aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-01-21 19:50:31 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-01-21 19:50:31 -0500
commit13a3cec8443290b082af2a5254562aca247fe591 (patch)
tree5c873a2c9333be348266234ac5d7101caa1b6d7d /drivers/media/video/gspca
parent973c9f4f49ca96a53bcf6384c4c59ccd26c33906 (diff)
parent88914bdf8c677ebd7e797adac05e47303fd6ac77 (diff)
Merge branch 'media_fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6
* 'media_fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6: (101 commits) [media] staging/lirc: fix mem leaks and ptr err usage [media] hdpvr: reduce latency of i2c read/write w/recycled buffer [media] hdpvr: enable IR part [media] rc/mceusb: timeout should be in ns, not us [media] v4l2-device: fix 'use-after-freed' oops [media] v4l2-dev: don't memset video_device.dev [media] zoran: use video_device_alloc instead of kmalloc [media] w9966: zero device state after a detach [media] v4l: Fix a use-before-set in the control framework [media] v4l: Include linux/videodev2.h in media/v4l2-ctrls.h [media] DocBook/v4l: update V4L2 revision and update copyright years [media] DocBook/v4l: fix validation error in dev-rds.xml [media] v4l2-ctrls: queryctrl shouldn't attempt to replace V4L2_CID_PRIVATE_BASE IDs [media] v4l2-ctrls: fix missing 'read-only' check [media] pvrusb2: Provide more information about IR units to lirc_zilog and ir-kbd-i2c [media] ir-kbd-i2c: Add back defaults setting for Zilog Z8's at addr 0x71 [media] lirc_zilog: Update TODO.lirc_zilog [media] lirc_zilog: Add Andy Walls to copyright notice and authors list [media] lirc_zilog: Remove useless struct i2c_driver.command function [media] lirc_zilog: Remove unneeded tests for existence of the IR Tx function ...
Diffstat (limited to 'drivers/media/video/gspca')
-rw-r--r--drivers/media/video/gspca/benq.c2
-rw-r--r--drivers/media/video/gspca/conex.c4
-rw-r--r--drivers/media/video/gspca/cpia1.c2
-rw-r--r--drivers/media/video/gspca/etoms.c4
-rw-r--r--drivers/media/video/gspca/finepix.c2
-rw-r--r--drivers/media/video/gspca/gl860/gl860.c2
-rw-r--r--drivers/media/video/gspca/gspca.c210
-rw-r--r--drivers/media/video/gspca/gspca.h2
-rw-r--r--drivers/media/video/gspca/jeilinj.c2
-rw-r--r--drivers/media/video/gspca/jpeg.h4
-rw-r--r--drivers/media/video/gspca/konica.c2
-rw-r--r--drivers/media/video/gspca/m5602/m5602_core.c2
-rw-r--r--drivers/media/video/gspca/mars.c2
-rw-r--r--drivers/media/video/gspca/mr97310a.c2
-rw-r--r--drivers/media/video/gspca/ov519.c8
-rw-r--r--drivers/media/video/gspca/ov534.c29
-rw-r--r--drivers/media/video/gspca/ov534_9.c2
-rw-r--r--drivers/media/video/gspca/pac207.c2
-rw-r--r--drivers/media/video/gspca/pac7302.c4
-rw-r--r--drivers/media/video/gspca/pac7311.c4
-rw-r--r--drivers/media/video/gspca/sn9c2028.c2
-rw-r--r--drivers/media/video/gspca/sn9c20x.c2
-rw-r--r--drivers/media/video/gspca/sonixb.c270
-rw-r--r--drivers/media/video/gspca/sonixj.c155
-rw-r--r--drivers/media/video/gspca/spca1528.c2
-rw-r--r--drivers/media/video/gspca/spca500.c2
-rw-r--r--drivers/media/video/gspca/spca501.c2
-rw-r--r--drivers/media/video/gspca/spca505.c2
-rw-r--r--drivers/media/video/gspca/spca508.c2
-rw-r--r--drivers/media/video/gspca/spca561.c2
-rw-r--r--drivers/media/video/gspca/sq905.c2
-rw-r--r--drivers/media/video/gspca/sq905c.c2
-rw-r--r--drivers/media/video/gspca/sq930x.c2
-rw-r--r--drivers/media/video/gspca/stk014.c2
-rw-r--r--drivers/media/video/gspca/stv0680.c2
-rw-r--r--drivers/media/video/gspca/stv06xx/stv06xx.c2
-rw-r--r--drivers/media/video/gspca/sunplus.c2
-rw-r--r--drivers/media/video/gspca/t613.c2
-rw-r--r--drivers/media/video/gspca/tv8532.c2
-rw-r--r--drivers/media/video/gspca/vc032x.c2
-rw-r--r--drivers/media/video/gspca/xirlink_cit.c2
-rw-r--r--drivers/media/video/gspca/zc3xx.c2
42 files changed, 394 insertions, 362 deletions
diff --git a/drivers/media/video/gspca/benq.c b/drivers/media/video/gspca/benq.c
index 62904393350..a09c4709d61 100644
--- a/drivers/media/video/gspca/benq.c
+++ b/drivers/media/video/gspca/benq.c
@@ -276,7 +276,7 @@ static const struct sd_desc sd_desc = {
276}; 276};
277 277
278/* -- module initialisation -- */ 278/* -- module initialisation -- */
279static const __devinitdata struct usb_device_id device_table[] = { 279static const struct usb_device_id device_table[] = {
280 {USB_DEVICE(0x04a5, 0x3035)}, 280 {USB_DEVICE(0x04a5, 0x3035)},
281 {} 281 {}
282}; 282};
diff --git a/drivers/media/video/gspca/conex.c b/drivers/media/video/gspca/conex.c
index 1eacb6c7926..8b398493f96 100644
--- a/drivers/media/video/gspca/conex.c
+++ b/drivers/media/video/gspca/conex.c
@@ -1040,14 +1040,14 @@ static const struct sd_desc sd_desc = {
1040}; 1040};
1041 1041
1042/* -- module initialisation -- */ 1042/* -- module initialisation -- */
1043static const struct usb_device_id device_table[] __devinitconst = { 1043static const struct usb_device_id device_table[] = {
1044 {USB_DEVICE(0x0572, 0x0041)}, 1044 {USB_DEVICE(0x0572, 0x0041)},
1045 {} 1045 {}
1046}; 1046};
1047MODULE_DEVICE_TABLE(usb, device_table); 1047MODULE_DEVICE_TABLE(usb, device_table);
1048 1048
1049/* -- device connect -- */ 1049/* -- device connect -- */
1050static int __devinit sd_probe(struct usb_interface *intf, 1050static int sd_probe(struct usb_interface *intf,
1051 const struct usb_device_id *id) 1051 const struct usb_device_id *id)
1052{ 1052{
1053 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), 1053 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
diff --git a/drivers/media/video/gspca/cpia1.c b/drivers/media/video/gspca/cpia1.c
index c1ae05f4661..4bf2cab98d6 100644
--- a/drivers/media/video/gspca/cpia1.c
+++ b/drivers/media/video/gspca/cpia1.c
@@ -2088,7 +2088,7 @@ static const struct sd_desc sd_desc = {
2088}; 2088};
2089 2089
2090/* -- module initialisation -- */ 2090/* -- module initialisation -- */
2091static const __devinitdata struct usb_device_id device_table[] = { 2091static const struct usb_device_id device_table[] = {
2092 {USB_DEVICE(0x0553, 0x0002)}, 2092 {USB_DEVICE(0x0553, 0x0002)},
2093 {USB_DEVICE(0x0813, 0x0001)}, 2093 {USB_DEVICE(0x0813, 0x0001)},
2094 {} 2094 {}
diff --git a/drivers/media/video/gspca/etoms.c b/drivers/media/video/gspca/etoms.c
index a594b36d619..4b2c483fce6 100644
--- a/drivers/media/video/gspca/etoms.c
+++ b/drivers/media/video/gspca/etoms.c
@@ -864,7 +864,7 @@ static const struct sd_desc sd_desc = {
864}; 864};
865 865
866/* -- module initialisation -- */ 866/* -- module initialisation -- */
867static const struct usb_device_id device_table[] __devinitconst = { 867static const struct usb_device_id device_table[] = {
868 {USB_DEVICE(0x102c, 0x6151), .driver_info = SENSOR_PAS106}, 868 {USB_DEVICE(0x102c, 0x6151), .driver_info = SENSOR_PAS106},
869#if !defined CONFIG_USB_ET61X251 && !defined CONFIG_USB_ET61X251_MODULE 869#if !defined CONFIG_USB_ET61X251 && !defined CONFIG_USB_ET61X251_MODULE
870 {USB_DEVICE(0x102c, 0x6251), .driver_info = SENSOR_TAS5130CXX}, 870 {USB_DEVICE(0x102c, 0x6251), .driver_info = SENSOR_TAS5130CXX},
@@ -875,7 +875,7 @@ static const struct usb_device_id device_table[] __devinitconst = {
875MODULE_DEVICE_TABLE(usb, device_table); 875MODULE_DEVICE_TABLE(usb, device_table);
876 876
877/* -- device connect -- */ 877/* -- device connect -- */
878static int __devinit sd_probe(struct usb_interface *intf, 878static int sd_probe(struct usb_interface *intf,
879 const struct usb_device_id *id) 879 const struct usb_device_id *id)
880{ 880{
881 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), 881 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
diff --git a/drivers/media/video/gspca/finepix.c b/drivers/media/video/gspca/finepix.c
index d78226455d1..987b4b69d7a 100644
--- a/drivers/media/video/gspca/finepix.c
+++ b/drivers/media/video/gspca/finepix.c
@@ -229,7 +229,7 @@ static void sd_stop0(struct gspca_dev *gspca_dev)
229} 229}
230 230
231/* Table of supported USB devices */ 231/* Table of supported USB devices */
232static const __devinitdata struct usb_device_id device_table[] = { 232static const struct usb_device_id device_table[] = {
233 {USB_DEVICE(0x04cb, 0x0104)}, 233 {USB_DEVICE(0x04cb, 0x0104)},
234 {USB_DEVICE(0x04cb, 0x0109)}, 234 {USB_DEVICE(0x04cb, 0x0109)},
235 {USB_DEVICE(0x04cb, 0x010b)}, 235 {USB_DEVICE(0x04cb, 0x010b)},
diff --git a/drivers/media/video/gspca/gl860/gl860.c b/drivers/media/video/gspca/gl860/gl860.c
index b05bec7321b..99083038cec 100644
--- a/drivers/media/video/gspca/gl860/gl860.c
+++ b/drivers/media/video/gspca/gl860/gl860.c
@@ -488,7 +488,7 @@ static void sd_callback(struct gspca_dev *gspca_dev)
488 488
489/*=================== USB driver structure initialisation ==================*/ 489/*=================== USB driver structure initialisation ==================*/
490 490
491static const __devinitdata struct usb_device_id device_table[] = { 491static const struct usb_device_id device_table[] = {
492 {USB_DEVICE(0x05e3, 0x0503)}, 492 {USB_DEVICE(0x05e3, 0x0503)},
493 {USB_DEVICE(0x05e3, 0xf191)}, 493 {USB_DEVICE(0x05e3, 0xf191)},
494 {} 494 {}
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c
index 442970073e8..f21f2a258ae 100644
--- a/drivers/media/video/gspca/gspca.c
+++ b/drivers/media/video/gspca/gspca.c
@@ -55,7 +55,7 @@ MODULE_AUTHOR("Jean-François Moine <http://moinejf.free.fr>");
55MODULE_DESCRIPTION("GSPCA USB Camera Driver"); 55MODULE_DESCRIPTION("GSPCA USB Camera Driver");
56MODULE_LICENSE("GPL"); 56MODULE_LICENSE("GPL");
57 57
58#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 11, 0) 58#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 12, 0)
59 59
60#ifdef GSPCA_DEBUG 60#ifdef GSPCA_DEBUG
61int gspca_debug = D_ERR | D_PROBE; 61int gspca_debug = D_ERR | D_PROBE;
@@ -508,8 +508,8 @@ static int gspca_is_compressed(__u32 format)
508 return 0; 508 return 0;
509} 509}
510 510
511static int frame_alloc(struct gspca_dev *gspca_dev, 511static int frame_alloc(struct gspca_dev *gspca_dev, struct file *file,
512 unsigned int count) 512 enum v4l2_memory memory, unsigned int count)
513{ 513{
514 struct gspca_frame *frame; 514 struct gspca_frame *frame;
515 unsigned int frsz; 515 unsigned int frsz;
@@ -519,7 +519,6 @@ static int frame_alloc(struct gspca_dev *gspca_dev,
519 frsz = gspca_dev->cam.cam_mode[i].sizeimage; 519 frsz = gspca_dev->cam.cam_mode[i].sizeimage;
520 PDEBUG(D_STREAM, "frame alloc frsz: %d", frsz); 520 PDEBUG(D_STREAM, "frame alloc frsz: %d", frsz);
521 frsz = PAGE_ALIGN(frsz); 521 frsz = PAGE_ALIGN(frsz);
522 gspca_dev->frsz = frsz;
523 if (count >= GSPCA_MAX_FRAMES) 522 if (count >= GSPCA_MAX_FRAMES)
524 count = GSPCA_MAX_FRAMES - 1; 523 count = GSPCA_MAX_FRAMES - 1;
525 gspca_dev->frbuf = vmalloc_32(frsz * count); 524 gspca_dev->frbuf = vmalloc_32(frsz * count);
@@ -527,6 +526,9 @@ static int frame_alloc(struct gspca_dev *gspca_dev,
527 err("frame alloc failed"); 526 err("frame alloc failed");
528 return -ENOMEM; 527 return -ENOMEM;
529 } 528 }
529 gspca_dev->capt_file = file;
530 gspca_dev->memory = memory;
531 gspca_dev->frsz = frsz;
530 gspca_dev->nframes = count; 532 gspca_dev->nframes = count;
531 for (i = 0; i < count; i++) { 533 for (i = 0; i < count; i++) {
532 frame = &gspca_dev->frame[i]; 534 frame = &gspca_dev->frame[i];
@@ -535,7 +537,7 @@ static int frame_alloc(struct gspca_dev *gspca_dev,
535 frame->v4l2_buf.flags = 0; 537 frame->v4l2_buf.flags = 0;
536 frame->v4l2_buf.field = V4L2_FIELD_NONE; 538 frame->v4l2_buf.field = V4L2_FIELD_NONE;
537 frame->v4l2_buf.length = frsz; 539 frame->v4l2_buf.length = frsz;
538 frame->v4l2_buf.memory = gspca_dev->memory; 540 frame->v4l2_buf.memory = memory;
539 frame->v4l2_buf.sequence = 0; 541 frame->v4l2_buf.sequence = 0;
540 frame->data = gspca_dev->frbuf + i * frsz; 542 frame->data = gspca_dev->frbuf + i * frsz;
541 frame->v4l2_buf.m.offset = i * frsz; 543 frame->v4l2_buf.m.offset = i * frsz;
@@ -558,6 +560,9 @@ static void frame_free(struct gspca_dev *gspca_dev)
558 gspca_dev->frame[i].data = NULL; 560 gspca_dev->frame[i].data = NULL;
559 } 561 }
560 gspca_dev->nframes = 0; 562 gspca_dev->nframes = 0;
563 gspca_dev->frsz = 0;
564 gspca_dev->capt_file = NULL;
565 gspca_dev->memory = GSPCA_MEMORY_NO;
561} 566}
562 567
563static void destroy_urbs(struct gspca_dev *gspca_dev) 568static void destroy_urbs(struct gspca_dev *gspca_dev)
@@ -1210,29 +1215,15 @@ static void gspca_release(struct video_device *vfd)
1210static int dev_open(struct file *file) 1215static int dev_open(struct file *file)
1211{ 1216{
1212 struct gspca_dev *gspca_dev; 1217 struct gspca_dev *gspca_dev;
1213 int ret;
1214 1218
1215 PDEBUG(D_STREAM, "[%s] open", current->comm); 1219 PDEBUG(D_STREAM, "[%s] open", current->comm);
1216 gspca_dev = (struct gspca_dev *) video_devdata(file); 1220 gspca_dev = (struct gspca_dev *) video_devdata(file);
1217 if (mutex_lock_interruptible(&gspca_dev->queue_lock)) 1221 if (!gspca_dev->present)
1218 return -ERESTARTSYS; 1222 return -ENODEV;
1219 if (!gspca_dev->present) {
1220 ret = -ENODEV;
1221 goto out;
1222 }
1223
1224 if (gspca_dev->users > 4) { /* (arbitrary value) */
1225 ret = -EBUSY;
1226 goto out;
1227 }
1228 1223
1229 /* protect the subdriver against rmmod */ 1224 /* protect the subdriver against rmmod */
1230 if (!try_module_get(gspca_dev->module)) { 1225 if (!try_module_get(gspca_dev->module))
1231 ret = -ENODEV; 1226 return -ENODEV;
1232 goto out;
1233 }
1234
1235 gspca_dev->users++;
1236 1227
1237 file->private_data = gspca_dev; 1228 file->private_data = gspca_dev;
1238#ifdef GSPCA_DEBUG 1229#ifdef GSPCA_DEBUG
@@ -1244,14 +1235,7 @@ static int dev_open(struct file *file)
1244 gspca_dev->vdev.debug &= ~(V4L2_DEBUG_IOCTL 1235 gspca_dev->vdev.debug &= ~(V4L2_DEBUG_IOCTL
1245 | V4L2_DEBUG_IOCTL_ARG); 1236 | V4L2_DEBUG_IOCTL_ARG);
1246#endif 1237#endif
1247 ret = 0; 1238 return 0;
1248out:
1249 mutex_unlock(&gspca_dev->queue_lock);
1250 if (ret != 0)
1251 PDEBUG(D_ERR|D_STREAM, "open failed err %d", ret);
1252 else
1253 PDEBUG(D_STREAM, "open done");
1254 return ret;
1255} 1239}
1256 1240
1257static int dev_close(struct file *file) 1241static int dev_close(struct file *file)
@@ -1261,7 +1245,6 @@ static int dev_close(struct file *file)
1261 PDEBUG(D_STREAM, "[%s] close", current->comm); 1245 PDEBUG(D_STREAM, "[%s] close", current->comm);
1262 if (mutex_lock_interruptible(&gspca_dev->queue_lock)) 1246 if (mutex_lock_interruptible(&gspca_dev->queue_lock))
1263 return -ERESTARTSYS; 1247 return -ERESTARTSYS;
1264 gspca_dev->users--;
1265 1248
1266 /* if the file did the capture, free the streaming resources */ 1249 /* if the file did the capture, free the streaming resources */
1267 if (gspca_dev->capt_file == file) { 1250 if (gspca_dev->capt_file == file) {
@@ -1272,8 +1255,6 @@ static int dev_close(struct file *file)
1272 mutex_unlock(&gspca_dev->usb_lock); 1255 mutex_unlock(&gspca_dev->usb_lock);
1273 } 1256 }
1274 frame_free(gspca_dev); 1257 frame_free(gspca_dev);
1275 gspca_dev->capt_file = NULL;
1276 gspca_dev->memory = GSPCA_MEMORY_NO;
1277 } 1258 }
1278 file->private_data = NULL; 1259 file->private_data = NULL;
1279 module_put(gspca_dev->module); 1260 module_put(gspca_dev->module);
@@ -1516,6 +1497,7 @@ static int vidioc_reqbufs(struct file *file, void *priv,
1516 return -ERESTARTSYS; 1497 return -ERESTARTSYS;
1517 1498
1518 if (gspca_dev->memory != GSPCA_MEMORY_NO 1499 if (gspca_dev->memory != GSPCA_MEMORY_NO
1500 && gspca_dev->memory != GSPCA_MEMORY_READ
1519 && gspca_dev->memory != rb->memory) { 1501 && gspca_dev->memory != rb->memory) {
1520 ret = -EBUSY; 1502 ret = -EBUSY;
1521 goto out; 1503 goto out;
@@ -1544,19 +1526,18 @@ static int vidioc_reqbufs(struct file *file, void *priv,
1544 gspca_stream_off(gspca_dev); 1526 gspca_stream_off(gspca_dev);
1545 mutex_unlock(&gspca_dev->usb_lock); 1527 mutex_unlock(&gspca_dev->usb_lock);
1546 } 1528 }
1529 /* Don't restart the stream when switching from read to mmap mode */
1530 if (gspca_dev->memory == GSPCA_MEMORY_READ)
1531 streaming = 0;
1547 1532
1548 /* free the previous allocated buffers, if any */ 1533 /* free the previous allocated buffers, if any */
1549 if (gspca_dev->nframes != 0) { 1534 if (gspca_dev->nframes != 0)
1550 frame_free(gspca_dev); 1535 frame_free(gspca_dev);
1551 gspca_dev->capt_file = NULL;
1552 }
1553 if (rb->count == 0) /* unrequest */ 1536 if (rb->count == 0) /* unrequest */
1554 goto out; 1537 goto out;
1555 gspca_dev->memory = rb->memory; 1538 ret = frame_alloc(gspca_dev, file, rb->memory, rb->count);
1556 ret = frame_alloc(gspca_dev, rb->count);
1557 if (ret == 0) { 1539 if (ret == 0) {
1558 rb->count = gspca_dev->nframes; 1540 rb->count = gspca_dev->nframes;
1559 gspca_dev->capt_file = file;
1560 if (streaming) 1541 if (streaming)
1561 ret = gspca_init_transfer(gspca_dev); 1542 ret = gspca_init_transfer(gspca_dev);
1562 } 1543 }
@@ -1630,11 +1611,15 @@ static int vidioc_streamoff(struct file *file, void *priv,
1630 1611
1631 if (buf_type != V4L2_BUF_TYPE_VIDEO_CAPTURE) 1612 if (buf_type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
1632 return -EINVAL; 1613 return -EINVAL;
1633 if (!gspca_dev->streaming) 1614
1634 return 0;
1635 if (mutex_lock_interruptible(&gspca_dev->queue_lock)) 1615 if (mutex_lock_interruptible(&gspca_dev->queue_lock))
1636 return -ERESTARTSYS; 1616 return -ERESTARTSYS;
1637 1617
1618 if (!gspca_dev->streaming) {
1619 ret = 0;
1620 goto out;
1621 }
1622
1638 /* check the capture file */ 1623 /* check the capture file */
1639 if (gspca_dev->capt_file != file) { 1624 if (gspca_dev->capt_file != file) {
1640 ret = -EBUSY; 1625 ret = -EBUSY;
@@ -1649,6 +1634,8 @@ static int vidioc_streamoff(struct file *file, void *priv,
1649 gspca_dev->usb_err = 0; 1634 gspca_dev->usb_err = 0;
1650 gspca_stream_off(gspca_dev); 1635 gspca_stream_off(gspca_dev);
1651 mutex_unlock(&gspca_dev->usb_lock); 1636 mutex_unlock(&gspca_dev->usb_lock);
1637 /* In case another thread is waiting in dqbuf */
1638 wake_up_interruptible(&gspca_dev->wq);
1652 1639
1653 /* empty the transfer queues */ 1640 /* empty the transfer queues */
1654 atomic_set(&gspca_dev->fr_q, 0); 1641 atomic_set(&gspca_dev->fr_q, 0);
@@ -1827,33 +1814,77 @@ out:
1827 return ret; 1814 return ret;
1828} 1815}
1829 1816
1817static int frame_ready_nolock(struct gspca_dev *gspca_dev, struct file *file,
1818 enum v4l2_memory memory)
1819{
1820 if (!gspca_dev->present)
1821 return -ENODEV;
1822 if (gspca_dev->capt_file != file || gspca_dev->memory != memory ||
1823 !gspca_dev->streaming)
1824 return -EINVAL;
1825
1826 /* check if a frame is ready */
1827 return gspca_dev->fr_o != atomic_read(&gspca_dev->fr_i);
1828}
1829
1830static int frame_ready(struct gspca_dev *gspca_dev, struct file *file,
1831 enum v4l2_memory memory)
1832{
1833 int ret;
1834
1835 if (mutex_lock_interruptible(&gspca_dev->queue_lock))
1836 return -ERESTARTSYS;
1837 ret = frame_ready_nolock(gspca_dev, file, memory);
1838 mutex_unlock(&gspca_dev->queue_lock);
1839 return ret;
1840}
1841
1830/* 1842/*
1831 * wait for a video frame 1843 * dequeue a video buffer
1832 * 1844 *
1833 * If a frame is ready, its index is returned. 1845 * If nonblock_ing is false, block until a buffer is available.
1834 */ 1846 */
1835static int frame_wait(struct gspca_dev *gspca_dev, 1847static int vidioc_dqbuf(struct file *file, void *priv,
1836 int nonblock_ing) 1848 struct v4l2_buffer *v4l2_buf)
1837{ 1849{
1838 int i, ret; 1850 struct gspca_dev *gspca_dev = priv;
1851 struct gspca_frame *frame;
1852 int i, j, ret;
1839 1853
1840 /* check if a frame is ready */ 1854 PDEBUG(D_FRAM, "dqbuf");
1841 i = gspca_dev->fr_o; 1855
1842 if (i == atomic_read(&gspca_dev->fr_i)) { 1856 if (mutex_lock_interruptible(&gspca_dev->queue_lock))
1843 if (nonblock_ing) 1857 return -ERESTARTSYS;
1858
1859 for (;;) {
1860 ret = frame_ready_nolock(gspca_dev, file, v4l2_buf->memory);
1861 if (ret < 0)
1862 goto out;
1863 if (ret > 0)
1864 break;
1865
1866 mutex_unlock(&gspca_dev->queue_lock);
1867
1868 if (file->f_flags & O_NONBLOCK)
1844 return -EAGAIN; 1869 return -EAGAIN;
1845 1870
1846 /* wait till a frame is ready */ 1871 /* wait till a frame is ready */
1847 ret = wait_event_interruptible_timeout(gspca_dev->wq, 1872 ret = wait_event_interruptible_timeout(gspca_dev->wq,
1848 i != atomic_read(&gspca_dev->fr_i) || 1873 frame_ready(gspca_dev, file, v4l2_buf->memory),
1849 !gspca_dev->streaming || !gspca_dev->present,
1850 msecs_to_jiffies(3000)); 1874 msecs_to_jiffies(3000));
1851 if (ret < 0) 1875 if (ret < 0)
1852 return ret; 1876 return ret;
1853 if (ret == 0 || !gspca_dev->streaming || !gspca_dev->present) 1877 if (ret == 0)
1854 return -EIO; 1878 return -EIO;
1879
1880 if (mutex_lock_interruptible(&gspca_dev->queue_lock))
1881 return -ERESTARTSYS;
1855 } 1882 }
1856 1883
1884 i = gspca_dev->fr_o;
1885 j = gspca_dev->fr_queue[i];
1886 frame = &gspca_dev->frame[j];
1887
1857 gspca_dev->fr_o = (i + 1) % GSPCA_MAX_FRAMES; 1888 gspca_dev->fr_o = (i + 1) % GSPCA_MAX_FRAMES;
1858 1889
1859 if (gspca_dev->sd_desc->dq_callback) { 1890 if (gspca_dev->sd_desc->dq_callback) {
@@ -1863,46 +1894,12 @@ static int frame_wait(struct gspca_dev *gspca_dev,
1863 gspca_dev->sd_desc->dq_callback(gspca_dev); 1894 gspca_dev->sd_desc->dq_callback(gspca_dev);
1864 mutex_unlock(&gspca_dev->usb_lock); 1895 mutex_unlock(&gspca_dev->usb_lock);
1865 } 1896 }
1866 return gspca_dev->fr_queue[i];
1867}
1868
1869/*
1870 * dequeue a video buffer
1871 *
1872 * If nonblock_ing is false, block until a buffer is available.
1873 */
1874static int vidioc_dqbuf(struct file *file, void *priv,
1875 struct v4l2_buffer *v4l2_buf)
1876{
1877 struct gspca_dev *gspca_dev = priv;
1878 struct gspca_frame *frame;
1879 int i, ret;
1880
1881 PDEBUG(D_FRAM, "dqbuf");
1882 if (v4l2_buf->memory != gspca_dev->memory)
1883 return -EINVAL;
1884
1885 if (!gspca_dev->present)
1886 return -ENODEV;
1887
1888 /* if not streaming, be sure the application will not loop forever */
1889 if (!(file->f_flags & O_NONBLOCK)
1890 && !gspca_dev->streaming && gspca_dev->users == 1)
1891 return -EINVAL;
1892 1897
1893 /* only the capturing file may dequeue */ 1898 frame->v4l2_buf.flags &= ~V4L2_BUF_FLAG_DONE;
1894 if (gspca_dev->capt_file != file) 1899 memcpy(v4l2_buf, &frame->v4l2_buf, sizeof *v4l2_buf);
1895 return -EINVAL; 1900 PDEBUG(D_FRAM, "dqbuf %d", j);
1896 1901 ret = 0;
1897 /* only one dequeue / read at a time */
1898 if (mutex_lock_interruptible(&gspca_dev->read_lock))
1899 return -ERESTARTSYS;
1900 1902
1901 ret = frame_wait(gspca_dev, file->f_flags & O_NONBLOCK);
1902 if (ret < 0)
1903 goto out;
1904 i = ret; /* frame index */
1905 frame = &gspca_dev->frame[i];
1906 if (gspca_dev->memory == V4L2_MEMORY_USERPTR) { 1903 if (gspca_dev->memory == V4L2_MEMORY_USERPTR) {
1907 if (copy_to_user((__u8 __user *) frame->v4l2_buf.m.userptr, 1904 if (copy_to_user((__u8 __user *) frame->v4l2_buf.m.userptr,
1908 frame->data, 1905 frame->data,
@@ -1910,15 +1907,10 @@ static int vidioc_dqbuf(struct file *file, void *priv,
1910 PDEBUG(D_ERR|D_STREAM, 1907 PDEBUG(D_ERR|D_STREAM,
1911 "dqbuf cp to user failed"); 1908 "dqbuf cp to user failed");
1912 ret = -EFAULT; 1909 ret = -EFAULT;
1913 goto out;
1914 } 1910 }
1915 } 1911 }
1916 frame->v4l2_buf.flags &= ~V4L2_BUF_FLAG_DONE;
1917 memcpy(v4l2_buf, &frame->v4l2_buf, sizeof *v4l2_buf);
1918 PDEBUG(D_FRAM, "dqbuf %d", i);
1919 ret = 0;
1920out: 1912out:
1921 mutex_unlock(&gspca_dev->read_lock); 1913 mutex_unlock(&gspca_dev->queue_lock);
1922 return ret; 1914 return ret;
1923} 1915}
1924 1916
@@ -2033,9 +2025,7 @@ static unsigned int dev_poll(struct file *file, poll_table *wait)
2033 poll_wait(file, &gspca_dev->wq, wait); 2025 poll_wait(file, &gspca_dev->wq, wait);
2034 2026
2035 /* if reqbufs is not done, the user would use read() */ 2027 /* if reqbufs is not done, the user would use read() */
2036 if (gspca_dev->nframes == 0) { 2028 if (gspca_dev->memory == GSPCA_MEMORY_NO) {
2037 if (gspca_dev->memory != GSPCA_MEMORY_NO)
2038 return POLLERR; /* not the 1st time */
2039 ret = read_alloc(gspca_dev, file); 2029 ret = read_alloc(gspca_dev, file);
2040 if (ret != 0) 2030 if (ret != 0)
2041 return POLLERR; 2031 return POLLERR;
@@ -2067,18 +2057,10 @@ static ssize_t dev_read(struct file *file, char __user *data,
2067 PDEBUG(D_FRAM, "read (%zd)", count); 2057 PDEBUG(D_FRAM, "read (%zd)", count);
2068 if (!gspca_dev->present) 2058 if (!gspca_dev->present)
2069 return -ENODEV; 2059 return -ENODEV;
2070 switch (gspca_dev->memory) { 2060 if (gspca_dev->memory == GSPCA_MEMORY_NO) { /* first time ? */
2071 case GSPCA_MEMORY_NO: /* first time */
2072 ret = read_alloc(gspca_dev, file); 2061 ret = read_alloc(gspca_dev, file);
2073 if (ret != 0) 2062 if (ret != 0)
2074 return ret; 2063 return ret;
2075 break;
2076 case GSPCA_MEMORY_READ:
2077 if (gspca_dev->capt_file == file)
2078 break;
2079 /* fall thru */
2080 default:
2081 return -EINVAL;
2082 } 2064 }
2083 2065
2084 /* get a frame */ 2066 /* get a frame */
@@ -2266,7 +2248,6 @@ int gspca_dev_probe2(struct usb_interface *intf,
2266 goto out; 2248 goto out;
2267 2249
2268 mutex_init(&gspca_dev->usb_lock); 2250 mutex_init(&gspca_dev->usb_lock);
2269 mutex_init(&gspca_dev->read_lock);
2270 mutex_init(&gspca_dev->queue_lock); 2251 mutex_init(&gspca_dev->queue_lock);
2271 init_waitqueue_head(&gspca_dev->wq); 2252 init_waitqueue_head(&gspca_dev->wq);
2272 2253
@@ -2341,12 +2322,11 @@ void gspca_disconnect(struct usb_interface *intf)
2341 PDEBUG(D_PROBE, "%s disconnect", 2322 PDEBUG(D_PROBE, "%s disconnect",
2342 video_device_node_name(&gspca_dev->vdev)); 2323 video_device_node_name(&gspca_dev->vdev));
2343 mutex_lock(&gspca_dev->usb_lock); 2324 mutex_lock(&gspca_dev->usb_lock);
2325
2344 gspca_dev->present = 0; 2326 gspca_dev->present = 0;
2327 wake_up_interruptible(&gspca_dev->wq);
2345 2328
2346 if (gspca_dev->streaming) { 2329 destroy_urbs(gspca_dev);
2347 destroy_urbs(gspca_dev);
2348 wake_up_interruptible(&gspca_dev->wq);
2349 }
2350 2330
2351#if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE) 2331#if defined(CONFIG_INPUT) || defined(CONFIG_INPUT_MODULE)
2352 gspca_input_destroy_urb(gspca_dev); 2332 gspca_input_destroy_urb(gspca_dev);
diff --git a/drivers/media/video/gspca/gspca.h b/drivers/media/video/gspca/gspca.h
index 97b77a26a2e..41755226d38 100644
--- a/drivers/media/video/gspca/gspca.h
+++ b/drivers/media/video/gspca/gspca.h
@@ -205,14 +205,12 @@ struct gspca_dev {
205 205
206 wait_queue_head_t wq; /* wait queue */ 206 wait_queue_head_t wq; /* wait queue */
207 struct mutex usb_lock; /* usb exchange protection */ 207 struct mutex usb_lock; /* usb exchange protection */
208 struct mutex read_lock; /* read protection */
209 struct mutex queue_lock; /* ISOC queue protection */ 208 struct mutex queue_lock; /* ISOC queue protection */
210 int usb_err; /* USB error - protected by usb_lock */ 209 int usb_err; /* USB error - protected by usb_lock */
211 u16 pkt_size; /* ISOC packet size */ 210 u16 pkt_size; /* ISOC packet size */
212#ifdef CONFIG_PM 211#ifdef CONFIG_PM
213 char frozen; /* suspend - resume */ 212 char frozen; /* suspend - resume */
214#endif 213#endif
215 char users; /* number of opens */
216 char present; /* device connected */ 214 char present; /* device connected */
217 char nbufread; /* number of buffers for read() */ 215 char nbufread; /* number of buffers for read() */
218 char memory; /* memory type (V4L2_MEMORY_xxx) */ 216 char memory; /* memory type (V4L2_MEMORY_xxx) */
diff --git a/drivers/media/video/gspca/jeilinj.c b/drivers/media/video/gspca/jeilinj.c
index a35e87bb038..06b777f5379 100644
--- a/drivers/media/video/gspca/jeilinj.c
+++ b/drivers/media/video/gspca/jeilinj.c
@@ -314,7 +314,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
314} 314}
315 315
316/* Table of supported USB devices */ 316/* Table of supported USB devices */
317static const __devinitdata struct usb_device_id device_table[] = { 317static const struct usb_device_id device_table[] = {
318 {USB_DEVICE(0x0979, 0x0280)}, 318 {USB_DEVICE(0x0979, 0x0280)},
319 {} 319 {}
320}; 320};
diff --git a/drivers/media/video/gspca/jpeg.h b/drivers/media/video/gspca/jpeg.h
index de63c36806c..ab54910418b 100644
--- a/drivers/media/video/gspca/jpeg.h
+++ b/drivers/media/video/gspca/jpeg.h
@@ -141,9 +141,9 @@ static void jpeg_define(u8 *jpeg_hdr,
141 memcpy(jpeg_hdr, jpeg_head, sizeof jpeg_head); 141 memcpy(jpeg_hdr, jpeg_head, sizeof jpeg_head);
142#ifndef CONEX_CAM 142#ifndef CONEX_CAM
143 jpeg_hdr[JPEG_HEIGHT_OFFSET + 0] = height >> 8; 143 jpeg_hdr[JPEG_HEIGHT_OFFSET + 0] = height >> 8;
144 jpeg_hdr[JPEG_HEIGHT_OFFSET + 1] = height & 0xff; 144 jpeg_hdr[JPEG_HEIGHT_OFFSET + 1] = height;
145 jpeg_hdr[JPEG_HEIGHT_OFFSET + 2] = width >> 8; 145 jpeg_hdr[JPEG_HEIGHT_OFFSET + 2] = width >> 8;
146 jpeg_hdr[JPEG_HEIGHT_OFFSET + 3] = width & 0xff; 146 jpeg_hdr[JPEG_HEIGHT_OFFSET + 3] = width;
147 jpeg_hdr[JPEG_HEIGHT_OFFSET + 6] = samplesY; 147 jpeg_hdr[JPEG_HEIGHT_OFFSET + 6] = samplesY;
148#endif 148#endif
149} 149}
diff --git a/drivers/media/video/gspca/konica.c b/drivers/media/video/gspca/konica.c
index d2ce65dcbfd..5964691c0e9 100644
--- a/drivers/media/video/gspca/konica.c
+++ b/drivers/media/video/gspca/konica.c
@@ -607,7 +607,7 @@ static const struct sd_desc sd_desc = {
607}; 607};
608 608
609/* -- module initialisation -- */ 609/* -- module initialisation -- */
610static const __devinitdata struct usb_device_id device_table[] = { 610static const struct usb_device_id device_table[] = {
611 {USB_DEVICE(0x04c8, 0x0720)}, /* Intel YC 76 */ 611 {USB_DEVICE(0x04c8, 0x0720)}, /* Intel YC 76 */
612 {} 612 {}
613}; 613};
diff --git a/drivers/media/video/gspca/m5602/m5602_core.c b/drivers/media/video/gspca/m5602/m5602_core.c
index c872b93a335..a7722b1aef9 100644
--- a/drivers/media/video/gspca/m5602/m5602_core.c
+++ b/drivers/media/video/gspca/m5602/m5602_core.c
@@ -28,7 +28,7 @@ int force_sensor;
28static int dump_bridge; 28static int dump_bridge;
29int dump_sensor; 29int dump_sensor;
30 30
31static const __devinitdata struct usb_device_id m5602_table[] = { 31static const struct usb_device_id m5602_table[] = {
32 {USB_DEVICE(0x0402, 0x5602)}, 32 {USB_DEVICE(0x0402, 0x5602)},
33 {} 33 {}
34}; 34};
diff --git a/drivers/media/video/gspca/mars.c b/drivers/media/video/gspca/mars.c
index a81536e7869..cb4d0bf0d78 100644
--- a/drivers/media/video/gspca/mars.c
+++ b/drivers/media/video/gspca/mars.c
@@ -490,7 +490,7 @@ static const struct sd_desc sd_desc = {
490}; 490};
491 491
492/* -- module initialisation -- */ 492/* -- module initialisation -- */
493static const __devinitdata struct usb_device_id device_table[] = { 493static const struct usb_device_id device_table[] = {
494 {USB_DEVICE(0x093a, 0x050f)}, 494 {USB_DEVICE(0x093a, 0x050f)},
495 {} 495 {}
496}; 496};
diff --git a/drivers/media/video/gspca/mr97310a.c b/drivers/media/video/gspca/mr97310a.c
index 7607a288b51..3884c9d300c 100644
--- a/drivers/media/video/gspca/mr97310a.c
+++ b/drivers/media/video/gspca/mr97310a.c
@@ -1229,7 +1229,7 @@ static const struct sd_desc sd_desc = {
1229}; 1229};
1230 1230
1231/* -- module initialisation -- */ 1231/* -- module initialisation -- */
1232static const __devinitdata struct usb_device_id device_table[] = { 1232static const struct usb_device_id device_table[] = {
1233 {USB_DEVICE(0x08ca, 0x0110)}, /* Trust Spyc@m 100 */ 1233 {USB_DEVICE(0x08ca, 0x0110)}, /* Trust Spyc@m 100 */
1234 {USB_DEVICE(0x08ca, 0x0111)}, /* Aiptek Pencam VGA+ */ 1234 {USB_DEVICE(0x08ca, 0x0111)}, /* Aiptek Pencam VGA+ */
1235 {USB_DEVICE(0x093a, 0x010f)}, /* All other known MR97310A VGA cams */ 1235 {USB_DEVICE(0x093a, 0x010f)}, /* All other known MR97310A VGA cams */
diff --git a/drivers/media/video/gspca/ov519.c b/drivers/media/video/gspca/ov519.c
index e1c3b9328ac..8ab2c452c25 100644
--- a/drivers/media/video/gspca/ov519.c
+++ b/drivers/media/video/gspca/ov519.c
@@ -488,7 +488,6 @@ static const struct v4l2_pix_format ovfx2_ov3610_mode[] = {
488#define R511_SNAP_PXDIV 0x1c 488#define R511_SNAP_PXDIV 0x1c
489#define R511_SNAP_LNDIV 0x1d 489#define R511_SNAP_LNDIV 0x1d
490#define R511_SNAP_UV_EN 0x1e 490#define R511_SNAP_UV_EN 0x1e
491#define R511_SNAP_UV_EN 0x1e
492#define R511_SNAP_OPTS 0x1f 491#define R511_SNAP_OPTS 0x1f
493 492
494#define R511_DRAM_FLOW_CTL 0x20 493#define R511_DRAM_FLOW_CTL 0x20
@@ -1847,8 +1846,7 @@ static const struct ov_i2c_regvals norm_7670[] = {
1847 { 0x6c, 0x0a }, 1846 { 0x6c, 0x0a },
1848 { 0x6d, 0x55 }, 1847 { 0x6d, 0x55 },
1849 { 0x6e, 0x11 }, 1848 { 0x6e, 0x11 },
1850 { 0x6f, 0x9f }, 1849 { 0x6f, 0x9f }, /* "9e for advance AWB" */
1851 /* "9e for advance AWB" */
1852 { 0x6a, 0x40 }, 1850 { 0x6a, 0x40 },
1853 { OV7670_R01_BLUE, 0x40 }, 1851 { OV7670_R01_BLUE, 0x40 },
1854 { OV7670_R02_RED, 0x60 }, 1852 { OV7670_R02_RED, 0x60 },
@@ -3054,7 +3052,7 @@ static void ov519_configure(struct sd *sd)
3054{ 3052{
3055 static const struct ov_regvals init_519[] = { 3053 static const struct ov_regvals init_519[] = {
3056 { 0x5a, 0x6d }, /* EnableSystem */ 3054 { 0x5a, 0x6d }, /* EnableSystem */
3057 { 0x53, 0x9b }, 3055 { 0x53, 0x9b }, /* don't enable the microcontroller */
3058 { OV519_R54_EN_CLK1, 0xff }, /* set bit2 to enable jpeg */ 3056 { OV519_R54_EN_CLK1, 0xff }, /* set bit2 to enable jpeg */
3059 { 0x5d, 0x03 }, 3057 { 0x5d, 0x03 },
3060 { 0x49, 0x01 }, 3058 { 0x49, 0x01 },
@@ -4747,7 +4745,7 @@ static const struct sd_desc sd_desc = {
4747}; 4745};
4748 4746
4749/* -- module initialisation -- */ 4747/* -- module initialisation -- */
4750static const __devinitdata struct usb_device_id device_table[] = { 4748static const struct usb_device_id device_table[] = {
4751 {USB_DEVICE(0x041e, 0x4003), .driver_info = BRIDGE_W9968CF }, 4749 {USB_DEVICE(0x041e, 0x4003), .driver_info = BRIDGE_W9968CF },
4752 {USB_DEVICE(0x041e, 0x4052), .driver_info = BRIDGE_OV519 }, 4750 {USB_DEVICE(0x041e, 0x4052), .driver_info = BRIDGE_OV519 },
4753 {USB_DEVICE(0x041e, 0x405f), .driver_info = BRIDGE_OV519 }, 4751 {USB_DEVICE(0x041e, 0x405f), .driver_info = BRIDGE_OV519 },
diff --git a/drivers/media/video/gspca/ov534.c b/drivers/media/video/gspca/ov534.c
index 0edf93973b1..04da2280273 100644
--- a/drivers/media/video/gspca/ov534.c
+++ b/drivers/media/video/gspca/ov534.c
@@ -479,15 +479,20 @@ static void ov534_reg_write(struct gspca_dev *gspca_dev, u16 reg, u8 val)
479 struct usb_device *udev = gspca_dev->dev; 479 struct usb_device *udev = gspca_dev->dev;
480 int ret; 480 int ret;
481 481
482 PDEBUG(D_USBO, "reg=0x%04x, val=0%02x", reg, val); 482 if (gspca_dev->usb_err < 0)
483 return;
484
485 PDEBUG(D_USBO, "SET 01 0000 %04x %02x", reg, val);
483 gspca_dev->usb_buf[0] = val; 486 gspca_dev->usb_buf[0] = val;
484 ret = usb_control_msg(udev, 487 ret = usb_control_msg(udev,
485 usb_sndctrlpipe(udev, 0), 488 usb_sndctrlpipe(udev, 0),
486 0x01, 489 0x01,
487 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 490 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
488 0x00, reg, gspca_dev->usb_buf, 1, CTRL_TIMEOUT); 491 0x00, reg, gspca_dev->usb_buf, 1, CTRL_TIMEOUT);
489 if (ret < 0) 492 if (ret < 0) {
490 err("write failed %d", ret); 493 err("write failed %d", ret);
494 gspca_dev->usb_err = ret;
495 }
491} 496}
492 497
493static u8 ov534_reg_read(struct gspca_dev *gspca_dev, u16 reg) 498static u8 ov534_reg_read(struct gspca_dev *gspca_dev, u16 reg)
@@ -495,14 +500,18 @@ static u8 ov534_reg_read(struct gspca_dev *gspca_dev, u16 reg)
495 struct usb_device *udev = gspca_dev->dev; 500 struct usb_device *udev = gspca_dev->dev;
496 int ret; 501 int ret;
497 502
503 if (gspca_dev->usb_err < 0)
504 return 0;
498 ret = usb_control_msg(udev, 505 ret = usb_control_msg(udev,
499 usb_rcvctrlpipe(udev, 0), 506 usb_rcvctrlpipe(udev, 0),
500 0x01, 507 0x01,
501 USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 508 USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
502 0x00, reg, gspca_dev->usb_buf, 1, CTRL_TIMEOUT); 509 0x00, reg, gspca_dev->usb_buf, 1, CTRL_TIMEOUT);
503 PDEBUG(D_USBI, "reg=0x%04x, data=0x%02x", reg, gspca_dev->usb_buf[0]); 510 PDEBUG(D_USBI, "GET 01 0000 %04x %02x", reg, gspca_dev->usb_buf[0]);
504 if (ret < 0) 511 if (ret < 0) {
505 err("read failed %d", ret); 512 err("read failed %d", ret);
513 gspca_dev->usb_err = ret;
514 }
506 return gspca_dev->usb_buf[0]; 515 return gspca_dev->usb_buf[0];
507} 516}
508 517
@@ -558,13 +567,15 @@ static int sccb_check_status(struct gspca_dev *gspca_dev)
558 567
559static void sccb_reg_write(struct gspca_dev *gspca_dev, u8 reg, u8 val) 568static void sccb_reg_write(struct gspca_dev *gspca_dev, u8 reg, u8 val)
560{ 569{
561 PDEBUG(D_USBO, "reg: 0x%02x, val: 0x%02x", reg, val); 570 PDEBUG(D_USBO, "sccb write: %02x %02x", reg, val);
562 ov534_reg_write(gspca_dev, OV534_REG_SUBADDR, reg); 571 ov534_reg_write(gspca_dev, OV534_REG_SUBADDR, reg);
563 ov534_reg_write(gspca_dev, OV534_REG_WRITE, val); 572 ov534_reg_write(gspca_dev, OV534_REG_WRITE, val);
564 ov534_reg_write(gspca_dev, OV534_REG_OPERATION, OV534_OP_WRITE_3); 573 ov534_reg_write(gspca_dev, OV534_REG_OPERATION, OV534_OP_WRITE_3);
565 574
566 if (!sccb_check_status(gspca_dev)) 575 if (!sccb_check_status(gspca_dev)) {
567 err("sccb_reg_write failed"); 576 err("sccb_reg_write failed");
577 gspca_dev->usb_err = -EIO;
578 }
568} 579}
569 580
570static u8 sccb_reg_read(struct gspca_dev *gspca_dev, u16 reg) 581static u8 sccb_reg_read(struct gspca_dev *gspca_dev, u16 reg)
@@ -885,7 +896,7 @@ static int sd_init(struct gspca_dev *gspca_dev)
885 ov534_set_led(gspca_dev, 0); 896 ov534_set_led(gspca_dev, 0);
886 set_frame_rate(gspca_dev); 897 set_frame_rate(gspca_dev);
887 898
888 return 0; 899 return gspca_dev->usb_err;
889} 900}
890 901
891static int sd_start(struct gspca_dev *gspca_dev) 902static int sd_start(struct gspca_dev *gspca_dev)
@@ -920,7 +931,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
920 931
921 ov534_set_led(gspca_dev, 1); 932 ov534_set_led(gspca_dev, 1);
922 ov534_reg_write(gspca_dev, 0xe0, 0x00); 933 ov534_reg_write(gspca_dev, 0xe0, 0x00);
923 return 0; 934 return gspca_dev->usb_err;
924} 935}
925 936
926static void sd_stopN(struct gspca_dev *gspca_dev) 937static void sd_stopN(struct gspca_dev *gspca_dev)
@@ -1289,7 +1300,7 @@ static const struct sd_desc sd_desc = {
1289}; 1300};
1290 1301
1291/* -- module initialisation -- */ 1302/* -- module initialisation -- */
1292static const __devinitdata struct usb_device_id device_table[] = { 1303static const struct usb_device_id device_table[] = {
1293 {USB_DEVICE(0x1415, 0x2000)}, 1304 {USB_DEVICE(0x1415, 0x2000)},
1294 {} 1305 {}
1295}; 1306};
diff --git a/drivers/media/video/gspca/ov534_9.c b/drivers/media/video/gspca/ov534_9.c
index c5244b4b477..aaf5428c57f 100644
--- a/drivers/media/video/gspca/ov534_9.c
+++ b/drivers/media/video/gspca/ov534_9.c
@@ -1429,7 +1429,7 @@ static const struct sd_desc sd_desc = {
1429}; 1429};
1430 1430
1431/* -- module initialisation -- */ 1431/* -- module initialisation -- */
1432static const __devinitdata struct usb_device_id device_table[] = { 1432static const struct usb_device_id device_table[] = {
1433 {USB_DEVICE(0x06f8, 0x3003)}, 1433 {USB_DEVICE(0x06f8, 0x3003)},
1434 {} 1434 {}
1435}; 1435};
diff --git a/drivers/media/video/gspca/pac207.c b/drivers/media/video/gspca/pac207.c
index 96f9986305b..81739a2f205 100644
--- a/drivers/media/video/gspca/pac207.c
+++ b/drivers/media/video/gspca/pac207.c
@@ -530,7 +530,7 @@ static const struct sd_desc sd_desc = {
530}; 530};
531 531
532/* -- module initialisation -- */ 532/* -- module initialisation -- */
533static const __devinitdata struct usb_device_id device_table[] = { 533static const struct usb_device_id device_table[] = {
534 {USB_DEVICE(0x041e, 0x4028)}, 534 {USB_DEVICE(0x041e, 0x4028)},
535 {USB_DEVICE(0x093a, 0x2460)}, 535 {USB_DEVICE(0x093a, 0x2460)},
536 {USB_DEVICE(0x093a, 0x2461)}, 536 {USB_DEVICE(0x093a, 0x2461)},
diff --git a/drivers/media/video/gspca/pac7302.c b/drivers/media/video/gspca/pac7302.c
index 2700975abce..5615d7bd830 100644
--- a/drivers/media/video/gspca/pac7302.c
+++ b/drivers/media/video/gspca/pac7302.c
@@ -1184,7 +1184,7 @@ static const struct sd_desc sd_desc = {
1184}; 1184};
1185 1185
1186/* -- module initialisation -- */ 1186/* -- module initialisation -- */
1187static const struct usb_device_id device_table[] __devinitconst = { 1187static const struct usb_device_id device_table[] = {
1188 {USB_DEVICE(0x06f8, 0x3009)}, 1188 {USB_DEVICE(0x06f8, 0x3009)},
1189 {USB_DEVICE(0x093a, 0x2620)}, 1189 {USB_DEVICE(0x093a, 0x2620)},
1190 {USB_DEVICE(0x093a, 0x2621)}, 1190 {USB_DEVICE(0x093a, 0x2621)},
@@ -1201,7 +1201,7 @@ static const struct usb_device_id device_table[] __devinitconst = {
1201MODULE_DEVICE_TABLE(usb, device_table); 1201MODULE_DEVICE_TABLE(usb, device_table);
1202 1202
1203/* -- device connect -- */ 1203/* -- device connect -- */
1204static int __devinit sd_probe(struct usb_interface *intf, 1204static int sd_probe(struct usb_interface *intf,
1205 const struct usb_device_id *id) 1205 const struct usb_device_id *id)
1206{ 1206{
1207 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), 1207 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
diff --git a/drivers/media/video/gspca/pac7311.c b/drivers/media/video/gspca/pac7311.c
index 6820f5d58b1..f8801b50e64 100644
--- a/drivers/media/video/gspca/pac7311.c
+++ b/drivers/media/video/gspca/pac7311.c
@@ -837,7 +837,7 @@ static const struct sd_desc sd_desc = {
837}; 837};
838 838
839/* -- module initialisation -- */ 839/* -- module initialisation -- */
840static const struct usb_device_id device_table[] __devinitconst = { 840static const struct usb_device_id device_table[] = {
841 {USB_DEVICE(0x093a, 0x2600)}, 841 {USB_DEVICE(0x093a, 0x2600)},
842 {USB_DEVICE(0x093a, 0x2601)}, 842 {USB_DEVICE(0x093a, 0x2601)},
843 {USB_DEVICE(0x093a, 0x2603)}, 843 {USB_DEVICE(0x093a, 0x2603)},
@@ -849,7 +849,7 @@ static const struct usb_device_id device_table[] __devinitconst = {
849MODULE_DEVICE_TABLE(usb, device_table); 849MODULE_DEVICE_TABLE(usb, device_table);
850 850
851/* -- device connect -- */ 851/* -- device connect -- */
852static int __devinit sd_probe(struct usb_interface *intf, 852static int sd_probe(struct usb_interface *intf,
853 const struct usb_device_id *id) 853 const struct usb_device_id *id)
854{ 854{
855 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), 855 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
diff --git a/drivers/media/video/gspca/sn9c2028.c b/drivers/media/video/gspca/sn9c2028.c
index 40a06680502..4271f86dfe0 100644
--- a/drivers/media/video/gspca/sn9c2028.c
+++ b/drivers/media/video/gspca/sn9c2028.c
@@ -703,7 +703,7 @@ static const struct sd_desc sd_desc = {
703}; 703};
704 704
705/* -- module initialisation -- */ 705/* -- module initialisation -- */
706static const __devinitdata struct usb_device_id device_table[] = { 706static const struct usb_device_id device_table[] = {
707 {USB_DEVICE(0x0458, 0x7005)}, /* Genius Smart 300, version 2 */ 707 {USB_DEVICE(0x0458, 0x7005)}, /* Genius Smart 300, version 2 */
708 /* The Genius Smart is untested. I can't find an owner ! */ 708 /* The Genius Smart is untested. I can't find an owner ! */
709 /* {USB_DEVICE(0x0c45, 0x8000)}, DC31VC, Don't know this camera */ 709 /* {USB_DEVICE(0x0c45, 0x8000)}, DC31VC, Don't know this camera */
diff --git a/drivers/media/video/gspca/sn9c20x.c b/drivers/media/video/gspca/sn9c20x.c
index cb08d00d0a3..fcf29897b71 100644
--- a/drivers/media/video/gspca/sn9c20x.c
+++ b/drivers/media/video/gspca/sn9c20x.c
@@ -2470,7 +2470,7 @@ static const struct sd_desc sd_desc = {
2470 | (SENSOR_ ## sensor << 8) \ 2470 | (SENSOR_ ## sensor << 8) \
2471 | (i2c_addr) 2471 | (i2c_addr)
2472 2472
2473static const __devinitdata struct usb_device_id device_table[] = { 2473static const struct usb_device_id device_table[] = {
2474 {USB_DEVICE(0x0c45, 0x6240), SN9C20X(MT9M001, 0x5d, 0)}, 2474 {USB_DEVICE(0x0c45, 0x6240), SN9C20X(MT9M001, 0x5d, 0)},
2475 {USB_DEVICE(0x0c45, 0x6242), SN9C20X(MT9M111, 0x5d, 0)}, 2475 {USB_DEVICE(0x0c45, 0x6242), SN9C20X(MT9M111, 0x5d, 0)},
2476 {USB_DEVICE(0x0c45, 0x6248), SN9C20X(OV9655, 0x30, 0)}, 2476 {USB_DEVICE(0x0c45, 0x6248), SN9C20X(OV9655, 0x30, 0)},
diff --git a/drivers/media/video/gspca/sonixb.c b/drivers/media/video/gspca/sonixb.c
index 73504a3f87b..c6cd68d66b5 100644
--- a/drivers/media/video/gspca/sonixb.c
+++ b/drivers/media/video/gspca/sonixb.c
@@ -23,8 +23,15 @@
23/* Some documentation on known sonixb registers: 23/* Some documentation on known sonixb registers:
24 24
25Reg Use 25Reg Use
26sn9c101 / sn9c102:
260x10 high nibble red gain low nibble blue gain 270x10 high nibble red gain low nibble blue gain
270x11 low nibble green gain 280x11 low nibble green gain
29sn9c103:
300x05 red gain 0-127
310x06 blue gain 0-127
320x07 green gain 0-127
33all:
340x08-0x0f i2c / 3wire registers
280x12 hstart 350x12 hstart
290x13 vstart 360x13 vstart
300x15 hsize (hsize = register-value * 16) 370x15 hsize (hsize = register-value * 16)
@@ -88,12 +95,9 @@ struct sd {
88typedef const __u8 sensor_init_t[8]; 95typedef const __u8 sensor_init_t[8];
89 96
90struct sensor_data { 97struct sensor_data {
91 const __u8 *bridge_init[2]; 98 const __u8 *bridge_init;
92 int bridge_init_size[2];
93 sensor_init_t *sensor_init; 99 sensor_init_t *sensor_init;
94 int sensor_init_size; 100 int sensor_init_size;
95 sensor_init_t *sensor_bridge_init[2];
96 int sensor_bridge_init_size[2];
97 int flags; 101 int flags;
98 unsigned ctrl_dis; 102 unsigned ctrl_dis;
99 __u8 sensor_addr; 103 __u8 sensor_addr;
@@ -114,7 +118,6 @@ struct sensor_data {
114#define NO_FREQ (1 << FREQ_IDX) 118#define NO_FREQ (1 << FREQ_IDX)
115#define NO_BRIGHTNESS (1 << BRIGHTNESS_IDX) 119#define NO_BRIGHTNESS (1 << BRIGHTNESS_IDX)
116 120
117#define COMP2 0x8f
118#define COMP 0xc7 /* 0x87 //0x07 */ 121#define COMP 0xc7 /* 0x87 //0x07 */
119#define COMP1 0xc9 /* 0x89 //0x09 */ 122#define COMP1 0xc9 /* 0x89 //0x09 */
120 123
@@ -123,15 +126,11 @@ struct sensor_data {
123 126
124#define SYS_CLK 0x04 127#define SYS_CLK 0x04
125 128
126#define SENS(bridge_1, bridge_3, sensor, sensor_1, \ 129#define SENS(bridge, sensor, _flags, _ctrl_dis, _sensor_addr) \
127 sensor_3, _flags, _ctrl_dis, _sensor_addr) \
128{ \ 130{ \
129 .bridge_init = { bridge_1, bridge_3 }, \ 131 .bridge_init = bridge, \
130 .bridge_init_size = { sizeof(bridge_1), sizeof(bridge_3) }, \
131 .sensor_init = sensor, \ 132 .sensor_init = sensor, \
132 .sensor_init_size = sizeof(sensor), \ 133 .sensor_init_size = sizeof(sensor), \
133 .sensor_bridge_init = { sensor_1, sensor_3,}, \
134 .sensor_bridge_init_size = { sizeof(sensor_1), sizeof(sensor_3)}, \
135 .flags = _flags, .ctrl_dis = _ctrl_dis, .sensor_addr = _sensor_addr \ 134 .flags = _flags, .ctrl_dis = _ctrl_dis, .sensor_addr = _sensor_addr \
136} 135}
137 136
@@ -311,7 +310,6 @@ static const __u8 initHv7131d[] = {
311 0x00, 0x00, 310 0x00, 0x00,
312 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 311 0x00, 0x00, 0x00, 0x02, 0x02, 0x00,
313 0x28, 0x1e, 0x60, 0x8e, 0x42, 312 0x28, 0x1e, 0x60, 0x8e, 0x42,
314 0x1d, 0x10, 0x02, 0x03, 0x0f, 0x0c
315}; 313};
316static const __u8 hv7131d_sensor_init[][8] = { 314static const __u8 hv7131d_sensor_init[][8] = {
317 {0xa0, 0x11, 0x01, 0x04, 0x00, 0x00, 0x00, 0x17}, 315 {0xa0, 0x11, 0x01, 0x04, 0x00, 0x00, 0x00, 0x17},
@@ -326,7 +324,6 @@ static const __u8 initHv7131r[] = {
326 0x00, 0x00, 324 0x00, 0x00,
327 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, 325 0x00, 0x00, 0x00, 0x02, 0x01, 0x00,
328 0x28, 0x1e, 0x60, 0x8a, 0x20, 326 0x28, 0x1e, 0x60, 0x8a, 0x20,
329 0x1d, 0x10, 0x02, 0x03, 0x0f, 0x0c
330}; 327};
331static const __u8 hv7131r_sensor_init[][8] = { 328static const __u8 hv7131r_sensor_init[][8] = {
332 {0xc0, 0x11, 0x31, 0x38, 0x2a, 0x2e, 0x00, 0x10}, 329 {0xc0, 0x11, 0x31, 0x38, 0x2a, 0x2e, 0x00, 0x10},
@@ -339,7 +336,7 @@ static const __u8 initOv6650[] = {
339 0x44, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 336 0x44, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
340 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 337 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
341 0x00, 0x01, 0x01, 0x0a, 0x16, 0x12, 0x68, 0x8b, 338 0x00, 0x01, 0x01, 0x0a, 0x16, 0x12, 0x68, 0x8b,
342 0x10, 0x1d, 0x10, 0x02, 0x02, 0x09, 0x07 339 0x10,
343}; 340};
344static const __u8 ov6650_sensor_init[][8] = { 341static const __u8 ov6650_sensor_init[][8] = {
345 /* Bright, contrast, etc are set through SCBB interface. 342 /* Bright, contrast, etc are set through SCBB interface.
@@ -378,24 +375,13 @@ static const __u8 initOv7630[] = {
378 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* r09 .. r10 */ 375 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* r09 .. r10 */
379 0x00, 0x01, 0x01, 0x0a, /* r11 .. r14 */ 376 0x00, 0x01, 0x01, 0x0a, /* r11 .. r14 */
380 0x28, 0x1e, /* H & V sizes r15 .. r16 */ 377 0x28, 0x1e, /* H & V sizes r15 .. r16 */
381 0x68, COMP2, MCK_INIT1, /* r17 .. r19 */
382 0x1d, 0x10, 0x02, 0x03, 0x0f, 0x0c /* r1a .. r1f */
383};
384static const __u8 initOv7630_3[] = {
385 0x44, 0x44, 0x00, 0x1a, 0x20, 0x20, 0x20, 0x80, /* r01 .. r08 */
386 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* r09 .. r10 */
387 0x00, 0x02, 0x01, 0x0a, /* r11 .. r14 */
388 0x28, 0x1e, /* H & V sizes r15 .. r16 */
389 0x68, 0x8f, MCK_INIT1, /* r17 .. r19 */ 378 0x68, 0x8f, MCK_INIT1, /* r17 .. r19 */
390 0x1d, 0x10, 0x02, 0x03, 0x0f, 0x0c, 0x00, /* r1a .. r20 */
391 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80, /* r21 .. r28 */
392 0x90, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0, 0xff /* r29 .. r30 */
393}; 379};
394static const __u8 ov7630_sensor_init[][8] = { 380static const __u8 ov7630_sensor_init[][8] = {
395 {0xa0, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10}, 381 {0xa0, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10},
396 {0xb0, 0x21, 0x01, 0x77, 0x3a, 0x00, 0x00, 0x10}, 382 {0xb0, 0x21, 0x01, 0x77, 0x3a, 0x00, 0x00, 0x10},
397/* {0xd0, 0x21, 0x12, 0x7c, 0x01, 0x80, 0x34, 0x10}, jfm */ 383/* {0xd0, 0x21, 0x12, 0x7c, 0x01, 0x80, 0x34, 0x10}, jfm */
398 {0xd0, 0x21, 0x12, 0x1c, 0x00, 0x80, 0x34, 0x10}, /* jfm */ 384 {0xd0, 0x21, 0x12, 0x5c, 0x00, 0x80, 0x34, 0x10}, /* jfm */
399 {0xa0, 0x21, 0x1b, 0x04, 0x00, 0x80, 0x34, 0x10}, 385 {0xa0, 0x21, 0x1b, 0x04, 0x00, 0x80, 0x34, 0x10},
400 {0xa0, 0x21, 0x20, 0x44, 0x00, 0x80, 0x34, 0x10}, 386 {0xa0, 0x21, 0x20, 0x44, 0x00, 0x80, 0x34, 0x10},
401 {0xa0, 0x21, 0x23, 0xee, 0x00, 0x80, 0x34, 0x10}, 387 {0xa0, 0x21, 0x23, 0xee, 0x00, 0x80, 0x34, 0x10},
@@ -413,16 +399,11 @@ static const __u8 ov7630_sensor_init[][8] = {
413 {0xd0, 0x21, 0x17, 0x1c, 0xbd, 0x06, 0xf6, 0x10}, 399 {0xd0, 0x21, 0x17, 0x1c, 0xbd, 0x06, 0xf6, 0x10},
414}; 400};
415 401
416static const __u8 ov7630_sensor_init_3[][8] = {
417 {0xa0, 0x21, 0x13, 0x80, 0x00, 0x00, 0x00, 0x10},
418};
419
420static const __u8 initPas106[] = { 402static const __u8 initPas106[] = {
421 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x40, 0x00, 0x00, 0x00, 403 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x40, 0x00, 0x00, 0x00,
422 0x00, 0x00, 404 0x00, 0x00,
423 0x00, 0x00, 0x00, 0x04, 0x01, 0x00, 405 0x00, 0x00, 0x00, 0x04, 0x01, 0x00,
424 0x16, 0x12, 0x24, COMP1, MCK_INIT1, 406 0x16, 0x12, 0x24, COMP1, MCK_INIT1,
425 0x18, 0x10, 0x02, 0x02, 0x09, 0x07
426}; 407};
427/* compression 0x86 mckinit1 0x2b */ 408/* compression 0x86 mckinit1 0x2b */
428 409
@@ -496,7 +477,6 @@ static const __u8 initPas202[] = {
496 0x00, 0x00, 477 0x00, 0x00,
497 0x00, 0x00, 0x00, 0x06, 0x03, 0x0a, 478 0x00, 0x00, 0x00, 0x06, 0x03, 0x0a,
498 0x28, 0x1e, 0x20, 0x89, 0x20, 479 0x28, 0x1e, 0x20, 0x89, 0x20,
499 0x00, 0x00, 0x02, 0x03, 0x0f, 0x0c
500}; 480};
501 481
502/* "Known" PAS202BCB registers: 482/* "Known" PAS202BCB registers:
@@ -537,7 +517,6 @@ static const __u8 initTas5110c[] = {
537 0x00, 0x00, 517 0x00, 0x00,
538 0x00, 0x00, 0x00, 0x45, 0x09, 0x0a, 518 0x00, 0x00, 0x00, 0x45, 0x09, 0x0a,
539 0x16, 0x12, 0x60, 0x86, 0x2b, 519 0x16, 0x12, 0x60, 0x86, 0x2b,
540 0x14, 0x0a, 0x02, 0x02, 0x09, 0x07
541}; 520};
542/* Same as above, except a different hstart */ 521/* Same as above, except a different hstart */
543static const __u8 initTas5110d[] = { 522static const __u8 initTas5110d[] = {
@@ -545,12 +524,19 @@ static const __u8 initTas5110d[] = {
545 0x00, 0x00, 524 0x00, 0x00,
546 0x00, 0x00, 0x00, 0x41, 0x09, 0x0a, 525 0x00, 0x00, 0x00, 0x41, 0x09, 0x0a,
547 0x16, 0x12, 0x60, 0x86, 0x2b, 526 0x16, 0x12, 0x60, 0x86, 0x2b,
548 0x14, 0x0a, 0x02, 0x02, 0x09, 0x07
549}; 527};
550static const __u8 tas5110_sensor_init[][8] = { 528/* tas5110c is 3 wire, tas5110d is 2 wire (regular i2c) */
529static const __u8 tas5110c_sensor_init[][8] = {
551 {0x30, 0x11, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x10}, 530 {0x30, 0x11, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x10},
552 {0x30, 0x11, 0x02, 0x20, 0xa9, 0x00, 0x00, 0x10}, 531 {0x30, 0x11, 0x02, 0x20, 0xa9, 0x00, 0x00, 0x10},
553 {0xa0, 0x61, 0x9a, 0xca, 0x00, 0x00, 0x00, 0x17}, 532};
533/* Known TAS5110D registers
534 * reg02: gain, bit order reversed!! 0 == max gain, 255 == min gain
535 * reg03: bit3: vflip, bit4: ~hflip, bit7: ~gainboost (~ == inverted)
536 * Note: writing reg03 seems to only work when written together with 02
537 */
538static const __u8 tas5110d_sensor_init[][8] = {
539 {0xa0, 0x61, 0x9a, 0xca, 0x00, 0x00, 0x00, 0x17}, /* reset */
554}; 540};
555 541
556static const __u8 initTas5130[] = { 542static const __u8 initTas5130[] = {
@@ -558,7 +544,6 @@ static const __u8 initTas5130[] = {
558 0x00, 0x00, 544 0x00, 0x00,
559 0x00, 0x00, 0x00, 0x68, 0x0c, 0x0a, 545 0x00, 0x00, 0x00, 0x68, 0x0c, 0x0a,
560 0x28, 0x1e, 0x60, COMP, MCK_INIT, 546 0x28, 0x1e, 0x60, COMP, MCK_INIT,
561 0x18, 0x10, 0x04, 0x03, 0x11, 0x0c
562}; 547};
563static const __u8 tas5130_sensor_init[][8] = { 548static const __u8 tas5130_sensor_init[][8] = {
564/* {0x30, 0x11, 0x00, 0x40, 0x47, 0x00, 0x00, 0x10}, 549/* {0x30, 0x11, 0x00, 0x40, 0x47, 0x00, 0x00, 0x10},
@@ -569,21 +554,18 @@ static const __u8 tas5130_sensor_init[][8] = {
569}; 554};
570 555
571static struct sensor_data sensor_data[] = { 556static struct sensor_data sensor_data[] = {
572SENS(initHv7131d, NULL, hv7131d_sensor_init, NULL, NULL, F_GAIN, NO_BRIGHTNESS|NO_FREQ, 0), 557SENS(initHv7131d, hv7131d_sensor_init, F_GAIN, NO_BRIGHTNESS|NO_FREQ, 0),
573SENS(initHv7131r, NULL, hv7131r_sensor_init, NULL, NULL, 0, NO_BRIGHTNESS|NO_EXPO|NO_FREQ, 0), 558SENS(initHv7131r, hv7131r_sensor_init, 0, NO_BRIGHTNESS|NO_EXPO|NO_FREQ, 0),
574SENS(initOv6650, NULL, ov6650_sensor_init, NULL, NULL, F_GAIN|F_SIF, 0, 0x60), 559SENS(initOv6650, ov6650_sensor_init, F_GAIN|F_SIF, 0, 0x60),
575SENS(initOv7630, initOv7630_3, ov7630_sensor_init, NULL, ov7630_sensor_init_3, 560SENS(initOv7630, ov7630_sensor_init, F_GAIN, 0, 0x21),
576 F_GAIN, 0, 0x21), 561SENS(initPas106, pas106_sensor_init, F_GAIN|F_SIF, NO_FREQ, 0),
577SENS(initPas106, NULL, pas106_sensor_init, NULL, NULL, F_GAIN|F_SIF, NO_FREQ, 562SENS(initPas202, pas202_sensor_init, F_GAIN, NO_FREQ, 0),
578 0), 563SENS(initTas5110c, tas5110c_sensor_init, F_GAIN|F_SIF|F_COARSE_EXPO,
579SENS(initPas202, initPas202, pas202_sensor_init, NULL, NULL, F_GAIN, 564 NO_BRIGHTNESS|NO_FREQ, 0),
580 NO_FREQ, 0), 565SENS(initTas5110d, tas5110d_sensor_init, F_GAIN|F_SIF|F_COARSE_EXPO,
581SENS(initTas5110c, NULL, tas5110_sensor_init, NULL, NULL, 566 NO_BRIGHTNESS|NO_FREQ, 0),
582 F_GAIN|F_SIF|F_COARSE_EXPO, NO_BRIGHTNESS|NO_FREQ, 0), 567SENS(initTas5130, tas5130_sensor_init, F_GAIN,
583SENS(initTas5110d, NULL, tas5110_sensor_init, NULL, NULL, 568 NO_BRIGHTNESS|NO_EXPO|NO_FREQ, 0),
584 F_GAIN|F_SIF|F_COARSE_EXPO, NO_BRIGHTNESS|NO_FREQ, 0),
585SENS(initTas5130, NULL, tas5130_sensor_init, NULL, NULL, 0, NO_EXPO|NO_FREQ,
586 0),
587}; 569};
588 570
589/* get one byte in gspca_dev->usb_buf */ 571/* get one byte in gspca_dev->usb_buf */
@@ -655,7 +637,6 @@ static void i2c_w_vector(struct gspca_dev *gspca_dev,
655static void setbrightness(struct gspca_dev *gspca_dev) 637static void setbrightness(struct gspca_dev *gspca_dev)
656{ 638{
657 struct sd *sd = (struct sd *) gspca_dev; 639 struct sd *sd = (struct sd *) gspca_dev;
658 __u8 value;
659 640
660 switch (sd->sensor) { 641 switch (sd->sensor) {
661 case SENSOR_OV6650: 642 case SENSOR_OV6650:
@@ -697,17 +678,6 @@ static void setbrightness(struct gspca_dev *gspca_dev)
697 goto err; 678 goto err;
698 break; 679 break;
699 } 680 }
700 case SENSOR_TAS5130CXX: {
701 __u8 i2c[] =
702 {0x30, 0x11, 0x02, 0x20, 0x70, 0x00, 0x00, 0x10};
703
704 value = 0xff - sd->brightness;
705 i2c[4] = value;
706 PDEBUG(D_CONF, "brightness %d : %d", value, i2c[4]);
707 if (i2c_w(gspca_dev, i2c) < 0)
708 goto err;
709 break;
710 }
711 } 681 }
712 return; 682 return;
713err: 683err:
@@ -733,7 +703,7 @@ static void setsensorgain(struct gspca_dev *gspca_dev)
733 break; 703 break;
734 } 704 }
735 case SENSOR_TAS5110C: 705 case SENSOR_TAS5110C:
736 case SENSOR_TAS5110D: { 706 case SENSOR_TAS5130CXX: {
737 __u8 i2c[] = 707 __u8 i2c[] =
738 {0x30, 0x11, 0x02, 0x20, 0x70, 0x00, 0x00, 0x10}; 708 {0x30, 0x11, 0x02, 0x20, 0x70, 0x00, 0x00, 0x10};
739 709
@@ -742,6 +712,23 @@ static void setsensorgain(struct gspca_dev *gspca_dev)
742 goto err; 712 goto err;
743 break; 713 break;
744 } 714 }
715 case SENSOR_TAS5110D: {
716 __u8 i2c[] = {
717 0xb0, 0x61, 0x02, 0x00, 0x10, 0x00, 0x00, 0x17 };
718 gain = 255 - gain;
719 /* The bits in the register are the wrong way around!! */
720 i2c[3] |= (gain & 0x80) >> 7;
721 i2c[3] |= (gain & 0x40) >> 5;
722 i2c[3] |= (gain & 0x20) >> 3;
723 i2c[3] |= (gain & 0x10) >> 1;
724 i2c[3] |= (gain & 0x08) << 1;
725 i2c[3] |= (gain & 0x04) << 3;
726 i2c[3] |= (gain & 0x02) << 5;
727 i2c[3] |= (gain & 0x01) << 7;
728 if (i2c_w(gspca_dev, i2c) < 0)
729 goto err;
730 break;
731 }
745 732
746 case SENSOR_OV6650: 733 case SENSOR_OV6650:
747 gain >>= 1; 734 gain >>= 1;
@@ -796,7 +783,7 @@ static void setgain(struct gspca_dev *gspca_dev)
796{ 783{
797 struct sd *sd = (struct sd *) gspca_dev; 784 struct sd *sd = (struct sd *) gspca_dev;
798 __u8 gain; 785 __u8 gain;
799 __u8 buf[2] = { 0, 0 }; 786 __u8 buf[3] = { 0, 0, 0 };
800 787
801 if (sensor_data[sd->sensor].flags & F_GAIN) { 788 if (sensor_data[sd->sensor].flags & F_GAIN) {
802 /* Use the sensor gain to do the actual gain */ 789 /* Use the sensor gain to do the actual gain */
@@ -804,13 +791,18 @@ static void setgain(struct gspca_dev *gspca_dev)
804 return; 791 return;
805 } 792 }
806 793
807 gain = sd->gain >> 4; 794 if (sd->bridge == BRIDGE_103) {
808 795 gain = sd->gain >> 1;
809 /* red and blue gain */ 796 buf[0] = gain; /* Red */
810 buf[0] = gain << 4 | gain; 797 buf[1] = gain; /* Green */
811 /* green gain */ 798 buf[2] = gain; /* Blue */
812 buf[1] = gain; 799 reg_w(gspca_dev, 0x05, buf, 3);
813 reg_w(gspca_dev, 0x10, buf, 2); 800 } else {
801 gain = sd->gain >> 4;
802 buf[0] = gain << 4 | gain; /* Red and blue */
803 buf[1] = gain; /* Green */
804 reg_w(gspca_dev, 0x10, buf, 2);
805 }
814} 806}
815 807
816static void setexposure(struct gspca_dev *gspca_dev) 808static void setexposure(struct gspca_dev *gspca_dev)
@@ -1049,7 +1041,7 @@ static void do_autogain(struct gspca_dev *gspca_dev)
1049 desired_avg_lum = 5000; 1041 desired_avg_lum = 5000;
1050 } else { 1042 } else {
1051 deadzone = 1500; 1043 deadzone = 1500;
1052 desired_avg_lum = 18000; 1044 desired_avg_lum = 13000;
1053 } 1045 }
1054 1046
1055 if (sensor_data[sd->sensor].flags & F_COARSE_EXPO) 1047 if (sensor_data[sd->sensor].flags & F_COARSE_EXPO)
@@ -1127,53 +1119,91 @@ static int sd_start(struct gspca_dev *gspca_dev)
1127{ 1119{
1128 struct sd *sd = (struct sd *) gspca_dev; 1120 struct sd *sd = (struct sd *) gspca_dev;
1129 struct cam *cam = &gspca_dev->cam; 1121 struct cam *cam = &gspca_dev->cam;
1130 int mode, l; 1122 int i, mode;
1131 const __u8 *sn9c10x; 1123 __u8 regs[0x31];
1132 __u8 reg12_19[8];
1133 1124
1134 mode = cam->cam_mode[gspca_dev->curr_mode].priv & 0x07; 1125 mode = cam->cam_mode[gspca_dev->curr_mode].priv & 0x07;
1135 sn9c10x = sensor_data[sd->sensor].bridge_init[sd->bridge]; 1126 /* Copy registers 0x01 - 0x19 from the template */
1136 l = sensor_data[sd->sensor].bridge_init_size[sd->bridge]; 1127 memcpy(&regs[0x01], sensor_data[sd->sensor].bridge_init, 0x19);
1137 memcpy(reg12_19, &sn9c10x[0x12 - 1], 8); 1128 /* Set the mode */
1138 reg12_19[6] = sn9c10x[0x18 - 1] | (mode << 4); 1129 regs[0x18] |= mode << 4;
1139 /* Special cases where reg 17 and or 19 value depends on mode */ 1130
1131 /* Set bridge gain to 1.0 */
1132 if (sd->bridge == BRIDGE_103) {
1133 regs[0x05] = 0x20; /* Red */
1134 regs[0x06] = 0x20; /* Green */
1135 regs[0x07] = 0x20; /* Blue */
1136 } else {
1137 regs[0x10] = 0x00; /* Red and blue */
1138 regs[0x11] = 0x00; /* Green */
1139 }
1140
1141 /* Setup pixel numbers and auto exposure window */
1142 if (sensor_data[sd->sensor].flags & F_SIF) {
1143 regs[0x1a] = 0x14; /* HO_SIZE 640, makes no sense */
1144 regs[0x1b] = 0x0a; /* VO_SIZE 320, makes no sense */
1145 regs[0x1c] = 0x02; /* AE H-start 64 */
1146 regs[0x1d] = 0x02; /* AE V-start 64 */
1147 regs[0x1e] = 0x09; /* AE H-end 288 */
1148 regs[0x1f] = 0x07; /* AE V-end 224 */
1149 } else {
1150 regs[0x1a] = 0x1d; /* HO_SIZE 960, makes no sense */
1151 regs[0x1b] = 0x10; /* VO_SIZE 512, makes no sense */
1152 regs[0x1c] = 0x05; /* AE H-start 160 */
1153 regs[0x1d] = 0x03; /* AE V-start 96 */
1154 regs[0x1e] = 0x0f; /* AE H-end 480 */
1155 regs[0x1f] = 0x0c; /* AE V-end 384 */
1156 }
1157
1158 /* Setup the gamma table (only used with the sn9c103 bridge) */
1159 for (i = 0; i < 16; i++)
1160 regs[0x20 + i] = i * 16;
1161 regs[0x20 + i] = 255;
1162
1163 /* Special cases where some regs depend on mode or bridge */
1140 switch (sd->sensor) { 1164 switch (sd->sensor) {
1141 case SENSOR_TAS5130CXX: 1165 case SENSOR_TAS5130CXX:
1142 /* probably not mode specific at all most likely the upper 1166 /* FIXME / TESTME
1167 probably not mode specific at all most likely the upper
1143 nibble of 0x19 is exposure (clock divider) just as with 1168 nibble of 0x19 is exposure (clock divider) just as with
1144 the tas5110, we need someone to test this. */ 1169 the tas5110, we need someone to test this. */
1145 reg12_19[7] = mode ? 0x23 : 0x43; 1170 regs[0x19] = mode ? 0x23 : 0x43;
1146 break; 1171 break;
1172 case SENSOR_OV7630:
1173 /* FIXME / TESTME for some reason with the 101/102 bridge the
1174 clock is set to 12 Mhz (reg1 == 0x04), rather then 24.
1175 Also the hstart needs to go from 1 to 2 when using a 103,
1176 which is likely related. This does not seem right. */
1177 if (sd->bridge == BRIDGE_103) {
1178 regs[0x01] = 0x44; /* Select 24 Mhz clock */
1179 regs[0x12] = 0x02; /* Set hstart to 2 */
1180 }
1147 } 1181 }
1148 /* Disable compression when the raw bayer format has been selected */ 1182 /* Disable compression when the raw bayer format has been selected */
1149 if (cam->cam_mode[gspca_dev->curr_mode].priv & MODE_RAW) 1183 if (cam->cam_mode[gspca_dev->curr_mode].priv & MODE_RAW)
1150 reg12_19[6] &= ~0x80; 1184 regs[0x18] &= ~0x80;
1151 1185
1152 /* Vga mode emulation on SIF sensor? */ 1186 /* Vga mode emulation on SIF sensor? */
1153 if (cam->cam_mode[gspca_dev->curr_mode].priv & MODE_REDUCED_SIF) { 1187 if (cam->cam_mode[gspca_dev->curr_mode].priv & MODE_REDUCED_SIF) {
1154 reg12_19[0] += 16; /* 0x12: hstart adjust */ 1188 regs[0x12] += 16; /* hstart adjust */
1155 reg12_19[1] += 24; /* 0x13: vstart adjust */ 1189 regs[0x13] += 24; /* vstart adjust */
1156 reg12_19[3] = 320 / 16; /* 0x15: hsize */ 1190 regs[0x15] = 320 / 16; /* hsize */
1157 reg12_19[4] = 240 / 16; /* 0x16: vsize */ 1191 regs[0x16] = 240 / 16; /* vsize */
1158 } 1192 }
1159 1193
1160 /* reg 0x01 bit 2 video transfert on */ 1194 /* reg 0x01 bit 2 video transfert on */
1161 reg_w(gspca_dev, 0x01, &sn9c10x[0x01 - 1], 1); 1195 reg_w(gspca_dev, 0x01, &regs[0x01], 1);
1162 /* reg 0x17 SensorClk enable inv Clk 0x60 */ 1196 /* reg 0x17 SensorClk enable inv Clk 0x60 */
1163 reg_w(gspca_dev, 0x17, &sn9c10x[0x17 - 1], 1); 1197 reg_w(gspca_dev, 0x17, &regs[0x17], 1);
1164 /* Set the registers from the template */ 1198 /* Set the registers from the template */
1165 reg_w(gspca_dev, 0x01, sn9c10x, l); 1199 reg_w(gspca_dev, 0x01, &regs[0x01],
1200 (sd->bridge == BRIDGE_103) ? 0x30 : 0x1f);
1166 1201
1167 /* Init the sensor */ 1202 /* Init the sensor */
1168 i2c_w_vector(gspca_dev, sensor_data[sd->sensor].sensor_init, 1203 i2c_w_vector(gspca_dev, sensor_data[sd->sensor].sensor_init,
1169 sensor_data[sd->sensor].sensor_init_size); 1204 sensor_data[sd->sensor].sensor_init_size);
1170 if (sensor_data[sd->sensor].sensor_bridge_init[sd->bridge])
1171 i2c_w_vector(gspca_dev,
1172 sensor_data[sd->sensor].sensor_bridge_init[sd->bridge],
1173 sensor_data[sd->sensor].sensor_bridge_init_size[
1174 sd->bridge]);
1175 1205
1176 /* Mode specific sensor setup */ 1206 /* Mode / bridge specific sensor setup */
1177 switch (sd->sensor) { 1207 switch (sd->sensor) {
1178 case SENSOR_PAS202: { 1208 case SENSOR_PAS202: {
1179 const __u8 i2cpclockdiv[] = 1209 const __u8 i2cpclockdiv[] =
@@ -1181,27 +1211,37 @@ static int sd_start(struct gspca_dev *gspca_dev)
1181 /* clockdiv from 4 to 3 (7.5 -> 10 fps) when in low res mode */ 1211 /* clockdiv from 4 to 3 (7.5 -> 10 fps) when in low res mode */
1182 if (mode) 1212 if (mode)
1183 i2c_w(gspca_dev, i2cpclockdiv); 1213 i2c_w(gspca_dev, i2cpclockdiv);
1214 break;
1184 } 1215 }
1216 case SENSOR_OV7630:
1217 /* FIXME / TESTME We should be able to handle this identical
1218 for the 101/102 and the 103 case */
1219 if (sd->bridge == BRIDGE_103) {
1220 const __u8 i2c[] = { 0xa0, 0x21, 0x13,
1221 0x80, 0x00, 0x00, 0x00, 0x10 };
1222 i2c_w(gspca_dev, i2c);
1223 }
1224 break;
1185 } 1225 }
1186 /* H_size V_size 0x28, 0x1e -> 640x480. 0x16, 0x12 -> 352x288 */ 1226 /* H_size V_size 0x28, 0x1e -> 640x480. 0x16, 0x12 -> 352x288 */
1187 reg_w(gspca_dev, 0x15, &reg12_19[3], 2); 1227 reg_w(gspca_dev, 0x15, &regs[0x15], 2);
1188 /* compression register */ 1228 /* compression register */
1189 reg_w(gspca_dev, 0x18, &reg12_19[6], 1); 1229 reg_w(gspca_dev, 0x18, &regs[0x18], 1);
1190 /* H_start */ 1230 /* H_start */
1191 reg_w(gspca_dev, 0x12, &reg12_19[0], 1); 1231 reg_w(gspca_dev, 0x12, &regs[0x12], 1);
1192 /* V_START */ 1232 /* V_START */
1193 reg_w(gspca_dev, 0x13, &reg12_19[1], 1); 1233 reg_w(gspca_dev, 0x13, &regs[0x13], 1);
1194 /* reset 0x17 SensorClk enable inv Clk 0x60 */ 1234 /* reset 0x17 SensorClk enable inv Clk 0x60 */
1195 /*fixme: ov7630 [17]=68 8f (+20 if 102)*/ 1235 /*fixme: ov7630 [17]=68 8f (+20 if 102)*/
1196 reg_w(gspca_dev, 0x17, &reg12_19[5], 1); 1236 reg_w(gspca_dev, 0x17, &regs[0x17], 1);
1197 /*MCKSIZE ->3 */ /*fixme: not ov7630*/ 1237 /*MCKSIZE ->3 */ /*fixme: not ov7630*/
1198 reg_w(gspca_dev, 0x19, &reg12_19[7], 1); 1238 reg_w(gspca_dev, 0x19, &regs[0x19], 1);
1199 /* AE_STRX AE_STRY AE_ENDX AE_ENDY */ 1239 /* AE_STRX AE_STRY AE_ENDX AE_ENDY */
1200 reg_w(gspca_dev, 0x1c, &sn9c10x[0x1c - 1], 4); 1240 reg_w(gspca_dev, 0x1c, &regs[0x1c], 4);
1201 /* Enable video transfert */ 1241 /* Enable video transfert */
1202 reg_w(gspca_dev, 0x01, &sn9c10x[0], 1); 1242 reg_w(gspca_dev, 0x01, &regs[0x01], 1);
1203 /* Compression */ 1243 /* Compression */
1204 reg_w(gspca_dev, 0x18, &reg12_19[6], 2); 1244 reg_w(gspca_dev, 0x18, &regs[0x18], 2);
1205 msleep(20); 1245 msleep(20);
1206 1246
1207 sd->reg11 = -1; 1247 sd->reg11 = -1;
@@ -1525,15 +1565,15 @@ static const struct sd_desc sd_desc = {
1525 .driver_info = (SENSOR_ ## sensor << 8) | BRIDGE_ ## bridge 1565 .driver_info = (SENSOR_ ## sensor << 8) | BRIDGE_ ## bridge
1526 1566
1527 1567
1528static const struct usb_device_id device_table[] __devinitconst = { 1568static const struct usb_device_id device_table[] = {
1529 {USB_DEVICE(0x0c45, 0x6001), SB(TAS5110C, 102)}, /* TAS5110C1B */ 1569 {USB_DEVICE(0x0c45, 0x6001), SB(TAS5110C, 102)}, /* TAS5110C1B */
1530 {USB_DEVICE(0x0c45, 0x6005), SB(TAS5110C, 101)}, /* TAS5110C1B */ 1570 {USB_DEVICE(0x0c45, 0x6005), SB(TAS5110C, 101)}, /* TAS5110C1B */
1531 {USB_DEVICE(0x0c45, 0x6007), SB(TAS5110D, 101)}, /* TAS5110D */ 1571 {USB_DEVICE(0x0c45, 0x6007), SB(TAS5110D, 101)}, /* TAS5110D */
1532 {USB_DEVICE(0x0c45, 0x6009), SB(PAS106, 101)}, 1572 {USB_DEVICE(0x0c45, 0x6009), SB(PAS106, 101)},
1533 {USB_DEVICE(0x0c45, 0x600d), SB(PAS106, 101)}, 1573 {USB_DEVICE(0x0c45, 0x600d), SB(PAS106, 101)},
1534 {USB_DEVICE(0x0c45, 0x6011), SB(OV6650, 101)}, 1574 {USB_DEVICE(0x0c45, 0x6011), SB(OV6650, 101)},
1535#if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE
1536 {USB_DEVICE(0x0c45, 0x6019), SB(OV7630, 101)}, 1575 {USB_DEVICE(0x0c45, 0x6019), SB(OV7630, 101)},
1576#if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE
1537 {USB_DEVICE(0x0c45, 0x6024), SB(TAS5130CXX, 102)}, 1577 {USB_DEVICE(0x0c45, 0x6024), SB(TAS5130CXX, 102)},
1538 {USB_DEVICE(0x0c45, 0x6025), SB(TAS5130CXX, 102)}, 1578 {USB_DEVICE(0x0c45, 0x6025), SB(TAS5130CXX, 102)},
1539#endif 1579#endif
@@ -1544,18 +1584,22 @@ static const struct usb_device_id device_table[] __devinitconst = {
1544 {USB_DEVICE(0x0c45, 0x602c), SB(OV7630, 102)}, 1584 {USB_DEVICE(0x0c45, 0x602c), SB(OV7630, 102)},
1545 {USB_DEVICE(0x0c45, 0x602d), SB(HV7131R, 102)}, 1585 {USB_DEVICE(0x0c45, 0x602d), SB(HV7131R, 102)},
1546 {USB_DEVICE(0x0c45, 0x602e), SB(OV7630, 102)}, 1586 {USB_DEVICE(0x0c45, 0x602e), SB(OV7630, 102)},
1547 /* {USB_DEVICE(0x0c45, 0x602b), SB(MI03XX, 102)}, */ /* MI0343 MI0360 MI0330 */ 1587 /* {USB_DEVICE(0x0c45, 0x6030), SB(MI03XX, 102)}, */ /* MI0343 MI0360 MI0330 */
1588 /* {USB_DEVICE(0x0c45, 0x6082), SB(MI03XX, 103)}, */ /* MI0343 MI0360 */
1589 {USB_DEVICE(0x0c45, 0x6083), SB(HV7131D, 103)},
1590 {USB_DEVICE(0x0c45, 0x608c), SB(HV7131R, 103)},
1591 /* {USB_DEVICE(0x0c45, 0x608e), SB(CISVF10, 103)}, */
1548 {USB_DEVICE(0x0c45, 0x608f), SB(OV7630, 103)}, 1592 {USB_DEVICE(0x0c45, 0x608f), SB(OV7630, 103)},
1549#if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE 1593 {USB_DEVICE(0x0c45, 0x60a8), SB(PAS106, 103)},
1594 {USB_DEVICE(0x0c45, 0x60aa), SB(TAS5130CXX, 103)},
1550 {USB_DEVICE(0x0c45, 0x60af), SB(PAS202, 103)}, 1595 {USB_DEVICE(0x0c45, 0x60af), SB(PAS202, 103)},
1551#endif
1552 {USB_DEVICE(0x0c45, 0x60b0), SB(OV7630, 103)}, 1596 {USB_DEVICE(0x0c45, 0x60b0), SB(OV7630, 103)},
1553 {} 1597 {}
1554}; 1598};
1555MODULE_DEVICE_TABLE(usb, device_table); 1599MODULE_DEVICE_TABLE(usb, device_table);
1556 1600
1557/* -- device connect -- */ 1601/* -- device connect -- */
1558static int __devinit sd_probe(struct usb_interface *intf, 1602static int sd_probe(struct usb_interface *intf,
1559 const struct usb_device_id *id) 1603 const struct usb_device_id *id)
1560{ 1604{
1561 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), 1605 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c
index 2d0bb17a30a..d6f39ce1b7e 100644
--- a/drivers/media/video/gspca/sonixj.c
+++ b/drivers/media/video/gspca/sonixj.c
@@ -25,12 +25,12 @@
25#include "gspca.h" 25#include "gspca.h"
26#include "jpeg.h" 26#include "jpeg.h"
27 27
28#define V4L2_CID_INFRARED (V4L2_CID_PRIVATE_BASE + 0)
29
30MODULE_AUTHOR("Jean-François Moine <http://moinejf.free.fr>"); 28MODULE_AUTHOR("Jean-François Moine <http://moinejf.free.fr>");
31MODULE_DESCRIPTION("GSPCA/SONIX JPEG USB Camera Driver"); 29MODULE_DESCRIPTION("GSPCA/SONIX JPEG USB Camera Driver");
32MODULE_LICENSE("GPL"); 30MODULE_LICENSE("GPL");
33 31
32static int starcam;
33
34/* controls */ 34/* controls */
35enum e_ctrl { 35enum e_ctrl {
36 BRIGHTNESS, 36 BRIGHTNESS,
@@ -43,7 +43,7 @@ enum e_ctrl {
43 HFLIP, 43 HFLIP,
44 VFLIP, 44 VFLIP,
45 SHARPNESS, 45 SHARPNESS,
46 INFRARED, 46 ILLUM,
47 FREQ, 47 FREQ,
48 NCTRLS /* number of controls */ 48 NCTRLS /* number of controls */
49}; 49};
@@ -100,7 +100,8 @@ enum sensors {
100}; 100};
101 101
102/* device flags */ 102/* device flags */
103#define PDN_INV 1 /* inverse pin S_PWR_DN / sn_xxx tables */ 103#define F_PDN_INV 0x01 /* inverse pin S_PWR_DN / sn_xxx tables */
104#define F_ILLUM 0x02 /* presence of illuminator */
104 105
105/* sn9c1xx definitions */ 106/* sn9c1xx definitions */
106/* register 0x01 */ 107/* register 0x01 */
@@ -124,7 +125,7 @@ static void setgamma(struct gspca_dev *gspca_dev);
124static void setautogain(struct gspca_dev *gspca_dev); 125static void setautogain(struct gspca_dev *gspca_dev);
125static void sethvflip(struct gspca_dev *gspca_dev); 126static void sethvflip(struct gspca_dev *gspca_dev);
126static void setsharpness(struct gspca_dev *gspca_dev); 127static void setsharpness(struct gspca_dev *gspca_dev);
127static void setinfrared(struct gspca_dev *gspca_dev); 128static void setillum(struct gspca_dev *gspca_dev);
128static void setfreq(struct gspca_dev *gspca_dev); 129static void setfreq(struct gspca_dev *gspca_dev);
129 130
130static const struct ctrl sd_ctrls[NCTRLS] = { 131static const struct ctrl sd_ctrls[NCTRLS] = {
@@ -251,18 +252,17 @@ static const struct ctrl sd_ctrls[NCTRLS] = {
251 }, 252 },
252 .set_control = setsharpness 253 .set_control = setsharpness
253 }, 254 },
254/* mt9v111 only */ 255[ILLUM] = {
255[INFRARED] = {
256 { 256 {
257 .id = V4L2_CID_INFRARED, 257 .id = V4L2_CID_ILLUMINATORS_1,
258 .type = V4L2_CTRL_TYPE_BOOLEAN, 258 .type = V4L2_CTRL_TYPE_BOOLEAN,
259 .name = "Infrared", 259 .name = "Illuminator / infrared",
260 .minimum = 0, 260 .minimum = 0,
261 .maximum = 1, 261 .maximum = 1,
262 .step = 1, 262 .step = 1,
263 .default_value = 0, 263 .default_value = 0,
264 }, 264 },
265 .set_control = setinfrared 265 .set_control = setillum
266 }, 266 },
267/* ov7630/ov7648/ov7660 only */ 267/* ov7630/ov7648/ov7660 only */
268[FREQ] = { 268[FREQ] = {
@@ -282,32 +282,26 @@ static const struct ctrl sd_ctrls[NCTRLS] = {
282/* table of the disabled controls */ 282/* table of the disabled controls */
283static const __u32 ctrl_dis[] = { 283static const __u32 ctrl_dis[] = {
284[SENSOR_ADCM1700] = (1 << AUTOGAIN) | 284[SENSOR_ADCM1700] = (1 << AUTOGAIN) |
285 (1 << INFRARED) |
286 (1 << HFLIP) | 285 (1 << HFLIP) |
287 (1 << VFLIP) | 286 (1 << VFLIP) |
288 (1 << FREQ), 287 (1 << FREQ),
289 288
290[SENSOR_GC0307] = (1 << INFRARED) | 289[SENSOR_GC0307] = (1 << HFLIP) |
291 (1 << HFLIP) |
292 (1 << VFLIP) | 290 (1 << VFLIP) |
293 (1 << FREQ), 291 (1 << FREQ),
294 292
295[SENSOR_HV7131R] = (1 << INFRARED) | 293[SENSOR_HV7131R] = (1 << HFLIP) |
296 (1 << HFLIP) |
297 (1 << FREQ), 294 (1 << FREQ),
298 295
299[SENSOR_MI0360] = (1 << INFRARED) | 296[SENSOR_MI0360] = (1 << HFLIP) |
300 (1 << HFLIP) |
301 (1 << VFLIP) | 297 (1 << VFLIP) |
302 (1 << FREQ), 298 (1 << FREQ),
303 299
304[SENSOR_MI0360B] = (1 << INFRARED) | 300[SENSOR_MI0360B] = (1 << HFLIP) |
305 (1 << HFLIP) |
306 (1 << VFLIP) | 301 (1 << VFLIP) |
307 (1 << FREQ), 302 (1 << FREQ),
308 303
309[SENSOR_MO4000] = (1 << INFRARED) | 304[SENSOR_MO4000] = (1 << HFLIP) |
310 (1 << HFLIP) |
311 (1 << VFLIP) | 305 (1 << VFLIP) |
312 (1 << FREQ), 306 (1 << FREQ),
313 307
@@ -315,40 +309,32 @@ static const __u32 ctrl_dis[] = {
315 (1 << VFLIP) | 309 (1 << VFLIP) |
316 (1 << FREQ), 310 (1 << FREQ),
317 311
318[SENSOR_OM6802] = (1 << INFRARED) | 312[SENSOR_OM6802] = (1 << HFLIP) |
319 (1 << HFLIP) |
320 (1 << VFLIP) | 313 (1 << VFLIP) |
321 (1 << FREQ), 314 (1 << FREQ),
322 315
323[SENSOR_OV7630] = (1 << INFRARED) | 316[SENSOR_OV7630] = (1 << HFLIP),
324 (1 << HFLIP),
325 317
326[SENSOR_OV7648] = (1 << INFRARED) | 318[SENSOR_OV7648] = (1 << HFLIP),
327 (1 << HFLIP),
328 319
329[SENSOR_OV7660] = (1 << AUTOGAIN) | 320[SENSOR_OV7660] = (1 << AUTOGAIN) |
330 (1 << INFRARED) |
331 (1 << HFLIP) | 321 (1 << HFLIP) |
332 (1 << VFLIP), 322 (1 << VFLIP),
333 323
334[SENSOR_PO1030] = (1 << AUTOGAIN) | 324[SENSOR_PO1030] = (1 << AUTOGAIN) |
335 (1 << INFRARED) |
336 (1 << HFLIP) | 325 (1 << HFLIP) |
337 (1 << VFLIP) | 326 (1 << VFLIP) |
338 (1 << FREQ), 327 (1 << FREQ),
339 328
340[SENSOR_PO2030N] = (1 << AUTOGAIN) | 329[SENSOR_PO2030N] = (1 << AUTOGAIN) |
341 (1 << INFRARED) |
342 (1 << FREQ), 330 (1 << FREQ),
343 331
344[SENSOR_SOI768] = (1 << AUTOGAIN) | 332[SENSOR_SOI768] = (1 << AUTOGAIN) |
345 (1 << INFRARED) |
346 (1 << HFLIP) | 333 (1 << HFLIP) |
347 (1 << VFLIP) | 334 (1 << VFLIP) |
348 (1 << FREQ), 335 (1 << FREQ),
349 336
350[SENSOR_SP80708] = (1 << AUTOGAIN) | 337[SENSOR_SP80708] = (1 << AUTOGAIN) |
351 (1 << INFRARED) |
352 (1 << HFLIP) | 338 (1 << HFLIP) |
353 (1 << VFLIP) | 339 (1 << VFLIP) |
354 (1 << FREQ), 340 (1 << FREQ),
@@ -1822,44 +1808,46 @@ static int sd_init(struct gspca_dev *gspca_dev)
1822 PDEBUG(D_PROBE, "Sonix chip id: %02x", regF1); 1808 PDEBUG(D_PROBE, "Sonix chip id: %02x", regF1);
1823 switch (sd->bridge) { 1809 switch (sd->bridge) {
1824 case BRIDGE_SN9C102P: 1810 case BRIDGE_SN9C102P:
1811 case BRIDGE_SN9C105:
1825 if (regF1 != 0x11) 1812 if (regF1 != 0x11)
1826 return -ENODEV; 1813 return -ENODEV;
1814 break;
1815 default:
1816/* case BRIDGE_SN9C110: */
1817/* case BRIDGE_SN9C120: */
1818 if (regF1 != 0x12)
1819 return -ENODEV;
1820 }
1821
1822 switch (sd->sensor) {
1823 case SENSOR_MI0360:
1824 mi0360_probe(gspca_dev);
1825 break;
1826 case SENSOR_OV7630:
1827 ov7630_probe(gspca_dev);
1828 break;
1829 case SENSOR_OV7648:
1830 ov7648_probe(gspca_dev);
1831 break;
1832 case SENSOR_PO2030N:
1833 po2030n_probe(gspca_dev);
1834 break;
1835 }
1836
1837 switch (sd->bridge) {
1838 case BRIDGE_SN9C102P:
1827 reg_w1(gspca_dev, 0x02, regGpio[1]); 1839 reg_w1(gspca_dev, 0x02, regGpio[1]);
1828 break; 1840 break;
1829 case BRIDGE_SN9C105: 1841 case BRIDGE_SN9C105:
1830 if (regF1 != 0x11)
1831 return -ENODEV;
1832 if (sd->sensor == SENSOR_MI0360)
1833 mi0360_probe(gspca_dev);
1834 reg_w(gspca_dev, 0x01, regGpio, 2); 1842 reg_w(gspca_dev, 0x01, regGpio, 2);
1835 break; 1843 break;
1844 case BRIDGE_SN9C110:
1845 reg_w1(gspca_dev, 0x02, 0x62);
1846 break;
1836 case BRIDGE_SN9C120: 1847 case BRIDGE_SN9C120:
1837 if (regF1 != 0x12)
1838 return -ENODEV;
1839 switch (sd->sensor) {
1840 case SENSOR_MI0360:
1841 mi0360_probe(gspca_dev);
1842 break;
1843 case SENSOR_OV7630:
1844 ov7630_probe(gspca_dev);
1845 break;
1846 case SENSOR_OV7648:
1847 ov7648_probe(gspca_dev);
1848 break;
1849 case SENSOR_PO2030N:
1850 po2030n_probe(gspca_dev);
1851 break;
1852 }
1853 regGpio[1] = 0x70; /* no audio */ 1848 regGpio[1] = 0x70; /* no audio */
1854 reg_w(gspca_dev, 0x01, regGpio, 2); 1849 reg_w(gspca_dev, 0x01, regGpio, 2);
1855 break; 1850 break;
1856 default:
1857/* case BRIDGE_SN9C110: */
1858/* case BRIDGE_SN9C325: */
1859 if (regF1 != 0x12)
1860 return -ENODEV;
1861 reg_w1(gspca_dev, 0x02, 0x62);
1862 break;
1863 } 1851 }
1864 1852
1865 if (sd->sensor == SENSOR_OM6802) 1853 if (sd->sensor == SENSOR_OM6802)
@@ -1874,6 +1862,8 @@ static int sd_init(struct gspca_dev *gspca_dev)
1874 sd->i2c_addr = sn9c1xx[9]; 1862 sd->i2c_addr = sn9c1xx[9];
1875 1863
1876 gspca_dev->ctrl_dis = ctrl_dis[sd->sensor]; 1864 gspca_dev->ctrl_dis = ctrl_dis[sd->sensor];
1865 if (!(sd->flags & F_ILLUM))
1866 gspca_dev->ctrl_dis |= (1 << ILLUM);
1877 1867
1878 return gspca_dev->usb_err; 1868 return gspca_dev->usb_err;
1879} 1869}
@@ -2197,16 +2187,28 @@ static void setsharpness(struct gspca_dev *gspca_dev)
2197 reg_w1(gspca_dev, 0x99, sd->ctrls[SHARPNESS].val); 2187 reg_w1(gspca_dev, 0x99, sd->ctrls[SHARPNESS].val);
2198} 2188}
2199 2189
2200static void setinfrared(struct gspca_dev *gspca_dev) 2190static void setillum(struct gspca_dev *gspca_dev)
2201{ 2191{
2202 struct sd *sd = (struct sd *) gspca_dev; 2192 struct sd *sd = (struct sd *) gspca_dev;
2203 2193
2204 if (gspca_dev->ctrl_dis & (1 << INFRARED)) 2194 if (gspca_dev->ctrl_dis & (1 << ILLUM))
2205 return; 2195 return;
2206/*fixme: different sequence for StarCam Clip and StarCam 370i */ 2196 switch (sd->sensor) {
2207/* Clip */ 2197 case SENSOR_ADCM1700:
2208 i2c_w1(gspca_dev, 0x02, /* gpio */ 2198 reg_w1(gspca_dev, 0x02, /* gpio */
2209 sd->ctrls[INFRARED].val ? 0x66 : 0x64); 2199 sd->ctrls[ILLUM].val ? 0x64 : 0x60);
2200 break;
2201 case SENSOR_MT9V111:
2202 if (starcam)
2203 reg_w1(gspca_dev, 0x02,
2204 sd->ctrls[ILLUM].val ?
2205 0x55 : 0x54); /* 370i */
2206 else
2207 reg_w1(gspca_dev, 0x02,
2208 sd->ctrls[ILLUM].val ?
2209 0x66 : 0x64); /* Clip */
2210 break;
2211 }
2210} 2212}
2211 2213
2212static void setfreq(struct gspca_dev *gspca_dev) 2214static void setfreq(struct gspca_dev *gspca_dev)
@@ -2344,7 +2346,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
2344 /* sensor clock already enabled in sd_init */ 2346 /* sensor clock already enabled in sd_init */
2345 /* reg_w1(gspca_dev, 0xf1, 0x00); */ 2347 /* reg_w1(gspca_dev, 0xf1, 0x00); */
2346 reg01 = sn9c1xx[1]; 2348 reg01 = sn9c1xx[1];
2347 if (sd->flags & PDN_INV) 2349 if (sd->flags & F_PDN_INV)
2348 reg01 ^= S_PDN_INV; /* power down inverted */ 2350 reg01 ^= S_PDN_INV; /* power down inverted */
2349 reg_w1(gspca_dev, 0x01, reg01); 2351 reg_w1(gspca_dev, 0x01, reg01);
2350 2352
@@ -2907,13 +2909,11 @@ static const struct sd_desc sd_desc = {
2907 .driver_info = (BRIDGE_ ## bridge << 16) \ 2909 .driver_info = (BRIDGE_ ## bridge << 16) \
2908 | (SENSOR_ ## sensor << 8) \ 2910 | (SENSOR_ ## sensor << 8) \
2909 | (flags) 2911 | (flags)
2910static const __devinitdata struct usb_device_id device_table[] = { 2912static const struct usb_device_id device_table[] = {
2911#if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE
2912 {USB_DEVICE(0x0458, 0x7025), BS(SN9C120, MI0360)}, 2913 {USB_DEVICE(0x0458, 0x7025), BS(SN9C120, MI0360)},
2913 {USB_DEVICE(0x0458, 0x702e), BS(SN9C120, OV7660)}, 2914 {USB_DEVICE(0x0458, 0x702e), BS(SN9C120, OV7660)},
2914#endif 2915 {USB_DEVICE(0x045e, 0x00f5), BSF(SN9C105, OV7660, F_PDN_INV)},
2915 {USB_DEVICE(0x045e, 0x00f5), BSF(SN9C105, OV7660, PDN_INV)}, 2916 {USB_DEVICE(0x045e, 0x00f7), BSF(SN9C105, OV7660, F_PDN_INV)},
2916 {USB_DEVICE(0x045e, 0x00f7), BSF(SN9C105, OV7660, PDN_INV)},
2917 {USB_DEVICE(0x0471, 0x0327), BS(SN9C105, MI0360)}, 2917 {USB_DEVICE(0x0471, 0x0327), BS(SN9C105, MI0360)},
2918 {USB_DEVICE(0x0471, 0x0328), BS(SN9C105, MI0360)}, 2918 {USB_DEVICE(0x0471, 0x0328), BS(SN9C105, MI0360)},
2919 {USB_DEVICE(0x0471, 0x0330), BS(SN9C105, MI0360)}, 2919 {USB_DEVICE(0x0471, 0x0330), BS(SN9C105, MI0360)},
@@ -2925,7 +2925,7 @@ static const __devinitdata struct usb_device_id device_table[] = {
2925/* {USB_DEVICE(0x0c45, 0x607b), BS(SN9C102P, OV7660)}, */ 2925/* {USB_DEVICE(0x0c45, 0x607b), BS(SN9C102P, OV7660)}, */
2926 {USB_DEVICE(0x0c45, 0x607c), BS(SN9C102P, HV7131R)}, 2926 {USB_DEVICE(0x0c45, 0x607c), BS(SN9C102P, HV7131R)},
2927/* {USB_DEVICE(0x0c45, 0x607e), BS(SN9C102P, OV7630)}, */ 2927/* {USB_DEVICE(0x0c45, 0x607e), BS(SN9C102P, OV7630)}, */
2928 {USB_DEVICE(0x0c45, 0x60c0), BS(SN9C105, MI0360)}, 2928 {USB_DEVICE(0x0c45, 0x60c0), BSF(SN9C105, MI0360, F_ILLUM)},
2929 /* or MT9V111 */ 2929 /* or MT9V111 */
2930/* {USB_DEVICE(0x0c45, 0x60c2), BS(SN9C105, P1030xC)}, */ 2930/* {USB_DEVICE(0x0c45, 0x60c2), BS(SN9C105, P1030xC)}, */
2931/* {USB_DEVICE(0x0c45, 0x60c8), BS(SN9C105, OM6802)}, */ 2931/* {USB_DEVICE(0x0c45, 0x60c8), BS(SN9C105, OM6802)}, */
@@ -2936,10 +2936,8 @@ static const __devinitdata struct usb_device_id device_table[] = {
2936/* {USB_DEVICE(0x0c45, 0x60fa), BS(SN9C105, OV7648)}, */ 2936/* {USB_DEVICE(0x0c45, 0x60fa), BS(SN9C105, OV7648)}, */
2937/* {USB_DEVICE(0x0c45, 0x60f2), BS(SN9C105, OV7660)}, */ 2937/* {USB_DEVICE(0x0c45, 0x60f2), BS(SN9C105, OV7660)}, */
2938 {USB_DEVICE(0x0c45, 0x60fb), BS(SN9C105, OV7660)}, 2938 {USB_DEVICE(0x0c45, 0x60fb), BS(SN9C105, OV7660)},
2939#if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE
2940 {USB_DEVICE(0x0c45, 0x60fc), BS(SN9C105, HV7131R)}, 2939 {USB_DEVICE(0x0c45, 0x60fc), BS(SN9C105, HV7131R)},
2941 {USB_DEVICE(0x0c45, 0x60fe), BS(SN9C105, OV7630)}, 2940 {USB_DEVICE(0x0c45, 0x60fe), BS(SN9C105, OV7630)},
2942#endif
2943 {USB_DEVICE(0x0c45, 0x6100), BS(SN9C120, MI0360)}, /*sn9c128*/ 2941 {USB_DEVICE(0x0c45, 0x6100), BS(SN9C120, MI0360)}, /*sn9c128*/
2944 {USB_DEVICE(0x0c45, 0x6102), BS(SN9C120, PO2030N)}, /* /GC0305*/ 2942 {USB_DEVICE(0x0c45, 0x6102), BS(SN9C120, PO2030N)}, /* /GC0305*/
2945/* {USB_DEVICE(0x0c45, 0x6108), BS(SN9C120, OM6802)}, */ 2943/* {USB_DEVICE(0x0c45, 0x6108), BS(SN9C120, OM6802)}, */
@@ -2962,16 +2960,15 @@ static const __devinitdata struct usb_device_id device_table[] = {
2962/* {USB_DEVICE(0x0c45, 0x6132), BS(SN9C120, OV7670)}, */ 2960/* {USB_DEVICE(0x0c45, 0x6132), BS(SN9C120, OV7670)}, */
2963 {USB_DEVICE(0x0c45, 0x6138), BS(SN9C120, MO4000)}, 2961 {USB_DEVICE(0x0c45, 0x6138), BS(SN9C120, MO4000)},
2964 {USB_DEVICE(0x0c45, 0x613a), BS(SN9C120, OV7648)}, 2962 {USB_DEVICE(0x0c45, 0x613a), BS(SN9C120, OV7648)},
2965#if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE
2966 {USB_DEVICE(0x0c45, 0x613b), BS(SN9C120, OV7660)}, 2963 {USB_DEVICE(0x0c45, 0x613b), BS(SN9C120, OV7660)},
2967#endif
2968 {USB_DEVICE(0x0c45, 0x613c), BS(SN9C120, HV7131R)}, 2964 {USB_DEVICE(0x0c45, 0x613c), BS(SN9C120, HV7131R)},
2969 {USB_DEVICE(0x0c45, 0x613e), BS(SN9C120, OV7630)}, 2965 {USB_DEVICE(0x0c45, 0x613e), BS(SN9C120, OV7630)},
2970 {USB_DEVICE(0x0c45, 0x6142), BS(SN9C120, PO2030N)}, /*sn9c120b*/ 2966 {USB_DEVICE(0x0c45, 0x6142), BS(SN9C120, PO2030N)}, /*sn9c120b*/
2971 /* or GC0305 / GC0307 */ 2967 /* or GC0305 / GC0307 */
2972 {USB_DEVICE(0x0c45, 0x6143), BS(SN9C120, SP80708)}, /*sn9c120b*/ 2968 {USB_DEVICE(0x0c45, 0x6143), BS(SN9C120, SP80708)}, /*sn9c120b*/
2973 {USB_DEVICE(0x0c45, 0x6148), BS(SN9C120, OM6802)}, /*sn9c120b*/ 2969 {USB_DEVICE(0x0c45, 0x6148), BS(SN9C120, OM6802)}, /*sn9c120b*/
2974 {USB_DEVICE(0x0c45, 0x614a), BS(SN9C120, ADCM1700)}, /*sn9c120b*/ 2970 {USB_DEVICE(0x0c45, 0x614a), BSF(SN9C120, ADCM1700, F_ILLUM)},
2971/* {USB_DEVICE(0x0c45, 0x614c), BS(SN9C120, GC0306)}, */ /*sn9c120b*/
2975 {} 2972 {}
2976}; 2973};
2977MODULE_DEVICE_TABLE(usb, device_table); 2974MODULE_DEVICE_TABLE(usb, device_table);
@@ -3007,3 +3004,7 @@ static void __exit sd_mod_exit(void)
3007 3004
3008module_init(sd_mod_init); 3005module_init(sd_mod_init);
3009module_exit(sd_mod_exit); 3006module_exit(sd_mod_exit);
3007
3008module_param(starcam, int, 0644);
3009MODULE_PARM_DESC(starcam,
3010 "StarCam model. 0: Clip, 1: 370i");
diff --git a/drivers/media/video/gspca/spca1528.c b/drivers/media/video/gspca/spca1528.c
index e6433866441..76c006b2bc8 100644
--- a/drivers/media/video/gspca/spca1528.c
+++ b/drivers/media/video/gspca/spca1528.c
@@ -555,7 +555,7 @@ static const struct sd_desc sd_desc = {
555}; 555};
556 556
557/* -- module initialisation -- */ 557/* -- module initialisation -- */
558static const __devinitdata struct usb_device_id device_table[] = { 558static const struct usb_device_id device_table[] = {
559 {USB_DEVICE(0x04fc, 0x1528)}, 559 {USB_DEVICE(0x04fc, 0x1528)},
560 {} 560 {}
561}; 561};
diff --git a/drivers/media/video/gspca/spca500.c b/drivers/media/video/gspca/spca500.c
index 8e202b9039f..45552c3ff8d 100644
--- a/drivers/media/video/gspca/spca500.c
+++ b/drivers/media/video/gspca/spca500.c
@@ -1051,7 +1051,7 @@ static const struct sd_desc sd_desc = {
1051}; 1051};
1052 1052
1053/* -- module initialisation -- */ 1053/* -- module initialisation -- */
1054static const __devinitdata struct usb_device_id device_table[] = { 1054static const struct usb_device_id device_table[] = {
1055 {USB_DEVICE(0x040a, 0x0300), .driver_info = KodakEZ200}, 1055 {USB_DEVICE(0x040a, 0x0300), .driver_info = KodakEZ200},
1056 {USB_DEVICE(0x041e, 0x400a), .driver_info = CreativePCCam300}, 1056 {USB_DEVICE(0x041e, 0x400a), .driver_info = CreativePCCam300},
1057 {USB_DEVICE(0x046d, 0x0890), .driver_info = LogitechTraveler}, 1057 {USB_DEVICE(0x046d, 0x0890), .driver_info = LogitechTraveler},
diff --git a/drivers/media/video/gspca/spca501.c b/drivers/media/video/gspca/spca501.c
index 642839a11e8..f7ef282cc60 100644
--- a/drivers/media/video/gspca/spca501.c
+++ b/drivers/media/video/gspca/spca501.c
@@ -2155,7 +2155,7 @@ static const struct sd_desc sd_desc = {
2155}; 2155};
2156 2156
2157/* -- module initialisation -- */ 2157/* -- module initialisation -- */
2158static const __devinitdata struct usb_device_id device_table[] = { 2158static const struct usb_device_id device_table[] = {
2159 {USB_DEVICE(0x040a, 0x0002), .driver_info = KodakDVC325}, 2159 {USB_DEVICE(0x040a, 0x0002), .driver_info = KodakDVC325},
2160 {USB_DEVICE(0x0497, 0xc001), .driver_info = SmileIntlCamera}, 2160 {USB_DEVICE(0x0497, 0xc001), .driver_info = SmileIntlCamera},
2161 {USB_DEVICE(0x0506, 0x00df), .driver_info = ThreeComHomeConnectLite}, 2161 {USB_DEVICE(0x0506, 0x00df), .driver_info = ThreeComHomeConnectLite},
diff --git a/drivers/media/video/gspca/spca505.c b/drivers/media/video/gspca/spca505.c
index bc9dd9034ab..e5bf865147d 100644
--- a/drivers/media/video/gspca/spca505.c
+++ b/drivers/media/video/gspca/spca505.c
@@ -786,7 +786,7 @@ static const struct sd_desc sd_desc = {
786}; 786};
787 787
788/* -- module initialisation -- */ 788/* -- module initialisation -- */
789static const __devinitdata struct usb_device_id device_table[] = { 789static const struct usb_device_id device_table[] = {
790 {USB_DEVICE(0x041e, 0x401d), .driver_info = Nxultra}, 790 {USB_DEVICE(0x041e, 0x401d), .driver_info = Nxultra},
791 {USB_DEVICE(0x0733, 0x0430), .driver_info = IntelPCCameraPro}, 791 {USB_DEVICE(0x0733, 0x0430), .driver_info = IntelPCCameraPro},
792/*fixme: may be UsbGrabberPV321 BRIDGE_SPCA506 SENSOR_SAA7113 */ 792/*fixme: may be UsbGrabberPV321 BRIDGE_SPCA506 SENSOR_SAA7113 */
diff --git a/drivers/media/video/gspca/spca508.c b/drivers/media/video/gspca/spca508.c
index 7307638ac91..34831937152 100644
--- a/drivers/media/video/gspca/spca508.c
+++ b/drivers/media/video/gspca/spca508.c
@@ -1509,7 +1509,7 @@ static const struct sd_desc sd_desc = {
1509}; 1509};
1510 1510
1511/* -- module initialisation -- */ 1511/* -- module initialisation -- */
1512static const __devinitdata struct usb_device_id device_table[] = { 1512static const struct usb_device_id device_table[] = {
1513 {USB_DEVICE(0x0130, 0x0130), .driver_info = HamaUSBSightcam}, 1513 {USB_DEVICE(0x0130, 0x0130), .driver_info = HamaUSBSightcam},
1514 {USB_DEVICE(0x041e, 0x4018), .driver_info = CreativeVista}, 1514 {USB_DEVICE(0x041e, 0x4018), .driver_info = CreativeVista},
1515 {USB_DEVICE(0x0733, 0x0110), .driver_info = ViewQuestVQ110}, 1515 {USB_DEVICE(0x0733, 0x0110), .driver_info = ViewQuestVQ110},
diff --git a/drivers/media/video/gspca/spca561.c b/drivers/media/video/gspca/spca561.c
index 3a162c6d546..e836e778dfb 100644
--- a/drivers/media/video/gspca/spca561.c
+++ b/drivers/media/video/gspca/spca561.c
@@ -1061,7 +1061,7 @@ static const struct sd_desc *sd_desc[2] = {
1061}; 1061};
1062 1062
1063/* -- module initialisation -- */ 1063/* -- module initialisation -- */
1064static const __devinitdata struct usb_device_id device_table[] = { 1064static const struct usb_device_id device_table[] = {
1065 {USB_DEVICE(0x041e, 0x401a), .driver_info = Rev072A}, 1065 {USB_DEVICE(0x041e, 0x401a), .driver_info = Rev072A},
1066 {USB_DEVICE(0x041e, 0x403b), .driver_info = Rev012A}, 1066 {USB_DEVICE(0x041e, 0x403b), .driver_info = Rev012A},
1067 {USB_DEVICE(0x0458, 0x7004), .driver_info = Rev072A}, 1067 {USB_DEVICE(0x0458, 0x7004), .driver_info = Rev072A},
diff --git a/drivers/media/video/gspca/sq905.c b/drivers/media/video/gspca/sq905.c
index 40406774577..2e9c0617519 100644
--- a/drivers/media/video/gspca/sq905.c
+++ b/drivers/media/video/gspca/sq905.c
@@ -396,7 +396,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
396} 396}
397 397
398/* Table of supported USB devices */ 398/* Table of supported USB devices */
399static const __devinitdata struct usb_device_id device_table[] = { 399static const struct usb_device_id device_table[] = {
400 {USB_DEVICE(0x2770, 0x9120)}, 400 {USB_DEVICE(0x2770, 0x9120)},
401 {} 401 {}
402}; 402};
diff --git a/drivers/media/video/gspca/sq905c.c b/drivers/media/video/gspca/sq905c.c
index 8ba19954385..457563b7a71 100644
--- a/drivers/media/video/gspca/sq905c.c
+++ b/drivers/media/video/gspca/sq905c.c
@@ -298,7 +298,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
298} 298}
299 299
300/* Table of supported USB devices */ 300/* Table of supported USB devices */
301static const __devinitdata struct usb_device_id device_table[] = { 301static const struct usb_device_id device_table[] = {
302 {USB_DEVICE(0x2770, 0x905c)}, 302 {USB_DEVICE(0x2770, 0x905c)},
303 {USB_DEVICE(0x2770, 0x9050)}, 303 {USB_DEVICE(0x2770, 0x9050)},
304 {USB_DEVICE(0x2770, 0x9051)}, 304 {USB_DEVICE(0x2770, 0x9051)},
diff --git a/drivers/media/video/gspca/sq930x.c b/drivers/media/video/gspca/sq930x.c
index a4a98811b9e..8215d5dcd45 100644
--- a/drivers/media/video/gspca/sq930x.c
+++ b/drivers/media/video/gspca/sq930x.c
@@ -1163,7 +1163,7 @@ static const struct sd_desc sd_desc = {
1163#define ST(sensor, type) \ 1163#define ST(sensor, type) \
1164 .driver_info = (SENSOR_ ## sensor << 8) \ 1164 .driver_info = (SENSOR_ ## sensor << 8) \
1165 | (type) 1165 | (type)
1166static const __devinitdata struct usb_device_id device_table[] = { 1166static const struct usb_device_id device_table[] = {
1167 {USB_DEVICE(0x041e, 0x4038), ST(MI0360, 0)}, 1167 {USB_DEVICE(0x041e, 0x4038), ST(MI0360, 0)},
1168 {USB_DEVICE(0x041e, 0x403c), ST(LZ24BP, 0)}, 1168 {USB_DEVICE(0x041e, 0x403c), ST(LZ24BP, 0)},
1169 {USB_DEVICE(0x041e, 0x403d), ST(LZ24BP, 0)}, 1169 {USB_DEVICE(0x041e, 0x403d), ST(LZ24BP, 0)},
diff --git a/drivers/media/video/gspca/stk014.c b/drivers/media/video/gspca/stk014.c
index 11a192b95ed..87be52b5e1e 100644
--- a/drivers/media/video/gspca/stk014.c
+++ b/drivers/media/video/gspca/stk014.c
@@ -495,7 +495,7 @@ static const struct sd_desc sd_desc = {
495}; 495};
496 496
497/* -- module initialisation -- */ 497/* -- module initialisation -- */
498static const __devinitdata struct usb_device_id device_table[] = { 498static const struct usb_device_id device_table[] = {
499 {USB_DEVICE(0x05e1, 0x0893)}, 499 {USB_DEVICE(0x05e1, 0x0893)},
500 {} 500 {}
501}; 501};
diff --git a/drivers/media/video/gspca/stv0680.c b/drivers/media/video/gspca/stv0680.c
index b199ad4666b..e2ef41cf72d 100644
--- a/drivers/media/video/gspca/stv0680.c
+++ b/drivers/media/video/gspca/stv0680.c
@@ -327,7 +327,7 @@ static const struct sd_desc sd_desc = {
327}; 327};
328 328
329/* -- module initialisation -- */ 329/* -- module initialisation -- */
330static const __devinitdata struct usb_device_id device_table[] = { 330static const struct usb_device_id device_table[] = {
331 {USB_DEVICE(0x0553, 0x0202)}, 331 {USB_DEVICE(0x0553, 0x0202)},
332 {USB_DEVICE(0x041e, 0x4007)}, 332 {USB_DEVICE(0x041e, 0x4007)},
333 {} 333 {}
diff --git a/drivers/media/video/gspca/stv06xx/stv06xx.c b/drivers/media/video/gspca/stv06xx/stv06xx.c
index 28ea4175b80..7e066142929 100644
--- a/drivers/media/video/gspca/stv06xx/stv06xx.c
+++ b/drivers/media/video/gspca/stv06xx/stv06xx.c
@@ -564,7 +564,7 @@ static int stv06xx_config(struct gspca_dev *gspca_dev,
564 564
565 565
566/* -- module initialisation -- */ 566/* -- module initialisation -- */
567static const __devinitdata struct usb_device_id device_table[] = { 567static const struct usb_device_id device_table[] = {
568 /* QuickCam Express */ 568 /* QuickCam Express */
569 {USB_DEVICE(0x046d, 0x0840), .driver_info = BRIDGE_STV600 }, 569 {USB_DEVICE(0x046d, 0x0840), .driver_info = BRIDGE_STV600 },
570 /* LEGO cam / QuickCam Web */ 570 /* LEGO cam / QuickCam Web */
diff --git a/drivers/media/video/gspca/sunplus.c b/drivers/media/video/gspca/sunplus.c
index a9cbcd6011d..543542af272 100644
--- a/drivers/media/video/gspca/sunplus.c
+++ b/drivers/media/video/gspca/sunplus.c
@@ -1162,7 +1162,7 @@ static const struct sd_desc sd_desc = {
1162#define BS(bridge, subtype) \ 1162#define BS(bridge, subtype) \
1163 .driver_info = (BRIDGE_ ## bridge << 8) \ 1163 .driver_info = (BRIDGE_ ## bridge << 8) \
1164 | (subtype) 1164 | (subtype)
1165static const __devinitdata struct usb_device_id device_table[] = { 1165static const struct usb_device_id device_table[] = {
1166 {USB_DEVICE(0x041e, 0x400b), BS(SPCA504C, 0)}, 1166 {USB_DEVICE(0x041e, 0x400b), BS(SPCA504C, 0)},
1167 {USB_DEVICE(0x041e, 0x4012), BS(SPCA504C, 0)}, 1167 {USB_DEVICE(0x041e, 0x4012), BS(SPCA504C, 0)},
1168 {USB_DEVICE(0x041e, 0x4013), BS(SPCA504C, 0)}, 1168 {USB_DEVICE(0x041e, 0x4013), BS(SPCA504C, 0)},
diff --git a/drivers/media/video/gspca/t613.c b/drivers/media/video/gspca/t613.c
index 8f0c33116e0..a3eccd81576 100644
--- a/drivers/media/video/gspca/t613.c
+++ b/drivers/media/video/gspca/t613.c
@@ -1416,7 +1416,7 @@ static const struct sd_desc sd_desc = {
1416}; 1416};
1417 1417
1418/* -- module initialisation -- */ 1418/* -- module initialisation -- */
1419static const __devinitdata struct usb_device_id device_table[] = { 1419static const struct usb_device_id device_table[] = {
1420 {USB_DEVICE(0x17a1, 0x0128)}, 1420 {USB_DEVICE(0x17a1, 0x0128)},
1421 {} 1421 {}
1422}; 1422};
diff --git a/drivers/media/video/gspca/tv8532.c b/drivers/media/video/gspca/tv8532.c
index 38c22f0a426..933ef2ca658 100644
--- a/drivers/media/video/gspca/tv8532.c
+++ b/drivers/media/video/gspca/tv8532.c
@@ -388,7 +388,7 @@ static const struct sd_desc sd_desc = {
388}; 388};
389 389
390/* -- module initialisation -- */ 390/* -- module initialisation -- */
391static const __devinitdata struct usb_device_id device_table[] = { 391static const struct usb_device_id device_table[] = {
392 {USB_DEVICE(0x046d, 0x0920)}, 392 {USB_DEVICE(0x046d, 0x0920)},
393 {USB_DEVICE(0x046d, 0x0921)}, 393 {USB_DEVICE(0x046d, 0x0921)},
394 {USB_DEVICE(0x0545, 0x808b)}, 394 {USB_DEVICE(0x0545, 0x808b)},
diff --git a/drivers/media/video/gspca/vc032x.c b/drivers/media/video/gspca/vc032x.c
index 9b2ae1b6cc7..6caed734a06 100644
--- a/drivers/media/video/gspca/vc032x.c
+++ b/drivers/media/video/gspca/vc032x.c
@@ -4192,7 +4192,7 @@ static const struct sd_desc sd_desc = {
4192#define BF(bridge, flags) \ 4192#define BF(bridge, flags) \
4193 .driver_info = (BRIDGE_ ## bridge << 8) \ 4193 .driver_info = (BRIDGE_ ## bridge << 8) \
4194 | (flags) 4194 | (flags)
4195static const __devinitdata struct usb_device_id device_table[] = { 4195static const struct usb_device_id device_table[] = {
4196 {USB_DEVICE(0x041e, 0x405b), BF(VC0323, FL_VFLIP)}, 4196 {USB_DEVICE(0x041e, 0x405b), BF(VC0323, FL_VFLIP)},
4197 {USB_DEVICE(0x046d, 0x0892), BF(VC0321, 0)}, 4197 {USB_DEVICE(0x046d, 0x0892), BF(VC0321, 0)},
4198 {USB_DEVICE(0x046d, 0x0896), BF(VC0321, 0)}, 4198 {USB_DEVICE(0x046d, 0x0896), BF(VC0321, 0)},
diff --git a/drivers/media/video/gspca/xirlink_cit.c b/drivers/media/video/gspca/xirlink_cit.c
index 5b5039a0203..c089a0f6f1d 100644
--- a/drivers/media/video/gspca/xirlink_cit.c
+++ b/drivers/media/video/gspca/xirlink_cit.c
@@ -3270,7 +3270,7 @@ static const struct sd_desc sd_desc_isoc_nego = {
3270}; 3270};
3271 3271
3272/* -- module initialisation -- */ 3272/* -- module initialisation -- */
3273static const __devinitdata struct usb_device_id device_table[] = { 3273static const struct usb_device_id device_table[] = {
3274 { USB_DEVICE_VER(0x0545, 0x8080, 0x0001, 0x0001), .driver_info = CIT_MODEL0 }, 3274 { USB_DEVICE_VER(0x0545, 0x8080, 0x0001, 0x0001), .driver_info = CIT_MODEL0 },
3275 { USB_DEVICE_VER(0x0545, 0x8080, 0x0002, 0x0002), .driver_info = CIT_MODEL1 }, 3275 { USB_DEVICE_VER(0x0545, 0x8080, 0x0002, 0x0002), .driver_info = CIT_MODEL1 },
3276 { USB_DEVICE_VER(0x0545, 0x8080, 0x030a, 0x030a), .driver_info = CIT_MODEL2 }, 3276 { USB_DEVICE_VER(0x0545, 0x8080, 0x030a, 0x030a), .driver_info = CIT_MODEL2 },
diff --git a/drivers/media/video/gspca/zc3xx.c b/drivers/media/video/gspca/zc3xx.c
index 14b85d48316..865216e9362 100644
--- a/drivers/media/video/gspca/zc3xx.c
+++ b/drivers/media/video/gspca/zc3xx.c
@@ -6909,7 +6909,7 @@ static const struct sd_desc sd_desc = {
6909#endif 6909#endif
6910}; 6910};
6911 6911
6912static const __devinitdata struct usb_device_id device_table[] = { 6912static const struct usb_device_id device_table[] = {
6913 {USB_DEVICE(0x041e, 0x041e)}, 6913 {USB_DEVICE(0x041e, 0x041e)},
6914 {USB_DEVICE(0x041e, 0x4017)}, 6914 {USB_DEVICE(0x041e, 0x4017)},
6915 {USB_DEVICE(0x041e, 0x401c), .driver_info = SENSOR_PAS106}, 6915 {USB_DEVICE(0x041e, 0x401c), .driver_info = SENSOR_PAS106},