]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
media: atomisp: gc0310: Add camera orientation and sensor rotation controls
authorHans de Goede <hansg@kernel.org>
Sun, 6 Jul 2025 09:53:40 +0000 (11:53 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 8 Jul 2025 06:43:30 +0000 (08:43 +0200)
Add camera orientation and sensor rotation controls using
the v4l2_fwnode_device_parse() and v4l2_ctrl_new_fwnode_properties()
helpers.

Signed-off-by: Hans de Goede <hansg@kernel.org>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Link: https://lore.kernel.org/r/20250517114106.43494-10-hdegoede@redhat.com
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/staging/media/atomisp/i2c/atomisp-gc0310.c

index dab736f5d4b398cef196c16e68d1a86b81b1923c..d0e7f0f8452b24e5fa816118910518561ae65870 100644 (file)
@@ -20,6 +20,7 @@
 #include <media/v4l2-cci.h>
 #include <media/v4l2-ctrls.h>
 #include <media/v4l2-device.h>
+#include <media/v4l2-fwnode.h>
 
 #define GC0310_NATIVE_WIDTH                    656
 #define GC0310_NATIVE_HEIGHT                   496
@@ -580,9 +581,12 @@ static const struct v4l2_subdev_ops gc0310_ops = {
 
 static int gc0310_init_controls(struct gc0310_device *sensor)
 {
+       struct i2c_client *client = v4l2_get_subdevdata(&sensor->sd);
        struct v4l2_ctrl_handler *hdl = &sensor->ctrls.handler;
+       struct v4l2_fwnode_device_properties props;
+       int ret;
 
-       v4l2_ctrl_handler_init(hdl, 6);
+       v4l2_ctrl_handler_init(hdl, 8);
 
        /* Use the same lock for controls as for everything else */
        hdl->lock = &sensor->input_lock;
@@ -614,6 +618,12 @@ static int gc0310_init_controls(struct gc0310_device *sensor)
                                  GC0310_H_BLANK_DEFAULT, 1,
                                  GC0310_H_BLANK_DEFAULT);
 
+       ret = v4l2_fwnode_device_parse(&client->dev, &props);
+       if (ret)
+               return ret;
+
+       v4l2_ctrl_new_fwnode_properties(hdl, &ctrl_ops, &props);
+
        if (hdl->error)
                return hdl->error;