SN9C10x driver updates. 

Changes: (+ new, - removed, * cleanup, @ bugfix, = sync with kernels)

@ Create correct red,green,blue entries under /sys according to the detected
  bridge
* Add and use defined symbols for I2C slave ids of TAS5110C1B and TAS51130D1B
* Color fixes for PAS202BCB - from its maintainer -

Signed-off-by: Luca Risolia <[EMAIL PROTECTED]>
---

diff -uprN -X dontdiff a/Documentation/usb/sn9c102.txt b/Documentation/usb/sn9c102.txt
--- a/Documentation/usb/sn9c102.txt     2004-09-13 17:36:48.000000000 +0200
+++ b/Documentation/usb/sn9c102.txt     2004-09-13 18:15:47.000000000 +0200
@@ -123,12 +123,12 @@ analyze kernel messages and verify that 
 Module parameters are listed below:
 -------------------------------------------------------------------------------
 Name:           video_nr
-Type:           int array (min = 0, max = 32)
+Type:           int array (min = 0, max = 64)
 Syntax:         <-1|n[,...]> 
 Description:    Specify V4L2 minor mode number:
                 -1 = use next available
                  n = use minor number n
-                You can specify up to 32 cameras this way.
+                You can specify up to 64 cameras this way.
                 For example:
                 video_nr=-1,2,-1 would assign minor number 2 to the second
                 recognized camera and use auto for the first one and for every
@@ -180,7 +180,9 @@ identifier - of the camera registered as
        [EMAIL PROTECTED] #] echo 1 > i2c_reg
        [EMAIL PROTECTED] #] cat i2c_val
 
-Now let's set the green gain's register of the SN9C10x chip to 2:
+Note that "cat" will fail if sensor registers cannot be read.
+
+Now let's set the green gain's register of the SN9C101 or SN9C102 chips to 2:
 
        [EMAIL PROTECTED] #] echo 0x11 > reg
        [EMAIL PROTECTED] #] echo 2 > val
@@ -250,6 +252,9 @@ PAS202BCB   PixArt Imaging Inc.
 TAS5110C1B  Taiwan Advanced Sensor Corporation
 TAS5130D1B  Taiwan Advanced Sensor Corporation
 
+All the available control settings of each image sensor are supported through
+the V4L2 interface.
+
 If you think your camera is based on the above hardware and is not actually
 listed in the above table, you may try to add the specific USB VendorID and
 ProductID identifiers to the sn9c102_id_table[] in the file "sn9c102_sensor.h";
