The patch number 9281 was added via Jean-Francois Moine <[EMAIL PROTECTED]>
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
        [EMAIL PROTECTED]

------

From: Erik Andren  <[EMAIL PROTECTED]>
gspca: Add hflip and vflip to the po1030 sensor


Priority: normal

Signed-off-by: Erik Andren <[EMAIL PROTECTED]>
Signed-off-by: Jean-Francois Moine <[EMAIL PROTECTED]>


---

 linux/drivers/media/video/gspca/m5602/m5602_po1030.c |   65 ++++++++++-
 linux/drivers/media/video/gspca/m5602/m5602_po1030.h |   43 ++++++-
 2 files changed, 101 insertions(+), 7 deletions(-)

diff -r d327ccc02ebb -r edc89d475ecd 
linux/drivers/media/video/gspca/m5602/m5602_po1030.c
--- a/linux/drivers/media/video/gspca/m5602/m5602_po1030.c      Thu Oct 16 
21:46:07 2008 +0200
+++ b/linux/drivers/media/video/gspca/m5602/m5602_po1030.c      Thu Oct 16 
21:49:17 2008 +0200
@@ -1,4 +1,3 @@
-
 /*
  * Driver for the po1030 sensor
  *
@@ -232,6 +231,70 @@ int po1030_get_gain(struct gspca_dev *gs
        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;
diff -r d327ccc02ebb -r edc89d475ecd 
linux/drivers/media/video/gspca/m5602/m5602_po1030.h
--- a/linux/drivers/media/video/gspca/m5602/m5602_po1030.h      Thu Oct 16 
21:46:07 2008 +0200
+++ b/linux/drivers/media/video/gspca/m5602/m5602_po1030.h      Thu Oct 16 
21:49:17 2008 +0200
@@ -108,10 +108,13 @@
 #define PO1030_REG_YCONTRAST           0x74
 #define PO1030_REG_YSATURATION         0x75
 
+#define PO1030_HFLIP                   (1 << 7)
+#define PO1030_VFLIP                   (1 << 6)
+
 /*****************************************************************************/
 
 #define PO1030_GLOBAL_GAIN_DEFAULT     0x12
-#define PO1030_EXPOSURE_DEFAULT                0xf0ff
+#define PO1030_EXPOSURE_DEFAULT                0x0085
 #define PO1030_BLUE_GAIN_DEFAULT       0x40
 #define PO1030_RED_GAIN_DEFAULT        0x40
 
@@ -120,7 +123,6 @@
 /* Kernel module parameters */
 extern int force_sensor;
 extern int dump_sensor;
-extern unsigned int m5602_debug;
 
 int po1030_probe(struct sd *sd);
 int po1030_init(struct sd *sd);
@@ -141,6 +143,10 @@ int po1030_set_red_balance(struct gspca_
 int po1030_set_red_balance(struct gspca_dev *gspca_dev, __s32 val);
 int po1030_get_blue_balance(struct gspca_dev *gspca_dev, __s32 *val);
 int po1030_set_blue_balance(struct gspca_dev *gspca_dev, __s32 val);
+int po1030_get_hflip(struct gspca_dev *gspca_dev, __s32 *val);
+int po1030_set_hflip(struct gspca_dev *gspca_dev, __s32 val);
+int po1030_get_vflip(struct gspca_dev *gspca_dev, __s32 *val);
+int po1030_set_vflip(struct gspca_dev *gspca_dev, __s32 val);
 
 static struct m5602_sensor po1030 = {
        .name = "PO1030",
@@ -151,7 +157,7 @@ static struct m5602_sensor po1030 = {
        .init = po1030_init,
        .power_down = po1030_power_down,
 
-       .nctrls = 4,
+       .nctrls = 6,
        .ctrls = {
        {
                {
@@ -159,7 +165,7 @@ static struct m5602_sensor po1030 = {
                        .type           = V4L2_CTRL_TYPE_INTEGER,
                        .name           = "gain",
                        .minimum        = 0x00,
-                       .maximum        = 0xff,
+                       .maximum        = 0x4f,
                        .step           = 0x1,
                        .default_value  = PO1030_GLOBAL_GAIN_DEFAULT,
                        .flags          = V4L2_CTRL_FLAG_SLIDER
@@ -172,7 +178,7 @@ static struct m5602_sensor po1030 = {
                        .type           = V4L2_CTRL_TYPE_INTEGER,
                        .name           = "exposure",
                        .minimum        = 0x00,
-                       .maximum        = 0xffff,
+                       .maximum        = 0x02ff,
                        .step           = 0x1,
                        .default_value  = PO1030_EXPOSURE_DEFAULT,
                        .flags          = V4L2_CTRL_FLAG_SLIDER
@@ -205,8 +211,33 @@ static struct m5602_sensor po1030 = {
                },
                .set = po1030_set_blue_balance,
                .get = po1030_get_blue_balance
+       }, {
+               {
+                       .id             = V4L2_CID_HFLIP,
+                       .type           = V4L2_CTRL_TYPE_BOOLEAN,
+                       .name           = "horizontal flip",
+                       .minimum        = 0,
+                       .maximum        = 1,
+                       .step           = 1,
+                       .default_value  = 0,
+               },
+               .set = po1030_set_hflip,
+               .get = po1030_get_hflip
+       }, {
+               {
+                       .id             = V4L2_CID_VFLIP,
+                       .type           = V4L2_CTRL_TYPE_BOOLEAN,
+                       .name           = "vertical flip",
+                       .minimum        = 0,
+                       .maximum        = 1,
+                       .step           = 1,
+                       .default_value  = 0,
+               },
+               .set = po1030_set_vflip,
+               .get = po1030_get_vflip
        }
        },
+
        .nmodes = 1,
        .modes = {
        {
@@ -380,7 +411,7 @@ static const unsigned char init_po1030[]
 
        /* Set the y window to 1 */
        {SENSOR, PO1030_REG_WINDOWY_H, 0x00},
-       {SENSOR, PO1030_REG_WINDOWX_L, 0x01},
+       {SENSOR, PO1030_REG_WINDOWY_L, 0x01},
 
        {SENSOR, PO1030_REG_WINDOWWIDTH_H, 0x02},
        {SENSOR, PO1030_REG_WINDOWWIDTH_L, 0x87},


---

Patch is available at: 
http://linuxtv.org/hg/v4l-dvb/rev/edc89d475ecd8a3667f6593457b078d8227f8e30

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to