diff options
author | Jean-Francois Moine <moinejf@free.fr> | 2008-10-16 21:49:17 +0200 |
---|---|---|
committer | Jean-Francois Moine <moinejf@free.fr> | 2008-10-16 21:49:17 +0200 |
commit | 83133ed6ee1025d950155673a627a81e47071f3f (patch) | |
tree | 1634dd921d3533cfff5743e79bbf81ecd99ac554 /linux/drivers/media/video/gspca/m5602/m5602_po1030.c | |
parent | 560150994e5f668affa075dd311b214a7a52e3fa (diff) | |
download | mediapointer-dvb-s2-83133ed6ee1025d950155673a627a81e47071f3f.tar.gz mediapointer-dvb-s2-83133ed6ee1025d950155673a627a81e47071f3f.tar.bz2 |
gspca: Add hflip and vflip to the po1030 sensor
From: Erik Andren <erik.andren@gmail.com>
Priority: normal
Signed-off-by: Erik Andren <erik.andren@gmail.com>
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Diffstat (limited to 'linux/drivers/media/video/gspca/m5602/m5602_po1030.c')
-rw-r--r-- | linux/drivers/media/video/gspca/m5602/m5602_po1030.c | 65 |
1 files changed, 64 insertions, 1 deletions
diff --git a/linux/drivers/media/video/gspca/m5602/m5602_po1030.c b/linux/drivers/media/video/gspca/m5602/m5602_po1030.c index f405294af..d17ac5256 100644 --- a/linux/drivers/media/video/gspca/m5602/m5602_po1030.c +++ b/linux/drivers/media/video/gspca/m5602/m5602_po1030.c @@ -1,4 +1,3 @@ - /* * Driver for the po1030 sensor * @@ -232,6 +231,70 @@ int po1030_get_gain(struct gspca_dev *gspca_dev, __s32 *val) return (err < 0) ? err : 0; } +int po1030_get_hflip(struct gspca_dev *gspca_dev, __s32 *val) +{ + struct sd *sd = (struct sd *) gspca_dev; + u8 i2c_data; + int err; + + err = po1030_read_sensor(sd, PO1030_REG_CONTROL2, + &i2c_data, 1); + + *val = (i2c_data >> 7) & 0x01 ; + + PDEBUG(D_V4L2, "Read hflip %d", *val); + + return (err < 0) ? err : 0; +} + +int po1030_set_hflip(struct gspca_dev *gspca_dev, __s32 val) +{ + struct sd *sd = (struct sd *) gspca_dev; + u8 i2c_data; + int err; + + PDEBUG(D_V4L2, "Set hflip %d", val); + + i2c_data = (val & 0x01) << 7; + + err = po1030_write_sensor(sd, PO1030_REG_CONTROL2, + &i2c_data, 1); + + return (err < 0) ? err : 0; +} + +int po1030_get_vflip(struct gspca_dev *gspca_dev, __s32 *val) +{ + struct sd *sd = (struct sd *) gspca_dev; + u8 i2c_data; + int err; + + err = po1030_read_sensor(sd, PO1030_REG_GLOBALGAIN, + &i2c_data, 1); + + *val = (i2c_data >> 6) & 0x01; + + PDEBUG(D_V4L2, "Read vflip %d", *val); + + return (err < 0) ? err : 0; +} + +int po1030_set_vflip(struct gspca_dev *gspca_dev, __s32 val) +{ + struct sd *sd = (struct sd *) gspca_dev; + u8 i2c_data; + int err; + + PDEBUG(D_V4L2, "Set vflip %d", val); + + i2c_data = (val & 0x01) << 6; + + err = po1030_write_sensor(sd, PO1030_REG_CONTROL2, + &i2c_data, 1); + + return (err < 0) ? err : 0; +} + int po1030_set_gain(struct gspca_dev *gspca_dev, __s32 val) { struct sd *sd = (struct sd *) gspca_dev; |