Commit 5a2a6de5 authored by Luca Risolia's avatar Luca Risolia Committed by Greg Kroah-Hartman

[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: default avatarLuca Risolia <luca.risolia@studio.unibo.it>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 7d8d0405
......@@ -123,12 +123,12 @@ analyze kernel messages and verify that the loading process has gone well:
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 "/dev/video0":
[root@localhost #] echo 1 > i2c_reg
[root@localhost #] 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:
[root@localhost #] echo 0x11 > reg
[root@localhost #] 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";
......
......@@ -53,8 +53,8 @@
#define SN9C102_MODULE_AUTHOR "(C) 2004 Luca Risolia"
#define SN9C102_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>"
#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,
......
......@@ -400,7 +400,7 @@ sn9c102_i2c_try_raw_write(struct sn9c102_device* cam,
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 sn9c102_device* cam)
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(struct class_device* cd, char* buf)
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 sn9c102_device* cam)
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* intf, const struct usb_device_id* id)
}
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);
......
......@@ -36,18 +36,19 @@ static int pas202bcb_init(struct sn9c102_device* cam)
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 sn9c102_device* cam)
* 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;
......
......@@ -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> */
......
......@@ -104,8 +104,8 @@ static struct sn9c102_sensor tas5110c1b = {
.maintainer = "Luca Risolia <luca.risolia@studio.unibo.it>",
.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 = {
{
......
......@@ -109,8 +109,8 @@ static struct sn9c102_sensor tas5130d1b = {
.maintainer = "Luca Risolia <luca.risolia@studio.unibo.it>",
.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 = {
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment