8be530dd378a4b5c5034a294951cc9da35420be0
[openwrt/staging/chunkeey.git] / target / linux / bcm27xx / patches-5.10 / 950-0728-media-i2c-ov9281-Add-fwnode-properties-controls.patch
1 From d7afaa8a210db98544d53fc319187191ae9807b4 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Tue, 3 Aug 2021 11:30:58 +0100
4 Subject: [PATCH] media: i2c: ov9281: 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/ov9281.c | 13 ++++++++++++-
12 1 file changed, 12 insertions(+), 1 deletion(-)
13
14 --- a/drivers/media/i2c/ov9281.c
15 +++ b/drivers/media/i2c/ov9281.c
16 @@ -25,6 +25,7 @@
17 #include <media/media-entity.h>
18 #include <media/v4l2-async.h>
19 #include <media/v4l2-ctrls.h>
20 +#include <media/v4l2-fwnode.h>
21 #include <media/v4l2-subdev.h>
22
23 #define OV9281_LINK_FREQ_400MHZ 400000000
24 @@ -1020,6 +1021,7 @@ static const struct v4l2_ctrl_ops ov9281
25
26 static int ov9281_initialize_controls(struct ov9281 *ov9281)
27 {
28 + struct v4l2_fwnode_device_properties props;
29 const struct ov9281_mode *mode;
30 struct v4l2_ctrl_handler *handler;
31 struct v4l2_ctrl *ctrl;
32 @@ -1029,7 +1031,7 @@ static int ov9281_initialize_controls(st
33
34 handler = &ov9281->ctrl_handler;
35 mode = ov9281->cur_mode;
36 - ret = v4l2_ctrl_handler_init(handler, 9);
37 + ret = v4l2_ctrl_handler_init(handler, 11);
38 if (ret)
39 return ret;
40 handler->lock = &ov9281->mutex;
41 @@ -1091,6 +1093,15 @@ static int ov9281_initialize_controls(st
42 goto err_free_handler;
43 }
44
45 + ret = v4l2_fwnode_device_parse(&ov9281->client->dev, &props);
46 + if (ret)
47 + goto err_free_handler;
48 +
49 + ret = v4l2_ctrl_new_fwnode_properties(handler, &ov9281_ctrl_ops,
50 + &props);
51 + if (ret)
52 + goto err_free_handler;
53 +
54 ov9281->subdev.ctrl_handler = handler;
55
56 return 0;