dc5584e84745eff470fcf586ce1ff22e9203defb
[openwrt/staging/ldir.git] / target / linux / bcm27xx / patches-5.4 / 950-0910-media-i2c-imx219-Parse-and-register-properties.patch
1 From db0889b08409484160a9082bc0b5f39877fe9591 Mon Sep 17 00:00:00 2001
2 From: Jacopo Mondi <jacopo@jmondi.org>
3 Date: Sat, 9 May 2020 11:04:55 +0200
4 Subject: [PATCH] media: i2c: imx219: Parse and register properties
5
6 Parse device properties and register controls for them using the newly
7 introduced helpers.
8
9 Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
10 Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
11 Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
12
13 Commit ad3a44cbd1b2e1559c6b93e80dc0c9c29632969a upstream
14
15 Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
16 ---
17 drivers/media/i2c/imx219.c | 12 +++++++++++-
18 1 file changed, 11 insertions(+), 1 deletion(-)
19
20 --- a/drivers/media/i2c/imx219.c
21 +++ b/drivers/media/i2c/imx219.c
22 @@ -1348,11 +1348,12 @@ static int imx219_init_controls(struct i
23 struct i2c_client *client = v4l2_get_subdevdata(&imx219->sd);
24 struct v4l2_ctrl_handler *ctrl_hdlr;
25 unsigned int height = imx219->mode->height;
26 + struct v4l2_fwnode_device_properties props;
27 int exposure_max, exposure_def, hblank;
28 int i, ret;
29
30 ctrl_hdlr = &imx219->ctrl_handler;
31 - ret = v4l2_ctrl_handler_init(ctrl_hdlr, 9);
32 + ret = v4l2_ctrl_handler_init(ctrl_hdlr, 11);
33 if (ret)
34 return ret;
35
36 @@ -1431,6 +1432,15 @@ static int imx219_init_controls(struct i
37 goto error;
38 }
39
40 + ret = v4l2_fwnode_device_parse(&client->dev, &props);
41 + if (ret)
42 + goto error;
43 +
44 + ret = v4l2_ctrl_new_fwnode_properties(ctrl_hdlr, &imx219_ctrl_ops,
45 + &props);
46 + if (ret)
47 + goto error;
48 +
49 imx219->sd.ctrl_handler = ctrl_hdlr;
50
51 return 0;