Use the newly introduced helper to parse properties from firmware and
register the associated v4l2 control.

Signed-off-by: Jacopo Mondi <jac...@jmondi.org>
---
 drivers/media/i2c/ov5670.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/media/i2c/ov5670.c b/drivers/media/i2c/ov5670.c
index 041fcbb4eebd..2bc57e85f721 100644
--- a/drivers/media/i2c/ov5670.c
+++ b/drivers/media/i2c/ov5670.c
@@ -7,6 +7,7 @@
 #include <linux/pm_runtime.h>
 #include <media/v4l2-ctrls.h>
 #include <media/v4l2-device.h>
+#include <media/v4l2-fwnode.h>
 
 #define OV5670_REG_CHIP_ID             0x300a
 #define OV5670_CHIP_ID                 0x005670
@@ -2059,6 +2060,7 @@ static const struct v4l2_ctrl_ops ov5670_ctrl_ops = {
 /* Initialize control handlers */
 static int ov5670_init_controls(struct ov5670 *ov5670)
 {
+       struct i2c_client *client = v4l2_get_subdevdata(&ov5670->sd);
        struct v4l2_ctrl_handler *ctrl_hdlr;
        s64 vblank_max;
        s64 vblank_def;
@@ -2129,6 +2131,11 @@ static int ov5670_init_controls(struct ov5670 *ov5670)
                goto error;
        }
 
+       ret = v4l2_fwnode_register_controls(dev_fwnode(&client->dev),
+                                           ctrl_hdlr, &ov5670_ctrl_ops);
+       if (ret)
+               goto error;
+
        ov5670->sd.ctrl_handler = ctrl_hdlr;
 
        return 0;
-- 
2.23.0

Reply via email to