From 8751d441ac6791553b888e0552f9d201733e4bd1 Mon Sep 17 00:00:00 2001
From: Robert Mader <robert.mader@collabora.com>
Date: Mon, 6 May 2024 16:36:05 -0700
Subject: [PATCH 133/463] media: i2c: gc2145: Parse and register properties

In order to propagate V4L2_CID_CAMERA_SENSOR_ROTATION and
V4L2_CID_CAMERA_ORIENTATION values from the DT to userspace.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
---
 drivers/media/i2c/gc2145.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/media/i2c/gc2145.c b/drivers/media/i2c/gc2145.c
index b505b3f07387c..d80e457f275b1 100644
--- a/drivers/media/i2c/gc2145.c
+++ b/drivers/media/i2c/gc2145.c
@@ -1272,6 +1272,7 @@ static int gc2145_init_controls(struct gc2145_dev *sensor)
 	const struct v4l2_ctrl_ops *ops = &gc2145_ctrl_ops;
 	struct gc2145_ctrls *ctrls = &sensor->ctrls;
 	struct v4l2_ctrl_handler *hdl = &ctrls->handler;
+	struct v4l2_fwnode_device_properties props;
 	//u8 wb_max = 0;
 	//u64 wb_mask = 0;
 	//unsigned int i;
@@ -1324,6 +1325,14 @@ static int gc2145_init_controls(struct gc2145_dev *sensor)
 	ctrls->vflip = v4l2_ctrl_new_std(hdl, ops,
 					 V4L2_CID_VFLIP, 0, 1, 1, 0);
 
+	ret = v4l2_fwnode_device_parse(&sensor->i2c_client->dev, &props);
+	if (ret)
+		goto free_ctrls;
+
+	ret = v4l2_ctrl_new_fwnode_properties(hdl, &gc2145_ctrl_ops,
+					      &props);
+	if (ret)
+		goto free_ctrls;
 
 	/* Test patterns */
 	ctrls->test_pattern =
-- 
2.46.0

