Skip to content

Commit

Permalink
media: i2c: imx477: Parse and register properties
Browse files Browse the repository at this point in the history
Parse device properties and register controls for them using the V4L2
fwnode properties helpers.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
  • Loading branch information
pinchartl authored and pelwell committed Jul 16, 2020
1 parent bb3aac1 commit 77ac60b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion drivers/media/i2c/imx477.c
Original file line number Diff line number Diff line change
Expand Up @@ -1957,11 +1957,12 @@ static int imx477_init_controls(struct imx477 *imx477)
{
struct v4l2_ctrl_handler *ctrl_hdlr;
struct i2c_client *client = v4l2_get_subdevdata(&imx477->sd);
struct v4l2_fwnode_device_properties props;
unsigned int i;
int ret;

ctrl_hdlr = &imx477->ctrl_handler;
ret = v4l2_ctrl_handler_init(ctrl_hdlr, 14);
ret = v4l2_ctrl_handler_init(ctrl_hdlr, 16);
if (ret)
return ret;

Expand Down Expand Up @@ -2045,6 +2046,15 @@ static int imx477_init_controls(struct imx477 *imx477)
goto error;
}

ret = v4l2_fwnode_device_parse(&client->dev, &props);
if (ret)
goto error;

ret = v4l2_ctrl_new_fwnode_properties(ctrl_hdlr, &imx477_ctrl_ops,
&props);
if (ret)
goto error;

imx477->sd.ctrl_handler = ctrl_hdlr;

/* Setup exposure and frame/line length limits. */
Expand Down

0 comments on commit 77ac60b

Please sign in to comment.