diff -uprN -X dontdiff a/drivers/usb/media/sn9c102_core.c 
b/drivers/usb/media/sn9c102_core.c
--- a/drivers/usb/media/sn9c102_core.c  2004-09-13 17:38:31.000000000 +0200
+++ b/drivers/usb/media/sn9c102_core.c  2004-09-13 17:50:39.000000000 +0200
@@ -400,7 +400,7 @@ sn9c102_i2c_try_raw_write(struct sn9c102
        if (err)
                DBG(3, "I2C write failed for %s image sensor", sensor->name)
 
-       PDBGG("I2C write: %u bytes, data0 = 0x%02X, data1 = 0x%02X, "
+       PDBGG("I2C raw write: %u bytes, data0 = 0x%02X, data1 = 0x%02X, "
              "data2 = 0x%02X, data3 = 0x%02X, data4 = 0x%02X, data5 = 0x%02X",
              n, data0, data1, data2, data3, data4, data5)
 
@@ -634,7 +634,7 @@ static int sn9c102_start_transfer(struct
        struct usb_device *udev = cam->usbdev;
        struct urb* urb;
        const unsigned int wMaxPacketSize[] = {0, 128, 256, 384, 512,
-                                               680, 800, 900, 1023};
+                                              680, 800, 900, 1023};
        const unsigned int psz = wMaxPacketSize[SN9C102_ALTERNATE_SETTING];
        s8 i, j;
        int err = 0;
@@ -965,6 +965,11 @@ static ssize_t sn9c102_show_i2c_val(stru
                return -ENODEV;
        }
 
+       if (cam->sensor->slave_read_id == SN9C102_I2C_SLAVEID_UNAVAILABLE) {
+               up(&sn9c102_sysfs_lock);
+               return -ENOSYS;
+       }
+
        if ((val = sn9c102_i2c_read(cam, cam->sysfs.i2c_reg)) < 0) {
                up(&sn9c102_sysfs_lock);
                return -EIO;
@@ -1126,7 +1131,8 @@ static void sn9c102_create_sysfs(struct 
                video_device_create_file(v4ldev, &class_device_attr_blue);
                video_device_create_file(v4ldev, &class_device_attr_red);
        }
-       if (cam->sensor->slave_write_id && cam->sensor->slave_read_id) {
+       if (cam->sensor->slave_write_id != SN9C102_I2C_SLAVEID_UNAVAILABLE ||
+           cam->sensor->slave_read_id != SN9C102_I2C_SLAVEID_UNAVAILABLE) {
                video_device_create_file(v4ldev, &class_device_attr_i2c_reg);
                video_device_create_file(v4ldev, &class_device_attr_i2c_val);
        }
@@ -2362,10 +2368,20 @@ sn9c102_usb_probe(struct usb_interface* 
        }
 
        cam->bridge = (sn9c102_id_table[i].idProduct & 0xffc0) == 0x6080 ?
-                     BRIDGE_SN9C102 : BRIDGE_SN9C103;
-
-       DBG(2, "SN9C10x PC Camera Controller detected (vid/pid 0x%04X/0x%04X)",
-           sn9c102_id_table[i].idVendor, sn9c102_id_table[i].idProduct)
+                     BRIDGE_SN9C103 : BRIDGE_SN9C102;
+       switch (cam->bridge) {
+       case BRIDGE_SN9C101:
+       case BRIDGE_SN9C102:
+               DBG(2, "SN9C10[12] PC Camera Controller detected "
+                      "(vid/pid 0x%04X/0x%04X)", sn9c102_id_table[i].idVendor,
+                   sn9c102_id_table[i].idProduct)
+               break;
+       case BRIDGE_SN9C103:
+               DBG(2, "SN9C103 PC Camera Controller detected "
+                      "(vid/pid 0x%04X/0x%04X)", sn9c102_id_table[i].idVendor,
+                   sn9c102_id_table[i].idProduct)
+               break;
+       }
 
        for  (i = 0; sn9c102_sensor_table[i]; i++) {
                err = sn9c102_sensor_table[i](cam);
diff -uprN -X dontdiff a/drivers/usb/media/sn9c102.h b/drivers/usb/media/sn9c102.h
--- a/drivers/usb/media/sn9c102.h       2004-09-13 17:38:31.000000000 +0200
+++ b/drivers/usb/media/sn9c102.h       2004-09-13 17:50:39.000000000 +0200
@@ -53,8 +53,8 @@
 #define SN9C102_MODULE_AUTHOR   "(C) 2004 Luca Risolia"
 #define SN9C102_AUTHOR_EMAIL    "<[EMAIL PROTECTED]>"
 #define SN9C102_MODULE_LICENSE  "GPL"
-#define SN9C102_MODULE_VERSION  "1:1.10"
-#define SN9C102_MODULE_VERSION_CODE  KERNEL_VERSION(1, 0, 10)
+#define SN9C102_MODULE_VERSION  "1:1.12"
+#define SN9C102_MODULE_VERSION_CODE  KERNEL_VERSION(1, 0, 12)
 
 enum sn9c102_bridge {
        BRIDGE_SN9C101 = 0x01,
@@ -62,8 +62,8 @@ enum sn9c102_bridge {
        BRIDGE_SN9C103 = 0x04,
 };
 
-SN9C102_ID_TABLE;
-SN9C102_SENSOR_TABLE;
+SN9C102_ID_TABLE
+SN9C102_SENSOR_TABLE
 
 enum sn9c102_frame_state {
        F_UNUSED,
diff -uprN -X dontdiff a/drivers/usb/media/sn9c102_pas202bcb.c 
b/drivers/usb/media/sn9c102_pas202bcb.c
--- a/drivers/usb/media/sn9c102_pas202bcb.c     2004-09-13 17:38:31.000000000 +0200
+++ b/drivers/usb/media/sn9c102_pas202bcb.c     2004-09-13 17:50:39.000000000 +0200
@@ -36,18 +36,19 @@ static int pas202bcb_init(struct sn9c102
        err += sn9c102_write_reg(cam, 0x00, 0x11);
        err += sn9c102_write_reg(cam, 0x00, 0x14);
        err += sn9c102_write_reg(cam, 0x20, 0x17);
-       err += sn9c102_write_reg(cam, 0x20, 0x19);
+       err += sn9c102_write_reg(cam, 0x30, 0x19);
        err += sn9c102_write_reg(cam, 0x09, 0x18);
 
-       err += sn9c102_i2c_write(cam, 0x02, 0x0c);
+       err += sn9c102_i2c_write(cam, 0x02, 0x14);
        err += sn9c102_i2c_write(cam, 0x03, 0x40);
        err += sn9c102_i2c_write(cam, 0x04, 0x07);
        err += sn9c102_i2c_write(cam, 0x05, 0x25);
        err += sn9c102_i2c_write(cam, 0x0d, 0x2c);
        err += sn9c102_i2c_write(cam, 0x0e, 0x01);
        err += sn9c102_i2c_write(cam, 0x0f, 0xa9);
-       err += sn9c102_i2c_write(cam, 0x08, 0x01);
+       err += sn9c102_i2c_write(cam, 0x10, 0x08);
        err += sn9c102_i2c_write(cam, 0x0b, 0x01);
+       err += sn9c102_i2c_write(cam, 0x0c, 0x04);
        err += sn9c102_i2c_write(cam, 0x13, 0x63);
        err += sn9c102_i2c_write(cam, 0x15, 0x70);
        err += sn9c102_i2c_write(cam, 0x11, 0x01);
@@ -217,7 +218,7 @@ int sn9c102_probe_pas202bcb(struct sn9c1
         *  NOTE: do NOT change the values!
         */
        err += sn9c102_write_reg(cam, 0x01, 0x01); /* sensor power down */
-       err += sn9c102_write_reg(cam, 0x00, 0x01); /* sensor power on */
+       err += sn9c102_write_reg(cam, 0x40, 0x01); /* sensor power on */
        err += sn9c102_write_reg(cam, 0x28, 0x17); /* sensor clock at 24 MHz */
        if (err)
                return -EIO;
diff -uprN -X dontdiff a/drivers/usb/media/sn9c102_sensor.h 
b/drivers/usb/media/sn9c102_sensor.h
--- a/drivers/usb/media/sn9c102_sensor.h        2004-09-13 17:38:31.000000000 +0200
+++ b/drivers/usb/media/sn9c102_sensor.h        2004-09-13 17:50:40.000000000 +0200
@@ -186,6 +186,9 @@ enum sn9c102_i2c_interface {
        SN9C102_I2C_3WIRES,
 };
 
+#define SN9C102_I2C_SLAVEID_FICTITIOUS 0xff
+#define SN9C102_I2C_SLAVEID_UNAVAILABLE 0x00
+
 struct sn9c102_sensor {
        char name[32], /* sensor name */
             maintainer[64]; /* name of the mantainer <email> */
diff -uprN -X dontdiff a/drivers/usb/media/sn9c102_tas5110c1b.c 
b/drivers/usb/media/sn9c102_tas5110c1b.c
--- a/drivers/usb/media/sn9c102_tas5110c1b.c    2004-09-13 17:38:31.000000000 +0200
+++ b/drivers/usb/media/sn9c102_tas5110c1b.c    2004-09-13 17:50:40.000000000 +0200
@@ -104,8 +104,8 @@ static struct sn9c102_sensor tas5110c1b 
        .maintainer = "Luca Risolia <[EMAIL PROTECTED]>",
        .frequency = SN9C102_I2C_100KHZ,
        .interface = SN9C102_I2C_3WIRES,
-       .slave_read_id = 0xff, /* fictitious */
-       .slave_write_id = 0xff, /* fictitious */
+       .slave_read_id = SN9C102_I2C_SLAVEID_UNAVAILABLE,
+       .slave_write_id = SN9C102_I2C_SLAVEID_FICTITIOUS,
        .init = &tas5110c1b_init,
        .qctrl = {
                {
diff -uprN -X dontdiff a/drivers/usb/media/sn9c102_tas5130d1b.c 
b/drivers/usb/media/sn9c102_tas5130d1b.c
--- a/drivers/usb/media/sn9c102_tas5130d1b.c    2004-09-13 17:38:31.000000000 +0200
+++ b/drivers/usb/media/sn9c102_tas5130d1b.c    2004-09-13 17:50:40.000000000 +0200
@@ -109,8 +109,8 @@ static struct sn9c102_sensor tas5130d1b 
        .maintainer = "Luca Risolia <[EMAIL PROTECTED]>",
        .frequency = SN9C102_I2C_100KHZ,
        .interface = SN9C102_I2C_3WIRES,
-       .slave_read_id = 0xff, /* fictitious */
-       .slave_write_id = 0xff, /* fictitious */
+       .slave_read_id = SN9C102_I2C_SLAVEID_UNAVAILABLE,
+       .slave_write_id = SN9C102_I2C_SLAVEID_FICTITIOUS,
        .init = &tas5130d1b_init,
        .qctrl = {
                {

Attachment: pgpIt2dDDWWWO.pgp
Description: PGP signature

Reply via email to