Commit 49b57dba authored by Jean-Francois Moine's avatar Jean-Francois Moine Committed by Mauro Carvalho Chehab

V4L/DVB (8664): gspca: The bridge/sensor of the webcam 093a:2621 is a PAC 7302.

Signed-off-by: default avatarJean-Francois Moine <moinejf@free.fr>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent d2d16e90
......@@ -44,6 +44,10 @@ struct sd {
char tosof; /* number of bytes before next start of frame */
signed char ag_cnt;
#define AG_CNT_START 13
__u8 sensor;
#define SENSOR_PAC7302 0
#define SENSOR_PAC7311 1
};
/* V4L2 controls supported by the driver */
......@@ -206,9 +210,158 @@ static const __u8 pac7311_jpeg_header[] = {
0x11, 0x00, 0x3f, 0x00
};
/* pac 7302 */
static const __u8 probe_7302[] = {
/* index,value */
0xff, 0x01, /* page 1 */
0x78, 0x00, /* deactivate */
0xff, 0x01,
0x78, 0x40, /* led off */
};
static const __u8 start_7302[] = {
/* index, len, [value]* */
0x00, 12, 0x01, 0x40, 0x40, 0x40, 0x01, 0xe0, 0x02, 0x80,
0x00, 0x00, 0x00, 0x00,
0x0d, 24, 0x03, 0x01, 0x00, 0xb5, 0x07, 0xcb, 0x00, 0x00,
0x07, 0xc8, 0x00, 0xea, 0x07, 0xcf, 0x07, 0xf7,
0x07, 0x7e, 0x01, 0x0b, 0x00, 0x00, 0x00, 0x11,
0x26, 2, 0xaa, 0xaa,
0x2e, 1, 0x31,
0x38, 1, 0x01,
0x3a, 3, 0x14, 0xff, 0x5a,
0x43, 11, 0x00, 0x0a, 0x18, 0x11, 0x01, 0x2c, 0x88, 0x11,
0x00, 0x54, 0x11,
0x55, 1, 0x00,
0x62, 4, 0x10, 0x1e, 0x1e, 0x18,
0x6b, 1, 0x00,
0x6e, 3, 0x08, 0x06, 0x00,
0x72, 3, 0x00, 0xff, 0x00,
0x7d, 23, 0x01, 0x01, 0x58, 0x46, 0x50, 0x3c, 0x50, 0x3c,
0x54, 0x46, 0x54, 0x56, 0x52, 0x50, 0x52, 0x50,
0x56, 0x64, 0xa4, 0x00, 0xda, 0x00, 0x00,
0xa2, 10, 0x22, 0x2c, 0x3c, 0x54, 0x69, 0x7c, 0x9c, 0xb9,
0xd2, 0xeb,
0xaf, 1, 0x02,
0xb5, 2, 0x08, 0x08,
0xb8, 2, 0x08, 0x88,
0xc4, 4, 0xae, 0x01, 0x04, 0x01,
0xcc, 1, 0x00,
0xd1, 11, 0x01, 0x30, 0x49, 0x5e, 0x6f, 0x7f, 0x8e, 0xa9,
0xc1, 0xd7, 0xec,
0xdc, 1, 0x01,
0xff, 1, 0x01,
0x12, 3, 0x02, 0x00, 0x01,
0x3e, 2, 0x00, 0x00,
0x76, 5, 0x01, 0x20, 0x40, 0x00, 0xf2,
0x7c, 1, 0x00,
0x7f, 10, 0x4b, 0x0f, 0x01, 0x2c, 0x02, 0x58, 0x03, 0x20,
0x02, 0x00,
0x96, 5, 0x01, 0x10, 0x04, 0x01, 0x04,
0xc8, 17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00,
0x07, 0x00, 0x01, 0x07, 0x04, 0x01,
0x01,
0xdb, 2, 0x00, 0x01,
0xde, 8, 0x00, 0x01, 0x04, 0x04, 0x00, 0x00, 0x00,
0xe6, 4, 0x00, 0x00, 0x00, 0x01,
0xeb, 1, 0x00,
0xff, 1, 0x02,
0x22, 1, 0x00,
0xff, 1, 0x03,
0x00, 255, /* load the page 3 */
0x11, 1, 0x01,
0xff, 1, 0x02,
0x13, 1, 0x00,
0x22, 4, 0x1f, 0xa4, 0xf0, 0x96,
0x27, 2, 0x14, 0x0c,
0x2a, 5, 0xc8, 0x00, 0x18, 0x12, 0x22,
0x64, 8, 0x00, 0x00, 0xf0, 0x01, 0x14, 0x44, 0x44, 0x44,
0x6e, 1, 0x08,
0xff, 1, 0x03,
0x78, 1, 0x00,
0, 0 /* end of sequence */
};
/* page 3 - the value 0xaa says skip the index - see reg_w_page() */
static const __u8 page3_7302[] = {
0x90, 0x40, 0x03, 0x50, 0xc2, 0x01, 0x14, 0x16,
0x14, 0x12, 0x00, 0x00, 0x00, 0x02, 0x33, 0x00,
0x0f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x47, 0x01, 0xb3, 0x01, 0x00,
0x00, 0x08, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x21,
0x00, 0x00, 0x00, 0x54, 0xf4, 0x02, 0x52, 0x54,
0xa4, 0xb8, 0xe0, 0x2a, 0xf6, 0x00, 0x00, 0x00,
0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xfc, 0x00, 0xf2, 0x1f, 0x04, 0x00, 0x00,
0x00, 0x00, 0x00, 0xc0, 0xc0, 0x10, 0x00, 0x00,
0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x40, 0xff, 0x03, 0x19, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0xc8, 0xc8,
0xc8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50,
0x08, 0x10, 0x24, 0x40, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x02, 0x47, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x02, 0xfa, 0x00, 0x64, 0x5a, 0x28, 0x00,
0x00
};
/* pac 7311 */
static const __u8 probe_7311[] = {
0x78, 0x40, /* Bit_0=start stream, Bit_7=LED */
0x78, 0x40, /* Bit_0=start stream, Bit_7=LED */
0x78, 0x44, /* Bit_0=start stream, Bit_7=LED */
0xff, 0x04,
0x27, 0x80,
0x28, 0xca,
0x29, 0x53,
0x2a, 0x0e,
0xff, 0x01,
0x3e, 0x20,
};
static const __u8 start_7311[] = {
/* index, len, [value]* */
0xff, 1, 0x01,
0x02, 53, 0x48, 0x0a, 0x40, 0x08, 0x00, 0x00, 0x08, 0x00,
0x06, 0xff, 0x11, 0xff, 0x5a, 0x30, 0x90, 0x4c,
0x00, 0x07, 0x00, 0x0a, 0x10, 0x00, 0xa0, 0x10,
0x02, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00,
0x3e, 52, 0x00, 0x00, 0x78, 0x52, 0x4a, 0x52, 0x78, 0x6e,
0x48, 0x46, 0x48, 0x6e, 0x5f, 0x49, 0x42, 0x49,
0x5f, 0x5f, 0x49, 0x42, 0x49, 0x5f, 0x6e, 0x48,
0x46, 0x48, 0x6e, 0x78, 0x52, 0x4a, 0x52, 0x78,
0x00, 0x00, 0x09, 0x1b, 0x34, 0x49, 0x5c, 0x9b,
0xd0, 0xff,
0x78, 6, 0x44, 0x00, 0xf2, 0x01, 0x01, 0x80,
0x7f, 18, 0x2a, 0x1c, 0x00, 0xc8, 0x02, 0x58, 0x03, 0x84,
0x12, 0x00, 0x1a, 0x04, 0x08, 0x0c, 0x10, 0x14,
0x18, 0x20,
0x96, 3, 0x01, 0x08, 0x04,
0xa0, 4, 0x44, 0x44, 0x44, 0x04,
0xf0, 13, 0x01, 0x00, 0x00, 0x00, 0x22, 0x00, 0x20, 0x00,
0x3f, 0x00, 0x0a, 0x01, 0x00,
0xff, 1, 0x04,
0x00, 254, /* load the page 4 */
0x11, 1, 0x01,
0, 0 /* end of sequence */
};
/* page 4 - the value 0xaa says skip the index - see reg_w_page() */
static const __u8 page4_7311[] = {
0xaa, 0xaa, 0x04, 0x54, 0x07, 0x2b, 0x09, 0x0f,
0x09, 0x00, 0xaa, 0xaa, 0x07, 0x00, 0x00, 0x62,
0x08, 0xaa, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x03, 0xa0, 0x01, 0xf4, 0xaa,
0xaa, 0x00, 0x08, 0xaa, 0x03, 0xaa, 0x00, 0x01,
0xca, 0x10, 0x06, 0x78, 0x00, 0x00, 0x00, 0x00,
0x23, 0x28, 0x04, 0x11, 0x00, 0x00
};
static void reg_w_buf(struct gspca_dev *gspca_dev,
__u16 index,
const char *buffer, __u16 len)
__u8 index,
const char *buffer, int len)
{
memcpy(gspca_dev->usb_buf, buffer, len);
usb_control_msg(gspca_dev->dev,
......@@ -221,7 +374,7 @@ static void reg_w_buf(struct gspca_dev *gspca_dev,
}
static __u8 reg_r(struct gspca_dev *gspca_dev,
__u16 index)
__u8 index)
{
usb_control_msg(gspca_dev->dev,
usb_rcvctrlpipe(gspca_dev->dev, 0),
......@@ -234,7 +387,7 @@ static __u8 reg_r(struct gspca_dev *gspca_dev,
}
static void reg_w(struct gspca_dev *gspca_dev,
__u16 index,
__u8 index,
__u8 value)
{
gspca_dev->usb_buf[0] = value;
......@@ -246,6 +399,74 @@ static void reg_w(struct gspca_dev *gspca_dev,
500);
}
static void reg_w_seq(struct gspca_dev *gspca_dev,
const __u8 *seq, int len)
{
while (--len >= 0) {
reg_w(gspca_dev, seq[0], seq[1]);
seq += 2;
}
}
/* load the beginning of a page */
static void reg_w_page(struct gspca_dev *gspca_dev,
const __u8 *page, int len)
{
int index;
for (index = 0; index < len; index++) {
if (page[index] == 0xaa) /* skip this index */
continue;
gspca_dev->usb_buf[0] = page[index];
usb_control_msg(gspca_dev->dev,
usb_sndctrlpipe(gspca_dev->dev, 0),
0, /* request */
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
0, index, gspca_dev->usb_buf, 1,
500);
}
}
/* output a variable sequence */
static void reg_w_var(struct gspca_dev *gspca_dev,
const __u8 *seq)
{
int index, len;
for (;;) {
index = *seq++;
len = *seq++;
switch (len) {
case 0:
return;
case 254:
reg_w_page(gspca_dev, page4_7311, sizeof page4_7311);
break;
case 255:
reg_w_page(gspca_dev, page3_7302, sizeof page3_7302);
break;
default:
if (len > 32) {
PDEBUG(D_ERR|D_STREAM,
"Incorrect variable sequence");
return;
}
while (len > 0) {
if (len < 8) {
reg_w_buf(gspca_dev, index, seq, len);
seq += len;
break;
}
reg_w_buf(gspca_dev, index, seq, 8);
seq += 8;
index += 8;
len -= 8;
}
}
}
/* not reached */
}
/* this function is called at probe time */
static int sd_config(struct gspca_dev *gspca_dev,
const struct usb_device_id *id)
......@@ -253,22 +474,23 @@ static int sd_config(struct gspca_dev *gspca_dev,
struct sd *sd = (struct sd *) gspca_dev;
struct cam *cam;
PDEBUG(D_CONF, "Find Sensor PAC7311");
reg_w(gspca_dev, 0x78, 0x40); /* Bit_0=start stream, Bit_7=LED */
reg_w(gspca_dev, 0x78, 0x40); /* Bit_0=start stream, Bit_7=LED */
reg_w(gspca_dev, 0x78, 0x44); /* Bit_0=start stream, Bit_7=LED */
reg_w(gspca_dev, 0xff, 0x04);
reg_w(gspca_dev, 0x27, 0x80);
reg_w(gspca_dev, 0x28, 0xca);
reg_w(gspca_dev, 0x29, 0x53);
reg_w(gspca_dev, 0x2a, 0x0e);
reg_w(gspca_dev, 0xff, 0x01);
reg_w(gspca_dev, 0x3e, 0x20);
cam = &gspca_dev->cam;
cam->epaddr = 0x05;
cam->cam_mode = vga_mode;
cam->nmodes = ARRAY_SIZE(vga_mode);
sd->sensor = id->driver_info;
if (sd->sensor == SENSOR_PAC7302) {
PDEBUG(D_CONF, "Find Sensor PAC7302");
reg_w_seq(gspca_dev, probe_7302, sizeof probe_7302);
cam->cam_mode = &vga_mode[2]; /* only 640x480 */
cam->nmodes = 1;
} else {
PDEBUG(D_CONF, "Find Sensor PAC7311");
reg_w_seq(gspca_dev, probe_7302, sizeof probe_7302);
cam->cam_mode = vga_mode;
cam->nmodes = ARRAY_SIZE(vga_mode);
}
sd->brightness = BRIGHTNESS_DEF;
sd->contrast = CONTRAST_DEF;
......@@ -283,10 +505,11 @@ static void setbrightness(struct gspca_dev *gspca_dev)
struct sd *sd = (struct sd *) gspca_dev;
int brightness;
if (sd->sensor == SENSOR_PAC7302)
return;
/*jfm: inverted?*/
brightness = BRIGHTNESS_MAX - sd->brightness;
reg_w(gspca_dev, 0xff, 0x04);
/* reg_w(gspca_dev, 0x0e, 0x00); */
reg_w(gspca_dev, 0x0f, brightness);
/* load registers to sensor (Bit 0, auto clear) */
reg_w(gspca_dev, 0x11, 0x01);
......@@ -297,6 +520,8 @@ static void setcontrast(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
if (sd->sensor == SENSOR_PAC7302)
return;
reg_w(gspca_dev, 0xff, 0x01);
reg_w(gspca_dev, 0x80, sd->contrast);
/* load registers to sensor (Bit 0, auto clear) */
......@@ -308,6 +533,8 @@ static void setcolors(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
if (sd->sensor == SENSOR_PAC7302)
return;
reg_w(gspca_dev, 0xff, 0x01);
reg_w(gspca_dev, 0x10, sd->colors);
/* load registers to sensor (Bit 0, auto clear) */
......@@ -340,75 +567,12 @@ static void sd_start(struct gspca_dev *gspca_dev)
sd->ffnb = 0;
sd->tosof = 0;
reg_w(gspca_dev, 0xff, 0x01);
reg_w_buf(gspca_dev, 0x0002, "\x48\x0a\x40\x08\x00\x00\x08\x00", 8);
reg_w_buf(gspca_dev, 0x000a, "\x06\xff\x11\xff\x5a\x30\x90\x4c", 8);
reg_w_buf(gspca_dev, 0x0012, "\x00\x07\x00\x0a\x10\x00\xa0\x10", 8);
reg_w_buf(gspca_dev, 0x001a, "\x02\x00\x00\x00\x00\x0b\x01\x00", 8);
reg_w_buf(gspca_dev, 0x0022, "\x00\x00\x00\x00\x00\x00\x00\x00", 8);
reg_w_buf(gspca_dev, 0x002a, "\x00\x00\x00", 3);
reg_w_buf(gspca_dev, 0x003e, "\x00\x00\x78\x52\x4a\x52\x78\x6e", 8);
reg_w_buf(gspca_dev, 0x0046, "\x48\x46\x48\x6e\x5f\x49\x42\x49", 8);
reg_w_buf(gspca_dev, 0x004e, "\x5f\x5f\x49\x42\x49\x5f\x6e\x48", 8);
reg_w_buf(gspca_dev, 0x0056, "\x46\x48\x6e\x78\x52\x4a\x52\x78", 8);
reg_w_buf(gspca_dev, 0x005e, "\x00\x00\x09\x1b\x34\x49\x5c\x9b", 8);
reg_w_buf(gspca_dev, 0x0066, "\xd0\xff", 2);
reg_w_buf(gspca_dev, 0x0078, "\x44\x00\xf2\x01\x01\x80", 6);
reg_w_buf(gspca_dev, 0x007f, "\x2a\x1c\x00\xc8\x02\x58\x03\x84", 8);
reg_w_buf(gspca_dev, 0x0087, "\x12\x00\x1a\x04\x08\x0c\x10\x14", 8);
reg_w_buf(gspca_dev, 0x008f, "\x18\x20", 2);
reg_w_buf(gspca_dev, 0x0096, "\x01\x08\x04", 3);
reg_w_buf(gspca_dev, 0x00a0, "\x44\x44\x44\x04", 4);
reg_w_buf(gspca_dev, 0x00f0, "\x01\x00\x00\x00\x22\x00\x20\x00", 8);
reg_w_buf(gspca_dev, 0x00f8, "\x3f\x00\x0a\x01\x00", 5);
reg_w(gspca_dev, 0xff, 0x04);
reg_w(gspca_dev, 0x02, 0x04);
reg_w(gspca_dev, 0x03, 0x54);
reg_w(gspca_dev, 0x04, 0x07);
reg_w(gspca_dev, 0x05, 0x2b);
reg_w(gspca_dev, 0x06, 0x09);
reg_w(gspca_dev, 0x07, 0x0f);
reg_w(gspca_dev, 0x08, 0x09);
reg_w(gspca_dev, 0x09, 0x00);
reg_w(gspca_dev, 0x0c, 0x07);
reg_w(gspca_dev, 0x0d, 0x00);
reg_w(gspca_dev, 0x0e, 0x00);
reg_w(gspca_dev, 0x0f, 0x62);
reg_w(gspca_dev, 0x10, 0x08);
reg_w(gspca_dev, 0x12, 0x07);
reg_w(gspca_dev, 0x13, 0x00);
reg_w(gspca_dev, 0x14, 0x00);
reg_w(gspca_dev, 0x15, 0x00);
reg_w(gspca_dev, 0x16, 0x00);
reg_w(gspca_dev, 0x17, 0x00);
reg_w(gspca_dev, 0x18, 0x00);
reg_w(gspca_dev, 0x19, 0x00);
reg_w(gspca_dev, 0x1a, 0x00);
reg_w(gspca_dev, 0x1b, 0x03);
reg_w(gspca_dev, 0x1c, 0xa0);
reg_w(gspca_dev, 0x1d, 0x01);
reg_w(gspca_dev, 0x1e, 0xf4);
reg_w(gspca_dev, 0x21, 0x00);
reg_w(gspca_dev, 0x22, 0x08);
reg_w(gspca_dev, 0x24, 0x03);
reg_w(gspca_dev, 0x26, 0x00);
reg_w(gspca_dev, 0x27, 0x01);
reg_w(gspca_dev, 0x28, 0xca);
reg_w(gspca_dev, 0x29, 0x10);
reg_w(gspca_dev, 0x2a, 0x06);
reg_w(gspca_dev, 0x2b, 0x78);
reg_w(gspca_dev, 0x2c, 0x00);
reg_w(gspca_dev, 0x2d, 0x00);
reg_w(gspca_dev, 0x2e, 0x00);
reg_w(gspca_dev, 0x2f, 0x00);
reg_w(gspca_dev, 0x30, 0x23);
reg_w(gspca_dev, 0x31, 0x28);
reg_w(gspca_dev, 0x32, 0x04);
reg_w(gspca_dev, 0x33, 0x11);
reg_w(gspca_dev, 0x34, 0x00);
reg_w(gspca_dev, 0x35, 0x00);
reg_w(gspca_dev, 0x11, 0x01);
if (sd->sensor == SENSOR_PAC7302)
reg_w_var(gspca_dev, start_7302);
else
reg_w_var(gspca_dev, start_7311);
setcontrast(gspca_dev);
setbrightness(gspca_dev);
setcolors(gspca_dev);
......@@ -416,7 +580,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
/* set correct resolution */
switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) {
case 2: /* 160x120 */
case 2: /* 160x120 pac7311 */
reg_w(gspca_dev, 0xff, 0x04);
reg_w(gspca_dev, 0x02, 0x03);
reg_w(gspca_dev, 0xff, 0x01);
......@@ -426,7 +590,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
/* reg_w(gspca_dev, 0x80, 0x69); */
reg_w(gspca_dev, 0x87, 0x10);
break;
case 1: /* 320x240 */
case 1: /* 320x240 pac7311 */
reg_w(gspca_dev, 0xff, 0x04);
reg_w(gspca_dev, 0x02, 0x03);
reg_w(gspca_dev, 0xff, 0x01);
......@@ -436,6 +600,8 @@ static void sd_start(struct gspca_dev *gspca_dev)
reg_w(gspca_dev, 0x87, 0x11);
break;
case 0: /* 640x480 */
if (sd->sensor == SENSOR_PAC7302)
break;
reg_w(gspca_dev, 0xff, 0x04);
reg_w(gspca_dev, 0x02, 0x03);
reg_w(gspca_dev, 0xff, 0x01);
......@@ -448,12 +614,25 @@ static void sd_start(struct gspca_dev *gspca_dev)
/* start stream */
reg_w(gspca_dev, 0xff, 0x01);
reg_w(gspca_dev, 0x78, 0x04);
reg_w(gspca_dev, 0x78, 0x05);
if (sd->sensor == SENSOR_PAC7302) {
reg_w(gspca_dev, 0x78, 0x01);
reg_w(gspca_dev, 0xff, 0x01);
reg_w(gspca_dev, 0x78, 0x01);
} else {
reg_w(gspca_dev, 0x78, 0x04);
reg_w(gspca_dev, 0x78, 0x05);
}
}
static void sd_stopN(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
if (sd->sensor == SENSOR_PAC7302) {
reg_w(gspca_dev, 0x78, 0x00);
reg_w(gspca_dev, 0x78, 0x00);
return;
}
reg_w(gspca_dev, 0xff, 0x04);
reg_w(gspca_dev, 0x27, 0x80);
reg_w(gspca_dev, 0x28, 0xca);
......@@ -468,21 +647,17 @@ static void sd_stopN(struct gspca_dev *gspca_dev)
static void sd_stop0(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
if (sd->sensor == SENSOR_PAC7302) {
reg_w(gspca_dev, 0xff, 0x01);
reg_w(gspca_dev, 0x78, 0x40);
}
}
/* this function is called at close time */
static void sd_close(struct gspca_dev *gspca_dev)
{
reg_w(gspca_dev, 0xff, 0x04);
reg_w(gspca_dev, 0x27, 0x80);
reg_w(gspca_dev, 0x28, 0xca);
reg_w(gspca_dev, 0x29, 0x53);
reg_w(gspca_dev, 0x2a, 0x0e);
reg_w(gspca_dev, 0xff, 0x01);
reg_w(gspca_dev, 0x3e, 0x20);
reg_w(gspca_dev, 0x78, 0x04); /* Bit_0=start stream, Bit_7=LED */
reg_w(gspca_dev, 0x78, 0x44); /* Bit_0=start stream, Bit_7=LED */
reg_w(gspca_dev, 0x78, 0x44); /* Bit_0=start stream, Bit_7=LED */
}
static void do_autogain(struct gspca_dev *gspca_dev)
......@@ -509,10 +684,17 @@ static void do_autogain(struct gspca_dev *gspca_dev)
else if (Gbright < 4)
Gbright = 4;
PDEBUG(D_FRAM, "gbright %d", Gbright);
reg_w(gspca_dev, 0xff, 0x04);
reg_w(gspca_dev, 0x0f, Gbright);
/* load registers to sensor (Bit 0, auto clear) */
reg_w(gspca_dev, 0x11, 0x01);
if (sd->sensor == SENSOR_PAC7302) {
reg_w(gspca_dev, 0xff, 0x03);
reg_w(gspca_dev, 0x10, Gbright);
/* load registers to sensor (Bit 0, auto clear) */
reg_w(gspca_dev, 0x11, 0x01);
} else {
reg_w(gspca_dev, 0xff, 0x04);
reg_w(gspca_dev, 0x0f, Gbright);
/* load registers to sensor (Bit 0, auto clear) */
reg_w(gspca_dev, 0x11, 0x01);
}
}
}
......@@ -636,15 +818,6 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
}
}
static void getbrightness(struct gspca_dev *gspca_dev)
{
/* sd->brightness = reg_r(gspca_dev, 0x08);
return sd->brightness; */
/* PDEBUG(D_CONF, "Called pac7311_getbrightness: Not implemented yet"); */
}
static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val)
{
struct sd *sd = (struct sd *) gspca_dev;
......@@ -659,7 +832,6 @@ static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val)
{
struct sd *sd = (struct sd *) gspca_dev;
getbrightness(gspca_dev);
*val = sd->brightness;
return 0;
}
......@@ -678,7 +850,6 @@ static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val)
{
struct sd *sd = (struct sd *) gspca_dev;
/* getcontrast(gspca_dev); */
*val = sd->contrast;
return 0;
}
......@@ -697,7 +868,6 @@ static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val)
{
struct sd *sd = (struct sd *) gspca_dev;
/* getcolors(gspca_dev); */
*val = sd->colors;
return 0;
}
......@@ -737,13 +907,13 @@ static struct sd_desc sd_desc = {
/* -- module initialisation -- */
static __devinitdata struct usb_device_id device_table[] = {
{USB_DEVICE(0x093a, 0x2600)},
{USB_DEVICE(0x093a, 0x2601)},
{USB_DEVICE(0x093a, 0x2603)},
{USB_DEVICE(0x093a, 0x2608)},
{USB_DEVICE(0x093a, 0x260e)},
{USB_DEVICE(0x093a, 0x260f)},
{USB_DEVICE(0x093a, 0x2621)},
{USB_DEVICE(0x093a, 0x2600), .driver_info = SENSOR_PAC7311},
{USB_DEVICE(0x093a, 0x2601), .driver_info = SENSOR_PAC7311},
{USB_DEVICE(0x093a, 0x2603), .driver_info = SENSOR_PAC7311},
{USB_DEVICE(0x093a, 0x2608), .driver_info = SENSOR_PAC7311},
{USB_DEVICE(0x093a, 0x260e), .driver_info = SENSOR_PAC7311},
{USB_DEVICE(0x093a, 0x260f), .driver_info = SENSOR_PAC7311},
{USB_DEVICE(0x093a, 0x2621), .driver_info = SENSOR_PAC7302},
{}
};
MODULE_DEVICE_TABLE(usb, device_table);
......
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