Commit 36cc66b0 authored by Luca Weiss's avatar Luca Weiss Committed by Mauro Carvalho Chehab

media: i2c: ov2685: Add controls from fwnode

Add V4L2_CID_CAMERA_ORIENTATION and V4L2_CID_CAMERA_SENSOR_ROTATION
controls to the ov2685 driver by attempting to parse them from firmware.
Signed-off-by: default avatarLuca Weiss <luca@z3ntu.xyz>
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 74b506cb
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <media/media-entity.h> #include <media/media-entity.h>
#include <media/v4l2-async.h> #include <media/v4l2-async.h>
#include <media/v4l2-ctrls.h> #include <media/v4l2-ctrls.h>
#include <media/v4l2-fwnode.h>
#include <media/v4l2-subdev.h> #include <media/v4l2-subdev.h>
#define CHIP_ID 0x2685 #define CHIP_ID 0x2685
...@@ -613,13 +614,14 @@ static int ov2685_initialize_controls(struct ov2685 *ov2685) ...@@ -613,13 +614,14 @@ static int ov2685_initialize_controls(struct ov2685 *ov2685)
const struct ov2685_mode *mode; const struct ov2685_mode *mode;
struct v4l2_ctrl_handler *handler; struct v4l2_ctrl_handler *handler;
struct v4l2_ctrl *ctrl; struct v4l2_ctrl *ctrl;
struct v4l2_fwnode_device_properties props;
u64 exposure_max; u64 exposure_max;
u32 pixel_rate, h_blank; u32 pixel_rate, h_blank;
int ret; int ret;
handler = &ov2685->ctrl_handler; handler = &ov2685->ctrl_handler;
mode = ov2685->cur_mode; mode = ov2685->cur_mode;
ret = v4l2_ctrl_handler_init(handler, 8); ret = v4l2_ctrl_handler_init(handler, 10);
if (ret) if (ret)
return ret; return ret;
handler->lock = &ov2685->mutex; handler->lock = &ov2685->mutex;
...@@ -661,6 +663,15 @@ static int ov2685_initialize_controls(struct ov2685 *ov2685) ...@@ -661,6 +663,15 @@ static int ov2685_initialize_controls(struct ov2685 *ov2685)
ARRAY_SIZE(ov2685_test_pattern_menu) - 1, ARRAY_SIZE(ov2685_test_pattern_menu) - 1,
0, 0, ov2685_test_pattern_menu); 0, 0, ov2685_test_pattern_menu);
/* set properties from fwnode (e.g. rotation, orientation) */
ret = v4l2_fwnode_device_parse(&ov2685->client->dev, &props);
if (ret)
goto err_free_handler;
ret = v4l2_ctrl_new_fwnode_properties(handler, &ov2685_ctrl_ops, &props);
if (ret)
goto err_free_handler;
if (handler->error) { if (handler->error) {
ret = handler->error; ret = handler->error;
dev_err(&ov2685->client->dev, dev_err(&ov2685->client->dev,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment