From: Laurent Pinchart Date: Fri, 3 Jul 2020 22:45:08 +0000 (+0300) Subject: media: i2c: ov5647: Parse and register properties X-Git-Tag: accepted/tizen/unified/20240422.153132~696 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0d53315e8779856d6cc725294bf2e3d4a48942d6;p=platform%2Fkernel%2Flinux-rpi.git media: i2c: ov5647: Parse and register properties Parse device properties and register controls for them using the V4L2 fwnode properties helpers. Signed-off-by: Laurent Pinchart --- diff --git a/drivers/media/i2c/ov5647.c b/drivers/media/i2c/ov5647.c index f1e6543..97fb3c0 100644 --- a/drivers/media/i2c/ov5647.c +++ b/drivers/media/i2c/ov5647.c @@ -1303,10 +1303,11 @@ static const struct v4l2_ctrl_ops ov5647_ctrl_ops = { .s_ctrl = ov5647_s_ctrl, }; -static int ov5647_init_controls(struct ov5647 *sensor) +static int ov5647_init_controls(struct ov5647 *sensor, struct device *dev) { struct i2c_client *client = v4l2_get_subdevdata(&sensor->sd); int hblank, exposure_max, exposure_def; + struct v4l2_fwnode_device_properties props; v4l2_ctrl_handler_init(&sensor->ctrls, 9); @@ -1357,6 +1358,11 @@ static int ov5647_init_controls(struct ov5647 *sensor) ARRAY_SIZE(ov5647_test_pattern_menu) - 1, 0, 0, ov5647_test_pattern_menu); + v4l2_fwnode_device_parse(dev, &props); + + v4l2_ctrl_new_fwnode_properties(&sensor->ctrls, &ov5647_ctrl_ops, + &props); + if (sensor->ctrls.error) goto handler_free; @@ -1443,7 +1449,7 @@ static int ov5647_probe(struct i2c_client *client) sensor->mode = OV5647_DEFAULT_MODE; - ret = ov5647_init_controls(sensor); + ret = ov5647_init_controls(sensor, dev); if (ret) goto mutex_destroy;