bcm27xx: add support for linux v5.15
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-5.15 / 950-0459-media-i2c-ov7251-Add-fwnode-properties-controls.patch
1 From 5aab08f11efaa42a97a9c046c956a16c331dd067 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Tue, 3 Aug 2021 11:33:33 +0100
4 Subject: [PATCH] media: i2c: ov7251: Add fwnode properties controls
5
6 Add call to v4l2_ctrl_new_fwnode_properties to read and
7 create the fwnode based controls.
8
9 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
10 ---
11 drivers/media/i2c/ov7251.c | 12 +++++++++++-
12 1 file changed, 11 insertions(+), 1 deletion(-)
13
14 --- a/drivers/media/i2c/ov7251.c
15 +++ b/drivers/media/i2c/ov7251.c
16 @@ -1256,6 +1256,7 @@ static const struct v4l2_subdev_ops ov72
17
18 static int ov7251_probe(struct i2c_client *client)
19 {
20 + struct v4l2_fwnode_device_properties props;
21 struct device *dev = &client->dev;
22 struct fwnode_handle *endpoint;
23 struct ov7251 *ov7251;
24 @@ -1341,7 +1342,7 @@ static int ov7251_probe(struct i2c_clien
25
26 mutex_init(&ov7251->lock);
27
28 - v4l2_ctrl_handler_init(&ov7251->ctrls, 7);
29 + v4l2_ctrl_handler_init(&ov7251->ctrls, 9);
30 ov7251->ctrls.lock = &ov7251->lock;
31
32 v4l2_ctrl_new_std(&ov7251->ctrls, &ov7251_ctrl_ops,
33 @@ -1377,6 +1378,15 @@ static int ov7251_probe(struct i2c_clien
34 goto free_ctrl;
35 }
36
37 + ret = v4l2_fwnode_device_parse(&client->dev, &props);
38 + if (ret)
39 + goto free_ctrl;
40 +
41 + ret = v4l2_ctrl_new_fwnode_properties(&ov7251->ctrls, &ov7251_ctrl_ops,
42 + &props);
43 + if (ret)
44 + goto free_ctrl;
45 +
46 v4l2_i2c_subdev_init(&ov7251->sd, client, &ov7251_subdev_ops);
47 ov7251->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
48 ov7251->pad.flags = MEDIA_PAD_FL_SOURCE;