From d7afaa8a210db98544d53fc319187191ae9807b4 Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Tue, 3 Aug 2021 11:30:58 +0100 Subject: [PATCH] media: i2c: ov9281: Add fwnode properties controls Add call to v4l2_ctrl_new_fwnode_properties to read and create the fwnode based controls. Signed-off-by: Dave Stevenson --- drivers/media/i2c/ov9281.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) --- a/drivers/media/i2c/ov9281.c +++ b/drivers/media/i2c/ov9281.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #define OV9281_LINK_FREQ_400MHZ 400000000 @@ -1020,6 +1021,7 @@ static const struct v4l2_ctrl_ops ov9281 static int ov9281_initialize_controls(struct ov9281 *ov9281) { + struct v4l2_fwnode_device_properties props; const struct ov9281_mode *mode; struct v4l2_ctrl_handler *handler; struct v4l2_ctrl *ctrl; @@ -1029,7 +1031,7 @@ static int ov9281_initialize_controls(st handler = &ov9281->ctrl_handler; mode = ov9281->cur_mode; - ret = v4l2_ctrl_handler_init(handler, 9); + ret = v4l2_ctrl_handler_init(handler, 11); if (ret) return ret; handler->lock = &ov9281->mutex; @@ -1091,6 +1093,15 @@ static int ov9281_initialize_controls(st goto err_free_handler; } + ret = v4l2_fwnode_device_parse(&ov9281->client->dev, &props); + if (ret) + goto err_free_handler; + + ret = v4l2_ctrl_new_fwnode_properties(handler, &ov9281_ctrl_ops, + &props); + if (ret) + goto err_free_handler; + ov9281->subdev.ctrl_handler = handler; return 0;