bcm27xx: add support for linux v5.15
[openwrt/staging/chunkeey.git] / target / linux / bcm27xx / patches-5.15 / 950-0370-media-i2c-ov5647-Parse-and-register-properties.patch
1 From c9ec0108b09b7222be4146d8fe543cf1def5cf69 Mon Sep 17 00:00:00 2001
2 From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
3 Date: Sat, 4 Jul 2020 01:45:08 +0300
4 Subject: [PATCH] media: i2c: ov5647: Parse and register properties
5
6 Parse device properties and register controls for them using the V4L2
7 fwnode properties helpers.
8
9 Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
10 ---
11 drivers/media/i2c/ov5647.c | 10 ++++++++--
12 1 file changed, 8 insertions(+), 2 deletions(-)
13
14 --- a/drivers/media/i2c/ov5647.c
15 +++ b/drivers/media/i2c/ov5647.c
16 @@ -1291,10 +1291,11 @@ static const struct v4l2_ctrl_ops ov5647
17 .s_ctrl = ov5647_s_ctrl,
18 };
19
20 -static int ov5647_init_controls(struct ov5647 *sensor)
21 +static int ov5647_init_controls(struct ov5647 *sensor, struct device *dev)
22 {
23 struct i2c_client *client = v4l2_get_subdevdata(&sensor->sd);
24 int hblank, exposure_max, exposure_def;
25 + struct v4l2_fwnode_device_properties props;
26
27 v4l2_ctrl_handler_init(&sensor->ctrls, 8);
28
29 @@ -1340,6 +1341,11 @@ static int ov5647_init_controls(struct o
30 sensor->mode->vts -
31 sensor->mode->format.height);
32
33 + v4l2_fwnode_device_parse(dev, &props);
34 +
35 + v4l2_ctrl_new_fwnode_properties(&sensor->ctrls, &ov5647_ctrl_ops,
36 + &props);
37 +
38 if (sensor->ctrls.error)
39 goto handler_free;
40
41 @@ -1426,7 +1432,7 @@ static int ov5647_probe(struct i2c_clien
42
43 sensor->mode = OV5647_DEFAULT_MODE;
44
45 - ret = ov5647_init_controls(sensor);
46 + ret = ov5647_init_controls(sensor, dev);
47 if (ret)
48 goto mutex_destroy;
49