Skip to content

Commit 17898af

Browse files
jwrdegoedemchehab
authored andcommitted
media: ov2740: Add camera orientation and sensor rotation controls
Add camera orientation and sensor rotation controls using the v4l2_fwnode_device_parse() and v4l2_ctrl_new_fwnode_properties() helpers. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Tested-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
1 parent 4760155 commit 17898af

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

drivers/media/i2c/ov2740.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -755,15 +755,17 @@ static const struct v4l2_ctrl_ops ov2740_ctrl_ops = {
755755

756756
static int ov2740_init_controls(struct ov2740 *ov2740)
757757
{
758+
struct i2c_client *client = v4l2_get_subdevdata(&ov2740->sd);
758759
struct v4l2_ctrl_handler *ctrl_hdlr;
759760
const struct ov2740_mode *cur_mode;
760761
s64 exposure_max, h_blank, pixel_rate;
761762
u32 vblank_min, vblank_max, vblank_default;
763+
struct v4l2_fwnode_device_properties props;
762764
int size;
763765
int ret;
764766

765767
ctrl_hdlr = &ov2740->ctrl_handler;
766-
ret = v4l2_ctrl_handler_init(ctrl_hdlr, 8);
768+
ret = v4l2_ctrl_handler_init(ctrl_hdlr, 10);
767769
if (ret)
768770
return ret;
769771

@@ -813,6 +815,13 @@ static int ov2740_init_controls(struct ov2740 *ov2740)
813815
V4L2_CID_TEST_PATTERN,
814816
ARRAY_SIZE(ov2740_test_pattern_menu) - 1,
815817
0, 0, ov2740_test_pattern_menu);
818+
819+
ret = v4l2_fwnode_device_parse(&client->dev, &props);
820+
if (ret)
821+
return ret;
822+
823+
v4l2_ctrl_new_fwnode_properties(ctrl_hdlr, &ov2740_ctrl_ops, &props);
824+
816825
if (ctrl_hdlr->error) {
817826
v4l2_ctrl_handler_free(ctrl_hdlr);
818827
return ctrl_hdlr->error;

0 commit comments

Comments
 (0)