summaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorErik Andr?n <erik.andren@gmail.com>2009-01-04 07:28:42 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-04-06 21:44:47 -0300
commit5196d7c63197b03b29985e8bd9bfa4425b253673 (patch)
treead0ac597e9c81ac7d0199b006a3de9e43b2ecf89 /drivers/media
parent7460f524980d1d7c39f05b7e95d6d2fba072fd8a (diff)
downloadlinux-5196d7c63197b03b29985e8bd9bfa4425b253673.tar.bz2
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: Erik Andr?n <erik.andren@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/gspca/m5602/m5602_ov9650.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/drivers/media/video/gspca/m5602/m5602_ov9650.c b/drivers/media/video/gspca/m5602/m5602_ov9650.c
index 9c79a516db61..7967a651c4db 100644
--- a/drivers/media/video/gspca/m5602/m5602_ov9650.c
+++ b/drivers/media/video/gspca/m5602/m5602_ov9650.c
@@ -662,12 +662,7 @@ int ov9650_set_hflip(struct gspca_dev *gspca_dev, __s32 val)
PDEBUG(D_V4L2, "Set horizontal flip to %d", val);
sensor_settings[HFLIP_IDX] = val;
- err = m5602_read_sensor(sd, OV9650_MVFP, &i2c_data, 1);
- if (err < 0)
- return err;
-
- i2c_data = ((i2c_data & 0xdf) | ((val & 0x01) << 5));
-
+ i2c_data = ((val & 0x01) << 5) | (sensor_settings[VFLIP_IDX] << 4);
err = m5602_write_sensor(sd, OV9650_MVFP, &i2c_data, 1);
return err;
@@ -692,19 +687,14 @@ int ov9650_set_vflip(struct gspca_dev *gspca_dev, __s32 val)
s32 *sensor_settings = sd->sensor_priv;
PDEBUG(D_V4L2, "Set vertical flip to %d", 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);
-
if (err < 0)
return err;
+ /* When vflip is toggled we need to readjust the bridge hsync/vsync */
if (gspca_dev->streaming)
err = ov9650_start(sd);