13f0c4c6b3dc32c8a5f1f6243208197112c46dc0
[openwrt/staging/ldir.git] /
1 From 10594f95e425d0eb7d36344cac5f276ab7e99658 Mon Sep 17 00:00:00 2001
2 From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
3 Date: Sun, 16 Oct 2022 09:15:19 +0300
4 Subject: [PATCH] media: i2c: imx290: Create controls for fwnode
5 properties
6
7 Upstream commit 4c9c93cf8657.
8
9 Create the V4L2_CID_ORIENTATION and V4L2_CID_ROTATION controls to
10 expose the corresponding fwnode properties.
11
12 Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
13 Acked-by: Alexander Stein <alexander.stein@ew.tq-group.com>
14 Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
15 ---
16 drivers/media/i2c/imx290.c | 10 +++++++++-
17 1 file changed, 9 insertions(+), 1 deletion(-)
18
19 --- a/drivers/media/i2c/imx290.c
20 +++ b/drivers/media/i2c/imx290.c
21 @@ -896,10 +896,15 @@ static const struct media_entity_operati
22
23 static int imx290_ctrl_init(struct imx290 *imx290)
24 {
25 + struct v4l2_fwnode_device_properties props;
26 unsigned int blank;
27 int ret;
28
29 - v4l2_ctrl_handler_init(&imx290->ctrls, 7);
30 + ret = v4l2_fwnode_device_parse(imx290->dev, &props);
31 + if (ret < 0)
32 + return ret;
33 +
34 + v4l2_ctrl_handler_init(&imx290->ctrls, 9);
35 imx290->ctrls.lock = &imx290->lock;
36
37 /*
38 @@ -954,6 +959,9 @@ static int imx290_ctrl_init(struct imx29
39 if (imx290->vblank)
40 imx290->vblank->flags |= V4L2_CTRL_FLAG_READ_ONLY;
41
42 + v4l2_ctrl_new_fwnode_properties(&imx290->ctrls, &imx290_ctrl_ops,
43 + &props);
44 +
45 imx290->sd.ctrl_handler = &imx290->ctrls;
46
47 if (imx290->ctrls.error) {