aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-07-28 17:32:00 -0400
committerIngo Molnar <mingo@elte.hu>2008-07-28 17:32:00 -0400
commit9e3ee1c39c0cc71222f9980ccbf87fe072897eef (patch)
tree99462000e6f0d4f907cb2fc690f19d4d441ba0f3 /drivers/media/video/gspca
parente56b3bc7942982ac2589c942fb345e38bc7a341a (diff)
parentf934fb19ef34730263e6afc01e8ec27a8a71470f (diff)
Merge branch 'linus' into cpus4096
Conflicts: kernel/stop_machine.c Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'drivers/media/video/gspca')
-rw-r--r--drivers/media/video/gspca/conex.c9
-rw-r--r--drivers/media/video/gspca/etoms.c30
-rw-r--r--drivers/media/video/gspca/gspca.c43
-rw-r--r--drivers/media/video/gspca/mars.c9
-rw-r--r--drivers/media/video/gspca/ov519.c33
-rw-r--r--drivers/media/video/gspca/pac207.c29
-rw-r--r--drivers/media/video/gspca/pac7311.c22
-rw-r--r--drivers/media/video/gspca/sonixb.c484
-rw-r--r--drivers/media/video/gspca/sonixj.c492
-rw-r--r--drivers/media/video/gspca/spca500.c139
-rw-r--r--drivers/media/video/gspca/spca501.c75
-rw-r--r--drivers/media/video/gspca/spca505.c140
-rw-r--r--drivers/media/video/gspca/spca506.c121
-rw-r--r--drivers/media/video/gspca/spca508.c164
-rw-r--r--drivers/media/video/gspca/spca561.c62
-rw-r--r--drivers/media/video/gspca/stk014.c9
-rw-r--r--drivers/media/video/gspca/sunplus.c355
-rw-r--r--drivers/media/video/gspca/t613.c26
-rw-r--r--drivers/media/video/gspca/tv8532.c17
-rw-r--r--drivers/media/video/gspca/vc032x.c44
-rw-r--r--drivers/media/video/gspca/zc3xx.c486
21 files changed, 847 insertions, 1942 deletions
diff --git a/drivers/media/video/gspca/conex.c b/drivers/media/video/gspca/conex.c
index 013d593b0c67..44b0bffeb20e 100644
--- a/drivers/media/video/gspca/conex.c
+++ b/drivers/media/video/gspca/conex.c
@@ -25,9 +25,6 @@
25#define CONEX_CAM 1 /* special JPEG header */ 25#define CONEX_CAM 1 /* special JPEG header */
26#include "jpeg.h" 26#include "jpeg.h"
27 27
28#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7)
29static const char version[] = "2.1.7";
30
31MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 28MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
32MODULE_DESCRIPTION("GSPCA USB Conexant Camera Driver"); 29MODULE_DESCRIPTION("GSPCA USB Conexant Camera Driver");
33MODULE_LICENSE("GPL"); 30MODULE_LICENSE("GPL");
@@ -818,7 +815,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
818 struct cam *cam; 815 struct cam *cam;
819 816
820 cam = &gspca_dev->cam; 817 cam = &gspca_dev->cam;
821 cam->dev_name = (char *) id->driver_info;
822 cam->epaddr = 0x01; 818 cam->epaddr = 0x01;
823 cam->cam_mode = vga_mode; 819 cam->cam_mode = vga_mode;
824 cam->nmodes = sizeof vga_mode / sizeof vga_mode[0]; 820 cam->nmodes = sizeof vga_mode / sizeof vga_mode[0];
@@ -1011,9 +1007,8 @@ static struct sd_desc sd_desc = {
1011}; 1007};
1012 1008
1013/* -- module initialisation -- */ 1009/* -- module initialisation -- */
1014#define DVNM(name) .driver_info = (kernel_ulong_t) name
1015static __devinitdata struct usb_device_id device_table[] = { 1010static __devinitdata struct usb_device_id device_table[] = {
1016 {USB_DEVICE(0x0572, 0x0041), DVNM("Creative Notebook cx11646")}, 1011 {USB_DEVICE(0x0572, 0x0041)},
1017 {} 1012 {}
1018}; 1013};
1019MODULE_DEVICE_TABLE(usb, device_table); 1014MODULE_DEVICE_TABLE(usb, device_table);
@@ -1038,7 +1033,7 @@ static int __init sd_mod_init(void)
1038{ 1033{
1039 if (usb_register(&sd_driver) < 0) 1034 if (usb_register(&sd_driver) < 0)
1040 return -1; 1035 return -1;
1041 PDEBUG(D_PROBE, "v%s registered", version); 1036 PDEBUG(D_PROBE, "registered");
1042 return 0; 1037 return 0;
1043} 1038}
1044static void __exit sd_mod_exit(void) 1039static void __exit sd_mod_exit(void)
diff --git a/drivers/media/video/gspca/etoms.c b/drivers/media/video/gspca/etoms.c
index 8ab4ea7201a9..c8c2f02fcf00 100644
--- a/drivers/media/video/gspca/etoms.c
+++ b/drivers/media/video/gspca/etoms.c
@@ -22,9 +22,6 @@
22 22
23#include "gspca.h" 23#include "gspca.h"
24 24
25#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7)
26static const char version[] = "2.1.7";
27
28MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 25MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
29MODULE_DESCRIPTION("Etoms USB Camera Driver"); 26MODULE_DESCRIPTION("Etoms USB Camera Driver");
30MODULE_LICENSE("GPL"); 27MODULE_LICENSE("GPL");
@@ -602,26 +599,10 @@ static int sd_config(struct gspca_dev *gspca_dev,
602{ 599{
603 struct sd *sd = (struct sd *) gspca_dev; 600 struct sd *sd = (struct sd *) gspca_dev;
604 struct cam *cam; 601 struct cam *cam;
605 __u16 vendor; 602
606 __u16 product;
607
608 vendor = id->idVendor;
609 product = id->idProduct;
610/* switch (vendor) { */
611/* case 0x102c: * Etoms */
612 switch (product) {
613 case 0x6151:
614 sd->sensor = SENSOR_PAS106; /* Etoms61x151 */
615 break;
616 case 0x6251:
617 sd->sensor = SENSOR_TAS5130CXX; /* Etoms61x251 */
618 break;
619/* } */
620/* break; */
621 }
622 cam = &gspca_dev->cam; 603 cam = &gspca_dev->cam;
623 cam->dev_name = (char *) id->driver_info;
624 cam->epaddr = 1; 604 cam->epaddr = 1;
605 sd->sensor = id->driver_info;
625 if (sd->sensor == SENSOR_PAS106) { 606 if (sd->sensor == SENSOR_PAS106) {
626 cam->cam_mode = sif_mode; 607 cam->cam_mode = sif_mode;
627 cam->nmodes = sizeof sif_mode / sizeof sif_mode[0]; 608 cam->nmodes = sizeof sif_mode / sizeof sif_mode[0];
@@ -911,12 +892,11 @@ static struct sd_desc sd_desc = {
911}; 892};
912 893
913/* -- module initialisation -- */ 894/* -- module initialisation -- */
914#define DVNM(name) .driver_info = (kernel_ulong_t) name
915static __devinitdata struct usb_device_id device_table[] = { 895static __devinitdata struct usb_device_id device_table[] = {
916#ifndef CONFIG_USB_ET61X251 896#ifndef CONFIG_USB_ET61X251
917 {USB_DEVICE(0x102c, 0x6151), DVNM("Qcam Sangha CIF")}, 897 {USB_DEVICE(0x102c, 0x6151), .driver_info = SENSOR_PAS106},
918#endif 898#endif
919 {USB_DEVICE(0x102c, 0x6251), DVNM("Qcam xxxxxx VGA")}, 899 {USB_DEVICE(0x102c, 0x6251), .driver_info = SENSOR_TAS5130CXX},
920 {} 900 {}
921}; 901};
922 902
@@ -942,7 +922,7 @@ static int __init sd_mod_init(void)
942{ 922{
943 if (usb_register(&sd_driver) < 0) 923 if (usb_register(&sd_driver) < 0)
944 return -1; 924 return -1;
945 PDEBUG(D_PROBE, "v%s registered", version); 925 PDEBUG(D_PROBE, "registered");
946 return 0; 926 return 0;
947} 927}
948 928
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c
index 16e367cec760..3a051c925ff6 100644
--- a/drivers/media/video/gspca/gspca.c
+++ b/drivers/media/video/gspca/gspca.c
@@ -32,6 +32,7 @@
32#include <asm/page.h> 32#include <asm/page.h>
33#include <linux/uaccess.h> 33#include <linux/uaccess.h>
34#include <linux/jiffies.h> 34#include <linux/jiffies.h>
35#include <media/v4l2-ioctl.h>
35 36
36#include "gspca.h" 37#include "gspca.h"
37 38
@@ -42,8 +43,7 @@ MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>");
42MODULE_DESCRIPTION("GSPCA USB Camera Driver"); 43MODULE_DESCRIPTION("GSPCA USB Camera Driver");
43MODULE_LICENSE("GPL"); 44MODULE_LICENSE("GPL");
44 45
45#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7) 46#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 2, 0)
46static const char version[] = "2.1.7";
47 47
48static int video_nr = -1; 48static int video_nr = -1;
49 49
@@ -209,6 +209,8 @@ struct gspca_frame *gspca_frame_add(struct gspca_dev *gspca_dev,
209 &frame->v4l2_buf.timestamp); 209 &frame->v4l2_buf.timestamp);
210 frame->v4l2_buf.sequence = ++gspca_dev->sequence; 210 frame->v4l2_buf.sequence = ++gspca_dev->sequence;
211 } else if (gspca_dev->last_packet_type == DISCARD_PACKET) { 211 } else if (gspca_dev->last_packet_type == DISCARD_PACKET) {
212 if (packet_type == LAST_PACKET)
213 gspca_dev->last_packet_type = packet_type;
212 return frame; 214 return frame;
213 } 215 }
214 216
@@ -399,7 +401,7 @@ static struct usb_host_endpoint *alt_isoc(struct usb_host_interface *alt,
399 * This routine may be called many times when the bandwidth is too small 401 * This routine may be called many times when the bandwidth is too small
400 * (the bandwidth is checked on urb submit). 402 * (the bandwidth is checked on urb submit).
401 */ 403 */
402struct usb_host_endpoint *get_isoc_ep(struct gspca_dev *gspca_dev) 404static struct usb_host_endpoint *get_isoc_ep(struct gspca_dev *gspca_dev)
403{ 405{
404 struct usb_interface *intf; 406 struct usb_interface *intf;
405 struct usb_host_endpoint *ep; 407 struct usb_host_endpoint *ep;
@@ -832,7 +834,16 @@ static int vidioc_querycap(struct file *file, void *priv,
832 834
833 memset(cap, 0, sizeof *cap); 835 memset(cap, 0, sizeof *cap);
834 strncpy(cap->driver, gspca_dev->sd_desc->name, sizeof cap->driver); 836 strncpy(cap->driver, gspca_dev->sd_desc->name, sizeof cap->driver);
835 strncpy(cap->card, gspca_dev->cam.dev_name, sizeof cap->card); 837/* strncpy(cap->card, gspca_dev->cam.dev_name, sizeof cap->card); */
838 if (gspca_dev->dev->product != NULL) {
839 strncpy(cap->card, gspca_dev->dev->product,
840 sizeof cap->card);
841 } else {
842 snprintf(cap->card, sizeof cap->card,
843 "USB Camera (%04x:%04x)",
844 le16_to_cpu(gspca_dev->dev->descriptor.idVendor),
845 le16_to_cpu(gspca_dev->dev->descriptor.idProduct));
846 }
836 strncpy(cap->bus_info, gspca_dev->dev->bus->bus_name, 847 strncpy(cap->bus_info, gspca_dev->dev->bus->bus_name,
837 sizeof cap->bus_info); 848 sizeof cap->bus_info);
838 cap->version = DRIVER_VERSION_NUMBER; 849 cap->version = DRIVER_VERSION_NUMBER;
@@ -1649,12 +1660,7 @@ static struct file_operations dev_fops = {
1649 .poll = dev_poll, 1660 .poll = dev_poll,
1650}; 1661};
1651 1662
1652static struct video_device gspca_template = { 1663static const struct v4l2_ioctl_ops dev_ioctl_ops = {
1653 .name = "gspca main driver",
1654 .type = VID_TYPE_CAPTURE,
1655 .fops = &dev_fops,
1656 .release = dev_release, /* mandatory */
1657 .minor = -1,
1658 .vidioc_querycap = vidioc_querycap, 1664 .vidioc_querycap = vidioc_querycap,
1659 .vidioc_dqbuf = vidioc_dqbuf, 1665 .vidioc_dqbuf = vidioc_dqbuf,
1660 .vidioc_qbuf = vidioc_qbuf, 1666 .vidioc_qbuf = vidioc_qbuf,
@@ -1683,6 +1689,14 @@ static struct video_device gspca_template = {
1683#endif 1689#endif
1684}; 1690};
1685 1691
1692static struct video_device gspca_template = {
1693 .name = "gspca main driver",
1694 .fops = &dev_fops,
1695 .ioctl_ops = &dev_ioctl_ops,
1696 .release = dev_release, /* mandatory */
1697 .minor = -1,
1698};
1699
1686/* 1700/*
1687 * probe and create a new gspca device 1701 * probe and create a new gspca device
1688 * 1702 *
@@ -1740,10 +1754,11 @@ int gspca_dev_probe(struct usb_interface *intf,
1740 1754
1741 /* init video stuff */ 1755 /* init video stuff */
1742 memcpy(&gspca_dev->vdev, &gspca_template, sizeof gspca_template); 1756 memcpy(&gspca_dev->vdev, &gspca_template, sizeof gspca_template);
1743 gspca_dev->vdev.dev = &dev->dev; 1757 gspca_dev->vdev.parent = &dev->dev;
1744 memcpy(&gspca_dev->fops, &dev_fops, sizeof gspca_dev->fops); 1758 memcpy(&gspca_dev->fops, &dev_fops, sizeof gspca_dev->fops);
1745 gspca_dev->vdev.fops = &gspca_dev->fops; 1759 gspca_dev->vdev.fops = &gspca_dev->fops;
1746 gspca_dev->fops.owner = module; /* module protection */ 1760 gspca_dev->fops.owner = module; /* module protection */
1761 gspca_dev->present = 1;
1747 ret = video_register_device(&gspca_dev->vdev, 1762 ret = video_register_device(&gspca_dev->vdev,
1748 VFL_TYPE_GRABBER, 1763 VFL_TYPE_GRABBER,
1749 video_nr); 1764 video_nr);
@@ -1752,7 +1767,6 @@ int gspca_dev_probe(struct usb_interface *intf,
1752 goto out; 1767 goto out;
1753 } 1768 }
1754 1769
1755 gspca_dev->present = 1;
1756 usb_set_intfdata(intf, gspca_dev); 1770 usb_set_intfdata(intf, gspca_dev);
1757 PDEBUG(D_PROBE, "probe ok"); 1771 PDEBUG(D_PROBE, "probe ok");
1758 return 0; 1772 return 0;
@@ -1885,7 +1899,10 @@ EXPORT_SYMBOL(gspca_auto_gain_n_exposure);
1885/* -- module insert / remove -- */ 1899/* -- module insert / remove -- */
1886static int __init gspca_init(void) 1900static int __init gspca_init(void)
1887{ 1901{
1888 info("main v%s registered", version); 1902 info("main v%d.%d.%d registered",
1903 (DRIVER_VERSION_NUMBER >> 16) & 0xff,
1904 (DRIVER_VERSION_NUMBER >> 8) & 0xff,
1905 DRIVER_VERSION_NUMBER & 0xff);
1889 return 0; 1906 return 0;
1890} 1907}
1891static void __exit gspca_exit(void) 1908static void __exit gspca_exit(void)
diff --git a/drivers/media/video/gspca/mars.c b/drivers/media/video/gspca/mars.c
index 88c2b02f380a..21c4ee56a10a 100644
--- a/drivers/media/video/gspca/mars.c
+++ b/drivers/media/video/gspca/mars.c
@@ -24,9 +24,6 @@
24#include "gspca.h" 24#include "gspca.h"
25#include "jpeg.h" 25#include "jpeg.h"
26 26
27#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7)
28static const char version[] = "2.1.7";
29
30MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 27MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
31MODULE_DESCRIPTION("GSPCA/Mars USB Camera Driver"); 28MODULE_DESCRIPTION("GSPCA/Mars USB Camera Driver");
32MODULE_LICENSE("GPL"); 29MODULE_LICENSE("GPL");
@@ -140,7 +137,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
140 struct cam *cam; 137 struct cam *cam;
141 138
142 cam = &gspca_dev->cam; 139 cam = &gspca_dev->cam;
143 cam->dev_name = (char *) id->driver_info;
144 cam->epaddr = 0x01; 140 cam->epaddr = 0x01;
145 cam->cam_mode = vga_mode; 141 cam->cam_mode = vga_mode;
146 cam->nmodes = sizeof vga_mode / sizeof vga_mode[0]; 142 cam->nmodes = sizeof vga_mode / sizeof vga_mode[0];
@@ -424,9 +420,8 @@ static const struct sd_desc sd_desc = {
424}; 420};
425 421
426/* -- module initialisation -- */ 422/* -- module initialisation -- */
427#define DVNM(name) .driver_info = (kernel_ulong_t) name
428static const __devinitdata struct usb_device_id device_table[] = { 423static const __devinitdata struct usb_device_id device_table[] = {
429 {USB_DEVICE(0x093a, 0x050f), DVNM("Mars-Semi Pc-Camera")}, 424 {USB_DEVICE(0x093a, 0x050f)},
430 {} 425 {}
431}; 426};
432MODULE_DEVICE_TABLE(usb, device_table); 427MODULE_DEVICE_TABLE(usb, device_table);
@@ -451,7 +446,7 @@ static int __init sd_mod_init(void)
451{ 446{
452 if (usb_register(&sd_driver) < 0) 447 if (usb_register(&sd_driver) < 0)
453 return -1; 448 return -1;
454 PDEBUG(D_PROBE, "v%s registered", version); 449 PDEBUG(D_PROBE, "registered");
455 return 0; 450 return 0;
456} 451}
457static void __exit sd_mod_exit(void) 452static void __exit sd_mod_exit(void)
diff --git a/drivers/media/video/gspca/ov519.c b/drivers/media/video/gspca/ov519.c
index 08d99c3b78e2..83139efc4629 100644
--- a/drivers/media/video/gspca/ov519.c
+++ b/drivers/media/video/gspca/ov519.c
@@ -24,9 +24,6 @@
24 24
25#include "gspca.h" 25#include "gspca.h"
26 26
27#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7)
28static const char version[] = "2.1.7";
29
30MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>"); 27MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>");
31MODULE_DESCRIPTION("OV519 USB Camera Driver"); 28MODULE_DESCRIPTION("OV519 USB Camera Driver");
32MODULE_LICENSE("GPL"); 29MODULE_LICENSE("GPL");
@@ -1375,7 +1372,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
1375 cam->cam_mode = sif_mode; 1372 cam->cam_mode = sif_mode;
1376 cam->nmodes = sizeof sif_mode / sizeof sif_mode[0]; 1373 cam->nmodes = sizeof sif_mode / sizeof sif_mode[0];
1377 } 1374 }
1378 cam->dev_name = (char *) id->driver_info;
1379 sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value; 1375 sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value;
1380 sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value; 1376 sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value;
1381 sd->colors = sd_ctrls[SD_COLOR].qctrl.default_value; 1377 sd->colors = sd_ctrls[SD_COLOR].qctrl.default_value;
@@ -2129,21 +2125,20 @@ static const struct sd_desc sd_desc = {
2129}; 2125};
2130 2126
2131/* -- module initialisation -- */ 2127/* -- module initialisation -- */
2132#define DVNM(name) .driver_info = (kernel_ulong_t) name
2133static const __devinitdata struct usb_device_id device_table[] = { 2128static const __devinitdata struct usb_device_id device_table[] = {
2134 {USB_DEVICE(0x041e, 0x4052), DVNM("Creative Live! VISTA IM")}, 2129 {USB_DEVICE(0x041e, 0x4052)},
2135 {USB_DEVICE(0x041e, 0x405f), DVNM("Creative Live! VISTA VF0330")}, 2130 {USB_DEVICE(0x041e, 0x405f)},
2136 {USB_DEVICE(0x041e, 0x4060), DVNM("Creative Live! VISTA VF0350")}, 2131 {USB_DEVICE(0x041e, 0x4060)},
2137 {USB_DEVICE(0x041e, 0x4061), DVNM("Creative Live! VISTA VF0400")}, 2132 {USB_DEVICE(0x041e, 0x4061)},
2138 {USB_DEVICE(0x041e, 0x4064), DVNM("Creative Live! VISTA VF0420")}, 2133 {USB_DEVICE(0x041e, 0x4064)},
2139 {USB_DEVICE(0x041e, 0x4068), DVNM("Creative Live! VISTA VF0470")}, 2134 {USB_DEVICE(0x041e, 0x4068)},
2140 {USB_DEVICE(0x045e, 0x028c), DVNM("Microsoft xbox cam")}, 2135 {USB_DEVICE(0x045e, 0x028c)},
2141 {USB_DEVICE(0x054c, 0x0154), DVNM("Sonny toy4")}, 2136 {USB_DEVICE(0x054c, 0x0154)},
2142 {USB_DEVICE(0x054c, 0x0155), DVNM("Sonny toy5")}, 2137 {USB_DEVICE(0x054c, 0x0155)},
2143 {USB_DEVICE(0x05a9, 0x0519), DVNM("OmniVision")}, 2138 {USB_DEVICE(0x05a9, 0x0519)},
2144 {USB_DEVICE(0x05a9, 0x0530), DVNM("OmniVision")}, 2139 {USB_DEVICE(0x05a9, 0x0530)},
2145 {USB_DEVICE(0x05a9, 0x4519), DVNM("OmniVision")}, 2140 {USB_DEVICE(0x05a9, 0x4519)},
2146 {USB_DEVICE(0x05a9, 0x8519), DVNM("OmniVision")}, 2141 {USB_DEVICE(0x05a9, 0x8519)},
2147 {} 2142 {}
2148}; 2143};
2149#undef DVNAME 2144#undef DVNAME
@@ -2169,7 +2164,7 @@ static int __init sd_mod_init(void)
2169{ 2164{
2170 if (usb_register(&sd_driver) < 0) 2165 if (usb_register(&sd_driver) < 0)
2171 return -1; 2166 return -1;
2172 PDEBUG(D_PROBE, "v%s registered", version); 2167 PDEBUG(D_PROBE, "registered");
2173 return 0; 2168 return 0;
2174} 2169}
2175static void __exit sd_mod_exit(void) 2170static void __exit sd_mod_exit(void)
diff --git a/drivers/media/video/gspca/pac207.c b/drivers/media/video/gspca/pac207.c
index fa7abc411090..7ef18d578811 100644
--- a/drivers/media/video/gspca/pac207.c
+++ b/drivers/media/video/gspca/pac207.c
@@ -27,9 +27,6 @@
27 27
28#include "gspca.h" 28#include "gspca.h"
29 29
30#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7)
31static const char version[] = "2.1.7";
32
33MODULE_AUTHOR("Hans de Goede <j.w.r.degoede@hhs.nl>"); 30MODULE_AUTHOR("Hans de Goede <j.w.r.degoede@hhs.nl>");
34MODULE_DESCRIPTION("Pixart PAC207"); 31MODULE_DESCRIPTION("Pixart PAC207");
35MODULE_LICENSE("GPL"); 32MODULE_LICENSE("GPL");
@@ -208,7 +205,7 @@ static int pac207_write_regs(struct gspca_dev *gspca_dev, u16 index,
208} 205}
209 206
210 207
211int pac207_write_reg(struct gspca_dev *gspca_dev, u16 index, u16 value) 208static int pac207_write_reg(struct gspca_dev *gspca_dev, u16 index, u16 value)
212{ 209{
213 struct usb_device *udev = gspca_dev->dev; 210 struct usb_device *udev = gspca_dev->dev;
214 int err; 211 int err;
@@ -223,8 +220,7 @@ int pac207_write_reg(struct gspca_dev *gspca_dev, u16 index, u16 value)
223 return err; 220 return err;
224} 221}
225 222
226 223static int pac207_read_reg(struct gspca_dev *gspca_dev, u16 index)
227int pac207_read_reg(struct gspca_dev *gspca_dev, u16 index)
228{ 224{
229 struct usb_device *udev = gspca_dev->dev; 225 struct usb_device *udev = gspca_dev->dev;
230 int res; 226 int res;
@@ -574,17 +570,16 @@ static const struct sd_desc sd_desc = {
574}; 570};
575 571
576/* -- module initialisation -- */ 572/* -- module initialisation -- */
577#define DVNM(name) .driver_info = (kernel_ulong_t) name
578static const __devinitdata struct usb_device_id device_table[] = { 573static const __devinitdata struct usb_device_id device_table[] = {
579 {USB_DEVICE(0x041e, 0x4028), DVNM("Creative Webcam Vista Plus")}, 574 {USB_DEVICE(0x041e, 0x4028)},
580 {USB_DEVICE(0x093a, 0x2460), DVNM("Q-Tec Webcam 100")}, 575 {USB_DEVICE(0x093a, 0x2460)},
581 {USB_DEVICE(0x093a, 0x2463), DVNM("Philips spc200nc pac207")}, 576 {USB_DEVICE(0x093a, 0x2463)},
582 {USB_DEVICE(0x093a, 0x2464), DVNM("Labtec Webcam 1200")}, 577 {USB_DEVICE(0x093a, 0x2464)},
583 {USB_DEVICE(0x093a, 0x2468), DVNM("PAC207")}, 578 {USB_DEVICE(0x093a, 0x2468)},
584 {USB_DEVICE(0x093a, 0x2470), DVNM("Genius GF112")}, 579 {USB_DEVICE(0x093a, 0x2470)},
585 {USB_DEVICE(0x093a, 0x2471), DVNM("Genius VideoCam GE111")}, 580 {USB_DEVICE(0x093a, 0x2471)},
586 {USB_DEVICE(0x093a, 0x2472), DVNM("Genius VideoCam GE110")}, 581 {USB_DEVICE(0x093a, 0x2472)},
587 {USB_DEVICE(0x2001, 0xf115), DVNM("D-Link DSB-C120")}, 582 {USB_DEVICE(0x2001, 0xf115)},
588 {} 583 {}
589}; 584};
590MODULE_DEVICE_TABLE(usb, device_table); 585MODULE_DEVICE_TABLE(usb, device_table);
@@ -609,7 +604,7 @@ static int __init sd_mod_init(void)
609{ 604{
610 if (usb_register(&sd_driver) < 0) 605 if (usb_register(&sd_driver) < 0)
611 return -1; 606 return -1;
612 PDEBUG(D_PROBE, "v%s registered", version); 607 PDEBUG(D_PROBE, "registered");
613 return 0; 608 return 0;
614} 609}
615static void __exit sd_mod_exit(void) 610static void __exit sd_mod_exit(void)
diff --git a/drivers/media/video/gspca/pac7311.c b/drivers/media/video/gspca/pac7311.c
index 5c052e31be4a..ea3d7021f401 100644
--- a/drivers/media/video/gspca/pac7311.c
+++ b/drivers/media/video/gspca/pac7311.c
@@ -23,9 +23,6 @@
23 23
24#include "gspca.h" 24#include "gspca.h"
25 25
26#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7)
27static const char version[] = "2.1.7";
28
29MODULE_AUTHOR("Thomas Kaiser thomas@kaiser-linux.li"); 26MODULE_AUTHOR("Thomas Kaiser thomas@kaiser-linux.li");
30MODULE_DESCRIPTION("Pixart PAC7311"); 27MODULE_DESCRIPTION("Pixart PAC7311");
31MODULE_LICENSE("GPL"); 28MODULE_LICENSE("GPL");
@@ -266,7 +263,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
266 reg_w(gspca_dev, 0x3e, 0x20); 263 reg_w(gspca_dev, 0x3e, 0x20);
267 264
268 cam = &gspca_dev->cam; 265 cam = &gspca_dev->cam;
269 cam->dev_name = (char *) id->driver_info;
270 cam->epaddr = 0x05; 266 cam->epaddr = 0x05;
271 cam->cam_mode = vga_mode; 267 cam->cam_mode = vga_mode;
272 cam->nmodes = ARRAY_SIZE(vga_mode); 268 cam->nmodes = ARRAY_SIZE(vga_mode);
@@ -713,16 +709,14 @@ static struct sd_desc sd_desc = {
713}; 709};
714 710
715/* -- module initialisation -- */ 711/* -- module initialisation -- */
716#define DVNM(name) .driver_info = (kernel_ulong_t) name
717static __devinitdata struct usb_device_id device_table[] = { 712static __devinitdata struct usb_device_id device_table[] = {
718 {USB_DEVICE(0x093a, 0x2600), DVNM("Typhoon")}, 713 {USB_DEVICE(0x093a, 0x2600)},
719 {USB_DEVICE(0x093a, 0x2601), DVNM("Philips SPC610NC")}, 714 {USB_DEVICE(0x093a, 0x2601)},
720 {USB_DEVICE(0x093a, 0x2603), DVNM("PAC7312")}, 715 {USB_DEVICE(0x093a, 0x2603)},
721 {USB_DEVICE(0x093a, 0x2608), DVNM("Trust WB-3300p")}, 716 {USB_DEVICE(0x093a, 0x2608)},
722 {USB_DEVICE(0x093a, 0x260e), DVNM("Gigaware VGA PC Camera")}, 717 {USB_DEVICE(0x093a, 0x260e)},
723 /* and also ', Trust WB-3350p, SIGMA cam 2350' */ 718 {USB_DEVICE(0x093a, 0x260f)},
724 {USB_DEVICE(0x093a, 0x260f), DVNM("SnakeCam")}, 719 {USB_DEVICE(0x093a, 0x2621)},
725 {USB_DEVICE(0x093a, 0x2621), DVNM("PAC731x")},
726 {} 720 {}
727}; 721};
728MODULE_DEVICE_TABLE(usb, device_table); 722MODULE_DEVICE_TABLE(usb, device_table);
@@ -747,7 +741,7 @@ static int __init sd_mod_init(void)
747{ 741{
748 if (usb_register(&sd_driver) < 0) 742 if (usb_register(&sd_driver) < 0)
749 return -1; 743 return -1;
750 PDEBUG(D_PROBE, "v%s registered", version); 744 PDEBUG(D_PROBE, "registered");
751 return 0; 745 return 0;
752} 746}
753static void __exit sd_mod_exit(void) 747static void __exit sd_mod_exit(void)
diff --git a/drivers/media/video/gspca/sonixb.c b/drivers/media/video/gspca/sonixb.c
index dbeebe8625c5..e18748c5a14d 100644
--- a/drivers/media/video/gspca/sonixb.c
+++ b/drivers/media/video/gspca/sonixb.c
@@ -24,9 +24,6 @@
24 24
25#include "gspca.h" 25#include "gspca.h"
26 26
27#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 8)
28static const char version[] = "2.1.8";
29
30MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 27MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
31MODULE_DESCRIPTION("GSPCA/SN9C102 USB Camera Driver"); 28MODULE_DESCRIPTION("GSPCA/SN9C102 USB Camera Driver");
32MODULE_LICENSE("GPL"); 29MODULE_LICENSE("GPL");
@@ -44,25 +41,29 @@ struct sd {
44 unsigned char brightness; 41 unsigned char brightness;
45 unsigned char autogain; 42 unsigned char autogain;
46 unsigned char autogain_ignore_frames; 43 unsigned char autogain_ignore_frames;
44 unsigned char frames_to_drop;
47 unsigned char freq; /* light freq filter setting */ 45 unsigned char freq; /* light freq filter setting */
48 unsigned char saturation;
49 unsigned char hue;
50 unsigned char contrast;
51 46
52 unsigned char fr_h_sz; /* size of frame header */ 47 unsigned char fr_h_sz; /* size of frame header */
53 char sensor; /* Type of image sensor chip */ 48 char sensor; /* Type of image sensor chip */
54#define SENSOR_HV7131R 0 49#define SENSOR_HV7131R 0
55#define SENSOR_OV6650 1 50#define SENSOR_OV6650 1
56#define SENSOR_OV7630 2 51#define SENSOR_OV7630 2
57#define SENSOR_OV7630_3 3 52#define SENSOR_PAS106 3
58#define SENSOR_PAS106 4 53#define SENSOR_PAS202 4
59#define SENSOR_PAS202 5 54#define SENSOR_TAS5110 5
60#define SENSOR_TAS5110 6 55#define SENSOR_TAS5130CXX 6
61#define SENSOR_TAS5130CXX 7
62 char sensor_has_gain; 56 char sensor_has_gain;
63 __u8 sensor_addr; 57 __u8 sensor_addr;
58 __u8 reg11;
64}; 59};
65 60
61/* flags used in the device id table */
62#define F_GAIN 0x01 /* has gain */
63#define F_AUTO 0x02 /* has autogain */
64#define F_SIF 0x04 /* sif or vga */
65#define F_H18 0x08 /* long (18 b) or short (12 b) frame header */
66
66#define COMP2 0x8f 67#define COMP2 0x8f
67#define COMP 0xc7 /* 0x87 //0x07 */ 68#define COMP 0xc7 /* 0x87 //0x07 */
68#define COMP1 0xc9 /* 0x89 //0x09 */ 69#define COMP1 0xc9 /* 0x89 //0x09 */
@@ -92,12 +93,6 @@ static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val);
92static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val); 93static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val);
93static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val); 94static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val);
94static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val); 95static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val);
95static int sd_setsaturation(struct gspca_dev *gspca_dev, __s32 val);
96static int sd_getsaturation(struct gspca_dev *gspca_dev, __s32 *val);
97static int sd_sethue(struct gspca_dev *gspca_dev, __s32 val);
98static int sd_gethue(struct gspca_dev *gspca_dev, __s32 *val);
99static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val);
100static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val);
101 96
102static struct ctrl sd_ctrls[] = { 97static struct ctrl sd_ctrls[] = {
103 { 98 {
@@ -174,48 +169,6 @@ static struct ctrl sd_ctrls[] = {
174 .set = sd_setfreq, 169 .set = sd_setfreq,
175 .get = sd_getfreq, 170 .get = sd_getfreq,
176 }, 171 },
177 {
178 {
179 .id = V4L2_CID_SATURATION,
180 .type = V4L2_CTRL_TYPE_INTEGER,
181 .name = "Saturation",
182 .minimum = 0,
183 .maximum = 255,
184 .step = 1,
185#define SATURATION_DEF 127
186 .default_value = SATURATION_DEF,
187 },
188 .set = sd_setsaturation,
189 .get = sd_getsaturation,
190 },
191 {
192 {
193 .id = V4L2_CID_HUE,
194 .type = V4L2_CTRL_TYPE_INTEGER,
195 .name = "Hue",
196 .minimum = 0,
197 .maximum = 255,
198 .step = 1,
199#define HUE_DEF 127
200 .default_value = HUE_DEF,
201 },
202 .set = sd_sethue,
203 .get = sd_gethue,
204 },
205 {
206 {
207 .id = V4L2_CID_CONTRAST,
208 .type = V4L2_CTRL_TYPE_INTEGER,
209 .name = "Contrast",
210 .minimum = 0,
211 .maximum = 255,
212 .step = 1,
213#define CONTRAST_DEF 127
214 .default_value = CONTRAST_DEF,
215 },
216 .set = sd_setcontrast,
217 .get = sd_getcontrast,
218 },
219}; 172};
220 173
221static struct v4l2_pix_format vga_mode[] = { 174static struct v4l2_pix_format vga_mode[] = {
@@ -248,8 +201,6 @@ static struct v4l2_pix_format sif_mode[] = {
248 .priv = 0}, 201 .priv = 0},
249}; 202};
250 203
251static const __u8 probe_ov7630[] = {0x08, 0x44};
252
253static const __u8 initHv7131[] = { 204static const __u8 initHv7131[] = {
254 0x46, 0x77, 0x00, 0x04, 0x00, 0x00, 0x00, 0x80, 0x11, 0x00, 0x00, 0x00, 205 0x46, 0x77, 0x00, 0x04, 0x00, 0x00, 0x00, 0x80, 0x11, 0x00, 0x00, 0x00,
255 0x00, 0x00, 206 0x00, 0x00,
@@ -321,7 +272,7 @@ static const __u8 initOv7630_3[] = {
321 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80, /* r21 .. r28 */ 272 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80, /* r21 .. r28 */
322 0x90, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0, 0xff /* r29 .. r30 */ 273 0x90, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0, 0xff /* r29 .. r30 */
323}; 274};
324static const __u8 ov7630_sensor_init_com[][8] = { 275static const __u8 ov7630_sensor_init[][8] = {
325 {0xa0, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10}, 276 {0xa0, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10},
326 {0xb0, 0x21, 0x01, 0x77, 0x3a, 0x00, 0x00, 0x10}, 277 {0xb0, 0x21, 0x01, 0x77, 0x3a, 0x00, 0x00, 0x10},
327/* {0xd0, 0x21, 0x12, 0x7c, 0x01, 0x80, 0x34, 0x10}, jfm */ 278/* {0xd0, 0x21, 0x12, 0x7c, 0x01, 0x80, 0x34, 0x10}, jfm */
@@ -342,17 +293,6 @@ static const __u8 ov7630_sensor_init_com[][8] = {
342 {0xa0, 0x21, 0x7d, 0xf7, 0x8e, 0x00, 0x30, 0x10}, 293 {0xa0, 0x21, 0x7d, 0xf7, 0x8e, 0x00, 0x30, 0x10},
343 {0xd0, 0x21, 0x17, 0x1c, 0xbd, 0x06, 0xf6, 0x10}, 294 {0xd0, 0x21, 0x17, 0x1c, 0xbd, 0x06, 0xf6, 0x10},
344}; 295};
345static const __u8 ov7630_sensor_init[][8] = {
346 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 200ms */
347 {0xa0, 0x21, 0x11, 0x01, 0xbd, 0x06, 0xf6, 0x10}, /* jfm */
348 {0xa0, 0x21, 0x10, 0x57, 0xbd, 0x06, 0xf6, 0x16},
349 {0xa0, 0x21, 0x76, 0x02, 0xbd, 0x06, 0xf6, 0x16},
350 {0xa0, 0x21, 0x00, 0x10, 0xbd, 0x06, 0xf6, 0x15}, /* gain */
351};
352static const __u8 ov7630_sensor_init_3[][8] = {
353 {0xa0, 0x21, 0x2a, 0xa0, 0x00, 0x00, 0x00, 0x10},
354 {0xa0, 0x21, 0x2a, 0x80, 0x00, 0x00, 0x00, 0x10},
355};
356 296
357static const __u8 initPas106[] = { 297static const __u8 initPas106[] = {
358 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x40, 0x00, 0x00, 0x00, 298 0x04, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x40, 0x00, 0x00, 0x00,
@@ -542,7 +482,6 @@ static void setbrightness(struct gspca_dev *gspca_dev)
542 482
543 switch (sd->sensor) { 483 switch (sd->sensor) {
544 case SENSOR_OV6650: 484 case SENSOR_OV6650:
545 case SENSOR_OV7630_3:
546 case SENSOR_OV7630: { 485 case SENSOR_OV7630: {
547 __u8 i2cOV[] = 486 __u8 i2cOV[] =
548 {0xa0, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x10}; 487 {0xa0, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x10};
@@ -635,7 +574,7 @@ static void setsensorgain(struct gspca_dev *gspca_dev)
635 case SENSOR_OV6650: 574 case SENSOR_OV6650:
636 gain >>= 1; 575 gain >>= 1;
637 /* fall thru */ 576 /* fall thru */
638 case SENSOR_OV7630_3: { 577 case SENSOR_OV7630: {
639 __u8 i2c[] = {0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10}; 578 __u8 i2c[] = {0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10};
640 579
641 i2c[1] = sd->sensor_addr; 580 i2c[1] = sd->sensor_addr;
@@ -690,7 +629,7 @@ static void setexposure(struct gspca_dev *gspca_dev)
690 break; 629 break;
691 } 630 }
692 case SENSOR_OV6650: 631 case SENSOR_OV6650:
693 case SENSOR_OV7630_3: { 632 case SENSOR_OV7630: {
694 /* The ov6650 / ov7630 have 2 registers which both influence 633 /* The ov6650 / ov7630 have 2 registers which both influence
695 exposure, register 11, whose low nibble sets the nr off fps 634 exposure, register 11, whose low nibble sets the nr off fps
696 according to: fps = 30 / (low_nibble + 1) 635 according to: fps = 30 / (low_nibble + 1)
@@ -705,16 +644,20 @@ static void setexposure(struct gspca_dev *gspca_dev)
705 The code maps our 0 - 510 ms exposure ctrl to these 2 644 The code maps our 0 - 510 ms exposure ctrl to these 2
706 registers, trying to keep fps as high as possible. 645 registers, trying to keep fps as high as possible.
707 */ 646 */
708 __u8 i2c[] = {0xb0, 0x00, 0x10, 0x00, 0xc0, 0x00, 0x00, 0x10}; 647 __u8 i2c[] = {0xb0, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10};
709 int reg10, reg11; 648 int reg10, reg11, reg10_max;
649
710 /* ov6645 datasheet says reg10_max is 9a, but that uses 650 /* ov6645 datasheet says reg10_max is 9a, but that uses
711 tline * 2 * reg10 as formula for calculating texpo, the 651 tline * 2 * reg10 as formula for calculating texpo, the
712 ov6650 probably uses the same formula as the 7730 which uses 652 ov6650 probably uses the same formula as the 7730 which uses
713 tline * 4 * reg10, which explains why the reg10max we've 653 tline * 4 * reg10, which explains why the reg10max we've
714 found experimentally for the ov6650 is exactly half that of 654 found experimentally for the ov6650 is exactly half that of
715 the ov6645. The ov7630 datasheet says the max is 0x41. */ 655 the ov6645. The ov7630 datasheet says the max is 0x41. */
716 const int reg10_max = (sd->sensor == SENSOR_OV6650) 656 if (sd->sensor == SENSOR_OV6650) {
717 ? 0x4d : 0x41; 657 reg10_max = 0x4d;
658 i2c[4] = 0xc0; /* OV6650 needs non default vsync pol */
659 } else
660 reg10_max = 0x41;
718 661
719 reg11 = (60 * sd->exposure + 999) / 1000; 662 reg11 = (60 * sd->exposure + 999) / 1000;
720 if (reg11 < 1) 663 if (reg11 < 1)
@@ -735,20 +678,23 @@ static void setexposure(struct gspca_dev *gspca_dev)
735 else if (reg10 > reg10_max) 678 else if (reg10 > reg10_max)
736 reg10 = reg10_max; 679 reg10 = reg10_max;
737 680
681 /* In 640x480, if the reg11 has less than 3, the image is
682 unstable (not enough bandwidth). */
683 if (gspca_dev->width == 640 && reg11 < 3)
684 reg11 = 3;
685
738 /* Write reg 10 and reg11 low nibble */ 686 /* Write reg 10 and reg11 low nibble */
739 i2c[1] = sd->sensor_addr; 687 i2c[1] = sd->sensor_addr;
740 i2c[3] = reg10; 688 i2c[3] = reg10;
741 i2c[4] |= reg11 - 1; 689 i2c[4] |= reg11 - 1;
742 if (sd->sensor == SENSOR_OV7630_3) { 690
743 __u8 reg76 = reg10 & 0x03; 691 /* If register 11 didn't change, don't change it */
744 __u8 i2c_reg76[] = {0xa0, 0x21, 0x76, 0x00, 692 if (sd->reg11 == reg11 )
745 0x00, 0x00, 0x00, 0x10}; 693 i2c[0] = 0xa0;
746 reg10 >>= 2; 694
747 i2c_reg76[3] = reg76; 695 if (i2c_w(gspca_dev, i2c) == 0)
748 if (i2c_w(gspca_dev, i2c_reg76) < 0) 696 sd->reg11 = reg11;
749 PDEBUG(D_ERR, "i2c error exposure"); 697 else
750 }
751 if (i2c_w(gspca_dev, i2c) < 0)
752 PDEBUG(D_ERR, "i2c error exposure"); 698 PDEBUG(D_ERR, "i2c error exposure");
753 break; 699 break;
754 } 700 }
@@ -761,11 +707,11 @@ static void setfreq(struct gspca_dev *gspca_dev)
761 707
762 switch (sd->sensor) { 708 switch (sd->sensor) {
763 case SENSOR_OV6650: 709 case SENSOR_OV6650:
764 case SENSOR_OV7630_3: { 710 case SENSOR_OV7630: {
765 /* Framerate adjust register for artificial light 50 hz flicker 711 /* Framerate adjust register for artificial light 50 hz flicker
766 compensation, identical to ov6630 0x2b register, see ov6630 712 compensation, for the ov6650 this is identical to ov6630
767 datasheet. 713 0x2b register, see ov6630 datasheet.
768 0x4f -> (30 fps -> 25 fps), 0x00 -> no adjustment */ 714 0x4f / 0x8a -> (30 fps -> 25 fps), 0x00 -> no adjustment */
769 __u8 i2c[] = {0xa0, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x10}; 715 __u8 i2c[] = {0xa0, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x10};
770 switch (sd->freq) { 716 switch (sd->freq) {
771 default: 717 default:
@@ -786,69 +732,6 @@ static void setfreq(struct gspca_dev *gspca_dev)
786 } 732 }
787} 733}
788 734
789static void setsaturation(struct gspca_dev *gspca_dev)
790{
791 struct sd *sd = (struct sd *) gspca_dev;
792
793 switch (sd->sensor) {
794/* case SENSOR_OV6650: */
795 case SENSOR_OV7630_3:
796 case SENSOR_OV7630: {
797 __u8 i2c[] = {0xa0, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x10};
798 i2c[1] = sd->sensor_addr;
799 i2c[3] = sd->saturation & 0xf0;
800 if (i2c_w(gspca_dev, i2c) < 0)
801 PDEBUG(D_ERR, "i2c error setsaturation");
802 else
803 PDEBUG(D_CONF, "saturation set to: %d",
804 (int)sd->saturation);
805 break;
806 }
807 }
808}
809
810static void sethue(struct gspca_dev *gspca_dev)
811{
812 struct sd *sd = (struct sd *) gspca_dev;
813
814 switch (sd->sensor) {
815/* case SENSOR_OV6650: */
816 case SENSOR_OV7630_3:
817 case SENSOR_OV7630: {
818 __u8 i2c[] = {0xa0, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x10};
819 i2c[1] = sd->sensor_addr;
820 i2c[3] = 0x20 | (sd->hue >> 3);
821 if (i2c_w(gspca_dev, i2c) < 0)
822 PDEBUG(D_ERR, "i2c error setsaturation");
823 else
824 PDEBUG(D_CONF, "hue set to: %d", (int)sd->hue);
825 break;
826 }
827 }
828}
829
830static void setcontrast(struct gspca_dev *gspca_dev)
831{
832 struct sd *sd = (struct sd *) gspca_dev;
833
834 switch (sd->sensor) {
835/* case SENSOR_OV6650: */
836 case SENSOR_OV7630_3:
837 case SENSOR_OV7630: {
838 __u8 i2c[] = {0xa0, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x10};
839 i2c[1] = sd->sensor_addr;
840 i2c[3] = 0x20 | (sd->contrast >> 3);
841 if (i2c_w(gspca_dev, i2c) < 0)
842 PDEBUG(D_ERR, "i2c error setcontrast");
843 else
844 PDEBUG(D_CONF, "contrast set to: %d",
845 (int)sd->contrast);
846 break;
847 }
848 }
849}
850
851
852static void do_autogain(struct gspca_dev *gspca_dev) 735static void do_autogain(struct gspca_dev *gspca_dev)
853{ 736{
854 struct sd *sd = (struct sd *) gspca_dev; 737 struct sd *sd = (struct sd *) gspca_dev;
@@ -874,88 +757,32 @@ static int sd_config(struct gspca_dev *gspca_dev,
874{ 757{
875 struct sd *sd = (struct sd *) gspca_dev; 758 struct sd *sd = (struct sd *) gspca_dev;
876 struct cam *cam; 759 struct cam *cam;
877 __u16 product;
878 int sif = 0; 760 int sif = 0;
879 761
880 /* nctrls depends upon the sensor, so we use a per cam copy */ 762 /* nctrls depends upon the sensor, so we use a per cam copy */
881 memcpy(&sd->sd_desc, gspca_dev->sd_desc, sizeof(struct sd_desc)); 763 memcpy(&sd->sd_desc, gspca_dev->sd_desc, sizeof(struct sd_desc));
882 gspca_dev->sd_desc = &sd->sd_desc; 764 gspca_dev->sd_desc = &sd->sd_desc;
883 765
884 sd->fr_h_sz = 12; /* default size of the frame header */ 766 /* copy the webcam info from the device id */
885 sd->sd_desc.nctrls = 2; /* default nb of ctrls */ 767 sd->sensor = (id->driver_info >> 24) & 0xff;
886 sd->autogain = AUTOGAIN_DEF; /* default is autogain active */ 768 if (id->driver_info & (F_GAIN << 16))
887 769 sd->sensor_has_gain = 1;
888 product = id->idProduct; 770 if (id->driver_info & (F_AUTO << 16))
889/* switch (id->idVendor) { */ 771 sd->sd_desc.dq_callback = do_autogain;
890/* case 0x0c45: * Sonix */ 772 if (id->driver_info & (F_SIF << 16))
891 switch (product) { 773 sif = 1;
892 case 0x6001: /* SN9C102 */ 774 if (id->driver_info & (F_H18 << 16))
893 case 0x6005: /* SN9C101 */ 775 sd->fr_h_sz = 18; /* size of frame header */
894 case 0x6007: /* SN9C101 */ 776 else
895 sd->sensor = SENSOR_TAS5110; 777 sd->fr_h_sz = 12;
896 sd->sensor_has_gain = 1; 778 sd->sd_desc.nctrls = (id->driver_info >> 8) & 0xff;
897 sd->sd_desc.nctrls = 4; 779 sd->sensor_addr = id->driver_info & 0xff;
898 sd->sd_desc.dq_callback = do_autogain;
899 sif = 1;
900 break;
901 case 0x6009: /* SN9C101 */
902 case 0x600d: /* SN9C101 */
903 case 0x6029: /* SN9C101 */
904 sd->sensor = SENSOR_PAS106;
905 sif = 1;
906 break;
907 case 0x6011: /* SN9C101 - SN9C101G */
908 sd->sensor = SENSOR_OV6650;
909 sd->sensor_has_gain = 1;
910 sd->sensor_addr = 0x60;
911 sd->sd_desc.nctrls = 5;
912 sd->sd_desc.dq_callback = do_autogain;
913 sif = 1;
914 break;
915 case 0x6019: /* SN9C101 */
916 case 0x602c: /* SN9C102 */
917 case 0x602e: /* SN9C102 */
918 sd->sensor = SENSOR_OV7630;
919 sd->sensor_addr = 0x21;
920 break;
921 case 0x60b0: /* SN9C103 */
922 sd->sensor = SENSOR_OV7630_3;
923 sd->sensor_addr = 0x21;
924 sd->fr_h_sz = 18; /* size of frame header */
925 sd->sensor_has_gain = 1;
926 sd->sd_desc.nctrls = 8;
927 sd->sd_desc.dq_callback = do_autogain;
928 sd->autogain = 0;
929 break;
930 case 0x6024: /* SN9C102 */
931 case 0x6025: /* SN9C102 */
932 sd->sensor = SENSOR_TAS5130CXX;
933 break;
934 case 0x6028: /* SN9C102 */
935 sd->sensor = SENSOR_PAS202;
936 break;
937 case 0x602d: /* SN9C102 */
938 sd->sensor = SENSOR_HV7131R;
939 break;
940 case 0x60af: /* SN9C103 */
941 sd->sensor = SENSOR_PAS202;
942 sd->fr_h_sz = 18; /* size of frame header (?) */
943 break;
944 }
945/* break; */
946/* } */
947 780
948 cam = &gspca_dev->cam; 781 cam = &gspca_dev->cam;
949 cam->dev_name = (char *) id->driver_info;
950 cam->epaddr = 0x01; 782 cam->epaddr = 0x01;
951 if (!sif) { 783 if (!sif) {
952 cam->cam_mode = vga_mode; 784 cam->cam_mode = vga_mode;
953 cam->nmodes = ARRAY_SIZE(vga_mode); 785 cam->nmodes = ARRAY_SIZE(vga_mode);
954 if (sd->sensor == SENSOR_OV7630_3) {
955 /* We only have 320x240 & 640x480 */
956 cam->cam_mode++;
957 cam->nmodes--;
958 }
959 } else { 786 } else {
960 cam->cam_mode = sif_mode; 787 cam->cam_mode = sif_mode;
961 cam->nmodes = ARRAY_SIZE(sif_mode); 788 cam->nmodes = ARRAY_SIZE(sif_mode);
@@ -963,12 +790,9 @@ static int sd_config(struct gspca_dev *gspca_dev,
963 sd->brightness = BRIGHTNESS_DEF; 790 sd->brightness = BRIGHTNESS_DEF;
964 sd->gain = GAIN_DEF; 791 sd->gain = GAIN_DEF;
965 sd->exposure = EXPOSURE_DEF; 792 sd->exposure = EXPOSURE_DEF;
793 sd->autogain = AUTOGAIN_DEF;
966 sd->freq = FREQ_DEF; 794 sd->freq = FREQ_DEF;
967 sd->contrast = CONTRAST_DEF; 795
968 sd->saturation = SATURATION_DEF;
969 sd->hue = HUE_DEF;
970 if (sd->sensor == SENSOR_OV7630_3) /* jfm: from win trace */
971 reg_w(gspca_dev, 0x01, probe_ov7630, sizeof probe_ov7630);
972 return 0; 796 return 0;
973} 797}
974 798
@@ -1002,9 +826,8 @@ static void pas106_i2cinit(struct gspca_dev *gspca_dev)
1002static void sd_start(struct gspca_dev *gspca_dev) 826static void sd_start(struct gspca_dev *gspca_dev)
1003{ 827{
1004 struct sd *sd = (struct sd *) gspca_dev; 828 struct sd *sd = (struct sd *) gspca_dev;
1005 int mode, l; 829 int mode, l = 0x1f;
1006 const __u8 *sn9c10x; 830 const __u8 *sn9c10x;
1007 __u8 reg01, reg17;
1008 __u8 reg17_19[3]; 831 __u8 reg17_19[3];
1009 832
1010 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv; 833 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
@@ -1022,13 +845,11 @@ static void sd_start(struct gspca_dev *gspca_dev)
1022 reg17_19[2] = 0x20; 845 reg17_19[2] = 0x20;
1023 break; 846 break;
1024 case SENSOR_OV7630: 847 case SENSOR_OV7630:
1025 sn9c10x = initOv7630; 848 if (sd->fr_h_sz == 18) { /* SN9C103 */
1026 reg17_19[0] = 0x68; 849 sn9c10x = initOv7630_3;
1027 reg17_19[1] = (mode << 4) | COMP2; 850 l = sizeof initOv7630_3;
1028 reg17_19[2] = MCK_INIT1; 851 } else
1029 break; 852 sn9c10x = initOv7630;
1030 case SENSOR_OV7630_3:
1031 sn9c10x = initOv7630_3;
1032 reg17_19[0] = 0x68; 853 reg17_19[0] = 0x68;
1033 reg17_19[1] = (mode << 4) | COMP2; 854 reg17_19[1] = (mode << 4) | COMP2;
1034 reg17_19[2] = MCK_INIT1; 855 reg17_19[2] = MCK_INIT1;
@@ -1059,30 +880,11 @@ static void sd_start(struct gspca_dev *gspca_dev)
1059 reg17_19[2] = mode ? 0x23 : 0x43; 880 reg17_19[2] = mode ? 0x23 : 0x43;
1060 break; 881 break;
1061 } 882 }
1062 switch (sd->sensor) {
1063 case SENSOR_OV7630:
1064 reg01 = 0x06;
1065 reg17 = 0x29;
1066 l = sizeof initOv7630;
1067 break;
1068 case SENSOR_OV7630_3:
1069 reg01 = 0x44;
1070 reg17 = 0x68;
1071 l = sizeof initOv7630_3;
1072 break;
1073 default:
1074 reg01 = sn9c10x[0];
1075 reg17 = sn9c10x[0x17 - 1];
1076 l = 0x1f;
1077 break;
1078 }
1079 883
1080 /* reg 0x01 bit 2 video transfert on */ 884 /* reg 0x01 bit 2 video transfert on */
1081 reg_w(gspca_dev, 0x01, &reg01, 1); 885 reg_w(gspca_dev, 0x01, &sn9c10x[0x01 - 1], 1);
1082 /* reg 0x17 SensorClk enable inv Clk 0x60 */ 886 /* reg 0x17 SensorClk enable inv Clk 0x60 */
1083 reg_w(gspca_dev, 0x17, &reg17, 1); 887 reg_w(gspca_dev, 0x17, &sn9c10x[0x17 - 1], 1);
1084/*fixme: for ov7630 102
1085 reg_w(gspca_dev, 0x01, {0x06, sn9c10x[1]}, 2); */
1086 /* Set the registers from the template */ 888 /* Set the registers from the template */
1087 reg_w_big(gspca_dev, 0x01, sn9c10x, l); 889 reg_w_big(gspca_dev, 0x01, sn9c10x, l);
1088 switch (sd->sensor) { 890 switch (sd->sensor) {
@@ -1095,17 +897,13 @@ static void sd_start(struct gspca_dev *gspca_dev)
1095 sizeof ov6650_sensor_init); 897 sizeof ov6650_sensor_init);
1096 break; 898 break;
1097 case SENSOR_OV7630: 899 case SENSOR_OV7630:
1098 i2c_w_vector(gspca_dev, ov7630_sensor_init_com,
1099 sizeof ov7630_sensor_init_com);
1100 msleep(200);
1101 i2c_w_vector(gspca_dev, ov7630_sensor_init, 900 i2c_w_vector(gspca_dev, ov7630_sensor_init,
1102 sizeof ov7630_sensor_init); 901 sizeof ov7630_sensor_init);
1103 break; 902 if (sd->fr_h_sz == 18) { /* SN9C103 */
1104 case SENSOR_OV7630_3: 903 const __u8 i2c[] = { 0xa0, 0x21, 0x13, 0x80, 0x00,
1105 i2c_w_vector(gspca_dev, ov7630_sensor_init_com, 904 0x00, 0x00, 0x10 };
1106 sizeof ov7630_sensor_init_com); 905 i2c_w(gspca_dev, i2c);
1107 msleep(200); 906 }
1108 i2c_w(gspca_dev, ov7630_sensor_init_3[mode]);
1109 break; 907 break;
1110 case SENSOR_PAS106: 908 case SENSOR_PAS106:
1111 pas106_i2cinit(gspca_dev); 909 pas106_i2cinit(gspca_dev);
@@ -1145,14 +943,14 @@ static void sd_start(struct gspca_dev *gspca_dev)
1145 reg_w(gspca_dev, 0x18, &reg17_19[1], 2); 943 reg_w(gspca_dev, 0x18, &reg17_19[1], 2);
1146 msleep(20); 944 msleep(20);
1147 945
946 sd->reg11 = -1;
947
1148 setgain(gspca_dev); 948 setgain(gspca_dev);
1149 setbrightness(gspca_dev); 949 setbrightness(gspca_dev);
1150 setexposure(gspca_dev); 950 setexposure(gspca_dev);
1151 setfreq(gspca_dev); 951 setfreq(gspca_dev);
1152 setsaturation(gspca_dev);
1153 sethue(gspca_dev);
1154 setcontrast(gspca_dev);
1155 952
953 sd->frames_to_drop = 0;
1156 sd->autogain_ignore_frames = 0; 954 sd->autogain_ignore_frames = 0;
1157 atomic_set(&sd->avg_lum, -1); 955 atomic_set(&sd->avg_lum, -1);
1158} 956}
@@ -1198,21 +996,31 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
1198 && data[3 + i] == 0xc4 996 && data[3 + i] == 0xc4
1199 && data[4 + i] == 0xc4 997 && data[4 + i] == 0xc4
1200 && data[5 + i] == 0x96) { /* start of frame */ 998 && data[5 + i] == 0x96) { /* start of frame */
1201 frame = gspca_frame_add(gspca_dev, LAST_PACKET, 999 int lum = -1;
1202 frame, data, 0); 1000 int pkt_type = LAST_PACKET;
1001
1203 if (len - i < sd->fr_h_sz) { 1002 if (len - i < sd->fr_h_sz) {
1204 atomic_set(&sd->avg_lum, -1);
1205 PDEBUG(D_STREAM, "packet too short to" 1003 PDEBUG(D_STREAM, "packet too short to"
1206 " get avg brightness"); 1004 " get avg brightness");
1207 } else if (sd->fr_h_sz == 12) { 1005 } else if (sd->fr_h_sz == 12) {
1208 atomic_set(&sd->avg_lum, 1006 lum = data[i + 8] + (data[i + 9] << 8);
1209 data[i + 8] +
1210 (data[i + 9] << 8));
1211 } else { 1007 } else {
1212 atomic_set(&sd->avg_lum, 1008 lum = data[i + 9] +
1213 data[i + 9] + 1009 (data[i + 10] << 8);
1214 (data[i + 10] << 8)); 1010 }
1011 if (lum == 0) {
1012 lum = -1;
1013 sd->frames_to_drop = 2;
1014 }
1015 atomic_set(&sd->avg_lum, lum);
1016
1017 if (sd->frames_to_drop) {
1018 sd->frames_to_drop--;
1019 pkt_type = DISCARD_PACKET;
1215 } 1020 }
1021
1022 frame = gspca_frame_add(gspca_dev, pkt_type,
1023 frame, data, 0);
1216 data += i + sd->fr_h_sz; 1024 data += i + sd->fr_h_sz;
1217 len -= i + sd->fr_h_sz; 1025 len -= i + sd->fr_h_sz;
1218 gspca_frame_add(gspca_dev, FIRST_PACKET, 1026 gspca_frame_add(gspca_dev, FIRST_PACKET,
@@ -1327,60 +1135,6 @@ static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val)
1327 return 0; 1135 return 0;
1328} 1136}
1329 1137
1330static int sd_setsaturation(struct gspca_dev *gspca_dev, __s32 val)
1331{
1332 struct sd *sd = (struct sd *) gspca_dev;
1333
1334 sd->saturation = val;
1335 if (gspca_dev->streaming)
1336 setsaturation(gspca_dev);
1337 return 0;
1338}
1339
1340static int sd_getsaturation(struct gspca_dev *gspca_dev, __s32 *val)
1341{
1342 struct sd *sd = (struct sd *) gspca_dev;
1343
1344 *val = sd->saturation;
1345 return 0;
1346}
1347
1348static int sd_sethue(struct gspca_dev *gspca_dev, __s32 val)
1349{
1350 struct sd *sd = (struct sd *) gspca_dev;
1351
1352 sd->hue = val;
1353 if (gspca_dev->streaming)
1354 sethue(gspca_dev);
1355 return 0;
1356}
1357
1358static int sd_gethue(struct gspca_dev *gspca_dev, __s32 *val)
1359{
1360 struct sd *sd = (struct sd *) gspca_dev;
1361
1362 *val = sd->hue;
1363 return 0;
1364}
1365
1366static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val)
1367{
1368 struct sd *sd = (struct sd *) gspca_dev;
1369
1370 sd->contrast = val;
1371 if (gspca_dev->streaming)
1372 setcontrast(gspca_dev);
1373 return 0;
1374}
1375
1376static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val)
1377{
1378 struct sd *sd = (struct sd *) gspca_dev;
1379
1380 *val = sd->contrast;
1381 return 0;
1382}
1383
1384static int sd_querymenu(struct gspca_dev *gspca_dev, 1138static int sd_querymenu(struct gspca_dev *gspca_dev,
1385 struct v4l2_querymenu *menu) 1139 struct v4l2_querymenu *menu)
1386{ 1140{
@@ -1418,27 +1172,47 @@ static const struct sd_desc sd_desc = {
1418}; 1172};
1419 1173
1420/* -- module initialisation -- */ 1174/* -- module initialisation -- */
1421#define DVNM(name) .driver_info = (kernel_ulong_t) name 1175#define SFCI(sensor, flags, nctrls, i2c_addr) \
1176 .driver_info = (SENSOR_ ## sensor << 24) \
1177 | ((flags) << 16) \
1178 | ((nctrls) << 8) \
1179 | (i2c_addr)
1422static __devinitdata struct usb_device_id device_table[] = { 1180static __devinitdata struct usb_device_id device_table[] = {
1423#ifndef CONFIG_USB_SN9C102 1181#ifndef CONFIG_USB_SN9C102
1424 {USB_DEVICE(0x0c45, 0x6001), DVNM("Genius VideoCAM NB")}, 1182 {USB_DEVICE(0x0c45, 0x6001), /* SN9C102 */
1425 {USB_DEVICE(0x0c45, 0x6005), DVNM("Sweex Tas5110")}, 1183 SFCI(TAS5110, F_GAIN|F_AUTO|F_SIF, 4, 0)},
1426 {USB_DEVICE(0x0c45, 0x6007), DVNM("Sonix sn9c101 + Tas5110D")}, 1184 {USB_DEVICE(0x0c45, 0x6005), /* SN9C101 */
1427 {USB_DEVICE(0x0c45, 0x6009), DVNM("spcaCam@120")}, 1185 SFCI(TAS5110, F_GAIN|F_AUTO|F_SIF, 4, 0)},
1428 {USB_DEVICE(0x0c45, 0x600d), DVNM("spcaCam@120")}, 1186 {USB_DEVICE(0x0c45, 0x6007), /* SN9C101 */
1187 SFCI(TAS5110, F_GAIN|F_AUTO|F_SIF, 4, 0)},
1188 {USB_DEVICE(0x0c45, 0x6009), /* SN9C101 */
1189 SFCI(PAS106, F_SIF, 2, 0)},
1190 {USB_DEVICE(0x0c45, 0x600d), /* SN9C101 */
1191 SFCI(PAS106, F_SIF, 2, 0)},
1429#endif 1192#endif
1430 {USB_DEVICE(0x0c45, 0x6011), DVNM("MAX Webcam Microdia")}, 1193 {USB_DEVICE(0x0c45, 0x6011), /* SN9C101 - SN9C101G */
1194 SFCI(OV6650, F_GAIN|F_AUTO|F_SIF, 5, 0x60)},
1431#ifndef CONFIG_USB_SN9C102 1195#ifndef CONFIG_USB_SN9C102
1432 {USB_DEVICE(0x0c45, 0x6019), DVNM("Generic Sonix OV7630")}, 1196 {USB_DEVICE(0x0c45, 0x6019), /* SN9C101 */
1433 {USB_DEVICE(0x0c45, 0x6024), DVNM("Generic Sonix Tas5130c")}, 1197 SFCI(OV7630, F_GAIN|F_AUTO, 5, 0x21)},
1434 {USB_DEVICE(0x0c45, 0x6025), DVNM("Xcam Shanga")}, 1198 {USB_DEVICE(0x0c45, 0x6024), /* SN9C102 */
1435 {USB_DEVICE(0x0c45, 0x6028), DVNM("Sonix Btc Pc380")}, 1199 SFCI(TAS5130CXX, 0, 2, 0)},
1436 {USB_DEVICE(0x0c45, 0x6029), DVNM("spcaCam@150")}, 1200 {USB_DEVICE(0x0c45, 0x6025), /* SN9C102 */
1437 {USB_DEVICE(0x0c45, 0x602c), DVNM("Generic Sonix OV7630")}, 1201 SFCI(TAS5130CXX, 0, 2, 0)},
1438 {USB_DEVICE(0x0c45, 0x602d), DVNM("LIC-200 LG")}, 1202 {USB_DEVICE(0x0c45, 0x6028), /* SN9C102 */
1439 {USB_DEVICE(0x0c45, 0x602e), DVNM("Genius VideoCam Messenger")}, 1203 SFCI(PAS202, 0, 2, 0)},
1440 {USB_DEVICE(0x0c45, 0x60af), DVNM("Trust WB3100P")}, 1204 {USB_DEVICE(0x0c45, 0x6029), /* SN9C101 */
1441 {USB_DEVICE(0x0c45, 0x60b0), DVNM("Genius VideoCam Look")}, 1205 SFCI(PAS106, F_SIF, 2, 0)},
1206 {USB_DEVICE(0x0c45, 0x602c), /* SN9C102 */
1207 SFCI(OV7630, F_GAIN|F_AUTO, 5, 0x21)},
1208 {USB_DEVICE(0x0c45, 0x602d), /* SN9C102 */
1209 SFCI(HV7131R, 0, 2, 0)},
1210 {USB_DEVICE(0x0c45, 0x602e), /* SN9C102 */
1211 SFCI(OV7630, F_GAIN|F_AUTO, 5, 0x21)},
1212 {USB_DEVICE(0x0c45, 0x60af), /* SN9C103 */
1213 SFCI(PAS202, F_H18, 2, 0)},
1214 {USB_DEVICE(0x0c45, 0x60b0), /* SN9C103 */
1215 SFCI(OV7630, F_GAIN|F_AUTO|F_H18, 5, 0x21)},
1442#endif 1216#endif
1443 {} 1217 {}
1444}; 1218};
@@ -1464,7 +1238,7 @@ static int __init sd_mod_init(void)
1464{ 1238{
1465 if (usb_register(&sd_driver) < 0) 1239 if (usb_register(&sd_driver) < 0)
1466 return -1; 1240 return -1;
1467 PDEBUG(D_PROBE, "v%s registered", version); 1241 PDEBUG(D_PROBE, "registered");
1468 return 0; 1242 return 0;
1469} 1243}
1470static void __exit sd_mod_exit(void) 1244static void __exit sd_mod_exit(void)
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c
index 3e68b9926956..33a3df1f6915 100644
--- a/drivers/media/video/gspca/sonixj.c
+++ b/drivers/media/video/gspca/sonixj.c
@@ -24,9 +24,6 @@
24#include "gspca.h" 24#include "gspca.h"
25#include "jpeg.h" 25#include "jpeg.h"
26 26
27#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7)
28static const char version[] = "2.1.7";
29
30MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 27MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
31MODULE_DESCRIPTION("GSPCA/SONIX JPEG USB Camera Driver"); 28MODULE_DESCRIPTION("GSPCA/SONIX JPEG USB Camera Driver");
32MODULE_LICENSE("GPL"); 29MODULE_LICENSE("GPL");
@@ -361,6 +358,7 @@ static const __u8 mo4000_sensor_init[][8] = {
361}; 358};
362static const __u8 ov7660_sensor_init[][8] = { 359static const __u8 ov7660_sensor_init[][8] = {
363 {0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10}, /* reset SCCB */ 360 {0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10}, /* reset SCCB */
361/* (delay 20ms) */
364 {0xa1, 0x21, 0x12, 0x05, 0x00, 0x00, 0x00, 0x10}, 362 {0xa1, 0x21, 0x12, 0x05, 0x00, 0x00, 0x00, 0x10},
365 /* Outformat ?? rawRGB */ 363 /* Outformat ?? rawRGB */
366 {0xa1, 0x21, 0x13, 0xb8, 0x00, 0x00, 0x00, 0x10}, /* init COM8 */ 364 {0xa1, 0x21, 0x13, 0xb8, 0x00, 0x00, 0x00, 0x10}, /* init COM8 */
@@ -539,13 +537,31 @@ static void reg_r(struct gspca_dev *gspca_dev,
539 value, 0, 537 value, 0,
540 gspca_dev->usb_buf, len, 538 gspca_dev->usb_buf, len,
541 500); 539 500);
540 PDEBUG(D_USBI, "reg_r [%02x] -> %02x", value, gspca_dev->usb_buf[0]);
542} 541}
543 542
543static void reg_w1(struct gspca_dev *gspca_dev,
544 __u16 value,
545 __u8 data)
546{
547 PDEBUG(D_USBO, "reg_w1 [%02x] = %02x", value, data);
548 gspca_dev->usb_buf[0] = data;
549 usb_control_msg(gspca_dev->dev,
550 usb_sndctrlpipe(gspca_dev->dev, 0),
551 0x08,
552 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
553 value,
554 0,
555 gspca_dev->usb_buf, 1,
556 500);
557}
544static void reg_w(struct gspca_dev *gspca_dev, 558static void reg_w(struct gspca_dev *gspca_dev,
545 __u16 value, 559 __u16 value,
546 const __u8 *buffer, 560 const __u8 *buffer,
547 int len) 561 int len)
548{ 562{
563 PDEBUG(D_USBO, "reg_w [%02x] = %02x %02x ..",
564 value, buffer[0], buffer[1]);
549 if (len <= sizeof gspca_dev->usb_buf) { 565 if (len <= sizeof gspca_dev->usb_buf) {
550 memcpy(gspca_dev->usb_buf, buffer, len); 566 memcpy(gspca_dev->usb_buf, buffer, len);
551 usb_control_msg(gspca_dev->dev, 567 usb_control_msg(gspca_dev->dev,
@@ -571,31 +587,42 @@ static void reg_w(struct gspca_dev *gspca_dev,
571 } 587 }
572} 588}
573 589
574/* I2C write 2 bytes */ 590/* I2C write 1 byte */
575static void i2c_w2(struct gspca_dev *gspca_dev, 591static void i2c_w1(struct gspca_dev *gspca_dev, __u8 reg, __u8 val)
576 const __u8 *buffer)
577{ 592{
578 struct sd *sd = (struct sd *) gspca_dev; 593 struct sd *sd = (struct sd *) gspca_dev;
579 __u8 mode[8];
580 594
581 /* is i2c ready */ 595 PDEBUG(D_USBO, "i2c_w2 [%02x] = %02x", reg, val);
582 mode[0] = 0x81 | (2 << 4); 596 gspca_dev->usb_buf[0] = 0x81 | (2 << 4); /* = a1 */
583 mode[1] = sd->i2c_base; 597 gspca_dev->usb_buf[1] = sd->i2c_base;
584 mode[2] = buffer[0]; 598 gspca_dev->usb_buf[2] = reg;
585 mode[3] = buffer[1]; 599 gspca_dev->usb_buf[3] = val;
586 mode[4] = 0; 600 gspca_dev->usb_buf[4] = 0;
587 mode[5] = 0; 601 gspca_dev->usb_buf[5] = 0;
588 mode[6] = 0; 602 gspca_dev->usb_buf[6] = 0;
589 mode[7] = 0x10; 603 gspca_dev->usb_buf[7] = 0x10;
590 reg_w(gspca_dev, 0x08, mode, 8); 604 usb_control_msg(gspca_dev->dev,
605 usb_sndctrlpipe(gspca_dev->dev, 0),
606 0x08,
607 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
608 0x08, /* value = i2c */
609 0,
610 gspca_dev->usb_buf, 8,
611 500);
591} 612}
592 613
593/* I2C write 8 bytes */ 614/* I2C write 8 bytes */
594static void i2c_w8(struct gspca_dev *gspca_dev, 615static void i2c_w8(struct gspca_dev *gspca_dev,
595 const __u8 *buffer) 616 const __u8 *buffer)
596{ 617{
597 reg_w(gspca_dev, 0x08, buffer, 8); 618 memcpy(gspca_dev->usb_buf, buffer, 8);
598 msleep(1); 619 usb_control_msg(gspca_dev->dev,
620 usb_sndctrlpipe(gspca_dev->dev, 0),
621 0x08,
622 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
623 0x08, 0, /* value, index */
624 gspca_dev->usb_buf, 8,
625 500);
599} 626}
600 627
601/* read 5 bytes in gspca_dev->usb_buf */ 628/* read 5 bytes in gspca_dev->usb_buf */
@@ -613,24 +640,21 @@ static void i2c_r5(struct gspca_dev *gspca_dev, __u8 reg)
613 mode[6] = 0; 640 mode[6] = 0;
614 mode[7] = 0x10; 641 mode[7] = 0x10;
615 i2c_w8(gspca_dev, mode); 642 i2c_w8(gspca_dev, mode);
643 msleep(2);
616 mode[0] = 0x81 | (5 << 4) | 0x02; 644 mode[0] = 0x81 | (5 << 4) | 0x02;
617 mode[2] = 0; 645 mode[2] = 0;
618 i2c_w8(gspca_dev, mode); 646 i2c_w8(gspca_dev, mode);
647 msleep(2);
619 reg_r(gspca_dev, 0x0a, 5); 648 reg_r(gspca_dev, 0x0a, 5);
620} 649}
621 650
622static int probesensor(struct gspca_dev *gspca_dev) 651static int probesensor(struct gspca_dev *gspca_dev)
623{ 652{
624 struct sd *sd = (struct sd *) gspca_dev; 653 struct sd *sd = (struct sd *) gspca_dev;
625 __u8 reg02;
626 static const __u8 datasend[] = { 2, 0 };
627 /* reg val1 val2 val3 val4 */
628 654
629 i2c_w2(gspca_dev, datasend); 655 i2c_w1(gspca_dev, 0x02, 0); /* sensor wakeup */
630/* should write 0xa1 0x11 0x02 0x00 0x00 0x00 0x00 the 0x10 is add by i2cw */
631 msleep(10); 656 msleep(10);
632 reg02 = 0x66; 657 reg_w1(gspca_dev, 0x02, 0x66); /* Gpio on */
633 reg_w(gspca_dev, 0x02, &reg02, 1); /* Gpio on */
634 msleep(10); 658 msleep(10);
635 i2c_r5(gspca_dev, 0); /* read sensor id */ 659 i2c_r5(gspca_dev, 0); /* read sensor id */
636 if (gspca_dev->usb_buf[0] == 0x02 660 if (gspca_dev->usb_buf[0] == 0x02
@@ -642,7 +666,7 @@ static int probesensor(struct gspca_dev *gspca_dev)
642 sd->sensor = SENSOR_HV7131R; 666 sd->sensor = SENSOR_HV7131R;
643 return SENSOR_HV7131R; 667 return SENSOR_HV7131R;
644 } 668 }
645 PDEBUG(D_PROBE, "Find Sensor %d %d %d", 669 PDEBUG(D_PROBE, "Find Sensor 0x%02x 0x%02x 0x%02x",
646 gspca_dev->usb_buf[0], gspca_dev->usb_buf[1], 670 gspca_dev->usb_buf[0], gspca_dev->usb_buf[1],
647 gspca_dev->usb_buf[2]); 671 gspca_dev->usb_buf[2]);
648 PDEBUG(D_PROBE, "Sensor sn9c102P Not found"); 672 PDEBUG(D_PROBE, "Sensor sn9c102P Not found");
@@ -653,8 +677,6 @@ static int configure_gpio(struct gspca_dev *gspca_dev,
653 const __u8 *sn9c1xx) 677 const __u8 *sn9c1xx)
654{ 678{
655 struct sd *sd = (struct sd *) gspca_dev; 679 struct sd *sd = (struct sd *) gspca_dev;
656 __u8 data;
657 __u8 regF1;
658 const __u8 *reg9a; 680 const __u8 *reg9a;
659 static const __u8 reg9a_def[] = 681 static const __u8 reg9a_def[] =
660 {0x08, 0x40, 0x20, 0x10, 0x00, 0x04}; 682 {0x08, 0x40, 0x20, 0x10, 0x00, 0x04};
@@ -663,15 +685,13 @@ static int configure_gpio(struct gspca_dev *gspca_dev,
663 static const __u8 reg9a_sn9c325[] = 685 static const __u8 reg9a_sn9c325[] =
664 {0x0a, 0x40, 0x38, 0x30, 0x00, 0x20}; 686 {0x0a, 0x40, 0x38, 0x30, 0x00, 0x20};
665 687
666 688 reg_w1(gspca_dev, 0xf1, 0x00);
667 regF1 = 0x00; 689 reg_w1(gspca_dev, 0x01, sn9c1xx[0]); /*fixme:jfm was [1] en v1*/
668 reg_w(gspca_dev, 0xf1, &regF1, 1);
669 reg_w(gspca_dev, 0x01, &sn9c1xx[0], 1); /*fixme:jfm was [1] en v1*/
670 690
671 /* configure gpio */ 691 /* configure gpio */
672 reg_w(gspca_dev, 0x01, &sn9c1xx[1], 2); 692 reg_w(gspca_dev, 0x01, &sn9c1xx[1], 2);
673 reg_w(gspca_dev, 0x08, &sn9c1xx[8], 2); 693 reg_w(gspca_dev, 0x08, &sn9c1xx[8], 2);
674 reg_w(gspca_dev, 0x17, &sn9c1xx[0x17], 5); /* jfm was 3 */ 694 reg_w(gspca_dev, 0x17, &sn9c1xx[0x17], 5); /* jfm len was 3 */
675 switch (sd->bridge) { 695 switch (sd->bridge) {
676 case BRIDGE_SN9C325: 696 case BRIDGE_SN9C325:
677 reg9a = reg9a_sn9c325; 697 reg9a = reg9a_sn9c325;
@@ -685,35 +705,25 @@ static int configure_gpio(struct gspca_dev *gspca_dev,
685 } 705 }
686 reg_w(gspca_dev, 0x9a, reg9a, 6); 706 reg_w(gspca_dev, 0x9a, reg9a, 6);
687 707
688 data = 0x60; /*fixme:jfm 60 00 00 (3) */ 708 reg_w1(gspca_dev, 0xd4, 0x60); /*fixme:jfm 60 00 00 (3) ? */
689 reg_w(gspca_dev, 0xd4, &data, 1);
690 709
691 reg_w(gspca_dev, 0x03, &sn9c1xx[3], 0x0f); 710 reg_w(gspca_dev, 0x03, &sn9c1xx[3], 0x0f);
692 711
693 switch (sd->bridge) { 712 switch (sd->bridge) {
694 case BRIDGE_SN9C120: /* from win trace */ 713 case BRIDGE_SN9C120: /* from win trace */
695 data = 0x61; 714 reg_w1(gspca_dev, 0x01, 0x61);
696 reg_w(gspca_dev, 0x01, &data, 1); 715 reg_w1(gspca_dev, 0x17, 0x20);
697 data = 0x20; 716 reg_w1(gspca_dev, 0x01, 0x60);
698 reg_w(gspca_dev, 0x17, &data, 1);
699 data = 0x60;
700 reg_w(gspca_dev, 0x01, &data, 1);
701 break; 717 break;
702 case BRIDGE_SN9C325: 718 case BRIDGE_SN9C325:
703 data = 0x43; 719 reg_w1(gspca_dev, 0x01, 0x43);
704 reg_w(gspca_dev, 0x01, &data, 1); 720 reg_w1(gspca_dev, 0x17, 0xae);
705 data = 0xae; 721 reg_w1(gspca_dev, 0x01, 0x42);
706 reg_w(gspca_dev, 0x17, &data, 1);
707 data = 0x42;
708 reg_w(gspca_dev, 0x01, &data, 1);
709 break; 722 break;
710 default: 723 default:
711 data = 0x43; 724 reg_w1(gspca_dev, 0x01, 0x43);
712 reg_w(gspca_dev, 0x01, &data, 1); 725 reg_w1(gspca_dev, 0x17, 0x61);
713 data = 0x61; 726 reg_w1(gspca_dev, 0x01, 0x42);
714 reg_w(gspca_dev, 0x17, &data, 1);
715 data = 0x42;
716 reg_w(gspca_dev, 0x01, &data, 1);
717 } 727 }
718 728
719 if (sd->sensor == SENSOR_HV7131R) { 729 if (sd->sensor == SENSOR_HV7131R) {
@@ -770,6 +780,9 @@ static void ov7660_InitSensor(struct gspca_dev *gspca_dev)
770{ 780{
771 int i = 0; 781 int i = 0;
772 782
783 i2c_w8(gspca_dev, ov7660_sensor_init[i]); /* reset SCCB */
784 i++;
785 msleep(20);
773 while (ov7660_sensor_init[i][0]) { 786 while (ov7660_sensor_init[i][0]) {
774 i2c_w8(gspca_dev, ov7660_sensor_init[i]); 787 i2c_w8(gspca_dev, ov7660_sensor_init[i]);
775 i++; 788 i++;
@@ -782,194 +795,16 @@ static int sd_config(struct gspca_dev *gspca_dev,
782{ 795{
783 struct sd *sd = (struct sd *) gspca_dev; 796 struct sd *sd = (struct sd *) gspca_dev;
784 struct cam *cam; 797 struct cam *cam;
785 __u16 vendor;
786 __u16 product;
787
788 vendor = id->idVendor;
789 product = id->idProduct;
790 sd->sensor = -1;
791 switch (vendor) {
792 case 0x0458: /* Genius */
793/* switch (product) {
794 case 0x7025: */
795 sd->bridge = BRIDGE_SN9C120;
796 sd->sensor = SENSOR_MI0360;
797 sd->i2c_base = 0x5d;
798/* break;
799 } */
800 break;
801 case 0x045e:
802/* switch (product) {
803 case 0x00f5:
804 case 0x00f7: */
805 sd->bridge = BRIDGE_SN9C105;
806 sd->sensor = SENSOR_OV7660;
807 sd->i2c_base = 0x21;
808/* break;
809 } */
810 break;
811 case 0x0471: /* Philips */
812/* switch (product) {
813 case 0x0327:
814 case 0x0328:
815 case 0x0330: */
816 sd->bridge = BRIDGE_SN9C105;
817 sd->sensor = SENSOR_MI0360;
818 sd->i2c_base = 0x5d;
819/* break;
820 } */
821 break;
822 case 0x0c45: /* Sonix */
823 switch (product) {
824 case 0x6040:
825 sd->bridge = BRIDGE_SN9C102P;
826/* sd->sensor = SENSOR_MI0360; * from BW600.inf */
827/*fixme: MI0360 base=5d ? */
828 sd->sensor = SENSOR_HV7131R; /* gspcav1 value */
829 sd->i2c_base = 0x11;
830 break;
831/* case 0x607a: * from BW600.inf
832 sd->bridge = BRIDGE_SN9C102P;
833 sd->sensor = SENSOR_OV7648;
834 sd->i2c_base = 0x??;
835 break; */
836 case 0x607c:
837 sd->bridge = BRIDGE_SN9C102P;
838 sd->sensor = SENSOR_HV7131R;
839 sd->i2c_base = 0x11;
840 break;
841/* case 0x607e: * from BW600.inf
842 sd->bridge = BRIDGE_SN9C102P;
843 sd->sensor = SENSOR_OV7630;
844 sd->i2c_base = 0x??;
845 break; */
846 case 0x60c0:
847 sd->bridge = BRIDGE_SN9C105;
848 sd->sensor = SENSOR_MI0360;
849 sd->i2c_base = 0x5d;
850 break;
851/* case 0x60c8: * from BW600.inf
852 sd->bridge = BRIDGE_SN9C105;
853 sd->sensor = SENSOR_OM6801;
854 sd->i2c_base = 0x??;
855 break; */
856/* case 0x60cc: * from BW600.inf
857 sd->bridge = BRIDGE_SN9C105;
858 sd->sensor = SENSOR_HV7131GP;
859 sd->i2c_base = 0x??;
860 break; */
861 case 0x60ec:
862 sd->bridge = BRIDGE_SN9C105;
863 sd->sensor = SENSOR_MO4000;
864 sd->i2c_base = 0x21;
865 break;
866/* case 0x60ef: * from BW600.inf
867 sd->bridge = BRIDGE_SN9C105;
868 sd->sensor = SENSOR_ICM105C;
869 sd->i2c_base = 0x??;
870 break; */
871/* case 0x60fa: * from BW600.inf
872 sd->bridge = BRIDGE_SN9C105;
873 sd->sensor = SENSOR_OV7648;
874 sd->i2c_base = 0x??;
875 break; */
876 case 0x60fb:
877 sd->bridge = BRIDGE_SN9C105;
878 sd->sensor = SENSOR_OV7660;
879 sd->i2c_base = 0x21;
880 break;
881 case 0x60fc:
882 sd->bridge = BRIDGE_SN9C105;
883 sd->sensor = SENSOR_HV7131R;
884 sd->i2c_base = 0x11;
885 break;
886/* case 0x60fe: * from BW600.inf
887 sd->bridge = BRIDGE_SN9C105;
888 sd->sensor = SENSOR_OV7630;
889 sd->i2c_base = 0x??;
890 break; */
891/* case 0x6108: * from BW600.inf
892 sd->bridge = BRIDGE_SN9C120;
893 sd->sensor = SENSOR_OM6801;
894 sd->i2c_base = 0x??;
895 break; */
896/* case 0x6122: * from BW600.inf
897 sd->bridge = BRIDGE_SN9C110;
898 sd->sensor = SENSOR_ICM105C;
899 sd->i2c_base = 0x??;
900 break; */
901 case 0x612a:
902/* sd->bridge = BRIDGE_SN9C110; * in BW600.inf */
903 sd->bridge = BRIDGE_SN9C325;
904 sd->sensor = SENSOR_OV7648;
905 sd->i2c_base = 0x21;
906/*fixme: sensor_init has base = 00 et 6e!*/
907 break;
908/* case 0x6123: * from BW600.inf
909 sd->bridge = BRIDGE_SN9C110;
910 sd->sensor = SENSOR_SanyoCCD;
911 sd->i2c_base = 0x??;
912 break; */
913 case 0x612c:
914 sd->bridge = BRIDGE_SN9C110;
915 sd->sensor = SENSOR_MO4000;
916 sd->i2c_base = 0x21;
917 break;
918/* case 0x612e: * from BW600.inf
919 sd->bridge = BRIDGE_SN9C110;
920 sd->sensor = SENSOR_OV7630;
921 sd->i2c_base = 0x??;
922 break; */
923/* case 0x612f: * from BW600.inf
924 sd->bridge = BRIDGE_SN9C110;
925 sd->sensor = SENSOR_ICM105C;
926 sd->i2c_base = 0x??;
927 break; */
928 case 0x6130:
929 sd->bridge = BRIDGE_SN9C120;
930 sd->sensor = SENSOR_MI0360;
931 sd->i2c_base = 0x5d;
932 break;
933 case 0x6138:
934 sd->bridge = BRIDGE_SN9C120;
935 sd->sensor = SENSOR_MO4000;
936 sd->i2c_base = 0x21;
937 break;
938/* case 0x613a: * from BW600.inf
939 sd->bridge = BRIDGE_SN9C120;
940 sd->sensor = SENSOR_OV7648;
941 sd->i2c_base = 0x??;
942 break; */
943 case 0x613b:
944 sd->bridge = BRIDGE_SN9C120;
945 sd->sensor = SENSOR_OV7660;
946 sd->i2c_base = 0x21;
947 break;
948 case 0x613c:
949 sd->bridge = BRIDGE_SN9C120;
950 sd->sensor = SENSOR_HV7131R;
951 sd->i2c_base = 0x11;
952 break;
953/* case 0x613e: * from BW600.inf
954 sd->bridge = BRIDGE_SN9C120;
955 sd->sensor = SENSOR_OV7630;
956 sd->i2c_base = 0x??;
957 break; */
958 }
959 break;
960 }
961 if (sd->sensor < 0) {
962 PDEBUG(D_ERR, "Invalid vendor/product %04x:%04x",
963 vendor, product);
964 return -EINVAL;
965 }
966 798
967 cam = &gspca_dev->cam; 799 cam = &gspca_dev->cam;
968 cam->dev_name = (char *) id->driver_info;
969 cam->epaddr = 0x01; 800 cam->epaddr = 0x01;
970 cam->cam_mode = vga_mode; 801 cam->cam_mode = vga_mode;
971 cam->nmodes = ARRAY_SIZE(vga_mode); 802 cam->nmodes = ARRAY_SIZE(vga_mode);
972 803
804 sd->bridge = id->driver_info >> 16;
805 sd->sensor = id->driver_info >> 8;
806 sd->i2c_base = id->driver_info;
807
973 sd->qindex = 4; /* set the quantization table */ 808 sd->qindex = 4; /* set the quantization table */
974 sd->brightness = BRIGHTNESS_DEF; 809 sd->brightness = BRIGHTNESS_DEF;
975 sd->contrast = CONTRAST_DEF; 810 sd->contrast = CONTRAST_DEF;
@@ -983,34 +818,26 @@ static int sd_open(struct gspca_dev *gspca_dev)
983{ 818{
984 struct sd *sd = (struct sd *) gspca_dev; 819 struct sd *sd = (struct sd *) gspca_dev;
985/* const __u8 *sn9c1xx; */ 820/* const __u8 *sn9c1xx; */
986 __u8 regF1;
987 __u8 regGpio[] = { 0x29, 0x74 }; 821 __u8 regGpio[] = { 0x29, 0x74 };
822 __u8 regF1;
988 823
989 /* setup a selector by bridge */ 824 /* setup a selector by bridge */
990 regF1 = 0x01; 825 reg_w1(gspca_dev, 0xf1, 0x01);
991 reg_w(gspca_dev, 0xf1, &regF1, 1);
992 reg_r(gspca_dev, 0x00, 1); /* -> regF1 = 0x00 */ 826 reg_r(gspca_dev, 0x00, 1); /* -> regF1 = 0x00 */
993 regF1 = gspca_dev->usb_buf[0]; 827 reg_w1(gspca_dev, 0xf1, gspca_dev->usb_buf[0]);
994 reg_w(gspca_dev, 0xf1, &regF1, 1);
995 reg_r(gspca_dev, 0x00, 1); 828 reg_r(gspca_dev, 0x00, 1);
996 regF1 = gspca_dev->usb_buf[0]; 829 regF1 = gspca_dev->usb_buf[0];
997 switch (sd->bridge) { 830 switch (sd->bridge) {
998 case BRIDGE_SN9C102P: 831 case BRIDGE_SN9C102P:
999 if (regF1 != 0x11) 832 if (regF1 != 0x11)
1000 return -ENODEV; 833 return -ENODEV;
1001 reg_w(gspca_dev, 0x02, &regGpio[1], 1); 834 reg_w1(gspca_dev, 0x02, regGpio[1]);
1002 break; 835 break;
1003 case BRIDGE_SN9C105: 836 case BRIDGE_SN9C105:
1004 if (regF1 != 0x11) 837 if (regF1 != 0x11)
1005 return -ENODEV; 838 return -ENODEV;
1006 reg_w(gspca_dev, 0x02, regGpio, 2); 839 reg_w(gspca_dev, 0x02, regGpio, 2);
1007 break; 840 break;
1008 case BRIDGE_SN9C110:
1009 if (regF1 != 0x12)
1010 return -ENODEV;
1011 regGpio[1] = 0x62;
1012 reg_w(gspca_dev, 0x02, &regGpio[1], 1);
1013 break;
1014 case BRIDGE_SN9C120: 841 case BRIDGE_SN9C120:
1015 if (regF1 != 0x12) 842 if (regF1 != 0x12)
1016 return -ENODEV; 843 return -ENODEV;
@@ -1018,16 +845,15 @@ static int sd_open(struct gspca_dev *gspca_dev)
1018 reg_w(gspca_dev, 0x02, regGpio, 2); 845 reg_w(gspca_dev, 0x02, regGpio, 2);
1019 break; 846 break;
1020 default: 847 default:
848/* case BRIDGE_SN9C110: */
1021/* case BRIDGE_SN9C325: */ 849/* case BRIDGE_SN9C325: */
1022 if (regF1 != 0x12) 850 if (regF1 != 0x12)
1023 return -ENODEV; 851 return -ENODEV;
1024 regGpio[1] = 0x62; 852 reg_w1(gspca_dev, 0x02, 0x62);
1025 reg_w(gspca_dev, 0x02, &regGpio[1], 1);
1026 break; 853 break;
1027 } 854 }
1028 855
1029 regF1 = 0x01; 856 reg_w1(gspca_dev, 0xf1, 0x01);
1030 reg_w(gspca_dev, 0xf1, &regF1, 1);
1031 857
1032 return 0; 858 return 0;
1033} 859}
@@ -1123,7 +949,7 @@ static void setbrightness(struct gspca_dev *gspca_dev)
1123 } 949 }
1124 950
1125 k2 = sd->brightness >> 10; 951 k2 = sd->brightness >> 10;
1126 reg_w(gspca_dev, 0x96, &k2, 1); 952 reg_w1(gspca_dev, 0x96, k2);
1127} 953}
1128 954
1129static void setcontrast(struct gspca_dev *gspca_dev) 955static void setcontrast(struct gspca_dev *gspca_dev)
@@ -1152,7 +978,7 @@ static void setcolors(struct gspca_dev *gspca_dev)
1152 data = (colour + 32) & 0x7f; /* blue */ 978 data = (colour + 32) & 0x7f; /* blue */
1153 else 979 else
1154 data = (-colour + 32) & 0x7f; /* red */ 980 data = (-colour + 32) & 0x7f; /* red */
1155 reg_w(gspca_dev, 0x05, &data, 1); 981 reg_w1(gspca_dev, 0x05, data);
1156} 982}
1157 983
1158/* -- start the camera -- */ 984/* -- start the camera -- */
@@ -1165,7 +991,6 @@ static void sd_start(struct gspca_dev *gspca_dev)
1165 __u8 reg17; 991 __u8 reg17;
1166 const __u8 *sn9c1xx; 992 const __u8 *sn9c1xx;
1167 int mode; 993 int mode;
1168 static const __u8 DC29[] = { 0x6a, 0x50, 0x00, 0x00, 0x50, 0x3c };
1169 static const __u8 C0[] = { 0x2d, 0x2d, 0x3a, 0x05, 0x04, 0x3f }; 994 static const __u8 C0[] = { 0x2d, 0x2d, 0x3a, 0x05, 0x04, 0x3f };
1170 static const __u8 CA[] = { 0x28, 0xd8, 0x14, 0xec }; 995 static const __u8 CA[] = { 0x28, 0xd8, 0x14, 0xec };
1171 static const __u8 CA_sn9c120[] = 996 static const __u8 CA_sn9c120[] =
@@ -1179,21 +1004,20 @@ static void sd_start(struct gspca_dev *gspca_dev)
1179 1004
1180/*fixme:jfm this sequence should appear at end of sd_start */ 1005/*fixme:jfm this sequence should appear at end of sd_start */
1181/* with 1006/* with
1182 data = 0x44; 1007 reg_w1(gspca_dev, 0x01, 0x44); */
1183 reg_w(gspca_dev, 0x01, &data, 1); */ 1008 reg_w1(gspca_dev, 0x15, sn9c1xx[0x15]);
1184 reg_w(gspca_dev, 0x15, &sn9c1xx[0x15], 1); 1009 reg_w1(gspca_dev, 0x16, sn9c1xx[0x16]);
1185 reg_w(gspca_dev, 0x16, &sn9c1xx[0x16], 1); 1010 reg_w1(gspca_dev, 0x12, sn9c1xx[0x12]);
1186 reg_w(gspca_dev, 0x12, &sn9c1xx[0x12], 1); 1011 reg_w1(gspca_dev, 0x13, sn9c1xx[0x13]);
1187 reg_w(gspca_dev, 0x13, &sn9c1xx[0x13], 1); 1012 reg_w1(gspca_dev, 0x18, sn9c1xx[0x18]);
1188 reg_w(gspca_dev, 0x18, &sn9c1xx[0x18], 1); 1013 reg_w1(gspca_dev, 0xd2, 0x6a); /* DC29 */
1189 reg_w(gspca_dev, 0xd2, &DC29[0], 1); 1014 reg_w1(gspca_dev, 0xd3, 0x50);
1190 reg_w(gspca_dev, 0xd3, &DC29[1], 1); 1015 reg_w1(gspca_dev, 0xc6, 0x00);
1191 reg_w(gspca_dev, 0xc6, &DC29[2], 1); 1016 reg_w1(gspca_dev, 0xc7, 0x00);
1192 reg_w(gspca_dev, 0xc7, &DC29[3], 1); 1017 reg_w1(gspca_dev, 0xc8, 0x50);
1193 reg_w(gspca_dev, 0xc8, &DC29[4], 1); 1018 reg_w1(gspca_dev, 0xc9, 0x3c);
1194 reg_w(gspca_dev, 0xc9, &DC29[5], 1);
1195/*fixme:jfm end of ending sequence */ 1019/*fixme:jfm end of ending sequence */
1196 reg_w(gspca_dev, 0x18, &sn9c1xx[0x18], 1); 1020 reg_w1(gspca_dev, 0x18, sn9c1xx[0x18]);
1197 switch (sd->bridge) { 1021 switch (sd->bridge) {
1198 case BRIDGE_SN9C325: 1022 case BRIDGE_SN9C325:
1199 data = 0xae; 1023 data = 0xae;
@@ -1205,11 +1029,11 @@ static void sd_start(struct gspca_dev *gspca_dev)
1205 data = 0x60; 1029 data = 0x60;
1206 break; 1030 break;
1207 } 1031 }
1208 reg_w(gspca_dev, 0x17, &data, 1); 1032 reg_w1(gspca_dev, 0x17, data);
1209 reg_w(gspca_dev, 0x05, &sn9c1xx[5], 1); 1033 reg_w1(gspca_dev, 0x05, sn9c1xx[5]);
1210 reg_w(gspca_dev, 0x07, &sn9c1xx[7], 1); 1034 reg_w1(gspca_dev, 0x07, sn9c1xx[7]);
1211 reg_w(gspca_dev, 0x06, &sn9c1xx[6], 1); 1035 reg_w1(gspca_dev, 0x06, sn9c1xx[6]);
1212 reg_w(gspca_dev, 0x14, &sn9c1xx[0x14], 1); 1036 reg_w1(gspca_dev, 0x14, sn9c1xx[0x14]);
1213 switch (sd->bridge) { 1037 switch (sd->bridge) {
1214 case BRIDGE_SN9C325: 1038 case BRIDGE_SN9C325:
1215 reg_w(gspca_dev, 0x20, regsn20_sn9c325, 1039 reg_w(gspca_dev, 0x20, regsn20_sn9c325,
@@ -1217,10 +1041,8 @@ static void sd_start(struct gspca_dev *gspca_dev)
1217 for (i = 0; i < 8; i++) 1041 for (i = 0; i < 8; i++)
1218 reg_w(gspca_dev, 0x84, reg84_sn9c325, 1042 reg_w(gspca_dev, 0x84, reg84_sn9c325,
1219 sizeof reg84_sn9c325); 1043 sizeof reg84_sn9c325);
1220 data = 0x0a; 1044 reg_w1(gspca_dev, 0x9a, 0x0a);
1221 reg_w(gspca_dev, 0x9a, &data, 1); 1045 reg_w1(gspca_dev, 0x99, 0x60);
1222 data = 0x60;
1223 reg_w(gspca_dev, 0x99, &data, 1);
1224 break; 1046 break;
1225 case BRIDGE_SN9C120: 1047 case BRIDGE_SN9C120:
1226 reg_w(gspca_dev, 0x20, regsn20_sn9c120, 1048 reg_w(gspca_dev, 0x20, regsn20_sn9c120,
@@ -1233,39 +1055,30 @@ static void sd_start(struct gspca_dev *gspca_dev)
1233 sizeof reg84_sn9c120_2); 1055 sizeof reg84_sn9c120_2);
1234 reg_w(gspca_dev, 0x84, reg84_sn9c120_3, 1056 reg_w(gspca_dev, 0x84, reg84_sn9c120_3,
1235 sizeof reg84_sn9c120_3); 1057 sizeof reg84_sn9c120_3);
1236 data = 0x05; 1058 reg_w1(gspca_dev, 0x9a, 0x05);
1237 reg_w(gspca_dev, 0x9a, &data, 1); 1059 reg_w1(gspca_dev, 0x99, 0x5b);
1238 data = 0x5b;
1239 reg_w(gspca_dev, 0x99, &data, 1);
1240 break; 1060 break;
1241 default: 1061 default:
1242 reg_w(gspca_dev, 0x20, regsn20, sizeof regsn20); 1062 reg_w(gspca_dev, 0x20, regsn20, sizeof regsn20);
1243 for (i = 0; i < 8; i++) 1063 for (i = 0; i < 8; i++)
1244 reg_w(gspca_dev, 0x84, reg84, sizeof reg84); 1064 reg_w(gspca_dev, 0x84, reg84, sizeof reg84);
1245 data = 0x08; 1065 reg_w1(gspca_dev, 0x9a, 0x08);
1246 reg_w(gspca_dev, 0x9a, &data, 1); 1066 reg_w1(gspca_dev, 0x99, 0x59);
1247 data = 0x59;
1248 reg_w(gspca_dev, 0x99, &data, 1);
1249 break; 1067 break;
1250 } 1068 }
1251 1069
1252 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv; 1070 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
1253 reg1 = 0x02; 1071 if (mode)
1072 reg1 = 0x46; /* 320 clk 48Mhz */
1073 else
1074 reg1 = 0x06; /* 640 clk 24Mz */
1254 reg17 = 0x61; 1075 reg17 = 0x61;
1255 switch (sd->sensor) { 1076 switch (sd->sensor) {
1256 case SENSOR_HV7131R: 1077 case SENSOR_HV7131R:
1257 hv7131R_InitSensor(gspca_dev); 1078 hv7131R_InitSensor(gspca_dev);
1258 if (mode)
1259 reg1 = 0x46; /* 320 clk 48Mhz */
1260 else
1261 reg1 = 0x06; /* 640 clk 24Mz */
1262 break; 1079 break;
1263 case SENSOR_MI0360: 1080 case SENSOR_MI0360:
1264 mi0360_InitSensor(gspca_dev); 1081 mi0360_InitSensor(gspca_dev);
1265 if (mode)
1266 reg1 = 0x46; /* 320 clk 48Mhz */
1267 else
1268 reg1 = 0x06; /* 640 clk 24Mz */
1269 break; 1082 break;
1270 case SENSOR_MO4000: 1083 case SENSOR_MO4000:
1271 mo4000_InitSensor(gspca_dev); 1084 mo4000_InitSensor(gspca_dev);
@@ -1274,13 +1087,13 @@ static void sd_start(struct gspca_dev *gspca_dev)
1274 reg1 = 0x06; /* clk 24Mz */ 1087 reg1 = 0x06; /* clk 24Mz */
1275 } else { 1088 } else {
1276 reg17 = 0x22; /* 640 MCKSIZE */ 1089 reg17 = 0x22; /* 640 MCKSIZE */
1277 reg1 = 0x06; /* 640 clk 24Mz */ 1090/* reg1 = 0x06; * 640 clk 24Mz (done) */
1278 } 1091 }
1279 break; 1092 break;
1280 case SENSOR_OV7648: 1093 case SENSOR_OV7648:
1094 ov7648_InitSensor(gspca_dev);
1281 reg17 = 0xa2; 1095 reg17 = 0xa2;
1282 reg1 = 0x44; 1096 reg1 = 0x44;
1283 ov7648_InitSensor(gspca_dev);
1284/* if (mode) 1097/* if (mode)
1285 ; * 320x2... 1098 ; * 320x2...
1286 else 1099 else
@@ -1292,7 +1105,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
1292 if (mode) { 1105 if (mode) {
1293/* reg17 = 0x21; * 320 */ 1106/* reg17 = 0x21; * 320 */
1294/* reg1 = 0x44; */ 1107/* reg1 = 0x44; */
1295 reg1 = 0x46; 1108/* reg1 = 0x46; (done) */
1296 } else { 1109 } else {
1297 reg17 = 0xa2; /* 640 */ 1110 reg17 = 0xa2; /* 640 */
1298 reg1 = 0x40; 1111 reg1 = 0x40;
@@ -1321,16 +1134,16 @@ static void sd_start(struct gspca_dev *gspca_dev)
1321 1134
1322 /* here change size mode 0 -> VGA; 1 -> CIF */ 1135 /* here change size mode 0 -> VGA; 1 -> CIF */
1323 data = 0x40 | sn9c1xx[0x18] | (mode << 4); 1136 data = 0x40 | sn9c1xx[0x18] | (mode << 4);
1324 reg_w(gspca_dev, 0x18, &data, 1); 1137 reg_w1(gspca_dev, 0x18, data);
1325 1138
1326 reg_w(gspca_dev, 0x100, qtable4, 0x40); 1139 reg_w(gspca_dev, 0x100, qtable4, 0x40);
1327 reg_w(gspca_dev, 0x140, qtable4 + 0x40, 0x40); 1140 reg_w(gspca_dev, 0x140, qtable4 + 0x40, 0x40);
1328 1141
1329 data = sn9c1xx[0x18] | (mode << 4); 1142 data = sn9c1xx[0x18] | (mode << 4);
1330 reg_w(gspca_dev, 0x18, &data, 1); 1143 reg_w1(gspca_dev, 0x18, data);
1331 1144
1332 reg_w(gspca_dev, 0x17, &reg17, 1); 1145 reg_w1(gspca_dev, 0x17, reg17);
1333 reg_w(gspca_dev, 0x01, &reg1, 1); 1146 reg_w1(gspca_dev, 0x01, reg1);
1334 setbrightness(gspca_dev); 1147 setbrightness(gspca_dev);
1335 setcontrast(gspca_dev); 1148 setcontrast(gspca_dev);
1336} 1149}
@@ -1342,7 +1155,6 @@ static void sd_stopN(struct gspca_dev *gspca_dev)
1342 { 0xa1, 0x11, 0x02, 0x09, 0x00, 0x00, 0x00, 0x10 }; 1155 { 0xa1, 0x11, 0x02, 0x09, 0x00, 0x00, 0x00, 0x10 };
1343 static const __u8 stopmi0360[] = 1156 static const __u8 stopmi0360[] =
1344 { 0xb1, 0x5d, 0x07, 0x00, 0x00, 0x00, 0x00, 0x10 }; 1157 { 0xb1, 0x5d, 0x07, 0x00, 0x00, 0x00, 0x00, 0x10 };
1345 __u8 regF1;
1346 __u8 data; 1158 __u8 data;
1347 const __u8 *sn9c1xx; 1159 const __u8 *sn9c1xx;
1348 1160
@@ -1366,12 +1178,11 @@ static void sd_stopN(struct gspca_dev *gspca_dev)
1366 break; 1178 break;
1367 } 1179 }
1368 sn9c1xx = sn_tb[(int) sd->sensor]; 1180 sn9c1xx = sn_tb[(int) sd->sensor];
1369 reg_w(gspca_dev, 0x01, &sn9c1xx[1], 1); 1181 reg_w1(gspca_dev, 0x01, sn9c1xx[1]);
1370 reg_w(gspca_dev, 0x17, &sn9c1xx[0x17], 1); 1182 reg_w1(gspca_dev, 0x17, sn9c1xx[0x17]);
1371 reg_w(gspca_dev, 0x01, &sn9c1xx[1], 1); 1183 reg_w1(gspca_dev, 0x01, sn9c1xx[1]);
1372 reg_w(gspca_dev, 0x01, &data, 1); 1184 reg_w1(gspca_dev, 0x01, data);
1373 regF1 = 0x01; 1185 reg_w1(gspca_dev, 0xf1, 0x01);
1374 reg_w(gspca_dev, 0xf1, &regF1, 1);
1375} 1186}
1376 1187
1377static void sd_stop0(struct gspca_dev *gspca_dev) 1188static void sd_stop0(struct gspca_dev *gspca_dev)
@@ -1610,30 +1421,53 @@ static const struct sd_desc sd_desc = {
1610}; 1421};
1611 1422
1612/* -- module initialisation -- */ 1423/* -- module initialisation -- */
1613#define DVNM(name) .driver_info = (kernel_ulong_t) name 1424#define BSI(bridge, sensor, i2c_addr) \
1425 .driver_info = (BRIDGE_ ## bridge << 16) \
1426 | (SENSOR_ ## sensor << 8) \
1427 | (i2c_addr)
1614static const __devinitdata struct usb_device_id device_table[] = { 1428static const __devinitdata struct usb_device_id device_table[] = {
1615#ifndef CONFIG_USB_SN9C102 1429#ifndef CONFIG_USB_SN9C102
1616 {USB_DEVICE(0x0458, 0x7025), DVNM("Genius Eye 311Q")}, 1430 {USB_DEVICE(0x0458, 0x7025), BSI(SN9C120, MI0360, 0x5d)},
1617 {USB_DEVICE(0x045e, 0x00f5), DVNM("MicroSoft VX3000")}, 1431 {USB_DEVICE(0x045e, 0x00f5), BSI(SN9C105, OV7660, 0x21)},
1618 {USB_DEVICE(0x045e, 0x00f7), DVNM("MicroSoft VX1000")}, 1432 {USB_DEVICE(0x045e, 0x00f7), BSI(SN9C105, OV7660, 0x21)},
1619 {USB_DEVICE(0x0471, 0x0327), DVNM("Philips SPC 600 NC")}, 1433 {USB_DEVICE(0x0471, 0x0327), BSI(SN9C105, MI0360, 0x5d)},
1620 {USB_DEVICE(0x0471, 0x0328), DVNM("Philips SPC 700 NC")}, 1434 {USB_DEVICE(0x0471, 0x0328), BSI(SN9C105, MI0360, 0x5d)},
1621#endif 1435#endif
1622 {USB_DEVICE(0x0471, 0x0330), DVNM("Philips SPC 710NC")}, 1436 {USB_DEVICE(0x0471, 0x0330), BSI(SN9C105, MI0360, 0x5d)},
1623 {USB_DEVICE(0x0c45, 0x6040), DVNM("Speed NVC 350K")}, 1437 {USB_DEVICE(0x0c45, 0x6040), BSI(SN9C102P, HV7131R, 0x11)},
1624 {USB_DEVICE(0x0c45, 0x607c), DVNM("Sonix sn9c102p Hv7131R")}, 1438/* bw600.inf:
1625 {USB_DEVICE(0x0c45, 0x60c0), DVNM("Sangha Sn535")}, 1439 {USB_DEVICE(0x0c45, 0x6040), BSI(SN9C102P, MI0360, 0x5d)}, */
1626 {USB_DEVICE(0x0c45, 0x60ec), DVNM("SN9C105+MO4000")}, 1440/* {USB_DEVICE(0x0c45, 0x603a), BSI(SN9C102P, OV7648, 0x??)}, */
1627 {USB_DEVICE(0x0c45, 0x60fb), DVNM("Surfer NoName")}, 1441/* {USB_DEVICE(0x0c45, 0x607a), BSI(SN9C102P, OV7648, 0x??)}, */
1628 {USB_DEVICE(0x0c45, 0x60fc), DVNM("LG-LIC300")}, 1442 {USB_DEVICE(0x0c45, 0x607c), BSI(SN9C102P, HV7131R, 0x11)},
1629 {USB_DEVICE(0x0c45, 0x612a), DVNM("Avant Camera")}, 1443/* {USB_DEVICE(0x0c45, 0x607e), BSI(SN9C102P, OV7630, 0x??)}, */
1630 {USB_DEVICE(0x0c45, 0x612c), DVNM("Typhoon Rasy Cam 1.3MPix")}, 1444 {USB_DEVICE(0x0c45, 0x60c0), BSI(SN9C105, MI0360, 0x5d)},
1445/* {USB_DEVICE(0x0c45, 0x60c8), BSI(SN9C105, OM6801, 0x??)}, */
1446/* {USB_DEVICE(0x0c45, 0x60cc), BSI(SN9C105, HV7131GP, 0x??)}, */
1447 {USB_DEVICE(0x0c45, 0x60ec), BSI(SN9C105, MO4000, 0x21)},
1448/* {USB_DEVICE(0x0c45, 0x60ef), BSI(SN9C105, ICM105C, 0x??)}, */
1449/* {USB_DEVICE(0x0c45, 0x60fa), BSI(SN9C105, OV7648, 0x??)}, */
1450 {USB_DEVICE(0x0c45, 0x60fb), BSI(SN9C105, OV7660, 0x21)},
1451 {USB_DEVICE(0x0c45, 0x60fc), BSI(SN9C105, HV7131R, 0x11)},
1452/* {USB_DEVICE(0x0c45, 0x60fe), BSI(SN9C105, OV7630, 0x??)}, */
1453/* {USB_DEVICE(0x0c45, 0x6108), BSI(SN9C120, OM6801, 0x??)}, */
1454/* {USB_DEVICE(0x0c45, 0x6122), BSI(SN9C110, ICM105C, 0x??)}, */
1455/* {USB_DEVICE(0x0c45, 0x6123), BSI(SN9C110, SanyoCCD, 0x??)}, */
1456 {USB_DEVICE(0x0c45, 0x612a), BSI(SN9C325, OV7648, 0x21)},
1457/* bw600.inf:
1458 {USB_DEVICE(0x0c45, 0x612a), BSI(SN9C110, OV7648, 0x21)}, */
1459 {USB_DEVICE(0x0c45, 0x612c), BSI(SN9C110, MO4000, 0x21)},
1460/* {USB_DEVICE(0x0c45, 0x612e), BSI(SN9C110, OV7630, 0x??)}, */
1461/* {USB_DEVICE(0x0c45, 0x612f), BSI(SN9C110, ICM105C, 0x??)}, */
1631#ifndef CONFIG_USB_SN9C102 1462#ifndef CONFIG_USB_SN9C102
1632 {USB_DEVICE(0x0c45, 0x6130), DVNM("Sonix Pccam")}, 1463 {USB_DEVICE(0x0c45, 0x6130), BSI(SN9C120, MI0360, 0x5d)},
1633 {USB_DEVICE(0x0c45, 0x6138), DVNM("Sn9c120 Mo4000")}, 1464 {USB_DEVICE(0x0c45, 0x6138), BSI(SN9C120, MO4000, 0x21)},
1634 {USB_DEVICE(0x0c45, 0x613b), DVNM("Surfer SN-206")}, 1465/* {USB_DEVICE(0x0c45, 0x613a), BSI(SN9C120, OV7648, 0x??)}, */
1635 {USB_DEVICE(0x0c45, 0x613c), DVNM("Sonix Pccam168")}, 1466 {USB_DEVICE(0x0c45, 0x613b), BSI(SN9C120, OV7660, 0x21)},
1467 {USB_DEVICE(0x0c45, 0x613c), BSI(SN9C120, HV7131R, 0x11)},
1468/* {USB_DEVICE(0x0c45, 0x613e), BSI(SN9C120, OV7630, 0x??)}, */
1636#endif 1469#endif
1470 {USB_DEVICE(0x0c45, 0x6143), BSI(SN9C120, MI0360, 0x5d)},
1637 {} 1471 {}
1638}; 1472};
1639MODULE_DEVICE_TABLE(usb, device_table); 1473MODULE_DEVICE_TABLE(usb, device_table);
@@ -1658,7 +1492,7 @@ static int __init sd_mod_init(void)
1658{ 1492{
1659 if (usb_register(&sd_driver) < 0) 1493 if (usb_register(&sd_driver) < 0)
1660 return -1; 1494 return -1;
1661 info("v%s registered", version); 1495 info("registered");
1662 return 0; 1496 return 0;
1663} 1497}
1664static void __exit sd_mod_exit(void) 1498static void __exit sd_mod_exit(void)
diff --git a/drivers/media/video/gspca/spca500.c b/drivers/media/video/gspca/spca500.c
index 156206118795..17fe2c2a440d 100644
--- a/drivers/media/video/gspca/spca500.c
+++ b/drivers/media/video/gspca/spca500.c
@@ -24,9 +24,6 @@
24#include "gspca.h" 24#include "gspca.h"
25#include "jpeg.h" 25#include "jpeg.h"
26 26
27#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7)
28static const char version[] = "2.1.7";
29
30MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 27MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
31MODULE_DESCRIPTION("GSPCA/SPCA500 USB Camera Driver"); 28MODULE_DESCRIPTION("GSPCA/SPCA500 USB Camera Driver");
32MODULE_LICENSE("GPL"); 29MODULE_LICENSE("GPL");
@@ -630,109 +627,10 @@ static int sd_config(struct gspca_dev *gspca_dev,
630{ 627{
631 struct sd *sd = (struct sd *) gspca_dev; 628 struct sd *sd = (struct sd *) gspca_dev;
632 struct cam *cam; 629 struct cam *cam;
633 __u16 vendor; 630
634 __u16 product;
635
636 vendor = id->idVendor;
637 product = id->idProduct;
638 switch (vendor) {
639 case 0x040a: /* Kodak cameras */
640/* switch (product) { */
641/* case 0x0300: */
642 sd->subtype = KodakEZ200;
643/* break; */
644/* } */
645 break;
646 case 0x041e: /* Creative cameras */
647/* switch (product) { */
648/* case 0x400a: */
649 sd->subtype = CreativePCCam300;
650/* break; */
651/* } */
652 break;
653 case 0x046d: /* Logitech Labtec */
654 switch (product) {
655 case 0x0890:
656 sd->subtype = LogitechTraveler;
657 break;
658 case 0x0900:
659 sd->subtype = LogitechClickSmart310;
660 break;
661 case 0x0901:
662 sd->subtype = LogitechClickSmart510;
663 break;
664 }
665 break;
666 case 0x04a5: /* Benq */
667/* switch (product) { */
668/* case 0x300c: */
669 sd->subtype = BenqDC1016;
670/* break; */
671/* } */
672 break;
673 case 0x04fc: /* SunPlus */
674/* switch (product) { */
675/* case 0x7333: */
676 sd->subtype = PalmPixDC85;
677/* break; */
678/* } */
679 break;
680 case 0x055f: /* Mustek cameras */
681 switch (product) {
682 case 0xc200:
683 sd->subtype = MustekGsmart300;
684 break;
685 case 0xc220:
686 sd->subtype = Gsmartmini;
687 break;
688 }
689 break;
690 case 0x06bd: /* Agfa Cl20 */
691/* switch (product) { */
692/* case 0x0404: */
693 sd->subtype = AgfaCl20;
694/* break; */
695/* } */
696 break;
697 case 0x06be: /* Optimedia */
698/* switch (product) { */
699/* case 0x0800: */
700 sd->subtype = Optimedia;
701/* break; */
702/* } */
703 break;
704 case 0x084d: /* D-Link / Minton */
705/* switch (product) { */
706/* case 0x0003: * DSC-350 / S-Cam F5 */
707 sd->subtype = DLinkDSC350;
708/* break; */
709/* } */
710 break;
711 case 0x08ca: /* Aiptek */
712/* switch (product) { */
713/* case 0x0103: */
714 sd->subtype = AiptekPocketDV;
715/* break; */
716/* } */
717 break;
718 case 0x2899: /* ToptroIndustrial */
719/* switch (product) { */
720/* case 0x012c: */
721 sd->subtype = ToptroIndus;
722/* break; */
723/* } */
724 break;
725 case 0x8086: /* Intel */
726/* switch (product) { */
727/* case 0x0630: * Pocket PC Camera */
728 sd->subtype = IntelPocketPCCamera;
729/* break; */
730/* } */
731 break;
732 }
733 cam = &gspca_dev->cam; 631 cam = &gspca_dev->cam;
734 cam->dev_name = (char *) id->driver_info;
735 cam->epaddr = 0x01; 632 cam->epaddr = 0x01;
633 sd->subtype = id->driver_info;
736 if (sd->subtype != LogitechClickSmart310) { 634 if (sd->subtype != LogitechClickSmart310) {
737 cam->cam_mode = vga_mode; 635 cam->cam_mode = vga_mode;
738 cam->nmodes = sizeof vga_mode / sizeof vga_mode[0]; 636 cam->nmodes = sizeof vga_mode / sizeof vga_mode[0];
@@ -1162,23 +1060,22 @@ static struct sd_desc sd_desc = {
1162}; 1060};
1163 1061
1164/* -- module initialisation -- */ 1062/* -- module initialisation -- */
1165#define DVNM(name) .driver_info = (kernel_ulong_t) name
1166static const __devinitdata struct usb_device_id device_table[] = { 1063static const __devinitdata struct usb_device_id device_table[] = {
1167 {USB_DEVICE(0x040a, 0x0300), DVNM("Kodak EZ200")}, 1064 {USB_DEVICE(0x040a, 0x0300), .driver_info = KodakEZ200},
1168 {USB_DEVICE(0x041e, 0x400a), DVNM("Creative PC-CAM 300")}, 1065 {USB_DEVICE(0x041e, 0x400a), .driver_info = CreativePCCam300},
1169 {USB_DEVICE(0x046d, 0x0890), DVNM("Logitech QuickCam traveler")}, 1066 {USB_DEVICE(0x046d, 0x0890), .driver_info = LogitechTraveler},
1170 {USB_DEVICE(0x046d, 0x0900), DVNM("Logitech Inc. ClickSmart 310")}, 1067 {USB_DEVICE(0x046d, 0x0900), .driver_info = LogitechClickSmart310},
1171 {USB_DEVICE(0x046d, 0x0901), DVNM("Logitech Inc. ClickSmart 510")}, 1068 {USB_DEVICE(0x046d, 0x0901), .driver_info = LogitechClickSmart510},
1172 {USB_DEVICE(0x04a5, 0x300c), DVNM("Benq DC1016")}, 1069 {USB_DEVICE(0x04a5, 0x300c), .driver_info = BenqDC1016},
1173 {USB_DEVICE(0x04fc, 0x7333), DVNM("PalmPixDC85")}, 1070 {USB_DEVICE(0x04fc, 0x7333), .driver_info = PalmPixDC85},
1174 {USB_DEVICE(0x055f, 0xc200), DVNM("Mustek Gsmart 300")}, 1071 {USB_DEVICE(0x055f, 0xc200), .driver_info = MustekGsmart300},
1175 {USB_DEVICE(0x055f, 0xc220), DVNM("Gsmart Mini")}, 1072 {USB_DEVICE(0x055f, 0xc220), .driver_info = Gsmartmini},
1176 {USB_DEVICE(0x06bd, 0x0404), DVNM("Agfa CL20")}, 1073 {USB_DEVICE(0x06bd, 0x0404), .driver_info = AgfaCl20},
1177 {USB_DEVICE(0x06be, 0x0800), DVNM("Optimedia")}, 1074 {USB_DEVICE(0x06be, 0x0800), .driver_info = Optimedia},
1178 {USB_DEVICE(0x084d, 0x0003), DVNM("D-Link DSC-350")}, 1075 {USB_DEVICE(0x084d, 0x0003), .driver_info = DLinkDSC350},
1179 {USB_DEVICE(0x08ca, 0x0103), DVNM("Aiptek PocketDV")}, 1076 {USB_DEVICE(0x08ca, 0x0103), .driver_info = AiptekPocketDV},
1180 {USB_DEVICE(0x2899, 0x012c), DVNM("Toptro Industrial")}, 1077 {USB_DEVICE(0x2899, 0x012c), .driver_info = ToptroIndus},
1181 {USB_DEVICE(0x8086, 0x0630), DVNM("Intel Pocket PC Camera")}, 1078 {USB_DEVICE(0x8086, 0x0630), .driver_info = IntelPocketPCCamera},
1182 {} 1079 {}
1183}; 1080};
1184MODULE_DEVICE_TABLE(usb, device_table); 1081MODULE_DEVICE_TABLE(usb, device_table);
@@ -1203,7 +1100,7 @@ static int __init sd_mod_init(void)
1203{ 1100{
1204 if (usb_register(&sd_driver) < 0) 1101 if (usb_register(&sd_driver) < 0)
1205 return -1; 1102 return -1;
1206 PDEBUG(D_PROBE, "v%s registered", version); 1103 PDEBUG(D_PROBE, "registered");
1207 return 0; 1104 return 0;
1208} 1105}
1209static void __exit sd_mod_exit(void) 1106static void __exit sd_mod_exit(void)
diff --git a/drivers/media/video/gspca/spca501.c b/drivers/media/video/gspca/spca501.c
index 50e929de0203..51a3c3429ef0 100644
--- a/drivers/media/video/gspca/spca501.c
+++ b/drivers/media/video/gspca/spca501.c
@@ -23,9 +23,6 @@
23 23
24#include "gspca.h" 24#include "gspca.h"
25 25
26#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7)
27static const char version[] = "2.1.7";
28
29MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 26MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
30MODULE_DESCRIPTION("GSPCA/SPCA501 USB Camera Driver"); 27MODULE_DESCRIPTION("GSPCA/SPCA501 USB Camera Driver");
31MODULE_LICENSE("GPL"); 28MODULE_LICENSE("GPL");
@@ -1923,63 +1920,12 @@ static int sd_config(struct gspca_dev *gspca_dev,
1923{ 1920{
1924 struct sd *sd = (struct sd *) gspca_dev; 1921 struct sd *sd = (struct sd *) gspca_dev;
1925 struct cam *cam; 1922 struct cam *cam;
1926 __u16 vendor; 1923
1927 __u16 product;
1928
1929 vendor = id->idVendor;
1930 product = id->idProduct;
1931 switch (vendor) {
1932 case 0x0000: /* Unknow Camera */
1933/* switch (product) { */
1934/* case 0x0000: */
1935 sd->subtype = MystFromOriUnknownCamera;
1936/* break; */
1937/* } */
1938 break;
1939 case 0x040a: /* Kodak cameras */
1940/* switch (product) { */
1941/* case 0x0002: */
1942 sd->subtype = KodakDVC325;
1943/* break; */
1944/* } */
1945 break;
1946 case 0x0497: /* Smile International */
1947/* switch (product) { */
1948/* case 0xc001: */
1949 sd->subtype = SmileIntlCamera;
1950/* break; */
1951/* } */
1952 break;
1953 case 0x0506: /* 3COM cameras */
1954/* switch (product) { */
1955/* case 0x00df: */
1956 sd->subtype = ThreeComHomeConnectLite;
1957/* break; */
1958/* } */
1959 break;
1960 case 0x0733: /* Rebadged ViewQuest (Intel) and ViewQuest cameras */
1961 switch (product) {
1962 case 0x0401:
1963 sd->subtype = IntelCreateAndShare;
1964 break;
1965 case 0x0402:
1966 sd->subtype = ViewQuestM318B;
1967 break;
1968 }
1969 break;
1970 case 0x1776: /* Arowana */
1971/* switch (product) { */
1972/* case 0x501c: */
1973 sd->subtype = Arowana300KCMOSCamera;
1974/* break; */
1975/* } */
1976 break;
1977 }
1978 cam = &gspca_dev->cam; 1924 cam = &gspca_dev->cam;
1979 cam->dev_name = (char *) id->driver_info;
1980 cam->epaddr = 0x01; 1925 cam->epaddr = 0x01;
1981 cam->cam_mode = vga_mode; 1926 cam->cam_mode = vga_mode;
1982 cam->nmodes = sizeof vga_mode / sizeof vga_mode[0]; 1927 cam->nmodes = sizeof vga_mode / sizeof vga_mode[0];
1928 sd->subtype = id->driver_info;
1983 sd->brightness = sd_ctrls[MY_BRIGHTNESS].qctrl.default_value; 1929 sd->brightness = sd_ctrls[MY_BRIGHTNESS].qctrl.default_value;
1984 sd->contrast = sd_ctrls[MY_CONTRAST].qctrl.default_value; 1930 sd->contrast = sd_ctrls[MY_CONTRAST].qctrl.default_value;
1985 sd->colors = sd_ctrls[MY_COLOR].qctrl.default_value; 1931 sd->colors = sd_ctrls[MY_COLOR].qctrl.default_value;
@@ -2183,15 +2129,14 @@ static const struct sd_desc sd_desc = {
2183}; 2129};
2184 2130
2185/* -- module initialisation -- */ 2131/* -- module initialisation -- */
2186#define DVNM(name) .driver_info = (kernel_ulong_t) name
2187static const __devinitdata struct usb_device_id device_table[] = { 2132static const __devinitdata struct usb_device_id device_table[] = {
2188 {USB_DEVICE(0x040a, 0x0002), DVNM("Kodak DVC-325")}, 2133 {USB_DEVICE(0x040a, 0x0002), .driver_info = KodakDVC325},
2189 {USB_DEVICE(0x0497, 0xc001), DVNM("Smile International")}, 2134 {USB_DEVICE(0x0497, 0xc001), .driver_info = SmileIntlCamera},
2190 {USB_DEVICE(0x0506, 0x00df), DVNM("3Com HomeConnect Lite")}, 2135 {USB_DEVICE(0x0506, 0x00df), .driver_info = ThreeComHomeConnectLite},
2191 {USB_DEVICE(0x0733, 0x0401), DVNM("Intel Create and Share")}, 2136 {USB_DEVICE(0x0733, 0x0401), .driver_info = IntelCreateAndShare},
2192 {USB_DEVICE(0x0733, 0x0402), DVNM("ViewQuest M318B")}, 2137 {USB_DEVICE(0x0733, 0x0402), .driver_info = ViewQuestM318B},
2193 {USB_DEVICE(0x1776, 0x501c), DVNM("Arowana 300K CMOS Camera")}, 2138 {USB_DEVICE(0x1776, 0x501c), .driver_info = Arowana300KCMOSCamera},
2194 {USB_DEVICE(0x0000, 0x0000), DVNM("MystFromOri Unknow Camera")}, 2139 {USB_DEVICE(0x0000, 0x0000), .driver_info = MystFromOriUnknownCamera},
2195 {} 2140 {}
2196}; 2141};
2197MODULE_DEVICE_TABLE(usb, device_table); 2142MODULE_DEVICE_TABLE(usb, device_table);
@@ -2216,7 +2161,7 @@ static int __init sd_mod_init(void)
2216{ 2161{
2217 if (usb_register(&sd_driver) < 0) 2162 if (usb_register(&sd_driver) < 0)
2218 return -1; 2163 return -1;
2219 PDEBUG(D_PROBE, "v%s registered", version); 2164 PDEBUG(D_PROBE, "registered");
2220 return 0; 2165 return 0;
2221} 2166}
2222static void __exit sd_mod_exit(void) 2167static void __exit sd_mod_exit(void)
diff --git a/drivers/media/video/gspca/spca505.c b/drivers/media/video/gspca/spca505.c
index ddea6e140aa8..3c2be80cbd65 100644
--- a/drivers/media/video/gspca/spca505.c
+++ b/drivers/media/video/gspca/spca505.c
@@ -23,9 +23,6 @@
23 23
24#include "gspca.h" 24#include "gspca.h"
25 25
26#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7)
27static const char version[] = "2.1.7";
28
29MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 26MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
30MODULE_DESCRIPTION("GSPCA/SPCA505 USB Camera Driver"); 27MODULE_DESCRIPTION("GSPCA/SPCA505 USB Camera Driver");
31MODULE_LICENSE("GPL"); 28MODULE_LICENSE("GPL");
@@ -34,10 +31,6 @@ MODULE_LICENSE("GPL");
34struct sd { 31struct sd {
35 struct gspca_dev gspca_dev; /* !! must be the first item */ 32 struct gspca_dev gspca_dev; /* !! must be the first item */
36 33
37 int buflen;
38 unsigned char tmpbuf[640 * 480 * 3 / 2]; /* YYUV per line */
39 unsigned char tmpbuf2[640 * 480 * 2]; /* YUYV */
40
41 unsigned char brightness; 34 unsigned char brightness;
42 35
43 char subtype; 36 char subtype;
@@ -67,29 +60,29 @@ static struct ctrl sd_ctrls[] = {
67}; 60};
68 61
69static struct v4l2_pix_format vga_mode[] = { 62static struct v4l2_pix_format vga_mode[] = {
70 {160, 120, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, 63 {160, 120, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
71 .bytesperline = 160 * 2, 64 .bytesperline = 160 * 3,
72 .sizeimage = 160 * 120 * 2, 65 .sizeimage = 160 * 120 * 3 / 2,
73 .colorspace = V4L2_COLORSPACE_SRGB, 66 .colorspace = V4L2_COLORSPACE_SRGB,
74 .priv = 5}, 67 .priv = 5},
75 {176, 144, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, 68 {176, 144, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
76 .bytesperline = 176 * 2, 69 .bytesperline = 176 * 3,
77 .sizeimage = 176 * 144 * 2, 70 .sizeimage = 176 * 144 * 3 / 2,
78 .colorspace = V4L2_COLORSPACE_SRGB, 71 .colorspace = V4L2_COLORSPACE_SRGB,
79 .priv = 4}, 72 .priv = 4},
80 {320, 240, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, 73 {320, 240, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
81 .bytesperline = 320 * 2, 74 .bytesperline = 320 * 3,
82 .sizeimage = 320 * 240 * 2, 75 .sizeimage = 320 * 240 * 3 / 2,
83 .colorspace = V4L2_COLORSPACE_SRGB, 76 .colorspace = V4L2_COLORSPACE_SRGB,
84 .priv = 2}, 77 .priv = 2},
85 {352, 288, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, 78 {352, 288, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
86 .bytesperline = 352 * 2, 79 .bytesperline = 352 * 3,
87 .sizeimage = 352 * 288 * 2, 80 .sizeimage = 352 * 288 * 3 / 2,
88 .colorspace = V4L2_COLORSPACE_SRGB, 81 .colorspace = V4L2_COLORSPACE_SRGB,
89 .priv = 1}, 82 .priv = 1},
90 {640, 480, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, 83 {640, 480, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
91 .bytesperline = 640 * 2, 84 .bytesperline = 640 * 3,
92 .sizeimage = 640 * 480 * 2, 85 .sizeimage = 640 * 480 * 3 / 2,
93 .colorspace = V4L2_COLORSPACE_SRGB, 86 .colorspace = V4L2_COLORSPACE_SRGB,
94 .priv = 0}, 87 .priv = 0},
95}; 88};
@@ -641,33 +634,11 @@ static int sd_config(struct gspca_dev *gspca_dev,
641{ 634{
642 struct sd *sd = (struct sd *) gspca_dev; 635 struct sd *sd = (struct sd *) gspca_dev;
643 struct cam *cam; 636 struct cam *cam;
644 __u16 vendor;
645 __u16 product;
646
647 vendor = id->idVendor;
648 product = id->idProduct;
649 switch (vendor) {
650 case 0x041e: /* Creative cameras */
651/* switch (product) { */
652/* case 0x401d: * here505b */
653 sd->subtype = Nxultra;
654/* break; */
655/* } */
656 break;
657 case 0x0733: /* Rebadged ViewQuest (Intel) and ViewQuest cameras */
658/* switch (product) { */
659/* case 0x0430: */
660/* fixme: may be UsbGrabberPV321 BRIDGE_SPCA506 SENSOR_SAA7113 */
661 sd->subtype = IntelPCCameraPro;
662/* break; */
663/* } */
664 break;
665 }
666 637
667 cam = &gspca_dev->cam; 638 cam = &gspca_dev->cam;
668 cam->dev_name = (char *) id->driver_info;
669 cam->epaddr = 0x01; 639 cam->epaddr = 0x01;
670 cam->cam_mode = vga_mode; 640 cam->cam_mode = vga_mode;
641 sd->subtype = id->driver_info;
671 if (sd->subtype != IntelPCCameraPro) 642 if (sd->subtype != IntelPCCameraPro)
672 cam->nmodes = sizeof vga_mode / sizeof vga_mode[0]; 643 cam->nmodes = sizeof vga_mode / sizeof vga_mode[0];
673 else /* no 640x480 for IntelPCCameraPro */ 644 else /* no 640x480 for IntelPCCameraPro */
@@ -785,77 +756,30 @@ static void sd_close(struct gspca_dev *gspca_dev)
785 reg_write(gspca_dev->dev, 0x05, 0x11, 0xf); 756 reg_write(gspca_dev->dev, 0x05, 0x11, 0xf);
786} 757}
787 758
788/* convert YYUV per line to YUYV (YUV 4:2:2) */
789static void yyuv_decode(unsigned char *out,
790 unsigned char *in,
791 int width,
792 int height)
793{
794 unsigned char *Ui, *Vi, *yi, *yi1;
795 unsigned char *out1;
796 int i, j;
797
798 yi = in;
799 for (i = height / 2; --i >= 0; ) {
800 out1 = out + width * 2; /* next line */
801 yi1 = yi + width;
802 Ui = yi1 + width;
803 Vi = Ui + width / 2;
804 for (j = width / 2; --j >= 0; ) {
805 *out++ = 128 + *yi++;
806 *out++ = 128 + *Ui;
807 *out++ = 128 + *yi++;
808 *out++ = 128 + *Vi;
809
810 *out1++ = 128 + *yi1++;
811 *out1++ = 128 + *Ui++;
812 *out1++ = 128 + *yi1++;
813 *out1++ = 128 + *Vi++;
814 }
815 yi += width * 2;
816 out = out1;
817 }
818}
819
820static void sd_pkt_scan(struct gspca_dev *gspca_dev, 759static void sd_pkt_scan(struct gspca_dev *gspca_dev,
821 struct gspca_frame *frame, /* target */ 760 struct gspca_frame *frame, /* target */
822 __u8 *data, /* isoc packet */ 761 __u8 *data, /* isoc packet */
823 int len) /* iso packet length */ 762 int len) /* iso packet length */
824{ 763{
825 struct sd *sd = (struct sd *) gspca_dev;
826
827 switch (data[0]) { 764 switch (data[0]) {
828 case 0: /* start of frame */ 765 case 0: /* start of frame */
829 if (gspca_dev->last_packet_type == FIRST_PACKET) { 766 frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame,
830 yyuv_decode(sd->tmpbuf2, sd->tmpbuf, 767 data, 0);
831 gspca_dev->width,
832 gspca_dev->height);
833 frame = gspca_frame_add(gspca_dev,
834 LAST_PACKET,
835 frame,
836 sd->tmpbuf2,
837 gspca_dev->width
838 * gspca_dev->height
839 * 2);
840 }
841 gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
842 data, 0);
843 data += SPCA50X_OFFSET_DATA; 768 data += SPCA50X_OFFSET_DATA;
844 len -= SPCA50X_OFFSET_DATA; 769 len -= SPCA50X_OFFSET_DATA;
845 if (len > 0) 770 gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
846 memcpy(sd->tmpbuf, data, len); 771 data, len);
847 else 772 break;
848 len = 0;
849 sd->buflen = len;
850 return;
851 case 0xff: /* drop */ 773 case 0xff: /* drop */
852/* gspca_dev->last_packet_type = DISCARD_PACKET; */ 774/* gspca_dev->last_packet_type = DISCARD_PACKET; */
853 return; 775 break;
776 default:
777 data += 1;
778 len -= 1;
779 gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
780 data, len);
781 break;
854 } 782 }
855 data += 1;
856 len -= 1;
857 memcpy(&sd->tmpbuf[sd->buflen], data, len);
858 sd->buflen += len;
859} 783}
860 784
861static void setbrightness(struct gspca_dev *gspca_dev) 785static void setbrightness(struct gspca_dev *gspca_dev)
@@ -910,10 +834,10 @@ static const struct sd_desc sd_desc = {
910}; 834};
911 835
912/* -- module initialisation -- */ 836/* -- module initialisation -- */
913#define DVNM(name) .driver_info = (kernel_ulong_t) name
914static const __devinitdata struct usb_device_id device_table[] = { 837static const __devinitdata struct usb_device_id device_table[] = {
915 {USB_DEVICE(0x041e, 0x401d), DVNM("Creative Webcam NX ULTRA")}, 838 {USB_DEVICE(0x041e, 0x401d), .driver_info = Nxultra},
916 {USB_DEVICE(0x0733, 0x0430), DVNM("Intel PC Camera Pro")}, 839 {USB_DEVICE(0x0733, 0x0430), .driver_info = IntelPCCameraPro},
840/*fixme: may be UsbGrabberPV321 BRIDGE_SPCA506 SENSOR_SAA7113 */
917 {} 841 {}
918}; 842};
919MODULE_DEVICE_TABLE(usb, device_table); 843MODULE_DEVICE_TABLE(usb, device_table);
@@ -938,7 +862,7 @@ static int __init sd_mod_init(void)
938{ 862{
939 if (usb_register(&sd_driver) < 0) 863 if (usb_register(&sd_driver) < 0)
940 return -1; 864 return -1;
941 PDEBUG(D_PROBE, "v%s registered", version); 865 PDEBUG(D_PROBE, "registered");
942 return 0; 866 return 0;
943} 867}
944static void __exit sd_mod_exit(void) 868static void __exit sd_mod_exit(void)
diff --git a/drivers/media/video/gspca/spca506.c b/drivers/media/video/gspca/spca506.c
index 143203c1fd9f..6fe715c80ad2 100644
--- a/drivers/media/video/gspca/spca506.c
+++ b/drivers/media/video/gspca/spca506.c
@@ -25,9 +25,6 @@
25 25
26#include "gspca.h" 26#include "gspca.h"
27 27
28#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7)
29static const char version[] = "2.1.7";
30
31MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 28MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
32MODULE_DESCRIPTION("GSPCA/SPCA506 USB Camera Driver"); 29MODULE_DESCRIPTION("GSPCA/SPCA506 USB Camera Driver");
33MODULE_LICENSE("GPL"); 30MODULE_LICENSE("GPL");
@@ -36,10 +33,6 @@ MODULE_LICENSE("GPL");
36struct sd { 33struct sd {
37 struct gspca_dev gspca_dev; /* !! must be the first item */ 34 struct gspca_dev gspca_dev; /* !! must be the first item */
38 35
39 int buflen;
40 __u8 tmpbuf[640 * 480 * 3]; /* YYUV per line */
41 __u8 tmpbuf2[640 * 480 * 2]; /* YUYV */
42
43 unsigned char brightness; 36 unsigned char brightness;
44 unsigned char contrast; 37 unsigned char contrast;
45 unsigned char colors; 38 unsigned char colors;
@@ -118,29 +111,29 @@ static struct ctrl sd_ctrls[] = {
118}; 111};
119 112
120static struct v4l2_pix_format vga_mode[] = { 113static struct v4l2_pix_format vga_mode[] = {
121 {160, 120, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, 114 {160, 120, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
122 .bytesperline = 160 * 2, 115 .bytesperline = 160 * 3,
123 .sizeimage = 160 * 120 * 2, 116 .sizeimage = 160 * 120 * 3 / 2,
124 .colorspace = V4L2_COLORSPACE_SRGB, 117 .colorspace = V4L2_COLORSPACE_SRGB,
125 .priv = 5}, 118 .priv = 5},
126 {176, 144, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, 119 {176, 144, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
127 .bytesperline = 176 * 2, 120 .bytesperline = 176 * 3,
128 .sizeimage = 176 * 144 * 2, 121 .sizeimage = 176 * 144 * 3 / 2,
129 .colorspace = V4L2_COLORSPACE_SRGB, 122 .colorspace = V4L2_COLORSPACE_SRGB,
130 .priv = 4}, 123 .priv = 4},
131 {320, 240, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, 124 {320, 240, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
132 .bytesperline = 320 * 2, 125 .bytesperline = 320 * 3,
133 .sizeimage = 320 * 240 * 2, 126 .sizeimage = 320 * 240 * 3 / 2,
134 .colorspace = V4L2_COLORSPACE_SRGB, 127 .colorspace = V4L2_COLORSPACE_SRGB,
135 .priv = 2}, 128 .priv = 2},
136 {352, 288, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, 129 {352, 288, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
137 .bytesperline = 352 * 2, 130 .bytesperline = 352 * 3,
138 .sizeimage = 352 * 288 * 2, 131 .sizeimage = 352 * 288 * 3 / 2,
139 .colorspace = V4L2_COLORSPACE_SRGB, 132 .colorspace = V4L2_COLORSPACE_SRGB,
140 .priv = 1}, 133 .priv = 1},
141 {640, 480, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, 134 {640, 480, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
142 .bytesperline = 640 * 2, 135 .bytesperline = 640 * 3,
143 .sizeimage = 640 * 480 * 2, 136 .sizeimage = 640 * 480 * 3 / 2,
144 .colorspace = V4L2_COLORSPACE_SRGB, 137 .colorspace = V4L2_COLORSPACE_SRGB,
145 .priv = 0}, 138 .priv = 0},
146}; 139};
@@ -310,7 +303,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
310 struct cam *cam; 303 struct cam *cam;
311 304
312 cam = &gspca_dev->cam; 305 cam = &gspca_dev->cam;
313 cam->dev_name = (char *) id->driver_info;
314 cam->epaddr = 0x01; 306 cam->epaddr = 0x01;
315 cam->cam_mode = vga_mode; 307 cam->cam_mode = vga_mode;
316 cam->nmodes = sizeof vga_mode / sizeof vga_mode[0]; 308 cam->nmodes = sizeof vga_mode / sizeof vga_mode[0];
@@ -576,77 +568,30 @@ static void sd_close(struct gspca_dev *gspca_dev)
576{ 568{
577} 569}
578 570
579/* convert YYUV per line to YUYV (YUV 4:2:2) */
580static void yyuv_decode(unsigned char *out,
581 unsigned char *in,
582 int width,
583 int height)
584{
585 unsigned char *Ui, *Vi, *yi, *yi1;
586 unsigned char *out1;
587 int i, j;
588
589 yi = in;
590 for (i = height / 2; --i >= 0; ) {
591 out1 = out + width * 2; /* next line */
592 yi1 = yi + width;
593 Ui = yi1 + width;
594 Vi = Ui + width / 2;
595 for (j = width / 2; --j >= 0; ) {
596 *out++ = 128 + *yi++;
597 *out++ = 128 + *Ui;
598 *out++ = 128 + *yi++;
599 *out++ = 128 + *Vi;
600
601 *out1++ = 128 + *yi1++;
602 *out1++ = 128 + *Ui++;
603 *out1++ = 128 + *yi1++;
604 *out1++ = 128 + *Vi++;
605 }
606 yi += width * 2;
607 out = out1;
608 }
609}
610
611static void sd_pkt_scan(struct gspca_dev *gspca_dev, 571static void sd_pkt_scan(struct gspca_dev *gspca_dev,
612 struct gspca_frame *frame, /* target */ 572 struct gspca_frame *frame, /* target */
613 __u8 *data, /* isoc packet */ 573 __u8 *data, /* isoc packet */
614 int len) /* iso packet length */ 574 int len) /* iso packet length */
615{ 575{
616 struct sd *sd = (struct sd *) gspca_dev;
617
618 switch (data[0]) { 576 switch (data[0]) {
619 case 0: /* start of frame */ 577 case 0: /* start of frame */
620 if (gspca_dev->last_packet_type == FIRST_PACKET) { 578 frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame,
621 yyuv_decode(sd->tmpbuf2, sd->tmpbuf, 579 data, 0);
622 gspca_dev->width,
623 gspca_dev->height);
624 frame = gspca_frame_add(gspca_dev,
625 LAST_PACKET,
626 frame,
627 sd->tmpbuf2,
628 gspca_dev->width
629 * gspca_dev->height
630 * 2);
631 }
632 gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
633 data, 0);
634 data += SPCA50X_OFFSET_DATA; 580 data += SPCA50X_OFFSET_DATA;
635 len -= SPCA50X_OFFSET_DATA; 581 len -= SPCA50X_OFFSET_DATA;
636 if (len > 0) 582 gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
637 memcpy(sd->tmpbuf, data, len); 583 data, len);
638 else 584 break;
639 len = 0;
640 sd->buflen = len;
641 return;
642 case 0xff: /* drop */ 585 case 0xff: /* drop */
643/* gspca_dev->last_packet_type = DISCARD_PACKET; */ 586/* gspca_dev->last_packet_type = DISCARD_PACKET; */
644 return; 587 break;
588 default:
589 data += 1;
590 len -= 1;
591 gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
592 data, len);
593 break;
645 } 594 }
646 data += 1;
647 len -= 1;
648 memcpy(&sd->tmpbuf[sd->buflen], data, len);
649 sd->buflen += len;
650} 595}
651 596
652static void setbrightness(struct gspca_dev *gspca_dev) 597static void setbrightness(struct gspca_dev *gspca_dev)
@@ -804,12 +749,12 @@ static struct sd_desc sd_desc = {
804}; 749};
805 750
806/* -- module initialisation -- */ 751/* -- module initialisation -- */
807#define DVNM(name) .driver_info = (kernel_ulong_t) name
808static __devinitdata struct usb_device_id device_table[] = { 752static __devinitdata struct usb_device_id device_table[] = {
809 {USB_DEVICE(0x06e1, 0xa190), DVNM("ADS Instant VCD")}, 753 {USB_DEVICE(0x06e1, 0xa190)},
810/* {USB_DEVICE(0x0733, 0x0430), DVNM("UsbGrabber PV321c")}, */ 754/*fixme: may be IntelPCCameraPro BRIDGE_SPCA505
811 {USB_DEVICE(0x0734, 0x043b), DVNM("3DeMon USB Capture aka")}, 755 {USB_DEVICE(0x0733, 0x0430)}, */
812 {USB_DEVICE(0x99fa, 0x8988), DVNM("Grandtec V.cap")}, 756 {USB_DEVICE(0x0734, 0x043b)},
757 {USB_DEVICE(0x99fa, 0x8988)},
813 {} 758 {}
814}; 759};
815MODULE_DEVICE_TABLE(usb, device_table); 760MODULE_DEVICE_TABLE(usb, device_table);
@@ -834,7 +779,7 @@ static int __init sd_mod_init(void)
834{ 779{
835 if (usb_register(&sd_driver) < 0) 780 if (usb_register(&sd_driver) < 0)
836 return -1; 781 return -1;
837 PDEBUG(D_PROBE, "v%s registered", version); 782 PDEBUG(D_PROBE, "registered");
838 return 0; 783 return 0;
839} 784}
840static void __exit sd_mod_exit(void) 785static void __exit sd_mod_exit(void)
diff --git a/drivers/media/video/gspca/spca508.c b/drivers/media/video/gspca/spca508.c
index d8cd93866a4a..b608a27ad115 100644
--- a/drivers/media/video/gspca/spca508.c
+++ b/drivers/media/video/gspca/spca508.c
@@ -22,9 +22,6 @@
22 22
23#include "gspca.h" 23#include "gspca.h"
24 24
25#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7)
26static const char version[] = "2.1.7";
27
28MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 25MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
29MODULE_DESCRIPTION("GSPCA/SPCA508 USB Camera Driver"); 26MODULE_DESCRIPTION("GSPCA/SPCA508 USB Camera Driver");
30MODULE_LICENSE("GPL"); 27MODULE_LICENSE("GPL");
@@ -33,10 +30,6 @@ MODULE_LICENSE("GPL");
33struct sd { 30struct sd {
34 struct gspca_dev gspca_dev; /* !! must be the first item */ 31 struct gspca_dev gspca_dev; /* !! must be the first item */
35 32
36 int buflen;
37 unsigned char tmpbuf[352 * 288 * 3 / 2]; /* YUVY per line */
38 unsigned char tmpbuf2[352 * 288 * 2]; /* YUYV */
39
40 unsigned char brightness; 33 unsigned char brightness;
41 34
42 char subtype; 35 char subtype;
@@ -71,23 +64,23 @@ static struct ctrl sd_ctrls[] = {
71 64
72static struct v4l2_pix_format sif_mode[] = { 65static struct v4l2_pix_format sif_mode[] = {
73 {160, 120, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, 66 {160, 120, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
74 .bytesperline = 160 * 2, 67 .bytesperline = 160 * 3,
75 .sizeimage = 160 * 120 * 2, 68 .sizeimage = 160 * 120 * 3 / 2,
76 .colorspace = V4L2_COLORSPACE_SRGB, 69 .colorspace = V4L2_COLORSPACE_SRGB,
77 .priv = 3}, 70 .priv = 3},
78 {176, 144, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, 71 {176, 144, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
79 .bytesperline = 176 * 2, 72 .bytesperline = 176 * 3,
80 .sizeimage = 176 * 144 * 2, 73 .sizeimage = 176 * 144 * 3 / 2,
81 .colorspace = V4L2_COLORSPACE_SRGB, 74 .colorspace = V4L2_COLORSPACE_SRGB,
82 .priv = 2}, 75 .priv = 2},
83 {320, 240, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, 76 {320, 240, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
84 .bytesperline = 320 * 2, 77 .bytesperline = 320 * 3,
85 .sizeimage = 320 * 240 * 2, 78 .sizeimage = 320 * 240 * 3 / 2,
86 .colorspace = V4L2_COLORSPACE_SRGB, 79 .colorspace = V4L2_COLORSPACE_SRGB,
87 .priv = 1}, 80 .priv = 1},
88 {352, 288, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, 81 {352, 288, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
89 .bytesperline = 352 * 2, 82 .bytesperline = 352 * 3,
90 .sizeimage = 352 * 288 * 2, 83 .sizeimage = 352 * 288 * 3 / 2,
91 .colorspace = V4L2_COLORSPACE_SRGB, 84 .colorspace = V4L2_COLORSPACE_SRGB,
92 .priv = 0}, 85 .priv = 0},
93}; 86};
@@ -1476,58 +1469,8 @@ static int sd_config(struct gspca_dev *gspca_dev,
1476{ 1469{
1477 struct sd *sd = (struct sd *) gspca_dev; 1470 struct sd *sd = (struct sd *) gspca_dev;
1478 struct cam *cam; 1471 struct cam *cam;
1479 __u16 product;
1480 int data1, data2; 1472 int data1, data2;
1481 1473
1482 product = id->idProduct;
1483 switch (id->idVendor) {
1484 case 0x0130: /* Clone webcam */
1485/* switch (product) { */
1486/* case 0x0130: */
1487 sd->subtype = HamaUSBSightcam; /* same as Hama 0010 */
1488/* break; */
1489/* } */
1490 break;
1491 case 0x041e: /* Creative cameras */
1492/* switch (product) { */
1493/* case 0x4018: */
1494 sd->subtype = CreativeVista;
1495/* break; */
1496/* } */
1497 break;
1498 case 0x0461: /* MicroInnovation */
1499/* switch (product) { */
1500/* case 0x0815: */
1501 sd->subtype = MicroInnovationIC200;
1502/* break; */
1503/* } */
1504 break;
1505 case 0x0733: /* Rebadged ViewQuest (Intel) and ViewQuest cameras */
1506/* switch (product) { */
1507/* case 0x110: */
1508 sd->subtype = ViewQuestVQ110;
1509/* break; */
1510/* } */
1511 break;
1512 case 0x0af9: /* Hama cameras */
1513 switch (product) {
1514 case 0x0010:
1515 sd->subtype = HamaUSBSightcam;
1516 break;
1517 case 0x0011:
1518 sd->subtype = HamaUSBSightcam2;
1519 break;
1520 }
1521 break;
1522 case 0x8086: /* Intel */
1523/* switch (product) { */
1524/* case 0x0110: */
1525 sd->subtype = IntelEasyPCCamera;
1526/* break; */
1527/* } */
1528 break;
1529 }
1530
1531 /* Read from global register the USB product and vendor IDs, just to 1474 /* Read from global register the USB product and vendor IDs, just to
1532 * prove that we can communicate with the device. This works, which 1475 * prove that we can communicate with the device. This works, which
1533 * confirms at we are communicating properly and that the device 1476 * confirms at we are communicating properly and that the device
@@ -1544,10 +1487,11 @@ static int sd_config(struct gspca_dev *gspca_dev,
1544 PDEBUG(D_PROBE, "Window 1 average luminance: %d", data1); 1487 PDEBUG(D_PROBE, "Window 1 average luminance: %d", data1);
1545 1488
1546 cam = &gspca_dev->cam; 1489 cam = &gspca_dev->cam;
1547 cam->dev_name = (char *) id->driver_info;
1548 cam->epaddr = 0x01; 1490 cam->epaddr = 0x01;
1549 cam->cam_mode = sif_mode; 1491 cam->cam_mode = sif_mode;
1550 cam->nmodes = ARRAY_SIZE(sif_mode); 1492 cam->nmodes = ARRAY_SIZE(sif_mode);
1493
1494 sd->subtype = id->driver_info;
1551 sd->brightness = BRIGHTNESS_DEF; 1495 sd->brightness = BRIGHTNESS_DEF;
1552 1496
1553 switch (sd->subtype) { 1497 switch (sd->subtype) {
@@ -1619,77 +1563,30 @@ static void sd_close(struct gspca_dev *gspca_dev)
1619{ 1563{
1620} 1564}
1621 1565
1622/* convert YUVY per line to YUYV (YUV 4:2:2) */
1623static void yuvy_decode(unsigned char *out,
1624 unsigned char *in,
1625 int width,
1626 int height)
1627{
1628 unsigned char *Ui, *Vi, *yi, *yi1;
1629 unsigned char *out1;
1630 int i, j;
1631
1632 yi = in;
1633 for (i = height / 2; --i >= 0; ) {
1634 out1 = out + width * 2; /* next line */
1635 Ui = yi + width;
1636 Vi = Ui + width / 2;
1637 yi1 = Vi + width / 2;
1638 for (j = width / 2; --j >= 0; ) {
1639 *out++ = 128 + *yi++;
1640 *out++ = 128 + *Ui;
1641 *out++ = 128 + *yi++;
1642 *out++ = 128 + *Vi;
1643
1644 *out1++ = 128 + *yi1++;
1645 *out1++ = 128 + *Ui++;
1646 *out1++ = 128 + *yi1++;
1647 *out1++ = 128 + *Vi++;
1648 }
1649 yi += width * 2;
1650 out = out1;
1651 }
1652}
1653
1654static void sd_pkt_scan(struct gspca_dev *gspca_dev, 1566static void sd_pkt_scan(struct gspca_dev *gspca_dev,
1655 struct gspca_frame *frame, /* target */ 1567 struct gspca_frame *frame, /* target */
1656 __u8 *data, /* isoc packet */ 1568 __u8 *data, /* isoc packet */
1657 int len) /* iso packet length */ 1569 int len) /* iso packet length */
1658{ 1570{
1659 struct sd *sd = (struct sd *) gspca_dev;
1660
1661 switch (data[0]) { 1571 switch (data[0]) {
1662 case 0: /* start of frame */ 1572 case 0: /* start of frame */
1663 if (gspca_dev->last_packet_type == FIRST_PACKET) { 1573 frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame,
1664 yuvy_decode(sd->tmpbuf2, sd->tmpbuf, 1574 data, 0);
1665 gspca_dev->width,
1666 gspca_dev->height);
1667 frame = gspca_frame_add(gspca_dev,
1668 LAST_PACKET,
1669 frame,
1670 sd->tmpbuf2,
1671 gspca_dev->width
1672 * gspca_dev->height
1673 * 2);
1674 }
1675 gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
1676 data, 0);
1677 data += SPCA508_OFFSET_DATA; 1575 data += SPCA508_OFFSET_DATA;
1678 len -= SPCA508_OFFSET_DATA; 1576 len -= SPCA508_OFFSET_DATA;
1679 if (len > 0) 1577 gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
1680 memcpy(sd->tmpbuf, data, len); 1578 data, len);
1681 else 1579 break;
1682 len = 0;
1683 sd->buflen = len;
1684 return;
1685 case 0xff: /* drop */ 1580 case 0xff: /* drop */
1686/* gspca_dev->last_packet_type = DISCARD_PACKET; */ 1581/* gspca_dev->last_packet_type = DISCARD_PACKET; */
1687 return; 1582 break;
1583 default:
1584 data += 1;
1585 len -= 1;
1586 gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
1587 data, len);
1588 break;
1688 } 1589 }
1689 data += 1;
1690 len -= 1;
1691 memcpy(&sd->tmpbuf[sd->buflen], data, len);
1692 sd->buflen += len;
1693} 1590}
1694 1591
1695static void setbrightness(struct gspca_dev *gspca_dev) 1592static void setbrightness(struct gspca_dev *gspca_dev)
@@ -1745,15 +1642,14 @@ static const struct sd_desc sd_desc = {
1745}; 1642};
1746 1643
1747/* -- module initialisation -- */ 1644/* -- module initialisation -- */
1748#define DVNM(name) .driver_info = (kernel_ulong_t) name
1749static const __devinitdata struct usb_device_id device_table[] = { 1645static const __devinitdata struct usb_device_id device_table[] = {
1750 {USB_DEVICE(0x0130, 0x0130), DVNM("Clone Digital Webcam 11043")}, 1646 {USB_DEVICE(0x0130, 0x0130), .driver_info = HamaUSBSightcam},
1751 {USB_DEVICE(0x041e, 0x4018), DVNM("Creative Webcam Vista (PD1100)")}, 1647 {USB_DEVICE(0x041e, 0x4018), .driver_info = CreativeVista},
1752 {USB_DEVICE(0x0461, 0x0815), DVNM("Micro Innovation IC200")}, 1648 {USB_DEVICE(0x0461, 0x0815), .driver_info = MicroInnovationIC200},
1753 {USB_DEVICE(0x0733, 0x0110), DVNM("ViewQuest VQ110")}, 1649 {USB_DEVICE(0x0733, 0x0110), .driver_info = ViewQuestVQ110},
1754 {USB_DEVICE(0x0af9, 0x0010), DVNM("Hama USB Sightcam 100")}, 1650 {USB_DEVICE(0x0af9, 0x0010), .driver_info = HamaUSBSightcam},
1755 {USB_DEVICE(0x0af9, 0x0011), DVNM("Hama USB Sightcam 100")}, 1651 {USB_DEVICE(0x0af9, 0x0011), .driver_info = HamaUSBSightcam2},
1756 {USB_DEVICE(0x8086, 0x0110), DVNM("Intel Easy PC Camera")}, 1652 {USB_DEVICE(0x8086, 0x0110), .driver_info = IntelEasyPCCamera},
1757 {} 1653 {}
1758}; 1654};
1759MODULE_DEVICE_TABLE(usb, device_table); 1655MODULE_DEVICE_TABLE(usb, device_table);
@@ -1778,7 +1674,7 @@ static int __init sd_mod_init(void)
1778{ 1674{
1779 if (usb_register(&sd_driver) < 0) 1675 if (usb_register(&sd_driver) < 0)
1780 return -1; 1676 return -1;
1781 PDEBUG(D_PROBE, "v%s registered", version); 1677 PDEBUG(D_PROBE, "registered");
1782 return 0; 1678 return 0;
1783} 1679}
1784static void __exit sd_mod_exit(void) 1680static void __exit sd_mod_exit(void)
diff --git a/drivers/media/video/gspca/spca561.c b/drivers/media/video/gspca/spca561.c
index b659bd0f788d..a26174508cb9 100644
--- a/drivers/media/video/gspca/spca561.c
+++ b/drivers/media/video/gspca/spca561.c
@@ -24,9 +24,6 @@
24 24
25#include "gspca.h" 25#include "gspca.h"
26 26
27#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7)
28static const char version[] = "2.1.7";
29
30MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 27MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
31MODULE_DESCRIPTION("GSPCA/SPCA561 USB Camera Driver"); 28MODULE_DESCRIPTION("GSPCA/SPCA561 USB Camera Driver");
32MODULE_LICENSE("GPL"); 29MODULE_LICENSE("GPL");
@@ -582,35 +579,15 @@ static int sd_config(struct gspca_dev *gspca_dev,
582 PDEBUG(D_PROBE, "Bad vendor / product from device"); 579 PDEBUG(D_PROBE, "Bad vendor / product from device");
583 return -EINVAL; 580 return -EINVAL;
584 } 581 }
585 switch (product) { 582
586 case 0x0928:
587 case 0x0929:
588 case 0x092a:
589 case 0x092b:
590 case 0x092c:
591 case 0x092d:
592 case 0x092e:
593 case 0x092f:
594 case 0x403b:
595 sd->chip_revision = Rev012A;
596 break;
597 default:
598/* case 0x0561:
599 case 0x0815: * ?? in spca508.c
600 case 0x401a:
601 case 0x7004:
602 case 0x7e50:
603 case 0xa001:
604 case 0xcdee: */
605 sd->chip_revision = Rev072A;
606 break;
607 }
608 cam = &gspca_dev->cam; 583 cam = &gspca_dev->cam;
609 cam->dev_name = (char *) id->driver_info; 584 cam->dev_name = (char *) id->driver_info;
610 cam->epaddr = 0x01; 585 cam->epaddr = 0x01;
611 gspca_dev->nbalt = 7 + 1; /* choose alternate 7 first */ 586 gspca_dev->nbalt = 7 + 1; /* choose alternate 7 first */
612 cam->cam_mode = sif_mode; 587 cam->cam_mode = sif_mode;
613 cam->nmodes = sizeof sif_mode / sizeof sif_mode[0]; 588 cam->nmodes = sizeof sif_mode / sizeof sif_mode[0];
589
590 sd->chip_revision = id->driver_info;
614 sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value; 591 sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value;
615 sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value; 592 sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value;
616 sd->autogain = sd_ctrls[SD_AUTOGAIN].qctrl.default_value; 593 sd->autogain = sd_ctrls[SD_AUTOGAIN].qctrl.default_value;
@@ -997,23 +974,22 @@ static const struct sd_desc sd_desc = {
997}; 974};
998 975
999/* -- module initialisation -- */ 976/* -- module initialisation -- */
1000#define DVNM(name) .driver_info = (kernel_ulong_t) name
1001static const __devinitdata struct usb_device_id device_table[] = { 977static const __devinitdata struct usb_device_id device_table[] = {
1002 {USB_DEVICE(0x041e, 0x401a), DVNM("Creative Webcam Vista (PD1100)")}, 978 {USB_DEVICE(0x041e, 0x401a), .driver_info = Rev072A},
1003 {USB_DEVICE(0x041e, 0x403b), DVNM("Creative Webcam Vista (VF0010)")}, 979 {USB_DEVICE(0x041e, 0x403b), .driver_info = Rev012A},
1004 {USB_DEVICE(0x0458, 0x7004), DVNM("Genius VideoCAM Express V2")}, 980 {USB_DEVICE(0x0458, 0x7004), .driver_info = Rev072A},
1005 {USB_DEVICE(0x046d, 0x0928), DVNM("Logitech QC Express Etch2")}, 981 {USB_DEVICE(0x046d, 0x0928), .driver_info = Rev012A},
1006 {USB_DEVICE(0x046d, 0x0929), DVNM("Labtec Webcam Elch2")}, 982 {USB_DEVICE(0x046d, 0x0929), .driver_info = Rev012A},
1007 {USB_DEVICE(0x046d, 0x092a), DVNM("Logitech QC for Notebook")}, 983 {USB_DEVICE(0x046d, 0x092a), .driver_info = Rev012A},
1008 {USB_DEVICE(0x046d, 0x092b), DVNM("Labtec Webcam Plus")}, 984 {USB_DEVICE(0x046d, 0x092b), .driver_info = Rev012A},
1009 {USB_DEVICE(0x046d, 0x092c), DVNM("Logitech QC chat Elch2")}, 985 {USB_DEVICE(0x046d, 0x092c), .driver_info = Rev012A},
1010 {USB_DEVICE(0x046d, 0x092d), DVNM("Logitech QC Elch2")}, 986 {USB_DEVICE(0x046d, 0x092d), .driver_info = Rev012A},
1011 {USB_DEVICE(0x046d, 0x092e), DVNM("Logitech QC Elch2")}, 987 {USB_DEVICE(0x046d, 0x092e), .driver_info = Rev012A},
1012 {USB_DEVICE(0x046d, 0x092f), DVNM("Logitech QC Elch2")}, 988 {USB_DEVICE(0x046d, 0x092f), .driver_info = Rev012A},
1013 {USB_DEVICE(0x04fc, 0x0561), DVNM("Flexcam 100")}, 989 {USB_DEVICE(0x04fc, 0x0561), .driver_info = Rev072A},
1014 {USB_DEVICE(0x060b, 0xa001), DVNM("Maxell Compact Pc PM3")}, 990 {USB_DEVICE(0x060b, 0xa001), .driver_info = Rev072A},
1015 {USB_DEVICE(0x10fd, 0x7e50), DVNM("FlyCam Usb 100")}, 991 {USB_DEVICE(0x10fd, 0x7e50), .driver_info = Rev072A},
1016 {USB_DEVICE(0xabcd, 0xcdee), DVNM("Petcam")}, 992 {USB_DEVICE(0xabcd, 0xcdee), .driver_info = Rev072A},
1017 {} 993 {}
1018}; 994};
1019 995
@@ -1039,7 +1015,7 @@ static int __init sd_mod_init(void)
1039{ 1015{
1040 if (usb_register(&sd_driver) < 0) 1016 if (usb_register(&sd_driver) < 0)
1041 return -1; 1017 return -1;
1042 PDEBUG(D_PROBE, "v%s registered", version); 1018 PDEBUG(D_PROBE, "registered");
1043 return 0; 1019 return 0;
1044} 1020}
1045static void __exit sd_mod_exit(void) 1021static void __exit sd_mod_exit(void)
diff --git a/drivers/media/video/gspca/stk014.c b/drivers/media/video/gspca/stk014.c
index c78ee0d3e59b..16219cf6a6d5 100644
--- a/drivers/media/video/gspca/stk014.c
+++ b/drivers/media/video/gspca/stk014.c
@@ -23,9 +23,6 @@
23#include "gspca.h" 23#include "gspca.h"
24#include "jpeg.h" 24#include "jpeg.h"
25 25
26#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7)
27static const char version[] = "2.1.7";
28
29MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>"); 26MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>");
30MODULE_DESCRIPTION("Syntek DV4000 (STK014) USB Camera Driver"); 27MODULE_DESCRIPTION("Syntek DV4000 (STK014) USB Camera Driver");
31MODULE_LICENSE("GPL"); 28MODULE_LICENSE("GPL");
@@ -299,7 +296,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
299 struct sd *sd = (struct sd *) gspca_dev; 296 struct sd *sd = (struct sd *) gspca_dev;
300 struct cam *cam = &gspca_dev->cam; 297 struct cam *cam = &gspca_dev->cam;
301 298
302 cam->dev_name = (char *) id->driver_info;
303 cam->epaddr = 0x02; 299 cam->epaddr = 0x02;
304 gspca_dev->cam.cam_mode = vga_mode; 300 gspca_dev->cam.cam_mode = vga_mode;
305 gspca_dev->cam.nmodes = ARRAY_SIZE(vga_mode); 301 gspca_dev->cam.nmodes = ARRAY_SIZE(vga_mode);
@@ -549,9 +545,8 @@ static const struct sd_desc sd_desc = {
549}; 545};
550 546
551/* -- module initialisation -- */ 547/* -- module initialisation -- */
552#define DVNM(name) .driver_info = (kernel_ulong_t) name
553static const __devinitdata struct usb_device_id device_table[] = { 548static const __devinitdata struct usb_device_id device_table[] = {
554 {USB_DEVICE(0x05e1, 0x0893), DVNM("Syntek DV4000")}, 549 {USB_DEVICE(0x05e1, 0x0893)},
555 {} 550 {}
556}; 551};
557MODULE_DEVICE_TABLE(usb, device_table); 552MODULE_DEVICE_TABLE(usb, device_table);
@@ -576,7 +571,7 @@ static int __init sd_mod_init(void)
576{ 571{
577 if (usb_register(&sd_driver) < 0) 572 if (usb_register(&sd_driver) < 0)
578 return -1; 573 return -1;
579 info("v%s registered", version); 574 info("registered");
580 return 0; 575 return 0;
581} 576}
582static void __exit sd_mod_exit(void) 577static void __exit sd_mod_exit(void)
diff --git a/drivers/media/video/gspca/sunplus.c b/drivers/media/video/gspca/sunplus.c
index abd7bef9b3d1..54efa48bee01 100644
--- a/drivers/media/video/gspca/sunplus.c
+++ b/drivers/media/video/gspca/sunplus.c
@@ -24,9 +24,6 @@
24#include "gspca.h" 24#include "gspca.h"
25#include "jpeg.h" 25#include "jpeg.h"
26 26
27#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 8)
28static const char version[] = "2.1.8";
29
30MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 27MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
31MODULE_DESCRIPTION("GSPCA/SPCA5xx USB Camera Driver"); 28MODULE_DESCRIPTION("GSPCA/SPCA5xx USB Camera Driver");
32MODULE_LICENSE("GPL"); 29MODULE_LICENSE("GPL");
@@ -804,229 +801,29 @@ static int sd_config(struct gspca_dev *gspca_dev,
804 struct sd *sd = (struct sd *) gspca_dev; 801 struct sd *sd = (struct sd *) gspca_dev;
805 struct usb_device *dev = gspca_dev->dev; 802 struct usb_device *dev = gspca_dev->dev;
806 struct cam *cam; 803 struct cam *cam;
807 __u16 vendor; 804
808 __u16 product; 805 cam = &gspca_dev->cam;
809 __u8 fw; 806 cam->epaddr = 0x01;
810 807
811 vendor = id->idVendor; 808 sd->bridge = id->driver_info >> 8;
812 product = id->idProduct; 809 sd->subtype = id->driver_info;
813 switch (vendor) { 810
814 case 0x041e: /* Creative cameras */ 811 if (sd->subtype == AiptekMiniPenCam13) {
815/* switch (product) { */
816/* case 0x400b: */
817/* case 0x4012: */
818/* case 0x4013: */
819/* sd->bridge = BRIDGE_SPCA504C; */
820/* break; */
821/* } */
822 break;
823 case 0x0458: /* Genius KYE cameras */
824/* switch (product) { */
825/* case 0x7006: */
826 sd->bridge = BRIDGE_SPCA504B;
827/* break; */
828/* } */
829 break;
830 case 0x0461: /* MicroInnovation */
831/* switch (product) { */
832/* case 0x0821: */
833 sd->bridge = BRIDGE_SPCA533;
834/* break; */
835/* } */
836 break;
837 case 0x046d: /* Logitech Labtec */
838 switch (product) {
839 case 0x0905:
840 sd->subtype = LogitechClickSmart820;
841 sd->bridge = BRIDGE_SPCA533;
842 break;
843 case 0x0960:
844 sd->subtype = LogitechClickSmart420;
845 sd->bridge = BRIDGE_SPCA504C;
846 break;
847 }
848 break;
849 case 0x0471: /* Philips */
850/* switch (product) { */
851/* case 0x0322: */
852 sd->bridge = BRIDGE_SPCA504B;
853/* break; */
854/* } */
855 break;
856 case 0x04a5: /* Benq */
857 switch (product) {
858 case 0x3003:
859 sd->bridge = BRIDGE_SPCA504B;
860 break;
861 case 0x3008:
862 case 0x300a:
863 sd->bridge = BRIDGE_SPCA533;
864 break;
865 }
866 break;
867 case 0x04f1: /* JVC */
868/* switch (product) { */
869/* case 0x1001: */
870 sd->bridge = BRIDGE_SPCA504B;
871/* break; */
872/* } */
873 break;
874 case 0x04fc: /* SunPlus */
875 switch (product) {
876 case 0x500c:
877 sd->bridge = BRIDGE_SPCA504B;
878 break;
879 case 0x504a:
880/* try to get the firmware as some cam answer 2.0.1.2.2 812/* try to get the firmware as some cam answer 2.0.1.2.2
881 * and should be a spca504b then overwrite that setting */ 813 * and should be a spca504b then overwrite that setting */
882 reg_r(dev, 0x20, 0, gspca_dev->usb_buf, 1); 814 reg_r(dev, 0x20, 0, gspca_dev->usb_buf, 1);
883 fw = gspca_dev->usb_buf[0]; 815 switch (gspca_dev->usb_buf[0]) {
884 if (fw == 1) { 816 case 1:
885 sd->subtype = AiptekMiniPenCam13; 817 break; /* (right bridge/subtype) */
886 sd->bridge = BRIDGE_SPCA504; 818 case 2:
887 } else if (fw == 2) {
888 sd->bridge = BRIDGE_SPCA504B;
889 } else
890 return -ENODEV;
891 break;
892 case 0x504b:
893 sd->bridge = BRIDGE_SPCA504B;
894 break;
895 case 0x5330:
896 sd->bridge = BRIDGE_SPCA533;
897 break;
898 case 0x5360:
899 sd->bridge = BRIDGE_SPCA536;
900 break;
901 case 0xffff:
902 sd->bridge = BRIDGE_SPCA504B;
903 break;
904 }
905 break;
906 case 0x052b: /* ?? Megapix */
907/* switch (product) { */
908/* case 0x1513: */
909 sd->subtype = MegapixV4;
910 sd->bridge = BRIDGE_SPCA533;
911/* break; */
912/* } */
913 break;
914 case 0x0546: /* Polaroid */
915 switch (product) {
916 case 0x3155:
917 sd->bridge = BRIDGE_SPCA533;
918 break;
919 case 0x3191:
920 case 0x3273:
921 sd->bridge = BRIDGE_SPCA504B;
922 break;
923 }
924 break;
925 case 0x055f: /* Mustek cameras */
926 switch (product) {
927 case 0xc211:
928 sd->bridge = BRIDGE_SPCA536;
929 break;
930 case 0xc230:
931 case 0xc232:
932 sd->bridge = BRIDGE_SPCA533;
933 break;
934 case 0xc360:
935 sd->bridge = BRIDGE_SPCA536;
936 break;
937 case 0xc420:
938 sd->bridge = BRIDGE_SPCA504;
939 break;
940 case 0xc430:
941 case 0xc440:
942 sd->bridge = BRIDGE_SPCA533;
943 break;
944 case 0xc520:
945 sd->bridge = BRIDGE_SPCA504;
946 break;
947 case 0xc530:
948 case 0xc540:
949 case 0xc630:
950 case 0xc650:
951 sd->bridge = BRIDGE_SPCA533;
952 break;
953 }
954 break;
955 case 0x05da: /* Digital Dream cameras */
956/* switch (product) { */
957/* case 0x1018: */
958 sd->bridge = BRIDGE_SPCA504B; 819 sd->bridge = BRIDGE_SPCA504B;
959/* break; */ 820 sd->subtype = 0;
960/* } */
961 break;
962 case 0x06d6: /* Trust */
963/* switch (product) { */
964/* case 0x0031: */
965 sd->bridge = BRIDGE_SPCA533; /* SPCA533A */
966/* break; */
967/* } */
968 break;
969 case 0x0733: /* Rebadged ViewQuest (Intel) and ViewQuest cameras */
970 switch (product) {
971 case 0x1311:
972 case 0x1314:
973 case 0x2211:
974 case 0x2221:
975 sd->bridge = BRIDGE_SPCA533;
976 break;
977 case 0x3261:
978 case 0x3281:
979 sd->bridge = BRIDGE_SPCA536;
980 break;
981 }
982 break;
983 case 0x08ca: /* Aiptek */
984 switch (product) {
985 case 0x0104:
986 case 0x0106:
987 sd->bridge = BRIDGE_SPCA533;
988 break;
989 case 0x2008:
990 sd->bridge = BRIDGE_SPCA504B;
991 break;
992 case 0x2010:
993 sd->bridge = BRIDGE_SPCA533;
994 break;
995 case 0x2016:
996 case 0x2018:
997 sd->bridge = BRIDGE_SPCA504B;
998 break;
999 case 0x2020:
1000 case 0x2022:
1001 sd->bridge = BRIDGE_SPCA533;
1002 break;
1003 case 0x2024:
1004 sd->bridge = BRIDGE_SPCA536;
1005 break;
1006 case 0x2028:
1007 sd->bridge = BRIDGE_SPCA533;
1008 break;
1009 case 0x2040:
1010 case 0x2042:
1011 case 0x2050:
1012 case 0x2060:
1013 sd->bridge = BRIDGE_SPCA536;
1014 break; 821 break;
822 default:
823 return -ENODEV;
1015 } 824 }
1016 break;
1017 case 0x0d64: /* SunPlus */
1018/* switch (product) { */
1019/* case 0x0303: */
1020 sd->bridge = BRIDGE_SPCA536;
1021/* break; */
1022/* } */
1023 break;
1024 } 825 }
1025 826
1026 cam = &gspca_dev->cam;
1027 cam->dev_name = (char *) id->driver_info;
1028 cam->epaddr = 0x01;
1029
1030 switch (sd->bridge) { 827 switch (sd->bridge) {
1031 default: 828 default:
1032/* case BRIDGE_SPCA504B: */ 829/* case BRIDGE_SPCA504B: */
@@ -1581,65 +1378,67 @@ static const struct sd_desc sd_desc = {
1581}; 1378};
1582 1379
1583/* -- module initialisation -- */ 1380/* -- module initialisation -- */
1584#define DVNM(name) .driver_info = (kernel_ulong_t) name 1381#define BS(bridge, subtype) \
1382 .driver_info = (BRIDGE_ ## bridge << 8) \
1383 | (subtype)
1585static const __devinitdata struct usb_device_id device_table[] = { 1384static const __devinitdata struct usb_device_id device_table[] = {
1586 {USB_DEVICE(0x041e, 0x400b), DVNM("Creative PC-CAM 600")}, 1385 {USB_DEVICE(0x041e, 0x400b), BS(SPCA504C, 0)},
1587 {USB_DEVICE(0x041e, 0x4012), DVNM("PC-Cam350")}, 1386 {USB_DEVICE(0x041e, 0x4012), BS(SPCA504C, 0)},
1588 {USB_DEVICE(0x041e, 0x4013), DVNM("Creative Pccam750")}, 1387 {USB_DEVICE(0x041e, 0x4013), BS(SPCA504C, 0)},
1589 {USB_DEVICE(0x0458, 0x7006), DVNM("Genius Dsc 1.3 Smart")}, 1388 {USB_DEVICE(0x0458, 0x7006), BS(SPCA504B, 0)},
1590 {USB_DEVICE(0x0461, 0x0821), DVNM("Fujifilm MV-1")}, 1389 {USB_DEVICE(0x0461, 0x0821), BS(SPCA533, 0)},
1591 {USB_DEVICE(0x046d, 0x0905), DVNM("Logitech ClickSmart 820")}, 1390 {USB_DEVICE(0x046d, 0x0905), BS(SPCA533, LogitechClickSmart820)},
1592 {USB_DEVICE(0x046d, 0x0960), DVNM("Logitech ClickSmart 420")}, 1391 {USB_DEVICE(0x046d, 0x0960), BS(SPCA504C, LogitechClickSmart420)},
1593 {USB_DEVICE(0x0471, 0x0322), DVNM("Philips DMVC1300K")}, 1392 {USB_DEVICE(0x0471, 0x0322), BS(SPCA504B, 0)},
1594 {USB_DEVICE(0x04a5, 0x3003), DVNM("Benq DC 1300")}, 1393 {USB_DEVICE(0x04a5, 0x3003), BS(SPCA504B, 0)},
1595 {USB_DEVICE(0x04a5, 0x3008), DVNM("Benq DC 1500")}, 1394 {USB_DEVICE(0x04a5, 0x3008), BS(SPCA533, 0)},
1596 {USB_DEVICE(0x04a5, 0x300a), DVNM("Benq DC3410")}, 1395 {USB_DEVICE(0x04a5, 0x300a), BS(SPCA533, 0)},
1597 {USB_DEVICE(0x04f1, 0x1001), DVNM("JVC GC A50")}, 1396 {USB_DEVICE(0x04f1, 0x1001), BS(SPCA504B, 0)},
1598 {USB_DEVICE(0x04fc, 0x500c), DVNM("Sunplus CA500C")}, 1397 {USB_DEVICE(0x04fc, 0x500c), BS(SPCA504B, 0)},
1599 {USB_DEVICE(0x04fc, 0x504a), DVNM("Aiptek Mini PenCam 1.3")}, 1398 {USB_DEVICE(0x04fc, 0x504a), BS(SPCA504, AiptekMiniPenCam13)},
1600 {USB_DEVICE(0x04fc, 0x504b), DVNM("Maxell MaxPocket LE 1.3")}, 1399 {USB_DEVICE(0x04fc, 0x504b), BS(SPCA504B, 0)},
1601 {USB_DEVICE(0x04fc, 0x5330), DVNM("Digitrex 2110")}, 1400 {USB_DEVICE(0x04fc, 0x5330), BS(SPCA533, 0)},
1602 {USB_DEVICE(0x04fc, 0x5360), DVNM("Sunplus Generic")}, 1401 {USB_DEVICE(0x04fc, 0x5360), BS(SPCA536, 0)},
1603 {USB_DEVICE(0x04fc, 0xffff), DVNM("Pure DigitalDakota")}, 1402 {USB_DEVICE(0x04fc, 0xffff), BS(SPCA504B, 0)},
1604 {USB_DEVICE(0x052b, 0x1513), DVNM("Megapix V4")}, 1403 {USB_DEVICE(0x052b, 0x1513), BS(SPCA533, MegapixV4)},
1605 {USB_DEVICE(0x0546, 0x3155), DVNM("Polaroid PDC3070")}, 1404 {USB_DEVICE(0x0546, 0x3155), BS(SPCA533, 0)},
1606 {USB_DEVICE(0x0546, 0x3191), DVNM("Polaroid Ion 80")}, 1405 {USB_DEVICE(0x0546, 0x3191), BS(SPCA504B, 0)},
1607 {USB_DEVICE(0x0546, 0x3273), DVNM("Polaroid PDC2030")}, 1406 {USB_DEVICE(0x0546, 0x3273), BS(SPCA504B, 0)},
1608 {USB_DEVICE(0x055f, 0xc211), DVNM("Kowa Bs888e Microcamera")}, 1407 {USB_DEVICE(0x055f, 0xc211), BS(SPCA536, 0)},
1609 {USB_DEVICE(0x055f, 0xc230), DVNM("Mustek Digicam 330K")}, 1408 {USB_DEVICE(0x055f, 0xc230), BS(SPCA533, 0)},
1610 {USB_DEVICE(0x055f, 0xc232), DVNM("Mustek MDC3500")}, 1409 {USB_DEVICE(0x055f, 0xc232), BS(SPCA533, 0)},
1611 {USB_DEVICE(0x055f, 0xc360), DVNM("Mustek DV4000 Mpeg4 ")}, 1410 {USB_DEVICE(0x055f, 0xc360), BS(SPCA536, 0)},
1612 {USB_DEVICE(0x055f, 0xc420), DVNM("Mustek gSmart Mini 2")}, 1411 {USB_DEVICE(0x055f, 0xc420), BS(SPCA504, 0)},
1613 {USB_DEVICE(0x055f, 0xc430), DVNM("Mustek Gsmart LCD 2")}, 1412 {USB_DEVICE(0x055f, 0xc430), BS(SPCA533, 0)},
1614 {USB_DEVICE(0x055f, 0xc440), DVNM("Mustek DV 3000")}, 1413 {USB_DEVICE(0x055f, 0xc440), BS(SPCA533, 0)},
1615 {USB_DEVICE(0x055f, 0xc520), DVNM("Mustek gSmart Mini 3")}, 1414 {USB_DEVICE(0x055f, 0xc520), BS(SPCA504, 0)},
1616 {USB_DEVICE(0x055f, 0xc530), DVNM("Mustek Gsmart LCD 3")}, 1415 {USB_DEVICE(0x055f, 0xc530), BS(SPCA533, 0)},
1617 {USB_DEVICE(0x055f, 0xc540), DVNM("Gsmart D30")}, 1416 {USB_DEVICE(0x055f, 0xc540), BS(SPCA533, 0)},
1618 {USB_DEVICE(0x055f, 0xc630), DVNM("Mustek MDC4000")}, 1417 {USB_DEVICE(0x055f, 0xc630), BS(SPCA533, 0)},
1619 {USB_DEVICE(0x055f, 0xc650), DVNM("Mustek MDC5500Z")}, 1418 {USB_DEVICE(0x055f, 0xc650), BS(SPCA533, 0)},
1620 {USB_DEVICE(0x05da, 0x1018), DVNM("Digital Dream Enigma 1.3")}, 1419 {USB_DEVICE(0x05da, 0x1018), BS(SPCA504B, 0)},
1621 {USB_DEVICE(0x06d6, 0x0031), DVNM("Trust 610 LCD PowerC@m Zoom")}, 1420 {USB_DEVICE(0x06d6, 0x0031), BS(SPCA533, 0)},
1622 {USB_DEVICE(0x0733, 0x1311), DVNM("Digital Dream Epsilon 1.3")}, 1421 {USB_DEVICE(0x0733, 0x1311), BS(SPCA533, 0)},
1623 {USB_DEVICE(0x0733, 0x1314), DVNM("Mercury 2.1MEG Deluxe Classic Cam")}, 1422 {USB_DEVICE(0x0733, 0x1314), BS(SPCA533, 0)},
1624 {USB_DEVICE(0x0733, 0x2211), DVNM("Jenoptik jdc 21 LCD")}, 1423 {USB_DEVICE(0x0733, 0x2211), BS(SPCA533, 0)},
1625 {USB_DEVICE(0x0733, 0x2221), DVNM("Mercury Digital Pro 3.1p")}, 1424 {USB_DEVICE(0x0733, 0x2221), BS(SPCA533, 0)},
1626 {USB_DEVICE(0x0733, 0x3261), DVNM("Concord 3045 spca536a")}, 1425 {USB_DEVICE(0x0733, 0x3261), BS(SPCA536, 0)},
1627 {USB_DEVICE(0x0733, 0x3281), DVNM("Cyberpix S550V")}, 1426 {USB_DEVICE(0x0733, 0x3281), BS(SPCA536, 0)},
1628 {USB_DEVICE(0x08ca, 0x0104), DVNM("Aiptek PocketDVII 1.3")}, 1427 {USB_DEVICE(0x08ca, 0x0104), BS(SPCA533, 0)},
1629 {USB_DEVICE(0x08ca, 0x0106), DVNM("Aiptek Pocket DV3100+")}, 1428 {USB_DEVICE(0x08ca, 0x0106), BS(SPCA533, 0)},
1630 {USB_DEVICE(0x08ca, 0x2008), DVNM("Aiptek Mini PenCam 2 M")}, 1429 {USB_DEVICE(0x08ca, 0x2008), BS(SPCA504B, 0)},
1631 {USB_DEVICE(0x08ca, 0x2010), DVNM("Aiptek PocketCam 3M")}, 1430 {USB_DEVICE(0x08ca, 0x2010), BS(SPCA533, 0)},
1632 {USB_DEVICE(0x08ca, 0x2016), DVNM("Aiptek PocketCam 2 Mega")}, 1431 {USB_DEVICE(0x08ca, 0x2016), BS(SPCA504B, 0)},
1633 {USB_DEVICE(0x08ca, 0x2018), DVNM("Aiptek Pencam SD 2M")}, 1432 {USB_DEVICE(0x08ca, 0x2018), BS(SPCA504B, 0)},
1634 {USB_DEVICE(0x08ca, 0x2020), DVNM("Aiptek Slim 3000F")}, 1433 {USB_DEVICE(0x08ca, 0x2020), BS(SPCA533, 0)},
1635 {USB_DEVICE(0x08ca, 0x2022), DVNM("Aiptek Slim 3200")}, 1434 {USB_DEVICE(0x08ca, 0x2022), BS(SPCA533, 0)},
1636 {USB_DEVICE(0x08ca, 0x2024), DVNM("Aiptek DV3500 Mpeg4 ")}, 1435 {USB_DEVICE(0x08ca, 0x2024), BS(SPCA536, 0)},
1637 {USB_DEVICE(0x08ca, 0x2028), DVNM("Aiptek PocketCam4M")}, 1436 {USB_DEVICE(0x08ca, 0x2028), BS(SPCA533, 0)},
1638 {USB_DEVICE(0x08ca, 0x2040), DVNM("Aiptek PocketDV4100M")}, 1437 {USB_DEVICE(0x08ca, 0x2040), BS(SPCA536, 0)},
1639 {USB_DEVICE(0x08ca, 0x2042), DVNM("Aiptek PocketDV5100")}, 1438 {USB_DEVICE(0x08ca, 0x2042), BS(SPCA536, 0)},
1640 {USB_DEVICE(0x08ca, 0x2050), DVNM("Medion MD 41437")}, 1439 {USB_DEVICE(0x08ca, 0x2050), BS(SPCA536, 0)},
1641 {USB_DEVICE(0x08ca, 0x2060), DVNM("Aiptek PocketDV5300")}, 1440 {USB_DEVICE(0x08ca, 0x2060), BS(SPCA536, 0)},
1642 {USB_DEVICE(0x0d64, 0x0303), DVNM("Sunplus FashionCam DXG")}, 1441 {USB_DEVICE(0x0d64, 0x0303), BS(SPCA536, 0)},
1643 {} 1442 {}
1644}; 1443};
1645MODULE_DEVICE_TABLE(usb, device_table); 1444MODULE_DEVICE_TABLE(usb, device_table);
@@ -1664,7 +1463,7 @@ static int __init sd_mod_init(void)
1664{ 1463{
1665 if (usb_register(&sd_driver) < 0) 1464 if (usb_register(&sd_driver) < 0)
1666 return -1; 1465 return -1;
1667 PDEBUG(D_PROBE, "v%s registered", version); 1466 PDEBUG(D_PROBE, "registered");
1668 return 0; 1467 return 0;
1669} 1468}
1670static void __exit sd_mod_exit(void) 1469static void __exit sd_mod_exit(void)
diff --git a/drivers/media/video/gspca/t613.c b/drivers/media/video/gspca/t613.c
index 00f47e463a05..91b555c34c68 100644
--- a/drivers/media/video/gspca/t613.c
+++ b/drivers/media/video/gspca/t613.c
@@ -1,12 +1,4 @@
1/* 1/*
2 *Notes: * t613 + tas5130A
3 * * Focus to light do not balance well as in win.
4 * Quality in win is not good, but its kinda better.
5 * * Fix some "extraneous bytes", most of apps will show the image anyway
6 * * Gamma table, is there, but its really doing something?
7 * * 7~8 Fps, its ok, max on win its 10.
8 * Costantino Leandro
9 *
10 * V4L2 by Jean-Francois Moine <http://moinejf.free.fr> 2 * V4L2 by Jean-Francois Moine <http://moinejf.free.fr>
11 * 3 *
12 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
@@ -22,16 +14,22 @@
22 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software 15 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 *Notes: * t613 + tas5130A
19 * * Focus to light do not balance well as in win.
20 * Quality in win is not good, but its kinda better.
21 * * Fix some "extraneous bytes", most of apps will show the image anyway
22 * * Gamma table, is there, but its really doing something?
23 * * 7~8 Fps, its ok, max on win its 10.
24 * Costantino Leandro
25 */ 25 */
26 26
27#define MODULE_NAME "t613" 27#define MODULE_NAME "t613"
28
28#include "gspca.h" 29#include "gspca.h"
29#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7)
30static const char version[] = "2.1.7";
31 30
32#define MAX_GAMMA 0x10 /* 0 to 15 */ 31#define MAX_GAMMA 0x10 /* 0 to 15 */
33 32
34/* From LUVCVIEW */
35#define V4L2_CID_EFFECTS (V4L2_CID_PRIVATE_BASE + 3) 33#define V4L2_CID_EFFECTS (V4L2_CID_PRIVATE_BASE + 3)
36 34
37MODULE_AUTHOR("Leandro Costantino <le_costantino@pixartargentina.com.ar>"); 35MODULE_AUTHOR("Leandro Costantino <le_costantino@pixartargentina.com.ar>");
@@ -424,7 +422,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
424 struct cam *cam; 422 struct cam *cam;
425 423
426 cam = &gspca_dev->cam; 424 cam = &gspca_dev->cam;
427 cam->dev_name = (char *) id->driver_info;
428 cam->epaddr = 0x01; 425 cam->epaddr = 0x01;
429 426
430 cam->cam_mode = vga_mode_t16; 427 cam->cam_mode = vga_mode_t16;
@@ -998,9 +995,8 @@ static const struct sd_desc sd_desc = {
998}; 995};
999 996
1000/* -- module initialisation -- */ 997/* -- module initialisation -- */
1001#define DVNM(name) .driver_info = (kernel_ulong_t) name
1002static const __devinitdata struct usb_device_id device_table[] = { 998static const __devinitdata struct usb_device_id device_table[] = {
1003 {USB_DEVICE(0x17a1, 0x0128), DVNM("XPX Webcam")}, 999 {USB_DEVICE(0x17a1, 0x0128)},
1004 {} 1000 {}
1005}; 1001};
1006MODULE_DEVICE_TABLE(usb, device_table); 1002MODULE_DEVICE_TABLE(usb, device_table);
@@ -1025,7 +1021,7 @@ static int __init sd_mod_init(void)
1025{ 1021{
1026 if (usb_register(&sd_driver) < 0) 1022 if (usb_register(&sd_driver) < 0)
1027 return -1; 1023 return -1;
1028 PDEBUG(D_PROBE, "v%s registered", version); 1024 PDEBUG(D_PROBE, "registered");
1029 return 0; 1025 return 0;
1030} 1026}
1031static void __exit sd_mod_exit(void) 1027static void __exit sd_mod_exit(void)
diff --git a/drivers/media/video/gspca/tv8532.c b/drivers/media/video/gspca/tv8532.c
index 0b793899095f..1ff8ba2f7fe5 100644
--- a/drivers/media/video/gspca/tv8532.c
+++ b/drivers/media/video/gspca/tv8532.c
@@ -22,9 +22,6 @@
22 22
23#include "gspca.h" 23#include "gspca.h"
24 24
25#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7)
26static const char version[] = "2.1.7";
27
28MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 25MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
29MODULE_DESCRIPTION("TV8532 USB Camera Driver"); 26MODULE_DESCRIPTION("TV8532 USB Camera Driver");
30MODULE_LICENSE("GPL"); 27MODULE_LICENSE("GPL");
@@ -249,7 +246,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
249 tv_8532WriteEEprom(gspca_dev); 246 tv_8532WriteEEprom(gspca_dev);
250 247
251 cam = &gspca_dev->cam; 248 cam = &gspca_dev->cam;
252 cam->dev_name = (char *) id->driver_info;
253 cam->epaddr = 1; 249 cam->epaddr = 1;
254 cam->cam_mode = sif_mode; 250 cam->cam_mode = sif_mode;
255 cam->nmodes = sizeof sif_mode / sizeof sif_mode[0]; 251 cam->nmodes = sizeof sif_mode / sizeof sif_mode[0];
@@ -624,13 +620,12 @@ static const struct sd_desc sd_desc = {
624}; 620};
625 621
626/* -- module initialisation -- */ 622/* -- module initialisation -- */
627#define DVNM(name) .driver_info = (kernel_ulong_t) name
628static const __devinitdata struct usb_device_id device_table[] = { 623static const __devinitdata struct usb_device_id device_table[] = {
629 {USB_DEVICE(0x046d, 0x0920), DVNM("QC Express")}, 624 {USB_DEVICE(0x046d, 0x0920)},
630 {USB_DEVICE(0x046d, 0x0921), DVNM("Labtec Webcam")}, 625 {USB_DEVICE(0x046d, 0x0921)},
631 {USB_DEVICE(0x0545, 0x808b), DVNM("Veo Stingray")}, 626 {USB_DEVICE(0x0545, 0x808b)},
632 {USB_DEVICE(0x0545, 0x8333), DVNM("Veo Stingray")}, 627 {USB_DEVICE(0x0545, 0x8333)},
633 {USB_DEVICE(0x0923, 0x010f), DVNM("ICM532 cams")}, 628 {USB_DEVICE(0x0923, 0x010f)},
634 {} 629 {}
635}; 630};
636 631
@@ -656,7 +651,7 @@ static int __init sd_mod_init(void)
656{ 651{
657 if (usb_register(&sd_driver) < 0) 652 if (usb_register(&sd_driver) < 0)
658 return -1; 653 return -1;
659 PDEBUG(D_PROBE, "v%s registered", version); 654 PDEBUG(D_PROBE, "registered");
660 return 0; 655 return 0;
661} 656}
662 657
diff --git a/drivers/media/video/gspca/vc032x.c b/drivers/media/video/gspca/vc032x.c
index fcf2c9e32573..a4221753e1bf 100644
--- a/drivers/media/video/gspca/vc032x.c
+++ b/drivers/media/video/gspca/vc032x.c
@@ -24,9 +24,6 @@
24 24
25#include "gspca.h" 25#include "gspca.h"
26 26
27#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7)
28static const char version[] = "2.1.7";
29
30MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 27MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
31MODULE_DESCRIPTION("GSPCA/VC032X USB Camera Driver"); 28MODULE_DESCRIPTION("GSPCA/VC032X USB Camera Driver");
32MODULE_LICENSE("GPL"); 29MODULE_LICENSE("GPL");
@@ -1419,30 +1416,10 @@ static int sd_config(struct gspca_dev *gspca_dev,
1419 struct usb_device *dev = gspca_dev->dev; 1416 struct usb_device *dev = gspca_dev->dev;
1420 struct cam *cam; 1417 struct cam *cam;
1421 int sensor; 1418 int sensor;
1422 __u16 product;
1423
1424 product = id->idProduct;
1425 sd->bridge = BRIDGE_VC0321;
1426 switch (id->idVendor) {
1427 case 0x0ac8: /* Vimicro z-star */
1428 switch (product) {
1429 case 0x0323:
1430 sd->bridge = BRIDGE_VC0323;
1431 break;
1432 }
1433 break;
1434 case 0x17ef: /* Lenovo */
1435/* switch (product) { */
1436/* case 0x4802: * Lenovo MI1310_SOC */
1437 sd->bridge = BRIDGE_VC0323;
1438/* break; */
1439/* } */
1440 break;
1441 }
1442 1419
1443 cam = &gspca_dev->cam; 1420 cam = &gspca_dev->cam;
1444 cam->dev_name = (char *) id->driver_info;
1445 cam->epaddr = 0x02; 1421 cam->epaddr = 0x02;
1422 sd->bridge = id->driver_info;
1446 if (sd->bridge == BRIDGE_VC0321) { 1423 if (sd->bridge == BRIDGE_VC0321) {
1447 cam->cam_mode = vc0321_mode; 1424 cam->cam_mode = vc0321_mode;
1448 cam->nmodes = ARRAY_SIZE(vc0321_mode); 1425 cam->nmodes = ARRAY_SIZE(vc0321_mode);
@@ -1771,16 +1748,15 @@ static const struct sd_desc sd_desc = {
1771}; 1748};
1772 1749
1773/* -- module initialisation -- */ 1750/* -- module initialisation -- */
1774#define DVNM(name) .driver_info = (kernel_ulong_t) name
1775static const __devinitdata struct usb_device_id device_table[] = { 1751static const __devinitdata struct usb_device_id device_table[] = {
1776 {USB_DEVICE(0x046d, 0x0892), DVNM("Logitech Orbicam")}, 1752 {USB_DEVICE(0x046d, 0x0892), .driver_info = BRIDGE_VC0321},
1777 {USB_DEVICE(0x046d, 0x0896), DVNM("Logitech Orbicam")}, 1753 {USB_DEVICE(0x046d, 0x0896), .driver_info = BRIDGE_VC0321},
1778 {USB_DEVICE(0x0ac8, 0x0321), DVNM("Vimicro generic vc0321")}, 1754 {USB_DEVICE(0x0ac8, 0x0321), .driver_info = BRIDGE_VC0321},
1779 {USB_DEVICE(0x0ac8, 0x0323), DVNM("Vimicro Vc0323")}, 1755 {USB_DEVICE(0x0ac8, 0x0323), .driver_info = BRIDGE_VC0323},
1780 {USB_DEVICE(0x0ac8, 0x0328), DVNM("A4Tech PK-130MG")}, 1756 {USB_DEVICE(0x0ac8, 0x0328), .driver_info = BRIDGE_VC0321},
1781 {USB_DEVICE(0x0ac8, 0xc001), DVNM("Sony embedded vimicro")}, 1757 {USB_DEVICE(0x0ac8, 0xc001), .driver_info = BRIDGE_VC0321},
1782 {USB_DEVICE(0x0ac8, 0xc002), DVNM("Sony embedded vimicro")}, 1758 {USB_DEVICE(0x0ac8, 0xc002), .driver_info = BRIDGE_VC0321},
1783 {USB_DEVICE(0x17ef, 0x4802), DVNM("Lenovo Vc0323+MI1310_SOC")}, 1759 {USB_DEVICE(0x17ef, 0x4802), .driver_info = BRIDGE_VC0323},
1784 {} 1760 {}
1785}; 1761};
1786MODULE_DEVICE_TABLE(usb, device_table); 1762MODULE_DEVICE_TABLE(usb, device_table);
@@ -1805,7 +1781,7 @@ static int __init sd_mod_init(void)
1805{ 1781{
1806 if (usb_register(&sd_driver) < 0) 1782 if (usb_register(&sd_driver) < 0)
1807 return -1; 1783 return -1;
1808 PDEBUG(D_PROBE, "v%s registered", version); 1784 PDEBUG(D_PROBE, "registered");
1809 return 0; 1785 return 0;
1810} 1786}
1811static void __exit sd_mod_exit(void) 1787static void __exit sd_mod_exit(void)
diff --git a/drivers/media/video/gspca/zc3xx.c b/drivers/media/video/gspca/zc3xx.c
index b761b11c5c6a..22a994ccb1d5 100644
--- a/drivers/media/video/gspca/zc3xx.c
+++ b/drivers/media/video/gspca/zc3xx.c
@@ -24,9 +24,6 @@
24 24
25#include "gspca.h" 25#include "gspca.h"
26 26
27#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7)
28static const char version[] = "2.1.7";
29
30MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>, " 27MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>, "
31 "Serge A. Suchkov <Serge.A.S@tochka.ru>"); 28 "Serge A. Suchkov <Serge.A.S@tochka.ru>");
32MODULE_DESCRIPTION("GSPCA ZC03xx/VC3xx USB Camera Driver"); 29MODULE_DESCRIPTION("GSPCA ZC03xx/VC3xx USB Camera Driver");
@@ -49,7 +46,7 @@ struct sd {
49 __u8 sharpness; 46 __u8 sharpness;
50 47
51 char qindex; 48 char qindex;
52 char sensor; /* Type of image sensor chip */ 49 signed char sensor; /* Type of image sensor chip */
53/* !! values used in different tables */ 50/* !! values used in different tables */
54#define SENSOR_CS2102 0 51#define SENSOR_CS2102 0
55#define SENSOR_CS2102K 1 52#define SENSOR_CS2102K 1
@@ -2205,10 +2202,10 @@ static const struct usb_action hdcs2020xb_InitialScale[] = {
2205}; 2202};
2206static const struct usb_action hdcs2020b_50HZ[] = { 2203static const struct usb_action hdcs2020b_50HZ[] = {
2207 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */ 2204 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */
2208 {0xaa, 0x13, 0x0018}, /* 00,13,18,aa */ 2205 {0xaa, 0x13, 0x0018}, /* 00,13,18,aa */
2209 {0xaa, 0x14, 0x0001}, /* 00,14,01,aa */ 2206 {0xaa, 0x14, 0x0001}, /* 00,14,01,aa */
2210 {0xaa, 0x0e, 0x0005}, /* 00,0e,05,aa */ 2207 {0xaa, 0x0e, 0x0005}, /* 00,0e,05,aa */
2211 {0xaa, 0x19, 0x001f}, /* 00,19,1f,aa */ 2208 {0xaa, 0x19, 0x001f}, /* 00,19,1f,aa */
2212 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */ 2209 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */
2213 {0xa0, 0x02, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,02,cc */ 2210 {0xa0, 0x02, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,02,cc */
2214 {0xa0, 0x76, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,76,cc */ 2211 {0xa0, 0x76, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,76,cc */
@@ -2226,10 +2223,10 @@ static const struct usb_action hdcs2020b_50HZ[] = {
2226}; 2223};
2227static const struct usb_action hdcs2020b_60HZ[] = { 2224static const struct usb_action hdcs2020b_60HZ[] = {
2228 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */ 2225 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */
2229 {0xaa, 0x13, 0x0031}, /* 00,13,31,aa */ 2226 {0xaa, 0x13, 0x0031}, /* 00,13,31,aa */
2230 {0xaa, 0x14, 0x0001}, /* 00,14,01,aa */ 2227 {0xaa, 0x14, 0x0001}, /* 00,14,01,aa */
2231 {0xaa, 0x0e, 0x0004}, /* 00,0e,04,aa */ 2228 {0xaa, 0x0e, 0x0004}, /* 00,0e,04,aa */
2232 {0xaa, 0x19, 0x00cd}, /* 00,19,cd,aa */ 2229 {0xaa, 0x19, 0x00cd}, /* 00,19,cd,aa */
2233 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */ 2230 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */
2234 {0xa0, 0x02, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,02,cc */ 2231 {0xa0, 0x02, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,02,cc */
2235 {0xa0, 0x62, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,62,cc */ 2232 {0xa0, 0x62, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,62,cc */
@@ -2247,10 +2244,10 @@ static const struct usb_action hdcs2020b_60HZ[] = {
2247}; 2244};
2248static const struct usb_action hdcs2020b_NoFliker[] = { 2245static const struct usb_action hdcs2020b_NoFliker[] = {
2249 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */ 2246 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */
2250 {0xaa, 0x13, 0x0010}, /* 00,13,10,aa */ 2247 {0xaa, 0x13, 0x0010}, /* 00,13,10,aa */
2251 {0xaa, 0x14, 0x0001}, /* 00,14,01,aa */ 2248 {0xaa, 0x14, 0x0001}, /* 00,14,01,aa */
2252 {0xaa, 0x0e, 0x0004}, /* 00,0e,04,aa */ 2249 {0xaa, 0x0e, 0x0004}, /* 00,0e,04,aa */
2253 {0xaa, 0x19, 0x0000}, /* 00,19,00,aa */ 2250 {0xaa, 0x19, 0x0000}, /* 00,19,00,aa */
2254 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */ 2251 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */
2255 {0xa0, 0x02, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,02,cc */ 2252 {0xa0, 0x02, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,02,cc */
2256 {0xa0, 0x70, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,70,cc */ 2253 {0xa0, 0x70, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,70,cc */
@@ -4102,27 +4099,27 @@ static const struct usb_action pas106b_Initial_com[] = {
4102 4099
4103static const struct usb_action pas106b_Initial[] = { /* 176x144 */ 4100static const struct usb_action pas106b_Initial[] = { /* 176x144 */
4104/* JPEG control */ 4101/* JPEG control */
4105 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* ClockSetting */ 4102 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
4106/* Sream and Sensor specific */ 4103/* Sream and Sensor specific */
4107 {0xa0, 0x0f, ZC3XX_R010_CMOSSENSORSELECT}, /* CMOSSensorSelect */ 4104 {0xa0, 0x0f, ZC3XX_R010_CMOSSENSORSELECT},
4108/* Picture size */ 4105/* Picture size */
4109 {0xa0, 0x00, ZC3XX_R003_FRAMEWIDTHHIGH}, /* FrameWidthHigh 00 */ 4106 {0xa0, 0x00, ZC3XX_R003_FRAMEWIDTHHIGH},
4110 {0xa0, 0xb0, ZC3XX_R004_FRAMEWIDTHLOW}, /* FrameWidthLow B0 */ 4107 {0xa0, 0xb0, ZC3XX_R004_FRAMEWIDTHLOW},
4111 {0xa0, 0x00, ZC3XX_R005_FRAMEHEIGHTHIGH}, /* FrameHeightHigh 00 */ 4108 {0xa0, 0x00, ZC3XX_R005_FRAMEHEIGHTHIGH},
4112 {0xa0, 0x90, ZC3XX_R006_FRAMEHEIGHTLOW}, /* FrameHightLow 90 */ 4109 {0xa0, 0x90, ZC3XX_R006_FRAMEHEIGHTLOW},
4113/* System */ 4110/* System */
4114 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, /* SystemOperating */ 4111 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING},
4115/* Sream and Sensor specific */ 4112/* Sream and Sensor specific */
4116 {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, /* VideoControlFunction */ 4113 {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC},
4117 {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, /* VideoControlFunction */ 4114 {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC},
4118/* Sensor Interface */ 4115/* Sensor Interface */
4119 {0xa0, 0x08, ZC3XX_R08D_COMPABILITYMODE}, /* Compatibily Mode */ 4116 {0xa0, 0x08, ZC3XX_R08D_COMPABILITYMODE},
4120/* Window inside sensor array */ 4117/* Window inside sensor array */
4121 {0xa0, 0x03, ZC3XX_R09A_WINXSTARTLOW}, /* WinXStartLow */ 4118 {0xa0, 0x03, ZC3XX_R09A_WINXSTARTLOW},
4122 {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, /* FirstYLow */ 4119 {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW},
4123 {0xa0, 0x03, ZC3XX_R11C_FIRSTXLOW}, /* FirstxLow */ 4120 {0xa0, 0x03, ZC3XX_R11C_FIRSTXLOW},
4124 {0xa0, 0x28, ZC3XX_R09C_WINHEIGHTLOW}, /* WinHeightLow */ 4121 {0xa0, 0x28, ZC3XX_R09C_WINHEIGHTLOW},
4125 {0xa0, 0x68, ZC3XX_R09E_WINWIDTHLOW}, /* WinWidthLow */ 4122 {0xa0, 0x68, ZC3XX_R09E_WINWIDTHLOW},
4126/* Init the sensor */ 4123/* Init the sensor */
4127 {0xaa, 0x02, 0x0004}, 4124 {0xaa, 0x02, 0x0004},
4128 {0xaa, 0x08, 0x0000}, 4125 {0xaa, 0x08, 0x0000},
@@ -4135,40 +4132,40 @@ static const struct usb_action pas106b_Initial[] = { /* 176x144 */
4135 {0xaa, 0x14, 0x0081}, 4132 {0xaa, 0x14, 0x0081},
4136 4133
4137/* Other registors */ 4134/* Other registors */
4138 {0xa0, 0x37, ZC3XX_R101_SENSORCORRECTION}, /* SensorCorrection */ 4135 {0xa0, 0x37, ZC3XX_R101_SENSORCORRECTION},
4139/* Frame retreiving */ 4136/* Frame retreiving */
4140 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* AutoAdjustFPS */ 4137 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
4141/* Gains */ 4138/* Gains */
4142 {0xa0, 0xa0, ZC3XX_R1A8_DIGITALGAIN}, /* DigitalGain */ 4139 {0xa0, 0xa0, ZC3XX_R1A8_DIGITALGAIN},
4143/* Unknown */ 4140/* Unknown */
4144 {0xa0, 0x00, 0x01ad}, 4141 {0xa0, 0x00, 0x01ad},
4145/* Sharpness */ 4142/* Sharpness */
4146 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, /* SharpnessMode */ 4143 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE},
4147 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, /* Sharpness05 */ 4144 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05},
4148/* Other registors */ 4145/* Other registors */
4149 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, /* OperationMode */ 4146 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE},
4150/* Auto exposure and white balance */ 4147/* Auto exposure and white balance */
4151 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, /* AWBStatus */ 4148 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS},
4152/*Dead pixels */ 4149/*Dead pixels */
4153 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, /* DeadPixelsMode */ 4150 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE},
4154/* EEPROM */ 4151/* EEPROM */
4155 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, /* EEPROMAccess */ 4152 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS},
4156/* JPEG control */ 4153/* JPEG control */
4157 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* ClockSetting */ 4154 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
4158 {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */ 4155 {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00},
4159 {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */ 4156 {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05},
4160/* Other registers */ 4157/* Other registers */
4161 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, /* OperationMode */ 4158 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE},
4162/* Auto exposure and white balance */ 4159/* Auto exposure and white balance */
4163 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, /* AWBStatus */ 4160 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS},
4164/*Dead pixels */ 4161/*Dead pixels */
4165 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, /* DeadPixelsMode */ 4162 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE},
4166/* EEPROM */ 4163/* EEPROM */
4167 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, /* EEPROMAccess */ 4164 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS},
4168/* JPEG control */ 4165/* JPEG control */
4169 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* ClockSetting */ 4166 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
4170 {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */ 4167 {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00},
4171 {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */ 4168 {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05},
4172 4169
4173 {0xa0, 0x58, ZC3XX_R10A_RGB00}, /* matrix */ 4170 {0xa0, 0x58, ZC3XX_R10A_RGB00}, /* matrix */
4174 {0xa0, 0xf4, ZC3XX_R10B_RGB01}, 4171 {0xa0, 0xf4, ZC3XX_R10B_RGB01},
@@ -4180,67 +4177,67 @@ static const struct usb_action pas106b_Initial[] = { /* 176x144 */
4180 {0xa0, 0xf4, ZC3XX_R111_RGB21}, 4177 {0xa0, 0xf4, ZC3XX_R111_RGB21},
4181 {0xa0, 0x58, ZC3XX_R112_RGB22}, 4178 {0xa0, 0x58, ZC3XX_R112_RGB22},
4182/* Auto correction */ 4179/* Auto correction */
4183 {0xa0, 0x03, ZC3XX_R181_WINXSTART}, /* WinXstart */ 4180 {0xa0, 0x03, ZC3XX_R181_WINXSTART},
4184 {0xa0, 0x08, ZC3XX_R182_WINXWIDTH}, /* WinXWidth */ 4181 {0xa0, 0x08, ZC3XX_R182_WINXWIDTH},
4185 {0xa0, 0x16, ZC3XX_R183_WINXCENTER}, /* WinXCenter */ 4182 {0xa0, 0x16, ZC3XX_R183_WINXCENTER},
4186 {0xa0, 0x03, ZC3XX_R184_WINYSTART}, /* WinYStart */ 4183 {0xa0, 0x03, ZC3XX_R184_WINYSTART},
4187 {0xa0, 0x05, ZC3XX_R185_WINYWIDTH}, /* WinYWidth */ 4184 {0xa0, 0x05, ZC3XX_R185_WINYWIDTH},
4188 {0xa0, 0x14, ZC3XX_R186_WINYCENTER}, /* WinYCenter */ 4185 {0xa0, 0x14, ZC3XX_R186_WINYCENTER},
4189 {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE}, /* AutoCorrectEnable */ 4186 {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE},
4190 4187
4191/* Auto exposure and white balance */ 4188/* Auto exposure and white balance */
4192 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* ExposureLimitHigh */ 4189 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH},
4193 {0xa0, 0x03, ZC3XX_R191_EXPOSURELIMITMID}, /* ExposureLimitMid */ 4190 {0xa0, 0x03, ZC3XX_R191_EXPOSURELIMITMID},
4194 {0xa0, 0xb1, ZC3XX_R192_EXPOSURELIMITLOW}, /* ExposureLimitLow */ 4191 {0xa0, 0xb1, ZC3XX_R192_EXPOSURELIMITLOW},
4195 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* AntiFlickerHigh */ 4192 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
4196 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* AntiFlickerLow */ 4193 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID},
4197 {0xa0, 0x87, ZC3XX_R197_ANTIFLICKERLOW}, /* AntiFlickerLow */ 4194 {0xa0, 0x87, ZC3XX_R197_ANTIFLICKERLOW},
4198 {0xa0, 0x0c, ZC3XX_R18C_AEFREEZE}, /* AEBFreeze */ 4195 {0xa0, 0x0c, ZC3XX_R18C_AEFREEZE},
4199 {0xa0, 0x18, ZC3XX_R18F_AEUNFREEZE}, /* AEBUnfreeze */ 4196 {0xa0, 0x18, ZC3XX_R18F_AEUNFREEZE},
4200/* sensor on */ 4197/* sensor on */
4201 {0xaa, 0x07, 0x00b1}, 4198 {0xaa, 0x07, 0x00b1},
4202 {0xaa, 0x05, 0x0003}, 4199 {0xaa, 0x05, 0x0003},
4203 {0xaa, 0x04, 0x0001}, 4200 {0xaa, 0x04, 0x0001},
4204 {0xaa, 0x03, 0x003b}, 4201 {0xaa, 0x03, 0x003b},
4205/* Gains */ 4202/* Gains */
4206 {0xa0, 0x20, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* DigitalLimitDiff */ 4203 {0xa0, 0x20, ZC3XX_R1A9_DIGITALLIMITDIFF},
4207 {0xa0, 0x26, ZC3XX_R1AA_DIGITALGAINSTEP}, /* DigitalGainStep */ 4204 {0xa0, 0x26, ZC3XX_R1AA_DIGITALGAINSTEP},
4208 {0xa0, 0xa0, ZC3XX_R11D_GLOBALGAIN}, /* GlobalGain */ 4205 {0xa0, 0xa0, ZC3XX_R11D_GLOBALGAIN},
4209 {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN}, /* GlobalGain */ 4206 {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN},
4210/* Auto correction */ 4207/* Auto correction */
4211 {0xa0, 0x40, ZC3XX_R180_AUTOCORRECTENABLE}, /* AutoCorrectEnable */ 4208 {0xa0, 0x40, ZC3XX_R180_AUTOCORRECTENABLE},
4212 {0xa1, 0x01, 0x0180}, /* AutoCorrectEnable */ 4209 {0xa1, 0x01, 0x0180}, /* AutoCorrectEnable */
4213 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, /* AutoCorrectEnable */ 4210 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE},
4214/* Gains */ 4211/* Gains */
4215 {0xa0, 0x40, ZC3XX_R116_RGAIN}, /* RGain */ 4212 {0xa0, 0x40, ZC3XX_R116_RGAIN},
4216 {0xa0, 0x40, ZC3XX_R117_GGAIN}, /* GGain */ 4213 {0xa0, 0x40, ZC3XX_R117_GGAIN},
4217 {0xa0, 0x40, ZC3XX_R118_BGAIN}, /* BGain */ 4214 {0xa0, 0x40, ZC3XX_R118_BGAIN},
4218 {} 4215 {}
4219}; 4216};
4220 4217
4221static const struct usb_action pas106b_InitialScale[] = { /* 352x288 */ 4218static const struct usb_action pas106b_InitialScale[] = { /* 352x288 */
4222/* JPEG control */ 4219/* JPEG control */
4223 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* ClockSetting */ 4220 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
4224/* Sream and Sensor specific */ 4221/* Sream and Sensor specific */
4225 {0xa0, 0x0f, ZC3XX_R010_CMOSSENSORSELECT}, /* CMOSSensorSelect */ 4222 {0xa0, 0x0f, ZC3XX_R010_CMOSSENSORSELECT},
4226/* Picture size */ 4223/* Picture size */
4227 {0xa0, 0x01, ZC3XX_R003_FRAMEWIDTHHIGH}, /* FrameWidthHigh */ 4224 {0xa0, 0x01, ZC3XX_R003_FRAMEWIDTHHIGH},
4228 {0xa0, 0x60, ZC3XX_R004_FRAMEWIDTHLOW}, /* FrameWidthLow */ 4225 {0xa0, 0x60, ZC3XX_R004_FRAMEWIDTHLOW},
4229 {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, /* FrameHeightHigh */ 4226 {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH},
4230 {0xa0, 0x20, ZC3XX_R006_FRAMEHEIGHTLOW}, /* FrameHightLow */ 4227 {0xa0, 0x20, ZC3XX_R006_FRAMEHEIGHTLOW},
4231/* System */ 4228/* System */
4232 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, /* SystemOperating */ 4229 {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING},
4233/* Sream and Sensor specific */ 4230/* Sream and Sensor specific */
4234 {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, /* VideoControlFunction */ 4231 {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC},
4235 {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, /* VideoControlFunction */ 4232 {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC},
4236/* Sensor Interface */ 4233/* Sensor Interface */
4237 {0xa0, 0x08, ZC3XX_R08D_COMPABILITYMODE}, /* Compatibily Mode */ 4234 {0xa0, 0x08, ZC3XX_R08D_COMPABILITYMODE},
4238/* Window inside sensor array */ 4235/* Window inside sensor array */
4239 {0xa0, 0x03, ZC3XX_R09A_WINXSTARTLOW}, /* WinXStartLow */ 4236 {0xa0, 0x03, ZC3XX_R09A_WINXSTARTLOW},
4240 {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, /* FirstYLow */ 4237 {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW},
4241 {0xa0, 0x03, ZC3XX_R11C_FIRSTXLOW}, /* FirstxLow */ 4238 {0xa0, 0x03, ZC3XX_R11C_FIRSTXLOW},
4242 {0xa0, 0x28, ZC3XX_R09C_WINHEIGHTLOW}, /* WinHeightLow */ 4239 {0xa0, 0x28, ZC3XX_R09C_WINHEIGHTLOW},
4243 {0xa0, 0x68, ZC3XX_R09E_WINWIDTHLOW}, /* WinWidthLow */ 4240 {0xa0, 0x68, ZC3XX_R09E_WINWIDTHLOW},
4244/* Init the sensor */ 4241/* Init the sensor */
4245 {0xaa, 0x02, 0x0004}, 4242 {0xaa, 0x02, 0x0004},
4246 {0xaa, 0x08, 0x0000}, 4243 {0xaa, 0x08, 0x0000},
@@ -4253,41 +4250,41 @@ static const struct usb_action pas106b_InitialScale[] = { /* 352x288 */
4253 {0xaa, 0x14, 0x0081}, 4250 {0xaa, 0x14, 0x0081},
4254 4251
4255/* Other registors */ 4252/* Other registors */
4256 {0xa0, 0x37, ZC3XX_R101_SENSORCORRECTION}, /* SensorCorrection */ 4253 {0xa0, 0x37, ZC3XX_R101_SENSORCORRECTION},
4257/* Frame retreiving */ 4254/* Frame retreiving */
4258 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* AutoAdjustFPS */ 4255 {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS},
4259/* Gains */ 4256/* Gains */
4260 {0xa0, 0xa0, ZC3XX_R1A8_DIGITALGAIN}, /* DigitalGain */ 4257 {0xa0, 0xa0, ZC3XX_R1A8_DIGITALGAIN},
4261/* Unknown */ 4258/* Unknown */
4262 {0xa0, 0x00, 0x01ad}, 4259 {0xa0, 0x00, 0x01ad},
4263/* Sharpness */ 4260/* Sharpness */
4264 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, /* SharpnessMode */ 4261 {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE},
4265 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, /* Sharpness05 */ 4262 {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05},
4266/* Other registors */ 4263/* Other registors */
4267 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, /* OperationMode */ 4264 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE},
4268/* Auto exposure and white balance */ 4265/* Auto exposure and white balance */
4269 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, /* AWBStatus */ 4266 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS},
4270 {0xa0, 0x80, ZC3XX_R18D_YTARGET}, /* ????????? */ 4267 {0xa0, 0x80, ZC3XX_R18D_YTARGET},
4271/*Dead pixels */ 4268/*Dead pixels */
4272 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, /* DeadPixelsMode */ 4269 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE},
4273/* EEPROM */ 4270/* EEPROM */
4274 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, /* EEPROMAccess */ 4271 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS},
4275/* JPEG control */ 4272/* JPEG control */
4276 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* ClockSetting */ 4273 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
4277 {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */ 4274 {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00},
4278 {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */ 4275 {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05},
4279/* Other registers */ 4276/* Other registers */
4280 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, /* OperationMode */ 4277 {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE},
4281/* Auto exposure and white balance */ 4278/* Auto exposure and white balance */
4282 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, /* AWBStatus */ 4279 {0xa0, 0x06, ZC3XX_R189_AWBSTATUS},
4283/*Dead pixels */ 4280/*Dead pixels */
4284 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, /* DeadPixelsMode */ 4281 {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE},
4285/* EEPROM */ 4282/* EEPROM */
4286 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, /* EEPROMAccess */ 4283 {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS},
4287/* JPEG control */ 4284/* JPEG control */
4288 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* ClockSetting */ 4285 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
4289 {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */ 4286 {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00},
4290 {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */ 4287 {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05},
4291 4288
4292 {0xa0, 0x58, ZC3XX_R10A_RGB00}, /* matrix */ 4289 {0xa0, 0x58, ZC3XX_R10A_RGB00}, /* matrix */
4293 {0xa0, 0xf4, ZC3XX_R10B_RGB01}, 4290 {0xa0, 0xf4, ZC3XX_R10B_RGB01},
@@ -4299,43 +4296,43 @@ static const struct usb_action pas106b_InitialScale[] = { /* 352x288 */
4299 {0xa0, 0xf4, ZC3XX_R111_RGB21}, 4296 {0xa0, 0xf4, ZC3XX_R111_RGB21},
4300 {0xa0, 0x58, ZC3XX_R112_RGB22}, 4297 {0xa0, 0x58, ZC3XX_R112_RGB22},
4301/* Auto correction */ 4298/* Auto correction */
4302 {0xa0, 0x03, ZC3XX_R181_WINXSTART}, /* WinXstart */ 4299 {0xa0, 0x03, ZC3XX_R181_WINXSTART},
4303 {0xa0, 0x08, ZC3XX_R182_WINXWIDTH}, /* WinXWidth */ 4300 {0xa0, 0x08, ZC3XX_R182_WINXWIDTH},
4304 {0xa0, 0x16, ZC3XX_R183_WINXCENTER}, /* WinXCenter */ 4301 {0xa0, 0x16, ZC3XX_R183_WINXCENTER},
4305 {0xa0, 0x03, ZC3XX_R184_WINYSTART}, /* WinYStart */ 4302 {0xa0, 0x03, ZC3XX_R184_WINYSTART},
4306 {0xa0, 0x05, ZC3XX_R185_WINYWIDTH}, /* WinYWidth */ 4303 {0xa0, 0x05, ZC3XX_R185_WINYWIDTH},
4307 {0xa0, 0x14, ZC3XX_R186_WINYCENTER}, /* WinYCenter */ 4304 {0xa0, 0x14, ZC3XX_R186_WINYCENTER},
4308 {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE}, /* AutoCorrectEnable */ 4305 {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE},
4309 4306
4310/* Auto exposure and white balance */ 4307/* Auto exposure and white balance */
4311 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* ExposureLimitHigh 0 */ 4308 {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH},
4312 {0xa0, 0x03, ZC3XX_R191_EXPOSURELIMITMID}, /* ExposureLimitMid */ 4309 {0xa0, 0x03, ZC3XX_R191_EXPOSURELIMITMID},
4313 {0xa0, 0xb1, ZC3XX_R192_EXPOSURELIMITLOW}, /* ExposureLimitLow 0xb1 */ 4310 {0xa0, 0xb1, ZC3XX_R192_EXPOSURELIMITLOW},
4314 4311
4315 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* AntiFlickerHigh 0x00 */ 4312 {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH},
4316 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* AntiFlickerLow 0x00 */ 4313 {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID},
4317 {0xa0, 0x87, ZC3XX_R197_ANTIFLICKERLOW}, /* AntiFlickerLow 0x87 */ 4314 {0xa0, 0x87, ZC3XX_R197_ANTIFLICKERLOW},
4318 4315
4319 {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* AEBFreeze 0x10 0x0c */ 4316 {0xa0, 0x10, ZC3XX_R18C_AEFREEZE},
4320 {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* AEBUnfreeze 0x30 0x18 */ 4317 {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE},
4321/* sensor on */ 4318/* sensor on */
4322 {0xaa, 0x07, 0x00b1}, 4319 {0xaa, 0x07, 0x00b1},
4323 {0xaa, 0x05, 0x0003}, 4320 {0xaa, 0x05, 0x0003},
4324 {0xaa, 0x04, 0x0001}, 4321 {0xaa, 0x04, 0x0001},
4325 {0xaa, 0x03, 0x003b}, 4322 {0xaa, 0x03, 0x003b},
4326/* Gains */ 4323/* Gains */
4327 {0xa0, 0x20, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* DigitalLimitDiff */ 4324 {0xa0, 0x20, ZC3XX_R1A9_DIGITALLIMITDIFF},
4328 {0xa0, 0x26, ZC3XX_R1AA_DIGITALGAINSTEP}, /* DigitalGainStep */ 4325 {0xa0, 0x26, ZC3XX_R1AA_DIGITALGAINSTEP},
4329 {0xa0, 0xa0, ZC3XX_R11D_GLOBALGAIN}, /* GlobalGain */ 4326 {0xa0, 0xa0, ZC3XX_R11D_GLOBALGAIN},
4330 {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN}, /* GlobalGain */ 4327 {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN},
4331/* Auto correction */ 4328/* Auto correction */
4332 {0xa0, 0x40, ZC3XX_R180_AUTOCORRECTENABLE}, /* AutoCorrectEnable */ 4329 {0xa0, 0x40, ZC3XX_R180_AUTOCORRECTENABLE},
4333 {0xa1, 0x01, 0x0180}, /* AutoCorrectEnable */ 4330 {0xa1, 0x01, 0x0180}, /* AutoCorrectEnable */
4334 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, /* AutoCorrectEnable */ 4331 {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE},
4335/* Gains */ 4332/* Gains */
4336 {0xa0, 0x40, ZC3XX_R116_RGAIN}, /* RGain */ 4333 {0xa0, 0x40, ZC3XX_R116_RGAIN},
4337 {0xa0, 0x40, ZC3XX_R117_GGAIN}, /* GGain */ 4334 {0xa0, 0x40, ZC3XX_R117_GGAIN},
4338 {0xa0, 0x40, ZC3XX_R118_BGAIN}, /* BGain */ 4335 {0xa0, 0x40, ZC3XX_R118_BGAIN},
4339 4336
4340 {0xa0, 0x00, 0x0007}, /* AutoCorrectEnable */ 4337 {0xa0, 0x00, 0x0007}, /* AutoCorrectEnable */
4341 {0xa0, 0xff, ZC3XX_R018_FRAMELOST}, /* Frame adjust */ 4338 {0xa0, 0xff, ZC3XX_R018_FRAMELOST}, /* Frame adjust */
@@ -4459,8 +4456,8 @@ static const struct usb_action pb03303x_Initial[] = {
4459 {0xa0, 0x50, ZC3XX_R112_RGB22}, 4456 {0xa0, 0x50, ZC3XX_R112_RGB22},
4460 4457
4461 {0xa1, 0x01, 0x0008}, 4458 {0xa1, 0x01, 0x0008},
4462 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* clock ? */ 4459 {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING},
4463 {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */ 4460 {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00},
4464 {0xa1, 0x01, 0x01c8}, 4461 {0xa1, 0x01, 0x01c8},
4465 {0xa1, 0x01, 0x01c9}, 4462 {0xa1, 0x01, 0x01c9},
4466 {0xa1, 0x01, 0x01ca}, 4463 {0xa1, 0x01, 0x01ca},
@@ -5984,7 +5981,7 @@ static const struct usb_action tas5130c_vf0250_Initial[] = {
5984 {0xaa, 0x1b, 0x0000}, /* 00,1b,00,aa, */ 5981 {0xaa, 0x1b, 0x0000}, /* 00,1b,00,aa, */
5985 {0xaa, 0x13, 0x0002}, /* 00,13,02,aa, */ 5982 {0xaa, 0x13, 0x0002}, /* 00,13,02,aa, */
5986 {0xaa, 0x15, 0x0004}, /* 00,15,04,aa */ 5983 {0xaa, 0x15, 0x0004}, /* 00,15,04,aa */
5987 {0xaa, 0x01, 0x0000}, 5984/*?? {0xaa, 0x01, 0x0000}, */
5988 {0xaa, 0x01, 0x0000}, 5985 {0xaa, 0x01, 0x0000},
5989 {0xaa, 0x1a, 0x0000}, /* 00,1a,00,aa, */ 5986 {0xaa, 0x1a, 0x0000}, /* 00,1a,00,aa, */
5990 {0xaa, 0x1c, 0x0017}, /* 00,1c,17,aa, */ 5987 {0xaa, 0x1c, 0x0017}, /* 00,1c,17,aa, */
@@ -6000,8 +5997,8 @@ static const struct usb_action tas5130c_vf0250_Initial[] = {
6000 {0xaa, 0x0f, 0x00a0}, /* 00,0f,a0,aa, */ 5997 {0xaa, 0x0f, 0x00a0}, /* 00,0f,a0,aa, */
6001 {0xaa, 0x10, 0x0000}, /* 00,10,00,aa, */ 5998 {0xaa, 0x10, 0x0000}, /* 00,10,00,aa, */
6002 {0xaa, 0x11, 0x00a0}, /* 00,11,a0,aa, */ 5999 {0xaa, 0x11, 0x00a0}, /* 00,11,a0,aa, */
6003 {0xa0, 0x00, 0x0039}, 6000/*?? {0xa0, 0x00, 0x0039},
6004 {0xa1, 0x01, 0x0037}, 6001 {0xa1, 0x01, 0x0037}, */
6005 {0xaa, 0x16, 0x0001}, /* 00,16,01,aa, */ 6002 {0xaa, 0x16, 0x0001}, /* 00,16,01,aa, */
6006 {0xaa, 0x17, 0x00e8}, /* 00,17,e6,aa, (e6 -> e8) */ 6003 {0xaa, 0x17, 0x00e8}, /* 00,17,e6,aa, (e6 -> e8) */
6007 {0xaa, 0x18, 0x0002}, /* 00,18,02,aa, */ 6004 {0xaa, 0x18, 0x0002}, /* 00,18,02,aa, */
@@ -6272,7 +6269,7 @@ static void reg_w(struct usb_device *dev,
6272 __u8 value, 6269 __u8 value,
6273 __u16 index) 6270 __u16 index)
6274{ 6271{
6275 PDEBUG(D_USBO, "reg w %02x -> [%04x]", value, index); 6272 PDEBUG(D_USBO, "reg w [%04x] = %02x", index, value);
6276 reg_w_i(dev, value, index); 6273 reg_w_i(dev, value, index);
6277} 6274}
6278 6275
@@ -6280,17 +6277,17 @@ static __u16 i2c_read(struct gspca_dev *gspca_dev,
6280 __u8 reg) 6277 __u8 reg)
6281{ 6278{
6282 __u8 retbyte; 6279 __u8 retbyte;
6283 __u8 retval[2]; 6280 __u16 retval;
6284 6281
6285 reg_w_i(gspca_dev->dev, reg, 0x92); 6282 reg_w_i(gspca_dev->dev, reg, 0x92);
6286 reg_w_i(gspca_dev->dev, 0x02, 0x90); /* <- read command */ 6283 reg_w_i(gspca_dev->dev, 0x02, 0x90); /* <- read command */
6287 msleep(25); 6284 msleep(25);
6288 retbyte = reg_r_i(gspca_dev, 0x0091); /* read status */ 6285 retbyte = reg_r_i(gspca_dev, 0x0091); /* read status */
6289 retval[0] = reg_r_i(gspca_dev, 0x0095); /* read Lowbyte */ 6286 retval = reg_r_i(gspca_dev, 0x0095); /* read Lowbyte */
6290 retval[1] = reg_r_i(gspca_dev, 0x0096); /* read Hightbyte */ 6287 retval |= reg_r_i(gspca_dev, 0x0096) << 8; /* read Hightbyte */
6291 PDEBUG(D_USBO, "i2c r [%02x] -> (%02x) %02x%02x", 6288 PDEBUG(D_USBO, "i2c r [%02x] -> %04x (%02x)",
6292 reg, retbyte, retval[1], retval[0]); 6289 reg, retval, retbyte);
6293 return (retval[1] << 8) | retval[0]; 6290 return retval;
6294} 6291}
6295 6292
6296static __u8 i2c_write(struct gspca_dev *gspca_dev, 6293static __u8 i2c_write(struct gspca_dev *gspca_dev,
@@ -6306,7 +6303,7 @@ static __u8 i2c_write(struct gspca_dev *gspca_dev,
6306 reg_w_i(gspca_dev->dev, 0x01, 0x90); /* <- write command */ 6303 reg_w_i(gspca_dev->dev, 0x01, 0x90); /* <- write command */
6307 msleep(5); 6304 msleep(5);
6308 retbyte = reg_r_i(gspca_dev, 0x0091); /* read status */ 6305 retbyte = reg_r_i(gspca_dev, 0x0091); /* read status */
6309 PDEBUG(D_USBO, "i2c w [%02x] %02x%02x (%02x)", 6306 PDEBUG(D_USBO, "i2c w [%02x] = %02x%02x (%02x)",
6310 reg, valH, valL, retbyte); 6307 reg, valH, valL, retbyte);
6311 return retbyte; 6308 return retbyte;
6312} 6309}
@@ -6349,6 +6346,8 @@ static void setmatrix(struct gspca_dev *gspca_dev)
6349 {0x58, 0xf4, 0xf4, 0xf4, 0x58, 0xf4, 0xf4, 0xf4, 0x58}; 6346 {0x58, 0xf4, 0xf4, 0xf4, 0x58, 0xf4, 0xf4, 0xf4, 0x58};
6350 static const __u8 po2030_matrix[9] = 6347 static const __u8 po2030_matrix[9] =
6351 {0x60, 0xf0, 0xf0, 0xf0, 0x60, 0xf0, 0xf0, 0xf0, 0x60}; 6348 {0x60, 0xf0, 0xf0, 0xf0, 0x60, 0xf0, 0xf0, 0xf0, 0x60};
6349 static const __u8 vf0250_matrix[9] =
6350 {0x7b, 0xea, 0xea, 0xea, 0x7b, 0xea, 0xea, 0xea, 0x7b};
6352 6351
6353 switch (sd->sensor) { 6352 switch (sd->sensor) {
6354 case SENSOR_GC0305: 6353 case SENSOR_GC0305:
@@ -6363,8 +6362,9 @@ static void setmatrix(struct gspca_dev *gspca_dev)
6363 case SENSOR_PO2030: 6362 case SENSOR_PO2030:
6364 matrix = po2030_matrix; 6363 matrix = po2030_matrix;
6365 break; 6364 break;
6366 case SENSOR_TAS5130C_VF0250: /* no matrix? */ 6365 case SENSOR_TAS5130C_VF0250:
6367 return; 6366 matrix = vf0250_matrix;
6367 break;
6368 default: /* matrix already loaded */ 6368 default: /* matrix already loaded */
6369 return; 6369 return;
6370 } 6370 }
@@ -6744,7 +6744,7 @@ static int vga_2wr_probe(struct gspca_dev *gspca_dev)
6744 return 0x04; /* CS2102 */ 6744 return 0x04; /* CS2102 */
6745 6745
6746 start_2wr_probe(dev, 0x06); /* OmniVision */ 6746 start_2wr_probe(dev, 0x06); /* OmniVision */
6747 reg_w(dev, 0x08, 0x8d); 6747 reg_w(dev, 0x08, 0x008d);
6748 i2c_write(gspca_dev, 0x11, 0xaa, 0x00); 6748 i2c_write(gspca_dev, 0x11, 0xaa, 0x00);
6749 retbyte = i2c_read(gspca_dev, 0x11); 6749 retbyte = i2c_read(gspca_dev, 0x11);
6750 if (retbyte != 0) { 6750 if (retbyte != 0) {
@@ -6778,7 +6778,7 @@ static int vga_2wr_probe(struct gspca_dev *gspca_dev)
6778 return 0x0c; /* ICM105A */ 6778 return 0x0c; /* ICM105A */
6779 6779
6780 start_2wr_probe(dev, 0x0e); /* PAS202BCB */ 6780 start_2wr_probe(dev, 0x0e); /* PAS202BCB */
6781 reg_w(dev, 0x08, 0x8d); 6781 reg_w(dev, 0x08, 0x008d);
6782 i2c_write(gspca_dev, 0x03, 0xaa, 0x00); 6782 i2c_write(gspca_dev, 0x03, 0xaa, 0x00);
6783 msleep(500); 6783 msleep(500);
6784 retbyte = i2c_read(gspca_dev, 0x03); 6784 retbyte = i2c_read(gspca_dev, 0x03);
@@ -6830,7 +6830,6 @@ static const struct sensor_by_chipset_revision chipset_revision_sensor[] = {
6830 {0x8001, 0x13}, 6830 {0x8001, 0x13},
6831 {0x8000, 0x14}, /* CS2102K */ 6831 {0x8000, 0x14}, /* CS2102K */
6832 {0x8400, 0x15}, /* TAS5130K */ 6832 {0x8400, 0x15}, /* TAS5130K */
6833 {0, 0}
6834}; 6833};
6835 6834
6836static int vga_3wr_probe(struct gspca_dev *gspca_dev) 6835static int vga_3wr_probe(struct gspca_dev *gspca_dev)
@@ -6843,7 +6842,7 @@ static int vga_3wr_probe(struct gspca_dev *gspca_dev)
6843 6842
6844/*fixme: lack of 8b=b3 (11,12)-> 10, 8b=e0 (14,15,16)-> 12 found in gspcav1*/ 6843/*fixme: lack of 8b=b3 (11,12)-> 10, 8b=e0 (14,15,16)-> 12 found in gspcav1*/
6845 reg_w(dev, 0x02, 0x0010); 6844 reg_w(dev, 0x02, 0x0010);
6846 reg_r(gspca_dev, 0x10); 6845 reg_r(gspca_dev, 0x0010);
6847 reg_w(dev, 0x01, 0x0000); 6846 reg_w(dev, 0x01, 0x0000);
6848 reg_w(dev, 0x00, 0x0010); 6847 reg_w(dev, 0x00, 0x0010);
6849 reg_w(dev, 0x01, 0x0001); 6848 reg_w(dev, 0x01, 0x0001);
@@ -6869,17 +6868,15 @@ static int vga_3wr_probe(struct gspca_dev *gspca_dev)
6869 PDEBUG(D_PROBE, "probe 3wr vga 1 0x%04x", checkword); 6868 PDEBUG(D_PROBE, "probe 3wr vga 1 0x%04x", checkword);
6870 reg_r(gspca_dev, 0x0010); 6869 reg_r(gspca_dev, 0x0010);
6871 /* this is tested only once anyway */ 6870 /* this is tested only once anyway */
6872 i = 0; 6871 for (i = 0; i < ARRAY_SIZE(chipset_revision_sensor); i++) {
6873 while (chipset_revision_sensor[i].revision) {
6874 if (chipset_revision_sensor[i].revision == checkword) { 6872 if (chipset_revision_sensor[i].revision == checkword) {
6875 sd->chip_revision = checkword; 6873 sd->chip_revision = checkword;
6876 send_unknown(dev, SENSOR_PB0330); 6874 send_unknown(dev, SENSOR_PB0330);
6877 return chipset_revision_sensor[i].internal_sensor_id; 6875 return chipset_revision_sensor[i].internal_sensor_id;
6878 } 6876 }
6879 i++;
6880 } 6877 }
6881 6878
6882 reg_w(dev, 0x01, 0x0000); 6879 reg_w(dev, 0x01, 0x0000); /* check ?? */
6883 reg_w(dev, 0x01, 0x0001); 6880 reg_w(dev, 0x01, 0x0001);
6884 reg_w(dev, 0xdd, 0x008b); 6881 reg_w(dev, 0xdd, 0x008b);
6885 reg_w(dev, 0x0a, 0x0010); 6882 reg_w(dev, 0x0a, 0x0010);
@@ -6901,8 +6898,11 @@ static int vga_3wr_probe(struct gspca_dev *gspca_dev)
6901 retbyte = i2c_read(gspca_dev, 0x00); 6898 retbyte = i2c_read(gspca_dev, 0x00);
6902 if (retbyte != 0) { 6899 if (retbyte != 0) {
6903 PDEBUG(D_PROBE, "probe 3wr vga type %02x", retbyte); 6900 PDEBUG(D_PROBE, "probe 3wr vga type %02x", retbyte);
6904 send_unknown(dev, SENSOR_GC0305); 6901 if (retbyte == 0x11) /* VF0250 */
6905 return retbyte; /* 0x29 = gc0305 - should continue? */ 6902 return 0x0250;
6903 if (retbyte == 0x29) /* gc0305 */
6904 send_unknown(dev, SENSOR_GC0305);
6905 return retbyte;
6906 } 6906 }
6907 6907
6908 reg_w(dev, 0x01, 0x0000); /* check OmniVision */ 6908 reg_w(dev, 0x01, 0x0000); /* check OmniVision */
@@ -6918,18 +6918,18 @@ static int vga_3wr_probe(struct gspca_dev *gspca_dev)
6918 return 0x06; /* OmniVision confirm ? */ 6918 return 0x06; /* OmniVision confirm ? */
6919 } 6919 }
6920 6920
6921 reg_w(dev, 0x01, 0x00); 6921 reg_w(dev, 0x01, 0x0000);
6922 reg_w(dev, 0x00, 0x02); 6922 reg_w(dev, 0x00, 0x0002);
6923 reg_w(dev, 0x01, 0x10); 6923 reg_w(dev, 0x01, 0x0010);
6924 reg_w(dev, 0x01, 0x01); 6924 reg_w(dev, 0x01, 0x0001);
6925 reg_w(dev, 0xee, 0x8b); 6925 reg_w(dev, 0xee, 0x008b);
6926 reg_w(dev, 0x03, 0x12); 6926 reg_w(dev, 0x03, 0x0012);
6927/* msleep(150); */ 6927/* msleep(150); */
6928 reg_w(dev, 0x01, 0x12); 6928 reg_w(dev, 0x01, 0x0012);
6929 reg_w(dev, 0x05, 0x12); 6929 reg_w(dev, 0x05, 0x0012);
6930 retbyte = i2c_read(gspca_dev, 0x00); /* ID 0 */ 6930 retbyte = i2c_read(gspca_dev, 0x0000); /* ID 0 */
6931 checkword = retbyte << 8; 6931 checkword = retbyte << 8;
6932 retbyte = i2c_read(gspca_dev, 0x01); /* ID 1 */ 6932 retbyte = i2c_read(gspca_dev, 0x0001); /* ID 1 */
6933 checkword |= retbyte; 6933 checkword |= retbyte;
6934 PDEBUG(D_PROBE, "probe 3wr vga 2 0x%04x", checkword); 6934 PDEBUG(D_PROBE, "probe 3wr vga 2 0x%04x", checkword);
6935 if (checkword == 0x2030) { 6935 if (checkword == 0x2030) {
@@ -6939,14 +6939,14 @@ static int vga_3wr_probe(struct gspca_dev *gspca_dev)
6939 return checkword; 6939 return checkword;
6940 } 6940 }
6941 6941
6942 reg_w(dev, 0x01, 0x00); 6942 reg_w(dev, 0x01, 0x0000);
6943 reg_w(dev, 0x0a, 0x10); 6943 reg_w(dev, 0x0a, 0x0010);
6944 reg_w(dev, 0xd3, 0x8b); 6944 reg_w(dev, 0xd3, 0x008b);
6945 reg_w(dev, 0x01, 0x01); 6945 reg_w(dev, 0x01, 0x0001);
6946 reg_w(dev, 0x03, 0x12); 6946 reg_w(dev, 0x03, 0x0012);
6947 reg_w(dev, 0x01, 0x12); 6947 reg_w(dev, 0x01, 0x0012);
6948 reg_w(dev, 0x05, 0x01); 6948 reg_w(dev, 0x05, 0x0001);
6949 reg_w(dev, 0xd3, 0x8b); 6949 reg_w(dev, 0xd3, 0x008b);
6950 retbyte = i2c_read(gspca_dev, 0x01); 6950 retbyte = i2c_read(gspca_dev, 0x01);
6951 if (retbyte != 0) { 6951 if (retbyte != 0) {
6952 PDEBUG(D_PROBE, "probe 3wr vga type 0a ?"); 6952 PDEBUG(D_PROBE, "probe 3wr vga type 0a ?");
@@ -6962,7 +6962,9 @@ static int zcxx_probeSensor(struct gspca_dev *gspca_dev)
6962 6962
6963 switch (sd->sensor) { 6963 switch (sd->sensor) {
6964 case SENSOR_MC501CB: 6964 case SENSOR_MC501CB:
6965 return -1; /* don't probe */
6965 case SENSOR_TAS5130C_VF0250: 6966 case SENSOR_TAS5130C_VF0250:
6967 /* may probe but with write in reg 0x0010 */
6966 return -1; /* don't probe */ 6968 return -1; /* don't probe */
6967 } 6969 }
6968 sensor = vga_2wr_probe(gspca_dev); 6970 sensor = vga_2wr_probe(gspca_dev);
@@ -7010,30 +7012,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
7010 7012
7011 /* define some sensors from the vendor/product */ 7013 /* define some sensors from the vendor/product */
7012 sd->sharpness = 2; 7014 sd->sharpness = 2;
7013 switch (id->idVendor) { 7015 sd->sensor = id->driver_info;
7014 case 0x041e: /* Creative */
7015 switch (id->idProduct) {
7016 case 0x4051: /* zc301 chips */
7017 case 0x4053:
7018 sd->sensor = SENSOR_TAS5130C_VF0250;
7019 break;
7020 }
7021 break;
7022 case 0x046d: /* Logitech Labtec */
7023 switch (id->idProduct) {
7024 case 0x08dd:
7025 sd->sensor = SENSOR_MC501CB;
7026 break;
7027 }
7028 break;
7029 case 0x0ac8: /* Vimicro z-star */
7030 switch (id->idProduct) {
7031 case 0x305b:
7032 sd->sensor = SENSOR_TAS5130C_VF0250;
7033 break;
7034 }
7035 break;
7036 }
7037 sensor = zcxx_probeSensor(gspca_dev); 7016 sensor = zcxx_probeSensor(gspca_dev);
7038 if (sensor >= 0) 7017 if (sensor >= 0)
7039 PDEBUG(D_PROBE, "probe sensor -> %02x", sensor); 7018 PDEBUG(D_PROBE, "probe sensor -> %02x", sensor);
@@ -7119,6 +7098,10 @@ static int sd_config(struct gspca_dev *gspca_dev,
7119 PDEBUG(D_PROBE, "Find Sensor GC0305"); 7098 PDEBUG(D_PROBE, "Find Sensor GC0305");
7120 sd->sensor = SENSOR_GC0305; 7099 sd->sensor = SENSOR_GC0305;
7121 break; 7100 break;
7101 case 0x0250:
7102 PDEBUG(D_PROBE, "Sensor Tas5130 (VF0250)");
7103 sd->sensor = SENSOR_TAS5130C_VF0250;
7104 break;
7122 case 0x2030: 7105 case 0x2030:
7123 PDEBUG(D_PROBE, "Find Sensor PO2030"); 7106 PDEBUG(D_PROBE, "Find Sensor PO2030");
7124 sd->sensor = SENSOR_PO2030; 7107 sd->sensor = SENSOR_PO2030;
@@ -7146,7 +7129,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
7146 } 7129 }
7147 7130
7148 cam = &gspca_dev->cam; 7131 cam = &gspca_dev->cam;
7149 cam->dev_name = (char *) id->driver_info;
7150 cam->epaddr = 0x01; 7132 cam->epaddr = 0x01;
7151/*fixme:test*/ 7133/*fixme:test*/
7152 gspca_dev->nbalt--; 7134 gspca_dev->nbalt--;
@@ -7235,6 +7217,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
7235 case SENSOR_GC0305: 7217 case SENSOR_GC0305:
7236 case SENSOR_OV7620: 7218 case SENSOR_OV7620:
7237 case SENSOR_PO2030: 7219 case SENSOR_PO2030:
7220 case SENSOR_TAS5130C_VF0250:
7238 msleep(100); /* ?? */ 7221 msleep(100); /* ?? */
7239 reg_r(gspca_dev, 0x0002); /* --> 0x40 */ 7222 reg_r(gspca_dev, 0x0002); /* --> 0x40 */
7240 reg_w(dev, 0x09, 0x01ad); /* (from win traces) */ 7223 reg_w(dev, 0x09, 0x01ad); /* (from win traces) */
@@ -7515,70 +7498,69 @@ static const struct sd_desc sd_desc = {
7515 .querymenu = sd_querymenu, 7498 .querymenu = sd_querymenu,
7516}; 7499};
7517 7500
7518#define DVNM(name) .driver_info = (kernel_ulong_t) name
7519static const __devinitdata struct usb_device_id device_table[] = { 7501static const __devinitdata struct usb_device_id device_table[] = {
7520 {USB_DEVICE(0x041e, 0x041e), DVNM("Creative WebCam Live!")}, 7502 {USB_DEVICE(0x041e, 0x041e)},
7521#ifndef CONFIG_USB_ZC0301 7503#ifndef CONFIG_USB_ZC0301
7522 {USB_DEVICE(0x041e, 0x4017), DVNM("Creative Webcam Mobile PD1090")}, 7504 {USB_DEVICE(0x041e, 0x4017)},
7523 {USB_DEVICE(0x041e, 0x401c), DVNM("Creative NX")}, 7505 {USB_DEVICE(0x041e, 0x401c)},
7524 {USB_DEVICE(0x041e, 0x401e), DVNM("Creative Nx Pro")}, 7506 {USB_DEVICE(0x041e, 0x401e)},
7525 {USB_DEVICE(0x041e, 0x401f), DVNM("Creative Webcam Notebook PD1171")}, 7507 {USB_DEVICE(0x041e, 0x401f)},
7526#endif 7508#endif
7527 {USB_DEVICE(0x041e, 0x4029), DVNM("Creative WebCam Vista Pro")}, 7509 {USB_DEVICE(0x041e, 0x4029)},
7528#ifndef CONFIG_USB_ZC0301 7510#ifndef CONFIG_USB_ZC0301
7529 {USB_DEVICE(0x041e, 0x4034), DVNM("Creative Instant P0620")}, 7511 {USB_DEVICE(0x041e, 0x4034)},
7530 {USB_DEVICE(0x041e, 0x4035), DVNM("Creative Instant P0620D")}, 7512 {USB_DEVICE(0x041e, 0x4035)},
7531 {USB_DEVICE(0x041e, 0x4036), DVNM("Creative Live !")}, 7513 {USB_DEVICE(0x041e, 0x4036)},
7532 {USB_DEVICE(0x041e, 0x403a), DVNM("Creative Nx Pro 2")}, 7514 {USB_DEVICE(0x041e, 0x403a)},
7533#endif 7515#endif
7534 {USB_DEVICE(0x041e, 0x4051), DVNM("Creative Notebook Pro (VF0250)")}, 7516 {USB_DEVICE(0x041e, 0x4051), .driver_info = SENSOR_TAS5130C_VF0250},
7535 {USB_DEVICE(0x041e, 0x4053), DVNM("Creative Live!Cam Video IM")}, 7517 {USB_DEVICE(0x041e, 0x4053), .driver_info = SENSOR_TAS5130C_VF0250},
7536#ifndef CONFIG_USB_ZC0301 7518#ifndef CONFIG_USB_ZC0301
7537 {USB_DEVICE(0x0458, 0x7007), DVNM("Genius VideoCam V2")}, 7519 {USB_DEVICE(0x0458, 0x7007)},
7538 {USB_DEVICE(0x0458, 0x700c), DVNM("Genius VideoCam V3")}, 7520 {USB_DEVICE(0x0458, 0x700c)},
7539 {USB_DEVICE(0x0458, 0x700f), DVNM("Genius VideoCam Web V2")}, 7521 {USB_DEVICE(0x0458, 0x700f)},
7540#endif 7522#endif
7541 {USB_DEVICE(0x0461, 0x0a00), DVNM("MicroInnovation WebCam320")}, 7523 {USB_DEVICE(0x0461, 0x0a00)},
7542 {USB_DEVICE(0x046d, 0x08a0), DVNM("Logitech QC IM")}, 7524 {USB_DEVICE(0x046d, 0x08a0)},
7543 {USB_DEVICE(0x046d, 0x08a1), DVNM("Logitech QC IM 0x08A1 +sound")}, 7525 {USB_DEVICE(0x046d, 0x08a1)},
7544 {USB_DEVICE(0x046d, 0x08a2), DVNM("Labtec Webcam Pro")}, 7526 {USB_DEVICE(0x046d, 0x08a2)},
7545 {USB_DEVICE(0x046d, 0x08a3), DVNM("Logitech QC Chat")}, 7527 {USB_DEVICE(0x046d, 0x08a3)},
7546 {USB_DEVICE(0x046d, 0x08a6), DVNM("Logitech QCim")}, 7528 {USB_DEVICE(0x046d, 0x08a6)},
7547 {USB_DEVICE(0x046d, 0x08a7), DVNM("Logitech QuickCam Image")}, 7529 {USB_DEVICE(0x046d, 0x08a7)},
7548 {USB_DEVICE(0x046d, 0x08a9), DVNM("Logitech Notebook Deluxe")}, 7530 {USB_DEVICE(0x046d, 0x08a9)},
7549 {USB_DEVICE(0x046d, 0x08aa), DVNM("Labtec Webcam Notebook")}, 7531 {USB_DEVICE(0x046d, 0x08aa)},
7550 {USB_DEVICE(0x046d, 0x08ac), DVNM("Logitech QuickCam Cool")}, 7532 {USB_DEVICE(0x046d, 0x08ac)},
7551 {USB_DEVICE(0x046d, 0x08ad), DVNM("Logitech QCCommunicate STX")}, 7533 {USB_DEVICE(0x046d, 0x08ad)},
7552#ifndef CONFIG_USB_ZC0301 7534#ifndef CONFIG_USB_ZC0301
7553 {USB_DEVICE(0x046d, 0x08ae), DVNM("Logitech QuickCam for Notebooks")}, 7535 {USB_DEVICE(0x046d, 0x08ae)},
7554#endif 7536#endif
7555 {USB_DEVICE(0x046d, 0x08af), DVNM("Logitech QuickCam Cool")}, 7537 {USB_DEVICE(0x046d, 0x08af)},
7556 {USB_DEVICE(0x046d, 0x08b9), DVNM("Logitech QC IM ???")}, 7538 {USB_DEVICE(0x046d, 0x08b9)},
7557 {USB_DEVICE(0x046d, 0x08d7), DVNM("Logitech QCam STX")}, 7539 {USB_DEVICE(0x046d, 0x08d7)},
7558 {USB_DEVICE(0x046d, 0x08d9), DVNM("Logitech QuickCam IM/Connect")}, 7540 {USB_DEVICE(0x046d, 0x08d9)},
7559 {USB_DEVICE(0x046d, 0x08d8), DVNM("Logitech Notebook Deluxe")}, 7541 {USB_DEVICE(0x046d, 0x08d8)},
7560 {USB_DEVICE(0x046d, 0x08da), DVNM("Logitech QuickCam Messenger")}, 7542 {USB_DEVICE(0x046d, 0x08da)},
7561 {USB_DEVICE(0x046d, 0x08dd), DVNM("Logitech QuickCam for Notebooks")}, 7543 {USB_DEVICE(0x046d, 0x08dd), .driver_info = SENSOR_MC501CB},
7562 {USB_DEVICE(0x0471, 0x0325), DVNM("Philips SPC 200 NC")}, 7544 {USB_DEVICE(0x0471, 0x0325)},
7563 {USB_DEVICE(0x0471, 0x0326), DVNM("Philips SPC 300 NC")}, 7545 {USB_DEVICE(0x0471, 0x0326)},
7564 {USB_DEVICE(0x0471, 0x032d), DVNM("Philips spc210nc")}, 7546 {USB_DEVICE(0x0471, 0x032d)},
7565 {USB_DEVICE(0x0471, 0x032e), DVNM("Philips spc315nc")}, 7547 {USB_DEVICE(0x0471, 0x032e)},
7566 {USB_DEVICE(0x055f, 0xc005), DVNM("Mustek Wcam300A")}, 7548 {USB_DEVICE(0x055f, 0xc005)},
7567#ifndef CONFIG_USB_ZC0301 7549#ifndef CONFIG_USB_ZC0301
7568 {USB_DEVICE(0x055f, 0xd003), DVNM("Mustek WCam300A")}, 7550 {USB_DEVICE(0x055f, 0xd003)},
7569 {USB_DEVICE(0x055f, 0xd004), DVNM("Mustek WCam300 AN")}, 7551 {USB_DEVICE(0x055f, 0xd004)},
7570#endif 7552#endif
7571 {USB_DEVICE(0x0698, 0x2003), DVNM("CTX M730V built in")}, 7553 {USB_DEVICE(0x0698, 0x2003)},
7572 {USB_DEVICE(0x0ac8, 0x0302), DVNM("Z-star Vimicro zc0302")}, 7554 {USB_DEVICE(0x0ac8, 0x0302)},
7573#ifndef CONFIG_USB_ZC0301 7555#ifndef CONFIG_USB_ZC0301
7574 {USB_DEVICE(0x0ac8, 0x301b), DVNM("Z-Star zc301b")}, 7556 {USB_DEVICE(0x0ac8, 0x301b)},
7575 {USB_DEVICE(0x0ac8, 0x303b), DVNM("Vimicro 0x303b")}, 7557 {USB_DEVICE(0x0ac8, 0x303b)},
7576#endif 7558#endif
7577 {USB_DEVICE(0x0ac8, 0x305b), DVNM("Z-star Vimicro zc0305b")}, 7559 {USB_DEVICE(0x0ac8, 0x305b), .driver_info = SENSOR_TAS5130C_VF0250},
7578#ifndef CONFIG_USB_ZC0301 7560#ifndef CONFIG_USB_ZC0301
7579 {USB_DEVICE(0x0ac8, 0x307b), DVNM("Z-Star 307b")}, 7561 {USB_DEVICE(0x0ac8, 0x307b)},
7580 {USB_DEVICE(0x10fd, 0x0128), DVNM("Typhoon Webshot II 300k 0x0128")}, 7562 {USB_DEVICE(0x10fd, 0x0128)},
7581 {USB_DEVICE(0x10fd, 0x8050), DVNM("Typhoon Webshot II USB 300k")}, 7563 {USB_DEVICE(0x10fd, 0x8050)},
7582#endif 7564#endif
7583 {} /* end of entry */ 7565 {} /* end of entry */
7584}; 7566};
@@ -7605,7 +7587,7 @@ static int __init sd_mod_init(void)
7605{ 7587{
7606 if (usb_register(&sd_driver) < 0) 7588 if (usb_register(&sd_driver) < 0)
7607 return -1; 7589 return -1;
7608 PDEBUG(D_PROBE, "v%s registered", version); 7590 PDEBUG(D_PROBE, "registered");
7609 return 0; 7591 return 0;
7610} 7592}
7611 7593