* [PATCH] media: i2c: imx355: Parse and register properties @ 2024-07-23 18:58 Robert Mader 2024-07-24 7:31 ` Jacopo Mondi 0 siblings, 1 reply; 4+ messages in thread From: Robert Mader @ 2024-07-23 18:58 UTC (permalink / raw) To: linux-kernel; +Cc: jacopo, sakari.ailus, javierm, Robert Mader Analogous to e.g. the imx219. This enables propagating V4L2_CID_CAMERA_SENSOR_ROTATION values so that libcamera can detect the correct rotation from the device tree and propagate it further to e.g. Pipewire. Signed-off-by: Robert Mader <robert.mader@collabora.com> --- drivers/media/i2c/imx355.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/imx355.c b/drivers/media/i2c/imx355.c index 7e9c2f65fa08..0dd25eeea60b 100644 --- a/drivers/media/i2c/imx355.c +++ b/drivers/media/i2c/imx355.c @@ -1520,6 +1520,7 @@ static const struct v4l2_subdev_internal_ops imx355_internal_ops = { static int imx355_init_controls(struct imx355 *imx355) { struct i2c_client *client = v4l2_get_subdevdata(&imx355->sd); + struct v4l2_fwnode_device_properties props; struct v4l2_ctrl_handler *ctrl_hdlr; s64 exposure_max; s64 vblank_def; @@ -1531,7 +1532,7 @@ static int imx355_init_controls(struct imx355 *imx355) int ret; ctrl_hdlr = &imx355->ctrl_handler; - ret = v4l2_ctrl_handler_init(ctrl_hdlr, 10); + ret = v4l2_ctrl_handler_init(ctrl_hdlr, 12); if (ret) return ret; @@ -1603,6 +1604,15 @@ static int imx355_init_controls(struct imx355 *imx355) goto error; } + ret = v4l2_fwnode_device_parse(&client->dev, &props); + if (ret) + goto error; + + ret = v4l2_ctrl_new_fwnode_properties(ctrl_hdlr, &imx355_ctrl_ops, + &props); + if (ret) + goto error; + imx355->sd.ctrl_handler = ctrl_hdlr; return 0; -- 2.45.2 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] media: i2c: imx355: Parse and register properties 2024-07-23 18:58 [PATCH] media: i2c: imx355: Parse and register properties Robert Mader @ 2024-07-24 7:31 ` Jacopo Mondi 2024-07-24 20:17 ` Robert Mader 0 siblings, 1 reply; 4+ messages in thread From: Jacopo Mondi @ 2024-07-24 7:31 UTC (permalink / raw) To: Robert Mader; +Cc: linux-kernel, jacopo, sakari.ailus, javierm Hi Robert On Tue, Jul 23, 2024 at 08:58:56PM GMT, Robert Mader wrote: > Analogous to e.g. the imx219. This enables propagating > V4L2_CID_CAMERA_SENSOR_ROTATION values so that libcamera and V4L2_CID_CAMERA_ORIENTATION > can detect the correct rotation from the device tree > and propagate it further to e.g. Pipewire. Well, yes, that's a consequence. As long as Linux is concerned, this serves to register the two above mentioned controls. > > Signed-off-by: Robert Mader <robert.mader@collabora.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Thanks j > --- > drivers/media/i2c/imx355.c | 12 +++++++++++- > 1 file changed, 11 insertions(+), 1 deletion(-) > > diff --git a/drivers/media/i2c/imx355.c b/drivers/media/i2c/imx355.c > index 7e9c2f65fa08..0dd25eeea60b 100644 > --- a/drivers/media/i2c/imx355.c > +++ b/drivers/media/i2c/imx355.c > @@ -1520,6 +1520,7 @@ static const struct v4l2_subdev_internal_ops imx355_internal_ops = { > static int imx355_init_controls(struct imx355 *imx355) > { > struct i2c_client *client = v4l2_get_subdevdata(&imx355->sd); > + struct v4l2_fwnode_device_properties props; > struct v4l2_ctrl_handler *ctrl_hdlr; > s64 exposure_max; > s64 vblank_def; > @@ -1531,7 +1532,7 @@ static int imx355_init_controls(struct imx355 *imx355) > int ret; > > ctrl_hdlr = &imx355->ctrl_handler; > - ret = v4l2_ctrl_handler_init(ctrl_hdlr, 10); > + ret = v4l2_ctrl_handler_init(ctrl_hdlr, 12); > if (ret) > return ret; > > @@ -1603,6 +1604,15 @@ static int imx355_init_controls(struct imx355 *imx355) > goto error; > } > > + ret = v4l2_fwnode_device_parse(&client->dev, &props); > + if (ret) > + goto error; > + > + ret = v4l2_ctrl_new_fwnode_properties(ctrl_hdlr, &imx355_ctrl_ops, > + &props); > + if (ret) > + goto error; > + > imx355->sd.ctrl_handler = ctrl_hdlr; > > return 0; > -- > 2.45.2 > ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] media: i2c: imx355: Parse and register properties 2024-07-24 7:31 ` Jacopo Mondi @ 2024-07-24 20:17 ` Robert Mader 2024-07-25 9:13 ` Kieran Bingham 0 siblings, 1 reply; 4+ messages in thread From: Robert Mader @ 2024-07-24 20:17 UTC (permalink / raw) To: Jacopo Mondi; +Cc: linux-kernel, jacopo, sakari.ailus, javierm Hi Jacopo, thanks for the quick review! Should I send a v2 for that (adding V4L2_CID_CAMERA_ORIENTATION and your RB to the commit message) - and if so should I first wait for more reviews or is that unnecessary/unlike to happen? Regards, Robert On 24.07.24 09:31, Jacopo Mondi wrote: > Hi Robert > > On Tue, Jul 23, 2024 at 08:58:56PM GMT, Robert Mader wrote: >> Analogous to e.g. the imx219. This enables propagating >> V4L2_CID_CAMERA_SENSOR_ROTATION values so that libcamera > and V4L2_CID_CAMERA_ORIENTATION > >> can detect the correct rotation from the device tree >> and propagate it further to e.g. Pipewire. > Well, yes, that's a consequence. As long as Linux is concerned, this > serves to register the two above mentioned controls. > >> Signed-off-by: Robert Mader <robert.mader@collabora.com> > Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> > > Thanks > j > >> --- >> drivers/media/i2c/imx355.c | 12 +++++++++++- >> 1 file changed, 11 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/media/i2c/imx355.c b/drivers/media/i2c/imx355.c >> index 7e9c2f65fa08..0dd25eeea60b 100644 >> --- a/drivers/media/i2c/imx355.c >> +++ b/drivers/media/i2c/imx355.c >> @@ -1520,6 +1520,7 @@ static const struct v4l2_subdev_internal_ops imx355_internal_ops = { >> static int imx355_init_controls(struct imx355 *imx355) >> { >> struct i2c_client *client = v4l2_get_subdevdata(&imx355->sd); >> + struct v4l2_fwnode_device_properties props; >> struct v4l2_ctrl_handler *ctrl_hdlr; >> s64 exposure_max; >> s64 vblank_def; >> @@ -1531,7 +1532,7 @@ static int imx355_init_controls(struct imx355 *imx355) >> int ret; >> >> ctrl_hdlr = &imx355->ctrl_handler; >> - ret = v4l2_ctrl_handler_init(ctrl_hdlr, 10); >> + ret = v4l2_ctrl_handler_init(ctrl_hdlr, 12); >> if (ret) >> return ret; >> >> @@ -1603,6 +1604,15 @@ static int imx355_init_controls(struct imx355 *imx355) >> goto error; >> } >> >> + ret = v4l2_fwnode_device_parse(&client->dev, &props); >> + if (ret) >> + goto error; >> + >> + ret = v4l2_ctrl_new_fwnode_properties(ctrl_hdlr, &imx355_ctrl_ops, >> + &props); >> + if (ret) >> + goto error; >> + >> imx355->sd.ctrl_handler = ctrl_hdlr; >> >> return 0; >> -- >> 2.45.2 >> -- Robert Mader Consultant Software Developer Collabora Ltd. Platinum Building, St John's Innovation Park, Cambridge CB4 0DS, UK Registered in England & Wales, no. 5513718 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] media: i2c: imx355: Parse and register properties 2024-07-24 20:17 ` Robert Mader @ 2024-07-25 9:13 ` Kieran Bingham 0 siblings, 0 replies; 4+ messages in thread From: Kieran Bingham @ 2024-07-25 9:13 UTC (permalink / raw) To: Jacopo Mondi, Robert Mader; +Cc: linux-kernel, jacopo, sakari.ailus, javierm Quoting Robert Mader (2024-07-24 21:17:23) > Hi Jacopo, > > thanks for the quick review! > > Should I send a v2 for that (adding V4L2_CID_CAMERA_ORIENTATION and your > RB to the commit message) - and if so should I first wait for more > reviews or is that unnecessary/unlike to happen? Reviews are usually slow, but this found it's way into my inbox because of a libcamera mention :-D (I do appreciate lore/lei for topic based subscriptions!) I don't think theres a specific need to wait for further reviews, but this might make it easier for you to send a v2 and know it's done ;-) Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > > Regards, > > Robert > > On 24.07.24 09:31, Jacopo Mondi wrote: > > Hi Robert > > > > On Tue, Jul 23, 2024 at 08:58:56PM GMT, Robert Mader wrote: > >> Analogous to e.g. the imx219. This enables propagating > >> V4L2_CID_CAMERA_SENSOR_ROTATION values so that libcamera > > and V4L2_CID_CAMERA_ORIENTATION > > > >> can detect the correct rotation from the device tree > >> and propagate it further to e.g. Pipewire. > > Well, yes, that's a consequence. As long as Linux is concerned, this > > serves to register the two above mentioned controls. > > > >> Signed-off-by: Robert Mader <robert.mader@collabora.com> > > Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> > > > > Thanks > > j > > > >> --- > >> drivers/media/i2c/imx355.c | 12 +++++++++++- > >> 1 file changed, 11 insertions(+), 1 deletion(-) > >> > >> diff --git a/drivers/media/i2c/imx355.c b/drivers/media/i2c/imx355.c > >> index 7e9c2f65fa08..0dd25eeea60b 100644 > >> --- a/drivers/media/i2c/imx355.c > >> +++ b/drivers/media/i2c/imx355.c > >> @@ -1520,6 +1520,7 @@ static const struct v4l2_subdev_internal_ops imx355_internal_ops = { > >> static int imx355_init_controls(struct imx355 *imx355) > >> { > >> struct i2c_client *client = v4l2_get_subdevdata(&imx355->sd); > >> + struct v4l2_fwnode_device_properties props; > >> struct v4l2_ctrl_handler *ctrl_hdlr; > >> s64 exposure_max; > >> s64 vblank_def; > >> @@ -1531,7 +1532,7 @@ static int imx355_init_controls(struct imx355 *imx355) > >> int ret; > >> > >> ctrl_hdlr = &imx355->ctrl_handler; > >> - ret = v4l2_ctrl_handler_init(ctrl_hdlr, 10); > >> + ret = v4l2_ctrl_handler_init(ctrl_hdlr, 12); > >> if (ret) > >> return ret; > >> > >> @@ -1603,6 +1604,15 @@ static int imx355_init_controls(struct imx355 *imx355) > >> goto error; > >> } > >> > >> + ret = v4l2_fwnode_device_parse(&client->dev, &props); > >> + if (ret) > >> + goto error; > >> + > >> + ret = v4l2_ctrl_new_fwnode_properties(ctrl_hdlr, &imx355_ctrl_ops, > >> + &props); > >> + if (ret) > >> + goto error; > >> + In the future (definitely not here) I hope there will be a way for us to factor out all of this common code from sensor drivers to make things more consistent. > >> imx355->sd.ctrl_handler = ctrl_hdlr; > >> > >> return 0; > >> -- > >> 2.45.2 > >> > -- > Robert Mader > Consultant Software Developer > > Collabora Ltd. > Platinum Building, St John's Innovation Park, Cambridge CB4 0DS, UK > Registered in England & Wales, no. 5513718 > ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-07-25 9:14 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2024-07-23 18:58 [PATCH] media: i2c: imx355: Parse and register properties Robert Mader 2024-07-24 7:31 ` Jacopo Mondi 2024-07-24 20:17 ` Robert Mader 2024-07-25 9:13 ` Kieran Bingham
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®