OSDN Git Service

media: ov7740: fix vertical flip control
authorAkinobu Mita <akinobu.mita@gmail.com>
Wed, 17 Apr 2019 14:06:40 +0000 (10:06 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Thu, 23 May 2019 09:40:03 +0000 (05:40 -0400)
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 <wenyou.yang@microchip.com>
Cc: Eugen Hristev <eugen.hristev@microchip.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/i2c/ov7740.c

index 5c0dfdf..352658b 100644 (file)
@@ -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;
@@ -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;
@@ -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;