* [PATCH 0/2] media: Use v4l2_subdev_get_fmt() @ 2023-08-30 4:53 Umang Jain 2023-08-30 4:53 ` [PATCH 1/2] media: i2c: imx214: " Umang Jain 2023-08-30 4:53 ` [PATCH 2/2] media: i2c: imx415: " Umang Jain 0 siblings, 2 replies; 7+ messages in thread From: Umang Jain @ 2023-08-30 4:53 UTC (permalink / raw) To: linux-media, linux-kernel Cc: Michael Riesch, Sakari Ailus, Mauro Carvalho Chehab, Ricardo Ribalda, Laurent Pinchart, Kieran Bingham, Umang Jain Driver of imx214 and imx415 uses subdev active state, there's no need to implement the .get_fmt() operation. Use the v4l2_subdev_get_fmt() helper instead. I don't have the sensors, so the patches are compile-tested only. Umang Jain (2): media: i2c: imx214: Use v4l2_subdev_get_fmt() media: i2c: imx415: Use v4l2_subdev_get_fmt() drivers/media/i2c/imx214.c | 17 +---------------- drivers/media/i2c/imx415.c | 11 +---------- 2 files changed, 2 insertions(+), 26 deletions(-) -- 2.41.0 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] media: i2c: imx214: Use v4l2_subdev_get_fmt() 2023-08-30 4:53 [PATCH 0/2] media: Use v4l2_subdev_get_fmt() Umang Jain @ 2023-08-30 4:53 ` Umang Jain 2023-08-30 7:19 ` Laurent Pinchart 2023-08-30 4:53 ` [PATCH 2/2] media: i2c: imx415: " Umang Jain 1 sibling, 1 reply; 7+ messages in thread From: Umang Jain @ 2023-08-30 4:53 UTC (permalink / raw) To: linux-media, linux-kernel Cc: Michael Riesch, Sakari Ailus, Mauro Carvalho Chehab, Ricardo Ribalda, Laurent Pinchart, Kieran Bingham, Umang Jain The imx214 driver uses the subdev active state, there's no need to implement the .get_fmt() operation manually. Use the v4l2_subdev_get_fmt() helper instead. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> --- drivers/media/i2c/imx214.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/drivers/media/i2c/imx214.c b/drivers/media/i2c/imx214.c index 2f9c8582f940..d8bdc52f552a 100644 --- a/drivers/media/i2c/imx214.c +++ b/drivers/media/i2c/imx214.c @@ -548,21 +548,6 @@ __imx214_get_pad_format(struct imx214 *imx214, } } -static int imx214_get_format(struct v4l2_subdev *sd, - struct v4l2_subdev_state *sd_state, - struct v4l2_subdev_format *format) -{ - struct imx214 *imx214 = to_imx214(sd); - - mutex_lock(&imx214->mutex); - format->format = *__imx214_get_pad_format(imx214, sd_state, - format->pad, - format->which); - mutex_unlock(&imx214->mutex); - - return 0; -} - static struct v4l2_rect * __imx214_get_pad_crop(struct imx214 *imx214, struct v4l2_subdev_state *sd_state, @@ -842,7 +827,7 @@ static const struct v4l2_subdev_pad_ops imx214_subdev_pad_ops = { .enum_mbus_code = imx214_enum_mbus_code, .enum_frame_size = imx214_enum_frame_size, .enum_frame_interval = imx214_enum_frame_interval, - .get_fmt = imx214_get_format, + .get_fmt = v4l2_subdev_get_fmt, .set_fmt = imx214_set_format, .get_selection = imx214_get_selection, .init_cfg = imx214_entity_init_cfg, -- 2.41.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] media: i2c: imx214: Use v4l2_subdev_get_fmt() 2023-08-30 4:53 ` [PATCH 1/2] media: i2c: imx214: " Umang Jain @ 2023-08-30 7:19 ` Laurent Pinchart 2023-08-30 7:22 ` Umang Jain 0 siblings, 1 reply; 7+ messages in thread From: Laurent Pinchart @ 2023-08-30 7:19 UTC (permalink / raw) To: Umang Jain Cc: linux-media, linux-kernel, Michael Riesch, Sakari Ailus, Mauro Carvalho Chehab, Ricardo Ribalda, Kieran Bingham On Wed, Aug 30, 2023 at 10:23:22AM +0530, Umang Jain wrote: > The imx214 driver uses the subdev active state, there's no Does it ? I don't see a call to v4l2_subdev_init_finalize(), and the imx214 struct has fmt and crop fields in which it stores the active format. > need to implement the .get_fmt() operation manually. Use the > v4l2_subdev_get_fmt() helper instead. > > Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> > --- > drivers/media/i2c/imx214.c | 17 +---------------- > 1 file changed, 1 insertion(+), 16 deletions(-) > > diff --git a/drivers/media/i2c/imx214.c b/drivers/media/i2c/imx214.c > index 2f9c8582f940..d8bdc52f552a 100644 > --- a/drivers/media/i2c/imx214.c > +++ b/drivers/media/i2c/imx214.c > @@ -548,21 +548,6 @@ __imx214_get_pad_format(struct imx214 *imx214, > } > } > > -static int imx214_get_format(struct v4l2_subdev *sd, > - struct v4l2_subdev_state *sd_state, > - struct v4l2_subdev_format *format) > -{ > - struct imx214 *imx214 = to_imx214(sd); > - > - mutex_lock(&imx214->mutex); > - format->format = *__imx214_get_pad_format(imx214, sd_state, > - format->pad, > - format->which); > - mutex_unlock(&imx214->mutex); > - > - return 0; > -} > - > static struct v4l2_rect * > __imx214_get_pad_crop(struct imx214 *imx214, > struct v4l2_subdev_state *sd_state, > @@ -842,7 +827,7 @@ static const struct v4l2_subdev_pad_ops imx214_subdev_pad_ops = { > .enum_mbus_code = imx214_enum_mbus_code, > .enum_frame_size = imx214_enum_frame_size, > .enum_frame_interval = imx214_enum_frame_interval, > - .get_fmt = imx214_get_format, > + .get_fmt = v4l2_subdev_get_fmt, > .set_fmt = imx214_set_format, > .get_selection = imx214_get_selection, > .init_cfg = imx214_entity_init_cfg, -- Regards, Laurent Pinchart ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] media: i2c: imx214: Use v4l2_subdev_get_fmt() 2023-08-30 7:19 ` Laurent Pinchart @ 2023-08-30 7:22 ` Umang Jain 0 siblings, 0 replies; 7+ messages in thread From: Umang Jain @ 2023-08-30 7:22 UTC (permalink / raw) To: Laurent Pinchart Cc: linux-media, linux-kernel, Michael Riesch, Sakari Ailus, Mauro Carvalho Chehab, Ricardo Ribalda, Kieran Bingham Hi Laurent, On 8/30/23 12:49 PM, Laurent Pinchart wrote: > On Wed, Aug 30, 2023 at 10:23:22AM +0530, Umang Jain wrote: >> The imx214 driver uses the subdev active state, there's no > Does it ? I don't see a call to v4l2_subdev_init_finalize(), and the > imx214 struct has fmt and crop fields in which it stores the active > format. Yes, It doesn't. Got confused with one of the pad ops (.init_cfg) which led me thinking this driver uses active state, whereas I should have checked v4l2_subdev_init_finalize() Apologies for the noise. This patch should be discarded. > >> need to implement the .get_fmt() operation manually. Use the >> v4l2_subdev_get_fmt() helper instead. >> >> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> >> --- >> drivers/media/i2c/imx214.c | 17 +---------------- >> 1 file changed, 1 insertion(+), 16 deletions(-) >> >> diff --git a/drivers/media/i2c/imx214.c b/drivers/media/i2c/imx214.c >> index 2f9c8582f940..d8bdc52f552a 100644 >> --- a/drivers/media/i2c/imx214.c >> +++ b/drivers/media/i2c/imx214.c >> @@ -548,21 +548,6 @@ __imx214_get_pad_format(struct imx214 *imx214, >> } >> } >> >> -static int imx214_get_format(struct v4l2_subdev *sd, >> - struct v4l2_subdev_state *sd_state, >> - struct v4l2_subdev_format *format) >> -{ >> - struct imx214 *imx214 = to_imx214(sd); >> - >> - mutex_lock(&imx214->mutex); >> - format->format = *__imx214_get_pad_format(imx214, sd_state, >> - format->pad, >> - format->which); >> - mutex_unlock(&imx214->mutex); >> - >> - return 0; >> -} >> - >> static struct v4l2_rect * >> __imx214_get_pad_crop(struct imx214 *imx214, >> struct v4l2_subdev_state *sd_state, >> @@ -842,7 +827,7 @@ static const struct v4l2_subdev_pad_ops imx214_subdev_pad_ops = { >> .enum_mbus_code = imx214_enum_mbus_code, >> .enum_frame_size = imx214_enum_frame_size, >> .enum_frame_interval = imx214_enum_frame_interval, >> - .get_fmt = imx214_get_format, >> + .get_fmt = v4l2_subdev_get_fmt, >> .set_fmt = imx214_set_format, >> .get_selection = imx214_get_selection, >> .init_cfg = imx214_entity_init_cfg, ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/2] media: i2c: imx415: Use v4l2_subdev_get_fmt() 2023-08-30 4:53 [PATCH 0/2] media: Use v4l2_subdev_get_fmt() Umang Jain 2023-08-30 4:53 ` [PATCH 1/2] media: i2c: imx214: " Umang Jain @ 2023-08-30 4:53 ` Umang Jain 2023-08-30 6:54 ` Michael Riesch 2023-08-30 7:20 ` Laurent Pinchart 1 sibling, 2 replies; 7+ messages in thread From: Umang Jain @ 2023-08-30 4:53 UTC (permalink / raw) To: linux-media, linux-kernel Cc: Michael Riesch, Sakari Ailus, Mauro Carvalho Chehab, Ricardo Ribalda, Laurent Pinchart, Kieran Bingham, Umang Jain The imx415 driver uses the subdev active state, there's no need to implement the .get_fmt() operation manually. Use the v4l2_subdev_get_fmt() helper instead. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> --- drivers/media/i2c/imx415.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/media/i2c/imx415.c b/drivers/media/i2c/imx415.c index 3f00172df3cc..9a7ac81edc28 100644 --- a/drivers/media/i2c/imx415.c +++ b/drivers/media/i2c/imx415.c @@ -842,15 +842,6 @@ static int imx415_enum_frame_size(struct v4l2_subdev *sd, return 0; } -static int imx415_get_format(struct v4l2_subdev *sd, - struct v4l2_subdev_state *state, - struct v4l2_subdev_format *fmt) -{ - fmt->format = *v4l2_subdev_get_pad_format(sd, state, fmt->pad); - - return 0; -} - static int imx415_set_format(struct v4l2_subdev *sd, struct v4l2_subdev_state *state, struct v4l2_subdev_format *fmt) @@ -913,7 +904,7 @@ static const struct v4l2_subdev_video_ops imx415_subdev_video_ops = { static const struct v4l2_subdev_pad_ops imx415_subdev_pad_ops = { .enum_mbus_code = imx415_enum_mbus_code, .enum_frame_size = imx415_enum_frame_size, - .get_fmt = imx415_get_format, + .get_fmt = v4l2_subdev_get_fmt, .set_fmt = imx415_set_format, .get_selection = imx415_get_selection, .init_cfg = imx415_init_cfg, -- 2.41.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] media: i2c: imx415: Use v4l2_subdev_get_fmt() 2023-08-30 4:53 ` [PATCH 2/2] media: i2c: imx415: " Umang Jain @ 2023-08-30 6:54 ` Michael Riesch 2023-08-30 7:20 ` Laurent Pinchart 1 sibling, 0 replies; 7+ messages in thread From: Michael Riesch @ 2023-08-30 6:54 UTC (permalink / raw) To: Umang Jain, linux-media, linux-kernel Cc: Sakari Ailus, Mauro Carvalho Chehab, Ricardo Ribalda, Laurent Pinchart, Kieran Bingham, Gerald Loacker Hi Umang, On 8/30/23 06:53, Umang Jain wrote: > The imx415 driver uses the subdev active state, there's > no need to implement the .get_fmt() operation manually. Use > the v4l2_subdev_get_fmt() helper instead. > > Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Thanks for the patch, we'll try to give it a test. Due to time constraints this might take a bit, though :-/ Cc: Gerald That said, without having it tested the patch LGTM: Reviewed-by: Michael Riesch <michael.riesch@wolfvision.net> Best regards, Michael > --- > drivers/media/i2c/imx415.c | 11 +---------- > 1 file changed, 1 insertion(+), 10 deletions(-) > > diff --git a/drivers/media/i2c/imx415.c b/drivers/media/i2c/imx415.c > index 3f00172df3cc..9a7ac81edc28 100644 > --- a/drivers/media/i2c/imx415.c > +++ b/drivers/media/i2c/imx415.c > @@ -842,15 +842,6 @@ static int imx415_enum_frame_size(struct v4l2_subdev *sd, > return 0; > } > > -static int imx415_get_format(struct v4l2_subdev *sd, > - struct v4l2_subdev_state *state, > - struct v4l2_subdev_format *fmt) > -{ > - fmt->format = *v4l2_subdev_get_pad_format(sd, state, fmt->pad); > - > - return 0; > -} > - > static int imx415_set_format(struct v4l2_subdev *sd, > struct v4l2_subdev_state *state, > struct v4l2_subdev_format *fmt) > @@ -913,7 +904,7 @@ static const struct v4l2_subdev_video_ops imx415_subdev_video_ops = { > static const struct v4l2_subdev_pad_ops imx415_subdev_pad_ops = { > .enum_mbus_code = imx415_enum_mbus_code, > .enum_frame_size = imx415_enum_frame_size, > - .get_fmt = imx415_get_format, > + .get_fmt = v4l2_subdev_get_fmt, > .set_fmt = imx415_set_format, > .get_selection = imx415_get_selection, > .init_cfg = imx415_init_cfg, ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] media: i2c: imx415: Use v4l2_subdev_get_fmt() 2023-08-30 4:53 ` [PATCH 2/2] media: i2c: imx415: " Umang Jain 2023-08-30 6:54 ` Michael Riesch @ 2023-08-30 7:20 ` Laurent Pinchart 1 sibling, 0 replies; 7+ messages in thread From: Laurent Pinchart @ 2023-08-30 7:20 UTC (permalink / raw) To: Umang Jain Cc: linux-media, linux-kernel, Michael Riesch, Sakari Ailus, Mauro Carvalho Chehab, Ricardo Ribalda, Kieran Bingham Hi Umang, Thank you for the patch. On Wed, Aug 30, 2023 at 10:23:23AM +0530, Umang Jain wrote: > The imx415 driver uses the subdev active state, there's > no need to implement the .get_fmt() operation manually. Use > the v4l2_subdev_get_fmt() helper instead. > > Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > --- > drivers/media/i2c/imx415.c | 11 +---------- > 1 file changed, 1 insertion(+), 10 deletions(-) > > diff --git a/drivers/media/i2c/imx415.c b/drivers/media/i2c/imx415.c > index 3f00172df3cc..9a7ac81edc28 100644 > --- a/drivers/media/i2c/imx415.c > +++ b/drivers/media/i2c/imx415.c > @@ -842,15 +842,6 @@ static int imx415_enum_frame_size(struct v4l2_subdev *sd, > return 0; > } > > -static int imx415_get_format(struct v4l2_subdev *sd, > - struct v4l2_subdev_state *state, > - struct v4l2_subdev_format *fmt) > -{ > - fmt->format = *v4l2_subdev_get_pad_format(sd, state, fmt->pad); > - > - return 0; > -} > - > static int imx415_set_format(struct v4l2_subdev *sd, > struct v4l2_subdev_state *state, > struct v4l2_subdev_format *fmt) > @@ -913,7 +904,7 @@ static const struct v4l2_subdev_video_ops imx415_subdev_video_ops = { > static const struct v4l2_subdev_pad_ops imx415_subdev_pad_ops = { > .enum_mbus_code = imx415_enum_mbus_code, > .enum_frame_size = imx415_enum_frame_size, > - .get_fmt = imx415_get_format, > + .get_fmt = v4l2_subdev_get_fmt, > .set_fmt = imx415_set_format, > .get_selection = imx415_get_selection, > .init_cfg = imx415_init_cfg, -- Regards, Laurent Pinchart ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-08-30 19:16 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-08-30 4:53 [PATCH 0/2] media: Use v4l2_subdev_get_fmt() Umang Jain 2023-08-30 4:53 ` [PATCH 1/2] media: i2c: imx214: " Umang Jain 2023-08-30 7:19 ` Laurent Pinchart 2023-08-30 7:22 ` Umang Jain 2023-08-30 4:53 ` [PATCH 2/2] media: i2c: imx415: " Umang Jain 2023-08-30 6:54 ` Michael Riesch 2023-08-30 7:20 ` Laurent Pinchart
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox