Commit 5196d7c6 authored by Erik Andr?n's avatar Erik Andr?n Committed by Mauro Carvalho Chehab

V4L/DVB (11426): gspca - m5602: Don't touch hflip/vflip register on Read/Modify/Write

Touching the hflip/vflip register while doing the read/modify/write corrupts the image. Just read from the sensor ctrl cache instead and all is good.
Signed-off-by: default avatarErik Andr?n <erik.andren@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 7460f524
...@@ -662,12 +662,7 @@ int ov9650_set_hflip(struct gspca_dev *gspca_dev, __s32 val) ...@@ -662,12 +662,7 @@ int ov9650_set_hflip(struct gspca_dev *gspca_dev, __s32 val)
PDEBUG(D_V4L2, "Set horizontal flip to %d", val); PDEBUG(D_V4L2, "Set horizontal flip to %d", val);
sensor_settings[HFLIP_IDX] = val; sensor_settings[HFLIP_IDX] = val;
err = m5602_read_sensor(sd, OV9650_MVFP, &i2c_data, 1); i2c_data = ((val & 0x01) << 5) | (sensor_settings[VFLIP_IDX] << 4);
if (err < 0)
return err;
i2c_data = ((i2c_data & 0xdf) | ((val & 0x01) << 5));
err = m5602_write_sensor(sd, OV9650_MVFP, &i2c_data, 1); err = m5602_write_sensor(sd, OV9650_MVFP, &i2c_data, 1);
return err; return err;
...@@ -692,19 +687,14 @@ int ov9650_set_vflip(struct gspca_dev *gspca_dev, __s32 val) ...@@ -692,19 +687,14 @@ int ov9650_set_vflip(struct gspca_dev *gspca_dev, __s32 val)
s32 *sensor_settings = sd->sensor_priv; s32 *sensor_settings = sd->sensor_priv;
PDEBUG(D_V4L2, "Set vertical flip to %d", val); PDEBUG(D_V4L2, "Set vertical flip to %d", val);
sensor_settings[VFLIP_IDX] = val; sensor_settings[VFLIP_IDX] = val;
err = m5602_read_sensor(sd, OV9650_MVFP, &i2c_data, 1);
if (err < 0)
return err;
i2c_data = ((i2c_data & 0xef) | ((val & 0x01) << 4));
i2c_data = ((val & 0x01) << 4) | (sensor_settings[VFLIP_IDX] << 5);
err = m5602_write_sensor(sd, OV9650_MVFP, &i2c_data, 1); err = m5602_write_sensor(sd, OV9650_MVFP, &i2c_data, 1);
if (err < 0) if (err < 0)
return err; return err;
/* When vflip is toggled we need to readjust the bridge hsync/vsync */
if (gspca_dev->streaming) if (gspca_dev->streaming)
err = ov9650_start(sd); err = ov9650_start(sd);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment