mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
media: ov02c10: Support hflip and vflip
Support horizontal and vertical flip, which is necessary to handle upside-down mounted sensors. Suggested-by: Bryan O'Donoghue <bod@kernel.org> Signed-off-by: Sebastian Reichel <sre@kernel.org> Reviewed-by: Bryan O'Donoghue <bod@kernel.org> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
This commit is contained in:
committed by
Hans Verkuil
parent
d5ebe3f7d1
commit
b7cd2ba3f6
@@ -385,6 +385,8 @@ struct ov02c10 {
|
||||
struct v4l2_ctrl *vblank;
|
||||
struct v4l2_ctrl *hblank;
|
||||
struct v4l2_ctrl *exposure;
|
||||
struct v4l2_ctrl *hflip;
|
||||
struct v4l2_ctrl *vflip;
|
||||
|
||||
struct clk *img_clk;
|
||||
struct gpio_desc *reset;
|
||||
@@ -462,6 +464,16 @@ static int ov02c10_set_ctrl(struct v4l2_ctrl *ctrl)
|
||||
ret = ov02c10_test_pattern(ov02c10, ctrl->val);
|
||||
break;
|
||||
|
||||
case V4L2_CID_HFLIP:
|
||||
cci_update_bits(ov02c10->regmap, OV02C10_ROTATE_CONTROL,
|
||||
BIT(3), ov02c10->hflip->val << 3, &ret);
|
||||
break;
|
||||
|
||||
case V4L2_CID_VFLIP:
|
||||
cci_update_bits(ov02c10->regmap, OV02C10_ROTATE_CONTROL,
|
||||
BIT(4), ov02c10->vflip->val << 4, &ret);
|
||||
break;
|
||||
|
||||
default:
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
@@ -485,7 +497,7 @@ static int ov02c10_init_controls(struct ov02c10 *ov02c10)
|
||||
s64 exposure_max, h_blank, pixel_rate;
|
||||
int ret;
|
||||
|
||||
v4l2_ctrl_handler_init(ctrl_hdlr, 10);
|
||||
v4l2_ctrl_handler_init(ctrl_hdlr, 12);
|
||||
|
||||
ov02c10->link_freq = v4l2_ctrl_new_int_menu(ctrl_hdlr,
|
||||
&ov02c10_ctrl_ops,
|
||||
@@ -536,6 +548,17 @@ static int ov02c10_init_controls(struct ov02c10 *ov02c10)
|
||||
exposure_max,
|
||||
OV02C10_EXPOSURE_STEP,
|
||||
exposure_max);
|
||||
|
||||
ov02c10->hflip = v4l2_ctrl_new_std(ctrl_hdlr, &ov02c10_ctrl_ops,
|
||||
V4L2_CID_HFLIP, 0, 1, 1, 0);
|
||||
if (ov02c10->hflip)
|
||||
ov02c10->hflip->flags |= V4L2_CTRL_FLAG_MODIFY_LAYOUT;
|
||||
|
||||
ov02c10->vflip = v4l2_ctrl_new_std(ctrl_hdlr, &ov02c10_ctrl_ops,
|
||||
V4L2_CID_VFLIP, 0, 1, 1, 0);
|
||||
if (ov02c10->vflip)
|
||||
ov02c10->vflip->flags |= V4L2_CTRL_FLAG_MODIFY_LAYOUT;
|
||||
|
||||
v4l2_ctrl_new_std_menu_items(ctrl_hdlr, &ov02c10_ctrl_ops,
|
||||
V4L2_CID_TEST_PATTERN,
|
||||
ARRAY_SIZE(ov02c10_test_pattern_menu) - 1,
|
||||
|
||||
Reference in New Issue
Block a user