ChangeSet 1.1867.3.5, 2004/09/14 10:51:00-07:00, [EMAIL PROTECTED]

[PATCH] USB: SN9C10x driver updates

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]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>


 Documentation/usb/sn9c102.txt          |   11 ++++++++---
 drivers/usb/media/sn9c102.h            |    8 ++++----
 drivers/usb/media/sn9c102_core.c       |   30 +++++++++++++++++++++++-------
 drivers/usb/media/sn9c102_pas202bcb.c  |    9 +++++----
 drivers/usb/media/sn9c102_sensor.h     |    3 +++
 drivers/usb/media/sn9c102_tas5110c1b.c |    4 ++--
 drivers/usb/media/sn9c102_tas5130d1b.c |    4 ++--
 7 files changed, 47 insertions(+), 22 deletions(-)


diff -Nru a/Documentation/usb/sn9c102.txt b/Documentation/usb/sn9c102.txt
--- a/Documentation/usb/sn9c102.txt     2004-10-19 08:14:02 -07:00
+++ b/Documentation/usb/sn9c102.txt     2004-10-19 08:14:02 -07:00
@@ -123,12 +123,12 @@
 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 @@
        [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
@@ -249,6 +251,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
diff -Nru a/drivers/usb/media/sn9c102.h b/drivers/usb/media/sn9c102.h
--- a/drivers/usb/media/sn9c102.h       2004-10-19 08:14:02 -07:00
+++ b/drivers/usb/media/sn9c102.h       2004-10-19 08:14:02 -07:00
@@ -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 @@
        BRIDGE_SN9C103 = 0x04,
 };
 
-SN9C102_ID_TABLE;
-SN9C102_SENSOR_TABLE;
+SN9C102_ID_TABLE
+SN9C102_SENSOR_TABLE
 
 enum sn9c102_frame_state {
        F_UNUSED,
diff -Nru a/drivers/usb/media/sn9c102_core.c b/drivers/usb/media/sn9c102_core.c
--- a/drivers/usb/media/sn9c102_core.c  2004-10-19 08:14:02 -07:00
+++ b/drivers/usb/media/sn9c102_core.c  2004-10-19 08:14:02 -07:00
@@ -400,7 +400,7 @@
        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 @@
        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 @@
                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 @@
                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 @@
        }
 
        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 -Nru a/drivers/usb/media/sn9c102_pas202bcb.c 
b/drivers/usb/media/sn9c102_pas202bcb.c
--- a/drivers/usb/media/sn9c102_pas202bcb.c     2004-10-19 08:14:02 -07:00
+++ b/drivers/usb/media/sn9c102_pas202bcb.c     2004-10-19 08:14:02 -07:00
@@ -36,18 +36,19 @@
        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 @@
         *  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 -Nru a/drivers/usb/media/sn9c102_sensor.h b/drivers/usb/media/sn9c102_sensor.h
--- a/drivers/usb/media/sn9c102_sensor.h        2004-10-19 08:14:02 -07:00
+++ b/drivers/usb/media/sn9c102_sensor.h        2004-10-19 08:14:02 -07:00
@@ -186,6 +186,9 @@
        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 -Nru a/drivers/usb/media/sn9c102_tas5110c1b.c 
b/drivers/usb/media/sn9c102_tas5110c1b.c
--- a/drivers/usb/media/sn9c102_tas5110c1b.c    2004-10-19 08:14:02 -07:00
+++ b/drivers/usb/media/sn9c102_tas5110c1b.c    2004-10-19 08:14:02 -07:00
@@ -104,8 +104,8 @@
        .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 -Nru a/drivers/usb/media/sn9c102_tas5130d1b.c 
b/drivers/usb/media/sn9c102_tas5130d1b.c
--- a/drivers/usb/media/sn9c102_tas5130d1b.c    2004-10-19 08:14:02 -07:00
+++ b/drivers/usb/media/sn9c102_tas5130d1b.c    2004-10-19 08:14:02 -07:00
@@ -109,8 +109,8 @@
        .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 = {
                {



-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to