aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorErik Andrén <erik.andren@gmail.com>2008-11-27 14:07:24 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-12-30 09:39:59 -0200
commit1d07b6f14e39eb613e42ff7fe7e352d6f67a65eb (patch)
treec20d71d7c0c37c86a937660f0f4b404bef5d049a /drivers
parent48223c88299a10a62ff5f5e40bd07670a21c3de9 (diff)
V4L/DVB (10030): m5602: Use read/modify/write when toggling vflip on the po1030
Signed-off-by: Erik Andrén <erik.andren@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/gspca/m5602/m5602_po1030.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/media/video/gspca/m5602/m5602_po1030.c b/drivers/media/video/gspca/m5602/m5602_po1030.c
index f9932a16fbd..2e7fb91673c 100644
--- a/drivers/media/video/gspca/m5602/m5602_po1030.c
+++ b/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;
}