bcm27xx: add support for linux v5.15
[openwrt/staging/wigyori.git] / target / linux / bcm27xx / patches-5.15 / 950-0457-media-i2c-imx290-Add-fwnode-properties-controls.patch
1 From 500db93808fcfa78292fe877f5120186f32df841 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Tue, 3 Aug 2021 11:25:59 +0100
4 Subject: [PATCH] media: i2c: imx290: 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/imx290.c | 12 +++++++++++-
12 1 file changed, 11 insertions(+), 1 deletion(-)
13
14 --- a/drivers/media/i2c/imx290.c
15 +++ b/drivers/media/i2c/imx290.c
16 @@ -1239,6 +1239,7 @@ static const struct of_device_id imx290_
17
18 static int imx290_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 /* Only CSI2 is supported for now: */
24 @@ -1360,7 +1361,7 @@ static int imx290_probe(struct i2c_clien
25 */
26 imx290_entity_init_cfg(&imx290->sd, NULL);
27
28 - v4l2_ctrl_handler_init(&imx290->ctrls, 9);
29 + v4l2_ctrl_handler_init(&imx290->ctrls, 11);
30
31 v4l2_ctrl_new_std(&imx290->ctrls, &imx290_ctrl_ops,
32 V4L2_CID_ANALOGUE_GAIN, 0, 100, 1, 0);
33 @@ -1408,6 +1409,15 @@ static int imx290_probe(struct i2c_clien
34 ARRAY_SIZE(imx290_test_pattern_menu) - 1,
35 0, 0, imx290_test_pattern_menu);
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(&imx290->ctrls, &imx290_ctrl_ops,
42 + &props);
43 + if (ret)
44 + goto free_ctrl;
45 +
46 imx290->sd.ctrl_handler = &imx290->ctrls;
47
48 if (imx290->ctrls.error) {