Skip to content

Commit

Permalink
media: ov7740: fix vertical flip control
Browse files Browse the repository at this point in the history
Setting the value of the V4L2_CID_VFLIP control is currently ignored.

Because V4L2_CID_HFLIP and V4L2_CID_VFLIP are independently controlled
in s_ctrl() but these controls belong to the same cluster and the first
control is V4L2_CID_HFLIP.

Fix it by not clustering these controls.  Also correct erroneous updating
register bit for vertical flip.

Cc: Wenyou Yang <[email protected]>
Cc: Eugen Hristev <[email protected]>
Signed-off-by: Akinobu Mita <[email protected]>
Signed-off-by: Sakari Ailus <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
mita authored and mchehab committed May 23, 2019
1 parent 6e4ab83 commit eed6b2e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/media/i2c/ov7740.c
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ static int ov7740_set_ctrl(struct v4l2_ctrl *ctrl)
struct i2c_client *client = v4l2_get_subdevdata(&ov7740->subdev);
struct regmap *regmap = ov7740->regmap;
int ret;
u8 val = 0;
u8 val;

if (!pm_runtime_get_if_in_use(&client->dev))
return 0;
Expand All @@ -551,6 +551,7 @@ static int ov7740_set_ctrl(struct v4l2_ctrl *ctrl)
ret = ov7740_set_contrast(regmap, ctrl->val);
break;
case V4L2_CID_VFLIP:
val = ctrl->val ? REG0C_IMG_FLIP : 0x00;
ret = regmap_update_bits(regmap, REG_REG0C,
REG0C_IMG_FLIP, val);
break;
Expand Down Expand Up @@ -1030,7 +1031,6 @@ static int ov7740_init_controls(struct ov7740 *ov7740)
v4l2_ctrl_auto_cluster(2, &ov7740->auto_gain, 0, true);
v4l2_ctrl_auto_cluster(2, &ov7740->auto_exposure,
V4L2_EXPOSURE_MANUAL, true);
v4l2_ctrl_cluster(2, &ov7740->hflip);

if (ctrl_hdlr->error) {
ret = ctrl_hdlr->error;
Expand Down

0 comments on commit eed6b2e

Please sign in to comment.