From 847500330c44313131e8d7bf3956da4ed569462a Mon Sep 17 00:00:00 2001 From: Erik Andr?n Date: Sun, 4 Jan 2009 11:28:42 +0100 Subject: gspca - m5602: Don't touch hflip/vflip register on Read/Modify/Write From: Erik Andr?n 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. Priority: normal Signed-off-by: Erik Andr?n --- linux/drivers/media/video/gspca/m5602/m5602_ov9650.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/linux/drivers/media/video/gspca/m5602/m5602_ov9650.c b/linux/drivers/media/video/gspca/m5602/m5602_ov9650.c index 1e0652bd6..583d8a086 100644 --- a/linux/drivers/media/video/gspca/m5602/m5602_ov9650.c +++ b/linux/drivers/media/video/gspca/m5602/m5602_ov9650.c @@ -664,12 +664,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; @@ -694,19 +689,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); -- cgit v1.2.3