summaryrefslogtreecommitdiff
path: root/drivers/media/i2c/ov8865.c
diff options
context:
space:
mode:
authorDaniel Scally <djrscally@gmail.com>2021-11-23 03:00:13 +0300
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2021-11-30 12:57:46 +0300
commit6eecfb34d3c4811686689f3dde657ad62d0b583b (patch)
tree573ddd746bdd8aa46284ea5a4a27e9560ca21e13 /drivers/media/i2c/ov8865.c
parentca28690ebe19f55fedb8ecb374f10a0d88a7366c (diff)
downloadlinux-6eecfb34d3c4811686689f3dde657ad62d0b583b.tar.xz
media: i2c: Add controls from fwnode to ov8865
Add V4L2_CID_CAMERA_ORIENTATION and V4L2_CID_CAMERA_SENSOR_ROTATION controls to the ov8865 driver by attempting to parse them from firmware. Signed-off-by: Daniel Scally <djrscally@gmail.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/media/i2c/ov8865.c')
-rw-r--r--drivers/media/i2c/ov8865.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/media/i2c/ov8865.c b/drivers/media/i2c/ov8865.c
index 811438c44b58..45b569f1e7c0 100644
--- a/drivers/media/i2c/ov8865.c
+++ b/drivers/media/i2c/ov8865.c
@@ -2515,6 +2515,7 @@ static int ov8865_ctrls_init(struct ov8865_sensor *sensor)
struct v4l2_ctrl_handler *handler = &ctrls->handler;
const struct v4l2_ctrl_ops *ops = &ov8865_ctrl_ops;
const struct ov8865_mode *mode = &ov8865_modes[0];
+ struct v4l2_fwnode_device_properties props;
unsigned int vblank_max, vblank_def;
unsigned int hblank;
int ret;
@@ -2578,6 +2579,15 @@ static int ov8865_ctrls_init(struct ov8865_sensor *sensor)
v4l2_ctrl_new_std(handler, NULL, V4L2_CID_PIXEL_RATE, 1,
INT_MAX, 1, 1);
+ /* set properties from fwnode (e.g. rotation, orientation) */
+ ret = v4l2_fwnode_device_parse(sensor->dev, &props);
+ if (ret)
+ goto error_ctrls;
+
+ ret = v4l2_ctrl_new_fwnode_properties(handler, ops, &props);
+ if (ret)
+ goto error_ctrls;
+
if (handler->error) {
ret = handler->error;
goto error_ctrls;