mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] media: i2c: imx355: Parse and register properties
@ 2024-08-11 11:17 Robert Mader
  2024-08-28  6:58 ` Sakari Ailus
  0 siblings, 1 reply; 2+ messages in thread
From: Robert Mader @ 2024-08-11 11:17 UTC (permalink / raw)
  To: linux-kernel
  Cc: jacopo.mondi, sakari.ailus, javierm, kieran.bingham, Robert Mader

Analogous to e.g. the imx219 driver. This enables propagating the
V4L2_CID_CAMERA_SENSOR_ROTATION and V4L2_CID_CAMERA_ORIENTATION
values so that userspace - e.g. libcamera - can detect the
correct rotation and orientation from the device tree.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

---

Changes since v1:
 - Slightly changed the commit message
 - Added RBs
---
 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.46.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] media: i2c: imx355: Parse and register properties
  2024-08-11 11:17 [PATCH v2] media: i2c: imx355: Parse and register properties Robert Mader
@ 2024-08-28  6:58 ` Sakari Ailus
  0 siblings, 0 replies; 2+ messages in thread
From: Sakari Ailus @ 2024-08-28  6:58 UTC (permalink / raw)
  To: Robert Mader; +Cc: linux-kernel, jacopo.mondi, javierm, kieran.bingham

Hi Robert,

On Sun, Aug 11, 2024 at 01:17:04PM +0200, Robert Mader wrote:
> Analogous to e.g. the imx219 driver. This enables propagating the
> V4L2_CID_CAMERA_SENSOR_ROTATION and V4L2_CID_CAMERA_ORIENTATION
> values so that userspace - e.g. libcamera - can detect the
> correct rotation and orientation from the device tree.
> 
> Signed-off-by: Robert Mader <robert.mader@collabora.com>
> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

Please always CC the linux-media list for Media tree patches. I've resent
this to linux-media this time.

-- 
Kind regards,

Sakari Ailus

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-08-28  6:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-11 11:17 [PATCH v2] media: i2c: imx355: Parse and register properties Robert Mader
2024-08-28  6:58 ` Sakari Ailus

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®