]> www.infradead.org Git - linux.git/commitdiff
media: i2c: imx355: Parse and register properties
authorRobert Mader <robert.mader@collabora.com>
Sun, 11 Aug 2024 11:17:04 +0000 (13:17 +0200)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Sat, 31 Aug 2024 07:40:43 +0000 (09:40 +0200)
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>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
drivers/media/i2c/imx355.c

index 7e9c2f65fa0812bf0ba32f8feea612d393725b96..0dd25eeea60b617574e16d94264afa413c0f827d 100644 (file)
@@ -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;