]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
V4L/DVB: gspca_sonixb: leave bridge gain at 1.0 when we have a sensor gain
authorHans de Goede <hdegoede@redhat.com>
Mon, 1 Feb 2010 10:48:17 +0000 (07:48 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 26 Feb 2010 18:11:08 +0000 (15:11 -0300)
Leave bridge gain at 1.0 when we have a sensor gain, while at it also
change the bridge gain setting code to write both registers in one go
saving us a usb transaction.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/gspca/sonixb.c

index 28843a6a6fea0d7ee78185a2738097059242fbed..4356423c6f996f09b34ec338849e7dad01a4007f 100644 (file)
@@ -347,7 +347,7 @@ static const __u8 initOv7630[] = {
 };
 static const __u8 initOv7630_3[] = {
        0x44, 0x44, 0x00, 0x1a, 0x20, 0x20, 0x20, 0x80, /* r01 .. r08 */
-       0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, /* r09 .. r10 */
+       0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* r09 .. r10 */
        0x00, 0x02, 0x01, 0x0a,                         /* r11 .. r14 */
        0x28, 0x1e,                     /* H & V sizes     r15 .. r16 */
        0x68, 0x8f, MCK_INIT1,                          /* r17 .. r19 */
@@ -465,7 +465,7 @@ static const __u8 pas202_sensor_init[][8] = {
 static const __u8 initTas5110c[] = {
        0x44, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x11, 0x00, 0x00, 0x00,
        0x00, 0x00,
-       0x00, 0x01, 0x00, 0x45, 0x09, 0x0a,
+       0x00, 0x00, 0x00, 0x45, 0x09, 0x0a,
        0x16, 0x12, 0x60, 0x86, 0x2b,
        0x14, 0x0a, 0x02, 0x02, 0x09, 0x07
 };
@@ -473,7 +473,7 @@ static const __u8 initTas5110c[] = {
 static const __u8 initTas5110d[] = {
        0x44, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x11, 0x00, 0x00, 0x00,
        0x00, 0x00,
-       0x00, 0x01, 0x00, 0x41, 0x09, 0x0a,
+       0x00, 0x00, 0x00, 0x41, 0x09, 0x0a,
        0x16, 0x12, 0x60, 0x86, 0x2b,
        0x14, 0x0a, 0x02, 0x02, 0x09, 0x07
 };
@@ -486,7 +486,7 @@ static const __u8 tas5110_sensor_init[][8] = {
 static const __u8 initTas5130[] = {
        0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x11, 0x00, 0x00, 0x00,
        0x00, 0x00,
-       0x00, 0x01, 0x00, 0x68, 0x0c, 0x0a,
+       0x00, 0x00, 0x00, 0x68, 0x0c, 0x0a,
        0x28, 0x1e, 0x60, COMP, MCK_INIT,
        0x18, 0x10, 0x04, 0x03, 0x11, 0x0c
 };
@@ -697,19 +697,21 @@ static void setgain(struct gspca_dev *gspca_dev)
 {
        struct sd *sd = (struct sd *) gspca_dev;
        __u8 gain;
-       __u8 rgb_value;
+       __u8 buf[2] = { 0, 0 };
+
+       if (sensor_data[sd->sensor].flags & F_GAIN) {
+               /* Use the sensor gain to do the actual gain */
+               setsensorgain(gspca_dev);
+               return;
+       }
 
        gain = sd->gain >> 4;
 
        /* red and blue gain */
-       rgb_value = gain << 4 | gain;
-       reg_w(gspca_dev, 0x10, &rgb_value, 1);
+       buf[0] = gain << 4 | gain;
        /* green gain */
-       rgb_value = gain;
-       reg_w(gspca_dev, 0x11, &rgb_value, 1);
-
-       if (sensor_data[sd->sensor].flags & F_GAIN)
-               setsensorgain(gspca_dev);
+       buf[1] = gain;
+       reg_w(gspca_dev, 0x10, buf, 2);
 }
 
 static void setexposure(struct gspca_dev *gspca_dev)