* [PATCH] media: i2c: vgxy61: Report stream using frame descriptors
@ 2025-07-04 9:28 Julien Massot
2025-07-21 11:03 ` Benjamin Mugnier
2025-08-15 6:04 ` Sakari Ailus
0 siblings, 2 replies; 5+ messages in thread
From: Julien Massot @ 2025-07-04 9:28 UTC (permalink / raw)
To: kernel, Sakari Ailus, Benjamin Mugnier, Sylvain Petinot,
Mauro Carvalho Chehab
Cc: linux-media, linux-kernel, Julien Massot
Add support for .get_frame_desc() to report CSI-2 virtual channel
and data type information. This allows CSI-2 receivers to properly
interpret the stream without inferring the data type from the pixel
format.
Signed-off-by: Julien Massot <julien.massot@collabora.com>
---
drivers/media/i2c/vgxy61.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/media/i2c/vgxy61.c b/drivers/media/i2c/vgxy61.c
index 5b0479f3a3c0592be430cefe5a1ab9a76812ba84..44d6c8d8fbf8d6182e42d44e129bc45945ee0da5 100644
--- a/drivers/media/i2c/vgxy61.c
+++ b/drivers/media/i2c/vgxy61.c
@@ -1181,6 +1181,21 @@ static int vgxy61_s_stream(struct v4l2_subdev *sd, int enable)
return ret;
}
+static int vgxy61_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
+ struct v4l2_mbus_frame_desc *fd)
+{
+ struct vgxy61_dev *sensor = to_vgxy61_dev(sd);
+
+ fd->type = V4L2_MBUS_FRAME_DESC_TYPE_CSI2;
+ fd->num_entries = 1;
+ fd->entry[0].pixelcode = sensor->fmt.code;
+ fd->entry[0].stream = 0;
+ fd->entry[0].bus.csi2.vc = 0;
+ fd->entry[0].bus.csi2.dt = get_data_type_by_code(sensor->fmt.code);
+
+ return 0;
+}
+
static int vgxy61_set_fmt(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_format *format)
@@ -1402,6 +1417,7 @@ static const struct v4l2_subdev_pad_ops vgxy61_pad_ops = {
.set_fmt = vgxy61_set_fmt,
.get_selection = vgxy61_get_selection,
.enum_frame_size = vgxy61_enum_frame_size,
+ .get_frame_desc = vgxy61_get_frame_desc,
};
static const struct v4l2_subdev_ops vgxy61_subdev_ops = {
---
base-commit: 1343433ed38923a21425c602e92120a1f1db5f7a
change-id: 20250704-vgxy61-frame-desc-2a6d3c6cab43
Best regards,
--
Julien Massot <julien.massot@collabora.com>
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] media: i2c: vgxy61: Report stream using frame descriptors
2025-07-04 9:28 [PATCH] media: i2c: vgxy61: Report stream using frame descriptors Julien Massot
@ 2025-07-21 11:03 ` Benjamin Mugnier
2025-08-15 6:04 ` Sakari Ailus
1 sibling, 0 replies; 5+ messages in thread
From: Benjamin Mugnier @ 2025-07-21 11:03 UTC (permalink / raw)
To: Julien Massot, kernel, Sakari Ailus, Sylvain Petinot,
Mauro Carvalho Chehab
Cc: linux-media, linux-kernel
Hi Julien,
Thank you for your patch.
On 7/4/25 11:28, Julien Massot wrote:
> Add support for .get_frame_desc() to report CSI-2 virtual channel
> and data type information. This allows CSI-2 receivers to properly
> interpret the stream without inferring the data type from the pixel
> format.
>
> Signed-off-by: Julien Massot <julien.massot@collabora.com>
Reviewed-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com>
> ---
> drivers/media/i2c/vgxy61.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/drivers/media/i2c/vgxy61.c b/drivers/media/i2c/vgxy61.c
> index 5b0479f3a3c0592be430cefe5a1ab9a76812ba84..44d6c8d8fbf8d6182e42d44e129bc45945ee0da5 100644
> --- a/drivers/media/i2c/vgxy61.c
> +++ b/drivers/media/i2c/vgxy61.c
> @@ -1181,6 +1181,21 @@ static int vgxy61_s_stream(struct v4l2_subdev *sd, int enable)
> return ret;
> }
>
> +static int vgxy61_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
> + struct v4l2_mbus_frame_desc *fd)
> +{
> + struct vgxy61_dev *sensor = to_vgxy61_dev(sd);
> +
> + fd->type = V4L2_MBUS_FRAME_DESC_TYPE_CSI2;
> + fd->num_entries = 1;
> + fd->entry[0].pixelcode = sensor->fmt.code;
> + fd->entry[0].stream = 0;
> + fd->entry[0].bus.csi2.vc = 0;
> + fd->entry[0].bus.csi2.dt = get_data_type_by_code(sensor->fmt.code);
> +
> + return 0;
> +}
> +
> static int vgxy61_set_fmt(struct v4l2_subdev *sd,
> struct v4l2_subdev_state *sd_state,
> struct v4l2_subdev_format *format)
> @@ -1402,6 +1417,7 @@ static const struct v4l2_subdev_pad_ops vgxy61_pad_ops = {
> .set_fmt = vgxy61_set_fmt,
> .get_selection = vgxy61_get_selection,
> .enum_frame_size = vgxy61_enum_frame_size,
> + .get_frame_desc = vgxy61_get_frame_desc,
> };
>
> static const struct v4l2_subdev_ops vgxy61_subdev_ops = {
>
> ---
> base-commit: 1343433ed38923a21425c602e92120a1f1db5f7a
> change-id: 20250704-vgxy61-frame-desc-2a6d3c6cab43
>
> Best regards,
--
Regards,
Benjamin
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] media: i2c: vgxy61: Report stream using frame descriptors
2025-07-04 9:28 [PATCH] media: i2c: vgxy61: Report stream using frame descriptors Julien Massot
2025-07-21 11:03 ` Benjamin Mugnier
@ 2025-08-15 6:04 ` Sakari Ailus
2025-08-26 7:21 ` Julien Massot
1 sibling, 1 reply; 5+ messages in thread
From: Sakari Ailus @ 2025-08-15 6:04 UTC (permalink / raw)
To: Julien Massot
Cc: kernel, Benjamin Mugnier, Sylvain Petinot, Mauro Carvalho Chehab,
linux-media, linux-kernel
Hi Julien,
On Fri, Jul 04, 2025 at 11:28:24AM +0200, Julien Massot wrote:
> Add support for .get_frame_desc() to report CSI-2 virtual channel
> and data type information. This allows CSI-2 receivers to properly
> interpret the stream without inferring the data type from the pixel
> format.
>
> Signed-off-by: Julien Massot <julien.massot@collabora.com>
> ---
> drivers/media/i2c/vgxy61.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/drivers/media/i2c/vgxy61.c b/drivers/media/i2c/vgxy61.c
> index 5b0479f3a3c0592be430cefe5a1ab9a76812ba84..44d6c8d8fbf8d6182e42d44e129bc45945ee0da5 100644
> --- a/drivers/media/i2c/vgxy61.c
> +++ b/drivers/media/i2c/vgxy61.c
> @@ -1181,6 +1181,21 @@ static int vgxy61_s_stream(struct v4l2_subdev *sd, int enable)
> return ret;
> }
>
> +static int vgxy61_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
> + struct v4l2_mbus_frame_desc *fd)
> +{
> + struct vgxy61_dev *sensor = to_vgxy61_dev(sd);
> +
> + fd->type = V4L2_MBUS_FRAME_DESC_TYPE_CSI2;
> + fd->num_entries = 1;
> + fd->entry[0].pixelcode = sensor->fmt.code;
> + fd->entry[0].stream = 0;
> + fd->entry[0].bus.csi2.vc = 0;
> + fd->entry[0].bus.csi2.dt = get_data_type_by_code(sensor->fmt.code);
> +
> + return 0;
> +}
> +
> static int vgxy61_set_fmt(struct v4l2_subdev *sd,
> struct v4l2_subdev_state *sd_state,
> struct v4l2_subdev_format *format)
> @@ -1402,6 +1417,7 @@ static const struct v4l2_subdev_pad_ops vgxy61_pad_ops = {
> .set_fmt = vgxy61_set_fmt,
> .get_selection = vgxy61_get_selection,
> .enum_frame_size = vgxy61_enum_frame_size,
> + .get_frame_desc = vgxy61_get_frame_desc,
> };
>
> static const struct v4l2_subdev_ops vgxy61_subdev_ops = {
>
I guess this is correct as such, but does it provide any information that
isn't already available? I.e. I wouldn't add it just for the sake of it.
--
Regards,
Sakari Ailus
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] media: i2c: vgxy61: Report stream using frame descriptors
2025-08-15 6:04 ` Sakari Ailus
@ 2025-08-26 7:21 ` Julien Massot
2025-08-26 10:00 ` Sakari Ailus
0 siblings, 1 reply; 5+ messages in thread
From: Julien Massot @ 2025-08-26 7:21 UTC (permalink / raw)
To: Sakari Ailus
Cc: kernel, Benjamin Mugnier, Sylvain Petinot, Mauro Carvalho Chehab,
linux-media, linux-kernel
Hi Sakari,
On Fri, 2025-08-15 at 06:04 +0000, Sakari Ailus wrote:
> Hi Julien,
>
> On Fri, Jul 04, 2025 at 11:28:24AM +0200, Julien Massot wrote:
> > Add support for .get_frame_desc() to report CSI-2 virtual channel
> > and data type information. This allows CSI-2 receivers to properly
> > interpret the stream without inferring the data type from the pixel
> > format.
> >
> > Signed-off-by: Julien Massot <julien.massot@collabora.com>
> > ---
> > drivers/media/i2c/vgxy61.c | 16 ++++++++++++++++
> > 1 file changed, 16 insertions(+)
> >
> > diff --git a/drivers/media/i2c/vgxy61.c b/drivers/media/i2c/vgxy61.c
> > index
> > 5b0479f3a3c0592be430cefe5a1ab9a76812ba84..44d6c8d8fbf8d6182e42d44e129b
> > c45945ee0da5 100644
> > --- a/drivers/media/i2c/vgxy61.c
> > +++ b/drivers/media/i2c/vgxy61.c
> > @@ -1181,6 +1181,21 @@ static int vgxy61_s_stream(struct v4l2_subdev
> > *sd, int enable)
> > return ret;
> > }
> >
> > +static int vgxy61_get_frame_desc(struct v4l2_subdev *sd, unsigned int
> > pad,
> > + struct v4l2_mbus_frame_desc *fd)
> > +{
> > + struct vgxy61_dev *sensor = to_vgxy61_dev(sd);
> > +
> > + fd->type = V4L2_MBUS_FRAME_DESC_TYPE_CSI2;
> > + fd->num_entries = 1;
> > + fd->entry[0].pixelcode = sensor->fmt.code;
> > + fd->entry[0].stream = 0;
> > + fd->entry[0].bus.csi2.vc = 0;
> > + fd->entry[0].bus.csi2.dt = get_data_type_by_code(sensor-
> > >fmt.code);
> > +
> > + return 0;
> > +}
> > +
> > static int vgxy61_set_fmt(struct v4l2_subdev *sd,
> > struct v4l2_subdev_state *sd_state,
> > struct v4l2_subdev_format *format)
> > @@ -1402,6 +1417,7 @@ static const struct v4l2_subdev_pad_ops
> > vgxy61_pad_ops = {
> > .set_fmt = vgxy61_set_fmt,
> > .get_selection = vgxy61_get_selection,
> > .enum_frame_size = vgxy61_enum_frame_size,
> > + .get_frame_desc = vgxy61_get_frame_desc,
> > };
> >
> > static const struct v4l2_subdev_ops vgxy61_subdev_ops = {
> >
>
> I guess this is correct as such, but does it provide any information
> that
> isn't already available? I.e. I wouldn't add it just for the sake of it.
Perhaps, I missed something. Without the get_frame_desc the CSI receiver
have to infers the datatype based on the pixel format.
I made this patch because some CSI receivers, such as the upcoming GMSL2
framework are relying on the frame desc to update its routing table.
So, it will only support sensors implementing the get_frame_desc function.
Regards,
Julien
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] media: i2c: vgxy61: Report stream using frame descriptors
2025-08-26 7:21 ` Julien Massot
@ 2025-08-26 10:00 ` Sakari Ailus
0 siblings, 0 replies; 5+ messages in thread
From: Sakari Ailus @ 2025-08-26 10:00 UTC (permalink / raw)
To: Julien Massot
Cc: kernel, Benjamin Mugnier, Sylvain Petinot, Mauro Carvalho Chehab,
linux-media, linux-kernel
Hi Julien,
On Tue, Aug 26, 2025 at 09:21:29AM +0200, Julien Massot wrote:
> Hi Sakari,
>
> On Fri, 2025-08-15 at 06:04 +0000, Sakari Ailus wrote:
> > Hi Julien,
> >
> > On Fri, Jul 04, 2025 at 11:28:24AM +0200, Julien Massot wrote:
> > > Add support for .get_frame_desc() to report CSI-2 virtual channel
> > > and data type information. This allows CSI-2 receivers to properly
> > > interpret the stream without inferring the data type from the pixel
> > > format.
> > >
> > > Signed-off-by: Julien Massot <julien.massot@collabora.com>
> > > ---
> > > drivers/media/i2c/vgxy61.c | 16 ++++++++++++++++
> > > 1 file changed, 16 insertions(+)
> > >
> > > diff --git a/drivers/media/i2c/vgxy61.c b/drivers/media/i2c/vgxy61.c
> > > index
> > > 5b0479f3a3c0592be430cefe5a1ab9a76812ba84..44d6c8d8fbf8d6182e42d44e129b
> > > c45945ee0da5 100644
> > > --- a/drivers/media/i2c/vgxy61.c
> > > +++ b/drivers/media/i2c/vgxy61.c
> > > @@ -1181,6 +1181,21 @@ static int vgxy61_s_stream(struct v4l2_subdev
> > > *sd, int enable)
> > > return ret;
> > > }
> > >
> > > +static int vgxy61_get_frame_desc(struct v4l2_subdev *sd, unsigned int
> > > pad,
> > > + struct v4l2_mbus_frame_desc *fd)
> > > +{
> > > + struct vgxy61_dev *sensor = to_vgxy61_dev(sd);
> > > +
> > > + fd->type = V4L2_MBUS_FRAME_DESC_TYPE_CSI2;
> > > + fd->num_entries = 1;
> > > + fd->entry[0].pixelcode = sensor->fmt.code;
> > > + fd->entry[0].stream = 0;
> > > + fd->entry[0].bus.csi2.vc = 0;
> > > + fd->entry[0].bus.csi2.dt = get_data_type_by_code(sensor-
> > > >fmt.code);
> > > +
> > > + return 0;
> > > +}
> > > +
> > > static int vgxy61_set_fmt(struct v4l2_subdev *sd,
> > > struct v4l2_subdev_state *sd_state,
> > > struct v4l2_subdev_format *format)
> > > @@ -1402,6 +1417,7 @@ static const struct v4l2_subdev_pad_ops
> > > vgxy61_pad_ops = {
> > > .set_fmt = vgxy61_set_fmt,
> > > .get_selection = vgxy61_get_selection,
> > > .enum_frame_size = vgxy61_enum_frame_size,
> > > + .get_frame_desc = vgxy61_get_frame_desc,
> > > };
> > >
> > > static const struct v4l2_subdev_ops vgxy61_subdev_ops = {
> > >
> >
> > I guess this is correct as such, but does it provide any information
> > that
> > isn't already available? I.e. I wouldn't add it just for the sake of it.
> Perhaps, I missed something. Without the get_frame_desc the CSI receiver
> have to infers the datatype based on the pixel format.
I think we should have a function in the framework to do that. Oh, we
actually already do have the function, call_get_mbus_config(), it just
doesn't get the format yet. Currently receiver drivers handle this by
themselves but that doesn't scale very well.
>
> I made this patch because some CSI receivers, such as the upcoming GMSL2
> framework are relying on the frame desc to update its routing table.
> So, it will only support sensors implementing the get_frame_desc function.
--
Regards,
Sakari Ailus
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-08-26 10:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-04 9:28 [PATCH] media: i2c: vgxy61: Report stream using frame descriptors Julien Massot
2025-07-21 11:03 ` Benjamin Mugnier
2025-08-15 6:04 ` Sakari Ailus
2025-08-26 7:21 ` Julien Massot
2025-08-26 10:00 ` Sakari Ailus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).