Commit 5da162e7 authored by Jean-Francois Moine's avatar Jean-Francois Moine Committed by Mauro Carvalho Chehab

V4L/DVB (8519): gspca: Set the specific per webcam information in driver_info for sonixb.

Signed-off-by: default avatarJean-Francois Moine <moinejf@free.fr>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 1250ac6d
...@@ -58,6 +58,12 @@ struct sd { ...@@ -58,6 +58,12 @@ struct sd {
__u8 reg11; __u8 reg11;
}; };
/* flags used in the device id table */
#define F_GAIN 0x01 /* has gain */
#define F_AUTO 0x02 /* has autogain */
#define F_SIF 0x04 /* sif or vga */
#define F_H18 0x08 /* long (18 b) or short (12 b) frame header */
#define COMP2 0x8f #define COMP2 0x8f
#define COMP 0xc7 /* 0x87 //0x07 */ #define COMP 0xc7 /* 0x87 //0x07 */
#define COMP1 0xc9 /* 0x89 //0x09 */ #define COMP1 0xc9 /* 0x89 //0x09 */
...@@ -751,74 +757,28 @@ static int sd_config(struct gspca_dev *gspca_dev, ...@@ -751,74 +757,28 @@ static int sd_config(struct gspca_dev *gspca_dev,
{ {
struct sd *sd = (struct sd *) gspca_dev; struct sd *sd = (struct sd *) gspca_dev;
struct cam *cam; struct cam *cam;
__u16 product;
int sif = 0; int sif = 0;
/* nctrls depends upon the sensor, so we use a per cam copy */ /* nctrls depends upon the sensor, so we use a per cam copy */
memcpy(&sd->sd_desc, gspca_dev->sd_desc, sizeof(struct sd_desc)); memcpy(&sd->sd_desc, gspca_dev->sd_desc, sizeof(struct sd_desc));
gspca_dev->sd_desc = &sd->sd_desc; gspca_dev->sd_desc = &sd->sd_desc;
sd->fr_h_sz = 12; /* default size of the frame header */ /* copy the webcam info from the device id */
sd->sd_desc.nctrls = 2; /* default nb of ctrls */ sd->sensor = (id->driver_info >> 24) & 0xff;
product = id->idProduct; if (id->driver_info & (F_GAIN << 16))
/* switch (id->idVendor) { */ sd->sensor_has_gain = 1;
/* case 0x0c45: * Sonix */ if (id->driver_info & (F_AUTO << 16))
switch (product) { sd->sd_desc.dq_callback = do_autogain;
case 0x6001: /* SN9C102 */ if (id->driver_info & (F_SIF << 16))
case 0x6005: /* SN9C101 */ sif = 1;
case 0x6007: /* SN9C101 */ if (id->driver_info & (F_H18 << 16))
sd->sensor = SENSOR_TAS5110; sd->fr_h_sz = 18; /* size of frame header */
sd->sensor_has_gain = 1; else
sd->sd_desc.nctrls = 4; sd->fr_h_sz = 12;
sd->sd_desc.dq_callback = do_autogain; sd->sd_desc.nctrls = (id->driver_info >> 8) & 0xff;
sif = 1; sd->sensor_addr = id->driver_info & 0xff;
break;
case 0x6009: /* SN9C101 */
case 0x600d: /* SN9C101 */
case 0x6029: /* SN9C101 */
sd->sensor = SENSOR_PAS106;
sif = 1;
break;
case 0x6011: /* SN9C101 - SN9C101G */
sd->sensor = SENSOR_OV6650;
sd->sensor_has_gain = 1;
sd->sensor_addr = 0x60;
sd->sd_desc.nctrls = 5;
sd->sd_desc.dq_callback = do_autogain;
sif = 1;
break;
case 0x6019: /* SN9C101 */
case 0x602c: /* SN9C102 */
case 0x602e: /* SN9C102 */
case 0x60b0: /* SN9C103 */
sd->sensor = SENSOR_OV7630;
sd->sensor_addr = 0x21;
sd->sensor_has_gain = 1;
sd->sd_desc.nctrls = 5;
sd->sd_desc.dq_callback = do_autogain;
if (product == 0x60b0)
sd->fr_h_sz = 18; /* size of frame header */
break;
case 0x6024: /* SN9C102 */
case 0x6025: /* SN9C102 */
sd->sensor = SENSOR_TAS5130CXX;
break;
case 0x6028: /* SN9C102 */
sd->sensor = SENSOR_PAS202;
break;
case 0x602d: /* SN9C102 */
sd->sensor = SENSOR_HV7131R;
break;
case 0x60af: /* SN9C103 */
sd->sensor = SENSOR_PAS202;
sd->fr_h_sz = 18; /* size of frame header (?) */
break;
}
/* break; */
/* } */
cam = &gspca_dev->cam; cam = &gspca_dev->cam;
cam->dev_name = (char *) id->driver_info;
cam->epaddr = 0x01; cam->epaddr = 0x01;
if (!sif) { if (!sif) {
cam->cam_mode = vga_mode; cam->cam_mode = vga_mode;
...@@ -1212,27 +1172,47 @@ static const struct sd_desc sd_desc = { ...@@ -1212,27 +1172,47 @@ static const struct sd_desc sd_desc = {
}; };
/* -- module initialisation -- */ /* -- module initialisation -- */
#define DVNM(name) .driver_info = (kernel_ulong_t) name #define SFCI(sensor, flags, nctrls, i2c_addr) \
.driver_info = (SENSOR_ ## sensor << 24) \
| ((flags) << 16) \
| ((nctrls) << 8) \
| (i2c_addr)
static __devinitdata struct usb_device_id device_table[] = { static __devinitdata struct usb_device_id device_table[] = {
#ifndef CONFIG_USB_SN9C102 #ifndef CONFIG_USB_SN9C102
{USB_DEVICE(0x0c45, 0x6001), DVNM("Genius VideoCAM NB")}, {USB_DEVICE(0x0c45, 0x6001), /* SN9C102 */
{USB_DEVICE(0x0c45, 0x6005), DVNM("Sweex Tas5110")}, SFCI(TAS5110, F_GAIN|F_AUTO|F_SIF, 4, 0)},
{USB_DEVICE(0x0c45, 0x6007), DVNM("Sonix sn9c101 + Tas5110D")}, {USB_DEVICE(0x0c45, 0x6005), /* SN9C101 */
{USB_DEVICE(0x0c45, 0x6009), DVNM("spcaCam@120")}, SFCI(TAS5110, F_GAIN|F_AUTO|F_SIF, 4, 0)},
{USB_DEVICE(0x0c45, 0x600d), DVNM("spcaCam@120")}, {USB_DEVICE(0x0c45, 0x6007), /* SN9C101 */
SFCI(TAS5110, F_GAIN|F_AUTO|F_SIF, 4, 0)},
{USB_DEVICE(0x0c45, 0x6009), /* SN9C101 */
SFCI(PAS106, F_SIF, 2, 0)},
{USB_DEVICE(0x0c45, 0x600d), /* SN9C101 */
SFCI(PAS106, F_SIF, 2, 0)},
#endif #endif
{USB_DEVICE(0x0c45, 0x6011), DVNM("MAX Webcam Microdia")}, {USB_DEVICE(0x0c45, 0x6011), /* SN9C101 - SN9C101G */
SFCI(OV6650, F_GAIN|F_AUTO|F_SIF, 5, 0x60)},
#ifndef CONFIG_USB_SN9C102 #ifndef CONFIG_USB_SN9C102
{USB_DEVICE(0x0c45, 0x6019), DVNM("Generic Sonix OV7630")}, {USB_DEVICE(0x0c45, 0x6019), /* SN9C101 */
{USB_DEVICE(0x0c45, 0x6024), DVNM("Generic Sonix Tas5130c")}, SFCI(OV7630, F_GAIN|F_AUTO|F_SIF, 5, 0x21)},
{USB_DEVICE(0x0c45, 0x6025), DVNM("Xcam Shanga")}, {USB_DEVICE(0x0c45, 0x6024), /* SN9C102 */
{USB_DEVICE(0x0c45, 0x6028), DVNM("Sonix Btc Pc380")}, SFCI(TAS5130CXX, 0, 2, 0)},
{USB_DEVICE(0x0c45, 0x6029), DVNM("spcaCam@150")}, {USB_DEVICE(0x0c45, 0x6025), /* SN9C102 */
{USB_DEVICE(0x0c45, 0x602c), DVNM("Generic Sonix OV7630")}, SFCI(TAS5130CXX, 0, 2, 0)},
{USB_DEVICE(0x0c45, 0x602d), DVNM("LIC-200 LG")}, {USB_DEVICE(0x0c45, 0x6028), /* SN9C102 */
{USB_DEVICE(0x0c45, 0x602e), DVNM("Genius VideoCam Messenger")}, SFCI(PAS202, 0, 2, 0)},
{USB_DEVICE(0x0c45, 0x60af), DVNM("Trust WB3100P")}, {USB_DEVICE(0x0c45, 0x6029), /* SN9C101 */
{USB_DEVICE(0x0c45, 0x60b0), DVNM("Genius VideoCam Look")}, SFCI(PAS106, F_SIF, 2, 0)},
{USB_DEVICE(0x0c45, 0x602c), /* SN9C102 */
SFCI(OV7630, F_GAIN|F_AUTO|F_SIF, 5, 0x21)},
{USB_DEVICE(0x0c45, 0x602d), /* SN9C102 */
SFCI(HV7131R, 0, 2, 0)},
{USB_DEVICE(0x0c45, 0x602e), /* SN9C102 */
SFCI(OV7630, F_GAIN|F_AUTO|F_SIF, 5, 0x21)},
{USB_DEVICE(0x0c45, 0x60af), /* SN9C103 */
SFCI(PAS202, F_H18, 2, 0)},
{USB_DEVICE(0x0c45, 0x60b0), /* SN9C103 */
SFCI(OV7630, F_GAIN|F_AUTO|F_SIF|F_H18, 5, 0x21)},
#endif #endif
{} {}
}; };
......
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