diff options
author | Erik Andrén <erik.andren@gmail.com> | 2008-11-27 18:07:24 +0100 |
---|---|---|
committer | Erik Andrén <erik.andren@gmail.com> | 2008-11-27 18:07:24 +0100 |
commit | b42f864d198ae7d339ae2ad20df320588c9d4550 (patch) | |
tree | bb1f92c8d8ba789b2082e745adbba8704853cbbe /linux/drivers/media/video/gspca/m5602/m5602_po1030.c | |
parent | cf10cacd2fad010966042d84b062929da66d1bec (diff) | |
download | mediapointer-dvb-s2-b42f864d198ae7d339ae2ad20df320588c9d4550.tar.gz mediapointer-dvb-s2-b42f864d198ae7d339ae2ad20df320588c9d4550.tar.bz2 |
Use read/modify/write when toggling vflip on the po1030
From: Erik Andrén <erik.andren@gmail.com>
Priority: normal
Signed-off-by: Erik Andrén <erik.andren@gmail.com>
Diffstat (limited to 'linux/drivers/media/video/gspca/m5602/m5602_po1030.c')
-rw-r--r-- | linux/drivers/media/video/gspca/m5602/m5602_po1030.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/linux/drivers/media/video/gspca/m5602/m5602_po1030.c b/linux/drivers/media/video/gspca/m5602/m5602_po1030.c index f9932a16f..2e7fb9167 100644 --- a/linux/drivers/media/video/gspca/m5602/m5602_po1030.c +++ b/linux/drivers/media/video/gspca/m5602/m5602_po1030.c @@ -184,12 +184,16 @@ int po1030_set_hflip(struct gspca_dev *gspca_dev, __s32 val) int err; PDEBUG(D_V4L2, "Set hflip %d", val); + err = m5602_read_sensor(sd, PO1030_REG_CONTROL2, &i2c_data, 1); + if (err < 0) + goto out; - i2c_data = (val & 0x01) << 7; + i2c_data = (0x7f & i2c_data) | ((val & 0x01) << 7); err = m5602_write_sensor(sd, PO1030_REG_CONTROL2, - &i2c_data, 1); + &i2c_data, 1); +out: return err; } @@ -216,12 +220,16 @@ int po1030_set_vflip(struct gspca_dev *gspca_dev, __s32 val) int err; PDEBUG(D_V4L2, "Set vflip %d", val); + err = m5602_read_sensor(sd, PO1030_REG_CONTROL2, &i2c_data, 1); + if (err < 0) + goto out; - i2c_data = (val & 0x01) << 6; + i2c_data = (i2c_data & 0xbf) | ((val & 0x01) << 6); err = m5602_write_sensor(sd, PO1030_REG_CONTROL2, - &i2c_data, 1); + &i2c_data, 1); +out: return err; } |