Skip to content

Commit d0bb6f1

Browse files
Hans de GoedeHans Verkuil
authored andcommitted
media: ov02c10: Adjust x-win/y-win when changing flipping to preserve bayer-pattern
The ov02c10 is capable of having its (crop) window shifted around with 1 pixel precision while streaming. This allows changing the x/y window coordinates when changing flipping to preserve the bayer-pattern. __v4l2_ctrl_handler_setup() will now write the window coordinates at 0x3810 and 0x3812 so these can be dropped from sensor_1928x1092_30fps_setting. Since the bayer-pattern is now unchanged, the V4L2_CTRL_FLAG_MODIFY_LAYOUT flag can be dropped from the flip controls. Note the original use of the V4L2_CTRL_FLAG_MODIFY_LAYOUT flag was incomplete, besides setting the flag the driver should also have reported a different mbus code when getting the source pad's format depending on the hflip / vflip settings see the ov2680.c driver for example. Fixes: b7cd2ba ("media: ov02c10: Support hflip and vflip") Cc: [email protected] Reviewed-by: Bryan O'Donoghue <[email protected]> Reviewed-by: Sebastian Reichel <[email protected]> Tested-by: Sebastian Reichel <[email protected]> # T14s Gen6 Snapdragon Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
1 parent 905120d commit d0bb6f1

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

drivers/media/i2c/ov02c10.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,6 @@ static const struct reg_sequence sensor_1928x1092_30fps_setting[] = {
165165
{0x3809, 0x88},
166166
{0x380a, 0x04},
167167
{0x380b, 0x44},
168-
{0x3810, 0x00},
169-
{0x3811, 0x02},
170-
{0x3812, 0x00},
171-
{0x3813, 0x01},
172168
{0x3814, 0x01},
173169
{0x3815, 0x01},
174170
{0x3816, 0x01},
@@ -465,11 +461,15 @@ static int ov02c10_set_ctrl(struct v4l2_ctrl *ctrl)
465461
break;
466462

467463
case V4L2_CID_HFLIP:
464+
cci_write(ov02c10->regmap, OV02C10_ISP_X_WIN_CONTROL,
465+
ctrl->val ? 1 : 2, &ret);
468466
cci_update_bits(ov02c10->regmap, OV02C10_ROTATE_CONTROL,
469467
BIT(3), ov02c10->hflip->val << 3, &ret);
470468
break;
471469

472470
case V4L2_CID_VFLIP:
471+
cci_write(ov02c10->regmap, OV02C10_ISP_Y_WIN_CONTROL,
472+
ctrl->val ? 2 : 1, &ret);
473473
cci_update_bits(ov02c10->regmap, OV02C10_ROTATE_CONTROL,
474474
BIT(4), ov02c10->vflip->val << 4, &ret);
475475
break;
@@ -551,13 +551,9 @@ static int ov02c10_init_controls(struct ov02c10 *ov02c10)
551551

552552
ov02c10->hflip = v4l2_ctrl_new_std(ctrl_hdlr, &ov02c10_ctrl_ops,
553553
V4L2_CID_HFLIP, 0, 1, 1, 0);
554-
if (ov02c10->hflip)
555-
ov02c10->hflip->flags |= V4L2_CTRL_FLAG_MODIFY_LAYOUT;
556554

557555
ov02c10->vflip = v4l2_ctrl_new_std(ctrl_hdlr, &ov02c10_ctrl_ops,
558556
V4L2_CID_VFLIP, 0, 1, 1, 0);
559-
if (ov02c10->vflip)
560-
ov02c10->vflip->flags |= V4L2_CTRL_FLAG_MODIFY_LAYOUT;
561557

562558
v4l2_ctrl_new_std_menu_items(ctrl_hdlr, &ov02c10_ctrl_ops,
563559
V4L2_CID_TEST_PATTERN,

0 commit comments

Comments
 (0)