aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Francois Moine <moinejf@free.fr>2008-06-12 09:58:58 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-07-20 06:14:45 -0400
commitd43fa32fec442571f10f5d0c3b553413288728de (patch)
tree6bbf2a57d5b9a94bca4246518094f32758eecb1e
parent4aa0d037a6c8e6b37ecfd986a444f83190c32a21 (diff)
V4L/DVB (8156): Many bug fixes, zc3xx added.
Signed-off-by: Jean-Francois Moine <moinejf@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--drivers/media/video/gspca/Makefile4
-rw-r--r--drivers/media/video/gspca/gspca.c991
-rw-r--r--drivers/media/video/gspca/gspca.h18
-rw-r--r--drivers/media/video/gspca/jpeg.h2
-rw-r--r--drivers/media/video/gspca/pac207.c31
-rw-r--r--drivers/media/video/gspca/stk014.c55
-rw-r--r--drivers/media/video/gspca/zc3xx.c7523
7 files changed, 8336 insertions, 288 deletions
diff --git a/drivers/media/video/gspca/Makefile b/drivers/media/video/gspca/Makefile
index 81170c19ba4..d959f777152 100644
--- a/drivers/media/video/gspca/Makefile
+++ b/drivers/media/video/gspca/Makefile
@@ -1,5 +1,7 @@
1obj-$(CONFIG_GSPCA) += gspca_main.o gspca_pac207.o gspca_stk014.o 1obj-$(CONFIG_GSPCA) += gspca_main.o \
2 gspca_pac207.o gspca_stk014.o gspca_zc3xx.o
2 3
3gspca_main-objs := gspca.o 4gspca_main-objs := gspca.o
4gspca_pac207-objs := pac207.o 5gspca_pac207-objs := pac207.o
5gspca_stk014-objs := stk014.o 6gspca_stk014-objs := stk014.o
7gspca_zc3xx-objs := zc3xx.o
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c
index 04dbaba4b78..423ebbdc4b4 100644
--- a/drivers/media/video/gspca/gspca.c
+++ b/drivers/media/video/gspca/gspca.c
@@ -35,12 +35,18 @@
35 35
36#include "gspca.h" 36#include "gspca.h"
37 37
38/* option */
39#define GSPCA_HLP 0
40
41/* global values */
42#define DEF_NURBS 2 /* default number of URBs (mmap) */
43
38MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>"); 44MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>");
39MODULE_DESCRIPTION("GSPCA USB Camera Driver"); 45MODULE_DESCRIPTION("GSPCA USB Camera Driver");
40MODULE_LICENSE("GPL"); 46MODULE_LICENSE("GPL");
41 47
42#define DRIVER_VERSION_NUMBER KERNEL_VERSION(0, 1, 1) 48#define DRIVER_VERSION_NUMBER KERNEL_VERSION(0, 2, 15)
43static const char version[] = "0.1.1"; 49static const char version[] = "0.2.15";
44 50
45static int video_nr = -1; 51static int video_nr = -1;
46 52
@@ -71,6 +77,229 @@ static void PDEBUG_MODE(char *txt, __u32 pixfmt, int w, int h)
71#define PDEBUG_MODE(txt, pixfmt, w, h) 77#define PDEBUG_MODE(txt, pixfmt, w, h)
72#endif 78#endif
73 79
80/* specific memory types - !! should different from V4L2_MEMORY_xxx */
81#define GSPCA_MEMORY_NO 0 /* V4L2_MEMORY_xxx starts from 1 */
82#define GSPCA_MEMORY_READ 7
83
84#ifndef GSPCA_HLP
85#define BUF_ALL_FLAGS (V4L2_BUF_FLAG_QUEUED | V4L2_BUF_FLAG_DONE)
86#else
87#define GSPCA_BUF_FLAG_DECODE 0x1000 /* internal buffer flag */
88#define BUF_ALL_FLAGS (V4L2_BUF_FLAG_QUEUED | V4L2_BUF_FLAG_DONE \
89 | GSPCA_BUF_FLAG_DECODE)
90
91static int autostart = 4;
92module_param(autostart, int, 0644);
93MODULE_PARM_DESC(autostart,
94 "Automatically start the helper process");
95
96/* try to start the helper process */
97static void start_hlp(void)
98{
99 int ret;
100 static char *argv[] = {"gspca_hlp", NULL};
101 static char *env[] = {NULL};
102
103 if (autostart <= 0) {
104 if (autostart < 0)
105 PDEBUG(D_ERR|D_PROBE, "Too many helper restart");
106 return;
107 }
108 autostart--;
109 if (autostart == 0)
110 autostart = -1;
111 ret = call_usermodehelper("/sbin/gspca_hlp", argv, env,
112 UMH_WAIT_EXEC);
113 if (ret != 0)
114 PDEBUG(D_ERR|D_PROBE,
115 "/sbin/gspca_hlp start failed %d", ret);
116}
117
118/* /dev/gspca_hlp stuff */
119#include <linux/miscdevice.h>
120#include "gspca_hlp.h"
121
122/* !! possible decodings defined in decoder.c */
123static __u32 bayer_to_tb[] = {
124 V4L2_PIX_FMT_SBGGR8,
125 V4L2_PIX_FMT_YUYV,
126 V4L2_PIX_FMT_YUV420,
127 V4L2_PIX_FMT_RGB24,
128 V4L2_PIX_FMT_BGR24,
129 V4L2_PIX_FMT_RGB565,
130};
131static __u32 jpeg_to_tb[] = {
132 V4L2_PIX_FMT_JPEG,
133 V4L2_PIX_FMT_YUYV,
134 V4L2_PIX_FMT_YUV420,
135 V4L2_PIX_FMT_RGB24,
136 V4L2_PIX_FMT_BGR24,
137 V4L2_PIX_FMT_RGB565,
138};
139
140/* /dev/gspca_hlp device */
141struct hlp_dev {
142 struct gspca_dev *gspca_dev; /* associated device */
143 struct gspca_frame *frame; /* frame being decoded */
144 __u32 pixfmt; /* webcam pixel format */
145 atomic_t nevent; /* nb of frames ready to decode */
146 wait_queue_head_t wq; /* wait queue */
147 char fr_d; /* next frame to decode */
148} *hlp;
149
150static int hlp_open(struct inode *inode, struct file *file)
151{
152 struct hlp_dev *hlp_dev;
153
154 PDEBUG(D_CONF, "hlp open");
155 if (hlp != 0)
156 return -EBUSY;
157 hlp_dev = kzalloc(sizeof *hlp_dev, GFP_KERNEL);
158 if (hlp_dev == NULL) {
159 err("couldn't kzalloc hlp struct");
160 return -EIO;
161 }
162 init_waitqueue_head(&hlp_dev->wq);
163 file->private_data = hlp_dev;
164 hlp = hlp_dev;
165 return 0;
166}
167
168static int hlp_close(struct inode *inode, struct file *file)
169{
170 struct gspca_dev *gspca_dev;
171 int mode;
172
173 PDEBUG(D_CONF, "hlp close");
174 file->private_data = NULL;
175
176 /* stop decoding */
177 gspca_dev = hlp->gspca_dev;
178 if (gspca_dev != 0) {
179 mode = gspca_dev->curr_mode;
180 gspca_dev->pixfmt = gspca_dev->cam.cam_mode[mode].pixfmt;
181 }
182
183 /* destroy the helper structure */
184 kfree(hlp);
185 hlp = 0;
186
187 /* try to restart the helper process */
188 start_hlp();
189 return 0;
190}
191
192static ssize_t hlp_read(struct file *file, char __user *buf,
193 size_t cnt, loff_t *ppos)
194{
195 struct hlp_dev *hlp_dev = file->private_data;
196 struct gspca_dev *gspca_dev;
197 struct gspca_frame *frame;
198 struct gspca_hlp_read_hd head;
199 int i, j, len, ret;
200
201 PDEBUG(D_FRAM, "hlp read (%d)", cnt);
202
203 /* check / wait till a frame is ready */
204 for (;;) {
205 gspca_dev = hlp_dev->gspca_dev;
206 if (gspca_dev != 0 && gspca_dev->streaming) {
207 i = hlp_dev->fr_d; /* frame to decode */
208 j = gspca_dev->fr_queue[i];
209 frame = &gspca_dev->frame[j];
210 if (frame->v4l2_buf.flags & GSPCA_BUF_FLAG_DECODE)
211 break;
212 }
213 ret = wait_event_interruptible(hlp_dev->wq,
214 atomic_read(&hlp_dev->nevent) > 0);
215 if (ret < 0) { /* helper process is killed */
216 autostart = 0; /* don't restart it */
217 return ret;
218 }
219 }
220 atomic_dec(&hlp_dev->nevent);
221 hlp_dev->fr_d = (i + 1) % gspca_dev->nframes;
222 PDEBUG(D_FRAM, "hlp read q:%d i:%d d:%d o:%d",
223 gspca_dev->fr_q,
224 gspca_dev->fr_i,
225 hlp_dev->fr_d,
226 gspca_dev->fr_o);
227
228 hlp_dev->frame = frame; /* memorize the current frame */
229 len = frame->v4l2_buf.bytesused;
230 if (cnt < sizeof head - sizeof head.data + len)
231/*fixme: special errno?*/
232 return -EINVAL;
233 head.pixfmt_out = gspca_dev->pixfmt;
234 head.pixfmt_in = hlp_dev->pixfmt;
235 head.width = gspca_dev->width;
236 head.height = gspca_dev->height;
237 copy_to_user(buf, &head, sizeof head);
238 copy_to_user(buf + sizeof head - sizeof head.data,
239 frame->data, len);
240 return sizeof head - sizeof head.data + len;
241}
242
243static ssize_t hlp_write(struct file *file,
244 const char __user *buf,
245 size_t cnt, loff_t *ppos)
246{
247 struct hlp_dev *hlp_dev = file->private_data;
248 struct gspca_dev *gspca_dev;
249 struct gspca_frame *frame;
250
251 PDEBUG(D_FRAM, "hlp write (%d)", cnt);
252 gspca_dev = hlp_dev->gspca_dev;
253 if (gspca_dev == 0)
254 return cnt;
255 if (mutex_lock_interruptible(&gspca_dev->queue_lock))
256 return -ERESTARTSYS;
257 if (!gspca_dev->streaming)
258 goto out;
259 frame = hlp_dev->frame;
260 hlp_dev->frame = 0;
261 if (frame == 0)
262 goto out;
263 if (cnt > frame->v4l2_buf.length) {
264 PDEBUG(D_ERR|D_FRAM, "bad frame size %d - %d",
265 cnt, frame->v4l2_buf.length);
266 cnt = -EINVAL;
267 goto out;
268 }
269 copy_from_user(frame->data, buf, cnt);
270 frame->v4l2_buf.bytesused = cnt;
271 frame->v4l2_buf.flags &= ~(V4L2_BUF_FLAG_QUEUED
272 | GSPCA_BUF_FLAG_DECODE);
273 frame->v4l2_buf.flags |= V4L2_BUF_FLAG_DONE;
274 mutex_unlock(&gspca_dev->queue_lock);
275 atomic_inc(&gspca_dev->nevent);
276 wake_up_interruptible(&gspca_dev->wq); /* event = new frame */
277 PDEBUG(D_FRAM, "hlp write q:%d i:%d d:%d o:%d",
278 gspca_dev->fr_q,
279 gspca_dev->fr_i,
280 hlp_dev->fr_d,
281 gspca_dev->fr_o);
282 return cnt;
283out:
284 mutex_unlock(&gspca_dev->queue_lock);
285 return cnt;
286}
287
288static struct file_operations hlp_fops = {
289 .owner = THIS_MODULE,
290 .open = hlp_open,
291 .release = hlp_close,
292 .read = hlp_read,
293 .write = hlp_write,
294 .llseek = no_llseek
295};
296static struct miscdevice hlp_device = {
297 .minor = MISC_DYNAMIC_MINOR,
298 .name = "gspca_hlp",
299 .fops = &hlp_fops,
300};
301#endif
302
74/* 303/*
75 * VMA operations. 304 * VMA operations.
76 */ 305 */
@@ -96,22 +325,16 @@ static struct vm_operations_struct gspca_vm_ops = {
96}; 325};
97 326
98/* 327/*
99 * ISOC message interrupt from the USB device 328 * fill a video frame from an URB and resubmit
100 *
101 * Analyse each packet and call the subdriver for doing the copy
102 * to the frame buffer.
103 */ 329 */
104static void isoc_irq(struct urb *urb) 330static void fill_frame(struct gspca_dev *gspca_dev,
331 struct urb *urb)
105{ 332{
106 struct gspca_dev *gspca_dev = (struct gspca_dev *) urb->context;
107 struct gspca_frame *frame; 333 struct gspca_frame *frame;
108 unsigned char *data; /* address of data in the iso message */ 334 unsigned char *data; /* address of data in the iso message */
109 int i, j, len, st; 335 int i, j, len, st;
110 cam_pkt_op pkt_scan; 336 cam_pkt_op pkt_scan;
111 337
112 PDEBUG(D_PACK, "isoc irq");
113 if (!gspca_dev->streaming)
114 return;
115 pkt_scan = gspca_dev->sd_desc->pkt_scan; 338 pkt_scan = gspca_dev->sd_desc->pkt_scan;
116 for (i = 0; i < urb->number_of_packets; i++) { 339 for (i = 0; i < urb->number_of_packets; i++) {
117 340
@@ -119,8 +342,7 @@ static void isoc_irq(struct urb *urb)
119 j = gspca_dev->fr_i; 342 j = gspca_dev->fr_i;
120 j = gspca_dev->fr_queue[j]; 343 j = gspca_dev->fr_queue[j];
121 frame = &gspca_dev->frame[j]; 344 frame = &gspca_dev->frame[j];
122 if ((frame->v4l2_buf.flags 345 if ((frame->v4l2_buf.flags & BUF_ALL_FLAGS)
123 & (V4L2_BUF_FLAG_QUEUED | V4L2_BUF_FLAG_DONE))
124 != V4L2_BUF_FLAG_QUEUED) { 346 != V4L2_BUF_FLAG_QUEUED) {
125 gspca_dev->last_packet_type = DISCARD_PACKET; 347 gspca_dev->last_packet_type = DISCARD_PACKET;
126 break; 348 break;
@@ -147,6 +369,7 @@ static void isoc_irq(struct urb *urb)
147 } 369 }
148 370
149 /* resubmit the URB */ 371 /* resubmit the URB */
372/*fixme: don't do that when userptr and too many URBs sent*/
150 urb->status = 0; 373 urb->status = 0;
151 st = usb_submit_urb(urb, GFP_ATOMIC); 374 st = usb_submit_urb(urb, GFP_ATOMIC);
152 if (st < 0) 375 if (st < 0)
@@ -154,9 +377,78 @@ static void isoc_irq(struct urb *urb)
154} 377}
155 378
156/* 379/*
380 * ISOC message interrupt from the USB device
381 *
382 * Analyse each packet and call the subdriver for copy
383 * to the frame buffer.
384 *
385 * There are 2 functions:
386 * - the first one (isoc_irq_mmap) is used when the application
387 * buffers are mapped. The frame detection and copy is done
388 * at interrupt level.
389 * - the second one (isoc_irq_user) is used when the application
390 * buffers are in user space (userptr). The frame detection
391 * and copy is done by the application.
392 */
393static void isoc_irq_mmap(struct urb *urb)
394{
395 struct gspca_dev *gspca_dev = (struct gspca_dev *) urb->context;
396
397 PDEBUG(D_PACK, "isoc irq mmap");
398 if (!gspca_dev->streaming)
399 return;
400 fill_frame(gspca_dev, urb);
401}
402
403static void isoc_irq_user(struct urb *urb)
404{
405 struct gspca_dev *gspca_dev = (struct gspca_dev *) urb->context;
406 int i;
407
408 PDEBUG(D_PACK, "isoc irq user");
409 if (!gspca_dev->streaming)
410 return;
411
412 i = gspca_dev->urb_in % gspca_dev->nurbs;
413 if (urb != gspca_dev->urb[i]) {
414 PDEBUG(D_ERR|D_PACK, "urb out of sequence");
415 return; /* should never occur */
416 }
417
418 gspca_dev->urb_in++;
419 atomic_inc(&gspca_dev->nevent); /* new event */
420 wake_up_interruptible(&gspca_dev->wq);
421/*fixme: submit a new URBs until urb_in == urb_out (% nurbs)*/
422}
423
424/*
425 * treat the isoc messages
426 *
427 * This routine is called by the application (case userptr).
428 */
429static void isoc_transfer(struct gspca_dev *gspca_dev)
430{
431 struct urb *urb;
432 int i;
433
434 for (;;) {
435 i = gspca_dev->urb_out;
436 PDEBUG(D_PACK, "isoc transf i:%d o:%d", gspca_dev->urb_in, i);
437 if (i == gspca_dev->urb_in) /* isoc message to read */
438 break; /* no (more) message */
439 atomic_dec(&gspca_dev->nevent);
440/*PDEBUG(D_PACK, "isoc_trf nevent: %d", atomic_read(&gspca_dev->nevent));*/
441 gspca_dev->urb_out = i + 1; /* message treated */
442 urb = gspca_dev->urb[i % gspca_dev->nurbs];
443 fill_frame(gspca_dev, urb);
444 }
445}
446
447/*
157 * add data to the current frame 448 * add data to the current frame
158 * 449 *
159 * This function is called by the subdrivers at interrupt level. 450 * This function is called by the subdrivers at interrupt level
451 * or user level.
160 * To build a frame, these ones must add 452 * To build a frame, these ones must add
161 * - one FIRST_PACKET 453 * - one FIRST_PACKET
162 * - 0 or many INTER_PACKETs 454 * - 0 or many INTER_PACKETs
@@ -177,9 +469,8 @@ struct gspca_frame *gspca_frame_add(struct gspca_dev *gspca_dev,
177 /* when start of a new frame, if the current frame buffer 469 /* when start of a new frame, if the current frame buffer
178 * is not queued, discard the whole frame */ 470 * is not queued, discard the whole frame */
179 if (packet_type == FIRST_PACKET) { 471 if (packet_type == FIRST_PACKET) {
180 if ((frame->v4l2_buf.flags 472 if ((frame->v4l2_buf.flags & BUF_ALL_FLAGS)
181 & (V4L2_BUF_FLAG_QUEUED | V4L2_BUF_FLAG_DONE)) 473 != V4L2_BUF_FLAG_QUEUED) {
182 != V4L2_BUF_FLAG_QUEUED) {
183 gspca_dev->last_packet_type = DISCARD_PACKET; 474 gspca_dev->last_packet_type = DISCARD_PACKET;
184 return frame; 475 return frame;
185 } 476 }
@@ -187,10 +478,11 @@ struct gspca_frame *gspca_frame_add(struct gspca_dev *gspca_dev,
187 jiffies_to_timeval(get_jiffies_64(), 478 jiffies_to_timeval(get_jiffies_64(),
188 &frame->v4l2_buf.timestamp); 479 &frame->v4l2_buf.timestamp);
189 frame->v4l2_buf.sequence = ++gspca_dev->sequence; 480 frame->v4l2_buf.sequence = ++gspca_dev->sequence;
190 } else if (gspca_dev->last_packet_type == DISCARD_PACKET) 481 } else if (gspca_dev->last_packet_type == DISCARD_PACKET) {
191 return frame; 482 return frame;
483 }
192 484
193 /* append the packet in the frame buffer */ 485 /* append the packet to the frame buffer */
194 if (len > 0) { 486 if (len > 0) {
195 if (frame->data_end - frame->data + len 487 if (frame->data_end - frame->data + len
196 > frame->v4l2_buf.length) { 488 > frame->v4l2_buf.length) {
@@ -211,12 +503,25 @@ struct gspca_frame *gspca_frame_add(struct gspca_dev *gspca_dev,
211 /* if last packet, wake the application and advance in the queue */ 503 /* if last packet, wake the application and advance in the queue */
212 if (packet_type == LAST_PACKET) { 504 if (packet_type == LAST_PACKET) {
213 frame->v4l2_buf.bytesused = frame->data_end - frame->data; 505 frame->v4l2_buf.bytesused = frame->data_end - frame->data;
506#ifndef GSPCA_HLP
214 frame->v4l2_buf.flags &= ~V4L2_BUF_FLAG_QUEUED; 507 frame->v4l2_buf.flags &= ~V4L2_BUF_FLAG_QUEUED;
215 frame->v4l2_buf.flags |= V4L2_BUF_FLAG_DONE; 508 frame->v4l2_buf.flags |= V4L2_BUF_FLAG_DONE;
216 atomic_inc(&gspca_dev->nevent); 509 atomic_inc(&gspca_dev->nevent);
217 wake_up_interruptible(&gspca_dev->wq); /* event = new frame */ 510 wake_up_interruptible(&gspca_dev->wq); /* event = new frame */
218 i = gspca_dev->fr_i; 511#else /*GSPCA_HLP*/
219 i = (i + 1) % gspca_dev->nframes; 512 if (hlp != 0 && hlp->gspca_dev == gspca_dev) {
513 frame->v4l2_buf.flags |= GSPCA_BUF_FLAG_DECODE;
514 atomic_inc(&hlp->nevent);
515 wake_up_interruptible(&hlp->wq);
516 } else {
517 frame->v4l2_buf.flags &= ~V4L2_BUF_FLAG_QUEUED;
518 frame->v4l2_buf.flags |= V4L2_BUF_FLAG_DONE;
519 atomic_inc(&gspca_dev->nevent);
520 wake_up_interruptible(&gspca_dev->wq); /* new frame */
521 }
522#endif /*GSPCA_HLP*/
523 i = (gspca_dev->fr_i + 1) % gspca_dev->nframes;
524 gspca_dev->fr_i = i;
220 PDEBUG(D_FRAM, "frame complete len:%d q:%d i:%d o:%d", 525 PDEBUG(D_FRAM, "frame complete len:%d q:%d i:%d o:%d",
221 frame->v4l2_buf.bytesused, 526 frame->v4l2_buf.bytesused,
222 gspca_dev->fr_q, 527 gspca_dev->fr_q,
@@ -224,7 +529,6 @@ struct gspca_frame *gspca_frame_add(struct gspca_dev *gspca_dev,
224 gspca_dev->fr_o); 529 gspca_dev->fr_o);
225 j = gspca_dev->fr_queue[i]; 530 j = gspca_dev->fr_queue[i];
226 frame = &gspca_dev->frame[j]; 531 frame = &gspca_dev->frame[j];
227 gspca_dev->fr_i = i;
228 } 532 }
229 return frame; 533 return frame;
230} 534}
@@ -245,7 +549,7 @@ static void *rvmalloc(unsigned long size)
245 void *mem; 549 void *mem;
246 unsigned long adr; 550 unsigned long adr;
247 551
248 size = PAGE_ALIGN(size); 552/* size = PAGE_ALIGN(size); (already done) */
249 mem = vmalloc_32(size); 553 mem = vmalloc_32(size);
250 if (mem != 0) { 554 if (mem != 0) {
251 memset(mem, 0, size); 555 memset(mem, 0, size);
@@ -274,27 +578,65 @@ static void rvfree(void *mem, unsigned long size)
274 vfree(mem); 578 vfree(mem);
275} 579}
276 580
581static __u32 get_v4l2_depth(__u32 pixfmt)
582{
583 switch (pixfmt) {
584 case V4L2_PIX_FMT_BGR32:
585 case V4L2_PIX_FMT_RGB32:
586 return 32;
587 case V4L2_PIX_FMT_RGB24: /* 'RGB3' */
588 case V4L2_PIX_FMT_BGR24:
589 return 24;
590 case V4L2_PIX_FMT_RGB565: /* 'RGBP' */
591 case V4L2_PIX_FMT_YUYV: /* 'YUYV' packed 4.2.2 */
592 case V4L2_PIX_FMT_YYUV: /* 'YYUV' */
593 return 16;
594 case V4L2_PIX_FMT_YUV420: /* 'YU12' planar 4.2.0 */
595 return 12;
596 case V4L2_PIX_FMT_MJPEG:
597 case V4L2_PIX_FMT_JPEG:
598 case V4L2_PIX_FMT_SBGGR8: /* 'BA81' Bayer */
599 return 8;
600 }
601 PDEBUG(D_ERR|D_CONF, "Unknown pixel format %c%c%c%c",
602 pixfmt & 0xff,
603 (pixfmt >> 8) & 0xff,
604 (pixfmt >> 16) & 0xff,
605 pixfmt >> 24);
606 return -EINVAL;
607}
608
609static int gspca_get_buff_size(struct gspca_dev *gspca_dev)
610{
611 unsigned int size;
612
613 size = gspca_dev->width * gspca_dev->height
614 * get_v4l2_depth(gspca_dev->pixfmt) / 8;
615 if (!size)
616 return -ENOMEM;
617 return size;
618}
619
277static int frame_alloc(struct gspca_dev *gspca_dev, 620static int frame_alloc(struct gspca_dev *gspca_dev,
278 unsigned int count, 621 unsigned int count)
279 unsigned int frsz,
280 enum v4l2_memory memory)
281{ 622{
282 int i, ret = 0; 623 struct gspca_frame *frame;
624 unsigned int frsz;
625 int i;
283 626
627 frsz = gspca_get_buff_size(gspca_dev);
628 if (frsz < 0)
629 return frsz;
284 PDEBUG(D_STREAM, "frame alloc frsz: %d", frsz); 630 PDEBUG(D_STREAM, "frame alloc frsz: %d", frsz);
285 if (gspca_dev->nframes != 0) {
286 PDEBUG(D_ERR|D_STREAM, "alloc frame already done");
287 return -EBUSY;
288 }
289 if (count > GSPCA_MAX_FRAMES) 631 if (count > GSPCA_MAX_FRAMES)
290 count = GSPCA_MAX_FRAMES; 632 count = GSPCA_MAX_FRAMES;
291 /* if compressed, reduce the buffer size */ 633 /* if compressed (JPEG), reduce the buffer size */
292 if (gspca_is_compressed(gspca_dev->pixfmt)) 634 if (gspca_is_compressed(gspca_dev->pixfmt))
293 frsz = (frsz * comp_fac) / 100; 635 frsz = (frsz * comp_fac) / 100 + 600; /* plus JPEG header */
294 frsz = PAGE_ALIGN(frsz); 636 frsz = PAGE_ALIGN(frsz);
295 PDEBUG(D_STREAM, "new fr_sz: %d", frsz); 637 PDEBUG(D_STREAM, "new fr_sz: %d", frsz);
296 gspca_dev->frsz = frsz; 638 gspca_dev->frsz = frsz;
297 if (memory == V4L2_MEMORY_MMAP) { 639 if (gspca_dev->memory == V4L2_MEMORY_MMAP) {
298 gspca_dev->frbuf = rvmalloc(frsz * count); 640 gspca_dev->frbuf = rvmalloc(frsz * count);
299 if (!gspca_dev->frbuf) { 641 if (!gspca_dev->frbuf) {
300 err("frame alloc failed"); 642 err("frame alloc failed");
@@ -303,25 +645,36 @@ static int frame_alloc(struct gspca_dev *gspca_dev,
303 } 645 }
304 gspca_dev->nframes = count; 646 gspca_dev->nframes = count;
305 for (i = 0; i < count; i++) { 647 for (i = 0; i < count; i++) {
306 gspca_dev->frame[i].v4l2_buf.index = i; 648 frame = &gspca_dev->frame[i];
307 gspca_dev->frame[i].v4l2_buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 649 frame->v4l2_buf.index = i;
308 gspca_dev->frame[i].v4l2_buf.flags = 0; 650 frame->v4l2_buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
309 gspca_dev->frame[i].v4l2_buf.field = V4L2_FIELD_NONE; 651 frame->v4l2_buf.flags = 0;
310 gspca_dev->frame[i].v4l2_buf.length = frsz; 652 frame->v4l2_buf.field = V4L2_FIELD_NONE;
311 gspca_dev->frame[i].v4l2_buf.memory = memory; 653 frame->v4l2_buf.length = frsz;
312 if (memory == V4L2_MEMORY_MMAP) { 654 frame->v4l2_buf.memory = gspca_dev->memory;
313 gspca_dev->frame[i].data 655 frame->v4l2_buf.sequence = 0;
314 = gspca_dev->frame[i].data_end 656 if (gspca_dev->memory == V4L2_MEMORY_MMAP) {
315 = gspca_dev->frbuf + i * frsz; 657 frame->data = frame->data_end =
316 gspca_dev->frame[i].v4l2_buf.m.offset = i * frsz; 658 gspca_dev->frbuf + i * frsz;
659 frame->v4l2_buf.m.offset = i * frsz;
317 } 660 }
318 gspca_dev->frame[i].v4l2_buf.flags = 0; /* buf in app space */
319 } 661 }
320 gspca_dev->fr_i = gspca_dev->fr_o = gspca_dev->fr_q = 0; 662 gspca_dev->fr_i = gspca_dev->fr_o = gspca_dev->fr_q = 0;
663#ifdef GSPCA_HLP
664 {
665 struct hlp_dev *hlp_dev;
666
667 hlp_dev = hlp;
668 if (hlp != 0 && hlp_dev->gspca_dev == gspca_dev) {
669 hlp_dev->fr_d = 0;
670 atomic_set(&hlp_dev->nevent, 0);
671 }
672 }
673#endif /*GSPCA_HLP*/
321 gspca_dev->last_packet_type = DISCARD_PACKET; 674 gspca_dev->last_packet_type = DISCARD_PACKET;
322 gspca_dev->sequence = 0; 675 gspca_dev->sequence = 0;
323 atomic_set(&gspca_dev->nevent, 0); 676 atomic_set(&gspca_dev->nevent, 0);
324 return ret; 677 return 0;
325} 678}
326 679
327static void frame_free(struct gspca_dev *gspca_dev) 680static void frame_free(struct gspca_dev *gspca_dev)
@@ -339,16 +692,16 @@ static void frame_free(struct gspca_dev *gspca_dev)
339 gspca_dev->nframes = 0; 692 gspca_dev->nframes = 0;
340} 693}
341 694
342static int gspca_kill_transfer(struct gspca_dev *gspca_dev) 695static void destroy_urbs(struct gspca_dev *gspca_dev)
343{ 696{
344 struct urb *urb; 697 struct urb *urb;
345 unsigned int i; 698 unsigned int i;
346 699
347 PDEBUG(D_STREAM, "kill transfer"); 700 PDEBUG(D_STREAM, "kill transfer");
348 for (i = 0; i < NURBS; ++i) { 701 for (i = 0; i < MAX_NURBS; ++i) {
349 urb = gspca_dev->urb[i]; 702 urb = gspca_dev->urb[i];
350 if (urb == NULL) 703 if (urb == NULL)
351 continue; 704 break;
352 705
353 gspca_dev->urb[i] = NULL; 706 gspca_dev->urb[i] = NULL;
354 usb_kill_urb(urb); 707 usb_kill_urb(urb);
@@ -359,7 +712,6 @@ static int gspca_kill_transfer(struct gspca_dev *gspca_dev)
359 urb->transfer_dma); 712 urb->transfer_dma);
360 usb_free_urb(urb); 713 usb_free_urb(urb);
361 } 714 }
362 return 0;
363} 715}
364 716
365/* 717/*
@@ -417,7 +769,7 @@ struct usb_host_endpoint *get_isoc_ep(struct gspca_dev *gspca_dev)
417 err("set interface err %d", ret); 769 err("set interface err %d", ret);
418 return NULL; 770 return NULL;
419 } 771 }
420 gspca_dev->alt = i; 772 gspca_dev->alt = i; /* memorize the current alt setting */
421 return ep; 773 return ep;
422} 774}
423 775
@@ -428,28 +780,28 @@ static int create_urbs(struct gspca_dev *gspca_dev,
428 struct usb_host_endpoint *ep) 780 struct usb_host_endpoint *ep)
429{ 781{
430 struct urb *urb; 782 struct urb *urb;
431 int n, i, psize, npkt, bsize; 783 int n, nurbs, i, psize, npkt, bsize;
784 usb_complete_t usb_complete;
432 785
433 /* calculate the packet size and the number of packets */ 786 /* calculate the packet size and the number of packets */
434 /* the URB buffer size must be a power of 2 */
435 psize = le16_to_cpu(ep->desc.wMaxPacketSize); 787 psize = le16_to_cpu(ep->desc.wMaxPacketSize);
788
436 /* See paragraph 5.9 / table 5-11 of the usb 2.0 spec. */ 789 /* See paragraph 5.9 / table 5-11 of the usb 2.0 spec. */
437 psize = (psize & 0x07ff) * (1 + ((psize >> 11) & 3)); 790 psize = (psize & 0x07ff) * (1 + ((psize >> 11) & 3));
438 npkt = ISO_MAX_SIZE / psize; 791 npkt = ISO_MAX_SIZE / psize;
439 if (npkt > ISO_MAX_PKT) 792 if (npkt > ISO_MAX_PKT)
440 npkt = ISO_MAX_PKT; 793 npkt = ISO_MAX_PKT;
441 bsize = psize * npkt; 794 bsize = psize * npkt;
442 for (n = ISO_MAX_SIZE; n > 0; n >>= 1) {
443 if (n & bsize) /* !! assume ISO_MAX_SIZE is a power of 2 */
444 break;
445 }
446 if (n != 0) {
447 npkt = n / psize;
448 bsize = psize * npkt;
449 }
450 PDEBUG(D_STREAM, 795 PDEBUG(D_STREAM,
451 "isoc %d pkts size %d (bsize:%d)", npkt, psize, bsize); 796 "isoc %d pkts size %d (bsize:%d)", npkt, psize, bsize);
452 for (n = 0; n < NURBS; n++) { 797/*fixme:change for userptr*/
798/*fixme:don't submit all URBs when userptr*/
799 gspca_dev->nurbs = nurbs = DEF_NURBS;
800 if (gspca_dev->memory == V4L2_MEMORY_MMAP)
801 usb_complete = isoc_irq_mmap;
802 else
803 usb_complete = isoc_irq_user;
804 for (n = 0; n < nurbs; n++) {
453 urb = usb_alloc_urb(npkt, GFP_KERNEL); 805 urb = usb_alloc_urb(npkt, GFP_KERNEL);
454 if (!urb) { 806 if (!urb) {
455 err("usb_alloc_urb failed"); 807 err("usb_alloc_urb failed");
@@ -462,7 +814,7 @@ static int create_urbs(struct gspca_dev *gspca_dev,
462 814
463 if (urb->transfer_buffer == NULL) { 815 if (urb->transfer_buffer == NULL) {
464 usb_free_urb(urb); 816 usb_free_urb(urb);
465 gspca_kill_transfer(gspca_dev); 817 destroy_urbs(gspca_dev);
466 err("usb_buffer_urb failed"); 818 err("usb_buffer_urb failed");
467 return -ENOMEM; 819 return -ENOMEM;
468 } 820 }
@@ -474,7 +826,7 @@ static int create_urbs(struct gspca_dev *gspca_dev,
474 urb->transfer_flags = URB_ISO_ASAP 826 urb->transfer_flags = URB_ISO_ASAP
475 | URB_NO_TRANSFER_DMA_MAP; 827 | URB_NO_TRANSFER_DMA_MAP;
476 urb->interval = ep->desc.bInterval; 828 urb->interval = ep->desc.bInterval;
477 urb->complete = isoc_irq; 829 urb->complete = usb_complete;
478 urb->number_of_packets = npkt; 830 urb->number_of_packets = npkt;
479 urb->transfer_buffer_length = bsize; 831 urb->transfer_buffer_length = bsize;
480 for (i = 0; i < npkt; i++) { 832 for (i = 0; i < npkt; i++) {
@@ -482,6 +834,7 @@ static int create_urbs(struct gspca_dev *gspca_dev,
482 urb->iso_frame_desc[i].offset = psize * i; 834 urb->iso_frame_desc[i].offset = psize * i;
483 } 835 }
484 } 836 }
837 gspca_dev->urb_in = gspca_dev->urb_out = 0;
485 return 0; 838 return 0;
486} 839}
487 840
@@ -490,18 +843,17 @@ static int create_urbs(struct gspca_dev *gspca_dev,
490 */ 843 */
491static int gspca_init_transfer(struct gspca_dev *gspca_dev) 844static int gspca_init_transfer(struct gspca_dev *gspca_dev)
492{ 845{
493 struct usb_interface *intf;
494 struct usb_host_endpoint *ep; 846 struct usb_host_endpoint *ep;
495 int n, ret; 847 int n, ret;
496 848
497 if (mutex_lock_interruptible(&gspca_dev->usb_lock)) 849 if (mutex_lock_interruptible(&gspca_dev->usb_lock))
498 return -ERESTARTSYS; 850 return -ERESTARTSYS;
499 851
500 /* set the max alternate setting and loop until urb submit succeeds */ 852 /* set the higher alternate setting and
501 intf = usb_ifnum_to_if(gspca_dev->dev, gspca_dev->iface); 853 * loop until urb submit succeeds */
502 gspca_dev->alt = intf->num_altsetting; 854 gspca_dev->alt = gspca_dev->nbalt;
503 for (;;) { 855 for (;;) {
504 PDEBUG(D_STREAM, "init transfer nbalt %d", gspca_dev->alt); 856 PDEBUG(D_STREAM, "init transfer alt %d", gspca_dev->alt);
505 ep = get_isoc_ep(gspca_dev); 857 ep = get_isoc_ep(gspca_dev);
506 if (ep == NULL) { 858 if (ep == NULL) {
507 ret = -EIO; 859 ret = -EIO;
@@ -517,13 +869,13 @@ static int gspca_init_transfer(struct gspca_dev *gspca_dev)
517 atomic_set(&gspca_dev->nevent, 0); 869 atomic_set(&gspca_dev->nevent, 0);
518 870
519 /* submit the URBs */ 871 /* submit the URBs */
520 for (n = 0; n < NURBS; n++) { 872 for (n = 0; n < gspca_dev->nurbs; n++) {
521 ret = usb_submit_urb(gspca_dev->urb[n], GFP_KERNEL); 873 ret = usb_submit_urb(gspca_dev->urb[n], GFP_KERNEL);
522 if (ret < 0) { 874 if (ret < 0) {
523 PDEBUG(D_ERR|D_STREAM, 875 PDEBUG(D_ERR|D_STREAM,
524 "usb_submit_urb [%d] err %d", n, ret); 876 "usb_submit_urb [%d] err %d", n, ret);
525 gspca_dev->streaming = 0; 877 gspca_dev->streaming = 0;
526 gspca_kill_transfer(gspca_dev); 878 destroy_urbs(gspca_dev);
527 if (ret == -ENOSPC) 879 if (ret == -ENOSPC)
528 break; /* try the previous alt */ 880 break; /* try the previous alt */
529 goto out; 881 goto out;
@@ -551,21 +903,32 @@ static int gspca_set_alt0(struct gspca_dev *gspca_dev)
551static void gspca_stream_off(struct gspca_dev *gspca_dev) 903static void gspca_stream_off(struct gspca_dev *gspca_dev)
552{ 904{
553 gspca_dev->streaming = 0; 905 gspca_dev->streaming = 0;
906 atomic_set(&gspca_dev->nevent, 0);
907#ifdef GSPCA_HLP
908 {
909 struct hlp_dev *hlp_dev;
910
911 hlp_dev = hlp;
912 if (hlp_dev != 0
913 && hlp_dev->gspca_dev == gspca_dev)
914 atomic_set(&hlp_dev->nevent, 0);
915 }
916#endif
554 if (gspca_dev->present) { 917 if (gspca_dev->present) {
555 gspca_dev->sd_desc->stopN(gspca_dev); 918 gspca_dev->sd_desc->stopN(gspca_dev);
556 gspca_kill_transfer(gspca_dev); 919 destroy_urbs(gspca_dev);
557 gspca_set_alt0(gspca_dev); 920 gspca_set_alt0(gspca_dev);
558 gspca_dev->sd_desc->stop0(gspca_dev); 921 gspca_dev->sd_desc->stop0(gspca_dev);
559 PDEBUG(D_STREAM, "stream off OK"); 922 PDEBUG(D_STREAM, "stream off OK");
560 } else { 923 } else {
561 gspca_kill_transfer(gspca_dev); 924 destroy_urbs(gspca_dev);
562 atomic_inc(&gspca_dev->nevent); 925 atomic_inc(&gspca_dev->nevent);
563 wake_up_interruptible(&gspca_dev->wq); 926 wake_up_interruptible(&gspca_dev->wq);
564 PDEBUG(D_ERR|D_STREAM, "stream off no device ??"); 927 PDEBUG(D_ERR|D_STREAM, "stream off no device ??");
565 } 928 }
566} 929}
567 930
568static int gspca_set_default_mode(struct gspca_dev *gspca_dev) 931static void gspca_set_default_mode(struct gspca_dev *gspca_dev)
569{ 932{
570 int i; 933 int i;
571 934
@@ -574,7 +937,6 @@ static int gspca_set_default_mode(struct gspca_dev *gspca_dev)
574 gspca_dev->width = gspca_dev->cam.cam_mode[i].width; 937 gspca_dev->width = gspca_dev->cam.cam_mode[i].width;
575 gspca_dev->height = gspca_dev->cam.cam_mode[i].height; 938 gspca_dev->height = gspca_dev->cam.cam_mode[i].height;
576 gspca_dev->pixfmt = gspca_dev->cam.cam_mode[i].pixfmt; 939 gspca_dev->pixfmt = gspca_dev->cam.cam_mode[i].pixfmt;
577 return 0;
578} 940}
579 941
580static int wxh_to_mode(struct gspca_dev *gspca_dev, 942static int wxh_to_mode(struct gspca_dev *gspca_dev,
@@ -582,46 +944,14 @@ static int wxh_to_mode(struct gspca_dev *gspca_dev,
582{ 944{
583 int i; 945 int i;
584 946
585 for (i = gspca_dev->cam.nmodes - 1; --i >= 0; ) { 947 for (i = gspca_dev->cam.nmodes; --i > 0; ) {
586 if (width > gspca_dev->cam.cam_mode[i].width) 948 if (width >= gspca_dev->cam.cam_mode[i].width
949 && height >= gspca_dev->cam.cam_mode[i].height)
587 break; 950 break;
588 } 951 }
589 i++;
590 while (i < gspca_dev->cam.nmodes - 1
591 && width == gspca_dev->cam.cam_mode[i + 1].width
592 && height < gspca_dev->cam.cam_mode[i + 1].height)
593 i++;
594 return i; 952 return i;
595} 953}
596 954
597static __u32 get_v4l2_depth(__u32 pixfmt)
598{
599 switch (pixfmt) {
600 case V4L2_PIX_FMT_BGR32:
601 case V4L2_PIX_FMT_RGB32:
602 return 32;
603 case V4L2_PIX_FMT_RGB24:
604 case V4L2_PIX_FMT_BGR24:
605 return 24;
606 case V4L2_PIX_FMT_RGB565:
607 case V4L2_PIX_FMT_YUYV: /* packed 4.2.2 */
608 case V4L2_PIX_FMT_YYUV:
609 return 16;
610 case V4L2_PIX_FMT_YUV420: /* planar 4.2.0 */
611 return 12;
612 case V4L2_PIX_FMT_MJPEG:
613 case V4L2_PIX_FMT_JPEG:
614 case V4L2_PIX_FMT_SBGGR8: /* Bayer */
615 return 8;
616 }
617 PDEBUG(D_ERR|D_CONF, "Unknown pixel format %c%c%c%c",
618 pixfmt & 0xff,
619 (pixfmt >> 8) & 0xff,
620 (pixfmt >> 16) & 0xff,
621 pixfmt >> 24);
622 return -EINVAL;
623}
624
625/* 955/*
626 * search a mode with the right pixel format 956 * search a mode with the right pixel format
627 */ 957 */
@@ -649,11 +979,15 @@ static int vidioc_enum_fmt_cap(struct file *file, void *priv,
649 struct v4l2_fmtdesc *fmtdesc) 979 struct v4l2_fmtdesc *fmtdesc)
650{ 980{
651 struct gspca_dev *gspca_dev = priv; 981 struct gspca_dev *gspca_dev = priv;
652 int i, j, index; 982 int i;
983#ifndef GSPCA_HLP
984 int j, index;
653 __u32 fmt_tb[8]; 985 __u32 fmt_tb[8];
986#endif
654 987
655 PDEBUG(D_CONF, "enum fmt cap"); 988 PDEBUG(D_CONF, "enum fmt cap");
656 989
990#ifndef GSPCA_HLP
657 /* give an index to each format */ 991 /* give an index to each format */
658 index = 0; 992 index = 0;
659 j = 0; 993 j = 0;
@@ -676,10 +1010,40 @@ static int vidioc_enum_fmt_cap(struct file *file, void *priv,
676 if (i < 0) 1010 if (i < 0)
677 return -EINVAL; /* no more format */ 1011 return -EINVAL; /* no more format */
678 1012
679 fmtdesc->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
680 fmtdesc->pixelformat = fmt_tb[index]; 1013 fmtdesc->pixelformat = fmt_tb[index];
681 if (gspca_is_compressed(fmt_tb[index])) 1014 if (gspca_is_compressed(fmt_tb[index]))
682 fmtdesc->flags = V4L2_FMT_FLAG_COMPRESSED; 1015 fmtdesc->flags = V4L2_FMT_FLAG_COMPRESSED;
1016#else /*GSPCA_HLP*/
1017 /* !! code tied to the decoding functions in decoder.c */
1018 i = gspca_dev->cam.nmodes - 1;
1019 if (fmtdesc->index == 0) { /* (assume one format per subdriver) */
1020 fmtdesc->pixelformat = gspca_dev->cam.cam_mode[i].pixfmt;
1021 if (gspca_is_compressed(fmtdesc->pixelformat))
1022 fmtdesc->flags = V4L2_FMT_FLAG_COMPRESSED;
1023 } else {
1024 if (hlp == 0
1025 || (hlp->gspca_dev != 0
1026 && hlp->gspca_dev != gspca_dev))
1027 return -EINVAL;
1028 switch (gspca_dev->cam.cam_mode[i].pixfmt) {
1029 case V4L2_PIX_FMT_JPEG:
1030 if (fmtdesc->index >= sizeof jpeg_to_tb
1031 / sizeof jpeg_to_tb[0])
1032 return -EINVAL;
1033 fmtdesc->pixelformat = jpeg_to_tb[fmtdesc->index];
1034 break;
1035 case V4L2_PIX_FMT_SBGGR8:
1036 if (fmtdesc->index >= sizeof bayer_to_tb
1037 / sizeof bayer_to_tb[0])
1038 return -EINVAL;
1039 fmtdesc->pixelformat = bayer_to_tb[fmtdesc->index];
1040 break;
1041 default:
1042 return -EINVAL;
1043 }
1044 }
1045#endif /*GSPCA_HLP*/
1046 fmtdesc->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
683 fmtdesc->description[0] = fmtdesc->pixelformat & 0xff; 1047 fmtdesc->description[0] = fmtdesc->pixelformat & 0xff;
684 fmtdesc->description[1] = (fmtdesc->pixelformat >> 8) & 0xff; 1048 fmtdesc->description[1] = (fmtdesc->pixelformat >> 8) & 0xff;
685 fmtdesc->description[2] = (fmtdesc->pixelformat >> 16) & 0xff; 1049 fmtdesc->description[2] = (fmtdesc->pixelformat >> 16) & 0xff;
@@ -688,22 +1052,26 @@ static int vidioc_enum_fmt_cap(struct file *file, void *priv,
688 return 0; 1052 return 0;
689} 1053}
690 1054
691static int gspca_get_buff_size(struct gspca_dev *gspca_dev)
692{
693 unsigned int size;
694
695 size = gspca_dev->width * gspca_dev->height
696 * get_v4l2_depth(gspca_dev->pixfmt) / 8;
697 if (!size)
698 return -ENOMEM;
699 return size;
700}
701
702static int vidioc_g_fmt_cap(struct file *file, void *priv, 1055static int vidioc_g_fmt_cap(struct file *file, void *priv,
703 struct v4l2_format *fmt) 1056 struct v4l2_format *fmt)
704{ 1057{
705 struct gspca_dev *gspca_dev = priv; 1058 struct gspca_dev *gspca_dev = priv;
706 1059
1060#ifdef GSPCA_HLP
1061 int i;
1062
1063 /* if the pixel format is not the one of the device and
1064 * if the helper is inactive or busy, restore */
1065 i = gspca_dev->curr_mode;
1066 if (gspca_dev->pixfmt != gspca_dev->cam.cam_mode[i].pixfmt) {
1067 struct hlp_dev *hlp_dev;
1068
1069 hlp_dev = hlp;
1070 if (hlp_dev == 0 || hlp_dev->gspca_dev != gspca_dev)
1071 gspca_dev->pixfmt = gspca_dev->cam.cam_mode[i].pixfmt;
1072 }
1073#endif /*GSPCA_HLP*/
1074
707 fmt->fmt.pix.width = gspca_dev->width; 1075 fmt->fmt.pix.width = gspca_dev->width;
708 fmt->fmt.pix.height = gspca_dev->height; 1076 fmt->fmt.pix.height = gspca_dev->height;
709 fmt->fmt.pix.pixelformat = gspca_dev->pixfmt; 1077 fmt->fmt.pix.pixelformat = gspca_dev->pixfmt;
@@ -733,6 +1101,10 @@ static int try_fmt_cap(struct gspca_dev *gspca_dev,
733 1101
734 w = fmt->fmt.pix.width; 1102 w = fmt->fmt.pix.width;
735 h = fmt->fmt.pix.height; 1103 h = fmt->fmt.pix.height;
1104
1105 /* (luvcview problem) */
1106 if (fmt->fmt.pix.pixelformat == V4L2_PIX_FMT_MJPEG)
1107 fmt->fmt.pix.pixelformat = V4L2_PIX_FMT_JPEG;
736#ifdef GSPCA_DEBUG 1108#ifdef GSPCA_DEBUG
737 if (gspca_debug & D_CONF) 1109 if (gspca_debug & D_CONF)
738 PDEBUG_MODE("try fmt cap", fmt->fmt.pix.pixelformat, w, h); 1110 PDEBUG_MODE("try fmt cap", fmt->fmt.pix.pixelformat, w, h);
@@ -746,13 +1118,46 @@ static int try_fmt_cap(struct gspca_dev *gspca_dev,
746 /* else, search the closest mode with the same pixel format */ 1118 /* else, search the closest mode with the same pixel format */
747 mode2 = gspca_get_mode(gspca_dev, mode, 1119 mode2 = gspca_get_mode(gspca_dev, mode,
748 fmt->fmt.pix.pixelformat); 1120 fmt->fmt.pix.pixelformat);
749 if (mode2 >= 0) 1121 if (mode2 >= 0) {
750 mode = mode2; 1122 mode = mode2;
751 else { 1123 } else {
1124 __u32 pixfmt;
1125
1126 pixfmt = gspca_dev->cam.cam_mode[mode].pixfmt;
1127#ifndef GSPCA_HLP
752 1128
753 /* no chance, return this mode */ 1129 /* no chance, return this mode */
754 fmt->fmt.pix.pixelformat 1130 fmt->fmt.pix.pixelformat = pixfmt;
755 = gspca_dev->cam.cam_mode[mode].pixfmt; 1131#else /*GSPCA_HLP*/
1132 if (hlp != 0
1133 && (hlp->gspca_dev == 0
1134 || hlp->gspca_dev == gspca_dev)
1135/* decoding works for JPEG and Bayer only */
1136 && (pixfmt == V4L2_PIX_FMT_JPEG
1137 || pixfmt == V4L2_PIX_FMT_SBGGR8)) {
1138 switch (fmt->fmt.pix.pixelformat) {
1139 case V4L2_PIX_FMT_YUYV: /* 'YUYV' */
1140 case V4L2_PIX_FMT_BGR24: /* 'BGR3' */
1141 case V4L2_PIX_FMT_RGB24: /* 'RGB3' */
1142 case V4L2_PIX_FMT_YUV420: /* 'YU12' */
1143 case V4L2_PIX_FMT_RGB565: /* 'RGBP' */
1144 break;
1145 default: {
1146 /* return any of the supported fmt's */
1147 __u8 u;
1148
1149 u = get_jiffies_64();
1150 u %= sizeof bayer_to_tb
1151 / sizeof bayer_to_tb[0] - 1;
1152 fmt->fmt.pix.pixelformat =
1153 bayer_to_tb[u + 1];
1154 break;
1155 }
1156 }
1157 } else {
1158 fmt->fmt.pix.pixelformat = pixfmt;
1159 }
1160#endif /*GSPCA_HLP*/
756#ifdef GSPCA_DEBUG 1161#ifdef GSPCA_DEBUG
757 if (gspca_debug & D_CONF) { 1162 if (gspca_debug & D_CONF) {
758 PDEBUG_MODE("new format", 1163 PDEBUG_MODE("new format",
@@ -791,7 +1196,7 @@ static int vidioc_s_fmt_cap(struct file *file, void *priv,
791 struct v4l2_format *fmt) 1196 struct v4l2_format *fmt)
792{ 1197{
793 struct gspca_dev *gspca_dev = priv; 1198 struct gspca_dev *gspca_dev = priv;
794 int ret, was_streaming; 1199 int ret;
795 1200
796#ifdef GSPCA_DEBUG 1201#ifdef GSPCA_DEBUG
797 if (gspca_debug & D_CONF) { 1202 if (gspca_debug & D_CONF) {
@@ -802,32 +1207,56 @@ static int vidioc_s_fmt_cap(struct file *file, void *priv,
802#endif 1207#endif
803 if (mutex_lock_interruptible(&gspca_dev->queue_lock)) 1208 if (mutex_lock_interruptible(&gspca_dev->queue_lock))
804 return -ERESTARTSYS; 1209 return -ERESTARTSYS;
1210
805 ret = try_fmt_cap(gspca_dev, fmt); 1211 ret = try_fmt_cap(gspca_dev, fmt);
806 if (ret < 0) 1212 if (ret < 0)
807 goto out; 1213 goto out;
808 1214
1215 if (gspca_dev->nframes != 0
1216 && fmt->fmt.pix.sizeimage > gspca_dev->frsz) {
1217 ret = -EINVAL;
1218 goto out;
1219 }
1220
1221#ifndef GSPCA_HLP
809 if (ret == gspca_dev->curr_mode) 1222 if (ret == gspca_dev->curr_mode)
810 goto out; /* same mode */ 1223 goto out; /* same mode */
811 was_streaming = gspca_dev->streaming; 1224#else /*GSPCA_HLP*/
812 if (was_streaming) { 1225 if (ret == gspca_dev->curr_mode
813 if (gspca_dev->capt_file != 0 1226 && gspca_dev->pixfmt == fmt->fmt.pix.pixelformat)
814 && gspca_dev->capt_file != file) { 1227 goto out; /* same mode */
815 ret = -EBUSY; 1228#endif /*GSPCA_HLP*/
816 goto out; 1229
817 } 1230 if (gspca_dev->streaming) {
818 if (mutex_lock_interruptible(&gspca_dev->usb_lock)) { 1231 ret = -EBUSY;
819 ret = -ERESTARTSYS; 1232 goto out;
820 goto out;
821 }
822 gspca_stream_off(gspca_dev);
823 mutex_unlock(&gspca_dev->usb_lock);
824 } 1233 }
825 gspca_dev->width = fmt->fmt.pix.width; 1234 gspca_dev->width = fmt->fmt.pix.width;
826 gspca_dev->height = fmt->fmt.pix.height; 1235 gspca_dev->height = fmt->fmt.pix.height;
827 gspca_dev->pixfmt = fmt->fmt.pix.pixelformat; 1236 gspca_dev->pixfmt = fmt->fmt.pix.pixelformat;
828 gspca_dev->curr_mode = ret; 1237 gspca_dev->curr_mode = ret;
829 if (was_streaming) 1238
830 ret = gspca_init_transfer(gspca_dev); 1239#ifdef GSPCA_HLP
1240 /* if frame decoding is required */
1241 if (gspca_dev->pixfmt != gspca_dev->cam.cam_mode[ret].pixfmt) {
1242 struct hlp_dev *hlp_dev;
1243
1244 hlp_dev = hlp;
1245 if (hlp_dev == 0
1246 || (hlp_dev->gspca_dev != 0
1247 && hlp_dev->gspca_dev != gspca_dev)) { /* helper busy */
1248 fmt->fmt.pix.pixelformat =
1249 gspca_dev->pixfmt =
1250 gspca_dev->cam.cam_mode[ret].pixfmt;
1251 } else { /* helper active */
1252 hlp_dev->gspca_dev = gspca_dev;
1253 hlp_dev->pixfmt = gspca_dev->cam.cam_mode[ret].pixfmt;
1254 hlp_dev->fr_d = gspca_dev->fr_i;
1255 }
1256 } else if (hlp != 0 && hlp->gspca_dev == gspca_dev)
1257 hlp->gspca_dev = 0;
1258#endif /*GSPCA_HLP*/
1259 ret = 0;
831out: 1260out:
832 mutex_unlock(&gspca_dev->queue_lock); 1261 mutex_unlock(&gspca_dev->queue_lock);
833 return ret; 1262 return ret;
@@ -838,7 +1267,7 @@ static int dev_open(struct inode *inode, struct file *file)
838 struct gspca_dev *gspca_dev; 1267 struct gspca_dev *gspca_dev;
839 int ret; 1268 int ret;
840 1269
841 PDEBUG(D_STREAM, "opening"); 1270 PDEBUG(D_STREAM, "%s open", current->comm);
842 gspca_dev = (struct gspca_dev *) video_devdata(file); 1271 gspca_dev = (struct gspca_dev *) video_devdata(file);
843 if (mutex_lock_interruptible(&gspca_dev->queue_lock)) 1272 if (mutex_lock_interruptible(&gspca_dev->queue_lock))
844 return -ERESTARTSYS; 1273 return -ERESTARTSYS;
@@ -867,7 +1296,7 @@ static int dev_open(struct inode *inode, struct file *file)
867 file->private_data = gspca_dev; 1296 file->private_data = gspca_dev;
868#ifdef GSPCA_DEBUG 1297#ifdef GSPCA_DEBUG
869 /* activate the v4l2 debug */ 1298 /* activate the v4l2 debug */
870 if (gspca_debug & D_CONF) 1299 if (gspca_debug & D_V4L2)
871 gspca_dev->vdev.debug |= 3; 1300 gspca_dev->vdev.debug |= 3;
872 else 1301 else
873 gspca_dev->vdev.debug &= ~3; 1302 gspca_dev->vdev.debug &= ~3;
@@ -877,7 +1306,7 @@ out:
877 if (ret != 0) 1306 if (ret != 0)
878 PDEBUG(D_ERR|D_STREAM, "open failed err %d", ret); 1307 PDEBUG(D_ERR|D_STREAM, "open failed err %d", ret);
879 else 1308 else
880 PDEBUG(D_STREAM, "open OK"); 1309 PDEBUG(D_STREAM, "open done");
881 return ret; 1310 return ret;
882} 1311}
883 1312
@@ -885,7 +1314,7 @@ static int dev_close(struct inode *inode, struct file *file)
885{ 1314{
886 struct gspca_dev *gspca_dev = file->private_data; 1315 struct gspca_dev *gspca_dev = file->private_data;
887 1316
888 PDEBUG(D_STREAM, "closing"); 1317 PDEBUG(D_STREAM, "%s close", current->comm);
889 if (mutex_lock_interruptible(&gspca_dev->queue_lock)) 1318 if (mutex_lock_interruptible(&gspca_dev->queue_lock))
890 return -ERESTARTSYS; 1319 return -ERESTARTSYS;
891 gspca_dev->users--; 1320 gspca_dev->users--;
@@ -898,11 +1327,28 @@ static int dev_close(struct inode *inode, struct file *file)
898 gspca_dev->sd_desc->close(gspca_dev); 1327 gspca_dev->sd_desc->close(gspca_dev);
899 mutex_unlock(&gspca_dev->usb_lock); 1328 mutex_unlock(&gspca_dev->usb_lock);
900 frame_free(gspca_dev); 1329 frame_free(gspca_dev);
901 file->private_data = NULL;
902 gspca_dev->capt_file = 0; 1330 gspca_dev->capt_file = 0;
1331 gspca_dev->memory = GSPCA_MEMORY_NO;
1332#ifdef GSPCA_HLP
1333 {
1334 struct hlp_dev *hlp_dev;
1335 int mode;
1336
1337 hlp_dev = hlp;
1338 if (hlp_dev != 0
1339 && hlp_dev->gspca_dev == gspca_dev) {
1340 hlp_dev->gspca_dev = 0;
1341 hlp_dev->frame = 0;
1342 mode = gspca_dev->curr_mode;
1343 gspca_dev->pixfmt =
1344 gspca_dev->cam.cam_mode[mode].pixfmt;
1345 }
1346 }
1347#endif /*GSPCA_HLP*/
903 } 1348 }
1349 file->private_data = NULL;
904 mutex_unlock(&gspca_dev->queue_lock); 1350 mutex_unlock(&gspca_dev->queue_lock);
905 PDEBUG(D_STREAM, "closed"); 1351 PDEBUG(D_STREAM, "close done");
906 return 0; 1352 return 0;
907} 1353}
908 1354
@@ -1036,32 +1482,50 @@ static int vidioc_reqbufs(struct file *file, void *priv,
1036 struct v4l2_requestbuffers *rb) 1482 struct v4l2_requestbuffers *rb)
1037{ 1483{
1038 struct gspca_dev *gspca_dev = priv; 1484 struct gspca_dev *gspca_dev = priv;
1039 int frsz, ret; 1485 int i, ret = 0;
1040 1486
1041 PDEBUG(D_STREAM, "reqbufs %d", rb->count); 1487 PDEBUG(D_STREAM, "reqbufs %d", rb->count);
1042 if (rb->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) 1488 if (rb->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
1043 return -EINVAL; 1489 return -EINVAL;
1044 if (rb->memory != V4L2_MEMORY_MMAP 1490 switch (rb->memory) {
1045 && rb->memory != V4L2_MEMORY_USERPTR) 1491 case V4L2_MEMORY_MMAP:
1492 break;
1493 case V4L2_MEMORY_USERPTR:
1494#ifdef GSPCA_HLP
1495 if (hlp == 0 || hlp->gspca_dev != gspca_dev)
1496 break;
1497#endif
1046 return -EINVAL; 1498 return -EINVAL;
1047 if (rb->count == 0) 1499 default:
1048 return -EINVAL; 1500 return -EINVAL;
1049 frsz = gspca_get_buff_size(gspca_dev); 1501 }
1050 if (frsz < 0)
1051 return frsz;
1052 if (mutex_lock_interruptible(&gspca_dev->queue_lock)) 1502 if (mutex_lock_interruptible(&gspca_dev->queue_lock))
1053 return -ERESTARTSYS; 1503 return -ERESTARTSYS;
1054 if (gspca_dev->capt_file != 0) { /* only one file may do capture */ 1504
1505 for (i = 0; i < gspca_dev->nframes; i++) {
1506 if (gspca_dev->frame[i].vma_use_count) {
1507 ret = -EBUSY;
1508 goto out;
1509 }
1510 }
1511
1512 /* only one file may do capture */
1513 if ((gspca_dev->capt_file != 0 && gspca_dev->capt_file != file)
1514 || gspca_dev->streaming) {
1055 ret = -EBUSY; 1515 ret = -EBUSY;
1056 goto out; 1516 goto out;
1057 } 1517 }
1058 ret = frame_alloc(gspca_dev, 1518
1059 rb->count, 1519 if (rb->count == 0) { /* unrequest? */
1060 (unsigned int) frsz, 1520 frame_free(gspca_dev);
1061 rb->memory); 1521 gspca_dev->capt_file = 0;
1062 if (ret == 0) { 1522 } else {
1063 rb->count = gspca_dev->nframes; 1523 gspca_dev->memory = rb->memory;
1064 gspca_dev->capt_file = file; 1524 ret = frame_alloc(gspca_dev, rb->count);
1525 if (ret == 0) {
1526 rb->count = gspca_dev->nframes;
1527 gspca_dev->capt_file = file;
1528 }
1065 } 1529 }
1066out: 1530out:
1067 mutex_unlock(&gspca_dev->queue_lock); 1531 mutex_unlock(&gspca_dev->queue_lock);
@@ -1224,12 +1688,25 @@ static int vidiocgmbuf(struct file *file, void *priv,
1224 if (gspca_dev->nframes == 0) { 1688 if (gspca_dev->nframes == 0) {
1225 struct v4l2_requestbuffers rb; 1689 struct v4l2_requestbuffers rb;
1226 int ret; 1690 int ret;
1227 1691 __u32 pixfmt;
1692 short width, height;
1693
1694 /* as the final format is not yet defined, allocate
1695 buffers with the max size */
1696 pixfmt = gspca_dev->pixfmt;
1697 width = gspca_dev->width;
1698 height = gspca_dev->height;
1699 gspca_dev->pixfmt = V4L2_PIX_FMT_BGR32;
1700 gspca_dev->width = 640;
1701 gspca_dev->height = 480;
1228 memset(&rb, 0, sizeof rb); 1702 memset(&rb, 0, sizeof rb);
1229 rb.count = 4; 1703 rb.count = 4;
1230 rb.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 1704 rb.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
1231 rb.memory = V4L2_MEMORY_MMAP; 1705 rb.memory = V4L2_MEMORY_MMAP;
1232 ret = vidioc_reqbufs(file, priv, &rb); 1706 ret = vidioc_reqbufs(file, priv, &rb);
1707 gspca_dev->pixfmt = pixfmt;
1708 gspca_dev->width = width;
1709 gspca_dev->height = height;
1233 if (ret != 0) 1710 if (ret != 0)
1234 return ret; 1711 return ret;
1235 } 1712 }
@@ -1328,43 +1805,22 @@ out:
1328 return ret; 1805 return ret;
1329} 1806}
1330 1807
1331static unsigned int dev_poll(struct file *file, poll_table * wait)
1332{
1333 struct gspca_dev *gspca_dev = file->private_data;
1334 int i, ret;
1335
1336 PDEBUG(D_FRAM, "poll");
1337
1338 poll_wait(file, &gspca_dev->wq, wait);
1339
1340 if (mutex_lock_interruptible(&gspca_dev->queue_lock) != 0)
1341 return POLLERR;
1342 if (gspca_dev->dev == 0
1343 || !gspca_dev->streaming) /* if not streaming */
1344 ret = POLLERR;
1345 else {
1346 i = gspca_dev->fr_o;
1347 i = gspca_dev->fr_queue[i];
1348 if (gspca_dev->frame[i].v4l2_buf.flags & V4L2_BUF_FLAG_DONE)
1349 ret = POLLIN | POLLRDNORM; /* something to read */
1350 else
1351 ret = 0;
1352 }
1353 mutex_unlock(&gspca_dev->queue_lock);
1354 return ret;
1355}
1356
1357/* 1808/*
1358 * wait for a video frame 1809 * wait for a video frame
1359 * 1810 *
1360 * If a frame is ready, its index is returned. 1811 * If a frame is ready, its index is returned.
1361 */ 1812 */
1362static int gspca_frame_wait(struct gspca_dev *gspca_dev, 1813static int frame_wait(struct gspca_dev *gspca_dev,
1363 int nonblock_ing) 1814 int nonblock_ing)
1364{ 1815{
1365 struct gspca_frame *frame; 1816 struct gspca_frame *frame;
1366 int i, j, ret; 1817 int i, j, ret;
1367 1818
1819 /* if userptr, treat the awaiting URBs */
1820 if (gspca_dev->memory == V4L2_MEMORY_USERPTR)
1821 isoc_transfer(gspca_dev);
1822
1823 /* check if a frame is ready */
1368 i = gspca_dev->fr_o; 1824 i = gspca_dev->fr_o;
1369 j = gspca_dev->fr_queue[i]; 1825 j = gspca_dev->fr_queue[i];
1370 frame = &gspca_dev->frame[j]; 1826 frame = &gspca_dev->frame[j];
@@ -1385,13 +1841,14 @@ static int gspca_frame_wait(struct gspca_dev *gspca_dev,
1385 } 1841 }
1386 if (!gspca_dev->streaming || !gspca_dev->present) 1842 if (!gspca_dev->streaming || !gspca_dev->present)
1387 return -EIO; 1843 return -EIO;
1844 if (gspca_dev->memory == V4L2_MEMORY_USERPTR)
1845 isoc_transfer(gspca_dev);
1388 i = gspca_dev->fr_o; 1846 i = gspca_dev->fr_o;
1389 j = gspca_dev->fr_queue[i]; 1847 j = gspca_dev->fr_queue[i];
1390 frame = &gspca_dev->frame[j]; 1848 frame = &gspca_dev->frame[j];
1391 if (frame->v4l2_buf.flags & V4L2_BUF_FLAG_DONE) 1849 if (frame->v4l2_buf.flags & V4L2_BUF_FLAG_DONE)
1392 break; 1850 break;
1393 } 1851 }
1394
1395ok: 1852ok:
1396 atomic_dec(&gspca_dev->nevent); 1853 atomic_dec(&gspca_dev->nevent);
1397 gspca_dev->fr_o = (i + 1) % gspca_dev->nframes; 1854 gspca_dev->fr_o = (i + 1) % gspca_dev->nframes;
@@ -1434,7 +1891,7 @@ static int vidioc_dqbuf(struct file *file, void *priv,
1434 if (mutex_lock_interruptible(&gspca_dev->read_lock)) 1891 if (mutex_lock_interruptible(&gspca_dev->read_lock))
1435 return -ERESTARTSYS; 1892 return -ERESTARTSYS;
1436 1893
1437 ret = gspca_frame_wait(gspca_dev, file->f_flags & O_NONBLOCK); 1894 ret = frame_wait(gspca_dev, file->f_flags & O_NONBLOCK);
1438 if (ret < 0) 1895 if (ret < 0)
1439 goto out; 1896 goto out;
1440 i = ret; /* frame index */ 1897 i = ret; /* frame index */
@@ -1467,14 +1924,14 @@ static int vidioc_qbuf(struct file *file, void *priv,
1467 1924
1468 index = v4l2_buf->index; 1925 index = v4l2_buf->index;
1469 if ((unsigned) index >= gspca_dev->nframes) { 1926 if ((unsigned) index >= gspca_dev->nframes) {
1470 PDEBUG(D_STREAM, 1927 PDEBUG(D_FRAM,
1471 "qbuf idx %d >= %d", index, gspca_dev->nframes); 1928 "qbuf idx %d >= %d", index, gspca_dev->nframes);
1472 return -EINVAL; 1929 return -EINVAL;
1473 } 1930 }
1474 frame = &gspca_dev->frame[index]; 1931 frame = &gspca_dev->frame[index];
1475 1932
1476 if (v4l2_buf->memory != frame->v4l2_buf.memory) { 1933 if (v4l2_buf->memory != frame->v4l2_buf.memory) {
1477 PDEBUG(D_STREAM, "qbuf bad memory type"); 1934 PDEBUG(D_FRAM, "qbuf bad memory type");
1478 return -EINVAL; 1935 return -EINVAL;
1479 } 1936 }
1480 if (gspca_dev->capt_file != file) 1937 if (gspca_dev->capt_file != file)
@@ -1483,17 +1940,16 @@ static int vidioc_qbuf(struct file *file, void *priv,
1483 if (mutex_lock_interruptible(&gspca_dev->queue_lock)) 1940 if (mutex_lock_interruptible(&gspca_dev->queue_lock))
1484 return -ERESTARTSYS; 1941 return -ERESTARTSYS;
1485 1942
1486 if (frame->v4l2_buf.flags 1943 if (frame->v4l2_buf.flags & BUF_ALL_FLAGS) {
1487 & (V4L2_BUF_FLAG_QUEUED | V4L2_BUF_FLAG_DONE)) { 1944 PDEBUG(D_FRAM, "qbuf bad state");
1488 PDEBUG(D_STREAM, "qbuf bad state");
1489 ret = -EINVAL; 1945 ret = -EINVAL;
1490 goto out; 1946 goto out;
1491 } 1947 }
1492 1948
1493 frame->v4l2_buf.flags |= V4L2_BUF_FLAG_QUEUED; 1949 frame->v4l2_buf.flags |= V4L2_BUF_FLAG_QUEUED;
1494 frame->v4l2_buf.flags &= ~V4L2_BUF_FLAG_DONE; 1950/* frame->v4l2_buf.flags &= ~V4L2_BUF_FLAG_DONE; */
1495 1951
1496 if (v4l2_buf->memory == V4L2_MEMORY_USERPTR) { 1952 if (frame->v4l2_buf.memory == V4L2_MEMORY_USERPTR) {
1497 frame->data = frame->data_end = 1953 frame->data = frame->data_end =
1498 (unsigned char *) v4l2_buf->m.userptr; 1954 (unsigned char *) v4l2_buf->m.userptr;
1499 frame->v4l2_buf.m.userptr = v4l2_buf->m.userptr; 1955 frame->v4l2_buf.m.userptr = v4l2_buf->m.userptr;
@@ -1517,16 +1973,16 @@ out:
1517 return ret; 1973 return ret;
1518} 1974}
1519 1975
1520static ssize_t dev_read(struct file *file, char __user *data, 1976/*
1521 size_t count, loff_t *ppos) 1977 * allocate the resources for read()
1978 */
1979static int read_alloc(struct gspca_dev *gspca_dev,
1980 struct file *file)
1522{ 1981{
1523 struct gspca_dev *gspca_dev = file->private_data;
1524 struct gspca_frame *frame;
1525 struct v4l2_buffer v4l2_buf; 1982 struct v4l2_buffer v4l2_buf;
1526 struct timeval timestamp; 1983 int i, ret;
1527 int i, ret, ret2;
1528 1984
1529 PDEBUG(D_FRAM, "read (%p, %d)", data, count); 1985 PDEBUG(D_STREAM, "read alloc");
1530 if (gspca_dev->nframes == 0) { 1986 if (gspca_dev->nframes == 0) {
1531 struct v4l2_requestbuffers rb; 1987 struct v4l2_requestbuffers rb;
1532 1988
@@ -1536,7 +1992,7 @@ static ssize_t dev_read(struct file *file, char __user *data,
1536 rb.memory = V4L2_MEMORY_MMAP; 1992 rb.memory = V4L2_MEMORY_MMAP;
1537 ret = vidioc_reqbufs(file, gspca_dev, &rb); 1993 ret = vidioc_reqbufs(file, gspca_dev, &rb);
1538 if (ret != 0) { 1994 if (ret != 0) {
1539 PDEBUG(D_STREAM, "read reqbuf err: %d", ret); 1995 PDEBUG(D_STREAM, "read reqbuf err %d", ret);
1540 return ret; 1996 return ret;
1541 } 1997 }
1542 memset(&v4l2_buf, 0, sizeof v4l2_buf); 1998 memset(&v4l2_buf, 0, sizeof v4l2_buf);
@@ -1553,18 +2009,89 @@ static ssize_t dev_read(struct file *file, char __user *data,
1553 return ret; 2009 return ret;
1554 } 2010 }
1555 } 2011 }
1556 } else if (gspca_dev->capt_file != file) 2012 gspca_dev->memory = GSPCA_MEMORY_READ;
1557 return -EINVAL; 2013 }
1558 2014
2015 /* start streaming */
2016 ret = vidioc_streamon(file, gspca_dev, V4L2_BUF_TYPE_VIDEO_CAPTURE);
2017 if (ret != 0)
2018 PDEBUG(D_STREAM, "read streamon err %d", ret);
2019 return ret;
2020}
2021
2022static unsigned int dev_poll(struct file *file, poll_table *wait)
2023{
2024 struct gspca_dev *gspca_dev = file->private_data;
2025 int i, ret;
2026
2027 PDEBUG(D_FRAM, "poll");
2028
2029 poll_wait(file, &gspca_dev->wq, wait);
2030 if (!gspca_dev->present)
2031 return POLLERR;
2032
2033 /* if not streaming, the user would use read() */
1559 if (!gspca_dev->streaming) { 2034 if (!gspca_dev->streaming) {
1560 ret = vidioc_streamon(file, gspca_dev, 2035 if (gspca_dev->memory != GSPCA_MEMORY_NO) {
1561 V4L2_BUF_TYPE_VIDEO_CAPTURE); 2036 ret = POLLERR; /* not the 1st time */
2037 goto out;
2038 }
2039 ret = read_alloc(gspca_dev, file);
1562 if (ret != 0) { 2040 if (ret != 0) {
1563 PDEBUG(D_STREAM, "read streamon err %d", ret); 2041 ret = POLLERR;
1564 return ret; 2042 goto out;
1565 } 2043 }
1566 } 2044 }
1567 2045
2046 if (mutex_lock_interruptible(&gspca_dev->queue_lock) != 0)
2047 return POLLERR;
2048 if (!gspca_dev->present) {
2049 ret = POLLERR;
2050 goto out;
2051 }
2052
2053 /* if not mmap, treat the awaiting URBs */
2054 if (gspca_dev->memory == V4L2_MEMORY_USERPTR
2055 && gspca_dev->capt_file == file)
2056 isoc_transfer(gspca_dev);
2057
2058 i = gspca_dev->fr_o;
2059 i = gspca_dev->fr_queue[i];
2060 if (gspca_dev->frame[i].v4l2_buf.flags & V4L2_BUF_FLAG_DONE)
2061 ret = POLLIN | POLLRDNORM; /* something to read */
2062 else
2063 ret = 0;
2064out:
2065 mutex_unlock(&gspca_dev->queue_lock);
2066 return ret;
2067}
2068
2069static ssize_t dev_read(struct file *file, char __user *data,
2070 size_t count, loff_t *ppos)
2071{
2072 struct gspca_dev *gspca_dev = file->private_data;
2073 struct gspca_frame *frame;
2074 struct v4l2_buffer v4l2_buf;
2075 struct timeval timestamp;
2076 int i, ret, ret2;
2077
2078 PDEBUG(D_FRAM, "read (%d)", count);
2079 if (!gspca_dev->present)
2080 return -ENODEV;
2081 switch (gspca_dev->memory) {
2082 case GSPCA_MEMORY_NO: /* first time */
2083 ret = read_alloc(gspca_dev, file);
2084 if (ret != 0)
2085 return ret;
2086 break;
2087 case GSPCA_MEMORY_READ:
2088 if (gspca_dev->capt_file != file)
2089 return -EINVAL;
2090 break;
2091 default:
2092 return -EINVAL;
2093 }
2094
1568 /* get a frame */ 2095 /* get a frame */
1569 jiffies_to_timeval(get_jiffies_64(), &timestamp); 2096 jiffies_to_timeval(get_jiffies_64(), &timestamp);
1570 timestamp.tv_sec--; 2097 timestamp.tv_sec--;
@@ -1615,7 +2142,7 @@ out:
1615 return ret; 2142 return ret;
1616} 2143}
1617 2144
1618static void gspca_dev_release(struct video_device *vfd) 2145static void dev_release(struct video_device *vfd)
1619{ 2146{
1620 /* nothing */ 2147 /* nothing */
1621} 2148}
@@ -1635,7 +2162,7 @@ static struct video_device gspca_template = {
1635 .name = "gspca main driver", 2162 .name = "gspca main driver",
1636 .type = VID_TYPE_CAPTURE, 2163 .type = VID_TYPE_CAPTURE,
1637 .fops = &dev_fops, 2164 .fops = &dev_fops,
1638 .release = gspca_dev_release, /* mandatory */ 2165 .release = dev_release, /* mandatory */
1639 .minor = -1, 2166 .minor = -1,
1640 .vidioc_querycap = vidioc_querycap, 2167 .vidioc_querycap = vidioc_querycap,
1641 .vidioc_dqbuf = vidioc_dqbuf, 2168 .vidioc_dqbuf = vidioc_dqbuf,
@@ -1673,7 +2200,8 @@ static struct video_device gspca_template = {
1673int gspca_dev_probe(struct usb_interface *intf, 2200int gspca_dev_probe(struct usb_interface *intf,
1674 const struct usb_device_id *id, 2201 const struct usb_device_id *id,
1675 const struct sd_desc *sd_desc, 2202 const struct sd_desc *sd_desc,
1676 int dev_size) 2203 int dev_size,
2204 struct module *module)
1677{ 2205{
1678 struct usb_interface_descriptor *interface; 2206 struct usb_interface_descriptor *interface;
1679 struct gspca_dev *gspca_dev; 2207 struct gspca_dev *gspca_dev;
@@ -1682,8 +2210,8 @@ int gspca_dev_probe(struct usb_interface *intf,
1682 __u16 vendor; 2210 __u16 vendor;
1683 __u16 product; 2211 __u16 product;
1684 2212
1685 vendor = le16_to_cpu(dev->descriptor.idVendor); 2213 vendor = id->idVendor;
1686 product = le16_to_cpu(dev->descriptor.idProduct); 2214 product = id->idProduct;
1687 PDEBUG(D_PROBE, "probing %04x:%04x", vendor, product); 2215 PDEBUG(D_PROBE, "probing %04x:%04x", vendor, product);
1688 2216
1689 /* we don't handle multi-config cameras */ 2217 /* we don't handle multi-config cameras */
@@ -1703,6 +2231,7 @@ int gspca_dev_probe(struct usb_interface *intf,
1703 } 2231 }
1704 gspca_dev->dev = dev; 2232 gspca_dev->dev = dev;
1705 gspca_dev->iface = interface->bInterfaceNumber; 2233 gspca_dev->iface = interface->bInterfaceNumber;
2234 gspca_dev->nbalt = intf->num_altsetting;
1706 gspca_dev->sd_desc = sd_desc; 2235 gspca_dev->sd_desc = sd_desc;
1707/* gspca_dev->users = 0; (done by kzalloc) */ 2236/* gspca_dev->users = 0; (done by kzalloc) */
1708 gspca_dev->nbufread = 2; 2237 gspca_dev->nbufread = 2;
@@ -1724,6 +2253,9 @@ int gspca_dev_probe(struct usb_interface *intf,
1724 /* init video stuff */ 2253 /* init video stuff */
1725 memcpy(&gspca_dev->vdev, &gspca_template, sizeof gspca_template); 2254 memcpy(&gspca_dev->vdev, &gspca_template, sizeof gspca_template);
1726 gspca_dev->vdev.dev = &dev->dev; 2255 gspca_dev->vdev.dev = &dev->dev;
2256 memcpy(&gspca_dev->fops, &dev_fops, sizeof gspca_dev->fops);
2257 gspca_dev->vdev.fops = &gspca_dev->fops;
2258 gspca_dev->fops.owner = module; /* module protection */
1727 ret = video_register_device(&gspca_dev->vdev, 2259 ret = video_register_device(&gspca_dev->vdev,
1728 VFL_TYPE_GRABBER, 2260 VFL_TYPE_GRABBER,
1729 video_nr); 2261 video_nr);
@@ -1758,7 +2290,7 @@ void gspca_disconnect(struct usb_interface *intf)
1758 mutex_lock(&gspca_dev->queue_lock); 2290 mutex_lock(&gspca_dev->queue_lock);
1759 mutex_lock(&gspca_dev->usb_lock); 2291 mutex_lock(&gspca_dev->usb_lock);
1760 gspca_dev->streaming = 0; 2292 gspca_dev->streaming = 0;
1761 gspca_kill_transfer(gspca_dev); 2293 destroy_urbs(gspca_dev);
1762 mutex_unlock(&gspca_dev->usb_lock); 2294 mutex_unlock(&gspca_dev->usb_lock);
1763 mutex_unlock(&gspca_dev->queue_lock); 2295 mutex_unlock(&gspca_dev->queue_lock);
1764 while (gspca_dev->users != 0) { /* wait until fully closed */ 2296 while (gspca_dev->users != 0) { /* wait until fully closed */
@@ -1777,11 +2309,23 @@ EXPORT_SYMBOL(gspca_disconnect);
1777/* -- module insert / remove -- */ 2309/* -- module insert / remove -- */
1778static int __init gspca_init(void) 2310static int __init gspca_init(void)
1779{ 2311{
2312#ifdef GSPCA_HLP
2313 int ret;
2314
2315 /* create /dev/gspca_hlp */
2316 ret = misc_register(&hlp_device);
2317 if (ret < 0)
2318 err("misc_register err %d", ret);
2319 start_hlp(); /* try to start the helper process */
2320#endif
1780 info("main v%s registered", version); 2321 info("main v%s registered", version);
1781 return 0; 2322 return 0;
1782} 2323}
1783static void __exit gspca_exit(void) 2324static void __exit gspca_exit(void)
1784{ 2325{
2326#ifdef GSPCA_HLP
2327 misc_deregister(&hlp_device);
2328#endif
1785 info("main deregistered"); 2329 info("main deregistered");
1786} 2330}
1787 2331
@@ -1791,7 +2335,8 @@ module_exit(gspca_exit);
1791module_param_named(debug, gspca_debug, int, 0644); 2335module_param_named(debug, gspca_debug, int, 0644);
1792MODULE_PARM_DESC(debug, 2336MODULE_PARM_DESC(debug,
1793 "Debug (bit) 0x01:error 0x02:probe 0x04:config" 2337 "Debug (bit) 0x01:error 0x02:probe 0x04:config"
1794 " 0x08:stream 0x10:frame 0x20:packet 0x40:USBin 0x80:USBout"); 2338 " 0x08:stream 0x10:frame 0x20:packet 0x40:USBin 0x80:USBout"
2339 " 0x0100: v4l2");
1795 2340
1796module_param(comp_fac, int, 0644); 2341module_param(comp_fac, int, 0644);
1797MODULE_PARM_DESC(comp_fac, 2342MODULE_PARM_DESC(comp_fac,
diff --git a/drivers/media/video/gspca/gspca.h b/drivers/media/video/gspca/gspca.h
index c2618c0e661..e69d8472a28 100644
--- a/drivers/media/video/gspca/gspca.h
+++ b/drivers/media/video/gspca/gspca.h
@@ -25,6 +25,7 @@ extern int gspca_debug;
25#define D_PACK 0x20 25#define D_PACK 0x20
26#define D_USBI 0x40 26#define D_USBI 0x40
27#define D_USBO 0x80 27#define D_USBO 0x80
28#define D_V4L2 0x0100
28#else 29#else
29#define PDEBUG(level, fmt, args...) 30#define PDEBUG(level, fmt, args...)
30#endif 31#endif
@@ -46,9 +47,9 @@ extern int gspca_debug;
46 47
47#define GSPCA_MAX_FRAMES 16 /* maximum number of video frame buffers */ 48#define GSPCA_MAX_FRAMES 16 /* maximum number of video frame buffers */
48/* ISOC transfers */ 49/* ISOC transfers */
49#define NURBS 4 /* number of URBs */ 50#define MAX_NURBS 32 /* max number of URBs (read & userptr) */
50#define ISO_MAX_PKT 32 /* max number of packets in an ISOC transfer */ 51#define ISO_MAX_PKT 32 /* max number of packets in an ISOC transfer */
51#define ISO_MAX_SIZE 0x10000 /* max size of one URB buffer (64 Kb) */ 52#define ISO_MAX_SIZE 0x8000 /* max size of one URB buffer (32 Kb) */
52 53
53/* device information - set at probe time */ 54/* device information - set at probe time */
54struct cam_mode { 55struct cam_mode {
@@ -123,13 +124,14 @@ struct gspca_frame {
123 124
124struct gspca_dev { 125struct gspca_dev {
125 struct video_device vdev; /* !! must be the first item */ 126 struct video_device vdev; /* !! must be the first item */
127 struct file_operations fops;
126 struct usb_device *dev; 128 struct usb_device *dev;
127 struct file *capt_file; /* file doing video capture */ 129 struct file *capt_file; /* file doing video capture */
128 130
129 struct cam cam; /* device information */ 131 struct cam cam; /* device information */
130 const struct sd_desc *sd_desc; /* subdriver description */ 132 const struct sd_desc *sd_desc; /* subdriver description */
131 133
132 struct urb *urb[NURBS]; 134 struct urb *urb[MAX_NURBS];
133 135
134 __u8 *frbuf; /* buffer for nframes */ 136 __u8 *frbuf; /* buffer for nframes */
135 struct gspca_frame frame[GSPCA_MAX_FRAMES]; 137 struct gspca_frame frame[GSPCA_MAX_FRAMES];
@@ -155,15 +157,21 @@ struct gspca_dev {
155 struct mutex queue_lock; /* ISOC queue protection */ 157 struct mutex queue_lock; /* ISOC queue protection */
156 __u32 sequence; /* frame sequence number */ 158 __u32 sequence; /* frame sequence number */
157 char streaming; 159 char streaming;
158 char users; /* # open */ 160 char users; /* number of opens */
159 char present; /* device connected */ 161 char present; /* device connected */
160 char nbufread; /* number of buffers for read() */ 162 char nbufread; /* number of buffers for read() */
163 char nurbs; /* number of allocated URBs */
164 char memory; /* memory type (V4L2_MEMORY_xxx) */
165 __u8 urb_in; /* URB pointers - used when !mmap */
166 __u8 urb_out;
167 __u8 nbalt; /* number of USB alternate settings */
161}; 168};
162 169
163int gspca_dev_probe(struct usb_interface *intf, 170int gspca_dev_probe(struct usb_interface *intf,
164 const struct usb_device_id *id, 171 const struct usb_device_id *id,
165 const struct sd_desc *sd_desc, 172 const struct sd_desc *sd_desc,
166 int dev_size); 173 int dev_size,
174 struct module *module);
167void gspca_disconnect(struct usb_interface *intf); 175void gspca_disconnect(struct usb_interface *intf);
168struct gspca_frame *gspca_frame_add(struct gspca_dev *gspca_dev, 176struct gspca_frame *gspca_frame_add(struct gspca_dev *gspca_dev,
169 int packet_type, 177 int packet_type,
diff --git a/drivers/media/video/gspca/jpeg.h b/drivers/media/video/gspca/jpeg.h
index c4087c0ebc4..d823b47bd4e 100644
--- a/drivers/media/video/gspca/jpeg.h
+++ b/drivers/media/video/gspca/jpeg.h
@@ -265,7 +265,7 @@ static unsigned char eoh[] = {
265 0x02, 0x11, 0x01, /* samples CbCr - quant CbCr */ 265 0x02, 0x11, 0x01, /* samples CbCr - quant CbCr */
266 0x03, 0x11, 0x01, 266 0x03, 0x11, 0x01,
267 267
268 0xff, 0xda, 0x00, 0x0c, /* SOS (start of scan */ 268 0xff, 0xda, 0x00, 0x0c, /* SOS (start of scan) */
269 0x03, 0x01, 0x00, 0x02, 0x11, 0x03, 0x11, 0x00, 0x3f, 0x00 269 0x03, 0x01, 0x00, 0x02, 0x11, 0x03, 0x11, 0x00, 0x3f, 0x00
270}; 270};
271#endif 271#endif
diff --git a/drivers/media/video/gspca/pac207.c b/drivers/media/video/gspca/pac207.c
index 57d48f51e3a..482ef4a6afc 100644
--- a/drivers/media/video/gspca/pac207.c
+++ b/drivers/media/video/gspca/pac207.c
@@ -27,8 +27,8 @@
27 27
28#include "gspca.h" 28#include "gspca.h"
29 29
30#define DRIVER_VERSION_NUMBER KERNEL_VERSION(0, 1, 1) 30#define DRIVER_VERSION_NUMBER KERNEL_VERSION(0, 2, 15)
31static const char version[] = "0.1.1"; 31static const char version[] = "0.2.15";
32 32
33MODULE_AUTHOR("Hans de Goede <j.w.r.degoede@hhs.nl>"); 33MODULE_AUTHOR("Hans de Goede <j.w.r.degoede@hhs.nl>");
34MODULE_DESCRIPTION("Pixart PAC207"); 34MODULE_DESCRIPTION("Pixart PAC207");
@@ -188,7 +188,8 @@ static const __u8 pac207_sensor_init[][8] = {
188 /* 48 reg_72 Rate Control end BalSize_4a =0x36 */ 188 /* 48 reg_72 Rate Control end BalSize_4a =0x36 */
189static const __u8 PacReg72[] = { 0x00, 0x00, 0x36, 0x00 }; 189static const __u8 PacReg72[] = { 0x00, 0x00, 0x36, 0x00 };
190 190
191static const char pac207_sof_marker[5] = { 0xff, 0xff, 0x00, 0xff, 0x96 }; 191static const unsigned char pac207_sof_marker[5] =
192 { 0xff, 0xff, 0x00, 0xff, 0x96 };
192 193
193int pac207_write_regs(struct gspca_dev *gspca_dev, u16 index, 194int pac207_write_regs(struct gspca_dev *gspca_dev, u16 index,
194 const u8 *buffer, u16 length) 195 const u8 *buffer, u16 length)
@@ -327,11 +328,12 @@ static void sd_start(struct gspca_dev *gspca_dev)
327 pac207_write_reg(gspca_dev, 0x02, sd->exposure); /* PXCK = 12MHz /n */ 328 pac207_write_reg(gspca_dev, 0x02, sd->exposure); /* PXCK = 12MHz /n */
328 329
329 mode = 0x02; /* Image Format (Bit 0), LED (1), Compr. test mode (2) */ 330 mode = 0x02; /* Image Format (Bit 0), LED (1), Compr. test mode (2) */
330 if (gspca_dev->width == 176) { /* 176x144 */ 331 if (gspca_dev->width == 176) { /* 176x144 */
331 mode |= 0x01; 332 mode |= 0x01;
332 PDEBUG(D_STREAM, "pac207_start mode 176x144"); 333 PDEBUG(D_STREAM, "pac207_start mode 176x144");
333 } else/* 352x288 */ 334 } else { /* 352x288 */
334 PDEBUG(D_STREAM, "pac207_start mode 352x288"); 335 PDEBUG(D_STREAM, "pac207_start mode 352x288");
336 }
335 pac207_write_reg(gspca_dev, 0x41, mode); 337 pac207_write_reg(gspca_dev, 0x41, mode);
336 338
337 pac207_write_reg(gspca_dev, 0x13, 0x01); /* Bit 0, auto clear */ 339 pac207_write_reg(gspca_dev, 0x13, 0x01); /* Bit 0, auto clear */
@@ -425,7 +427,7 @@ void init_pixart_decoder(void)
425} 427}
426 428
427/* auto gain and exposure algorithm based on the knee algorithm described here: 429/* auto gain and exposure algorithm based on the knee algorithm described here:
428 http://ytse.tricolour.net/docs/LowLightOptimization.html */ 430 * <http://ytse.tricolour.net/docs/LowLightOptimization.html> */
429static void pac207_do_auto_gain(struct gspca_dev *gspca_dev) 431static void pac207_do_auto_gain(struct gspca_dev *gspca_dev)
430{ 432{
431 struct sd *sd = (struct sd *) gspca_dev; 433 struct sd *sd = (struct sd *) gspca_dev;
@@ -508,8 +510,9 @@ static unsigned char *pac207_find_sof(struct gspca_dev *gspca_dev,
508 sd->sof_read = 0; 510 sd->sof_read = 0;
509 return m + i + 1; 511 return m + i + 1;
510 } 512 }
511 } else 513 } else {
512 sd->sof_read = 0; 514 sd->sof_read = 0;
515 }
513 } 516 }
514 517
515 return NULL; 518 return NULL;
@@ -556,9 +559,9 @@ static int pac207_decompress_row(struct gspca_dev *gspca_dev,
556 decoder_state->line_read++; 559 decoder_state->line_read++;
557 decoder_state->get_abs = 0; 560 decoder_state->get_abs = 0;
558 } else { 561 } else {
559 if (table[code].is_abs) 562 if (table[code].is_abs) {
560 decoder_state->get_abs = 1; 563 decoder_state->get_abs = 1;
561 else { 564 } else {
562 /* relative to left pixel */ 565 /* relative to left pixel */
563 val = outp[-2] + 566 val = outp[-2] +
564 table[code].val; 567 table[code].val;
@@ -894,13 +897,13 @@ static struct sd_desc sd_desc = {
894#define DVNM(name) .driver_info = (kernel_ulong_t) name 897#define DVNM(name) .driver_info = (kernel_ulong_t) name
895static __devinitdata struct usb_device_id device_table[] = { 898static __devinitdata struct usb_device_id device_table[] = {
896 {USB_DEVICE(0x041e, 0x4028), DVNM("Creative Webcam Vista Plus")}, 899 {USB_DEVICE(0x041e, 0x4028), DVNM("Creative Webcam Vista Plus")},
897 {USB_DEVICE(0x093a, 0x2460), DVNM("PAC207 Qtec Webcam 100")}, 900 {USB_DEVICE(0x093a, 0x2460), DVNM("Q-Tec Webcam 100")},
898 {USB_DEVICE(0x093a, 0x2463), DVNM("Philips spc200nc pac207")}, 901 {USB_DEVICE(0x093a, 0x2463), DVNM("Philips spc200nc pac207")},
899 {USB_DEVICE(0x093a, 0x2464), DVNM("Labtec Webcam 1200")}, 902 {USB_DEVICE(0x093a, 0x2464), DVNM("Labtec Webcam 1200")},
900 {USB_DEVICE(0x093a, 0x2468), DVNM("PAC207")}, 903 {USB_DEVICE(0x093a, 0x2468), DVNM("PAC207")},
901 {USB_DEVICE(0x093a, 0x2470), DVNM("Genius GF112")}, 904 {USB_DEVICE(0x093a, 0x2470), DVNM("Genius GF112")},
902 {USB_DEVICE(0x093a, 0x2471), DVNM("PAC207 Genius VideoCam ge111")}, 905 {USB_DEVICE(0x093a, 0x2471), DVNM("Genius VideoCam GE111")},
903 {USB_DEVICE(0x093a, 0x2472), DVNM("PAC207 Genius VideoCam ge110")}, 906 {USB_DEVICE(0x093a, 0x2472), DVNM("Genius VideoCam GE110")},
904 {USB_DEVICE(0x2001, 0xf115), DVNM("D-Link DSB-C120")}, 907 {USB_DEVICE(0x2001, 0xf115), DVNM("D-Link DSB-C120")},
905 {} 908 {}
906}; 909};
@@ -910,8 +913,8 @@ MODULE_DEVICE_TABLE(usb, device_table);
910static int sd_probe(struct usb_interface *intf, 913static int sd_probe(struct usb_interface *intf,
911 const struct usb_device_id *id) 914 const struct usb_device_id *id)
912{ 915{
913 PDEBUG(D_PROBE, "camera probe"); 916 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
914 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd)); 917 THIS_MODULE);
915} 918}
916 919
917static struct usb_driver sd_driver = { 920static struct usb_driver sd_driver = {
diff --git a/drivers/media/video/gspca/stk014.c b/drivers/media/video/gspca/stk014.c
index 2e4cf64442a..d8c203e99cd 100644
--- a/drivers/media/video/gspca/stk014.c
+++ b/drivers/media/video/gspca/stk014.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Syntek DV4000 (STK014) subdriver 2 * Syntek DV4000 (STK014) subdriver
3 * 3 *
4 * Copyright (C) Jean-Francois Moine (http://moinejf.free.fr) 4 * Copyright (C) 2008 Jean-Francois Moine (http://moinejf.free.fr)
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
@@ -16,7 +16,6 @@
16 * You should have received a copy of the GNU General Public License 16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software 17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 */ 19 */
21 20
22#define MODULE_NAME "stk014" 21#define MODULE_NAME "stk014"
@@ -24,8 +23,8 @@
24#include "gspca.h" 23#include "gspca.h"
25#include "jpeg.h" 24#include "jpeg.h"
26 25
27#define DRIVER_VERSION_NUMBER KERNEL_VERSION(0, 1, 0) 26#define DRIVER_VERSION_NUMBER KERNEL_VERSION(0, 2, 7)
28static const char version[] = "0.1.0"; 27static const char version[] = "0.2.7";
29 28
30MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>"); 29MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>");
31MODULE_DESCRIPTION("Syntek DV4000 (STK014) USB Camera Driver"); 30MODULE_DESCRIPTION("Syntek DV4000 (STK014) USB Camera Driver");
@@ -389,64 +388,32 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
389 unsigned char *data, /* isoc packet */ 388 unsigned char *data, /* isoc packet */
390 int len) /* iso packet length */ 389 int len) /* iso packet length */
391{ 390{
392 int l;
393 static unsigned char ffd9[] = {0xff, 0xd9}; 391 static unsigned char ffd9[] = {0xff, 0xd9};
394 392
395 /* a frame starts with: 393 /* a frame starts with:
396 * - 0xff 0xfe 394 * - 0xff 0xfe
397 * - 0x08 0x00 // length (little endian ?!) 395 * - 0x08 0x00 - length (little endian ?!)
398 * - 4 bytes = size of whole frame (big endian - including header) 396 * - 4 bytes = size of whole frame (BE - including header)
399 * - 0x00 0x0c 397 * - 0x00 0x0c
400 * - 0xff 0xd8 398 * - 0xff 0xd8
401 * - .. JPEG image with escape sequences (ff 00) 399 * - .. JPEG image with escape sequences (ff 00)
400 * (without ending - ff d9)
402 */ 401 */
403 if (data[0] == 0xff && data[1] == 0xfe) { 402 if (data[0] == 0xff && data[1] == 0xfe) {
404 if (gspca_dev->last_packet_type == INTER_PACKET) { 403 frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame,
405 PDEBUG(D_ERR|D_FRAM, "sof actual l: %d init l: %d", 404 ffd9, 2);
406 frame->data_end - frame->data,
407 frame->v4l2_buf.bytesused);
408 }
409 405
410 /* put the JPEG headaer */ 406 /* put the JPEG 411 header */
411 jpeg_put_header(gspca_dev, frame, sd_quant, 0x22); 407 jpeg_put_header(gspca_dev, frame, sd_quant, 0x22);
412 408
413 /* beginning of the frame */ 409 /* beginning of the frame */
414#define STKHDRSZ 12 410#define STKHDRSZ 12
415 l = (data[4] << 24) /* frame size */
416 + (data[5] << 16)
417 + (data[6] << 8)
418 + data[7]
419 - STKHDRSZ
420 + (frame->data_end - frame->data)
421 + 2; /* EOF (ff d9) */
422 gspca_frame_add(gspca_dev, INTER_PACKET, frame, 411 gspca_frame_add(gspca_dev, INTER_PACKET, frame,
423 data + STKHDRSZ, len - STKHDRSZ); 412 data + STKHDRSZ, len - STKHDRSZ);
424#undef STKHDRSZ 413#undef STKHDRSZ
425 frame->v4l2_buf.bytesused = l;
426 return;
427 }
428 if (gspca_dev->last_packet_type != INTER_PACKET) {
429 if (gspca_dev->last_packet_type == LAST_PACKET) {
430 PDEBUG(D_ERR|D_PACK, "mof actual l: %d init l: %d",
431 frame->data_end - frame->data,
432 frame->v4l2_buf.bytesused);
433 }
434 return;
435 }
436
437 /* intermediate packet */
438 l = frame->data_end - frame->data;
439 if (len < frame->v4l2_buf.bytesused - 2 - l) {
440 gspca_frame_add(gspca_dev, INTER_PACKET, frame,
441 data, len);
442 return; 414 return;
443 } 415 }
444
445 /* last packet */
446 if (len > frame->v4l2_buf.bytesused - 2 - l)
447 len = frame->v4l2_buf.bytesused - 2 - l;
448 gspca_frame_add(gspca_dev, INTER_PACKET, frame, data, len); 416 gspca_frame_add(gspca_dev, INTER_PACKET, frame, data, len);
449 gspca_frame_add(gspca_dev, LAST_PACKET, frame, ffd9, 2);
450} 417}
451 418
452static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val) 419static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val)
@@ -529,8 +496,8 @@ MODULE_DEVICE_TABLE(usb, device_table);
529static int sd_probe(struct usb_interface *intf, 496static int sd_probe(struct usb_interface *intf,
530 const struct usb_device_id *id) 497 const struct usb_device_id *id)
531{ 498{
532 PDEBUG(D_PROBE, "camera probe"); 499 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
533 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd)); 500 THIS_MODULE);
534} 501}
535 502
536static struct usb_driver sd_driver = { 503static struct usb_driver sd_driver = {
diff --git a/drivers/media/video/gspca/zc3xx.c b/drivers/media/video/gspca/zc3xx.c
new file mode 100644
index 00000000000..03cc7fc58db
--- /dev/null
+++ b/drivers/media/video/gspca/zc3xx.c
@@ -0,0 +1,7523 @@
1/*
2 * Z-Star/Vimicro zc301/zc302p/vc30x library
3 * Copyright (C) 2004 2005 2006 Michel Xhaard
4 * mxhaard@magic.fr
5 *
6 * V4L2 by Jean-François Moine <http://moinejf.free.fr>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23#define MODULE_NAME "zc3xx"
24
25#include "gspca.h"
26
27#define DRIVER_VERSION_NUMBER KERNEL_VERSION(0, 2, 13)
28static const char version[] = "0.2.13";
29
30MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>, "
31 "Serge A. Suchkov <Serge.A.S@tochka.ru>");
32MODULE_DESCRIPTION("GSPCA ZC03xx/VC3xx USB Camera Driver");
33MODULE_LICENSE("GPL");
34
35static int lightfreq = 50;
36static int force_sensor = -1;
37
38#include "jpeg.h"
39
40/* specific webcam descriptor */
41struct sd {
42 struct gspca_dev gspca_dev; /* !! must be the first item */
43
44 unsigned char brightness;
45 unsigned char contrast;
46 unsigned char autogain;
47 unsigned char gamma;
48
49 char qindex;
50 char sensor; /* Type of image sensor chip */
51/* !! values used in different tables */
52#define SENSOR_CS2102 0
53#define SENSOR_CS2102K 1
54#define SENSOR_GC0305 2
55#define SENSOR_HDCS2020 3
56#define SENSOR_HDCS2020b 4
57#define SENSOR_HV7131B 5
58#define SENSOR_HV7131C 6
59#define SENSOR_ICM105A 7
60#define SENSOR_MC501CB 8
61#define SENSOR_OV7620 9
62/*#define SENSOR_OV7648 9 - same values */
63#define SENSOR_OV7630C 10
64/*#define SENSOR_free 11 */
65#define SENSOR_PAS106 12
66#define SENSOR_PB0330 13
67#define SENSOR_PO2030 14
68#define SENSOR_TAS5130CK 15
69#define SENSOR_TAS5130CXX 16
70#define SENSOR_TAS5130C_VF0250 17
71#define SENSOR_MAX 18
72 unsigned short chip_revision;
73};
74
75/* V4L2 controls supported by the driver */
76static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val);
77static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val);
78static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val);
79static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val);
80static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val);
81static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val);
82static int sd_getgamma(struct gspca_dev *gspca_dev, __s32 *val);
83
84static struct ctrl sd_ctrls[] = {
85#define SD_BRIGHTNESS 0
86 {
87 {
88 .id = V4L2_CID_BRIGHTNESS,
89 .type = V4L2_CTRL_TYPE_INTEGER,
90 .name = "Brightness",
91 .minimum = 0,
92 .maximum = 255,
93 .step = 1,
94 .default_value = 128,
95 },
96 .set = sd_setbrightness,
97 .get = sd_getbrightness,
98 },
99#define SD_CONTRAST 1
100 {
101 {
102 .id = V4L2_CID_CONTRAST,
103 .type = V4L2_CTRL_TYPE_INTEGER,
104 .name = "Contrast",
105 .minimum = 0,
106 .maximum = 256,
107 .step = 1,
108 .default_value = 128,
109 },
110 .set = sd_setcontrast,
111 .get = sd_getcontrast,
112 },
113#define SD_AUTOGAIN 2
114 {
115 {
116 .id = V4L2_CID_AUTOGAIN,
117 .type = V4L2_CTRL_TYPE_BOOLEAN,
118 .name = "Auto Gain",
119 .minimum = 0,
120 .maximum = 1,
121 .step = 1,
122 .default_value = 1,
123 },
124 .set = sd_setautogain,
125 .get = sd_getautogain,
126 },
127#define SD_GAMMA 3
128 {
129 {
130 .id = V4L2_CID_GAMMA,
131 .type = V4L2_CTRL_TYPE_INTEGER,
132 .name = "Gamma",
133 .minimum = 1,
134 .maximum = 6,
135 .step = 1,
136 .default_value = 4,
137 },
138 .set = sd_setcontrast,
139 .get = sd_getgamma,
140 },
141};
142
143static struct cam_mode vga_mode[] = {
144 {V4L2_PIX_FMT_JPEG, 320, 240, 1},
145 {V4L2_PIX_FMT_JPEG, 640, 480, 0},
146};
147
148static struct cam_mode sif_mode[] = {
149 {V4L2_PIX_FMT_JPEG, 176, 144, 1},
150 {V4L2_PIX_FMT_JPEG, 352, 288, 0},
151};
152
153/* usb exchanges */
154struct usb_action {
155 __u8 req;
156 __u8 val;
157 __u16 idx;
158};
159
160static struct usb_action cs2102_Initial[] = {
161 {0xa1, 0x01, 0x0008},
162 {0xa1, 0x01, 0x0008},
163 {0xa0, 0x01, 0x0000},
164 {0xa0, 0x10, 0x0002},
165 {0xa0, 0x00, 0x0010},
166 {0xa0, 0x01, 0x0001},
167 {0xa0, 0x20, 0x0080},
168 {0xa0, 0x21, 0x0081},
169 {0xa0, 0x30, 0x0083},
170 {0xa0, 0x31, 0x0084},
171 {0xa0, 0x32, 0x0085},
172 {0xa0, 0x23, 0x0086},
173 {0xa0, 0x24, 0x0087},
174 {0xa0, 0x25, 0x0088},
175 {0xa0, 0xb3, 0x008b},
176 {0xa0, 0x03, 0x0008}, /* 00 */
177 {0xa0, 0x03, 0x0012},
178 {0xa0, 0x01, 0x0012},
179 {0xa0, 0x02, 0x0003},
180 {0xa0, 0x80, 0x0004},
181 {0xa0, 0x01, 0x0005},
182 {0xa0, 0xe0, 0x0006},
183 {0xa0, 0x00, 0x0098},
184 {0xa0, 0x00, 0x009a},
185 {0xa0, 0x00, 0x011a},
186 {0xa0, 0x00, 0x011c},
187 {0xaa, 0x02, 0x0008},
188 {0xaa, 0x03, 0x0000},
189 {0xaa, 0x11, 0x0000},
190 {0xaa, 0x12, 0x0089},
191 {0xaa, 0x13, 0x0000},
192 {0xaa, 0x14, 0x00e9},
193 {0xaa, 0x20, 0x0000},
194 {0xaa, 0x22, 0x0000},
195 {0xaa, 0x0b, 0x0004},
196 {0xaa, 0x30, 0x0030},
197 {0xaa, 0x31, 0x0030},
198 {0xaa, 0x32, 0x0030},
199 {0xa0, 0x37, 0x0101},
200 {0xa0, 0x00, 0x0019},
201 {0xa0, 0x05, 0x0012},
202 {0xa0, 0x0d, 0x0100},
203 {0xa0, 0x06, 0x0189},
204 {0xa0, 0x03, 0x01c5},
205 {0xa0, 0x13, 0x01cb},
206 {0xa0, 0x10, 0x01ae},
207 {0xa0, 0x08, 0x0250},
208 {0xa0, 0x08, 0x0301},
209 {0xa0, 0x68, 0x018d},
210 {0xa0, 0x00, 0x01ad},
211 {0xa1, 0x01, 0x0002},
212 {0xa1, 0x01, 0x0008},
213 {0xa0, 0x03, 0x0008}, /* 00 */
214 {0xa0, 0x08, 0x01c6}, /* clock ? */
215 {0xa1, 0x01, 0x01c8},
216 {0xa1, 0x01, 0x01c9},
217 {0xa1, 0x01, 0x01ca},
218 {0xa0, 0x0f, 0x01cb},
219 {0xa0, 0x24, 0x0120}, /* gamma 5 */
220 {0xa0, 0x44, 0x0121},
221 {0xa0, 0x64, 0x0122},
222 {0xa0, 0x84, 0x0123},
223 {0xa0, 0x9d, 0x0124},
224 {0xa0, 0xb2, 0x0125},
225 {0xa0, 0xc4, 0x0126},
226 {0xa0, 0xd3, 0x0127},
227 {0xa0, 0xe0, 0x0128},
228 {0xa0, 0xeb, 0x0129},
229 {0xa0, 0xf4, 0x012a},
230 {0xa0, 0xfb, 0x012b},
231 {0xa0, 0xff, 0x012c},
232 {0xa0, 0xff, 0x012d},
233 {0xa0, 0xff, 0x012e},
234 {0xa0, 0xff, 0x012f},
235 {0xa0, 0x18, 0x0130},
236 {0xa0, 0x20, 0x0131},
237 {0xa0, 0x20, 0x0132},
238 {0xa0, 0x1c, 0x0133},
239 {0xa0, 0x16, 0x0134},
240 {0xa0, 0x13, 0x0135},
241 {0xa0, 0x10, 0x0136},
242 {0xa0, 0x0e, 0x0137},
243 {0xa0, 0x0b, 0x0138},
244 {0xa0, 0x09, 0x0139},
245 {0xa0, 0x07, 0x013a},
246 {0xa0, 0x06, 0x013b},
247 {0xa0, 0x00, 0x013c},
248 {0xa0, 0x00, 0x013d},
249 {0xa0, 0x00, 0x013e},
250 {0xa0, 0x01, 0x013f},
251 {0xa0, 0x58, 0x010a}, /* matrix */
252 {0xa0, 0xf4, 0x010b},
253 {0xa0, 0xf4, 0x010c},
254 {0xa0, 0xf4, 0x010d},
255 {0xa0, 0x58, 0x010e},
256 {0xa0, 0xf4, 0x010f},
257 {0xa0, 0xf4, 0x0110},
258 {0xa0, 0xf4, 0x0111},
259 {0xa0, 0x58, 0x0112},
260 {0xa1, 0x01, 0x0180},
261 {0xa0, 0x00, 0x0180},
262 {0xa0, 0x00, 0x0019},
263 {0xaa, 0x23, 0x0001},
264 {0xaa, 0x24, 0x0055},
265 {0xaa, 0x25, 0x00cc},
266 {0xaa, 0x21, 0x003f},
267 {0xa0, 0x02, 0x0190},
268 {0xa0, 0xab, 0x0191},
269 {0xa0, 0x98, 0x0192},
270 {0xa0, 0x00, 0x0195},
271 {0xa0, 0x30, 0x0196},
272 {0xa0, 0xd4, 0x0197},
273 {0xa0, 0x10, 0x018c},
274 {0xa0, 0x20, 0x018f},
275 {0xa0, 0x10, 0x01a9},
276 {0xa0, 0x24, 0x01aa},
277 {0xa0, 0x39, 0x001d},
278 {0xa0, 0x70, 0x001e},
279 {0xa0, 0xb0, 0x001f},
280 {0xa0, 0xff, 0x0020},
281 {0xa0, 0x40, 0x0180},
282 {0xa1, 0x01, 0x0180},
283 {0xa0, 0x42, 0x0180},
284 {0xa0, 0x40, 0x0116},
285 {0xa0, 0x40, 0x0117},
286 {0xa0, 0x40, 0x0118},
287 {0, 0, 0}
288};
289
290static struct usb_action cs2102_InitialScale[] = {
291 {0xa1, 0x01, 0x0008},
292 {0xa1, 0x01, 0x0008},
293 {0xa0, 0x01, 0x0000},
294 {0xa0, 0x00, 0x0002},
295 {0xa0, 0x00, 0x0010},
296 {0xa0, 0x01, 0x0001},
297 {0xa0, 0x20, 0x0080},
298 {0xa0, 0x21, 0x0081},
299 {0xa0, 0x30, 0x0083},
300 {0xa0, 0x31, 0x0084},
301 {0xa0, 0x32, 0x0085},
302 {0xa0, 0x23, 0x0086},
303 {0xa0, 0x24, 0x0087},
304 {0xa0, 0x25, 0x0088},
305 {0xa0, 0xb3, 0x008b},
306 {0xa0, 0x03, 0x0008}, /* 00 */
307 {0xa0, 0x03, 0x0012},
308 {0xa0, 0x01, 0x0012},
309 {0xa0, 0x02, 0x0003},
310 {0xa0, 0x80, 0x0004},
311 {0xa0, 0x01, 0x0005},
312 {0xa0, 0xe0, 0x0006},
313 {0xa0, 0x00, 0x0098},
314 {0xa0, 0x00, 0x009a},
315 {0xa0, 0x00, 0x011a},
316 {0xa0, 0x00, 0x011c},
317 {0xaa, 0x02, 0x0008},
318 {0xaa, 0x03, 0x0000},
319 {0xaa, 0x11, 0x0001},
320 {0xaa, 0x12, 0x0087},
321 {0xaa, 0x13, 0x0001},
322 {0xaa, 0x14, 0x00e7},
323 {0xaa, 0x20, 0x0000},
324 {0xaa, 0x22, 0x0000},
325 {0xaa, 0x0b, 0x0004},
326 {0xaa, 0x30, 0x0030},
327 {0xaa, 0x31, 0x0030},
328 {0xaa, 0x32, 0x0030},
329 {0xa0, 0x77, 0x0101},
330 {0xa0, 0x00, 0x0019},
331 {0xa0, 0x05, 0x0012},
332 {0xa0, 0x0d, 0x0100},
333 {0xa0, 0x06, 0x0189},
334 {0xa0, 0x03, 0x01c5},
335 {0xa0, 0x13, 0x01cb},
336 {0xa0, 0x15, 0x01ae},
337 {0xa0, 0x08, 0x0250},
338 {0xa0, 0x08, 0x0301},
339 {0xa0, 0x68, 0x018d},
340 {0xa0, 0x00, 0x01ad},
341 {0xa1, 0x01, 0x0002},
342 {0xa1, 0x01, 0x0008},
343 {0xa0, 0x03, 0x0008}, /* 00 */
344 {0xa0, 0x08, 0x01c6}, /* clock ? */
345 {0xa1, 0x01, 0x01c8},
346 {0xa1, 0x01, 0x01c9},
347 {0xa1, 0x01, 0x01ca},
348 {0xa0, 0x0f, 0x01cb},
349 {0xa0, 0x24, 0x0120}, /* gamma 5 */
350 {0xa0, 0x44, 0x0121},
351 {0xa0, 0x64, 0x0122},
352 {0xa0, 0x84, 0x0123},
353 {0xa0, 0x9d, 0x0124},
354 {0xa0, 0xb2, 0x0125},
355 {0xa0, 0xc4, 0x0126},
356 {0xa0, 0xd3, 0x0127},
357 {0xa0, 0xe0, 0x0128},
358 {0xa0, 0xeb, 0x0129},
359 {0xa0, 0xf4, 0x012a},
360 {0xa0, 0xfb, 0x012b},
361 {0xa0, 0xff, 0x012c},
362 {0xa0, 0xff, 0x012d},
363 {0xa0, 0xff, 0x012e},
364 {0xa0, 0xff, 0x012f},
365 {0xa0, 0x18, 0x0130},
366 {0xa0, 0x20, 0x0131},
367 {0xa0, 0x20, 0x0132},
368 {0xa0, 0x1c, 0x0133},
369 {0xa0, 0x16, 0x0134},
370 {0xa0, 0x13, 0x0135},
371 {0xa0, 0x10, 0x0136},
372 {0xa0, 0x0e, 0x0137},
373 {0xa0, 0x0b, 0x0138},
374 {0xa0, 0x09, 0x0139},
375 {0xa0, 0x07, 0x013a},
376 {0xa0, 0x06, 0x013b},
377 {0xa0, 0x00, 0x013c},
378 {0xa0, 0x00, 0x013d},
379 {0xa0, 0x00, 0x013e},
380 {0xa0, 0x01, 0x013f},
381 {0xa0, 0x58, 0x010a}, /* matrix */
382 {0xa0, 0xf4, 0x010b},
383 {0xa0, 0xf4, 0x010c},
384 {0xa0, 0xf4, 0x010d},
385 {0xa0, 0x58, 0x010e},
386 {0xa0, 0xf4, 0x010f},
387 {0xa0, 0xf4, 0x0110},
388 {0xa0, 0xf4, 0x0111},
389 {0xa0, 0x58, 0x0112},
390 {0xa1, 0x01, 0x0180},
391 {0xa0, 0x00, 0x0180},
392 {0xa0, 0x00, 0x0019},
393 {0xaa, 0x23, 0x0000},
394 {0xaa, 0x24, 0x00aa},
395 {0xaa, 0x25, 0x00e6},
396 {0xaa, 0x21, 0x003f},
397 {0xa0, 0x01, 0x0190},
398 {0xa0, 0x55, 0x0191},
399 {0xa0, 0xcc, 0x0192},
400 {0xa0, 0x00, 0x0195},
401 {0xa0, 0x18, 0x0196},
402 {0xa0, 0x6a, 0x0197},
403 {0xa0, 0x10, 0x018c},
404 {0xa0, 0x20, 0x018f},
405 {0xa0, 0x10, 0x01a9},
406 {0xa0, 0x24, 0x01aa},
407 {0xa0, 0x3f, 0x001d},
408 {0xa0, 0xa5, 0x001e},
409 {0xa0, 0xf0, 0x001f},
410 {0xa0, 0xff, 0x0020},
411 {0xa0, 0x40, 0x0180},
412 {0xa1, 0x01, 0x0180},
413 {0xa0, 0x42, 0x0180},
414 {0xa0, 0x40, 0x0116},
415 {0xa0, 0x40, 0x0117},
416 {0xa0, 0x40, 0x0118},
417 {0, 0, 0}
418};
419static struct usb_action cs2102_50HZ[] = {
420 {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
421 {0xaa, 0x0f, 0x008c}, /* 00,0f,8c,aa */
422 {0xaa, 0x03, 0x0005}, /* 00,03,05,aa */
423 {0xaa, 0x04, 0x00ac}, /* 00,04,ac,aa */
424 {0xaa, 0x10, 0x0005}, /* 00,10,05,aa */
425 {0xaa, 0x11, 0x00ac}, /* 00,11,ac,aa */
426 {0xaa, 0x1b, 0x0000}, /* 00,1b,00,aa */
427 {0xaa, 0x1c, 0x0005}, /* 00,1c,05,aa */
428 {0xaa, 0x1d, 0x00ac}, /* 00,1d,ac,aa */
429 {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
430 {0xa0, 0x3f, 0x0191}, /* 01,91,3f,cc */
431 {0xa0, 0xf0, 0x0192}, /* 01,92,f0,cc */
432 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */
433 {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */
434 {0xa0, 0x42, 0x0197}, /* 01,97,42,cc */
435 {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */
436 {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */
437 {0xa0, 0x10, 0x01a9}, /* 01,a9,10,cc */
438 {0xa0, 0x24, 0x01aa}, /* 01,aa,24,cc */
439 {0xa0, 0x8c, 0x001d}, /* 00,1d,8c,cc */
440 {0xa0, 0xb0, 0x001e}, /* 00,1e,b0,cc */
441 {0xa0, 0xd0, 0x001f}, /* 00,1f,d0,cc */
442 {0, 0, 0}
443};
444static struct usb_action cs2102_50HZScale[] = {
445 {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
446 {0xaa, 0x0f, 0x0093}, /* 00,0f,93,aa */
447 {0xaa, 0x03, 0x0005}, /* 00,03,05,aa */
448 {0xaa, 0x04, 0x00a1}, /* 00,04,a1,aa */
449 {0xaa, 0x10, 0x0005}, /* 00,10,05,aa */
450 {0xaa, 0x11, 0x00a1}, /* 00,11,a1,aa */
451 {0xaa, 0x1b, 0x0000}, /* 00,1b,00,aa */
452 {0xaa, 0x1c, 0x0005}, /* 00,1c,05,aa */
453 {0xaa, 0x1d, 0x00a1}, /* 00,1d,a1,aa */
454 {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
455 {0xa0, 0x3f, 0x0191}, /* 01,91,3f,cc */
456 {0xa0, 0xf7, 0x0192}, /* 01,92,f7,cc */
457 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */
458 {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */
459 {0xa0, 0x83, 0x0197}, /* 01,97,83,cc */
460 {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */
461 {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */
462 {0xa0, 0x10, 0x01a9}, /* 01,a9,10,cc */
463 {0xa0, 0x24, 0x01aa}, /* 01,aa,24,cc */
464 {0xa0, 0x93, 0x001d}, /* 00,1d,93,cc */
465 {0xa0, 0xb0, 0x001e}, /* 00,1e,b0,cc */
466 {0xa0, 0xd0, 0x001f}, /* 00,1f,d0,cc */
467 {0, 0, 0}
468};
469static struct usb_action cs2102_60HZ[] = {
470 {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
471 {0xaa, 0x0f, 0x005d}, /* 00,0f,5d,aa */
472 {0xaa, 0x03, 0x0005}, /* 00,03,05,aa */
473 {0xaa, 0x04, 0x00aa}, /* 00,04,aa,aa */
474 {0xaa, 0x10, 0x0005}, /* 00,10,05,aa */
475 {0xaa, 0x11, 0x00aa}, /* 00,11,aa,aa */
476 {0xaa, 0x1b, 0x0000}, /* 00,1b,00,aa */
477 {0xaa, 0x1c, 0x0005}, /* 00,1c,05,aa */
478 {0xaa, 0x1d, 0x00aa}, /* 00,1d,aa,aa */
479 {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
480 {0xa0, 0x3f, 0x0191}, /* 01,91,3f,cc */
481 {0xa0, 0xe4, 0x0192}, /* 01,92,e4,cc */
482 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */
483 {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */
484 {0xa0, 0x3a, 0x0197}, /* 01,97,3a,cc */
485 {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */
486 {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */
487 {0xa0, 0x10, 0x01a9}, /* 01,a9,10,cc */
488 {0xa0, 0x24, 0x01aa}, /* 01,aa,24,cc */
489 {0xa0, 0x5d, 0x001d}, /* 00,1d,5d,cc */
490 {0xa0, 0x90, 0x001e}, /* 00,1e,90,cc */
491 {0xa0, 0xd0, 0x00c8}, /* 00,c8,d0,cc */
492 {0, 0, 0}
493};
494static struct usb_action cs2102_60HZScale[] = {
495 {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
496 {0xaa, 0x0f, 0x00b7}, /* 00,0f,b7,aa */
497 {0xaa, 0x03, 0x0005}, /* 00,03,05,aa */
498 {0xaa, 0x04, 0x00be}, /* 00,04,be,aa */
499 {0xaa, 0x10, 0x0005}, /* 00,10,05,aa */
500 {0xaa, 0x11, 0x00be}, /* 00,11,be,aa */
501 {0xaa, 0x1b, 0x0000}, /* 00,1b,00,aa */
502 {0xaa, 0x1c, 0x0005}, /* 00,1c,05,aa */
503 {0xaa, 0x1d, 0x00be}, /* 00,1d,be,aa */
504 {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
505 {0xa0, 0x3f, 0x0191}, /* 01,91,3f,cc */
506 {0xa0, 0xfc, 0x0192}, /* 01,92,fc,cc */
507 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */
508 {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */
509 {0xa0, 0x69, 0x0197}, /* 01,97,69,cc */
510 {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */
511 {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */
512 {0xa0, 0x10, 0x01a9}, /* 01,a9,10,cc */
513 {0xa0, 0x24, 0x01aa}, /* 01,aa,24,cc */
514 {0xa0, 0xb7, 0x001d}, /* 00,1d,b7,cc */
515 {0xa0, 0xd0, 0x001e}, /* 00,1e,d0,cc */
516 {0xa0, 0xe8, 0x001f}, /* 00,1f,e8,cc */
517 {0, 0, 0}
518};
519static struct usb_action cs2102_NoFliker[] = {
520 {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
521 {0xaa, 0x0f, 0x0059}, /* 00,0f,59,aa */
522 {0xaa, 0x03, 0x0005}, /* 00,03,05,aa */
523 {0xaa, 0x04, 0x0080}, /* 00,04,80,aa */
524 {0xaa, 0x10, 0x0005}, /* 00,10,05,aa */
525 {0xaa, 0x11, 0x0080}, /* 00,11,80,aa */
526 {0xaa, 0x1b, 0x0000}, /* 00,1b,00,aa */
527 {0xaa, 0x1c, 0x0005}, /* 00,1c,05,aa */
528 {0xaa, 0x1d, 0x0080}, /* 00,1d,80,aa */
529 {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
530 {0xa0, 0x3f, 0x0191}, /* 01,91,3f,cc */
531 {0xa0, 0xf0, 0x0192}, /* 01,92,f0,cc */
532 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */
533 {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */
534 {0xa0, 0x10, 0x0197}, /* 01,97,10,cc */
535 {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */
536 {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */
537 {0xa0, 0x00, 0x01a9}, /* 01,a9,00,cc */
538 {0xa0, 0x00, 0x01aa}, /* 01,aa,00,cc */
539 {0xa0, 0x59, 0x001d}, /* 00,1d,59,cc */
540 {0xa0, 0x90, 0x001e}, /* 00,1e,90,cc */
541 {0xa0, 0xc8, 0x001f}, /* 00,1f,c8,cc */
542 {0, 0, 0}
543};
544static struct usb_action cs2102_NoFlikerScale[] = {
545 {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
546 {0xaa, 0x0f, 0x0059}, /* 00,0f,59,aa */
547 {0xaa, 0x03, 0x0005}, /* 00,03,05,aa */
548 {0xaa, 0x04, 0x0080}, /* 00,04,80,aa */
549 {0xaa, 0x10, 0x0005}, /* 00,10,05,aa */
550 {0xaa, 0x11, 0x0080}, /* 00,11,80,aa */
551 {0xaa, 0x1b, 0x0000}, /* 00,1b,00,aa */
552 {0xaa, 0x1c, 0x0005}, /* 00,1c,05,aa */
553 {0xaa, 0x1d, 0x0080}, /* 00,1d,80,aa */
554 {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
555 {0xa0, 0x3f, 0x0191}, /* 01,91,3f,cc */
556 {0xa0, 0xf0, 0x0192}, /* 01,92,f0,cc */
557 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */
558 {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */
559 {0xa0, 0x10, 0x0197}, /* 01,97,10,cc */
560 {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */
561 {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */
562 {0xa0, 0x00, 0x01a9}, /* 01,a9,00,cc */
563 {0xa0, 0x00, 0x01aa}, /* 01,aa,00,cc */
564 {0xa0, 0x59, 0x001d}, /* 00,1d,59,cc */
565 {0xa0, 0x90, 0x001e}, /* 00,1e,90,cc */
566 {0xa0, 0xc8, 0x001f}, /* 00,1f,c8,cc */
567 {0, 0, 0}
568};
569
570/* CS2102_KOCOM */
571static struct usb_action cs2102K_Initial[] = {
572 {0xa0, 0x11, 0x0002},
573 {0xa0, 0x03, 0x0008},
574 {0xa0, 0x08, 0x0010},
575 {0xa0, 0x02, 0x0003},
576 {0xa0, 0x80, 0x0004},
577 {0xa0, 0x01, 0x0005},
578 {0xa0, 0xe0, 0x0006},
579 {0xa0, 0x01, 0x0001},
580 {0xa0, 0x03, 0x0012},
581 {0xa0, 0x01, 0x0012},
582 {0xa0, 0x00, 0x0098},
583 {0xa0, 0x00, 0x009a},
584 {0xa0, 0x00, 0x011a},
585 {0xa0, 0x00, 0x011c},
586 {0xa0, 0xe8, 0x009c},
587 {0xa0, 0x88, 0x009e},
588 {0xa0, 0x55, 0x008b},
589 {0xa0, 0x18, 0x0092},
590 {0xa0, 0x00, 0x0093},
591 {0xa0, 0x00, 0x0094},
592 {0xa0, 0x01, 0x0090},
593 {0xa0, 0x0a, 0x0092},
594 {0xa0, 0x02, 0x0093},
595 {0xa0, 0x00, 0x0094},
596 {0xa0, 0x01, 0x0090},
597 {0xa0, 0x0b, 0x0092},
598 {0xa0, 0x02, 0x0093},
599 {0xa0, 0x00, 0x0094},
600 {0xa0, 0x01, 0x0090},
601 {0xa0, 0x0c, 0x0092},
602 {0xa0, 0x7c, 0x0093},
603 {0xa0, 0x00, 0x0094},
604 {0xa0, 0x01, 0x0090},
605 {0xa0, 0x0d, 0x0092},
606 {0xa0, 0xa3, 0x0093},
607 {0xa0, 0x00, 0x0094},
608 {0xa0, 0x01, 0x0090},
609 {0xa0, 0x03, 0x0092},
610 {0xa0, 0xfb, 0x0093},
611 {0xa0, 0x00, 0x0094},
612 {0xa0, 0x01, 0x0090},
613 {0xa0, 0x05, 0x0092},
614 {0xa0, 0x00, 0x0093},
615 {0xa0, 0x00, 0x0094},
616 {0xa0, 0x01, 0x0090},
617 {0xa0, 0x06, 0x0092},
618 {0xa0, 0x03, 0x0093},
619 {0xa0, 0x00, 0x0094},
620 {0xa0, 0x01, 0x0090},
621 {0xa0, 0x09, 0x0092},
622 {0xa0, 0x08, 0x0093},
623 {0xa0, 0x00, 0x0094},
624 {0xa0, 0x01, 0x0090},
625 {0xa0, 0x0e, 0x0092},
626 {0xa0, 0x04, 0x0093},
627 {0xa0, 0x00, 0x0094},
628 {0xa0, 0x01, 0x0090},
629 {0xa0, 0x0f, 0x0092},
630 {0xa0, 0x18, 0x0093},
631 {0xa0, 0x00, 0x0094},
632 {0xa0, 0x01, 0x0090},
633 {0xa0, 0x10, 0x0092},
634 {0xa0, 0x18, 0x0093},
635 {0xa0, 0x00, 0x0094},
636 {0xa0, 0x01, 0x0090},
637 {0xa0, 0x11, 0x0092},
638 {0xa0, 0x18, 0x0093},
639 {0xa0, 0x00, 0x0094},
640 {0xa0, 0x01, 0x0090},
641 {0xa0, 0x12, 0x0092},
642 {0xa0, 0x18, 0x0093},
643 {0xa0, 0x00, 0x0094},
644 {0xa0, 0x01, 0x0090},
645 {0xa0, 0x15, 0x0092},
646 {0xa0, 0x00, 0x0093},
647 {0xa0, 0x00, 0x0094},
648 {0xa0, 0x01, 0x0090},
649 {0xa0, 0x16, 0x0092},
650 {0xa0, 0x0c, 0x0093},
651 {0xa0, 0x00, 0x0094},
652 {0xa0, 0x01, 0x0090},
653 {0xa0, 0x17, 0x0092},
654 {0xa0, 0x0c, 0x0093},
655 {0xa0, 0x00, 0x0094},
656 {0xa0, 0x01, 0x0090},
657 {0xa0, 0x18, 0x0092},
658 {0xa0, 0x04, 0x0093},
659 {0xa0, 0x00, 0x0094},
660 {0xa0, 0x01, 0x0090},
661 {0xa0, 0xb7, 0x0101},
662 {0xa0, 0x05, 0x0012},
663 {0xa0, 0x78, 0x018d},
664 {0xa0, 0x0d, 0x0100},
665 {0xa0, 0x06, 0x0189},
666 {0xa0, 0x03, 0x01c5},
667 {0xa0, 0x13, 0x01cb},
668 {0xa0, 0x20, 0x0087},
669 {0xa0, 0x21, 0x0088},
670 {0xa0, 0x08, 0x0250},
671 {0xa0, 0x08, 0x0301},
672 {0xa0, 0x00, 0x01ad},
673 {0xa0, 0x01, 0x01b1},
674 {0xa0, 0x02, 0x0180},
675 {0xa0, 0x60, 0x0116},
676 {0xa0, 0x40, 0x0117},
677 {0xa0, 0x4c, 0x0118},
678 {0xa0, 0x03, 0x0008}, /* clock ? */
679 {0xa0, 0x08, 0x01c6},
680 {0xa0, 0x0f, 0x01cb},
681 {0xa0, 0x13, 0x0120}, /* gamma 4 */
682 {0xa0, 0x38, 0x0121},
683 {0xa0, 0x59, 0x0122},
684 {0xa0, 0x79, 0x0123},
685 {0xa0, 0x92, 0x0124},
686 {0xa0, 0xa7, 0x0125},
687 {0xa0, 0xb9, 0x0126},
688 {0xa0, 0xc8, 0x0127},
689 {0xa0, 0xd4, 0x0128},
690 {0xa0, 0xdf, 0x0129},
691 {0xa0, 0xe7, 0x012a},
692 {0xa0, 0xee, 0x012b},
693 {0xa0, 0xf4, 0x012c},
694 {0xa0, 0xf9, 0x012d},
695 {0xa0, 0xfc, 0x012e},
696 {0xa0, 0xff, 0x012f},
697 {0xa0, 0x26, 0x0130},
698 {0xa0, 0x22, 0x0131},
699 {0xa0, 0x20, 0x0132},
700 {0xa0, 0x1c, 0x0133},
701 {0xa0, 0x16, 0x0134},
702 {0xa0, 0x13, 0x0135},
703 {0xa0, 0x10, 0x0136},
704 {0xa0, 0x0d, 0x0137},
705 {0xa0, 0x0b, 0x0138},
706 {0xa0, 0x09, 0x0139},
707 {0xa0, 0x07, 0x013a},
708 {0xa0, 0x06, 0x013b},
709 {0xa0, 0x05, 0x013c},
710 {0xa0, 0x04, 0x013d},
711 {0xa0, 0x03, 0x013e},
712 {0xa0, 0x02, 0x013f},
713 {0xa0, 0x58, 0x010a}, /* matrix */
714 {0xa0, 0xf4, 0x010b},
715 {0xa0, 0xf4, 0x010c},
716 {0xa0, 0xf4, 0x010d},
717 {0xa0, 0x58, 0x010e},
718 {0xa0, 0xf4, 0x010f},
719 {0xa0, 0xf4, 0x0110},
720 {0xa0, 0xf4, 0x0111},
721 {0xa0, 0x58, 0x0112},
722 {0xa0, 0x00, 0x0180},
723 {0xa0, 0x00, 0x0019},
724 {0xa0, 0x18, 0x0092},
725 {0xa0, 0x00, 0x0093},
726 {0xa0, 0x00, 0x0094},
727 {0xa0, 0x01, 0x0090},
728 {0xa0, 0x13, 0x0092},
729 {0xa0, 0x22, 0x0093},
730 {0xa0, 0x00, 0x0094},
731 {0xa0, 0x01, 0x0090},
732 {0xa0, 0x14, 0x0092},
733 {0xa0, 0x01, 0x0093},
734 {0xa0, 0x00, 0x0094},
735 {0xa0, 0x01, 0x0090},
736 {0xa0, 0x20, 0x0092},
737 {0xa0, 0x01, 0x0093},
738 {0xa0, 0x00, 0x0094},
739 {0xa0, 0x01, 0x0090},
740 {0xa0, 0x21, 0x0092},
741 {0xa0, 0x22, 0x0093},
742 {0xa0, 0x00, 0x0094},
743 {0xa0, 0x01, 0x0090},
744 {0xa0, 0x18, 0x0092},
745 {0xa0, 0x04, 0x0093},
746 {0xa0, 0x00, 0x0094},
747 {0xa0, 0x01, 0x0090},
748 {0xa0, 0x01, 0x00a3},
749 {0xa0, 0x22, 0x00a4},
750 {0xa0, 0x00, 0x0190},
751 {0xa0, 0x07, 0x0191},
752 {0xa0, 0xee, 0x0192},
753 {0xa0, 0x00, 0x0195},
754 {0xa0, 0x00, 0x0196},
755 {0xa0, 0x3a, 0x0197},
756 {0xa0, 0x10, 0x018c},
757 {0xa0, 0x20, 0x018f},
758 {0xa0, 0x0c, 0x01a9},
759 {0xa0, 0x28, 0x01aa},
760 {0xa0, 0x04, 0x001d},
761 {0xa0, 0x0f, 0x001e},
762 {0xa0, 0x19, 0x001f},
763 {0xa0, 0x1f, 0x0020},
764 {0xa0, 0x60, 0x011d},
765 {0xa0, 0x60, 0x011d},
766 {0xa0, 0x42, 0x0180},
767 {0xa0, 0x42, 0x0180},
768 {0xa0, 0x60, 0x0116},
769 {0xa0, 0x40, 0x0117},
770 {0xa0, 0x4c, 0x0118},
771 {0xa0, 0x04, 0x01a7},
772 {0xa0, 0x20, 0x0092},
773 {0xa0, 0x01, 0x0093},
774 {0xa0, 0x00, 0x0094},
775 {0xa0, 0x01, 0x0090},
776 {0xa0, 0x21, 0x0092},
777 {0xa0, 0x5c, 0x0093},
778 {0xa0, 0x00, 0x0094},
779 {0xa0, 0x01, 0x0090},
780 {0xa0, 0x18, 0x0092},
781 {0xa0, 0x00, 0x0093},
782 {0xa0, 0x00, 0x0094},
783 {0xa0, 0x01, 0x0090},
784 {0xa0, 0x13, 0x0092},
785 {0xa0, 0x5c, 0x0093},
786 {0xa0, 0x00, 0x0094},
787 {0xa0, 0x01, 0x0090},
788 {0xa0, 0x14, 0x0092},
789 {0xa0, 0x01, 0x0093},
790 {0xa0, 0x00, 0x0094},
791 {0xa0, 0x01, 0x0090},
792 {0xa0, 0x18, 0x0092},
793 {0xa0, 0x04, 0x0093},
794 {0xa0, 0x00, 0x0094},
795 {0xa0, 0x01, 0x0090},
796 {0xa0, 0x00, 0x01a7},
797 {0xa0, 0x04, 0x01a7},
798 {0xa0, 0x00, 0x01a7},
799 {0xa0, 0x04, 0x01a7},
800 {0xa0, 0x20, 0x0092},
801 {0xa0, 0x01, 0x0093},
802 {0xa0, 0x00, 0x0094},
803 {0xa0, 0x01, 0x0090},
804 {0xa0, 0x21, 0x0092},
805 {0xa0, 0x96, 0x0093},
806 {0xa0, 0x00, 0x0094},
807 {0xa0, 0x01, 0x0090},
808 {0xa0, 0x18, 0x0092},
809 {0xa0, 0x00, 0x0093},
810 {0xa0, 0x00, 0x0094},
811 {0xa0, 0x01, 0x0090},
812 {0xa0, 0x13, 0x0092},
813 {0xa0, 0x96, 0x0093},
814 {0xa0, 0x00, 0x0094},
815 {0xa0, 0x01, 0x0090},
816 {0xa0, 0x14, 0x0092},
817 {0xa0, 0x01, 0x0093},
818 {0xa0, 0x00, 0x0094},
819 {0xa0, 0x01, 0x0090},
820 {0xa0, 0x18, 0x0092},
821 {0xa0, 0x04, 0x0093},
822 {0xa0, 0x00, 0x0094},
823 {0xa0, 0x01, 0x0090},
824 {0xa0, 0x00, 0x01a7},
825 {0xa0, 0x04, 0x01a7},
826 {0xa0, 0x00, 0x01a7},
827 {0, 0, 0}
828};
829
830static struct usb_action cs2102K_InitialScale[] = {
831 {0xa0, 0x11, 0x0002},
832 {0xa0, 0x00, 0x0002},
833 {0xa0, 0x03, 0x0008},
834 {0xa0, 0x08, 0x0010},
835 {0xa0, 0x02, 0x0003},
836 {0xa0, 0x80, 0x0004},
837 {0xa0, 0x01, 0x0005},
838 {0xa0, 0xe0, 0x0006},
839 {0xa0, 0x01, 0x0001},
840 {0xa0, 0x03, 0x0012},
841 {0xa0, 0x01, 0x0012},
842 {0xa0, 0x00, 0x0098},
843 {0xa0, 0x00, 0x009a},
844 {0xa0, 0x00, 0x011a},
845 {0xa0, 0x00, 0x011c},
846 {0xa0, 0xe8, 0x009c},
847 {0xa0, 0x88, 0x009e},
848 {0xa0, 0x55, 0x008b},
849 {0xa0, 0x18, 0x0092},
850 {0xa0, 0x00, 0x0093},
851 {0xa0, 0x00, 0x0094},
852 {0xa0, 0x01, 0x0090},
853 {0xa0, 0x0a, 0x0092},
854 {0xa0, 0x02, 0x0093},
855 {0xa0, 0x00, 0x0094},
856 {0xa0, 0x01, 0x0090},
857 {0xa0, 0x0b, 0x0092},
858 {0xa0, 0x02, 0x0093},
859 {0xa0, 0x00, 0x0094},
860 {0xa0, 0x01, 0x0090},
861 {0xa0, 0x0c, 0x0092},
862 {0xa0, 0x7b, 0x0093},
863 {0xa0, 0x00, 0x0094},
864 {0xa0, 0x01, 0x0090},
865 {0xa0, 0x0d, 0x0092},
866 {0xa0, 0xa3, 0x0093},
867 {0xa0, 0x00, 0x0094},
868 {0xa0, 0x01, 0x0090},
869 {0xa0, 0x03, 0x0092},
870 {0xa0, 0xfb, 0x0093},
871 {0xa0, 0x00, 0x0094},
872 {0xa0, 0x01, 0x0090},
873 {0xa0, 0x05, 0x0092},
874 {0xa0, 0x00, 0x0093},
875 {0xa0, 0x00, 0x0094},
876 {0xa0, 0x01, 0x0090},
877 {0xa0, 0x06, 0x0092},
878 {0xa0, 0x03, 0x0093},
879 {0xa0, 0x00, 0x0094},
880 {0xa0, 0x01, 0x0090},
881 {0xa0, 0x09, 0x0092},
882 {0xa0, 0x08, 0x0093},
883 {0xa0, 0x00, 0x0094},
884 {0xa0, 0x01, 0x0090},
885 {0xa0, 0x0e, 0x0092},
886 {0xa0, 0x04, 0x0093},
887 {0xa0, 0x00, 0x0094},
888 {0xa0, 0x01, 0x0090},
889 {0xa0, 0x0f, 0x0092},
890 {0xa0, 0x18, 0x0093},
891 {0xa0, 0x00, 0x0094},
892 {0xa0, 0x01, 0x0090},
893 {0xa0, 0x10, 0x0092},
894 {0xa0, 0x18, 0x0093},
895 {0xa0, 0x00, 0x0094},
896 {0xa0, 0x01, 0x0090},
897 {0xa0, 0x11, 0x0092},
898 {0xa0, 0x18, 0x0093},
899 {0xa0, 0x00, 0x0094},
900 {0xa0, 0x01, 0x0090},
901 {0xa0, 0x12, 0x0092},
902 {0xa0, 0x18, 0x0093},
903 {0xa0, 0x00, 0x0094},
904 {0xa0, 0x01, 0x0090},
905 {0xa0, 0x15, 0x0092},
906 {0xa0, 0x00, 0x0093},
907 {0xa0, 0x00, 0x0094},
908 {0xa0, 0x01, 0x0090},
909 {0xa0, 0x16, 0x0092},
910 {0xa0, 0x0c, 0x0093},
911 {0xa0, 0x00, 0x0094},
912 {0xa0, 0x01, 0x0090},
913 {0xa0, 0x17, 0x0092},
914 {0xa0, 0x0c, 0x0093},
915 {0xa0, 0x00, 0x0094},
916 {0xa0, 0x01, 0x0090},
917 {0xa0, 0x18, 0x0092},
918 {0xa0, 0x04, 0x0093},
919 {0xa0, 0x00, 0x0094},
920 {0xa0, 0x01, 0x0090},
921 {0xa0, 0xf7, 0x0101},
922 {0xa0, 0x05, 0x0012},
923 {0xa0, 0x78, 0x018d},
924 {0xa0, 0x0d, 0x0100},
925 {0xa0, 0x06, 0x0189},
926 {0xa0, 0x03, 0x01c5},
927 {0xa0, 0x13, 0x01cb},
928 {0xa0, 0x20, 0x0087},
929 {0xa0, 0x21, 0x0088},
930 {0xa0, 0x08, 0x0250},
931 {0xa0, 0x08, 0x0301},
932 {0xa0, 0x00, 0x01ad},
933 {0xa0, 0x01, 0x01b1},
934 {0xa0, 0x02, 0x0180},
935 {0xa0, 0x60, 0x0116},
936 {0xa0, 0x40, 0x0117},
937 {0xa0, 0x4c, 0x0118},
938 {0xa0, 0x03, 0x0008}, /* clock ? */
939 {0xa0, 0x08, 0x01c6},
940 {0xa0, 0x0f, 0x01cb},
941 {0xa0, 0x13, 0x0120}, /* gamma 4 */
942 {0xa0, 0x38, 0x0121},
943 {0xa0, 0x59, 0x0122},
944 {0xa0, 0x79, 0x0123},
945 {0xa0, 0x92, 0x0124},
946 {0xa0, 0xa7, 0x0125},
947 {0xa0, 0xb9, 0x0126},
948 {0xa0, 0xc8, 0x0127},
949 {0xa0, 0xd4, 0x0128},
950 {0xa0, 0xdf, 0x0129},
951 {0xa0, 0xe7, 0x012a},
952 {0xa0, 0xee, 0x012b},
953 {0xa0, 0xf4, 0x012c},
954 {0xa0, 0xf9, 0x012d},
955 {0xa0, 0xfc, 0x012e},
956 {0xa0, 0xff, 0x012f},
957 {0xa0, 0x26, 0x0130},
958 {0xa0, 0x22, 0x0131},
959 {0xa0, 0x20, 0x0132},
960 {0xa0, 0x1c, 0x0133},
961 {0xa0, 0x16, 0x0134},
962 {0xa0, 0x13, 0x0135},
963 {0xa0, 0x10, 0x0136},
964 {0xa0, 0x0d, 0x0137},
965 {0xa0, 0x0b, 0x0138},
966 {0xa0, 0x09, 0x0139},
967 {0xa0, 0x07, 0x013a},
968 {0xa0, 0x06, 0x013b},
969 {0xa0, 0x05, 0x013c},
970 {0xa0, 0x04, 0x013d},
971 {0xa0, 0x03, 0x013e},
972 {0xa0, 0x02, 0x013f},
973 {0xa0, 0x58, 0x010a}, /* matrix */
974 {0xa0, 0xf4, 0x010b},
975 {0xa0, 0xf4, 0x010c},
976 {0xa0, 0xf4, 0x010d},
977 {0xa0, 0x58, 0x010e},
978 {0xa0, 0xf4, 0x010f},
979 {0xa0, 0xf4, 0x0110},
980 {0xa0, 0xf4, 0x0111},
981 {0xa0, 0x58, 0x0112},
982 {0xa0, 0x00, 0x0180},
983 {0xa0, 0x00, 0x0019},
984 {0xa0, 0x18, 0x0092},
985 {0xa0, 0x00, 0x0093},
986 {0xa0, 0x00, 0x0094},
987 {0xa0, 0x01, 0x0090},
988 {0xa0, 0x13, 0x0092},
989 {0xa0, 0x22, 0x0093},
990 {0xa0, 0x00, 0x0094},
991 {0xa0, 0x01, 0x0090},
992 {0xa0, 0x14, 0x0092},
993 {0xa0, 0x01, 0x0093},
994 {0xa0, 0x00, 0x0094},
995 {0xa0, 0x01, 0x0090},
996 {0xa0, 0x20, 0x0092},
997 {0xa0, 0x01, 0x0093},
998 {0xa0, 0x00, 0x0094},
999 {0xa0, 0x01, 0x0090},
1000 {0xa0, 0x21, 0x0092},
1001 {0xa0, 0x22, 0x0093},
1002 {0xa0, 0x00, 0x0094},
1003 {0xa0, 0x01, 0x0090},
1004 {0xa0, 0x18, 0x0092},
1005 {0xa0, 0x04, 0x0093},
1006 {0xa0, 0x00, 0x0094},
1007 {0xa0, 0x01, 0x0090},
1008 {0xa0, 0x01, 0x00a3},
1009 {0xa0, 0x22, 0x00a4},
1010 {0xa0, 0x00, 0x0190},
1011 {0xa0, 0x07, 0x0191},
1012 {0xa0, 0xee, 0x0192},
1013 {0xa0, 0x00, 0x0195},
1014 {0xa0, 0x00, 0x0196},
1015 {0xa0, 0x3a, 0x0197},
1016 {0xa0, 0x10, 0x018c},
1017 {0xa0, 0x20, 0x018f},
1018 {0xa0, 0x0c, 0x01a9},
1019 {0xa0, 0x28, 0x01aa},
1020 {0xa0, 0x04, 0x001d},
1021 {0xa0, 0x0f, 0x001e},
1022 {0xa0, 0x19, 0x001f},
1023 {0xa0, 0x1f, 0x0020},
1024 {0xa0, 0x60, 0x011d},
1025 {0xa0, 0x60, 0x011d},
1026 {0xa0, 0x42, 0x0180},
1027 {0xa0, 0x42, 0x0180},
1028 {0xa0, 0x60, 0x0116},
1029 {0xa0, 0x40, 0x0117},
1030 {0xa0, 0x4c, 0x0118},
1031 {0xa0, 0x01, 0x0000},
1032 {0xa0, 0x01, 0x0000},
1033 {0xa0, 0x00, 0x0002},
1034 {0xa0, 0x03, 0x0008},
1035 {0xa0, 0x08, 0x0010},
1036 {0xa0, 0x02, 0x0003},
1037 {0xa0, 0x80, 0x0004},
1038 {0xa0, 0x01, 0x0005},
1039 {0xa0, 0xe0, 0x0006},
1040 {0xa0, 0x01, 0x0001},
1041 {0xa0, 0x03, 0x0012},
1042 {0xa0, 0x01, 0x0012},
1043 {0xa0, 0x00, 0x0098},
1044 {0xa0, 0x00, 0x009a},
1045 {0xa0, 0x00, 0x011a},
1046 {0xa0, 0x00, 0x011c},
1047 {0xa0, 0xe8, 0x009c},
1048 {0xa0, 0x88, 0x009e},
1049 {0xa0, 0x55, 0x008b},
1050 {0xa0, 0x18, 0x0092},
1051 {0xa0, 0x00, 0x0093},
1052 {0xa0, 0x00, 0x0094},
1053 {0xa0, 0x01, 0x0090},
1054 {0xa0, 0x0A, 0x0092},
1055 {0xa0, 0x02, 0x0093},
1056 {0xa0, 0x00, 0x0094},
1057 {0xa0, 0x01, 0x0090},
1058 {0xa0, 0x0B, 0x0092},
1059 {0xa0, 0x02, 0x0093},
1060 {0xa0, 0x00, 0x0094},
1061 {0xa0, 0x01, 0x0090},
1062 {0xa0, 0x0C, 0x0092},
1063 {0xa0, 0x7b, 0x0093},
1064 {0xa0, 0x00, 0x0094},
1065 {0xa0, 0x01, 0x0090},
1066 {0xa0, 0x0D, 0x0092},
1067 {0xa0, 0xA3, 0x0093},
1068 {0xa0, 0x00, 0x0094},
1069 {0xa0, 0x01, 0x0090},
1070 {0xa0, 0x03, 0x0092},
1071 {0xa0, 0xfb, 0x0093},
1072 {0xa0, 0x00, 0x0094},
1073 {0xa0, 0x01, 0x0090},
1074 {0xa0, 0x05, 0x0092},
1075 {0xa0, 0x00, 0x0093},
1076 {0xa0, 0x00, 0x0094},
1077 {0xa0, 0x01, 0x0090},
1078 {0xa0, 0x06, 0x0092},
1079 {0xa0, 0x03, 0x0093},
1080 {0xa0, 0x00, 0x0094},
1081 {0xa0, 0x01, 0x0090},
1082 {0xa0, 0x09, 0x0092},
1083 {0xa0, 0x08, 0x0093},
1084 {0xa0, 0x00, 0x0094},
1085 {0xa0, 0x01, 0x0090},
1086 {0xa0, 0x0E, 0x0092},
1087 {0xa0, 0x04, 0x0093},
1088 {0xa0, 0x00, 0x0094},
1089 {0xa0, 0x01, 0x0090},
1090 {0xa0, 0x0f, 0x0092},
1091 {0xa0, 0x18, 0x0093},
1092 {0xa0, 0x00, 0x0094},
1093 {0xa0, 0x01, 0x0090},
1094 {0xa0, 0x10, 0x0092},
1095 {0xa0, 0x18, 0x0093},
1096 {0xa0, 0x00, 0x0094},
1097 {0xa0, 0x01, 0x0090},
1098 {0xa0, 0x11, 0x0092},
1099 {0xa0, 0x18, 0x0093},
1100 {0xa0, 0x00, 0x0094},
1101 {0xa0, 0x01, 0x0090},
1102 {0xa0, 0x12, 0x0092},
1103 {0xa0, 0x18, 0x0093},
1104 {0xa0, 0x00, 0x0094},
1105 {0xa0, 0x01, 0x0090},
1106 {0xa0, 0x15, 0x0092},
1107 {0xa0, 0x00, 0x0093},
1108 {0xa0, 0x00, 0x0094},
1109 {0xa0, 0x01, 0x0090},
1110 {0xa0, 0x16, 0x0092},
1111 {0xa0, 0x0c, 0x0093},
1112 {0xa0, 0x00, 0x0094},
1113 {0xa0, 0x01, 0x0090},
1114 {0xa0, 0x17, 0x0092},
1115 {0xa0, 0x0C, 0x0093},
1116 {0xa0, 0x00, 0x0094},
1117 {0xa0, 0x01, 0x0090},
1118 {0xa0, 0x18, 0x0092},
1119 {0xa0, 0x04, 0x0093},
1120 {0xa0, 0x00, 0x0094},
1121 {0xa0, 0x01, 0x0090},
1122 {0xa0, 0xf7, 0x0101},
1123 {0xa0, 0x05, 0x0012},
1124 {0xa0, 0x78, 0x018d},
1125 {0xa0, 0x0d, 0x0100},
1126 {0xa0, 0x06, 0x0189},
1127 {0xa0, 0x03, 0x01c5},
1128 {0xa0, 0x13, 0x01cb},
1129 {0xa0, 0x20, 0x0087},
1130 {0xa0, 0x21, 0x0088},
1131 {0xa0, 0x08, 0x0250},
1132 {0xa0, 0x08, 0x0301},
1133 {0xa0, 0x00, 0x01ad},
1134 {0xa0, 0x01, 0x01b1},
1135 {0xa0, 0x02, 0x0180},
1136 {0xa0, 0x60, 0x0116},
1137 {0xa0, 0x40, 0x0117},
1138 {0xa0, 0x4c, 0x0118},
1139 {0xa0, 0x03, 0x0008}, /* clock ? */
1140 {0xa0, 0x08, 0x01c6},
1141 {0xa0, 0x0f, 0x01cb},
1142 {0xa0, 0x13, 0x0120}, /* gamma 4 */
1143 {0xa0, 0x38, 0x0121},
1144 {0xa0, 0x59, 0x0122},
1145 {0xa0, 0x79, 0x0123},
1146 {0xa0, 0x92, 0x0124},
1147 {0xa0, 0xa7, 0x0125},
1148 {0xa0, 0xb9, 0x0126},
1149 {0xa0, 0xc8, 0x0127},
1150 {0xa0, 0xd4, 0x0128},
1151 {0xa0, 0xdf, 0x0129},
1152 {0xa0, 0xe7, 0x012a},
1153 {0xa0, 0xee, 0x012b},
1154 {0xa0, 0xf4, 0x012c},
1155 {0xa0, 0xf9, 0x012d},
1156 {0xa0, 0xfc, 0x012e},
1157 {0xa0, 0xff, 0x012f},
1158 {0xa0, 0x26, 0x0130},
1159 {0xa0, 0x22, 0x0131},
1160 {0xa0, 0x20, 0x0132},
1161 {0xa0, 0x1c, 0x0133},
1162 {0xa0, 0x16, 0x0134},
1163 {0xa0, 0x13, 0x0135},
1164 {0xa0, 0x10, 0x0136},
1165 {0xa0, 0x0d, 0x0137},
1166 {0xa0, 0x0b, 0x0138},
1167 {0xa0, 0x09, 0x0139},
1168 {0xa0, 0x07, 0x013a},
1169 {0xa0, 0x06, 0x013b},
1170 {0xa0, 0x05, 0x013c},
1171 {0xa0, 0x04, 0x013d},
1172 {0xa0, 0x03, 0x013e},
1173 {0xa0, 0x02, 0x013f},
1174 {0xa0, 0x58, 0x010a}, /* matrix */
1175 {0xa0, 0xf4, 0x010b},
1176 {0xa0, 0xf4, 0x010c},
1177 {0xa0, 0xf4, 0x010d},
1178 {0xa0, 0x58, 0x010e},
1179 {0xa0, 0xf4, 0x010f},
1180 {0xa0, 0xf4, 0x0110},
1181 {0xa0, 0xf4, 0x0111},
1182 {0xa0, 0x58, 0x0112},
1183 {0xa0, 0x00, 0x0180},
1184 {0xa0, 0x00, 0x0019},
1185 {0xa0, 0x18, 0x0092},
1186 {0xa0, 0x00, 0x0093},
1187 {0xa0, 0x00, 0x0094},
1188 {0xa0, 0x01, 0x0090},
1189 {0xa0, 0x13, 0x0092},
1190 {0xa0, 0x22, 0x0093},
1191 {0xa0, 0x00, 0x0094},
1192 {0xa0, 0x01, 0x0090},
1193 {0xa0, 0x14, 0x0092},
1194 {0xa0, 0x01, 0x0093},
1195 {0xa0, 0x00, 0x0094},
1196 {0xa0, 0x01, 0x0090},
1197 {0xa0, 0x20, 0x0092},
1198 {0xa0, 0x01, 0x0093},
1199 {0xa0, 0x00, 0x0094},
1200 {0xa0, 0x01, 0x0090},
1201 {0xa0, 0x21, 0x0092},
1202 {0xa0, 0x22, 0x0093},
1203 {0xa0, 0x00, 0x0094},
1204 {0xa0, 0x01, 0x0090},
1205 {0xa0, 0x18, 0x0092},
1206 {0xa0, 0x04, 0x0093},
1207 {0xa0, 0x00, 0x0094},
1208 {0xa0, 0x01, 0x0090},
1209 {0xa0, 0x01, 0x00a3},
1210 {0xa0, 0x22, 0x00a4},
1211 {0xa0, 0x00, 0x0190},
1212 {0xa0, 0x07, 0x0191},
1213 {0xa0, 0xee, 0x0192},
1214 {0xa0, 0x00, 0x0195},
1215 {0xa0, 0x00, 0x0196},
1216 {0xa0, 0x3a, 0x0197},
1217 {0xa0, 0x10, 0x018c},
1218 {0xa0, 0x20, 0x018f},
1219 {0xa0, 0x0c, 0x01a9},
1220 {0xa0, 0x28, 0x01aa},
1221 {0xa0, 0x04, 0x001d},
1222 {0xa0, 0x0f, 0x001e},
1223 {0xa0, 0x19, 0x001f},
1224 {0xa0, 0x1f, 0x0020},
1225 {0xa0, 0x60, 0x011d},
1226 {0xa0, 0x60, 0x011d},
1227 {0xa0, 0x42, 0x0180},
1228 {0xa0, 0x42, 0x0180},
1229 {0xa0, 0x60, 0x0116},
1230 {0xa0, 0x40, 0x0117},
1231 {0xa0, 0x4c, 0x0118},
1232 {0xa0, 0x04, 0x01a7},
1233 {0xa0, 0x20, 0x0092},
1234 {0xa0, 0x01, 0x0093},
1235 {0xa0, 0x00, 0x0094},
1236 {0xa0, 0x01, 0x0090},
1237 {0xa0, 0x21, 0x0092},
1238 {0xa0, 0x5c, 0x0093},
1239 {0xa0, 0x00, 0x0094},
1240 {0xa0, 0x01, 0x0090},
1241 {0xa0, 0x18, 0x0092},
1242 {0xa0, 0x00, 0x0093},
1243 {0xa0, 0x00, 0x0094},
1244 {0xa0, 0x01, 0x0090},
1245 {0xa0, 0x13, 0x0092},
1246 {0xa0, 0x5c, 0x0093},
1247 {0xa0, 0x00, 0x0094},
1248 {0xa0, 0x01, 0x0090},
1249 {0xa0, 0x14, 0x0092},
1250 {0xa0, 0x01, 0x0093},
1251 {0xa0, 0x00, 0x0094},
1252 {0xa0, 0x01, 0x0090},
1253 {0xa0, 0x18, 0x0092},
1254 {0xa0, 0x04, 0x0093},
1255 {0xa0, 0x00, 0x0094},
1256 {0xa0, 0x01, 0x0090},
1257 {0xa0, 0x00, 0x01a7},
1258 {0xa0, 0x04, 0x01a7},
1259 {0xa0, 0x00, 0x01a7},
1260 {0xa0, 0x04, 0x01a7},
1261 {0xa0, 0x20, 0x0092},
1262 {0xa0, 0x01, 0x0093},
1263 {0xa0, 0x00, 0x0094},
1264 {0xa0, 0x01, 0x0090},
1265 {0xa0, 0x21, 0x0092},
1266 {0xa0, 0x96, 0x0093},
1267 {0xa0, 0x00, 0x0094},
1268 {0xa0, 0x01, 0x0090},
1269 {0xa0, 0x18, 0x0092},
1270 {0xa0, 0x00, 0x0093},
1271 {0xa0, 0x00, 0x0094},
1272 {0xa0, 0x01, 0x0090},
1273 {0xa0, 0x13, 0x0092},
1274 {0xa0, 0x96, 0x0093},
1275 {0xa0, 0x00, 0x0094},
1276 {0xa0, 0x01, 0x0090},
1277 {0xa0, 0x14, 0x0092},
1278 {0xa0, 0x01, 0x0093},
1279 {0xa0, 0x00, 0x0094},
1280 {0xa0, 0x01, 0x0090},
1281 {0xa0, 0x18, 0x0092},
1282 {0xa0, 0x04, 0x0093},
1283 {0xa0, 0x00, 0x0094},
1284 {0xa0, 0x01, 0x0090},
1285 {0xa0, 0x00, 0x01a7},
1286 {0xa0, 0x04, 0x01a7},
1287 {0xa0, 0x00, 0x01a7},
1288 {0xa0, 0x04, 0x01a7},
1289 {0xa0, 0x00, 0x01a7},
1290 {0xa0, 0x04, 0x01a7},
1291 {0xa0, 0x20, 0x0092},
1292 {0xa0, 0x01, 0x0093},
1293 {0xa0, 0x00, 0x0094},
1294 {0xa0, 0x01, 0x0090},
1295 {0xa0, 0x21, 0x0092},
1296 {0xa0, 0xd0, 0x0093},
1297 {0xa0, 0x00, 0x0094},
1298 {0xa0, 0x01, 0x0090},
1299 {0xa0, 0x18, 0x0092},
1300 {0xa0, 0x00, 0x0093},
1301 {0xa0, 0x00, 0x0094},
1302 {0xa0, 0x01, 0x0090},
1303 {0xa0, 0x13, 0x0092},
1304 {0xa0, 0xd0, 0x0093},
1305 {0xa0, 0x00, 0x0094},
1306 {0xa0, 0x01, 0x0090},
1307 {0xa0, 0x14, 0x0092},
1308 {0xa0, 0x01, 0x0093},
1309 {0xa0, 0x00, 0x0094},
1310 {0xa0, 0x01, 0x0090},
1311 {0xa0, 0x18, 0x0092},
1312 {0xa0, 0x04, 0x0093},
1313 {0xa0, 0x00, 0x0094},
1314 {0xa0, 0x01, 0x0090},
1315 {0xa0, 0x00, 0x01a7},
1316 {0xa0, 0x02, 0x0008},
1317 {0xa0, 0x04, 0x01a7},
1318 {0xa0, 0x00, 0x01a7},
1319 {0xa0, 0x04, 0x01a7},
1320 {0xa0, 0x20, 0x0092},
1321 {0xa0, 0x02, 0x0093},
1322 {0xa0, 0x00, 0x0094},
1323 {0xa0, 0x01, 0x0090},
1324 {0xa0, 0x21, 0x0092},
1325 {0xa0, 0x0a, 0x0093},
1326 {0xa0, 0x00, 0x0094},
1327 {0xa0, 0x01, 0x0090},
1328 {0xa0, 0x18, 0x0092},
1329 {0xa0, 0x00, 0x0093},
1330 {0xa0, 0x00, 0x0094},
1331 {0xa0, 0x01, 0x0090},
1332 {0xa0, 0x13, 0x0092},
1333 {0xa0, 0x0a, 0x0093},
1334 {0xa0, 0x00, 0x0094},
1335 {0xa0, 0x01, 0x0090},
1336 {0xa0, 0x14, 0x0092},
1337 {0xa0, 0x02, 0x0093},
1338 {0xa0, 0x00, 0x0094},
1339 {0xa0, 0x01, 0x0090},
1340 {0xa0, 0x18, 0x0092},
1341 {0xa0, 0x04, 0x0093},
1342 {0xa0, 0x00, 0x0094},
1343 {0xa0, 0x01, 0x0090},
1344 {0xa0, 0x00, 0x01a7},
1345 {0xa0, 0x04, 0x01a7},
1346 {0xa0, 0x00, 0x01a7},
1347 {0xa0, 0x04, 0x01a7},
1348 {0xa0, 0x20, 0x0092},
1349 {0xa0, 0x02, 0x0093},
1350 {0xa0, 0x00, 0x0094},
1351 {0xa0, 0x01, 0x0090},
1352 {0xa0, 0x21, 0x0092},
1353 {0xa0, 0x44, 0x0093},
1354 {0xa0, 0x00, 0x0094},
1355 {0xa0, 0x01, 0x0090},
1356 {0xa0, 0x18, 0x0092},
1357 {0xa0, 0x00, 0x0093},
1358 {0xa0, 0x00, 0x0094},
1359 {0xa0, 0x01, 0x0090},
1360 {0xa0, 0x13, 0x0092},
1361 {0xa0, 0x44, 0x0093},
1362 {0xa0, 0x00, 0x0094},
1363 {0xa0, 0x01, 0x0090},
1364 {0xa0, 0x14, 0x0092},
1365 {0xa0, 0x02, 0x0093},
1366 {0xa0, 0x00, 0x0094},
1367 {0xa0, 0x01, 0x0090},
1368 {0xa0, 0x18, 0x0092},
1369 {0xa0, 0x04, 0x0093},
1370 {0xa0, 0x00, 0x0094},
1371 {0xa0, 0x01, 0x0090},
1372 {0xa0, 0x00, 0x01a7},
1373 {0xa0, 0x04, 0x01a7},
1374 {0xa0, 0x00, 0x01a7},
1375 {0xa0, 0x04, 0x01a7},
1376 {0xa0, 0x20, 0x0092},
1377 {0xa0, 0x02, 0x0093},
1378 {0xa0, 0x00, 0x0094},
1379 {0xa0, 0x01, 0x0090},
1380 {0xa0, 0x21, 0x0092},
1381 {0xa0, 0x7e, 0x0093},
1382 {0xa0, 0x00, 0x0094},
1383 {0xa0, 0x01, 0x0090},
1384 {0xa0, 0x18, 0x0092},
1385 {0xa0, 0x00, 0x0093},
1386 {0xa0, 0x00, 0x0094},
1387 {0xa0, 0x01, 0x0090},
1388 {0xa0, 0x13, 0x0092},
1389 {0xa0, 0x7e, 0x0093},
1390 {0xa0, 0x00, 0x0094},
1391 {0xa0, 0x01, 0x0090},
1392 {0xa0, 0x14, 0x0092},
1393 {0xa0, 0x02, 0x0093},
1394 {0xa0, 0x00, 0x0094},
1395 {0xa0, 0x01, 0x0090},
1396 {0xa0, 0x18, 0x0092},
1397 {0xa0, 0x04, 0x0093},
1398 {0xa0, 0x00, 0x0094},
1399 {0xa0, 0x01, 0x0090},
1400 {0xa0, 0x00, 0x01a7},
1401 {0xa0, 0x04, 0x01a7},
1402 {0xa0, 0x00, 0x01a7},
1403 {0xa0, 0x04, 0x01a7},
1404 {0, 0, 0}
1405};
1406
1407static struct usb_action gc0305_Initial[] = { /* 640x480 */
1408 {0xa0, 0x01, 0x0000}, /* 00,00,01,cc */
1409 {0xa0, 0x03, 0x0008}, /* 00,08,03,cc */
1410 {0xa0, 0x01, 0x0010}, /* 00,10,01,cc */
1411 {0xa0, 0x04, 0x0002}, /* 00,02,04,cc */
1412 {0xa0, 0x02, 0x0003}, /* 00,03,02,cc */
1413 {0xa0, 0x80, 0x0004}, /* 00,04,80,cc */
1414 {0xa0, 0x01, 0x0005}, /* 00,05,01,cc */
1415 {0xa0, 0xe0, 0x0006}, /* 00,06,e0,cc */
1416 {0xa0, 0x01, 0x0001}, /* 00,01,01,cc */
1417 {0xa0, 0x03, 0x0012}, /* 00,12,03,cc */
1418 {0xa0, 0x01, 0x0012}, /* 00,12,01,cc */
1419 {0xa0, 0x00, 0x0098}, /* 00,98,00,cc */
1420 {0xa0, 0x00, 0x009a}, /* 00,9a,00,cc */
1421 {0xa0, 0x00, 0x011a}, /* 01,1a,00,cc */
1422 {0xa0, 0x00, 0x011c}, /* 01,1c,00,cc */
1423 {0xa0, 0xe6, 0x009c}, /* 00,9c,e6,cc */
1424 {0xa0, 0x86, 0x009e}, /* 00,9e,86,cc */
1425 {0xa0, 0x98, 0x008b}, /* 00,8b,98,cc */
1426 {0xaa, 0x13, 0x0002}, /* 00,13,02,aa */
1427 {0xaa, 0x15, 0x0003}, /* 00,15,03,aa */
1428 {0xaa, 0x01, 0x0000}, /* 00,01,00,aa */
1429 {0xaa, 0x02, 0x0000}, /* 00,02,00,aa */
1430 {0xaa, 0x1a, 0x0000}, /* 00,1a,00,aa */
1431 {0xaa, 0x1c, 0x0017}, /* 00,1c,17,aa */
1432 {0xaa, 0x1d, 0x0080}, /* 00,1d,80,aa */
1433 {0xaa, 0x1f, 0x0008}, /* 00,1f,08,aa */
1434 {0xaa, 0x21, 0x0012}, /* 00,21,12,aa */
1435 {0xa0, 0x82, 0x0086}, /* 00,86,82,cc */
1436 {0xa0, 0x83, 0x0087}, /* 00,87,83,cc */
1437 {0xa0, 0x84, 0x0088}, /* 00,88,84,cc */
1438 {0xaa, 0x05, 0x0000}, /* 00,05,00,aa */
1439 {0xaa, 0x0a, 0x0000}, /* 00,0a,00,aa */
1440 {0xaa, 0x0b, 0x00b0}, /* 00,0b,b0,aa */
1441 {0xaa, 0x0c, 0x0000}, /* 00,0c,00,aa */
1442 {0xaa, 0x0d, 0x00b0}, /* 00,0d,b0,aa */
1443 {0xaa, 0x0e, 0x0000}, /* 00,0e,00,aa */
1444 {0xaa, 0x0f, 0x00b0}, /* 00,0f,b0,aa */
1445 {0xaa, 0x10, 0x0000}, /* 00,10,00,aa */
1446 {0xaa, 0x11, 0x00b0}, /* 00,11,b0,aa */
1447 {0xaa, 0x16, 0x0001}, /* 00,16,01,aa */
1448 {0xaa, 0x17, 0x00e6}, /* 00,17,e6,aa */
1449 {0xaa, 0x18, 0x0002}, /* 00,18,02,aa */
1450 {0xaa, 0x19, 0x0086}, /* 00,19,86,aa */
1451 {0xaa, 0x20, 0x0000}, /* 00,20,00,aa */
1452 {0xaa, 0x1b, 0x0020}, /* 00,1b,20,aa */
1453 {0xa0, 0xb7, 0x0101}, /* 01,01,b7,cc */
1454 {0xa0, 0x05, 0x0012}, /* 00,12,05,cc */
1455 {0xa0, 0x0d, 0x0100}, /* 01,00,0d,cc */
1456 {0xa0, 0x76, 0x0189}, /* 01,89,76,cc */
1457 {0xa0, 0x09, 0x01ad}, /* 01,ad,09,cc */
1458 {0xa0, 0x03, 0x01c5}, /* 01,c5,03,cc */
1459 {0xa0, 0x13, 0x01cb}, /* 01,cb,13,cc */
1460 {0xa0, 0x08, 0x0250}, /* 02,50,08,cc */
1461 {0xa0, 0x08, 0x0301}, /* 03,01,08,cc */
1462 {0xa0, 0x60, 0x01a8}, /* 01,a8,60,cc */
1463 {0xa0, 0x85, 0x018d}, /* 01,8d,85,cc */
1464 {0xa0, 0x00, 0x011e}, /* 01,1e,00,cc */
1465 {0xa0, 0x52, 0x0116}, /* 01,16,52,cc */
1466 {0xa0, 0x40, 0x0117}, /* 01,17,40,cc */
1467 {0xa0, 0x52, 0x0118}, /* 01,18,52,cc */
1468 {0xa0, 0x03, 0x0113}, /* 01,13,03,cc */
1469 {0,0,0}
1470};
1471static struct usb_action gc0305_InitialScale[] = { /* 320x240 */
1472 {0xa0, 0x01, 0x0000}, /* 00,00,01,cc */
1473 {0xa0, 0x03, 0x0008}, /* 00,08,03,cc */
1474 {0xa0, 0x01, 0x0010}, /* 00,10,01,cc */
1475 {0xa0, 0x10, 0x0002}, /* 00,02,10,cc */
1476 {0xa0, 0x02, 0x0003}, /* 00,03,02,cc */
1477 {0xa0, 0x80, 0x0004}, /* 00,04,80,cc */
1478 {0xa0, 0x01, 0x0005}, /* 00,05,01,cc */
1479 {0xa0, 0xe0, 0x0006}, /* 00,06,e0,cc */
1480 {0xa0, 0x01, 0x0001}, /* 00,01,01,cc */
1481 {0xa0, 0x03, 0x0012}, /* 00,12,03,cc */
1482 {0xa0, 0x01, 0x0012}, /* 00,12,01,cc */
1483 {0xa0, 0x00, 0x0098}, /* 00,98,00,cc */
1484 {0xa0, 0x00, 0x009a}, /* 00,9a,00,cc */
1485 {0xa0, 0x00, 0x011a}, /* 01,1a,00,cc */
1486 {0xa0, 0x00, 0x011c}, /* 01,1c,00,cc */
1487 {0xa0, 0xe8, 0x009c}, /* 00,9c,e8,cc */
1488 {0xa0, 0x88, 0x009e}, /* 00,9e,88,cc */
1489 {0xa0, 0x98, 0x008b}, /* 00,8b,98,cc */
1490 {0xaa, 0x13, 0x0000}, /* 00,13,00,aa */
1491 {0xaa, 0x15, 0x0001}, /* 00,15,01,aa */
1492 {0xaa, 0x01, 0x0000}, /* 00,01,00,aa */
1493 {0xaa, 0x02, 0x0000}, /* 00,02,00,aa */
1494 {0xaa, 0x1a, 0x0000}, /* 00,1a,00,aa */
1495 {0xaa, 0x1c, 0x0017}, /* 00,1c,17,aa */
1496 {0xaa, 0x1d, 0x0080}, /* 00,1d,80,aa */
1497 {0xaa, 0x1f, 0x0008}, /* 00,1f,08,aa */
1498 {0xaa, 0x21, 0x0012}, /* 00,21,12,aa */
1499 {0xa0, 0x82, 0x0086}, /* 00,86,82,cc */
1500 {0xa0, 0x83, 0x0087}, /* 00,87,83,cc */
1501 {0xa0, 0x84, 0x0088}, /* 00,88,84,cc */
1502 {0xaa, 0x05, 0x0000}, /* 00,05,00,aa */
1503 {0xaa, 0x0a, 0x0000}, /* 00,0a,00,aa */
1504 {0xaa, 0x0b, 0x00b0}, /* 00,0b,b0,aa */
1505 {0xaa, 0x0c, 0x0000}, /* 00,0c,00,aa */
1506 {0xaa, 0x0d, 0x00b0}, /* 00,0d,b0,aa */
1507 {0xaa, 0x0e, 0x0000}, /* 00,0e,00,aa */
1508 {0xaa, 0x0f, 0x00b0}, /* 00,0f,b0,aa */
1509 {0xaa, 0x10, 0x0000}, /* 00,10,00,aa */
1510 {0xaa, 0x11, 0x00b0}, /* 00,11,b0,aa */
1511 {0xaa, 0x16, 0x0001}, /* 00,16,01,aa */
1512 {0xaa, 0x17, 0x00e8}, /* 00,17,e8,aa */
1513 {0xaa, 0x18, 0x0002}, /* 00,18,02,aa */
1514 {0xaa, 0x19, 0x0088}, /* 00,19,88,aa */
1515 {0xaa, 0x20, 0x0000}, /* 00,20,00,aa */
1516 {0xaa, 0x1b, 0x0020}, /* 00,1b,20,aa */
1517 {0xa0, 0xb7, 0x0101}, /* 01,01,b7,cc */
1518 {0xa0, 0x05, 0x0012}, /* 00,12,05,cc */
1519 {0xa0, 0x0d, 0x0100}, /* 01,00,0d,cc */
1520 {0xa0, 0x76, 0x0189}, /* 01,89,76,cc */
1521 {0xa0, 0x09, 0x01ad}, /* 01,ad,09,cc */
1522 {0xa0, 0x03, 0x01c5}, /* 01,c5,03,cc */
1523 {0xa0, 0x13, 0x01cb}, /* 01,cb,13,cc */
1524 {0xa0, 0x08, 0x0250}, /* 02,50,08,cc */
1525 {0xa0, 0x08, 0x0301}, /* 03,01,08,cc */
1526 {0xa0, 0x60, 0x01a8}, /* 01,a8,60,cc */
1527 {0xa0, 0x00, 0x011e}, /* 01,1e,00,cc */
1528 {0xa0, 0x52, 0x0116}, /* 01,16,52,cc */
1529 {0xa0, 0x40, 0x0117}, /* 01,17,40,cc */
1530 {0xa0, 0x52, 0x0118}, /* 01,18,52,cc */
1531 {0xa0, 0x03, 0x0113}, /* 01,13,03,cc */
1532 {0,0,0}
1533};
1534static struct usb_action gc0305_50HZ[] = {
1535 {0xaa, 0x82, 0x0000}, /* 00,82,00,aa */
1536 {0xaa, 0x83, 0x0002}, /* 00,83,02,aa */
1537 {0xaa, 0x84, 0x0038}, /* 00,84,38,aa */ /* win: 00,84,ec */
1538 {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
1539 {0xa0, 0x0b, 0x0191}, /* 01,91,0b,cc */
1540 {0xa0, 0x18, 0x0192}, /* 01,92,18,cc */ /* win: 01,92,10 */
1541 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */
1542 {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */
1543 {0xa0, 0x8e, 0x0197}, /* 01,97,8e,cc */ /* win: 01,97,ec */
1544 {0xa0, 0x0e, 0x018c}, /* 01,8c,0e,cc */
1545 {0xa0, 0x15, 0x018f}, /* 01,8f,15,cc */
1546 {0xa0, 0x10, 0x01a9}, /* 01,a9,10,cc */
1547 {0xa0, 0x24, 0x01aa}, /* 01,aa,24,cc */
1548 {0xa0, 0x62, 0x001d}, /* 00,1d,62,cc */
1549 {0xa0, 0x90, 0x001e}, /* 00,1e,90,cc */
1550 {0xa0, 0xc8, 0x001f}, /* 00,1f,c8,cc */
1551 {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc */
1552 {0xa0, 0x60, 0x011d}, /* 01,1d,60,cc */
1553 {0xa0, 0x42, 0x0180}, /* 01,80,42,cc */
1554/* {0xa0, 0x85, 0x018d}, * 01,8d,85,cc * * if 640x480 */
1555 {0,0,0}
1556};
1557static struct usb_action gc0305_60HZ[] = {
1558 {0xaa, 0x82, 0x0000}, /* 00,82,00,aa */
1559 {0xaa, 0x83, 0x0000}, /* 00,83,00,aa */
1560 {0xaa, 0x84, 0x00ec}, /* 00,84,ec,aa */
1561 {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
1562 {0xa0, 0x0b, 0x0191}, /* 01,91,0b,cc */
1563 {0xa0, 0x10, 0x0192}, /* 01,92,10,cc */
1564 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */
1565 {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */
1566 {0xa0, 0xec, 0x0197}, /* 01,97,ec,cc */
1567 {0xa0, 0x0e, 0x018c}, /* 01,8c,0e,cc */
1568 {0xa0, 0x15, 0x018f}, /* 01,8f,15,cc */
1569 {0xa0, 0x10, 0x01a9}, /* 01,a9,10,cc */
1570 {0xa0, 0x24, 0x01aa}, /* 01,aa,24,cc */
1571 {0xa0, 0x62, 0x001d}, /* 00,1d,62,cc */
1572 {0xa0, 0x90, 0x001e}, /* 00,1e,90,cc */
1573 {0xa0, 0xc8, 0x001f}, /* 00,1f,c8,cc */
1574 {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc */
1575 {0xa0, 0x60, 0x011d}, /* 01,1d,60,cc */
1576 {0xa0, 0x42, 0x0180}, /* 01,80,42,cc */
1577 {0xa0, 0x80, 0x018d}, /* 01,8d,80,cc */
1578 {0,0,0}
1579};
1580
1581static struct usb_action gc0305_NoFliker[] = {
1582 {0xa0, 0x0c, 0x0100}, /* 01,00,0c,cc */
1583 {0xaa, 0x82, 0x0000}, /* 00,82,00,aa */
1584 {0xaa, 0x83, 0x0000}, /* 00,83,00,aa */
1585 {0xaa, 0x84, 0x0020}, /* 00,84,20,aa */
1586 {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
1587 {0xa0, 0x00, 0x0191}, /* 01,91,00,cc */
1588 {0xa0, 0x48, 0x0192}, /* 01,92,48,cc */
1589 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */
1590 {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */
1591 {0xa0, 0x10, 0x0197}, /* 01,97,10,cc */
1592 {0xa0, 0x0e, 0x018c}, /* 01,8c,0e,cc */
1593 {0xa0, 0x15, 0x018f}, /* 01,8f,15,cc */
1594 {0xa0, 0x62, 0x001d}, /* 00,1d,62,cc */
1595 {0xa0, 0x90, 0x001e}, /* 00,1e,90,cc */
1596 {0xa0, 0xc8, 0x001f}, /* 00,1f,c8,cc */
1597 {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc */
1598 {0xa0, 0x60, 0x011d}, /* 01,1d,60,cc */
1599 {0xa0, 0x03, 0x0180}, /* 01,80,03,cc */
1600 {0xa0, 0x80, 0x018d}, /* 01,8d,80,cc */
1601 {0,0,0}
1602};
1603
1604/* play poker with registers at your own risk !! */
1605static struct usb_action hdcs2020xx_Initial[] = {
1606 {0xa0, 0x01, 0x0000},
1607 {0xa0, 0x03, 0x0008},
1608 {0xa0, 0x0e, 0x0010},
1609 {0xa0, 0x10, 0x0002},
1610 {0xa0, 0x02, 0x0003},
1611 {0xa0, 0x80, 0x0004},
1612 {0xa0, 0x01, 0x0005},
1613 {0xa0, 0xd0, 0x0006}, /* D0 ?? E0 did not start */
1614 {0xa0, 0x01, 0x0001},
1615 {0xa0, 0x03, 0x0012},
1616 {0xa0, 0x01, 0x0012},
1617 {0xa0, 0x08, 0x008d},
1618 {0xa0, 0x08, 0x0098},
1619 {0xa0, 0x02, 0x009a},
1620 {0xa0, 0x08, 0x011a},
1621 {0xa0, 0x02, 0x011c},
1622 {0xa0, 0x01, 0x009b},
1623 {0xa0, 0xd8, 0x009c},
1624 {0xa0, 0x02, 0x009d},
1625 {0xa0, 0x88, 0x009e},
1626 {0xaa, 0x02, 0x0002},
1627 {0xaa, 0x07, 0x0006},
1628 {0xaa, 0x08, 0x0002},
1629 {0xaa, 0x09, 0x0006},
1630 {0xaa, 0x0a, 0x0001},
1631 {0xaa, 0x0b, 0x0001},
1632 {0xaa, 0x0c, 0x0008},
1633 {0xaa, 0x0d, 0x0000},
1634 {0xaa, 0x10, 0x0000},
1635 {0xaa, 0x12, 0x0005},
1636 {0xaa, 0x13, 0x0063},
1637 {0xaa, 0x15, 0x0070},
1638 {0xa0, 0x37, 0x0101},
1639 {0xa0, 0x0d, 0x0100},
1640 {0xa0, 0x06, 0x0189},
1641 {0xa0, 0x00, 0x01ad},
1642 {0xa0, 0x03, 0x01c5},
1643 {0xa0, 0x13, 0x01cb},
1644 {0xa0, 0x08, 0x0250},
1645 {0xa0, 0x08, 0x0301},
1646 {0xa0, 0x70, 0x018d},
1647 {0xa1, 0x01, 0x0002},
1648 {0xa1, 0x01, 0x0008},
1649 {0xa0, 0x03, 0x0008}, /* clock ? */
1650 {0xa0, 0x04, 0x01c6},
1651 {0xa1, 0x01, 0x01c8},
1652 {0xa1, 0x01, 0x01c9},
1653 {0xa1, 0x01, 0x01ca},
1654 {0xa0, 0x07, 0x01cb},
1655 {0xa0, 0x11, 0x0120}, /* gamma ~4 */
1656 {0xa0, 0x37, 0x0121},
1657 {0xa0, 0x58, 0x0122},
1658 {0xa0, 0x79, 0x0123},
1659 {0xa0, 0x91, 0x0124},
1660 {0xa0, 0xa6, 0x0125},
1661 {0xa0, 0xb8, 0x0126},
1662 {0xa0, 0xc7, 0x0127},
1663 {0xa0, 0xd3, 0x0128},
1664 {0xa0, 0xde, 0x0129},
1665 {0xa0, 0xe6, 0x012a},
1666 {0xa0, 0xed, 0x012b},
1667 {0xa0, 0xf3, 0x012c},
1668 {0xa0, 0xf8, 0x012d},
1669 {0xa0, 0xfb, 0x012e},
1670 {0xa0, 0xff, 0x012f},
1671 {0xa0, 0x26, 0x0130},
1672 {0xa0, 0x23, 0x0131},
1673 {0xa0, 0x20, 0x0132},
1674 {0xa0, 0x1c, 0x0133},
1675 {0xa0, 0x16, 0x0134},
1676 {0xa0, 0x13, 0x0135},
1677 {0xa0, 0x10, 0x0136},
1678 {0xa0, 0x0d, 0x0137},
1679 {0xa0, 0x0b, 0x0138},
1680 {0xa0, 0x09, 0x0139},
1681 {0xa0, 0x07, 0x013a},
1682 {0xa0, 0x06, 0x013b},
1683 {0xa0, 0x05, 0x013c},
1684 {0xa0, 0x04, 0x013d},
1685 {0xa0, 0x03, 0x013e},
1686 {0xa0, 0x02, 0x013f},
1687
1688 {0xa0, 0x4c, 0x010a}, /* matrix */
1689 {0xa0, 0xf5, 0x010b},
1690 {0xa0, 0xff, 0x010c},
1691 {0xa0, 0xf9, 0x010d},
1692 {0xa0, 0x51, 0x010e},
1693 {0xa0, 0xf5, 0x010f},
1694 {0xa0, 0xfb, 0x0110},
1695 {0xa0, 0xed, 0x0111},
1696 {0xa0, 0x5f, 0x0112},
1697
1698 {0xa1, 0x01, 0x0180},
1699 {0xa0, 0x00, 0x0180},
1700 {0xa0, 0x00, 0x0019},
1701 {0xa0, 0x20, 0x0087},
1702 {0xa0, 0x21, 0x0088},
1703 {0xaa, 0x20, 0x0004},
1704 {0xaa, 0x21, 0x003d},
1705 {0xaa, 0x03, 0x0041},
1706 {0xaa, 0x04, 0x0010},
1707 {0xaa, 0x05, 0x003d},
1708 {0xaa, 0x0e, 0x0001},
1709 {0xaa, 0x0f, 0x0000},
1710 {0xa0, 0x14, 0x01a9},
1711 {0xa0, 0x24, 0x01aa},
1712 {0xa0, 0x00, 0x0190},
1713 {0xa0, 0x04, 0x0191},
1714 {0xa0, 0x3d, 0x0192},
1715 {0xa0, 0x00, 0x0195},
1716 {0xa0, 0x00, 0x0196},
1717 {0xa0, 0x9b, 0x0197},
1718 {0xa0, 0x10, 0x018c},
1719 {0xa0, 0x20, 0x018f},
1720 {0xa0, 0x41, 0x001d},
1721 {0xa0, 0x6f, 0x001e},
1722 {0xa0, 0xad, 0x001f},
1723 {0xa0, 0xff, 0x0020},
1724 {0xa0, 0x0f, 0x0087},
1725 {0xa0, 0x0e, 0x0088},
1726 {0xa0, 0x40, 0x0180},
1727 {0xa1, 0x01, 0x0195},
1728 {0xa1, 0x01, 0x0196},
1729 {0xa1, 0x01, 0x0197},
1730 {0xa0, 0x3d, 0x0192},
1731 {0xa0, 0x04, 0x0191},
1732 {0xa0, 0x00, 0x0190},
1733 {0xa0, 0x1d, 0x0116},
1734 {0xa0, 0x40, 0x0117},
1735 {0xa0, 0x85, 0x0118},
1736 {0xa1, 0x01, 0x0116},
1737 {0xa1, 0x01, 0x0118},
1738 {0xa1, 0x01, 0x0180},
1739 {0xa0, 0x42, 0x0180},
1740 {0xa0, 0x1d, 0x0116},
1741 {0xa0, 0x40, 0x0117},
1742 {0xa0, 0x85, 0x0118},
1743 {0xa1, 0x01, 0x0116},
1744 {0xa1, 0x01, 0x0118},
1745/* {0xa0, 0x02, 0x0008}, */
1746 {0xa0, 0x00, 0x0007},
1747 {0, 0, 0}
1748};
1749
1750static struct usb_action hdcs2020xx_InitialScale[] = {
1751 {0xa0, 0x01, 0x0000},
1752 {0xa0, 0x03, 0x0008},
1753 {0xa0, 0x0e, 0x0010},
1754 {0xa0, 0x00, 0x0002},
1755 {0xa0, 0x02, 0x0003},
1756 {0xa0, 0x80, 0x0004},
1757 {0xa0, 0x01, 0x0005},
1758 {0xa0, 0xe0, 0x0006},
1759 {0xa0, 0x01, 0x0001},
1760 {0xa0, 0x03, 0x0012},
1761 {0xa0, 0x01, 0x0012},
1762 {0xa0, 0x08, 0x008d},
1763 {0xa0, 0x00, 0x0098},
1764 {0xa0, 0x03, 0x009a},
1765 {0xa0, 0x00, 0x011a},
1766 {0xa0, 0x03, 0x011c},
1767 {0xa0, 0x01, 0x009b},
1768 {0xa0, 0xe6, 0x009c},
1769 {0xa0, 0x02, 0x009d},
1770 {0xa0, 0x86, 0x009e},
1771 {0xaa, 0x02, 0x0002},
1772 {0xaa, 0x07, 0x0006},
1773 {0xaa, 0x08, 0x0002},
1774 {0xaa, 0x09, 0x0006},
1775 {0xaa, 0x0a, 0x0001},
1776 {0xaa, 0x0b, 0x0001},
1777 {0xaa, 0x0c, 0x0008},
1778 {0xaa, 0x0d, 0x0000},
1779 {0xaa, 0x10, 0x0000},
1780 {0xaa, 0x12, 0x0005},
1781 {0xaa, 0x13, 0x0063},
1782 {0xaa, 0x15, 0x0070},
1783 {0xa0, 0xb7, 0x0101},
1784 {0xa0, 0x0d, 0x0100},
1785 {0xa0, 0x06, 0x0189},
1786 {0xa0, 0x00, 0x01ad},
1787 {0xa0, 0x03, 0x01c5},
1788 {0xa0, 0x13, 0x01cb},
1789 {0xa0, 0x08, 0x0250},
1790 {0xa0, 0x08, 0x0301},
1791 {0xa0, 0x70, 0x018d},
1792 {0xa1, 0x01, 0x0002},
1793 {0xa1, 0x01, 0x0008},
1794 {0xa0, 0x03, 0x0008}, /* clock ? */
1795 {0xa0, 0x04, 0x01c6},
1796 {0xa1, 0x01, 0x01c8},
1797 {0xa1, 0x01, 0x01c9},
1798 {0xa1, 0x01, 0x01ca},
1799 {0xa0, 0x07, 0x01cb},
1800 {0xa0, 0x11, 0x0120}, /* gamma ~4*/
1801 {0xa0, 0x37, 0x0121},
1802 {0xa0, 0x58, 0x0122},
1803 {0xa0, 0x79, 0x0123},
1804 {0xa0, 0x91, 0x0124},
1805 {0xa0, 0xa6, 0x0125},
1806 {0xa0, 0xb8, 0x0126},
1807 {0xa0, 0xc7, 0x0127},
1808 {0xa0, 0xd3, 0x0128},
1809 {0xa0, 0xde, 0x0129},
1810 {0xa0, 0xe6, 0x012a},
1811 {0xa0, 0xed, 0x012b},
1812 {0xa0, 0xf3, 0x012c},
1813 {0xa0, 0xf8, 0x012d},
1814 {0xa0, 0xfb, 0x012e},
1815 {0xa0, 0xff, 0x012f},
1816 {0xa0, 0x26, 0x0130},
1817 {0xa0, 0x23, 0x0131},
1818 {0xa0, 0x20, 0x0132},
1819 {0xa0, 0x1c, 0x0133},
1820 {0xa0, 0x16, 0x0134},
1821 {0xa0, 0x13, 0x0135},
1822 {0xa0, 0x10, 0x0136},
1823 {0xa0, 0x0d, 0x0137},
1824 {0xa0, 0x0b, 0x0138},
1825 {0xa0, 0x09, 0x0139},
1826 {0xa0, 0x07, 0x013a},
1827 {0xa0, 0x06, 0x013b},
1828 {0xa0, 0x05, 0x013c},
1829 {0xa0, 0x04, 0x013d},
1830 {0xa0, 0x03, 0x013e},
1831 {0xa0, 0x02, 0x013f},
1832 {0xa0, 0x60, 0x010a}, /* matrix */
1833 {0xa0, 0xff, 0x010b},
1834 {0xa0, 0xff, 0x010c},
1835 {0xa0, 0xff, 0x010d},
1836 {0xa0, 0x60, 0x010e},
1837 {0xa0, 0xff, 0x010f},
1838 {0xa0, 0xff, 0x0110},
1839 {0xa0, 0xff, 0x0111},
1840 {0xa0, 0x60, 0x0112},
1841
1842 {0xa1, 0x01, 0x0180},
1843 {0xa0, 0x00, 0x0180},
1844 {0xa0, 0x00, 0x0019},
1845 {0xa0, 0x20, 0x0087},
1846 {0xa0, 0x21, 0x0088},
1847 {0xaa, 0x20, 0x0002},
1848 {0xaa, 0x21, 0x001b},
1849 {0xaa, 0x03, 0x0044},
1850 {0xaa, 0x04, 0x0008},
1851 {0xaa, 0x05, 0x001b},
1852 {0xaa, 0x0e, 0x0001},
1853 {0xaa, 0x0f, 0x0000},
1854 {0xa0, 0x14, 0x01a9},
1855 {0xa0, 0x24, 0x01aa},
1856 {0xa0, 0x00, 0x0190},
1857 {0xa0, 0x02, 0x0191},
1858 {0xa0, 0x1b, 0x0192},
1859 {0xa0, 0x00, 0x0195},
1860 {0xa0, 0x00, 0x0196},
1861 {0xa0, 0x4d, 0x0197},
1862 {0xa0, 0x10, 0x018c},
1863 {0xa0, 0x20, 0x018f},
1864 {0xa0, 0x44, 0x001d},
1865 {0xa0, 0x6f, 0x001e},
1866 {0xa0, 0xad, 0x001f},
1867 {0xa0, 0xeb, 0x0020},
1868 {0xa0, 0x0f, 0x0087},
1869 {0xa0, 0x0e, 0x0088},
1870 {0xa0, 0x40, 0x0180},
1871 {0xa1, 0x01, 0x0195},
1872 {0xa1, 0x01, 0x0196},
1873 {0xa1, 0x01, 0x0197},
1874 {0xa0, 0x1b, 0x0192},
1875 {0xa0, 0x02, 0x0191},
1876 {0xa0, 0x00, 0x0190},
1877 {0xa0, 0x1d, 0x0116},
1878 {0xa0, 0x40, 0x0117},
1879 {0xa0, 0x99, 0x0118},
1880 {0xa1, 0x01, 0x0116},
1881 {0xa1, 0x01, 0x0118},
1882 {0xa1, 0x01, 0x0180},
1883 {0xa0, 0x42, 0x0180},
1884 {0xa0, 0x1d, 0x0116},
1885 {0xa0, 0x40, 0x0117},
1886 {0xa0, 0x99, 0x0118},
1887/* {0xa0, 0x02, 0x0008}, */
1888 {0xa0, 0x00, 0x0007},
1889/* {0xa0, 0x18, 0x00fe}, */
1890 {0, 0, 0}
1891};
1892static struct usb_action hdcs2020xb_Initial[] = {
1893 {0xa0, 0x01, 0x0000},
1894 {0xa0, 0x11, 0x0002},
1895 {0xa0, 0x03, 0x0008}, /* qtable 0x05 */
1896 {0xa0, 0x08, 0x0010},
1897 {0xa0, 0x02, 0x0003},
1898 {0xa0, 0x80, 0x0004},
1899 {0xa0, 0x01, 0x0005},
1900 {0xa0, 0xe0, 0x0006},
1901 {0xa0, 0x01, 0x0001},
1902 {0xa0, 0x03, 0x0012},
1903 {0xa0, 0x01, 0x0012},
1904 {0xa0, 0x00, 0x0098},
1905 {0xa0, 0x00, 0x009a},
1906 {0xa0, 0x00, 0x011a},
1907 {0xa0, 0x00, 0x011c},
1908 {0xa0, 0xe8, 0x009c},
1909 {0xa0, 0x88, 0x009e},
1910 {0xaa, 0x1c, 0x0000},
1911 {0xaa, 0x0a, 0x0001},
1912 {0xaa, 0x0b, 0x0006},
1913 {0xaa, 0x0c, 0x007b},
1914 {0xaa, 0x0d, 0x00a7},
1915 {0xaa, 0x03, 0x00fb},
1916 {0xaa, 0x05, 0x0000},
1917 {0xaa, 0x06, 0x0003},
1918 {0xaa, 0x09, 0x0008},
1919
1920 {0xaa, 0x0f, 0x0018}, /* set sensor gain */
1921 {0xaa, 0x10, 0x0018},
1922 {0xaa, 0x11, 0x0018},
1923 {0xaa, 0x12, 0x0018},
1924
1925 {0xaa, 0x15, 0x004e},
1926 {0xaa, 0x1c, 0x0004},
1927 {0xa0, 0xb7, 0x0101},
1928 {0xa0, 0x05, 0x0012},
1929 {0xa0, 0x70, 0x018d},
1930 {0xa0, 0x0d, 0x0100},
1931 {0xa0, 0x06, 0x0189},
1932 {0xa0, 0x03, 0x01c5},
1933 {0xa0, 0x13, 0x01cb},
1934 {0xa0, 0x08, 0x0250},
1935 {0xa0, 0x08, 0x0301},
1936 {0xa1, 0x01, 0x0002},
1937 {0xa1, 0x01, 0x0008},
1938 {0xa1, 0x01, 0x0180},
1939 {0xa0, 0x02, 0x0180},
1940 {0xa0, 0x40, 0x0116},
1941 {0xa0, 0x40, 0x0117},
1942 {0xa0, 0x40, 0x0118},
1943 {0xa1, 0x01, 0x0008},
1944 {0xa0, 0x03, 0x0008}, /* clock ? */
1945 {0xa0, 0x08, 0x01c6},
1946 {0xa1, 0x01, 0x01c8},
1947 {0xa1, 0x01, 0x01c9},
1948 {0xa1, 0x01, 0x01ca},
1949 {0xa0, 0x0f, 0x01cb},
1950 {0xa0, 0x13, 0x0120}, /* gamma 4 */
1951 {0xa0, 0x38, 0x0121},
1952 {0xa0, 0x59, 0x0122},
1953 {0xa0, 0x79, 0x0123},
1954 {0xa0, 0x92, 0x0124},
1955 {0xa0, 0xa7, 0x0125},
1956 {0xa0, 0xb9, 0x0126},
1957 {0xa0, 0xc8, 0x0127},
1958 {0xa0, 0xd4, 0x0128},
1959 {0xa0, 0xdf, 0x0129},
1960 {0xa0, 0xe7, 0x012a},
1961 {0xa0, 0xee, 0x012b},
1962 {0xa0, 0xf4, 0x012c},
1963 {0xa0, 0xf9, 0x012d},
1964 {0xa0, 0xfc, 0x012e},
1965 {0xa0, 0xff, 0x012f},
1966 {0xa0, 0x26, 0x0130},
1967 {0xa0, 0x22, 0x0131},
1968 {0xa0, 0x20, 0x0132},
1969 {0xa0, 0x1c, 0x0133},
1970 {0xa0, 0x16, 0x0134},
1971 {0xa0, 0x13, 0x0135},
1972 {0xa0, 0x10, 0x0136},
1973 {0xa0, 0x0d, 0x0137},
1974 {0xa0, 0x0b, 0x0138},
1975 {0xa0, 0x09, 0x0139},
1976 {0xa0, 0x07, 0x013a},
1977 {0xa0, 0x06, 0x013b},
1978 {0xa0, 0x05, 0x013c},
1979 {0xa0, 0x04, 0x013d},
1980 {0xa0, 0x03, 0x013e},
1981 {0xa0, 0x02, 0x013f},
1982
1983 {0xa0, 0x66, 0x010a}, /* matrix */
1984 {0xa0, 0xed, 0x010b},
1985 {0xa0, 0xed, 0x010c},
1986 {0xa0, 0xed, 0x010d},
1987 {0xa0, 0x66, 0x010e},
1988 {0xa0, 0xed, 0x010f},
1989 {0xa0, 0xed, 0x0110},
1990 {0xa0, 0xed, 0x0111},
1991 {0xa0, 0x66, 0x0112},
1992
1993 {0xa1, 0x01, 0x0180},
1994 {0xa0, 0x00, 0x0180},
1995 {0xa0, 0x00, 0x0019},
1996 {0xaa, 0x13, 0x0031},
1997 {0xaa, 0x14, 0x0001},
1998 {0xaa, 0x0e, 0x0004},
1999 {0xaa, 0x19, 0x00cd},
2000 {0xa0, 0x00, 0x0190},
2001 {0xa0, 0x02, 0x0191},
2002 {0xa0, 0x62, 0x0192},
2003 {0xa0, 0x00, 0x0195},
2004 {0xa0, 0x00, 0x0196},
2005 {0xa0, 0x3d, 0x0197},
2006 {0xa0, 0x10, 0x018c},
2007 {0xa0, 0x20, 0x018f},
2008
2009 {0xa0, 0x0c, 0x01a9}, /* 0x14 */
2010 {0xa0, 0x28, 0x01aa},
2011 {0xa0, 0x04, 0x001d},
2012 {0xa0, 0x18, 0x001e},
2013 {0xa0, 0x2c, 0x001f},
2014 {0xa0, 0x41, 0x0020},
2015 {0xa0, 0x60, 0x011d},
2016 {0xa0, 0x42, 0x0180},
2017 {0xa1, 0x01, 0x0180},
2018 {0xa0, 0x42, 0x0180},
2019 {0xa0, 0x40, 0x0116},
2020 {0xa0, 0x40, 0x0117},
2021 {0xa0, 0x40, 0x0118},
2022 {0, 0, 0}
2023};
2024static struct usb_action hdcs2020xb_InitialScale[] = {
2025 {0xa0, 0x01, 0x0000},
2026 {0xa0, 0x00, 0x0002},
2027 {0xa0, 0x03, 0x0008},
2028 {0xa0, 0x08, 0x0010},
2029 {0xa0, 0x02, 0x0003},
2030 {0xa0, 0x80, 0x0004},
2031 {0xa0, 0x01, 0x0005},
2032 {0xa0, 0xe0, 0x0006},
2033 {0xa0, 0x01, 0x0001},
2034 {0xa0, 0x03, 0x0012},
2035 {0xa0, 0x01, 0x0012},
2036 {0xa0, 0x00, 0x0098},
2037 {0xa0, 0x00, 0x009a},
2038 {0xa0, 0x00, 0x011a},
2039 {0xa0, 0x00, 0x011c},
2040 {0xa0, 0xe8, 0x009c},
2041 {0xa0, 0x88, 0x009e},
2042 {0xaa, 0x1c, 0x0000},
2043 {0xaa, 0x0a, 0x0001},
2044 {0xaa, 0x0b, 0x0006},
2045 {0xaa, 0x0c, 0x007a},
2046 {0xaa, 0x0d, 0x00a7},
2047 {0xaa, 0x03, 0x00fb},
2048 {0xaa, 0x05, 0x0000},
2049 {0xaa, 0x06, 0x0003},
2050 {0xaa, 0x09, 0x0008},
2051 {0xaa, 0x0f, 0x0018}, /* original setting */
2052 {0xaa, 0x10, 0x0018},
2053 {0xaa, 0x11, 0x0018},
2054 {0xaa, 0x12, 0x0018},
2055 {0xaa, 0x15, 0x004e},
2056 {0xaa, 0x1c, 0x0004},
2057 {0xa0, 0xf7, 0x0101},
2058 {0xa0, 0x05, 0x0012},
2059 {0xa0, 0x70, 0x018d},
2060 {0xa0, 0x0d, 0x0100},
2061 {0xa0, 0x06, 0x0189},
2062 {0xa0, 0x03, 0x01c5},
2063 {0xa0, 0x13, 0x01cb},
2064 {0xa0, 0x08, 0x0250},
2065 {0xa0, 0x08, 0x0301},
2066 {0xa1, 0x01, 0x0002},
2067 {0xa1, 0x01, 0x0008},
2068 {0xa1, 0x01, 0x0180},
2069 {0xa0, 0x02, 0x0180},
2070 {0xa0, 0x40, 0x0116},
2071 {0xa0, 0x40, 0x0117},
2072 {0xa0, 0x40, 0x0118},
2073 {0xa1, 0x01, 0x0008},
2074 {0xa0, 0x03, 0x0008}, /* clock ? */
2075 {0xa0, 0x08, 0x01c6},
2076 {0xa1, 0x01, 0x01c8},
2077 {0xa1, 0x01, 0x01c9},
2078 {0xa1, 0x01, 0x01ca},
2079 {0xa0, 0x0f, 0x01cb},
2080 {0xa0, 0x13, 0x0120}, /* gamma 4 */
2081 {0xa0, 0x38, 0x0121},
2082 {0xa0, 0x59, 0x0122},
2083 {0xa0, 0x79, 0x0123},
2084 {0xa0, 0x92, 0x0124},
2085 {0xa0, 0xa7, 0x0125},
2086 {0xa0, 0xb9, 0x0126},
2087 {0xa0, 0xc8, 0x0127},
2088 {0xa0, 0xd4, 0x0128},
2089 {0xa0, 0xdf, 0x0129},
2090 {0xa0, 0xe7, 0x012a},
2091 {0xa0, 0xee, 0x012b},
2092 {0xa0, 0xf4, 0x012c},
2093 {0xa0, 0xf9, 0x012d},
2094 {0xa0, 0xfc, 0x012e},
2095 {0xa0, 0xff, 0x012f},
2096 {0xa0, 0x26, 0x0130},
2097 {0xa0, 0x22, 0x0131},
2098 {0xa0, 0x20, 0x0132},
2099 {0xa0, 0x1c, 0x0133},
2100 {0xa0, 0x16, 0x0134},
2101 {0xa0, 0x13, 0x0135},
2102 {0xa0, 0x10, 0x0136},
2103 {0xa0, 0x0d, 0x0137},
2104 {0xa0, 0x0b, 0x0138},
2105 {0xa0, 0x09, 0x0139},
2106 {0xa0, 0x07, 0x013a},
2107 {0xa0, 0x06, 0x013b},
2108 {0xa0, 0x05, 0x013c},
2109 {0xa0, 0x04, 0x013d},
2110 {0xa0, 0x03, 0x013e},
2111 {0xa0, 0x02, 0x013f},
2112 {0xa0, 0x66, 0x010a}, /* matrix */
2113 {0xa0, 0xed, 0x010b},
2114 {0xa0, 0xed, 0x010c},
2115 {0xa0, 0xed, 0x010d},
2116 {0xa0, 0x66, 0x010e},
2117 {0xa0, 0xed, 0x010f},
2118 {0xa0, 0xed, 0x0110},
2119 {0xa0, 0xed, 0x0111},
2120 {0xa0, 0x66, 0x0112},
2121 {0xa1, 0x01, 0x0180},
2122 {0xa0, 0x00, 0x0180},
2123 {0xa0, 0x00, 0x0019},
2124 /**** set exposure ***/
2125 {0xaa, 0x13, 0x0031},
2126 {0xaa, 0x14, 0x0001},
2127 {0xaa, 0x0e, 0x0004},
2128 {0xaa, 0x19, 0x00cd},
2129 {0xa0, 0x00, 0x0190},
2130 {0xa0, 0x02, 0x0191},
2131 {0xa0, 0x62, 0x0192},
2132 {0xa0, 0x00, 0x0195},
2133 {0xa0, 0x00, 0x0196},
2134 {0xa0, 0x3d, 0x0197},
2135 {0xa0, 0x10, 0x018c},
2136 {0xa0, 0x20, 0x018f},
2137 {0xa0, 0x0c, 0x01a9},
2138 {0xa0, 0x28, 0x01aa},
2139 {0xa0, 0x04, 0x001d},
2140 {0xa0, 0x18, 0x001e},
2141 {0xa0, 0x2c, 0x001f},
2142 {0xa0, 0x41, 0x0020},
2143 {0xa0, 0x60, 0x011d},
2144 {0xa0, 0x42, 0x0180},
2145 {0xa1, 0x01, 0x0180},
2146 {0xa0, 0x42, 0x0180},
2147 {0xa0, 0x40, 0x0116},
2148 {0xa0, 0x40, 0x0117},
2149 {0xa0, 0x40, 0x0118},
2150 {0, 0, 0}
2151};
2152static struct usb_action hdcs2020b_50HZ[] = {
2153 {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
2154 {0xaa, 0x13, 0x0018}, /* 00,13,18,aa */
2155 {0xaa, 0x14, 0x0001}, /* 00,14,01,aa */
2156 {0xaa, 0x0e, 0x0005}, /* 00,0e,05,aa */
2157 {0xaa, 0x19, 0x001f}, /* 00,19,1f,aa */
2158 {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
2159 {0xa0, 0x02, 0x0191}, /* 01,91,02,cc */
2160 {0xa0, 0x76, 0x0192}, /* 01,92,76,cc */
2161 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */
2162 {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */
2163 {0xa0, 0x46, 0x0197}, /* 01,97,46,cc */
2164 {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */
2165 {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */
2166 {0xa0, 0x0c, 0x01a9}, /* 01,a9,0c,cc */
2167 {0xa0, 0x28, 0x01aa}, /* 01,aa,28,cc */
2168 {0xa0, 0x05, 0x001d}, /* 00,1d,05,cc */
2169 {0xa0, 0x1a, 0x001e}, /* 00,1e,1a,cc */
2170 {0xa0, 0x2f, 0x001f}, /* 00,1f,2f,cc */
2171 {0, 0, 0}
2172};
2173static struct usb_action hdcs2020b_60HZ[] = {
2174 {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
2175 {0xaa, 0x13, 0x0031}, /* 00,13,31,aa */
2176 {0xaa, 0x14, 0x0001}, /* 00,14,01,aa */
2177 {0xaa, 0x0e, 0x0004}, /* 00,0e,04,aa */
2178 {0xaa, 0x19, 0x00cd}, /* 00,19,cd,aa */
2179 {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
2180 {0xa0, 0x02, 0x0191}, /* 01,91,02,cc */
2181 {0xa0, 0x62, 0x0192}, /* 01,92,62,cc */
2182 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */
2183 {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */
2184 {0xa0, 0x3d, 0x0197}, /* 01,97,3d,cc */
2185 {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */
2186 {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */
2187 {0xa0, 0x0c, 0x01a9}, /* 01,a9,0c,cc */
2188 {0xa0, 0x28, 0x01aa}, /* 01,aa,28,cc */
2189 {0xa0, 0x04, 0x001d}, /* 00,1d,04,cc */
2190 {0xa0, 0x18, 0x001e}, /* 00,1e,18,cc */
2191 {0xa0, 0x2c, 0x001f}, /* 00,1f,2c,cc */
2192 {0, 0, 0}
2193};
2194static struct usb_action hdcs2020b_NoFliker[] = {
2195 {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
2196 {0xaa, 0x13, 0x0010}, /* 00,13,10,aa */
2197 {0xaa, 0x14, 0x0001}, /* 00,14,01,aa */
2198 {0xaa, 0x0e, 0x0004}, /* 00,0e,04,aa */
2199 {0xaa, 0x19, 0x0000}, /* 00,19,00,aa */
2200 {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
2201 {0xa0, 0x02, 0x0191}, /* 01,91,02,cc */
2202 {0xa0, 0x70, 0x0192}, /* 01,92,70,cc */
2203 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */
2204 {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */
2205 {0xa0, 0x10, 0x0197}, /* 01,97,10,cc */
2206 {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */
2207 {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */
2208 {0xa0, 0x00, 0x01a9}, /* 01,a9,00,cc */
2209 {0xa0, 0x00, 0x01aa}, /* 01,aa,00,cc */
2210 {0xa0, 0x04, 0x001d}, /* 00,1d,04,cc */
2211 {0xa0, 0x17, 0x001e}, /* 00,1e,17,cc */
2212 {0xa0, 0x2a, 0x001f}, /* 00,1f,2a,cc */
2213 {0, 0, 0}
2214};
2215
2216static struct usb_action hv7131bxx_Initial[] = {
2217 {0xa0, 0x01, 0x0000},
2218 {0xa0, 0x10, 0x0002},
2219 {0xa0, 0x00, 0x0010},
2220 {0xa0, 0x01, 0x0001},
2221 {0xa0, 0x77, 0x0101},
2222 {0xa0, 0x03, 0x0008}, /* 00 */
2223 {0xa0, 0x03, 0x0012},
2224 {0xa0, 0x01, 0x0012},
2225 {0xa0, 0x02, 0x0003},
2226 {0xa0, 0x80, 0x0004},
2227 {0xa0, 0x01, 0x0005},
2228 {0xa0, 0xe0, 0x0006},
2229 {0xa0, 0x00, 0x0098},
2230 {0xa0, 0x00, 0x009a},
2231 {0xa0, 0x00, 0x011a},
2232 {0xa0, 0x00, 0x011c},
2233 {0xaa, 0x30, 0x002d},
2234 {0xaa, 0x01, 0x0005},
2235 {0xaa, 0x11, 0x0000},
2236 {0xaa, 0x13, 0x0001}, /* {0xaa, 0x13, 0x0000}, */
2237 {0xaa, 0x14, 0x0001},
2238 {0xaa, 0x15, 0x00e8},
2239 {0xaa, 0x16, 0x0002},
2240 {0xaa, 0x17, 0x0086},
2241 {0xaa, 0x31, 0x0038},
2242 {0xaa, 0x32, 0x0038},
2243 {0xaa, 0x33, 0x0038},
2244 {0xaa, 0x5b, 0x0001},
2245 {0xa0, 0x00, 0x0019},
2246 {0xa0, 0x05, 0x0012},
2247 {0xa0, 0x0d, 0x0100},
2248 {0xa0, 0x68, 0x018d},
2249 {0xa0, 0x60, 0x01a8},
2250 {0xa0, 0x00, 0x01ad},
2251 {0xa0, 0xc0, 0x019b},
2252 {0xa0, 0xa0, 0x019c},
2253 {0xa0, 0x02, 0x0188},
2254 {0xa0, 0x06, 0x0189},
2255 {0xa0, 0x03, 0x01c5},
2256 {0xa0, 0x13, 0x01cb},
2257 {0xa0, 0x08, 0x0250},
2258 {0xa0, 0x08, 0x0301},
2259 {0xaa, 0x02, 0x0080}, /* {0xaa, 0x02, 0x0090}; */
2260 {0xa1, 0x01, 0x0002},
2261 {0xa0, 0x00, 0x0092},
2262 {0xa0, 0x02, 0x0090},
2263 {0xa1, 0x01, 0x0091},
2264 {0xa1, 0x01, 0x0095},
2265 {0xa1, 0x01, 0x0096},
2266
2267 {0xa1, 0x01, 0x0008},
2268 {0xa0, 0x03, 0x0008}, /* clock ? */
2269 {0xa0, 0x08, 0x01c6},
2270 {0xa1, 0x01, 0x01c8},
2271 {0xa1, 0x01, 0x01c9},
2272 {0xa1, 0x01, 0x01ca},
2273 {0xa0, 0x0f, 0x01cb},
2274
2275 {0xa0, 0x50, 0x010a}, /* matrix */
2276 {0xa0, 0xf8, 0x010b},
2277 {0xa0, 0xf8, 0x010c},
2278 {0xa0, 0xf8, 0x010d},
2279 {0xa0, 0x50, 0x010e},
2280 {0xa0, 0xf8, 0x010f},
2281 {0xa0, 0xf8, 0x0110},
2282 {0xa0, 0xf8, 0x0111},
2283 {0xa0, 0x50, 0x0112},
2284 {0xa1, 0x01, 0x0180},
2285 {0xa0, 0x10, 0x0180},
2286 {0xa0, 0x00, 0x0019},
2287 {0xaa, 0x25, 0x0007},
2288 {0xaa, 0x26, 0x00a1},
2289 {0xaa, 0x27, 0x0020},
2290 {0xaa, 0x20, 0x0000},
2291 {0xaa, 0x21, 0x00a0},
2292 {0xaa, 0x22, 0x0016},
2293 {0xaa, 0x23, 0x0040},
2294
2295 {0xa0, 0x10, 0x0190}, /* 2F */
2296 {0xa0, 0x04, 0x0191}, /* 4d */
2297 {0xa0, 0x60, 0x0192},
2298 {0xa0, 0x01, 0x0195},
2299 {0xa0, 0x86, 0x0196},
2300 {0xa0, 0xa0, 0x0197},
2301 {0xa0, 0x07, 0x018c},
2302 {0xa0, 0x0f, 0x018f},
2303 {0xa0, 0x18, 0x01a9},
2304 {0xa0, 0x24, 0x01aa},
2305 {0xa0, 0x00, 0x001d},
2306 {0xa0, 0xa0, 0x001e},
2307 {0xa0, 0x16, 0x001f},
2308 {0xa0, 0x40, 0x0020},
2309 {0xa0, 0x60, 0x011d},
2310 {0xa1, 0x01, 0x001d},
2311 {0xa1, 0x01, 0x001e},
2312 {0xa1, 0x01, 0x001f},
2313 {0xa1, 0x01, 0x0020},
2314 {0xa0, 0x40, 0x0180},
2315 {0xa1, 0x01, 0x0180},
2316 {0xa0, 0x42, 0x0180},
2317 {0xa0, 0x40, 0x0116},
2318 {0xa0, 0x40, 0x0117},
2319 {0xa0, 0x40, 0x0118},
2320/* {0xa0, 0x02, 0x0008}, */
2321 {0, 0, 0}
2322};
2323
2324static struct usb_action hv7131bxx_InitialScale[] = {
2325 {0xa0, 0x01, 0x0000},
2326 {0xa0, 0x00, 0x0002},
2327 {0xa0, 0x00, 0x0010},
2328 {0xa0, 0x01, 0x0001},
2329 {0xa0, 0x37, 0x0101},
2330 {0xa0, 0x03, 0x0008}, /* 00 */
2331 {0xa0, 0x03, 0x0012},
2332 {0xa0, 0x01, 0x0012},
2333 {0xa0, 0x02, 0x0003},
2334 {0xa0, 0x80, 0x0004},
2335 {0xa0, 0x01, 0x0005},
2336 {0xa0, 0xe0, 0x0006},
2337 {0xa0, 0x00, 0x0098},
2338 {0xa0, 0x00, 0x009a},
2339 {0xa0, 0x00, 0x011a},
2340 {0xa0, 0x00, 0x011c},
2341 {0xaa, 0x30, 0x002d},
2342 {0xaa, 0x01, 0x0005},
2343 {0xaa, 0x11, 0x0001},
2344 {0xaa, 0x13, 0x0000}, /* {0xaa, 0x13, 0x0001}; */
2345 {0xaa, 0x14, 0x0001},
2346 {0xaa, 0x15, 0x00e6},
2347 {0xaa, 0x16, 0x0002},
2348 {0xaa, 0x17, 0x0086},
2349 {0xaa, 0x31, 0x0038},
2350 {0xaa, 0x32, 0x0038},
2351 {0xaa, 0x33, 0x0038},
2352 {0xaa, 0x5b, 0x0001},
2353 {0xa0, 0x00, 0x0019},
2354 {0xa0, 0x05, 0x0012},
2355 {0xa0, 0x0d, 0x0100},
2356 {0xa0, 0x70, 0x018d},
2357 {0xa0, 0x60, 0x01a8},
2358 {0xa0, 0x00, 0x01ad},
2359 {0xa0, 0xc0, 0x019b},
2360 {0xa0, 0xa0, 0x019c},
2361 {0xa0, 0x02, 0x0188},
2362 {0xa0, 0x06, 0x0189},
2363 {0xa0, 0x03, 0x01c5},
2364 {0xa0, 0x13, 0x01cb},
2365 {0xa0, 0x08, 0x0250},
2366 {0xa0, 0x08, 0x0301},
2367 {0xaa, 0x02, 0x0090}, /* {0xaa, 0x02, 0x0080}, */
2368 {0xa1, 0x01, 0x0002},
2369 {0xa0, 0x00, 0x0092},
2370 {0xa0, 0x02, 0x0090},
2371 {0xa1, 0x01, 0x0091},
2372 {0xa1, 0x01, 0x0095},
2373 {0xa1, 0x01, 0x0096},
2374 {0xa1, 0x01, 0x0008},
2375 {0xa0, 0x03, 0x0008}, /* clock ? */
2376 {0xa0, 0x08, 0x01c6},
2377 {0xa1, 0x01, 0x01c8},
2378 {0xa1, 0x01, 0x01c9},
2379 {0xa1, 0x01, 0x01ca},
2380 {0xa0, 0x0f, 0x01cb},
2381
2382 {0xa0, 0x50, 0x010a}, /* matrix */
2383 {0xa0, 0xf8, 0x010b},
2384 {0xa0, 0xf8, 0x010c},
2385 {0xa0, 0xf8, 0x010d},
2386 {0xa0, 0x50, 0x010e},
2387 {0xa0, 0xf8, 0x010f},
2388 {0xa0, 0xf8, 0x0110},
2389 {0xa0, 0xf8, 0x0111},
2390 {0xa0, 0x50, 0x0112},
2391 {0xa1, 0x01, 0x0180},
2392 {0xa0, 0x10, 0x0180},
2393 {0xa0, 0x00, 0x0019},
2394 {0xaa, 0x25, 0x0007},
2395 {0xaa, 0x26, 0x00a1},
2396 {0xaa, 0x27, 0x0020},
2397 {0xaa, 0x20, 0x0000},
2398 {0xaa, 0x21, 0x0040},
2399 {0xaa, 0x22, 0x0013},
2400 {0xaa, 0x23, 0x004c},
2401 {0xa0, 0x10, 0x0190}, /* 2f */
2402 {0xa0, 0x04, 0x0191}, /* 4d */
2403 {0xa0, 0x60, 0x0192}, /* 60 */
2404 {0xa0, 0x00, 0x0195},
2405 {0xa0, 0xc3, 0x0196},
2406 {0xa0, 0x50, 0x0197},
2407 {0xa0, 0x0c, 0x018c},
2408 {0xa0, 0x18, 0x018f},
2409 {0xa0, 0x18, 0x01a9},
2410 {0xa0, 0x24, 0x01aa},
2411 {0xa0, 0x00, 0x001d},
2412 {0xa0, 0x40, 0x001e},
2413 {0xa0, 0x13, 0x001f},
2414 {0xa0, 0x4c, 0x0020},
2415 {0xa0, 0x60, 0x011d},
2416 {0xa1, 0x01, 0x001d},
2417 {0xa1, 0x01, 0x001e},
2418 {0xa1, 0x01, 0x001f},
2419 {0xa1, 0x01, 0x0020},
2420 {0xa0, 0x40, 0x0180},
2421 {0xa1, 0x01, 0x0180},
2422 {0xa0, 0x42, 0x0180},
2423 {0xa0, 0x40, 0x0116},
2424 {0xa0, 0x40, 0x0117},
2425 {0xa0, 0x40, 0x0118},
2426/* {0xa0, 0x02, 0x0008}, */
2427 {0, 0, 0}
2428};
2429
2430static struct usb_action hv7131cxx_Initial[] = {
2431 {0xa0, 0x01, 0x0000},
2432 {0xa0, 0x10, 0x0002},
2433 {0xa0, 0x01, 0x0010},
2434 {0xa0, 0x01, 0x0001},
2435 {0xa0, 0x77, 0x0101},
2436 {0xa0, 0x03, 0x0008},
2437 {0xa0, 0x05, 0x0012},
2438 {0xa0, 0x07, 0x0012},
2439 {0xa0, 0x02, 0x0003},
2440 {0xa0, 0x80, 0x0004},
2441 {0xa0, 0x01, 0x0005},
2442 {0xa0, 0xe0, 0x0006},
2443 {0xa0, 0x00, 0x0098},
2444 {0xa0, 0x00, 0x009a},
2445 {0xa0, 0x01, 0x009b},
2446 {0xa0, 0xe8, 0x009c},
2447 {0xa0, 0x02, 0x009d},
2448 {0xa0, 0x88, 0x009e},
2449 {0xa0, 0x00, 0x011a},
2450 {0xa0, 0x00, 0x011c},
2451 {0xa0, 0x05, 0x0012},
2452 {0xaa, 0x01, 0x000c},
2453 {0xaa, 0x11, 0x0000},
2454 {0xaa, 0x13, 0x0000},
2455 {0xaa, 0x14, 0x0001},
2456 {0xaa, 0x15, 0x00e8},
2457 {0xaa, 0x16, 0x0002},
2458 {0xaa, 0x17, 0x0088},
2459
2460 {0xa0, 0x00, 0x0019},
2461 {0xa0, 0x0d, 0x0100},
2462 {0xa0, 0x89, 0x018d},
2463 {0xa0, 0x50, 0x01a8},
2464 {0xa0, 0x00, 0x01ad},
2465 {0xa0, 0xc0, 0x019b},
2466 {0xa0, 0xa0, 0x019c},
2467 {0xa0, 0x06, 0x0189},
2468 {0xa0, 0x03, 0x01c5},
2469 {0xa0, 0x13, 0x01cb},
2470 {0xa0, 0x08, 0x0250},
2471 {0xa0, 0x08, 0x0301},
2472 {0xa1, 0x01, 0x0002},
2473 {0xa0, 0x00, 0x0092},
2474 {0xa0, 0x02, 0x0090},
2475 {0xa1, 0x01, 0x0091},
2476 {0xa1, 0x01, 0x0095},
2477 {0xa1, 0x01, 0x0096},
2478
2479 {0xa1, 0x01, 0x0008},
2480 {0xa0, 0x03, 0x0008}, /* clock ? */
2481 {0xa0, 0x08, 0x01c6},
2482 {0xa1, 0x01, 0x01c8},
2483 {0xa1, 0x01, 0x01c9},
2484 {0xa1, 0x01, 0x01ca},
2485 {0xa0, 0x0f, 0x01cb},
2486
2487 {0xa0, 0x60, 0x010a}, /* matrix */
2488 {0xa0, 0xf0, 0x010b},
2489 {0xa0, 0xf0, 0x010c},
2490 {0xa0, 0xf0, 0x010d},
2491 {0xa0, 0x60, 0x010e},
2492 {0xa0, 0xf0, 0x010f},
2493 {0xa0, 0xf0, 0x0110},
2494 {0xa0, 0xf0, 0x0111},
2495 {0xa0, 0x60, 0x0112},
2496 {0xa1, 0x01, 0x0180},
2497 {0xa0, 0x10, 0x0180},
2498 {0xa0, 0x00, 0x0019},
2499 {0xaa, 0x25, 0x0007},
2500 {0xaa, 0x26, 0x0053},
2501 {0xaa, 0x27, 0x0000},
2502
2503 {0xa0, 0x10, 0x0190}, /* 2f */
2504 {0xa0, 0x04, 0x0191}, /* 9b */
2505 {0xa0, 0x60, 0x0192}, /* 80 */
2506 {0xa0, 0x01, 0x0195},
2507 {0xa0, 0xd4, 0x0196},
2508 {0xa0, 0xc0, 0x0197},
2509 {0xa0, 0x10, 0x018c},
2510 {0xa0, 0x20, 0x018f},
2511 {0xa0, 0x60, 0x01a8},
2512 {0xa0, 0x10, 0x01a9},
2513 {0xa0, 0x13, 0x01aa},
2514 {0xa1, 0x01, 0x001d},
2515 {0xa1, 0x01, 0x001e},
2516 {0xa1, 0x01, 0x001f},
2517 {0xa1, 0x01, 0x0020},
2518 {0xa0, 0x40, 0x0180},
2519 {0xa1, 0x01, 0x0180},
2520 {0xa0, 0x42, 0x0180},
2521 {0, 0, 0}
2522};
2523
2524static struct usb_action hv7131cxx_InitialScale[] = {
2525 {0xa0, 0x01, 0x0000},
2526
2527 {0xa0, 0x00, 0x0002}, /* diff */
2528 {0xa0, 0x01, 0x0010},
2529 {0xa0, 0x01, 0x0001},
2530 {0xa0, 0x77, 0x0101},
2531 {0xa0, 0x03, 0x0008},
2532
2533 {0xa0, 0x05, 0x0012},
2534 {0xa0, 0x07, 0x0012},
2535
2536 {0xa0, 0x02, 0x0003},
2537 {0xa0, 0x80, 0x0004},
2538 {0xa0, 0x01, 0x0005},
2539 {0xa0, 0xe0, 0x0006}, /* 1e0 */
2540
2541 {0xa0, 0x00, 0x0098},
2542 {0xa0, 0x00, 0x009a},
2543 {0xa0, 0x01, 0x009b},
2544 {0xa0, 0xe8, 0x009c},
2545 {0xa0, 0x02, 0x009d},
2546 {0xa0, 0x88, 0x009e},
2547 {0xa0, 0x00, 0x011a},
2548 {0xa0, 0x00, 0x011c},
2549 {0xa0, 0x05, 0x0012},
2550 {0xaa, 0x01, 0x000c},
2551 {0xaa, 0x11, 0x0000},
2552 {0xaa, 0x13, 0x0000},
2553 {0xaa, 0x14, 0x0001},
2554 {0xaa, 0x15, 0x00e8},
2555 {0xaa, 0x16, 0x0002},
2556 {0xaa, 0x17, 0x0088},
2557
2558 {0xa0, 0x00, 0x0019}, /* 00 */
2559
2560 {0xa0, 0x0d, 0x0100},
2561 {0xa0, 0x89, 0x018d},
2562 {0xa0, 0x50, 0x01a8},
2563 {0xa0, 0x00, 0x01ad},
2564 {0xa0, 0xc0, 0x019b},
2565 {0xa0, 0xa0, 0x019c},
2566 {0xa0, 0x06, 0x0189},
2567 {0xa0, 0x03, 0x01c5},
2568 {0xa0, 0x13, 0x01cb},
2569 {0xa0, 0x08, 0x0250},
2570 {0xa0, 0x08, 0x0301},
2571 {0xa1, 0x01, 0x0002},
2572 {0xa0, 0x00, 0x0092}, /* read the i2c chips ident */
2573 {0xa0, 0x02, 0x0090},
2574 {0xa1, 0x01, 0x0091},
2575 {0xa1, 0x01, 0x0095},
2576 {0xa1, 0x01, 0x0096},
2577
2578 {0xa1, 0x01, 0x0008},
2579 {0xa0, 0x03, 0x0008}, /* clock ? */
2580 {0xa0, 0x08, 0x01c6},
2581 {0xa1, 0x01, 0x01c8},
2582 {0xa1, 0x01, 0x01c9},
2583 {0xa1, 0x01, 0x01ca},
2584 {0xa0, 0x0f, 0x01cb},
2585
2586 {0xa0, 0x60, 0x010a}, /* matrix */
2587 {0xa0, 0xf0, 0x010b},
2588 {0xa0, 0xf0, 0x010c},
2589 {0xa0, 0xf0, 0x010d},
2590 {0xa0, 0x60, 0x010e},
2591 {0xa0, 0xf0, 0x010f},
2592 {0xa0, 0xf0, 0x0110},
2593 {0xa0, 0xf0, 0x0111},
2594 {0xa0, 0x60, 0x0112},
2595 {0xa1, 0x01, 0x0180},
2596 {0xa0, 0x10, 0x0180},
2597 {0xa0, 0x00, 0x0019},
2598 {0xaa, 0x25, 0x0007},
2599 {0xaa, 0x26, 0x0053},
2600 {0xaa, 0x27, 0x0000},
2601
2602 {0xa0, 0x10, 0x0190}, /* 2f */
2603 {0xa0, 0x04, 0x0191}, /* 9b */
2604 {0xa0, 0x60, 0x0192}, /* 80 */
2605
2606 {0xa0, 0x01, 0x0195},
2607 {0xa0, 0xd4, 0x0196},
2608 {0xa0, 0xc0, 0x0197},
2609
2610 {0xa0, 0x10, 0x018c},
2611 {0xa0, 0x20, 0x018f},
2612 {0xa0, 0x60, 0x01a8},
2613 {0xa0, 0x10, 0x01a9},
2614 {0xa0, 0x13, 0x01aa},
2615 {0xa1, 0x01, 0x001d},
2616 {0xa1, 0x01, 0x001e},
2617 {0xa1, 0x01, 0x001f},
2618 {0xa1, 0x01, 0x0020},
2619 {0xa0, 0x40, 0x0180},
2620 {0xa1, 0x01, 0x0180},
2621 {0xa0, 0x42, 0x0180},
2622 {0, 0, 0}
2623};
2624
2625static struct usb_action icm105axx_Initial[] = {
2626 {0xa0, 0x01, 0x0000},
2627 {0xa0, 0x10, 0x0002},
2628 {0xa0, 0x03, 0x0008},
2629 {0xa0, 0x0c, 0x0010},
2630 {0xa0, 0x02, 0x0003},
2631 {0xa0, 0x80, 0x0004},
2632 {0xa0, 0x01, 0x0005},
2633 {0xa0, 0xe0, 0x0006},
2634 {0xa0, 0x01, 0x0001},
2635 {0xa0, 0x03, 0x0012},
2636 {0xa0, 0x01, 0x0012},
2637 {0xa0, 0xa1, 0x008b},
2638 {0xa0, 0x00, 0x0097},
2639 {0xa0, 0x01, 0x0098},
2640 {0xa0, 0x00, 0x0099},
2641 {0xa0, 0x01, 0x009a},
2642 {0xa0, 0x01, 0x011a},
2643 {0xa0, 0x01, 0x011c},
2644 {0xa0, 0x01, 0x009b},
2645 {0xa0, 0xe8, 0x009c},
2646 {0xa0, 0x02, 0x009d},
2647 {0xa0, 0x88, 0x009e},
2648 {0xa0, 0x37, 0x0101},
2649 {0xa0, 0x0d, 0x0100},
2650 {0xa0, 0x06, 0x0189},
2651 {0xa0, 0x03, 0x01c5},
2652 {0xa0, 0x13, 0x01cb},
2653 {0xaa, 0x01, 0x0010},
2654 {0xaa, 0x03, 0x0000},
2655 {0xaa, 0x04, 0x0001},
2656 {0xaa, 0x05, 0x0020},
2657 {0xaa, 0x06, 0x0001},
2658 {0xaa, 0x08, 0x0000},
2659 {0xaa, 0x03, 0x0001},
2660 {0xaa, 0x04, 0x0011},
2661 {0xaa, 0x05, 0x00a0},
2662 {0xaa, 0x06, 0x0001},
2663 {0xaa, 0x08, 0x0000},
2664 {0xaa, 0x03, 0x0002},
2665 {0xaa, 0x04, 0x0013},
2666 {0xaa, 0x05, 0x0020},
2667 {0xaa, 0x06, 0x0001},
2668 {0xaa, 0x08, 0x0000},
2669 {0xaa, 0x03, 0x0003},
2670 {0xaa, 0x04, 0x0015},
2671 {0xaa, 0x05, 0x0020},
2672 {0xaa, 0x06, 0x0005},
2673 {0xaa, 0x08, 0x0000},
2674 {0xaa, 0x03, 0x0004},
2675 {0xaa, 0x04, 0x0017},
2676 {0xaa, 0x05, 0x0020},
2677 {0xaa, 0x06, 0x000d},
2678 {0xaa, 0x08, 0x0000},
2679 {0xaa, 0x03, 0x0005},
2680 {0xaa, 0x04, 0x0019},
2681 {0xaa, 0x05, 0x0020},
2682 {0xaa, 0x06, 0x0005},
2683 {0xaa, 0x08, 0x0000},
2684 {0xaa, 0x03, 0x0006},
2685 {0xaa, 0x04, 0x0017},
2686 {0xaa, 0x05, 0x0026},
2687 {0xaa, 0x06, 0x0005},
2688 {0xaa, 0x08, 0x0000},
2689 {0xaa, 0x03, 0x0007},
2690 {0xaa, 0x04, 0x0019},
2691 {0xaa, 0x05, 0x0022},
2692 {0xaa, 0x06, 0x0005},
2693 {0xaa, 0x08, 0x0000},
2694 {0xaa, 0x03, 0x0008},
2695 {0xaa, 0x04, 0x0021},
2696 {0xaa, 0x05, 0x00aa},
2697 {0xaa, 0x06, 0x0005},
2698 {0xaa, 0x08, 0x0000},
2699 {0xaa, 0x03, 0x0009},
2700 {0xaa, 0x04, 0x0023},
2701 {0xaa, 0x05, 0x00aa},
2702 {0xaa, 0x06, 0x000d},
2703 {0xaa, 0x08, 0x0000},
2704 {0xaa, 0x03, 0x000a},
2705 {0xaa, 0x04, 0x0025},
2706 {0xaa, 0x05, 0x00aa},
2707 {0xaa, 0x06, 0x0005},
2708 {0xaa, 0x08, 0x0000},
2709 {0xaa, 0x03, 0x000b},
2710 {0xaa, 0x04, 0x00ec},
2711 {0xaa, 0x05, 0x002e},
2712 {0xaa, 0x06, 0x0005},
2713 {0xaa, 0x08, 0x0000},
2714 {0xaa, 0x03, 0x000c},
2715 {0xaa, 0x04, 0x00fa},
2716 {0xaa, 0x05, 0x002a},
2717 {0xaa, 0x06, 0x0005},
2718 {0xaa, 0x08, 0x0000},
2719 {0xaa, 0x07, 0x000d},
2720 {0xaa, 0x01, 0x0005},
2721 {0xaa, 0x94, 0x0002},
2722 {0xaa, 0x90, 0x0000},
2723 {0xaa, 0x91, 0x001f},
2724 {0xaa, 0x10, 0x0064},
2725 {0xaa, 0x9b, 0x00f0},
2726 {0xaa, 0x9c, 0x0002},
2727 {0xaa, 0x14, 0x001a},
2728 {0xaa, 0x20, 0x0080},
2729 {0xaa, 0x22, 0x0080},
2730 {0xaa, 0x24, 0x0080},
2731 {0xaa, 0x26, 0x0080},
2732 {0xaa, 0x00, 0x0084},
2733 {0xa0, 0x08, 0x0250},
2734 {0xa0, 0x08, 0x0301},
2735 {0xaa, 0xa8, 0x00c0},
2736 {0xa1, 0x01, 0x0002},
2737 {0xa1, 0x01, 0x0008},
2738 {0xa1, 0x01, 0x0180},
2739 {0xa0, 0x02, 0x0180},
2740 {0xa0, 0x40, 0x0116},
2741 {0xa0, 0x40, 0x0117},
2742 {0xa0, 0x40, 0x0118},
2743 {0xa1, 0x01, 0x0008},
2744
2745 {0xa0, 0x03, 0x0008}, /* clock ? */
2746 {0xa0, 0x08, 0x01c6},
2747 {0xa1, 0x01, 0x01c8},
2748 {0xa1, 0x01, 0x01c9},
2749 {0xa1, 0x01, 0x01ca},
2750 {0xa0, 0x0f, 0x01cb},
2751 {0xa0, 0x52, 0x010a}, /* matrix */
2752 {0xa0, 0xf7, 0x010b},
2753 {0xa0, 0xf7, 0x010c},
2754 {0xa0, 0xf7, 0x010d},
2755 {0xa0, 0x52, 0x010e},
2756 {0xa0, 0xf7, 0x010f},
2757 {0xa0, 0xf7, 0x0110},
2758 {0xa0, 0xf7, 0x0111},
2759 {0xa0, 0x52, 0x0112},
2760 {0xa1, 0x01, 0x0180},
2761 {0xa0, 0x00, 0x0180},
2762 {0xa0, 0x00, 0x0019},
2763 {0xaa, 0x0d, 0x0003},
2764 {0xaa, 0x0c, 0x008c},
2765 {0xaa, 0x0e, 0x0095},
2766 {0xaa, 0x0f, 0x0002},
2767 {0xaa, 0x1c, 0x0094},
2768 {0xaa, 0x1d, 0x0002},
2769 {0xaa, 0x20, 0x0080},
2770 {0xaa, 0x22, 0x0080},
2771 {0xaa, 0x24, 0x0080},
2772 {0xaa, 0x26, 0x0080},
2773 {0xaa, 0x00, 0x0084},
2774 {0xa0, 0x02, 0x00a3},
2775 {0xa0, 0x94, 0x00a4},
2776 {0xa0, 0x00, 0x0190},
2777 {0xa0, 0x04, 0x0191},
2778 {0xa0, 0x20, 0x0192},
2779 {0xa0, 0x00, 0x0195},
2780 {0xa0, 0x00, 0x0196},
2781 {0xa0, 0x84, 0x0197},
2782 {0xa0, 0x10, 0x018c},
2783 {0xa0, 0x20, 0x018f},
2784 {0xa0, 0x10, 0x01a9},
2785 {0xa0, 0x12, 0x01aa},
2786 {0xa0, 0xe3, 0x001d},
2787 {0xa0, 0xec, 0x001e},
2788 {0xa0, 0xf5, 0x001f},
2789 {0xa0, 0xff, 0x0020},
2790 {0xa0, 0x00, 0x01a7},
2791 {0xa0, 0xc0, 0x01a8},
2792 {0xa0, 0xc0, 0x011d},
2793 {0xa0, 0x42, 0x0180},
2794 {0xa1, 0x01, 0x0180},
2795 {0xa0, 0x42, 0x0180},
2796 {0xa0, 0x40, 0x0116},
2797 {0xa0, 0x40, 0x0117},
2798 {0xa0, 0x40, 0x0118},
2799 {0, 0, 0}
2800};
2801
2802static struct usb_action icm105axx_InitialScale[] = {
2803 {0xa0, 0x01, 0x0000},
2804 {0xa0, 0x00, 0x0002},
2805 {0xa0, 0x03, 0x0008},
2806 {0xa0, 0x0c, 0x0010},
2807 {0xa0, 0x02, 0x0003},
2808 {0xa0, 0x80, 0x0004},
2809 {0xa0, 0x01, 0x0005},
2810 {0xa0, 0xe0, 0x0006},
2811 {0xa0, 0x01, 0x0001},
2812 {0xa0, 0x03, 0x0012},
2813 {0xa0, 0x01, 0x0012},
2814 {0xa0, 0xa1, 0x008b},
2815 {0xa0, 0x00, 0x0097},
2816 {0xa0, 0x02, 0x0098},
2817 {0xa0, 0x00, 0x0099},
2818 {0xa0, 0x02, 0x009a},
2819 {0xa0, 0x02, 0x011a},
2820 {0xa0, 0x02, 0x011c},
2821 {0xa0, 0x01, 0x009b},
2822 {0xa0, 0xe6, 0x009c},
2823 {0xa0, 0x02, 0x009d},
2824 {0xa0, 0x86, 0x009e},
2825 {0xa0, 0x77, 0x0101},
2826 {0xa0, 0x0d, 0x0100},
2827 {0xa0, 0x06, 0x0189},
2828 {0xa0, 0x03, 0x01c5},
2829 {0xa0, 0x13, 0x01cb},
2830 {0xaa, 0x01, 0x0010},
2831 {0xaa, 0x03, 0x0000},
2832 {0xaa, 0x04, 0x0001},
2833 {0xaa, 0x05, 0x0020},
2834 {0xaa, 0x06, 0x0001},
2835 {0xaa, 0x08, 0x0000},
2836 {0xaa, 0x03, 0x0001},
2837 {0xaa, 0x04, 0x0011},
2838 {0xaa, 0x05, 0x00a0},
2839 {0xaa, 0x06, 0x0001},
2840 {0xaa, 0x08, 0x0000},
2841 {0xaa, 0x03, 0x0002},
2842 {0xaa, 0x04, 0x0013},
2843 {0xaa, 0x05, 0x0020},
2844 {0xaa, 0x06, 0x0001},
2845 {0xaa, 0x08, 0x0000},
2846 {0xaa, 0x03, 0x0003},
2847 {0xaa, 0x04, 0x0015},
2848 {0xaa, 0x05, 0x0020},
2849 {0xaa, 0x06, 0x0005},
2850 {0xaa, 0x08, 0x0000},
2851 {0xaa, 0x03, 0x0004},
2852 {0xaa, 0x04, 0x0017},
2853 {0xaa, 0x05, 0x0020},
2854 {0xaa, 0x06, 0x000d},
2855 {0xaa, 0x08, 0x0000},
2856 {0xaa, 0x03, 0x0005},
2857 {0xa0, 0x04, 0x0092},
2858 {0xa0, 0x19, 0x0093},
2859 {0xa0, 0x01, 0x0090},
2860 {0xa1, 0x01, 0x0091},
2861 {0xaa, 0x05, 0x0020},
2862 {0xaa, 0x06, 0x0005},
2863 {0xaa, 0x08, 0x0000},
2864 {0xaa, 0x03, 0x0006},
2865 {0xaa, 0x04, 0x0017},
2866 {0xaa, 0x05, 0x0026},
2867 {0xaa, 0x06, 0x0005},
2868 {0xaa, 0x08, 0x0000},
2869 {0xaa, 0x03, 0x0007},
2870 {0xaa, 0x04, 0x0019},
2871 {0xaa, 0x05, 0x0022},
2872 {0xaa, 0x06, 0x0005},
2873 {0xaa, 0x08, 0x0000},
2874 {0xaa, 0x03, 0x0008},
2875 {0xaa, 0x04, 0x0021},
2876 {0xaa, 0x05, 0x00aa},
2877 {0xaa, 0x06, 0x0005},
2878 {0xaa, 0x08, 0x0000},
2879 {0xaa, 0x03, 0x0009},
2880 {0xaa, 0x04, 0x0023},
2881 {0xaa, 0x05, 0x00aa},
2882 {0xaa, 0x06, 0x000d},
2883 {0xaa, 0x08, 0x0000},
2884 {0xaa, 0x03, 0x000a},
2885 {0xaa, 0x04, 0x0025},
2886 {0xaa, 0x05, 0x00aa},
2887 {0xaa, 0x06, 0x0005},
2888 {0xaa, 0x08, 0x0000},
2889 {0xaa, 0x03, 0x000b},
2890 {0xaa, 0x04, 0x00ec},
2891 {0xaa, 0x05, 0x002e},
2892 {0xaa, 0x06, 0x0005},
2893 {0xaa, 0x08, 0x0000},
2894 {0xaa, 0x03, 0x000c},
2895 {0xaa, 0x04, 0x00fa},
2896 {0xaa, 0x05, 0x002a},
2897 {0xaa, 0x06, 0x0005},
2898 {0xaa, 0x08, 0x0000},
2899 {0xaa, 0x07, 0x000d},
2900 {0xaa, 0x01, 0x0005},
2901 {0xaa, 0x94, 0x0002},
2902 {0xaa, 0x90, 0x0000},
2903 {0xaa, 0x91, 0x0010},
2904 {0xaa, 0x10, 0x0064},
2905 {0xaa, 0x9b, 0x00f0},
2906 {0xaa, 0x9c, 0x0002},
2907 {0xaa, 0x14, 0x001a},
2908 {0xaa, 0x20, 0x0080},
2909 {0xaa, 0x22, 0x0080},
2910 {0xaa, 0x24, 0x0080},
2911 {0xaa, 0x26, 0x0080},
2912 {0xaa, 0x00, 0x0084},
2913 {0xa0, 0x08, 0x0250},
2914 {0xa0, 0x08, 0x0301},
2915 {0xaa, 0xa8, 0x0080},
2916 {0xa0, 0x78, 0x018d},
2917 {0xa1, 0x01, 0x0002},
2918 {0xa1, 0x01, 0x0008},
2919 {0xa1, 0x01, 0x0180},
2920 {0xa0, 0x02, 0x0180},
2921 {0xa0, 0x40, 0x0116},
2922 {0xa0, 0x40, 0x0117},
2923 {0xa0, 0x40, 0x0118},
2924 {0xa1, 0x01, 0x0008},
2925
2926 {0xa0, 0x03, 0x0008}, /* clock ? */
2927 {0xa0, 0x08, 0x01c6},
2928 {0xa1, 0x01, 0x01c8},
2929 {0xa1, 0x01, 0x01c9},
2930 {0xa1, 0x01, 0x01ca},
2931 {0xa0, 0x0f, 0x01cb},
2932
2933 {0xa0, 0x52, 0x010a}, /* matrix */
2934 {0xa0, 0xf7, 0x010b},
2935 {0xa0, 0xf7, 0x010c},
2936 {0xa0, 0xf7, 0x010d},
2937 {0xa0, 0x52, 0x010e},
2938 {0xa0, 0xf7, 0x010f},
2939 {0xa0, 0xf7, 0x0110},
2940 {0xa0, 0xf7, 0x0111},
2941 {0xa0, 0x52, 0x0112},
2942 {0xa1, 0x01, 0x0180},
2943 {0xa0, 0x00, 0x0180},
2944 {0xa0, 0x00, 0x0019},
2945 {0xaa, 0x0d, 0x0003},
2946 {0xaa, 0x0c, 0x0020},
2947 {0xaa, 0x0e, 0x000e},
2948 {0xaa, 0x0f, 0x0002},
2949 {0xaa, 0x1c, 0x000d},
2950 {0xaa, 0x1d, 0x0002},
2951 {0xaa, 0x20, 0x0080},
2952 {0xaa, 0x22, 0x0080},
2953 {0xaa, 0x24, 0x0080},
2954 {0xaa, 0x26, 0x0080},
2955 {0xaa, 0x00, 0x0084},
2956 {0xa0, 0x02, 0x00a3},
2957 {0xa0, 0x0d, 0x00a4},
2958 {0xa0, 0x00, 0x0190},
2959 {0xa0, 0x04, 0x0191},
2960 {0xa0, 0x1a, 0x0192},
2961 {0xa0, 0x00, 0x0195},
2962 {0xa0, 0x00, 0x0196},
2963 {0xa0, 0x4b, 0x0197},
2964 {0xa0, 0x10, 0x018c},
2965 {0xa0, 0x20, 0x018f},
2966 {0xa0, 0x10, 0x01a9},
2967 {0xa0, 0x12, 0x01aa},
2968 {0xa0, 0xc8, 0x001d},
2969 {0xa0, 0xd8, 0x001e},
2970 {0xa0, 0xea, 0x001f},
2971 {0xa0, 0xff, 0x0020},
2972 {0xa0, 0x00, 0x01a7},
2973 {0xa0, 0x42, 0x0180},
2974 {0xa1, 0x01, 0x0180},
2975 {0xa0, 0x42, 0x0180},
2976 {0xa0, 0x40, 0x0116},
2977 {0xa0, 0x40, 0x0117},
2978 {0xa0, 0x40, 0x0118},
2979 {0, 0, 0}
2980};
2981static struct usb_action icm105a_50HZ[] = {
2982 {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
2983 {0xaa, 0x0d, 0x0003}, /* 00,0d,03,aa */
2984 {0xaa, 0x0c, 0x0020}, /* 00,0c,20,aa */
2985 {0xaa, 0x0e, 0x000e}, /* 00,0e,0e,aa */
2986 {0xaa, 0x0f, 0x0002}, /* 00,0f,02,aa */
2987 {0xaa, 0x1c, 0x000d}, /* 00,1c,0d,aa */
2988 {0xaa, 0x1d, 0x0002}, /* 00,1d,02,aa */
2989 {0xaa, 0x20, 0x0080}, /* 00,20,80,aa */
2990 {0xaa, 0x22, 0x0080}, /* 00,22,80,aa */
2991 {0xaa, 0x24, 0x0080}, /* 00,24,80,aa */
2992 {0xaa, 0x26, 0x0080}, /* 00,26,80,aa */
2993 {0xaa, 0x00, 0x0084}, /* 00,00,84,aa */
2994 {0xa0, 0x02, 0x00a3}, /* 00,a3,02,cc */
2995 {0xa0, 0x0d, 0x00a4}, /* 00,a4,0d,cc */
2996 {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
2997 {0xa0, 0x04, 0x0191}, /* 01,91,04,cc */
2998 {0xa0, 0x1a, 0x0192}, /* 01,92,1a,cc */
2999 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */
3000 {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */
3001 {0xa0, 0x4b, 0x0197}, /* 01,97,4b,cc */
3002 {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */
3003 {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */
3004 {0xa0, 0x10, 0x01a9}, /* 01,a9,10,cc */
3005 {0xa0, 0x12, 0x01aa}, /* 01,aa,12,cc */
3006 {0xa0, 0xc8, 0x001d}, /* 00,1d,c8,cc */
3007 {0xa0, 0xd8, 0x001e}, /* 00,1e,d8,cc */
3008 {0xa0, 0xea, 0x001f}, /* 00,1f,ea,cc */
3009 {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc */
3010 {0, 0, 0}
3011};
3012static struct usb_action icm105a_50HZScale[] = {
3013 {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
3014 {0xaa, 0x0d, 0x0003}, /* 00,0d,03,aa */
3015 {0xaa, 0x0c, 0x008c}, /* 00,0c,8c,aa */
3016 {0xaa, 0x0e, 0x0095}, /* 00,0e,95,aa */
3017 {0xaa, 0x0f, 0x0002}, /* 00,0f,02,aa */
3018 {0xaa, 0x1c, 0x0094}, /* 00,1c,94,aa */
3019 {0xaa, 0x1d, 0x0002}, /* 00,1d,02,aa */
3020 {0xaa, 0x20, 0x0080}, /* 00,20,80,aa */
3021 {0xaa, 0x22, 0x0080}, /* 00,22,80,aa */
3022 {0xaa, 0x24, 0x0080}, /* 00,24,80,aa */
3023 {0xaa, 0x26, 0x0080}, /* 00,26,80,aa */
3024 {0xaa, 0x00, 0x0084}, /* 00,00,84,aa */
3025 {0xa0, 0x02, 0x00a3}, /* 00,a3,02,cc */
3026 {0xa0, 0x94, 0x00a4}, /* 00,a4,94,cc */
3027 {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
3028 {0xa0, 0x04, 0x0191}, /* 01,91,04,cc */
3029 {0xa0, 0x20, 0x0192}, /* 01,92,20,cc */
3030 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */
3031 {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */
3032 {0xa0, 0x84, 0x0197}, /* 01,97,84,cc */
3033 {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */
3034 {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */
3035 {0xa0, 0x10, 0x01a9}, /* 01,a9,10,cc */
3036 {0xa0, 0x12, 0x01aa}, /* 01,aa,12,cc */
3037 {0xa0, 0xe3, 0x001d}, /* 00,1d,e3,cc */
3038 {0xa0, 0xec, 0x001e}, /* 00,1e,ec,cc */
3039 {0xa0, 0xf5, 0x001f}, /* 00,1f,f5,cc */
3040 {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc */
3041 {0xa0, 0x00, 0x01a7}, /* 01,a7,00,cc */
3042 {0xa0, 0xc0, 0x01a8}, /* 01,a8,c0,cc */
3043 {0, 0, 0}
3044};
3045static struct usb_action icm105a_60HZ[] = {
3046 {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
3047 {0xaa, 0x0d, 0x0003}, /* 00,0d,03,aa */
3048 {0xaa, 0x0c, 0x0004}, /* 00,0c,04,aa */
3049 {0xaa, 0x0e, 0x000d}, /* 00,0e,0d,aa */
3050 {0xaa, 0x0f, 0x0002}, /* 00,0f,02,aa */
3051 {0xaa, 0x1c, 0x0008}, /* 00,1c,08,aa */
3052 {0xaa, 0x1d, 0x0002}, /* 00,1d,02,aa */
3053 {0xaa, 0x20, 0x0080}, /* 00,20,80,aa */
3054 {0xaa, 0x22, 0x0080}, /* 00,22,80,aa */
3055 {0xaa, 0x24, 0x0080}, /* 00,24,80,aa */
3056 {0xaa, 0x26, 0x0080}, /* 00,26,80,aa */
3057 {0xaa, 0x00, 0x0084}, /* 00,00,84,aa */
3058 {0xa0, 0x02, 0x00a3}, /* 00,a3,02,cc */
3059 {0xa0, 0x08, 0x00a4}, /* 00,a4,08,cc */
3060 {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
3061 {0xa0, 0x04, 0x0191}, /* 01,91,04,cc */
3062 {0xa0, 0x10, 0x0192}, /* 01,92,10,cc */
3063 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */
3064 {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */
3065 {0xa0, 0x41, 0x0197}, /* 01,97,41,cc */
3066 {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */
3067 {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */
3068 {0xa0, 0x10, 0x01a9}, /* 01,a9,10,cc */
3069 {0xa0, 0x12, 0x01aa}, /* 01,aa,12,cc */
3070 {0xa0, 0xc1, 0x001d}, /* 00,1d,c1,cc */
3071 {0xa0, 0xd4, 0x001e}, /* 00,1e,d4,cc */
3072 {0xa0, 0xe8, 0x001f}, /* 00,1f,e8,cc */
3073 {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc */
3074 {0, 0, 0}
3075};
3076static struct usb_action icm105a_60HZScale[] = {
3077 {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
3078 {0xaa, 0x0d, 0x0003}, /* 00,0d,03,aa */
3079 {0xaa, 0x0c, 0x0008}, /* 00,0c,08,aa */
3080 {0xaa, 0x0e, 0x0086}, /* 00,0e,86,aa */
3081 {0xaa, 0x0f, 0x0002}, /* 00,0f,02,aa */
3082 {0xaa, 0x1c, 0x0085}, /* 00,1c,85,aa */
3083 {0xaa, 0x1d, 0x0002}, /* 00,1d,02,aa */
3084 {0xaa, 0x20, 0x0080}, /* 00,20,80,aa */
3085 {0xaa, 0x22, 0x0080}, /* 00,22,80,aa */
3086 {0xaa, 0x24, 0x0080}, /* 00,24,80,aa */
3087 {0xaa, 0x26, 0x0080}, /* 00,26,80,aa */
3088 {0xaa, 0x00, 0x0084}, /* 00,00,84,aa */
3089 {0xa0, 0x02, 0x00a3}, /* 00,a3,02,cc */
3090 {0xa0, 0x85, 0x00a4}, /* 00,a4,85,cc */
3091 {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
3092 {0xa0, 0x04, 0x0191}, /* 01,91,04,cc */
3093 {0xa0, 0x08, 0x0192}, /* 01,92,08,cc */
3094 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */
3095 {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */
3096 {0xa0, 0x81, 0x0197}, /* 01,97,81,cc */
3097 {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */
3098 {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */
3099 {0xa0, 0x10, 0x01a9}, /* 01,a9,10,cc */
3100 {0xa0, 0x12, 0x01aa}, /* 01,aa,12,cc */
3101 {0xa0, 0xc2, 0x001d}, /* 00,1d,c2,cc */
3102 {0xa0, 0xd6, 0x001e}, /* 00,1e,d6,cc */
3103 {0xa0, 0xea, 0x001f}, /* 00,1f,ea,cc */
3104 {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc */
3105 {0xa0, 0x00, 0x01a7}, /* 01,a7,00,cc */
3106 {0xa0, 0xc0, 0x01a8}, /* 01,a8,c0,cc */
3107 {0, 0, 0}
3108};
3109static struct usb_action icm105a_NoFliker[] = {
3110 {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
3111 {0xaa, 0x0d, 0x0003}, /* 00,0d,03,aa */
3112 {0xaa, 0x0c, 0x0004}, /* 00,0c,04,aa */
3113 {0xaa, 0x0e, 0x000d}, /* 00,0e,0d,aa */
3114 {0xaa, 0x0f, 0x0002}, /* 00,0f,02,aa */
3115 {0xaa, 0x1c, 0x0000}, /* 00,1c,00,aa */
3116 {0xaa, 0x1d, 0x0002}, /* 00,1d,02,aa */
3117 {0xaa, 0x20, 0x0080}, /* 00,20,80,aa */
3118 {0xaa, 0x22, 0x0080}, /* 00,22,80,aa */
3119 {0xaa, 0x24, 0x0080}, /* 00,24,80,aa */
3120 {0xaa, 0x26, 0x0080}, /* 00,26,80,aa */
3121 {0xaa, 0x00, 0x0084}, /* 00,00,84,aa */
3122 {0xa0, 0x02, 0x00a3}, /* 00,a3,02,cc */
3123 {0xa0, 0x00, 0x00a4}, /* 00,a4,00,cc */
3124 {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
3125 {0xa0, 0x04, 0x0191}, /* 01,91,04,cc */
3126 {0xa0, 0x20, 0x0192}, /* 01,92,20,cc */
3127 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */
3128 {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */
3129 {0xa0, 0x10, 0x0197}, /* 01,97,10,cc */
3130 {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */
3131 {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */
3132 {0xa0, 0x00, 0x01a9}, /* 01,a9,00,cc */
3133 {0xa0, 0x00, 0x01aa}, /* 01,aa,00,cc */
3134 {0xa0, 0xc1, 0x001d}, /* 00,1d,c1,cc */
3135 {0xa0, 0xd4, 0x001e}, /* 00,1e,d4,cc */
3136 {0xa0, 0xe8, 0x001f}, /* 00,1f,e8,cc */
3137 {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc */
3138 {0, 0, 0}
3139};
3140static struct usb_action icm105a_NoFlikerScale[] = {
3141 {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
3142 {0xaa, 0x0d, 0x0003}, /* 00,0d,03,aa */
3143 {0xaa, 0x0c, 0x0004}, /* 00,0c,04,aa */
3144 {0xaa, 0x0e, 0x0081}, /* 00,0e,81,aa */
3145 {0xaa, 0x0f, 0x0002}, /* 00,0f,02,aa */
3146 {0xaa, 0x1c, 0x0080}, /* 00,1c,80,aa */
3147 {0xaa, 0x1d, 0x0002}, /* 00,1d,02,aa */
3148 {0xaa, 0x20, 0x0080}, /* 00,20,80,aa */
3149 {0xaa, 0x22, 0x0080}, /* 00,22,80,aa */
3150 {0xaa, 0x24, 0x0080}, /* 00,24,80,aa */
3151 {0xaa, 0x26, 0x0080}, /* 00,26,80,aa */
3152 {0xaa, 0x00, 0x0084}, /* 00,00,84,aa */
3153 {0xa0, 0x02, 0x00a3}, /* 00,a3,02,cc */
3154 {0xa0, 0x80, 0x00a4}, /* 00,a4,80,cc */
3155 {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
3156 {0xa0, 0x04, 0x0191}, /* 01,91,04,cc */
3157 {0xa0, 0x20, 0x0192}, /* 01,92,20,cc */
3158 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */
3159 {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */
3160 {0xa0, 0x10, 0x0197}, /* 01,97,10,cc */
3161 {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */
3162 {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */
3163 {0xa0, 0x00, 0x01a9}, /* 01,a9,00,cc */
3164 {0xa0, 0x00, 0x01aa}, /* 01,aa,00,cc */
3165 {0xa0, 0xc1, 0x001d}, /* 00,1d,c1,cc */
3166 {0xa0, 0xd4, 0x001e}, /* 00,1e,d4,cc */
3167 {0xa0, 0xe8, 0x001f}, /* 00,1f,e8,cc */
3168 {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc */
3169 {0xa0, 0x00, 0x01a7}, /* 01,a7,00,cc */
3170 {0xa0, 0xc0, 0x01a8}, /* 01,a8,c0,cc */
3171 {0, 0, 0}
3172};
3173
3174static struct usb_action MC501CB_InitialScale[] = {
3175 {0xa0, 0x01, 0x0000}, /* 00,00,01,cc */
3176 {0xa0, 0x00, 0x0002}, /* 00,02,00,cc */
3177 {0xa0, 0x01, 0x0010}, /* 00,10,01,cc */
3178 {0xa0, 0x01, 0x0001}, /* 00,01,01,cc */
3179 {0xa0, 0x03, 0x0008}, /* 00,08,03,cc */
3180 {0xa0, 0x01, 0x0012}, /* 00,12,01,cc */
3181 {0xa0, 0x05, 0x0012}, /* 00,12,05,cc */
3182 {0xa0, 0x02, 0x0003}, /* 00,03,02,cc */
3183 {0xa0, 0x80, 0x0004}, /* 00,04,80,cc */
3184 {0xa0, 0x01, 0x0005}, /* 00,05,01,cc */
3185 {0xa0, 0xd8, 0x0006}, /* 00,06,d8,cc */
3186 {0xa0, 0x00, 0x0098}, /* 00,98,00,cc */
3187 {0xa0, 0x00, 0x009a}, /* 00,9a,00,cc */
3188 {0xa0, 0x00, 0x011a}, /* 01,1a,00,cc */
3189 {0xa0, 0x00, 0x011c}, /* 01,1c,00,cc */
3190 {0xa0, 0x01, 0x009b}, /* 00,9b,01,cc */
3191 {0xa0, 0xde, 0x009c}, /* 00,9c,de,cc */
3192 {0xa0, 0x02, 0x009d}, /* 00,9d,02,cc */
3193 {0xa0, 0x86, 0x009e}, /* 00,9e,86,cc */
3194 {0xa0, 0x33, 0x0086}, /* 00,86,33,cc */
3195 {0xa0, 0x34, 0x0087}, /* 00,87,34,cc */
3196 {0xa0, 0x35, 0x0088}, /* 00,88,35,cc */
3197 {0xa0, 0xb0, 0x008b}, /* 00,8b,b0,cc */
3198 {0xa0, 0x05, 0x0012}, /* 00,12,05,cc */
3199 {0xaa, 0x01, 0x0001}, /* 00,01,01,aa */
3200 {0xaa, 0x01, 0x0003}, /* 00,01,03,aa */
3201 {0xaa, 0x01, 0x0001}, /* 00,01,01,aa */
3202 {0xaa, 0x03, 0x0000}, /* 00,03,00,aa */
3203 {0xaa, 0x10, 0x0000}, /* 00,10,00,aa */
3204 {0xaa, 0x11, 0x0080}, /* 00,11,80,aa */
3205 {0xaa, 0x12, 0x0000}, /* 00,12,00,aa */
3206 {0xaa, 0x13, 0x0000}, /* 00,13,00,aa */
3207 {0xaa, 0x14, 0x0000}, /* 00,14,00,aa */
3208 {0xaa, 0x15, 0x0000}, /* 00,15,00,aa */
3209 {0xaa, 0x16, 0x0000}, /* 00,16,00,aa */
3210 {0xaa, 0x17, 0x0001}, /* 00,17,01,aa */
3211 {0xaa, 0x18, 0x00de}, /* 00,18,de,aa */
3212 {0xaa, 0x19, 0x0002}, /* 00,19,02,aa */
3213 {0xaa, 0x1a, 0x0086}, /* 00,1a,86,aa */
3214 {0xaa, 0x20, 0x00a8}, /* 00,20,a8,aa */
3215 {0xaa, 0x22, 0x0000}, /* 00,22,00,aa */
3216 {0xaa, 0x23, 0x0000}, /* 00,23,00,aa */
3217 {0xaa, 0x24, 0x0000}, /* 00,24,00,aa */
3218 {0xaa, 0x40, 0x0033}, /* 00,40,33,aa */
3219 {0xaa, 0x41, 0x0077}, /* 00,41,77,aa */
3220 {0xaa, 0x42, 0x0053}, /* 00,42,53,aa */
3221 {0xaa, 0x43, 0x00b0}, /* 00,43,b0,aa */
3222 {0xaa, 0x4b, 0x0001}, /* 00,4b,01,aa */
3223 {0xaa, 0x72, 0x0020}, /* 00,72,20,aa */
3224 {0xaa, 0x73, 0x0000}, /* 00,73,00,aa */
3225 {0xaa, 0x80, 0x0000}, /* 00,80,00,aa */
3226 {0xaa, 0x85, 0x0050}, /* 00,85,50,aa */
3227 {0xaa, 0x91, 0x0070}, /* 00,91,70,aa */
3228 {0xaa, 0x92, 0x0072}, /* 00,92,72,aa */
3229 {0xaa, 0x03, 0x0001}, /* 00,03,01,aa */
3230 {0xaa, 0x10, 0x00a0}, /* 00,10,a0,aa */
3231 {0xaa, 0x11, 0x0001}, /* 00,11,01,aa */
3232 {0xaa, 0x30, 0x0000}, /* 00,30,00,aa */
3233 {0xaa, 0x60, 0x0000}, /* 00,60,00,aa */
3234 {0xaa, 0xa0, 0x001a}, /* 00,a0,1a,aa */
3235 {0xaa, 0xa1, 0x0000}, /* 00,a1,00,aa */
3236 {0xaa, 0xa2, 0x003f}, /* 00,a2,3f,aa */
3237 {0xaa, 0xa3, 0x0028}, /* 00,a3,28,aa */
3238 {0xaa, 0xa4, 0x0010}, /* 00,a4,10,aa */
3239 {0xaa, 0xa5, 0x0020}, /* 00,a5,20,aa */
3240 {0xaa, 0xb1, 0x0044}, /* 00,b1,44,aa */
3241 {0xaa, 0xd0, 0x0001}, /* 00,d0,01,aa */
3242 {0xaa, 0xd1, 0x0085}, /* 00,d1,85,aa */
3243 {0xaa, 0xd2, 0x0080}, /* 00,d2,80,aa */
3244 {0xaa, 0xd3, 0x0080}, /* 00,d3,80,aa */
3245 {0xaa, 0xd4, 0x0080}, /* 00,d4,80,aa */
3246 {0xaa, 0xd5, 0x0080}, /* 00,d5,80,aa */
3247 {0xaa, 0xc0, 0x00c3}, /* 00,c0,c3,aa */
3248 {0xaa, 0xc2, 0x0044}, /* 00,c2,44,aa */
3249 {0xaa, 0xc4, 0x0040}, /* 00,c4,40,aa */
3250 {0xaa, 0xc5, 0x0020}, /* 00,c5,20,aa */
3251 {0xaa, 0xc6, 0x0008}, /* 00,c6,08,aa */
3252 {0xaa, 0x03, 0x0004}, /* 00,03,04,aa */
3253 {0xaa, 0x10, 0x0000}, /* 00,10,00,aa */
3254 {0xaa, 0x40, 0x0030}, /* 00,40,30,aa */
3255 {0xaa, 0x41, 0x0020}, /* 00,41,20,aa */
3256 {0xaa, 0x42, 0x002d}, /* 00,42,2d,aa */
3257 {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */
3258 {0xaa, 0x1c, 0x0050}, /* 00,1C,50,aa */
3259 {0xaa, 0x11, 0x0081}, /* 00,11,81,aa */
3260 {0xaa, 0x3b, 0x001d}, /* 00,3b,1D,aa */
3261 {0xaa, 0x3c, 0x004c}, /* 00,3c,4C,aa */
3262 {0xaa, 0x3d, 0x0018}, /* 00,3d,18,aa */
3263 {0xaa, 0x3e, 0x006a}, /* 00,3e,6A,aa */
3264 {0xaa, 0x01, 0x0000}, /* 00,01,00,aa */
3265 {0xaa, 0x52, 0x00ff}, /* 00,52,FF,aa */
3266 {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
3267 {0xa0, 0x0d, 0x0100}, /* 01,00,0d,cc */
3268 {0xa0, 0x37, 0x0101}, /* 01,01,37,cc */
3269 {0xa0, 0x06, 0x0189}, /* 01,89,06,cc */
3270 {0xa0, 0x03, 0x01c5}, /* 01,c5,03,cc */
3271 {0xa0, 0x13, 0x01cb}, /* 01,cb,13,cc */
3272 {0xa0, 0x08, 0x0250}, /* 02,50,08,cc */
3273 {0xa0, 0x08, 0x0301}, /* 03,01,08,cc */
3274 {0xa0, 0x02, 0x0180}, /* 01,80,02,cc */
3275 {0xaa, 0x03, 0x0002}, /* 00,03,02,aa */
3276 {0xaa, 0x51, 0x0027}, /* 00,51,27,aa */
3277 {0xaa, 0x52, 0x0020}, /* 00,52,20,aa */
3278 {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */
3279 {0xaa, 0x50, 0x0010}, /* 00,50,10,aa */
3280 {0xaa, 0x51, 0x0010}, /* 00,51,10,aa */
3281 {0xaa, 0x54, 0x0010}, /* 00,54,10,aa */
3282 {0xaa, 0x55, 0x0010}, /* 00,55,10,aa */
3283 {0xa0, 0xf0, 0x0199}, /* 01,99,F0,cc */
3284 {0xa0, 0x80, 0x019a}, /* 01,9A,80,cc */
3285
3286 {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */
3287 {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */
3288 {0xaa, 0x36, 0x001d}, /* 00,36,1D,aa */
3289 {0xaa, 0x37, 0x004c}, /* 00,37,4C,aa */
3290 {0xaa, 0x3b, 0x001d}, /* 00,3B,1D,aa */
3291 {0, 0, 0}
3292};
3293
3294static struct usb_action MC501CB_Initial[] = { /* 320x240 */
3295 {0xa0, 0x01, 0x0000}, /* 00,00,01,cc */
3296 {0xa0, 0x10, 0x0002}, /* 00,02,10,cc */
3297 {0xa0, 0x01, 0x0010}, /* 00,10,01,cc */
3298 {0xa0, 0x01, 0x0001}, /* 00,01,01,cc */
3299 {0xa0, 0x03, 0x0008}, /* 00,08,03,cc */
3300 {0xa0, 0x01, 0x0012}, /* 00,12,01,cc */
3301 {0xa0, 0x05, 0x0012}, /* 00,12,05,cc */
3302 {0xa0, 0x02, 0x0003}, /* 00,03,02,cc */
3303 {0xa0, 0x80, 0x0004}, /* 00,04,80,cc */
3304 {0xa0, 0x01, 0x0005}, /* 00,05,01,cc */
3305 {0xa0, 0xd0, 0x0006}, /* 00,06,d0,cc */
3306 {0xa0, 0x00, 0x0098}, /* 00,98,00,cc */
3307 {0xa0, 0x00, 0x009a}, /* 00,9a,00,cc */
3308 {0xa0, 0x00, 0x011a}, /* 01,1a,00,cc */
3309 {0xa0, 0x00, 0x011c}, /* 01,1c,00,cc */
3310 {0xa0, 0x01, 0x009b}, /* 00,9b,01,cc */
3311 {0xa0, 0xd8, 0x009c}, /* 00,9c,d8,cc */
3312 {0xa0, 0x02, 0x009d}, /* 00,9d,02,cc */
3313 {0xa0, 0x88, 0x009e}, /* 00,9e,88,cc */
3314 {0xa0, 0x33, 0x0086}, /* 00,86,33,cc */
3315 {0xa0, 0x34, 0x0087}, /* 00,87,34,cc */
3316 {0xa0, 0x35, 0x0088}, /* 00,88,35,cc */
3317 {0xa0, 0xb0, 0x008b}, /* 00,8b,b0,cc */
3318 {0xa0, 0x05, 0x0012}, /* 00,12,05,cc */
3319 {0xaa, 0x01, 0x0001}, /* 00,01,01,aa */
3320 {0xaa, 0x01, 0x0003}, /* 00,01,03,aa */
3321 {0xaa, 0x01, 0x0001}, /* 00,01,01,aa */
3322 {0xaa, 0x03, 0x0000}, /* 00,03,00,aa */
3323 {0xaa, 0x10, 0x0000}, /* 00,10,00,aa */
3324 {0xaa, 0x11, 0x0080}, /* 00,11,80,aa */
3325 {0xaa, 0x12, 0x0000}, /* 00,12,00,aa */
3326 {0xaa, 0x13, 0x0000}, /* 00,13,00,aa */
3327 {0xaa, 0x14, 0x0000}, /* 00,14,00,aa */
3328 {0xaa, 0x15, 0x0000}, /* 00,15,00,aa */
3329 {0xaa, 0x16, 0x0000}, /* 00,16,00,aa */
3330 {0xaa, 0x17, 0x0001}, /* 00,17,01,aa */
3331 {0xaa, 0x18, 0x00d8}, /* 00,18,d8,aa */
3332 {0xaa, 0x19, 0x0002}, /* 00,19,02,aa */
3333 {0xaa, 0x1a, 0x0088}, /* 00,1a,88,aa */
3334 {0xaa, 0x20, 0x00a8}, /* 00,20,a8,aa */
3335 {0xaa, 0x22, 0x0000}, /* 00,22,00,aa */
3336 {0xaa, 0x23, 0x0000}, /* 00,23,00,aa */
3337 {0xaa, 0x24, 0x0000}, /* 00,24,00,aa */
3338 {0xaa, 0x40, 0x0033}, /* 00,40,33,aa */
3339 {0xaa, 0x41, 0x0077}, /* 00,41,77,aa */
3340 {0xaa, 0x42, 0x0053}, /* 00,42,53,aa */
3341 {0xaa, 0x43, 0x00b0}, /* 00,43,b0,aa */
3342 {0xaa, 0x4b, 0x0001}, /* 00,4b,01,aa */
3343 {0xaa, 0x72, 0x0020}, /* 00,72,20,aa */
3344 {0xaa, 0x73, 0x0000}, /* 00,73,00,aa */
3345 {0xaa, 0x80, 0x0000}, /* 00,80,00,aa */
3346 {0xaa, 0x85, 0x0050}, /* 00,85,50,aa */
3347 {0xaa, 0x91, 0x0070}, /* 00,91,70,aa */
3348 {0xaa, 0x92, 0x0072}, /* 00,92,72,aa */
3349 {0xaa, 0x03, 0x0001}, /* 00,03,01,aa */
3350 {0xaa, 0x10, 0x00a0}, /* 00,10,a0,aa */
3351 {0xaa, 0x11, 0x0001}, /* 00,11,01,aa */
3352 {0xaa, 0x30, 0x0000}, /* 00,30,00,aa */
3353 {0xaa, 0x60, 0x0000}, /* 00,60,00,aa */
3354 {0xaa, 0xa0, 0x001a}, /* 00,a0,1a,aa */
3355 {0xaa, 0xa1, 0x0000}, /* 00,a1,00,aa */
3356 {0xaa, 0xa2, 0x003f}, /* 00,a2,3f,aa */
3357 {0xaa, 0xa3, 0x0028}, /* 00,a3,28,aa */
3358 {0xaa, 0xa4, 0x0010}, /* 00,a4,10,aa */
3359 {0xaa, 0xa5, 0x0020}, /* 00,a5,20,aa */
3360 {0xaa, 0xb1, 0x0044}, /* 00,b1,44,aa */
3361 {0xaa, 0xd0, 0x0001}, /* 00,d0,01,aa */
3362 {0xaa, 0xd1, 0x0085}, /* 00,d1,85,aa */
3363 {0xaa, 0xd2, 0x0080}, /* 00,d2,80,aa */
3364 {0xaa, 0xd3, 0x0080}, /* 00,d3,80,aa */
3365 {0xaa, 0xd4, 0x0080}, /* 00,d4,80,aa */
3366 {0xaa, 0xd5, 0x0080}, /* 00,d5,80,aa */
3367 {0xaa, 0xc0, 0x00c3}, /* 00,c0,c3,aa */
3368 {0xaa, 0xc2, 0x0044}, /* 00,c2,44,aa */
3369 {0xaa, 0xc4, 0x0040}, /* 00,c4,40,aa */
3370 {0xaa, 0xc5, 0x0020}, /* 00,c5,20,aa */
3371 {0xaa, 0xc6, 0x0008}, /* 00,c6,08,aa */
3372 {0xaa, 0x03, 0x0004}, /* 00,03,04,aa */
3373 {0xaa, 0x10, 0x0000}, /* 00,10,00,aa */
3374 {0xaa, 0x40, 0x0030}, /* 00,40,30,aa */
3375 {0xaa, 0x41, 0x0020}, /* 00,41,20,aa */
3376 {0xaa, 0x42, 0x002d}, /* 00,42,2d,aa */
3377 {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */
3378 {0xaa, 0x1c, 0x0050}, /* 00,1c,50,aa */
3379 {0xaa, 0x11, 0x0081}, /* 00,11,81,aa */
3380 {0xaa, 0x3b, 0x003a}, /* 00,3b,3A,aa */
3381 {0xaa, 0x3c, 0x0098}, /* 00,3c,98,aa */
3382 {0xaa, 0x3d, 0x0030}, /* 00,3d,30,aa */
3383 {0xaa, 0x3e, 0x00d4}, /* 00,3E,D4,aa */
3384 {0xaa, 0x01, 0x0000}, /* 00,01,00,aa */
3385 {0xaa, 0x52, 0x00ff}, /* 00,52,FF,aa */
3386 {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
3387 {0xa0, 0x0d, 0x0100}, /* 01,00,0d,cc */
3388 {0xa0, 0x37, 0x0101}, /* 01,01,37,cc */
3389 {0xa0, 0x06, 0x0189}, /* 01,89,06,cc */
3390 {0xa0, 0x03, 0x01c5}, /* 01,c5,03,cc */
3391 {0xa0, 0x13, 0x01cb}, /* 01,cb,13,cc */
3392 {0xa0, 0x08, 0x0250}, /* 02,50,08,cc */
3393 {0xa0, 0x08, 0x0301}, /* 03,01,08,cc */
3394 {0xa0, 0x02, 0x0180}, /* 01,80,02,cc */
3395 {0xaa, 0x03, 0x0002}, /* 00,03,02,aa */
3396 {0xaa, 0x51, 0x004e}, /* 00,51,4E,aa */
3397 {0xaa, 0x52, 0x0041}, /* 00,52,41,aa */
3398 {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */
3399 {0xaa, 0x50, 0x0010}, /* 00,50,10,aa */
3400 {0xaa, 0x51, 0x0010}, /* 00,51,10,aa */
3401 {0xaa, 0x54, 0x0010}, /* 00,54,10,aa */
3402 {0xaa, 0x55, 0x0010}, /* 00,55,10,aa */
3403 {0xa0, 0xf0, 0x0199}, /* 01,99,F0,cc */
3404 {0xa0, 0x80, 0x019a}, /* 01,9A,80,cc */
3405 {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */
3406 {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */
3407 {0xaa, 0x36, 0x001d}, /* 00,36,1D,aa */
3408 {0xaa, 0x37, 0x004c}, /* 00,37,4C,aa */
3409 {0xaa, 0x3b, 0x001d}, /* 00,3B,1D,aa */
3410 {0, 0, 0}
3411};
3412
3413static struct usb_action MC501CB_50HZ[] = {
3414 {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */
3415 {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */
3416 {0xaa, 0x36, 0x001d}, /* 00,36,1D,aa */
3417 {0xaa, 0x37, 0x004c}, /* 00,37,4C,aa */
3418 {0xaa, 0x3b, 0x001d}, /* 00,3B,1D,aa */
3419 {0xaa, 0x3c, 0x004c}, /* 00,3C,4C,aa */
3420 {0xaa, 0x3d, 0x001d}, /* 00,3D,1D,aa */
3421 {0xaa, 0x3e, 0x004c}, /* 00,3E,4C,aa */
3422 {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */
3423 {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */
3424 {0xaa, 0x36, 0x003a}, /* 00,36,3A,aa */
3425 {0xaa, 0x37, 0x0098}, /* 00,37,98,aa */
3426 {0xaa, 0x3b, 0x003a}, /* 00,3B,3A,aa */
3427 {0, 0, 0}
3428};
3429
3430static struct usb_action MC501CB_50HZScale[] = {
3431 {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */
3432 {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */
3433 {0xaa, 0x36, 0x003a}, /* 00,36,3A,aa */
3434 {0xaa, 0x37, 0x0098}, /* 00,37,98,aa */
3435 {0xaa, 0x3b, 0x003a}, /* 00,3B,3A,aa */
3436 {0xaa, 0x3c, 0x0098}, /* 00,3C,98,aa */
3437 {0xaa, 0x3d, 0x003a}, /* 00,3D,3A,aa */
3438 {0xaa, 0x3e, 0x0098}, /* 00,3E,98,aa */
3439 {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */
3440 {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */
3441 {0xaa, 0x36, 0x0018}, /* 00,36,18,aa */
3442 {0xaa, 0x37, 0x006a}, /* 00,37,6A,aa */
3443 {0xaa, 0x3d, 0x0018}, /* 00,3D,18,aa */
3444 {0, 0, 0}
3445};
3446
3447static struct usb_action MC501CB_60HZ[] = {
3448 {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */
3449 {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */
3450 {0xaa, 0x36, 0x0018}, /* 00,36,18,aa */
3451 {0xaa, 0x37, 0x006a}, /* 00,37,6A,aa */
3452 {0xaa, 0x3d, 0x0018}, /* 00,3D,18,aa */
3453 {0xaa, 0x3e, 0x006a}, /* 00,3E,6A,aa */
3454 {0xaa, 0x3b, 0x0018}, /* 00,3B,18,aa */
3455 {0xaa, 0x3c, 0x006a}, /* 00,3C,6A,aa */
3456 {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */
3457 {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */
3458 {0xaa, 0x36, 0x0030}, /* 00,36,30,aa */
3459 {0xaa, 0x37, 0x00d4}, /* 00,37,D4,aa */
3460 {0xaa, 0x3d, 0x0030}, /* 00,3D,30,aa */
3461 {0, 0, 0}
3462};
3463
3464static struct usb_action MC501CB_60HZScale[] = {
3465 {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */
3466 {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */
3467 {0xaa, 0x36, 0x0030}, /* 00,36,30,aa */
3468 {0xaa, 0x37, 0x00d4}, /* 00,37,D4,aa */
3469 {0xaa, 0x3d, 0x0030}, /* 00,3D,30,aa */
3470 {0xaa, 0x3e, 0x00d4}, /* 00,3E,D4,aa */
3471 {0xaa, 0x3b, 0x0030}, /* 00,3B,30,aa */
3472 {0xaa, 0x3c, 0x00d4}, /* 00,3C,D4,aa */
3473 {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */
3474 {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */
3475 {0xaa, 0x36, 0x0018}, /* 00,36,18,aa */
3476 {0xaa, 0x37, 0x006a}, /* 00,37,6A,aa */
3477 {0xaa, 0x3d, 0x0018}, /* 00,3D,18,aa */
3478 {0, 0, 0}
3479};
3480
3481static struct usb_action MC501CB_NoFliker[] = {
3482 {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */
3483 {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */
3484 {0xaa, 0x36, 0x0018}, /* 00,36,18,aa */
3485 {0xaa, 0x37, 0x006a}, /* 00,37,6A,aa */
3486 {0xaa, 0x3d, 0x0018}, /* 00,3D,18,aa */
3487 {0xaa, 0x3e, 0x006a}, /* 00,3E,6A,aa */
3488 {0xaa, 0x3b, 0x0018}, /* 00,3B,18,aa */
3489 {0xaa, 0x3c, 0x006a}, /* 00,3C,6A,aa */
3490 {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */
3491 {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */
3492 {0xaa, 0x36, 0x0030}, /* 00,36,30,aa */
3493 {0xaa, 0x37, 0x00d4}, /* 00,37,D4,aa */
3494 {0xaa, 0x3d, 0x0030}, /* 00,3D,30,aa */
3495 {0, 0, 0}
3496};
3497
3498static struct usb_action MC501CB_NoFlikerScale[] = {
3499 {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */
3500 {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */
3501 {0xaa, 0x36, 0x0030}, /* 00,36,30,aa */
3502 {0xaa, 0x37, 0x00d4}, /* 00,37,D4,aa */
3503 {0xaa, 0x3d, 0x0030}, /* 00,3D,30,aa */
3504 {0xaa, 0x3e, 0x00d4}, /* 00,3E,D4,aa */
3505 {0xaa, 0x3b, 0x0030}, /* 00,3B,30,aa */
3506 {0xaa, 0x3c, 0x00d4}, /* 00,3C,D4,aa */
3507 {0, 0, 0}
3508};
3509
3510/* from zs211.inf - HKR,%OV7620%,Initial - 640x480 */
3511static struct usb_action OV7620_mode0[] = {
3512 {0xa0, 0x01, 0x0000}, /* 00,00,01,cc */
3513 {0xa0, 0x40, 0x0002}, /* 00,02,40,cc */
3514 {0xa0, 0x00, 0x0008}, /* 00,08,00,cc */
3515 {0xa0, 0x01, 0x0001}, /* 00,01,01,cc */
3516 {0xa0, 0x06, 0x0010}, /* 00,10,06,cc */
3517 {0xa0, 0x02, 0x0083}, /* 00,83,02,cc */
3518 {0xa0, 0x01, 0x0085}, /* 00,85,01,cc */
3519 {0xa0, 0x80, 0x0086}, /* 00,86,80,cc */
3520 {0xa0, 0x81, 0x0087}, /* 00,87,81,cc */
3521 {0xa0, 0x10, 0x0088}, /* 00,88,10,cc */
3522 {0xa0, 0xa1, 0x008b}, /* 00,8b,a1,cc */
3523 {0xa0, 0x08, 0x008d}, /* 00,8d,08,cc */
3524 {0xa0, 0x02, 0x0003}, /* 00,03,02,cc */
3525 {0xa0, 0x80, 0x0004}, /* 00,04,80,cc */
3526 {0xa0, 0x01, 0x0005}, /* 00,05,01,cc */
3527 {0xa0, 0xd8, 0x0006}, /* 00,06,d8,cc */
3528 {0xa0, 0x03, 0x0012}, /* 00,12,03,cc */
3529 {0xa0, 0x01, 0x0012}, /* 00,12,01,cc */
3530 {0xa0, 0x00, 0x0098}, /* 00,98,00,cc */
3531 {0xa0, 0x00, 0x009a}, /* 00,9a,00,cc */
3532 {0xa0, 0x00, 0x011a}, /* 01,1a,00,cc */
3533 {0xa0, 0x00, 0x011c}, /* 01,1c,00,cc */
3534 {0xa0, 0xde, 0x009c}, /* 00,9c,de,cc */
3535 {0xa0, 0x86, 0x009e}, /* 00,9e,86,cc */
3536 {0xaa, 0x12, 0x0088}, /* 00,12,88,aa */
3537 {0xaa, 0x12, 0x0048}, /* 00,12,48,aa */
3538 {0xaa, 0x75, 0x008a}, /* 00,75,8a,aa */
3539 {0xaa, 0x13, 0x00a3}, /* 00,13,a3,aa */
3540 {0xaa, 0x04, 0x0000}, /* 00,04,00,aa */
3541 {0xaa, 0x05, 0x0000}, /* 00,05,00,aa */
3542 {0xaa, 0x14, 0x0000}, /* 00,14,00,aa */
3543 {0xaa, 0x15, 0x0004}, /* 00,15,04,aa */
3544 {0xaa, 0x17, 0x0018}, /* 00,17,18,aa */
3545 {0xaa, 0x18, 0x00ba}, /* 00,18,ba,aa */
3546 {0xaa, 0x19, 0x0002}, /* 00,19,02,aa */
3547 {0xaa, 0x1a, 0x00f1}, /* 00,1a,f1,aa */
3548 {0xaa, 0x20, 0x0040}, /* 00,20,40,aa */
3549 {0xaa, 0x24, 0x0088}, /* 00,24,88,aa */
3550 {0xaa, 0x25, 0x0078}, /* 00,25,78,aa */
3551 {0xaa, 0x27, 0x00f6}, /* 00,27,f6,aa */
3552 {0xaa, 0x28, 0x00a0}, /* 00,28,a0,aa */
3553 {0xaa, 0x21, 0x0000}, /* 00,21,00,aa */
3554 {0xaa, 0x2a, 0x0083}, /* 00,2a,83,aa */
3555 {0xaa, 0x2b, 0x0096}, /* 00,2b,96,aa */
3556 {0xaa, 0x2d, 0x0005}, /* 00,2d,05,aa */
3557 {0xaa, 0x74, 0x0020}, /* 00,74,20,aa */
3558 {0xaa, 0x61, 0x0068}, /* 00,61,68,aa */
3559 {0xaa, 0x64, 0x0088}, /* 00,64,88,aa */
3560 {0xaa, 0x00, 0x0000}, /* 00,00,00,aa */
3561 {0xaa, 0x06, 0x0080}, /* 00,06,80,aa */
3562 {0xaa, 0x01, 0x0090}, /* 00,01,90,aa */
3563 {0xaa, 0x02, 0x0030}, /* 00,02,30,aa */
3564 {0xa0, 0x77, 0x0101}, /* 01,01,77,cc */
3565 {0xa0, 0x05, 0x0012}, /* 00,12,05,cc */
3566 {0xa0, 0x0d, 0x0100}, /* 01,00,0d,cc */
3567 {0xa0, 0x06, 0x0189}, /* 01,89,06,cc */
3568 {0xa0, 0x00, 0x01ad}, /* 01,ad,00,cc */
3569 {0xa0, 0x03, 0x01c5}, /* 01,c5,03,cc */
3570 {0xa0, 0x13, 0x01cb}, /* 01,cb,13,cc */
3571 {0xa0, 0x08, 0x0250}, /* 02,50,08,cc */
3572 {0xa0, 0x08, 0x0301}, /* 03,01,08,cc */
3573 {0xa0, 0x68, 0x0116}, /* 01,16,68,cc */
3574 {0xa0, 0x52, 0x0118}, /* 01,18,52,cc */
3575 {0xa0, 0x40, 0x011d}, /* 01,1d,40,cc */
3576 {0xa0, 0x02, 0x0180}, /* 01,80,02,cc */
3577 {0xa0, 0x50, 0x01a8}, /* 01,a8,50,cc */
3578 {0, 0, 0}
3579};
3580
3581/* from zs211.inf - HKR,%OV7620%,InitialScale - 320x240 */
3582static struct usb_action OV7620_mode1[] = {
3583 {0xa0, 0x01, 0x0000}, /* 00,00,01,cc */
3584 {0xa0, 0x50, 0x0002}, /* 00,02,50,cc */
3585 {0xa0, 0x03, 0x0008}, /* 00,08,00,cc */ /* mx change? */
3586 {0xa0, 0x01, 0x0001}, /* 00,01,01,cc */
3587 {0xa0, 0x06, 0x0010}, /* 00,10,06,cc */
3588 {0xa0, 0x02, 0x0083}, /* 00,83,02,cc */
3589 {0xa0, 0x01, 0x0085}, /* 00,85,01,cc */
3590 {0xa0, 0x80, 0x0086}, /* 00,86,80,cc */
3591 {0xa0, 0x81, 0x0087}, /* 00,87,81,cc */
3592 {0xa0, 0x10, 0x0088}, /* 00,88,10,cc */
3593 {0xa0, 0xa1, 0x008b}, /* 00,8b,a1,cc */
3594 {0xa0, 0x08, 0x008d}, /* 00,8d,08,cc */
3595 {0xa0, 0x02, 0x0003}, /* 00,03,02,cc */
3596 {0xa0, 0x80, 0x0004}, /* 00,04,80,cc */
3597 {0xa0, 0x01, 0x0005}, /* 00,05,01,cc */
3598 {0xa0, 0xd0, 0x0006}, /* 00,06,d0,cc */
3599 {0xa0, 0x03, 0x0012}, /* 00,12,03,cc */
3600 {0xa0, 0x01, 0x0012}, /* 00,12,01,cc */
3601 {0xa0, 0x00, 0x0098}, /* 00,98,00,cc */
3602 {0xa0, 0x00, 0x009a}, /* 00,9a,00,cc */
3603 {0xa0, 0x00, 0x011a}, /* 01,1a,00,cc */
3604 {0xa0, 0x00, 0x011c}, /* 01,1c,00,cc */
3605 {0xa0, 0xd6, 0x009c}, /* 00,9c,d6,cc */ /* OV7648 00,9c,d8,cc */
3606 {0xa0, 0x88, 0x009e}, /* 00,9e,88,cc */
3607 {0xaa, 0x12, 0x0088}, /* 00,12,88,aa */
3608 {0xaa, 0x12, 0x0048}, /* 00,12,48,aa */
3609 {0xaa, 0x75, 0x008a}, /* 00,75,8a,aa */
3610 {0xaa, 0x13, 0x00a3}, /* 00,13,a3,aa */
3611 {0xaa, 0x04, 0x0000}, /* 00,04,00,aa */
3612 {0xaa, 0x05, 0x0000}, /* 00,05,00,aa */
3613 {0xaa, 0x14, 0x0000}, /* 00,14,00,aa */
3614 {0xaa, 0x15, 0x0004}, /* 00,15,04,aa */
3615 {0xaa, 0x24, 0x0088}, /* 00,24,88,aa */
3616 {0xaa, 0x25, 0x0078}, /* 00,25,78,aa */
3617 {0xaa, 0x17, 0x0018}, /* 00,17,18,aa */
3618 {0xaa, 0x18, 0x00ba}, /* 00,18,ba,aa */
3619 {0xaa, 0x19, 0x0002}, /* 00,19,02,aa */
3620 {0xaa, 0x1a, 0x00f2}, /* 00,1a,f2,aa */
3621 {0xaa, 0x20, 0x0040}, /* 00,20,40,aa */
3622 {0xaa, 0x27, 0x00f6}, /* 00,27,f6,aa */
3623 {0xaa, 0x28, 0x00a0}, /* 00,28,a0,aa */
3624 {0xaa, 0x21, 0x0000}, /* 00,21,00,aa */
3625 {0xaa, 0x2a, 0x0083}, /* 00,2a,83,aa */
3626 {0xaa, 0x2b, 0x0096}, /* 00,2b,96,aa */
3627 {0xaa, 0x2d, 0x0005}, /* 00,2d,05,aa */
3628 {0xaa, 0x74, 0x0020}, /* 00,74,20,aa */
3629 {0xaa, 0x61, 0x0068}, /* 00,61,68,aa */
3630 {0xaa, 0x64, 0x0088}, /* 00,64,88,aa */
3631 {0xaa, 0x00, 0x0000}, /* 00,00,00,aa */
3632 {0xaa, 0x06, 0x0080}, /* 00,06,80,aa */
3633 {0xaa, 0x01, 0x0090}, /* 00,01,90,aa */
3634 {0xaa, 0x02, 0x0030}, /* 00,02,30,aa */
3635 {0xa0, 0x77, 0x0101}, /* 01,01,77,cc */
3636 {0xa0, 0x05, 0x0012}, /* 00,12,05,cc */
3637 {0xa0, 0x0d, 0x0100}, /* 01,00,0d,cc */
3638 {0xa0, 0x06, 0x0189}, /* 01,89,06,cc */
3639 {0xa0, 0x00, 0x01ad}, /* 01,ad,00,cc */
3640 {0xa0, 0x03, 0x01c5}, /* 01,c5,03,cc */
3641 {0xa0, 0x13, 0x01cb}, /* 01,cb,13,cc */
3642 {0xa0, 0x08, 0x0250}, /* 02,50,08,cc */
3643 {0xa0, 0x08, 0x0301}, /* 03,01,08,cc */
3644 {0xa0, 0x68, 0x0116}, /* 01,16,68,cc */
3645 {0xa0, 0x52, 0x0118}, /* 01,18,52,cc */
3646 {0xa0, 0x50, 0x011d}, /* 01,1d,50,cc */
3647 {0xa0, 0x02, 0x0180}, /* 01,80,02,cc */
3648 {0xa0, 0x50, 0x01a8}, /* 01,a8,50,cc */
3649 {0, 0, 0}
3650};
3651
3652/* from zs211.inf - HKR,%OV7620%\AE,50HZ */
3653static struct usb_action OV7620_50HZ[] = {
3654 {0xaa, 0x13, 0x00a3}, /* 00,13,a3,aa */
3655 {0xdd, 0x00, 0x0100}, /* 00,01,00,dd */
3656 {0xaa, 0x2b, 0x0096}, /* 00,2b,96,aa */
3657 {0xaa, 0x75, 0x008a}, /* 00,75,8a,aa */
3658 {0xaa, 0x2d, 0x0005}, /* 00,2d,05,aa */
3659 {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
3660 {0xa0, 0x04, 0x0191}, /* 01,91,04,cc */
3661 {0xa0, 0x18, 0x0192}, /* 01,92,18,cc */
3662 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */
3663 {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */
3664 {0xa0, 0x83, 0x0197}, /* 01,97,83,cc */
3665 {0xaa, 0x10, 0x0082}, /* 00,10,82,aa */
3666 {0xaa, 0x76, 0x0003}, /* 00,76,03,aa */
3667/* {0xa0, 0x40, 0x0002}, * 00,02,40,cc - if mode0 (640x480) */
3668 {0, 0, 0}
3669};
3670
3671/* from zs211.inf - HKR,%OV7620%\AE,60HZ */
3672static struct usb_action OV7620_60HZ[] = {
3673 {0xaa, 0x13, 0x00a3}, /* 00,13,a3,aa */ /* (bug in zs211.inf) */
3674 {0xdd, 0x00, 0x0100}, /* 00,01,00,dd */
3675 {0xaa, 0x2b, 0x0000}, /* 00,2b,00,aa */
3676 {0xaa, 0x75, 0x008a}, /* 00,75,8a,aa */
3677 {0xaa, 0x2d, 0x0005}, /* 00,2d,05,aa */
3678 {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
3679 {0xa0, 0x04, 0x0191}, /* 01,91,04,cc */
3680 {0xa0, 0x18, 0x0192}, /* 01,92,18,cc */
3681 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */
3682 {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */
3683 {0xa0, 0x83, 0x0197}, /* 01,97,83,cc */
3684 {0xaa, 0x10, 0x0020}, /* 00,10,20,aa */
3685 {0xaa, 0x76, 0x0003}, /* 00,76,03,aa */
3686/* {0xa0, 0x40, 0x0002}, * 00,02,40,cc - if mode0 (640x480) */
3687/* ?? in gspca v1, it was
3688 {0xa0, 0x00, 0x0039}, * 00,00,00,dd *
3689 {0xa1, 0x01, 0x0037}, */
3690 {0, 0, 0}
3691};
3692
3693/* from zs211.inf - HKR,%OV7620%\AE,NoFliker */
3694static struct usb_action OV7620_NoFliker[] = {
3695 {0xaa, 0x13, 0x00a3}, /* 00,13,a3,aa */ /* (bug in zs211.inf) */
3696 {0xdd, 0x00, 0x0100}, /* 00,01,00,dd */
3697 {0xaa, 0x2b, 0x0000}, /* 00,2b,00,aa */
3698 {0xaa, 0x75, 0x008e}, /* 00,75,8e,aa */
3699 {0xaa, 0x2d, 0x0001}, /* 00,2d,01,aa */
3700 {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
3701 {0xa0, 0x04, 0x0191}, /* 01,91,04,cc */
3702 {0xa0, 0x18, 0x0192}, /* 01,92,18,cc */
3703 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */
3704 {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */
3705 {0xa0, 0x01, 0x0197}, /* 01,97,01,cc */
3706/* {0xa0, 0x44, 0x0002}, * 00,02,44,cc - if mode1 (320x240) */
3707/* ?? was
3708 {0xa0, 0x00, 0x0039}, * 00,00,00,dd *
3709 {0xa1, 0x01, 0x0037}, */
3710 {0, 0, 0}
3711};
3712
3713static struct usb_action ov7630c_Initial[] = {
3714 {0xa0, 0x01, 0x0000},
3715 {0xa0, 0x10, 0x0002},
3716 {0xa0, 0x01, 0x0000},
3717 {0xa0, 0x10, 0x0002},
3718 {0xa0, 0x03, 0x0008},
3719 {0xa0, 0x01, 0x0001},
3720 {0xa0, 0x06, 0x0010},
3721 {0xa0, 0xa1, 0x008b},
3722 {0xa0, 0x08, 0x008d},
3723 {0xa0, 0x02, 0x0003},
3724 {0xa0, 0x80, 0x0004},
3725 {0xa0, 0x01, 0x0005},
3726 {0xa0, 0xe0, 0x0006},
3727 {0xa0, 0x01, 0x0012},
3728 {0xaa, 0x12, 0x0080},
3729 {0xa0, 0x02, 0x0083},
3730 {0xa0, 0x01, 0x0085},
3731 {0xa0, 0x90, 0x0086},
3732 {0xa0, 0x91, 0x0087},
3733 {0xa0, 0x10, 0x0088},
3734 {0xa0, 0x00, 0x0098},
3735 {0xa0, 0x00, 0x009a},
3736 {0xa0, 0x00, 0x011a},
3737 {0xa0, 0x00, 0x011c},
3738 {0xa0, 0xd8, 0x009c},
3739 {0xa0, 0x88, 0x009e},
3740 {0xaa, 0x12, 0x0069},
3741 {0xaa, 0x04, 0x0020},
3742 {0xaa, 0x06, 0x0050},
3743 {0xaa, 0x13, 0x0083},
3744 {0xaa, 0x14, 0x0000},
3745 {0xaa, 0x15, 0x0024},
3746 {0xaa, 0x17, 0x0018},
3747 {0xaa, 0x18, 0x00ba},
3748 {0xaa, 0x19, 0x0002},
3749 {0xaa, 0x1a, 0x00f6},
3750 {0xaa, 0x1b, 0x0002},
3751 {0xaa, 0x20, 0x00c2},
3752 {0xaa, 0x24, 0x0060},
3753 {0xaa, 0x25, 0x0040},
3754 {0xaa, 0x26, 0x0030},
3755 {0xaa, 0x27, 0x00ea},
3756 {0xaa, 0x28, 0x00a0},
3757 {0xaa, 0x21, 0x0000},
3758 {0xaa, 0x2a, 0x0081},
3759 {0xaa, 0x2b, 0x0096},
3760 {0xaa, 0x2d, 0x0094},
3761 {0xaa, 0x2f, 0x003d},
3762 {0xaa, 0x30, 0x0024},
3763 {0xaa, 0x60, 0x0000},
3764 {0xaa, 0x61, 0x0040},
3765 {0xaa, 0x68, 0x007c},
3766 {0xaa, 0x6f, 0x0015},
3767 {0xaa, 0x75, 0x0088},
3768 {0xaa, 0x77, 0x00b5},
3769 {0xaa, 0x01, 0x0060},
3770 {0xaa, 0x02, 0x0060},
3771 {0xa0, 0x05, 0x0012},
3772 {0xa0, 0x77, 0x0101},
3773 {0xa0, 0x0d, 0x0100},
3774 {0xa0, 0x06, 0x0189},
3775 {0xa0, 0x04, 0x01a7},
3776 {0xa0, 0x00, 0x01ad},
3777 {0xa0, 0x03, 0x01c5},
3778 {0xa0, 0x13, 0x01cb},
3779 {0xa0, 0x08, 0x0250},
3780 {0xa0, 0x08, 0x0301},
3781 {0xa0, 0x60, 0x0116},
3782 {0xa0, 0x46, 0x0118},
3783 {0xa0, 0x04, 0x0113},
3784/* 0x10, */
3785 {0xa1, 0x01, 0x0002},
3786 {0xa0, 0x50, 0x010a}, /* matrix */
3787 {0xa0, 0xf8, 0x010b},
3788 {0xa0, 0xf8, 0x010c},
3789 {0xa0, 0xf8, 0x010d},
3790 {0xa0, 0x50, 0x010e},
3791 {0xa0, 0xf8, 0x010f},
3792 {0xa0, 0xf8, 0x0110},
3793 {0xa0, 0xf8, 0x0111},
3794 {0xa0, 0x50, 0x0112},
3795/* 0x03, */
3796 {0xa1, 0x01, 0x0008},
3797 {0xa0, 0x03, 0x0008}, /* clock ? */
3798 {0xa0, 0x08, 0x01c6},
3799/* 0x05, */
3800 {0xa1, 0x01, 0x01c8},
3801/* 0x07, */
3802 {0xa1, 0x01, 0x01c9},
3803/* 0x0f, */
3804 {0xa1, 0x01, 0x01ca},
3805 {0xa0, 0x0f, 0x01cb},
3806 {0xa0, 0x01, 0x0120}, /* gamma 2 ?*/
3807 {0xa0, 0x0c, 0x0121},
3808 {0xa0, 0x1f, 0x0122},
3809 {0xa0, 0x3a, 0x0123},
3810 {0xa0, 0x53, 0x0124},
3811 {0xa0, 0x6d, 0x0125},
3812 {0xa0, 0x85, 0x0126},
3813 {0xa0, 0x9c, 0x0127},
3814 {0xa0, 0xb0, 0x0128},
3815 {0xa0, 0xc2, 0x0129},
3816 {0xa0, 0xd1, 0x012a},
3817 {0xa0, 0xde, 0x012b},
3818 {0xa0, 0xe9, 0x012c},
3819 {0xa0, 0xf2, 0x012d},
3820 {0xa0, 0xf9, 0x012e},
3821 {0xa0, 0xff, 0x012f},
3822 {0xa0, 0x05, 0x0130},
3823 {0xa0, 0x0f, 0x0131},
3824 {0xa0, 0x16, 0x0132},
3825 {0xa0, 0x1a, 0x0133},
3826 {0xa0, 0x19, 0x0134},
3827 {0xa0, 0x19, 0x0135},
3828 {0xa0, 0x17, 0x0136},
3829 {0xa0, 0x15, 0x0137},
3830 {0xa0, 0x12, 0x0138},
3831 {0xa0, 0x10, 0x0139},
3832 {0xa0, 0x0e, 0x013a},
3833 {0xa0, 0x0b, 0x013b},
3834 {0xa0, 0x09, 0x013c},
3835 {0xa0, 0x08, 0x013d},
3836 {0xa0, 0x06, 0x013e},
3837 {0xa0, 0x03, 0x013f},
3838 {0xa0, 0x50, 0x010a}, /* matrix */
3839 {0xa0, 0xf8, 0x010b},
3840 {0xa0, 0xf8, 0x010c},
3841 {0xa0, 0xf8, 0x010d},
3842 {0xa0, 0x50, 0x010e},
3843 {0xa0, 0xf8, 0x010f},
3844 {0xa0, 0xf8, 0x0110},
3845 {0xa0, 0xf8, 0x0111},
3846 {0xa0, 0x50, 0x0112},
3847
3848 {0xa1, 0x01, 0x0180},
3849 {0xa0, 0x00, 0x0180},
3850 {0xaa, 0x10, 0x001b},
3851 {0xaa, 0x76, 0x0002},
3852 {0xaa, 0x2a, 0x0081},
3853 {0xaa, 0x2b, 0x0000},
3854 {0xa0, 0x00, 0x0190},
3855 {0xa0, 0x01, 0x0191},
3856 {0xa0, 0xb8, 0x0192},
3857 {0xa0, 0x00, 0x0195},
3858 {0xa0, 0x00, 0x0196},
3859 {0xa0, 0x37, 0x0197},
3860 {0xa0, 0x10, 0x018c},
3861 {0xa0, 0x20, 0x018f},
3862 {0xa0, 0x10, 0x01a9},
3863 {0xa0, 0x26, 0x01aa},
3864 {0xa0, 0x50, 0x011d},
3865 {0xa0, 0x02, 0x0180},
3866 {0xa0, 0x40, 0x0180},
3867 {0xaa, 0x13, 0x0083}, /* 40 */
3868 {0xa1, 0x01, 0x0180},
3869 {0xa0, 0x42, 0x0180},
3870 {0, 0, 0}
3871};
3872
3873static struct usb_action ov7630c_InitialScale[] = {
3874 {0xa0, 0x01, 0x0000},
3875 {0xa0, 0x00, 0x0002},
3876 {0xa0, 0x03, 0x0008},
3877 {0xa0, 0x01, 0x0001},
3878 {0xa0, 0x06, 0x0010},
3879 {0xa0, 0xa1, 0x008b},
3880 {0xa0, 0x08, 0x008d},
3881 {0xa0, 0x02, 0x0003},
3882 {0xa0, 0x80, 0x0004},
3883 {0xa0, 0x01, 0x0005},
3884 {0xa0, 0xe0, 0x0006},
3885 {0xa0, 0x01, 0x0012},
3886
3887 {0xaa, 0x12, 0x0080},
3888 {0xa0, 0x02, 0x0083},
3889 {0xa0, 0x01, 0x0085},
3890 {0xa0, 0x90, 0x0086},
3891 {0xa0, 0x91, 0x0087},
3892 {0xa0, 0x10, 0x0088},
3893 {0xa0, 0x00, 0x0098},
3894 {0xa0, 0x00, 0x009a},
3895 {0xa0, 0x00, 0x011a},
3896 {0xa0, 0x00, 0x011c},
3897 {0xa0, 0xe6, 0x009c},
3898 {0xa0, 0x86, 0x009e},
3899 {0xaa, 0x12, 0x0069}, /* i2c */
3900 {0xaa, 0x04, 0x0020},
3901 {0xaa, 0x06, 0x0050},
3902 {0xaa, 0x13, 0x00c3},
3903 {0xaa, 0x14, 0x0000},
3904 {0xaa, 0x15, 0x0024},
3905 {0xaa, 0x19, 0x0003},
3906 {0xaa, 0x1a, 0x00f6},
3907 {0xaa, 0x1b, 0x0002},
3908 {0xaa, 0x20, 0x00c2},
3909 {0xaa, 0x24, 0x0060},
3910 {0xaa, 0x25, 0x0040},
3911 {0xaa, 0x26, 0x0030},
3912 {0xaa, 0x27, 0x00ea},
3913 {0xaa, 0x28, 0x00a0},
3914 {0xaa, 0x21, 0x0000},
3915 {0xaa, 0x2a, 0x0081},
3916 {0xaa, 0x2b, 0x0096},
3917 {0xaa, 0x2d, 0x0084},
3918 {0xaa, 0x2f, 0x003d},
3919 {0xaa, 0x30, 0x0024},
3920 {0xaa, 0x60, 0x0000},
3921 {0xaa, 0x61, 0x0040},
3922 {0xaa, 0x68, 0x007c},
3923 {0xaa, 0x6f, 0x0015},
3924 {0xaa, 0x75, 0x0088},
3925 {0xaa, 0x77, 0x00b5},
3926 {0xaa, 0x01, 0x0060},
3927 {0xaa, 0x02, 0x0060},
3928 {0xaa, 0x17, 0x0018},
3929 {0xaa, 0x18, 0x00ba},
3930 {0xa0, 0x05, 0x0012},
3931 {0xa0, 0x77, 0x0101},
3932 {0xa0, 0x0d, 0x0100},
3933 {0xa0, 0x06, 0x0189},
3934 {0xa0, 0x04, 0x01a7},
3935 {0xa0, 0x00, 0x01ad},
3936 {0xa0, 0x03, 0x01c5},
3937 {0xa0, 0x13, 0x01cb},
3938 {0xa0, 0x08, 0x0250},
3939 {0xa0, 0x08, 0x0301},
3940 {0xa0, 0x60, 0x0116},
3941 {0xa0, 0x46, 0x0118},
3942 {0xa0, 0x04, 0x0113},
3943
3944 {0xa1, 0x01, 0x0002},
3945 {0xa0, 0x4e, 0x010a}, /* matrix */
3946 {0xa0, 0xfe, 0x010b},
3947 {0xa0, 0xf4, 0x010c},
3948 {0xa0, 0xf7, 0x010d},
3949 {0xa0, 0x4d, 0x010e},
3950 {0xa0, 0xfc, 0x010f},
3951 {0xa0, 0x00, 0x0110},
3952 {0xa0, 0xf6, 0x0111},
3953 {0xa0, 0x4a, 0x0112},
3954
3955 {0xa1, 0x01, 0x0008},
3956 {0xa0, 0x03, 0x0008}, /* clock ? */
3957 {0xa0, 0x08, 0x01c6},
3958
3959 {0xa1, 0x01, 0x01c8},
3960
3961 {0xa1, 0x01, 0x01c9},
3962
3963 {0xa1, 0x01, 0x01ca},
3964 {0xa0, 0x0f, 0x01cb},
3965 {0xa0, 0x16, 0x0120}, /* gamma ~4 */
3966 {0xa0, 0x3a, 0x0121},
3967 {0xa0, 0x5b, 0x0122},
3968 {0xa0, 0x7c, 0x0123},
3969 {0xa0, 0x94, 0x0124},
3970 {0xa0, 0xa9, 0x0125},
3971 {0xa0, 0xbb, 0x0126},
3972 {0xa0, 0xca, 0x0127},
3973 {0xa0, 0xd7, 0x0128},
3974 {0xa0, 0xe1, 0x0129},
3975 {0xa0, 0xea, 0x012a},
3976 {0xa0, 0xf1, 0x012b},
3977 {0xa0, 0xf7, 0x012c},
3978 {0xa0, 0xfc, 0x012d},
3979 {0xa0, 0xff, 0x012e},
3980 {0xa0, 0xff, 0x012f},
3981 {0xa0, 0x20, 0x0130},
3982 {0xa0, 0x22, 0x0131},
3983 {0xa0, 0x20, 0x0132},
3984 {0xa0, 0x1c, 0x0133},
3985 {0xa0, 0x16, 0x0134},
3986 {0xa0, 0x13, 0x0135},
3987 {0xa0, 0x10, 0x0136},
3988 {0xa0, 0x0d, 0x0137},
3989 {0xa0, 0x0b, 0x0138},
3990 {0xa0, 0x09, 0x0139},
3991 {0xa0, 0x07, 0x013a},
3992 {0xa0, 0x06, 0x013b},
3993 {0xa0, 0x05, 0x013c},
3994 {0xa0, 0x04, 0x013d},
3995 {0xa0, 0x00, 0x013e},
3996 {0xa0, 0x01, 0x013f},
3997 {0xa0, 0x4e, 0x010a}, /* matrix */
3998 {0xa0, 0xfe, 0x010b},
3999 {0xa0, 0xf4, 0x010c},
4000 {0xa0, 0xf7, 0x010d},
4001 {0xa0, 0x4d, 0x010e},
4002 {0xa0, 0xfc, 0x010f},
4003 {0xa0, 0x00, 0x0110},
4004 {0xa0, 0xf6, 0x0111},
4005 {0xa0, 0x4a, 0x0112},
4006
4007 {0xa1, 0x01, 0x0180},
4008 {0xa0, 0x00, 0x0180},
4009 {0xaa, 0x10, 0x000d},
4010 {0xaa, 0x76, 0x0002},
4011 {0xaa, 0x2a, 0x0081},
4012 {0xaa, 0x2b, 0x0000},
4013 {0xa0, 0x00, 0x0190},
4014 {0xa0, 0x00, 0x0191},
4015 {0xa0, 0xd8, 0x0192},
4016 {0xa0, 0x00, 0x0195},
4017 {0xa0, 0x00, 0x0196},
4018 {0xa0, 0x1b, 0x0197},
4019 {0xa0, 0x10, 0x018c},
4020 {0xa0, 0x20, 0x018f},
4021 {0xa0, 0x10, 0x01a9},
4022 {0xa0, 0x26, 0x01aa},
4023 {0xa0, 0x50, 0x011d},
4024 {0xa0, 0x02, 0x0180},
4025 {0xa0, 0x40, 0x0180},
4026 {0xaa, 0x13, 0x00c3},
4027
4028 {0xa1, 0x01, 0x0180},
4029 {0xa0, 0x42, 0x0180},
4030 {0, 0, 0}
4031};
4032
4033static struct usb_action pas106b_Initial_com[] = {
4034/* Sream and Sensor specific */
4035 {0xa1, 0x01, 0x0010}, /* CMOSSensorSelect */
4036/* System */
4037 {0xa0, 0x01, 0x0000}, /* SystemControl */
4038 {0xa0, 0x01, 0x0000}, /* SystemControl */
4039/* Picture size */
4040 {0xa0, 0x00, 0x0002}, /* ClockSelect */
4041 {0xa0, 0x03, 0x003a},
4042 {0xa0, 0x0c, 0x003b},
4043 {0xa0, 0x04, 0x0038},
4044 {0, 0, 0}
4045};
4046
4047static struct usb_action pas106b_Initial[] = { /* 176x144 */
4048/* JPEG control */
4049 {0xa0, 0x03, 0x0008}, /* ClockSetting */
4050/* Sream and Sensor specific */
4051 {0xa0, 0x0f, 0x0010}, /* CMOSSensorSelect */
4052/* Picture size */
4053 {0xa0, 0x00, 0x0003}, /* FrameWidthHigh 00 */
4054 {0xa0, 0xb0, 0x0004}, /* FrameWidthLow B0 */
4055 {0xa0, 0x00, 0x0005}, /* FrameHeightHigh 00 */
4056 {0xa0, 0x90, 0x0006}, /* FrameHightLow 90 */
4057/* System */
4058 {0xa0, 0x01, 0x0001}, /* SystemOperating */
4059/* Sream and Sensor specific */
4060 {0xa0, 0x03, 0x0012}, /* VideoControlFunction */
4061 {0xa0, 0x01, 0x0012}, /* VideoControlFunction */
4062/* Sensor Interface */
4063 {0xa0, 0x08, 0x008d}, /* Compatibily Mode */
4064/* Window inside sensor array */
4065 {0xa0, 0x03, 0x009a}, /* WinXStartLow */
4066 {0xa0, 0x00, 0x011a}, /* FirstYLow */
4067 {0xa0, 0x03, 0x011c}, /* FirstxLow */
4068 {0xa0, 0x28, 0x009c}, /* WinHeightLow */
4069 {0xa0, 0x68, 0x009e}, /* WinWidthLow */
4070/* Init the sensor */
4071 {0xaa, 0x02, 0x0004},
4072 {0xaa, 0x08, 0x0000},
4073 {0xaa, 0x09, 0x0005},
4074 {0xaa, 0x0a, 0x0002},
4075 {0xaa, 0x0b, 0x0002},
4076 {0xaa, 0x0c, 0x0005},
4077 {0xaa, 0x0d, 0x0000},
4078 {0xaa, 0x0e, 0x0002},
4079 {0xaa, 0x14, 0x0081},
4080
4081/* Other registors */
4082 {0xa0, 0x37, 0x0101}, /* SensorCorrection */
4083/* Frame retreiving */
4084 {0xa0, 0x00, 0x0019}, /* AutoAdjustFPS */
4085/* Gains */
4086 {0xa0, 0xa0, 0x01a8}, /* DigitalGain */
4087/* Unknown */
4088 {0xa0, 0x00, 0x01ad},
4089/* Sharpness */
4090 {0xa0, 0x03, 0x01c5}, /* SharpnessMode */
4091 {0xa0, 0x13, 0x01cb}, /* Sharpness05 */
4092/* Other registors */
4093 {0xa0, 0x0d, 0x0100}, /* OperationMode */
4094/* Auto exposure and white balance */
4095 {0xa0, 0x06, 0x0189}, /* AWBStatus */
4096/*Dead pixels */
4097 {0xa0, 0x08, 0x0250}, /* DeadPixelsMode */
4098/* EEPROM */
4099 {0xa0, 0x08, 0x0301}, /* EEPROMAccess */
4100/* JPEG control */
4101 {0xa0, 0x03, 0x0008}, /* ClockSetting */
4102/* Unknown */
4103 {0xa0, 0x08, 0x01c6},
4104/* Sharpness */
4105 {0xa0, 0x0f, 0x01cb}, /* Sharpness05 */
4106/* Other registers */
4107 {0xa0, 0x0d, 0x0100}, /* OperationMode */
4108/* Auto exposure and white balance */
4109 {0xa0, 0x06, 0x0189}, /* AWBStatus */
4110/*Dead pixels */
4111 {0xa0, 0x08, 0x0250}, /* DeadPixelsMode */
4112/* EEPROM */
4113 {0xa0, 0x08, 0x0301}, /* EEPROMAccess */
4114/* JPEG control */
4115 {0xa0, 0x03, 0x0008}, /* ClockSetting */
4116/* Sharpness */
4117 {0xa0, 0x08, 0x01c6}, /* Sharpness00 */
4118 {0xa0, 0x0f, 0x01cb}, /* Sharpness05 */
4119
4120 {0xa0, 0x58, 0x010a}, /* matrix */
4121 {0xa0, 0xf4, 0x010b},
4122 {0xa0, 0xf4, 0x010c},
4123 {0xa0, 0xf4, 0x010d},
4124 {0xa0, 0x58, 0x010e},
4125 {0xa0, 0xf4, 0x010f},
4126 {0xa0, 0xf4, 0x0110},
4127 {0xa0, 0xf4, 0x0111},
4128 {0xa0, 0x58, 0x0112},
4129/* Auto correction */
4130 {0xa0, 0x03, 0x0181}, /* WinXstart */
4131 {0xa0, 0x08, 0x0182}, /* WinXWidth */
4132 {0xa0, 0x16, 0x0183}, /* WinXCenter */
4133 {0xa0, 0x03, 0x0184}, /* WinYStart */
4134 {0xa0, 0x05, 0x0185}, /* WinYWidth */
4135 {0xa0, 0x14, 0x0186}, /* WinYCenter */
4136 {0xa0, 0x00, 0x0180}, /* AutoCorrectEnable */
4137
4138/* Auto exposure and white balance */
4139 {0xa0, 0x00, 0x0190}, /* ExposureLimitHigh */
4140 {0xa0, 0x03, 0x0191}, /* ExposureLimitMid */
4141 {0xa0, 0xb1, 0x0192}, /* ExposureLimitLow */
4142 {0xa0, 0x00, 0x0195}, /* AntiFlickerHigh */
4143 {0xa0, 0x00, 0x0196}, /* AntiFlickerLow */
4144 {0xa0, 0x87, 0x0197}, /* AntiFlickerLow */
4145 {0xa0, 0x0c, 0x018c}, /* AEBFreeze */
4146 {0xa0, 0x18, 0x018f}, /* AEBUnfreeze */
4147/* sensor on */
4148 {0xaa, 0x07, 0x00b1},
4149 {0xaa, 0x05, 0x0003},
4150 {0xaa, 0x04, 0x0001},
4151 {0xaa, 0x03, 0x003b},
4152/* Gains */
4153 {0xa0, 0x20, 0x01a9}, /* DigitalLimitDiff */
4154 {0xa0, 0x26, 0x01aa}, /* DigitalGainStep */
4155 {0xa0, 0xa0, 0x011d}, /* GlobalGain */
4156 {0xa0, 0x60, 0x011d}, /* GlobalGain */
4157/* Auto correction */
4158 {0xa0, 0x40, 0x0180}, /* AutoCorrectEnable */
4159 {0xa1, 0x01, 0x0180}, /* AutoCorrectEnable */
4160 {0xa0, 0x42, 0x0180}, /* AutoCorrectEnable */
4161/* Gains */
4162 {0xa0, 0x40, 0x0116}, /* RGain */
4163 {0xa0, 0x40, 0x0117}, /* GGain */
4164 {0xa0, 0x40, 0x0118}, /* BGain */
4165 {0, 0, 0}
4166};
4167
4168static struct usb_action pas106b_InitialScale[] = { /* 352x288 */
4169/* JPEG control */
4170 {0xa0, 0x03, 0x0008}, /* ClockSetting */
4171/* Sream and Sensor specific */
4172 {0xa0, 0x0f, 0x0010}, /* CMOSSensorSelect */
4173/* Picture size */
4174 {0xa0, 0x01, 0x0003}, /* FrameWidthHigh */
4175 {0xa0, 0x60, 0x0004}, /* FrameWidthLow */
4176 {0xa0, 0x01, 0x0005}, /* FrameHeightHigh */
4177 {0xa0, 0x20, 0x0006}, /* FrameHightLow */
4178/* System */
4179 {0xa0, 0x01, 0x0001}, /* SystemOperating */
4180/* Sream and Sensor specific */
4181 {0xa0, 0x03, 0x0012}, /* VideoControlFunction */
4182 {0xa0, 0x01, 0x0012}, /* VideoControlFunction */
4183/* Sensor Interface */
4184 {0xa0, 0x08, 0x008d}, /* Compatibily Mode */
4185/* Window inside sensor array */
4186 {0xa0, 0x03, 0x009a}, /* WinXStartLow */
4187 {0xa0, 0x00, 0x011a}, /* FirstYLow */
4188 {0xa0, 0x03, 0x011c}, /* FirstxLow */
4189 {0xa0, 0x28, 0x009c}, /* WinHeightLow */
4190 {0xa0, 0x68, 0x009e}, /* WinWidthLow */
4191/* Init the sensor */
4192 {0xaa, 0x02, 0x0004},
4193 {0xaa, 0x08, 0x0000},
4194 {0xaa, 0x09, 0x0005},
4195 {0xaa, 0x0a, 0x0002},
4196 {0xaa, 0x0b, 0x0002},
4197 {0xaa, 0x0c, 0x0005},
4198 {0xaa, 0x0d, 0x0000},
4199 {0xaa, 0x0e, 0x0002},
4200 {0xaa, 0x14, 0x0081},
4201
4202/* Other registors */
4203 {0xa0, 0x37, 0x0101}, /* SensorCorrection */
4204/* Frame retreiving */
4205 {0xa0, 0x00, 0x0019}, /* AutoAdjustFPS */
4206/* Gains */
4207 {0xa0, 0xa0, 0x01a8}, /* DigitalGain */
4208/* Unknown */
4209 {0xa0, 0x00, 0x01ad},
4210/* Sharpness */
4211 {0xa0, 0x03, 0x01c5}, /* SharpnessMode */
4212 {0xa0, 0x13, 0x01cb}, /* Sharpness05 */
4213/* Other registors */
4214 {0xa0, 0x0d, 0x0100}, /* OperationMode */
4215/* Auto exposure and white balance */
4216 {0xa0, 0x06, 0x0189}, /* AWBStatus */
4217 {0xa0, 0x80, 0x018d}, /* ????????? */
4218/*Dead pixels */
4219 {0xa0, 0x08, 0x0250}, /* DeadPixelsMode */
4220/* EEPROM */
4221 {0xa0, 0x08, 0x0301}, /* EEPROMAccess */
4222/* JPEG control */
4223 {0xa0, 0x03, 0x0008}, /* ClockSetting */
4224/* Unknown */
4225 {0xa0, 0x08, 0x01c6},
4226/* Sharpness */
4227 {0xa0, 0x0f, 0x01cb}, /* Sharpness05 */
4228/* Other registers */
4229 {0xa0, 0x0d, 0x0100}, /* OperationMode */
4230/* Auto exposure and white balance */
4231 {0xa0, 0x06, 0x0189}, /* AWBStatus */
4232/*Dead pixels */
4233 {0xa0, 0x08, 0x0250}, /* DeadPixelsMode */
4234/* EEPROM */
4235 {0xa0, 0x08, 0x0301}, /* EEPROMAccess */
4236/* JPEG control */
4237 {0xa0, 0x03, 0x0008}, /* ClockSetting */
4238/* Sharpness */
4239 {0xa0, 0x08, 0x01c6}, /* Sharpness00 */
4240 {0xa0, 0x0f, 0x01cb}, /* Sharpness05 */
4241
4242 {0xa0, 0x58, 0x010a}, /* matrix */
4243 {0xa0, 0xf4, 0x010b},
4244 {0xa0, 0xf4, 0x010c},
4245 {0xa0, 0xf4, 0x010d},
4246 {0xa0, 0x58, 0x010e},
4247 {0xa0, 0xf4, 0x010f},
4248 {0xa0, 0xf4, 0x0110},
4249 {0xa0, 0xf4, 0x0111},
4250 {0xa0, 0x58, 0x0112},
4251/* Auto correction */
4252 {0xa0, 0x03, 0x0181}, /* WinXstart */
4253 {0xa0, 0x08, 0x0182}, /* WinXWidth */
4254 {0xa0, 0x16, 0x0183}, /* WinXCenter */
4255 {0xa0, 0x03, 0x0184}, /* WinYStart */
4256 {0xa0, 0x05, 0x0185}, /* WinYWidth */
4257 {0xa0, 0x14, 0x0186}, /* WinYCenter */
4258 {0xa0, 0x00, 0x0180}, /* AutoCorrectEnable */
4259
4260/* Auto exposure and white balance */
4261 {0xa0, 0x00, 0x0190}, /* ExposureLimitHigh 0 */
4262 {0xa0, 0x03, 0x0191}, /* ExposureLimitMid */
4263 {0xa0, 0xb1, 0x0192}, /* ExposureLimitLow 0xb1 */
4264
4265 {0xa0, 0x00, 0x0195}, /* AntiFlickerHigh 0x00 */
4266 {0xa0, 0x00, 0x0196}, /* AntiFlickerLow 0x00 */
4267 {0xa0, 0x87, 0x0197}, /* AntiFlickerLow 0x87 */
4268
4269 {0xa0, 0x10, 0x018c}, /* AEBFreeze 0x10 0x0c */
4270 {0xa0, 0x20, 0x018f}, /* AEBUnfreeze 0x30 0x18 */
4271/* sensor on */
4272 {0xaa, 0x07, 0x00b1},
4273 {0xaa, 0x05, 0x0003},
4274 {0xaa, 0x04, 0x0001},
4275 {0xaa, 0x03, 0x003b},
4276/* Gains */
4277 {0xa0, 0x20, 0x01a9}, /* DigitalLimitDiff */
4278 {0xa0, 0x26, 0x01aa}, /* DigitalGainStep */
4279 {0xa0, 0xa0, 0x011d}, /* GlobalGain */
4280 {0xa0, 0x60, 0x011d}, /* GlobalGain */
4281/* Auto correction */
4282 {0xa0, 0x40, 0x0180}, /* AutoCorrectEnable */
4283 {0xa1, 0x01, 0x0180}, /* AutoCorrectEnable */
4284 {0xa0, 0x42, 0x0180}, /* AutoCorrectEnable */
4285/* Gains */
4286 {0xa0, 0x40, 0x0116}, /* RGain */
4287 {0xa0, 0x40, 0x0117}, /* GGain */
4288 {0xa0, 0x40, 0x0118}, /* BGain */
4289
4290 {0xa0, 0x00, 0x0007}, /* AutoCorrectEnable */
4291 {0xa0, 0xff, 0x0018}, /* Frame adjust */
4292 {0, 0, 0}
4293};
4294static struct usb_action pas106b_50HZ[] = {
4295 {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
4296 {0xa0, 0x06, 0x0191}, /* 01,91,06,cc */
4297 {0xa0, 0x54, 0x0192}, /* 01,92,54,cc */
4298 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */
4299 {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */
4300 {0xa0, 0x87, 0x0197}, /* 01,97,87,cc */
4301 {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */
4302 {0xa0, 0x30, 0x018f}, /* 01,8f,30,cc */
4303 {0xaa, 0x03, 0x0021}, /* 00,03,21,aa */
4304 {0xaa, 0x04, 0x000c}, /* 00,04,0c,aa */
4305 {0xaa, 0x05, 0x0002}, /* 00,05,02,aa */
4306 {0xaa, 0x07, 0x001c}, /* 00,07,1c,aa */
4307 {0xa0, 0x04, 0x01a9}, /* 01,a9,04,cc */
4308 {0, 0, 0}
4309};
4310static struct usb_action pas106b_60HZ[] = {
4311 {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
4312 {0xa0, 0x06, 0x0191}, /* 01,91,06,cc */
4313 {0xa0, 0x2e, 0x0192}, /* 01,92,2e,cc */
4314 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */
4315 {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */
4316 {0xa0, 0x71, 0x0197}, /* 01,97,71,cc */
4317 {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */
4318 {0xa0, 0x30, 0x018f}, /* 01,8f,30,cc */
4319 {0xaa, 0x03, 0x001c}, /* 00,03,1c,aa */
4320 {0xaa, 0x04, 0x0004}, /* 00,04,04,aa */
4321 {0xaa, 0x05, 0x0001}, /* 00,05,01,aa */
4322 {0xaa, 0x07, 0x00c4}, /* 00,07,c4,aa */
4323 {0xa0, 0x04, 0x01a9}, /* 01,a9,04,cc */
4324 {0, 0, 0}
4325};
4326static struct usb_action pas106b_NoFliker[] = {
4327 {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
4328 {0xa0, 0x06, 0x0191}, /* 01,91,06,cc */
4329 {0xa0, 0x50, 0x0192}, /* 01,92,50,cc */
4330 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */
4331 {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */
4332 {0xa0, 0x10, 0x0197}, /* 01,97,10,cc */
4333 {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */
4334 {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */
4335 {0xaa, 0x03, 0x0013}, /* 00,03,13,aa */
4336 {0xaa, 0x04, 0x0000}, /* 00,04,00,aa */
4337 {0xaa, 0x05, 0x0001}, /* 00,05,01,aa */
4338 {0xaa, 0x07, 0x0030}, /* 00,07,30,aa */
4339 {0xa0, 0x00, 0x01a9}, /* 01,a9,00,cc */
4340 {0, 0, 0}
4341};
4342
4343/* Aurelien setting from snoop */
4344static struct usb_action pb03303x_Initial[] = {
4345 {0xa0, 0x01, 0x0000},
4346 {0xa0, 0x03, 0x0008},
4347 {0xa0, 0x0a, 0x0010},
4348 {0xa0, 0x10, 0x0002},
4349 {0xa0, 0x02, 0x0003},
4350 {0xa0, 0x80, 0x0004},
4351 {0xa0, 0x01, 0x0005},
4352 {0xa0, 0xe0, 0x0006},
4353 {0xa0, 0xdc, 0x008b}, /* 8b -> dc */
4354 {0xa0, 0x01, 0x0001},
4355 {0xa0, 0x03, 0x0012},
4356 {0xa0, 0x01, 0x0012},
4357 {0xa0, 0x00, 0x0098},
4358 {0xa0, 0x00, 0x009a},
4359 {0xa0, 0x00, 0x011a},
4360 {0xa0, 0x00, 0x011c},
4361 {0xa0, 0xdc, 0x008b},
4362 {0xaa, 0x01, 0x0001},
4363 {0xaa, 0x06, 0x0000},
4364 {0xaa, 0x08, 0x0483},
4365 {0xaa, 0x01, 0x0004},
4366 {0xaa, 0x08, 0x0006},
4367 {0xaa, 0x02, 0x0011},
4368 {0xaa, 0x03, 0x01e7},
4369 {0xaa, 0x04, 0x0287},
4370 {0xaa, 0x07, 0x3002},
4371 {0xaa, 0x20, 0x1100},
4372 {0xaa, 0x35, 0x0050},
4373 {0xaa, 0x30, 0x0005},
4374 {0xaa, 0x31, 0x0000},
4375 {0xaa, 0x58, 0x0078},
4376 {0xaa, 0x62, 0x0411},
4377 {0xaa, 0x2b, 0x0028},
4378 {0xaa, 0x2c, 0x0030},
4379 {0xaa, 0x2d, 0x0030},
4380 {0xaa, 0x2e, 0x0028},
4381 {0xa0, 0x10, 0x0087},
4382 {0xa0, 0x37, 0x0101},
4383 {0xa0, 0x05, 0x0012},
4384 {0xa0, 0x0d, 0x0100},
4385 {0xa0, 0x06, 0x0189},
4386 {0xa0, 0x00, 0x01ad},
4387 {0xa0, 0x03, 0x01c5},
4388 {0xa0, 0x13, 0x01cb},
4389 {0xa0, 0x08, 0x0250},
4390 {0xa0, 0x08, 0x0301},
4391 {0xa0, 0x60, 0x01a8},
4392 {0xa0, 0x78, 0x018d},
4393 {0xa0, 0x61, 0x0116},
4394 {0xa0, 0x65, 0x0118},
4395
4396 {0xa1, 0x01, 0x0002},
4397 {0xa0, 0x09, 0x01ad},
4398 {0xa0, 0x15, 0x01ae},
4399 {0xa0, 0x0d, 0x003a},
4400 {0xa0, 0x02, 0x003b},
4401 {0xa0, 0x00, 0x0038},
4402 {0xa0, 0x50, 0x010a}, /* matrix */
4403 {0xa0, 0xf8, 0x010b},
4404 {0xa0, 0xf8, 0x010c},
4405 {0xa0, 0xf8, 0x010d},
4406 {0xa0, 0x50, 0x010e},
4407 {0xa0, 0xf8, 0x010f},
4408 {0xa0, 0xf8, 0x0110},
4409 {0xa0, 0xf8, 0x0111},
4410 {0xa0, 0x50, 0x0112},
4411
4412 {0xa1, 0x01, 0x0008},
4413 {0xa0, 0x03, 0x0008}, /* clock ? */
4414 {0xa0, 0x08, 0x01c6},
4415 {0xa1, 0x01, 0x01c8},
4416 {0xa1, 0x01, 0x01c9},
4417 {0xa1, 0x01, 0x01ca},
4418 {0xa0, 0x0f, 0x01cb},
4419 {0xa0, 0x13, 0x0120}, /* gamma 4 */
4420 {0xa0, 0x38, 0x0121},
4421 {0xa0, 0x59, 0x0122},
4422 {0xa0, 0x79, 0x0123},
4423 {0xa0, 0x92, 0x0124},
4424 {0xa0, 0xa7, 0x0125},
4425 {0xa0, 0xb9, 0x0126},
4426 {0xa0, 0xc8, 0x0127},
4427 {0xa0, 0xd4, 0x0128},
4428 {0xa0, 0xdf, 0x0129},
4429 {0xa0, 0xe7, 0x012a},
4430 {0xa0, 0xee, 0x012b},
4431 {0xa0, 0xf4, 0x012c},
4432 {0xa0, 0xf9, 0x012d},
4433 {0xa0, 0xfc, 0x012e},
4434 {0xa0, 0xff, 0x012f},
4435 {0xa0, 0x26, 0x0130},
4436 {0xa0, 0x22, 0x0131},
4437 {0xa0, 0x20, 0x0132},
4438 {0xa0, 0x1c, 0x0133},
4439 {0xa0, 0x16, 0x0134},
4440 {0xa0, 0x13, 0x0135},
4441 {0xa0, 0x10, 0x0136},
4442 {0xa0, 0x0d, 0x0137},
4443 {0xa0, 0x0b, 0x0138},
4444 {0xa0, 0x09, 0x0139},
4445 {0xa0, 0x07, 0x013a},
4446 {0xa0, 0x06, 0x013b},
4447 {0xa0, 0x05, 0x013c},
4448 {0xa0, 0x04, 0x013d},
4449 {0xa0, 0x03, 0x013e},
4450 {0xa0, 0x02, 0x013f},
4451 {0xa0, 0x50, 0x010a}, /* matrix */
4452 {0xa0, 0xf8, 0x010b},
4453 {0xa0, 0xf8, 0x010c},
4454 {0xa0, 0xf8, 0x010d},
4455 {0xa0, 0x50, 0x010e},
4456 {0xa0, 0xf8, 0x010f},
4457 {0xa0, 0xf8, 0x0110},
4458 {0xa0, 0xf8, 0x0111},
4459 {0xa0, 0x50, 0x0112},
4460
4461 {0xa1, 0x01, 0x0180},
4462 {0xa0, 0x00, 0x0180},
4463 {0xa0, 0x00, 0x0180},
4464 {0xa0, 0x00, 0x0019},
4465 {0xaa, 0x05, 0x0009},
4466 {0xaa, 0x09, 0x0134},
4467 {0xa0, 0x00, 0x0190},
4468 {0xa0, 0x07, 0x0191},
4469 {0xa0, 0xec, 0x0192},
4470 {0xa0, 0x00, 0x0195},
4471 {0xa0, 0x00, 0x0196},
4472 {0xa0, 0x9c, 0x0197},
4473 {0xa0, 0x0e, 0x018c},
4474 {0xa0, 0x1c, 0x018f},
4475 {0xa0, 0x14, 0x01a9},
4476 {0xa0, 0x24, 0x01aa},
4477 {0xa0, 0xd7, 0x001d},
4478 {0xa0, 0xf4, 0x001e},
4479 {0xa0, 0xf9, 0x001f},
4480 {0xa0, 0xff, 0x0020},
4481 {0xa0, 0x42, 0x0180},
4482 {0xa0, 0x09, 0x01ad},
4483 {0xa0, 0x15, 0x01ae},
4484 {0xa0, 0x40, 0x0180},
4485 {0xa1, 0x01, 0x0180},
4486 {0xa0, 0x42, 0x0180},
4487 {0, 0, 0}
4488};
4489
4490static struct usb_action pb03303x_InitialScale[] = {
4491 {0xa0, 0x01, 0x0000},
4492 {0xa0, 0x03, 0x0008},
4493 {0xa0, 0x0a, 0x0010},
4494 {0xa0, 0x00, 0x0002},
4495 {0xa0, 0x02, 0x0003},
4496 {0xa0, 0x80, 0x0004},
4497 {0xa0, 0x01, 0x0005},
4498 {0xa0, 0xe0, 0x0006},
4499 {0xa0, 0xdc, 0x008b}, /* 8b -> dc */
4500 {0xa0, 0x01, 0x0001},
4501 {0xa0, 0x03, 0x0012},
4502 {0xa0, 0x01, 0x0012},
4503 {0xa0, 0x00, 0x0098},
4504 {0xa0, 0x00, 0x009a},
4505 {0xa0, 0x00, 0x011a},
4506 {0xa0, 0x00, 0x011c},
4507 {0xa0, 0xdc, 0x008b},
4508 {0xaa, 0x01, 0x0001},
4509 {0xaa, 0x06, 0x0000},
4510 {0xaa, 0x08, 0x0483},
4511 {0xaa, 0x01, 0x0004},
4512 {0xaa, 0x08, 0x0006},
4513 {0xaa, 0x02, 0x0011},
4514 {0xaa, 0x03, 0x01e7},
4515 {0xaa, 0x04, 0x0287},
4516 {0xaa, 0x07, 0x3002},
4517 {0xaa, 0x20, 0x1100},
4518 {0xaa, 0x35, 0x0050},
4519 {0xaa, 0x30, 0x0005},
4520 {0xaa, 0x31, 0x0000},
4521 {0xaa, 0x58, 0x0078},
4522 {0xaa, 0x62, 0x0411},
4523 {0xaa, 0x2b, 0x0028},
4524 {0xaa, 0x2c, 0x0030},
4525 {0xaa, 0x2d, 0x0030},
4526 {0xaa, 0x2e, 0x0028},
4527 {0xa0, 0x10, 0x0087},
4528 {0xa0, 0x37, 0x0101},
4529 {0xa0, 0x05, 0x0012},
4530 {0xa0, 0x0d, 0x0100},
4531 {0xa0, 0x06, 0x0189},
4532 {0xa0, 0x00, 0x01ad},
4533 {0xa0, 0x03, 0x01c5},
4534 {0xa0, 0x13, 0x01cb},
4535 {0xa0, 0x08, 0x0250},
4536 {0xa0, 0x08, 0x0301},
4537 {0xa0, 0x60, 0x01a8},
4538 {0xa0, 0x78, 0x018d},
4539 {0xa0, 0x61, 0x0116},
4540 {0xa0, 0x65, 0x0118},
4541
4542 {0xa1, 0x01, 0x0002},
4543
4544 {0xa0, 0x09, 0x01ad},
4545 {0xa0, 0x15, 0x01ae},
4546
4547 {0xa0, 0x0d, 0x003a},
4548 {0xa0, 0x02, 0x003b},
4549 {0xa0, 0x00, 0x0038},
4550 {0xa0, 0x50, 0x010a}, /* matrix */
4551 {0xa0, 0xf8, 0x010b},
4552 {0xa0, 0xf8, 0x010c},
4553 {0xa0, 0xf8, 0x010d},
4554 {0xa0, 0x50, 0x010e},
4555 {0xa0, 0xf8, 0x010f},
4556 {0xa0, 0xf8, 0x0110},
4557 {0xa0, 0xf8, 0x0111},
4558 {0xa0, 0x50, 0x0112},
4559
4560 {0xa1, 0x01, 0x0008},
4561 {0xa0, 0x03, 0x0008}, /* clock ? */
4562 {0xa0, 0x08, 0x01c6},
4563 {0xa1, 0x01, 0x01c8},
4564 {0xa1, 0x01, 0x01c9},
4565 {0xa1, 0x01, 0x01ca},
4566 {0xa0, 0x0f, 0x01cb},
4567
4568 {0xa0, 0x13, 0x0120}, /* gamma 4 */
4569 {0xa0, 0x38, 0x0121},
4570 {0xa0, 0x59, 0x0122},
4571 {0xa0, 0x79, 0x0123},
4572 {0xa0, 0x92, 0x0124},
4573 {0xa0, 0xa7, 0x0125},
4574 {0xa0, 0xb9, 0x0126},
4575 {0xa0, 0xc8, 0x0127},
4576 {0xa0, 0xd4, 0x0128},
4577 {0xa0, 0xdf, 0x0129},
4578 {0xa0, 0xe7, 0x012a},
4579 {0xa0, 0xee, 0x012b},
4580 {0xa0, 0xf4, 0x012c},
4581 {0xa0, 0xf9, 0x012d},
4582 {0xa0, 0xfc, 0x012e},
4583 {0xa0, 0xff, 0x012f},
4584 {0xa0, 0x26, 0x0130},
4585 {0xa0, 0x22, 0x0131},
4586 {0xa0, 0x20, 0x0132},
4587 {0xa0, 0x1c, 0x0133},
4588 {0xa0, 0x16, 0x0134},
4589 {0xa0, 0x13, 0x0135},
4590 {0xa0, 0x10, 0x0136},
4591 {0xa0, 0x0d, 0x0137},
4592 {0xa0, 0x0b, 0x0138},
4593 {0xa0, 0x09, 0x0139},
4594 {0xa0, 0x07, 0x013a},
4595 {0xa0, 0x06, 0x013b},
4596 {0xa0, 0x05, 0x013c},
4597 {0xa0, 0x04, 0x013d},
4598 {0xa0, 0x03, 0x013e},
4599 {0xa0, 0x02, 0x013f},
4600 {0xa0, 0x50, 0x010a}, /* matrix */
4601 {0xa0, 0xf8, 0x010b},
4602 {0xa0, 0xf8, 0x010c},
4603 {0xa0, 0xf8, 0x010d},
4604 {0xa0, 0x50, 0x010e},
4605 {0xa0, 0xf8, 0x010f},
4606 {0xa0, 0xf8, 0x0110},
4607 {0xa0, 0xf8, 0x0111},
4608 {0xa0, 0x50, 0x0112},
4609
4610 {0xa1, 0x01, 0x0180},
4611 {0xa0, 0x00, 0x0180},
4612 {0xa0, 0x00, 0x0180},
4613 {0xa0, 0x00, 0x0019},
4614 {0xaa, 0x05, 0x0009},
4615 {0xaa, 0x09, 0x0134},
4616 {0xa0, 0x00, 0x0190},
4617 {0xa0, 0x07, 0x0191},
4618 {0xa0, 0xec, 0x0192},
4619 {0xa0, 0x00, 0x0195},
4620 {0xa0, 0x00, 0x0196},
4621 {0xa0, 0x9c, 0x0197},
4622 {0xa0, 0x0e, 0x018c},
4623 {0xa0, 0x1c, 0x018f},
4624 {0xa0, 0x14, 0x01a9},
4625 {0xa0, 0x24, 0x01aa},
4626 {0xa0, 0xd7, 0x001d},
4627 {0xa0, 0xf4, 0x001e},
4628 {0xa0, 0xf9, 0x001f},
4629 {0xa0, 0xff, 0x0020},
4630 {0xa0, 0x42, 0x0180},
4631 {0xa0, 0x09, 0x01ad},
4632 {0xa0, 0x15, 0x01ae},
4633 {0xa0, 0x40, 0x0180},
4634 {0xa1, 0x01, 0x0180},
4635 {0xa0, 0x42, 0x0180},
4636 {0, 0, 0}
4637};
4638static struct usb_action pb0330xx_Initial[] = {
4639 {0xa1, 0x01, 0x0008},
4640 {0xa1, 0x01, 0x0008},
4641 {0xa0, 0x01, 0x0000},
4642 {0xa0, 0x03, 0x0008}, /* 00 */
4643 {0xa0, 0x0a, 0x0010},
4644 {0xa0, 0x10, 0x0002},
4645 {0xa0, 0x02, 0x0003},
4646 {0xa0, 0x80, 0x0004},
4647 {0xa0, 0x01, 0x0005},
4648 {0xa0, 0xe0, 0x0006},
4649 {0xa0, 0x01, 0x0001},
4650 {0xa0, 0x05, 0x0012},
4651 {0xa0, 0x07, 0x0012},
4652 {0xa0, 0x00, 0x0098},
4653 {0xa0, 0x00, 0x009a},
4654 {0xa0, 0x00, 0x011a},
4655 {0xa0, 0x00, 0x011c},
4656 {0xa0, 0x05, 0x0012},
4657 {0xaa, 0x01, 0x0006},
4658 {0xaa, 0x02, 0x0011},
4659 {0xaa, 0x03, 0x01e7},
4660 {0xaa, 0x04, 0x0287},
4661 {0xaa, 0x06, 0x0003},
4662 {0xaa, 0x07, 0x3002},
4663 {0xaa, 0x20, 0x1100},
4664 {0xaa, 0x2f, 0xf7b0},
4665 {0xaa, 0x30, 0x0005},
4666 {0xaa, 0x31, 0x0000},
4667 {0xaa, 0x34, 0x0100},
4668 {0xaa, 0x35, 0x0060},
4669 {0xaa, 0x3d, 0x068f},
4670 {0xaa, 0x40, 0x01e0},
4671 {0xaa, 0x58, 0x0078},
4672 {0xaa, 0x62, 0x0411},
4673 {0xa0, 0x10, 0x0087},
4674 {0xa0, 0x37, 0x0101},
4675 {0xa0, 0x05, 0x0012},
4676 {0xa0, 0x0d, 0x0100},
4677 {0xa0, 0x06, 0x0189},
4678 {0xa0, 0x00, 0x01ad},
4679 {0xa0, 0x03, 0x01c5},
4680 {0xa0, 0x13, 0x01cb},
4681 {0xa0, 0x08, 0x0250},
4682 {0xa0, 0x08, 0x0301},
4683 {0xa0, 0x60, 0x01a8},
4684 {0xa0, 0x6c, 0x018d},
4685 {0xa1, 0x01, 0x0002},
4686 {0xa0, 0x09, 0x01ad},
4687 {0xa0, 0x15, 0x01ae},
4688 {0xa0, 0x00, 0x0092},
4689 {0xa0, 0x02, 0x0090},
4690 {0xa1, 0x01, 0x0091},
4691 {0xa1, 0x01, 0x0095},
4692 {0xa1, 0x01, 0x0096},
4693 {0xa0, 0x50, 0x010a}, /* matrix */
4694 {0xa0, 0xf8, 0x010b},
4695 {0xa0, 0xf8, 0x010c},
4696 {0xa0, 0xf8, 0x010d},
4697 {0xa0, 0x50, 0x010e},
4698 {0xa0, 0xf8, 0x010f},
4699 {0xa0, 0xf8, 0x0110},
4700 {0xa0, 0xf8, 0x0111},
4701 {0xa0, 0x50, 0x0112},
4702 {0xa1, 0x01, 0x0008},
4703 {0xa0, 0x03, 0x0008}, /* clock ? */
4704 {0xa0, 0x08, 0x01c6},
4705 {0xa1, 0x01, 0x01c8},
4706 {0xa1, 0x01, 0x01c9},
4707 {0xa1, 0x01, 0x01ca},
4708 {0xa0, 0x0f, 0x01cb},
4709
4710 {0xa0, 0x50, 0x010a}, /* matrix */
4711 {0xa0, 0xf8, 0x010b},
4712 {0xa0, 0xf8, 0x010c},
4713 {0xa0, 0xf8, 0x010d},
4714 {0xa0, 0x50, 0x010e},
4715 {0xa0, 0xf8, 0x010f},
4716 {0xa0, 0xf8, 0x0110},
4717 {0xa0, 0xf8, 0x0111},
4718 {0xa0, 0x50, 0x0112},
4719 {0xa1, 0x01, 0x0180},
4720 {0xa0, 0x00, 0x0180},
4721 {0xa0, 0x00, 0x0019},
4722 {0xaa, 0x05, 0x0066},
4723 {0xaa, 0x09, 0x02b2},
4724 {0xaa, 0x10, 0x0002},
4725
4726 {0xa0, 0x60, 0x011d},
4727 {0xa0, 0x00, 0x0190},
4728 {0xa0, 0x07, 0x0191},
4729 {0xa0, 0x8c, 0x0192},
4730 {0xa0, 0x00, 0x0195},
4731 {0xa0, 0x00, 0x0196},
4732 {0xa0, 0x8a, 0x0197},
4733 {0xa0, 0x10, 0x018c},
4734 {0xa0, 0x20, 0x018f},
4735 {0xa0, 0x14, 0x01a9},
4736 {0xa0, 0x24, 0x01aa},
4737 {0xa0, 0xd7, 0x001d},
4738 {0xa0, 0xf0, 0x001e},
4739 {0xa0, 0xf8, 0x001f},
4740 {0xa0, 0xff, 0x0020},
4741 {0xa0, 0x09, 0x01ad},
4742 {0xa0, 0x15, 0x01ae},
4743 {0xa0, 0x40, 0x0180},
4744 {0xa1, 0x01, 0x0180},
4745 {0xa0, 0x42, 0x0180},
4746 {0xa1, 0x01, 0x0008},
4747 {0xa1, 0x01, 0x0007},
4748/* {0xa0, 0x30, 0x0007}, */
4749/* {0xa0, 0x00, 0x0007}, */
4750 {0, 0, 0}
4751};
4752
4753static struct usb_action pb0330xx_InitialScale[] = {
4754 {0xa1, 0x01, 0x0008},
4755 {0xa1, 0x01, 0x0008},
4756 {0xa0, 0x01, 0x0000},
4757 {0xa0, 0x03, 0x0008}, /* 00 */
4758 {0xa0, 0x0a, 0x0010},
4759 {0xa0, 0x00, 0x0002}, /* 10 */
4760 {0xa0, 0x02, 0x0003},
4761 {0xa0, 0x80, 0x0004},
4762 {0xa0, 0x01, 0x0005},
4763 {0xa0, 0xe0, 0x0006},
4764 {0xa0, 0x01, 0x0001},
4765 {0xa0, 0x05, 0x0012},
4766 {0xa0, 0x07, 0x0012},
4767 {0xa0, 0x00, 0x0098},
4768 {0xa0, 0x00, 0x009a},
4769 {0xa0, 0x00, 0x011a},
4770 {0xa0, 0x00, 0x011c},
4771 {0xa0, 0x05, 0x0012},
4772 {0xaa, 0x01, 0x0006},
4773 {0xaa, 0x02, 0x0011},
4774 {0xaa, 0x03, 0x01e7},
4775 {0xaa, 0x04, 0x0287},
4776 {0xaa, 0x06, 0x0003},
4777 {0xaa, 0x07, 0x3002},
4778 {0xaa, 0x20, 0x1100},
4779 {0xaa, 0x2f, 0xf7b0},
4780 {0xaa, 0x30, 0x0005},
4781 {0xaa, 0x31, 0x0000},
4782 {0xaa, 0x34, 0x0100},
4783 {0xaa, 0x35, 0x0060},
4784 {0xaa, 0x3d, 0x068f},
4785 {0xaa, 0x40, 0x01e0},
4786 {0xaa, 0x58, 0x0078},
4787 {0xaa, 0x62, 0x0411},
4788 {0xa0, 0x10, 0x0087},
4789 {0xa0, 0x37, 0x0101},
4790 {0xa0, 0x05, 0x0012},
4791 {0xa0, 0x0d, 0x0100},
4792 {0xa0, 0x06, 0x0189},
4793 {0xa0, 0x00, 0x01ad},
4794 {0xa0, 0x03, 0x01c5},
4795 {0xa0, 0x13, 0x01cb},
4796 {0xa0, 0x08, 0x0250},
4797 {0xa0, 0x08, 0x0301},
4798 {0xa0, 0x60, 0x01a8},
4799 {0xa0, 0x6c, 0x018d},
4800 {0xa1, 0x01, 0x0002},
4801 {0xa0, 0x09, 0x01ad},
4802 {0xa0, 0x15, 0x01ae},
4803 {0xa0, 0x00, 0x0092},
4804 {0xa0, 0x02, 0x0090},
4805 {0xa1, 0x01, 0x0091},
4806 {0xa1, 0x01, 0x0095},
4807 {0xa1, 0x01, 0x0096},
4808 {0xa0, 0x50, 0x010a}, /* matrix */
4809 {0xa0, 0xf8, 0x010b},
4810 {0xa0, 0xf8, 0x010c},
4811 {0xa0, 0xf8, 0x010d},
4812 {0xa0, 0x50, 0x010e},
4813 {0xa0, 0xf8, 0x010f},
4814 {0xa0, 0xf8, 0x0110},
4815 {0xa0, 0xf8, 0x0111},
4816 {0xa0, 0x50, 0x0112},
4817 {0xa1, 0x01, 0x0008},
4818 {0xa0, 0x03, 0x0008}, /* clock ? */
4819 {0xa0, 0x08, 0x01c6},
4820 {0xa1, 0x01, 0x01c8},
4821 {0xa1, 0x01, 0x01c9},
4822 {0xa1, 0x01, 0x01ca},
4823 {0xa0, 0x0f, 0x01cb},
4824
4825 {0xa0, 0x50, 0x010a}, /* matrix */
4826 {0xa0, 0xf8, 0x010b},
4827 {0xa0, 0xf8, 0x010c},
4828 {0xa0, 0xf8, 0x010d},
4829 {0xa0, 0x50, 0x010e},
4830 {0xa0, 0xf8, 0x010f},
4831 {0xa0, 0xf8, 0x0110},
4832 {0xa0, 0xf8, 0x0111},
4833 {0xa0, 0x50, 0x0112},
4834 {0xa1, 0x01, 0x0180},
4835 {0xa0, 0x00, 0x0180},
4836 {0xa0, 0x00, 0x0019},
4837 {0xaa, 0x05, 0x0066},
4838 {0xaa, 0x09, 0x02b2},
4839 {0xaa, 0x10, 0x0002},
4840 {0xa0, 0x60, 0x011d},
4841 {0xa0, 0x00, 0x0190},
4842 {0xa0, 0x07, 0x0191},
4843 {0xa0, 0x8c, 0x0192},
4844 {0xa0, 0x00, 0x0195},
4845 {0xa0, 0x00, 0x0196},
4846 {0xa0, 0x8a, 0x0197},
4847 {0xa0, 0x10, 0x018c},
4848 {0xa0, 0x20, 0x018f},
4849 {0xa0, 0x14, 0x01a9},
4850 {0xa0, 0x24, 0x01aa},
4851 {0xa0, 0xd7, 0x001d},
4852 {0xa0, 0xf0, 0x001e},
4853 {0xa0, 0xf8, 0x001f},
4854 {0xa0, 0xff, 0x0020},
4855 {0xa0, 0x09, 0x01ad},
4856 {0xa0, 0x15, 0x01ae},
4857 {0xa0, 0x40, 0x0180},
4858 {0xa1, 0x01, 0x0180},
4859 {0xa0, 0x42, 0x0180},
4860 {0xa1, 0x01, 0x0008},
4861 {0xa1, 0x01, 0x0007},
4862/* {0xa0, 0x30, 0x0007}, */
4863/* {0xa0, 0x00, 0x0007}, */
4864 {0, 0, 0}
4865};
4866static struct usb_action pb0330_50HZ[] = {
4867 {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
4868 {0xa0, 0x07, 0x0191}, /* 01,91,07,cc */
4869 {0xa0, 0xee, 0x0192}, /* 01,92,ee,cc */
4870 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */
4871 {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */
4872 {0xa0, 0x46, 0x0197}, /* 01,97,46,cc */
4873 {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */
4874 {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */
4875 {0xa0, 0x0c, 0x01a9}, /* 01,a9,0c,cc */
4876 {0xa0, 0x26, 0x01aa}, /* 01,aa,26,cc */
4877 {0xa0, 0x68, 0x001d}, /* 00,1d,68,cc */
4878 {0xa0, 0x90, 0x001e}, /* 00,1e,90,cc */
4879 {0xa0, 0xc8, 0x001f}, /* 00,1f,c8,cc */
4880 {0, 0, 0}
4881};
4882static struct usb_action pb0330_50HZScale[] = {
4883 {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
4884 {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
4885 {0xa0, 0x07, 0x0191}, /* 01,91,07,cc */
4886 {0xa0, 0xa0, 0x0192}, /* 01,92,a0,cc */
4887 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */
4888 {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */
4889 {0xa0, 0x7a, 0x0197}, /* 01,97,7a,cc */
4890 {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */
4891 {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */
4892 {0xa0, 0x0c, 0x01a9}, /* 01,a9,0c,cc */
4893 {0xa0, 0x26, 0x01aa}, /* 01,aa,26,cc */
4894 {0xa0, 0xe5, 0x001d}, /* 00,1d,e5,cc */
4895 {0xa0, 0xf0, 0x001e}, /* 00,1e,f0,cc */
4896 {0xa0, 0xf8, 0x001f}, /* 00,1f,f8,cc */
4897 {0, 0, 0}
4898};
4899static struct usb_action pb0330_60HZ[] = {
4900 {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
4901 {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
4902 {0xa0, 0x07, 0x0191}, /* 01,91,07,cc */
4903 {0xa0, 0xdd, 0x0192}, /* 01,92,dd,cc */
4904 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */
4905 {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */
4906 {0xa0, 0x3d, 0x0197}, /* 01,97,3d,cc */
4907 {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */
4908 {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */
4909 {0xa0, 0x0c, 0x01a9}, /* 01,a9,0c,cc */
4910 {0xa0, 0x26, 0x01aa}, /* 01,aa,26,cc */
4911 {0xa0, 0x43, 0x001d}, /* 00,1d,43,cc */
4912 {0xa0, 0x50, 0x001e}, /* 00,1e,50,cc */
4913 {0xa0, 0x90, 0x001f}, /* 00,1f,90,cc */
4914 {0, 0, 0}
4915};
4916static struct usb_action pb0330_60HZScale[] = {
4917 {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
4918 {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
4919 {0xa0, 0x07, 0x0191}, /* 01,91,07,cc */
4920 {0xa0, 0xa0, 0x0192}, /* 01,92,a0,cc */
4921 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */
4922 {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */
4923 {0xa0, 0x7a, 0x0197}, /* 01,97,7a,cc */
4924 {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */
4925 {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */
4926 {0xa0, 0x0c, 0x01a9}, /* 01,a9,0c,cc */
4927 {0xa0, 0x26, 0x01aa}, /* 01,aa,26,cc */
4928 {0xa0, 0x41, 0x001d}, /* 00,1d,41,cc */
4929 {0xa0, 0x50, 0x001e}, /* 00,1e,50,cc */
4930 {0xa0, 0x90, 0x001f}, /* 00,1f,90,cc */
4931 {0, 0, 0}
4932};
4933static struct usb_action pb0330_NoFliker[] = {
4934 {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
4935 {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
4936 {0xa0, 0x07, 0x0191}, /* 01,91,07,cc */
4937 {0xa0, 0xf0, 0x0192}, /* 01,92,f0,cc */
4938 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */
4939 {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */
4940 {0xa0, 0x10, 0x0197}, /* 01,97,10,cc */
4941 {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */
4942 {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */
4943 {0xa0, 0x00, 0x01a9}, /* 01,a9,00,cc */
4944 {0xa0, 0x00, 0x01aa}, /* 01,aa,00,cc */
4945 {0xa0, 0x09, 0x001d}, /* 00,1d,09,cc */
4946 {0xa0, 0x40, 0x001e}, /* 00,1e,40,cc */
4947 {0xa0, 0x90, 0x001f}, /* 00,1f,90,cc */
4948 {0, 0, 0}
4949};
4950static struct usb_action pb0330_NoFlikerScale[] = {
4951 {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
4952 {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
4953 {0xa0, 0x07, 0x0191}, /* 01,91,07,cc */
4954 {0xa0, 0xf0, 0x0192}, /* 01,92,f0,cc */
4955 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */
4956 {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */
4957 {0xa0, 0x10, 0x0197}, /* 01,97,10,cc */
4958 {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */
4959 {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */
4960 {0xa0, 0x00, 0x01a9}, /* 01,a9,00,cc */
4961 {0xa0, 0x00, 0x01aa}, /* 01,aa,00,cc */
4962 {0xa0, 0x09, 0x001d}, /* 00,1d,09,cc */
4963 {0xa0, 0x40, 0x001e}, /* 00,1e,40,cc */
4964 {0xa0, 0x90, 0x001f}, /* 00,1f,90,cc */
4965 {0, 0, 0}
4966};
4967
4968/* from oem9.inf - HKR,%PO2030%,Initial - 640x480 - (close to CS2102) */
4969static struct usb_action PO2030_mode0[] = {
4970 {0xa0, 0x01, 0x0000}, /* 00,00,01,cc */
4971 {0xa0, 0x04, 0x0002}, /* 00,02,04,cc */
4972 {0xa0, 0x01, 0x0010}, /* 00,10,01,cc */
4973 {0xa0, 0x01, 0x0001}, /* 00,01,01,cc */
4974 {0xa0, 0x04, 0x0080}, /* 00,80,04,cc */
4975 {0xa0, 0x05, 0x0081}, /* 00,81,05,cc */
4976 {0xa0, 0x16, 0x0083}, /* 00,83,16,cc */
4977 {0xa0, 0x18, 0x0085}, /* 00,85,18,cc */
4978 {0xa0, 0x1a, 0x0086}, /* 00,86,1a,cc */
4979 {0xa0, 0x1b, 0x0087}, /* 00,87,1b,cc */
4980 {0xa0, 0x1c, 0x0088}, /* 00,88,1c,cc */
4981 {0xa0, 0xee, 0x008b}, /* 00,8b,ee,cc */
4982 {0xa0, 0x03, 0x0008}, /* 00,08,03,cc */
4983 {0xa0, 0x03, 0x0012}, /* 00,12,03,cc */
4984 {0xa0, 0x01, 0x0012}, /* 00,12,01,cc */
4985 {0xa0, 0x02, 0x0003}, /* 00,03,02,cc */
4986 {0xa0, 0x80, 0x0004}, /* 00,04,80,cc */
4987 {0xa0, 0x01, 0x0005}, /* 00,05,01,cc */
4988 {0xa0, 0xe0, 0x0006}, /* 00,06,e0,cc */
4989 {0xa0, 0x42, 0x0180}, /* 01,80,42,cc */
4990 {0xaa, 0x8d, 0x0008}, /* 00,8d,08,aa */
4991 {0xa0, 0x00, 0x0098}, /* 00,98,00,cc */
4992 {0xa0, 0x00, 0x009a}, /* 00,9a,00,cc */
4993 {0xa0, 0x00, 0x011a}, /* 01,1a,00,cc */
4994 {0xa0, 0x00, 0x011c}, /* 01,1c,00,cc */
4995 {0xa0, 0xe6, 0x009c}, /* 00,9c,e6,cc */
4996 {0xa0, 0x86, 0x009e}, /* 00,9e,86,cc */
4997 {0xaa, 0x09, 0x00ce}, /* 00,09,ce,aa */
4998 {0xaa, 0x0b, 0x0005}, /* 00,0b,05,aa */
4999 {0xaa, 0x0d, 0x0054}, /* 00,0d,54,aa */
5000 {0xaa, 0x0f, 0x00eb}, /* 00,0f,eb,aa */
5001 {0xaa, 0x87, 0x0000}, /* 00,87,00,aa */
5002 {0xaa, 0x88, 0x0004}, /* 00,88,04,aa */
5003 {0xaa, 0x89, 0x0000}, /* 00,89,00,aa */
5004 {0xaa, 0x8a, 0x0005}, /* 00,8a,05,aa */
5005 {0xaa, 0x13, 0x0003}, /* 00,13,03,aa */
5006 {0xaa, 0x16, 0x0040}, /* 00,16,40,aa */
5007 {0xaa, 0x18, 0x0040}, /* 00,18,40,aa */
5008 {0xaa, 0x1d, 0x0002}, /* 00,1d,02,aa */
5009 {0xaa, 0x29, 0x00e8}, /* 00,29,e8,aa */
5010 {0xaa, 0x45, 0x0045}, /* 00,45,45,aa */
5011 {0xaa, 0x50, 0x00ed}, /* 00,50,ed,aa */
5012 {0xaa, 0x51, 0x0025}, /* 00,51,25,aa */
5013 {0xaa, 0x52, 0x0042}, /* 00,52,42,aa */
5014 {0xaa, 0x53, 0x002f}, /* 00,53,2f,aa */
5015 {0xaa, 0x79, 0x0025}, /* 00,79,25,aa */
5016 {0xaa, 0x7b, 0x0000}, /* 00,7b,00,aa */
5017 {0xaa, 0x7e, 0x0025}, /* 00,7e,25,aa */
5018 {0xaa, 0x7f, 0x0025}, /* 00,7f,25,aa */
5019 {0xaa, 0x21, 0x0000}, /* 00,21,00,aa */
5020 {0xaa, 0x33, 0x0036}, /* 00,33,36,aa */
5021 {0xaa, 0x36, 0x0060}, /* 00,36,60,aa */
5022 {0xaa, 0x37, 0x0008}, /* 00,37,08,aa */
5023 {0xaa, 0x3b, 0x0031}, /* 00,3b,31,aa */
5024 {0xaa, 0x44, 0x000f}, /* 00,44,0f,aa */
5025 {0xaa, 0x58, 0x0002}, /* 00,58,02,aa */
5026 {0xaa, 0x66, 0x00c0}, /* 00,66,c0,aa */
5027 {0xaa, 0x67, 0x0044}, /* 00,67,44,aa */
5028 {0xaa, 0x6b, 0x00a0}, /* 00,6b,a0,aa */
5029 {0xaa, 0x6c, 0x0054}, /* 00,6c,54,aa */
5030 {0xaa, 0xd6, 0x0007}, /* 00,d6,07,aa */
5031 {0xa0, 0xf7, 0x0101}, /* 01,01,f7,cc */
5032 {0xa0, 0x05, 0x0012}, /* 00,12,05,cc */
5033 {0xa0, 0x0d, 0x0100}, /* 01,00,0d,cc */
5034 {0xa0, 0x06, 0x0189}, /* 01,89,06,cc */
5035 {0xa0, 0x00, 0x01ad}, /* 01,ad,00,cc */
5036 {0xa0, 0x03, 0x01c5}, /* 01,c5,03,cc */
5037 {0xa0, 0x13, 0x01cb}, /* 01,cb,13,cc */
5038 {0xa0, 0x08, 0x0250}, /* 02,50,08,cc */
5039 {0xa0, 0x08, 0x0301}, /* 03,01,08,cc */
5040 {0xa0, 0x7a, 0x0116}, /* 01,16,7a,cc */
5041 {0xa0, 0x4a, 0x0118}, /* 01,18,4a,cc */
5042 {0, 0, 0}
5043};
5044
5045/* from oem9.inf - HKR,%PO2030%,InitialScale - 320x240 */
5046static struct usb_action PO2030_mode1[] = {
5047 {0xa0, 0x01, 0x0000}, /* 00,00,01,cc */
5048 {0xa0, 0x10, 0x0002}, /* 00,02,10,cc */
5049 {0xa0, 0x01, 0x0010}, /* 00,10,01,cc */
5050 {0xa0, 0x01, 0x0001}, /* 00,01,01,cc */
5051 {0xa0, 0x04, 0x0080}, /* 00,80,04,cc */
5052 {0xa0, 0x05, 0x0081}, /* 00,81,05,cc */
5053 {0xa0, 0x16, 0x0083}, /* 00,83,16,cc */
5054 {0xa0, 0x18, 0x0085}, /* 00,85,18,cc */
5055 {0xa0, 0x1a, 0x0086}, /* 00,86,1a,cc */
5056 {0xa0, 0x1b, 0x0087}, /* 00,87,1b,cc */
5057 {0xa0, 0x1c, 0x0088}, /* 00,88,1c,cc */
5058 {0xa0, 0xee, 0x008b}, /* 00,8b,ee,cc */
5059 {0xa0, 0x03, 0x0008}, /* 00,08,03,cc */
5060 {0xa0, 0x03, 0x0012}, /* 00,12,03,cc */
5061 {0xa0, 0x01, 0x0012}, /* 00,12,01,cc */
5062 {0xa0, 0x02, 0x0003}, /* 00,03,02,cc */
5063 {0xa0, 0x80, 0x0004}, /* 00,04,80,cc */
5064 {0xa0, 0x01, 0x0005}, /* 00,05,01,cc */
5065 {0xa0, 0xe0, 0x0006}, /* 00,06,e0,cc */
5066 {0xa0, 0x42, 0x0180}, /* 01,80,42,cc */
5067 {0xaa, 0x8d, 0x0008}, /* 00,8d,08,aa */
5068 {0xa0, 0x00, 0x0098}, /* 00,98,00,cc */
5069 {0xa0, 0x00, 0x009a}, /* 00,9a,00,cc */
5070 {0xa0, 0x00, 0x011a}, /* 01,1a,00,cc */
5071 {0xa0, 0x00, 0x011c}, /* 01,1c,00,cc */
5072 {0xa0, 0xe8, 0x009c}, /* 00,9c,e8,cc */
5073 {0xa0, 0x88, 0x009e}, /* 00,9e,88,cc */
5074 {0xaa, 0x09, 0x00cc}, /* 00,09,cc,aa */
5075 {0xaa, 0x0b, 0x0005}, /* 00,0b,05,aa */
5076 {0xaa, 0x0d, 0x0058}, /* 00,0d,58,aa */
5077 {0xaa, 0x0f, 0x00ed}, /* 00,0f,ed,aa */
5078 {0xaa, 0x87, 0x0000}, /* 00,87,00,aa */
5079 {0xaa, 0x88, 0x0004}, /* 00,88,04,aa */
5080 {0xaa, 0x89, 0x0000}, /* 00,89,00,aa */
5081 {0xaa, 0x8a, 0x0005}, /* 00,8a,05,aa */
5082 {0xaa, 0x13, 0x0003}, /* 00,13,03,aa */
5083 {0xaa, 0x16, 0x0040}, /* 00,16,40,aa */
5084 {0xaa, 0x18, 0x0040}, /* 00,18,40,aa */
5085 {0xaa, 0x1d, 0x0002}, /* 00,1d,02,aa */
5086 {0xaa, 0x29, 0x00e8}, /* 00,29,e8,aa */
5087 {0xaa, 0x45, 0x0045}, /* 00,45,45,aa */
5088 {0xaa, 0x50, 0x00ed}, /* 00,50,ed,aa */
5089 {0xaa, 0x51, 0x0025}, /* 00,51,25,aa */
5090 {0xaa, 0x52, 0x0042}, /* 00,52,42,aa */
5091 {0xaa, 0x53, 0x002f}, /* 00,53,2f,aa */
5092 {0xaa, 0x79, 0x0025}, /* 00,79,25,aa */
5093 {0xaa, 0x7b, 0x0000}, /* 00,7b,00,aa */
5094 {0xaa, 0x7e, 0x0025}, /* 00,7e,25,aa */
5095 {0xaa, 0x7f, 0x0025}, /* 00,7f,25,aa */
5096 {0xaa, 0x21, 0x0000}, /* 00,21,00,aa */
5097 {0xaa, 0x33, 0x0036}, /* 00,33,36,aa */
5098 {0xaa, 0x36, 0x0060}, /* 00,36,60,aa */
5099 {0xaa, 0x37, 0x0008}, /* 00,37,08,aa */
5100 {0xaa, 0x3b, 0x0031}, /* 00,3b,31,aa */
5101 {0xaa, 0x44, 0x000f}, /* 00,44,0f,aa */
5102 {0xaa, 0x58, 0x0002}, /* 00,58,02,aa */
5103 {0xaa, 0x66, 0x00c0}, /* 00,66,c0,aa */
5104 {0xaa, 0x67, 0x0044}, /* 00,67,44,aa */
5105 {0xaa, 0x6b, 0x00a0}, /* 00,6b,a0,aa */
5106 {0xaa, 0x6c, 0x0054}, /* 00,6c,54,aa */
5107 {0xaa, 0xd6, 0x0007}, /* 00,d6,07,aa */
5108 {0xa0, 0xf7, 0x0101}, /* 01,01,f7,cc */
5109 {0xa0, 0x05, 0x0012}, /* 00,12,05,cc */
5110 {0xa0, 0x0d, 0x0100}, /* 01,00,0d,cc */
5111 {0xa0, 0x06, 0x0189}, /* 01,89,06,cc */
5112 {0xa0, 0x00, 0x01ad}, /* 01,ad,00,cc */
5113 {0xa0, 0x03, 0x01c5}, /* 01,c5,03,cc */
5114 {0xa0, 0x13, 0x01cb}, /* 01,cb,13,cc */
5115 {0xa0, 0x08, 0x0250}, /* 02,50,08,cc */
5116 {0xa0, 0x08, 0x0301}, /* 03,01,08,cc */
5117 {0xa0, 0x7a, 0x0116}, /* 01,16,7a,cc */
5118 {0xa0, 0x4a, 0x0118}, /* 01,18,4a,cc */
5119 {0, 0, 0}
5120};
5121
5122static struct usb_action PO2030_50HZ[] = {
5123 {0xaa, 0x8d, 0x0008}, /* 00,8d,08,aa */
5124 {0xaa, 0x1a, 0x0001}, /* 00,1a,01,aa */
5125 {0xaa, 0x1b, 0x000a}, /* 00,1b,0a,aa */
5126 {0xaa, 0x1c, 0x00b0}, /* 00,1c,b0,aa */
5127 {0xa0, 0x05, 0x0190}, /* 01,90,05,cc */
5128 {0xa0, 0x35, 0x0191}, /* 01,91,35,cc */
5129 {0xa0, 0x70, 0x0192}, /* 01,92,70,cc */
5130 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */
5131 {0xa0, 0x85, 0x0196}, /* 01,96,85,cc */
5132 {0xa0, 0x58, 0x0197}, /* 01,97,58,cc */
5133 {0xa0, 0x0c, 0x018c}, /* 01,8c,0c,cc */
5134 {0xa0, 0x18, 0x018f}, /* 01,8f,18,cc */
5135 {0xa0, 0x60, 0x01a8}, /* 01,a8,60,cc */
5136 {0xa0, 0x10, 0x01a9}, /* 01,a9,10,cc */
5137 {0xa0, 0x22, 0x01aa}, /* 01,aa,22,cc */
5138 {0xa0, 0x88, 0x018d}, /* 01,8d,88,cc */
5139 {0xa0, 0x58, 0x011d}, /* 01,1d,58,cc */
5140 {0xa0, 0x42, 0x0180}, /* 01,80,42,cc */
5141 {0, 0, 0}
5142};
5143
5144static struct usb_action PO2030_60HZ[] = {
5145 {0xaa, 0x8d, 0x0008}, /* 00,8d,08,aa */
5146 {0xaa, 0x1a, 0x0000}, /* 00,1a,00,aa */
5147 {0xaa, 0x1b, 0x00de}, /* 00,1b,de,aa */
5148 {0xaa, 0x1c, 0x0040}, /* 00,1c,40,aa */
5149 {0xa0, 0x08, 0x0190}, /* 01,90,08,cc */
5150 {0xa0, 0xae, 0x0191}, /* 01,91,ae,cc */
5151 {0xa0, 0x80, 0x0192}, /* 01,92,80,cc */
5152 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */
5153 {0xa0, 0x6f, 0x0196}, /* 01,96,6f,cc */
5154 {0xa0, 0x20, 0x0197}, /* 01,97,20,cc */
5155 {0xa0, 0x0c, 0x018c}, /* 01,8c,0c,cc */
5156 {0xa0, 0x18, 0x018f}, /* 01,8f,18,cc */
5157 {0xa0, 0x60, 0x01a8}, /* 01,a8,60,cc */
5158 {0xa0, 0x10, 0x01a9}, /* 01,a9,10,cc */
5159 {0xa0, 0x22, 0x01aa}, /* 01,aa,22,cc */
5160 {0xa0, 0x88, 0x018d}, /* 01,8d,88,cc */ /* win: 01,8d,80 */
5161 {0xa0, 0x58, 0x011d}, /* 01,1d,58,cc */
5162 {0xa0, 0x42, 0x0180}, /* 01,80,42,cc */
5163 {0, 0, 0}
5164};
5165
5166static struct usb_action PO2030_NoFliker[] = {
5167 {0xa0, 0x02, 0x0180}, /* 01,80,02,cc */
5168 {0xaa, 0x8d, 0x000d}, /* 00,8d,0d,aa */
5169 {0xaa, 0x1a, 0x0000}, /* 00,1a,00,aa */
5170 {0xaa, 0x1b, 0x0002}, /* 00,1b,02,aa */
5171 {0xaa, 0x1c, 0x0078}, /* 00,1c,78,aa */
5172 {0xaa, 0x46, 0x0000}, /* 00,46,00,aa */
5173 {0xaa, 0x15, 0x0000}, /* 00,15,00,aa */
5174 {0, 0, 0}
5175};
5176
5177/* TEST */
5178static struct usb_action tas5130CK_Initial[] = {
5179 {0xa0, 0x01, 0x0000},
5180 {0xa0, 0x01, 0x003b},
5181 {0xa0, 0x0e, 0x003a},
5182 {0xa0, 0x01, 0x0038},
5183 {0xa0, 0x0b, 0x0039},
5184 {0xa0, 0x00, 0x0038},
5185 {0xa0, 0x0b, 0x0039},
5186 {0xa0, 0x01, 0x0000},
5187 {0xa0, 0x03, 0x0008},
5188 {0xa0, 0x0a, 0x0010},
5189 {0xa0, 0x10, 0x0002},
5190 {0xa0, 0x02, 0x0003},
5191 {0xa0, 0x80, 0x0004},
5192 {0xa0, 0x01, 0x0005},
5193 {0xa0, 0xe0, 0x0006},
5194 {0xa0, 0xdc, 0x008b},
5195 {0xa0, 0x01, 0x0001},
5196 {0xa0, 0x07, 0x0012},
5197 {0xa0, 0x00, 0x0098},
5198 {0xa0, 0x00, 0x009a},
5199 {0xa0, 0x00, 0x011a},
5200 {0xa0, 0x00, 0x011c},
5201 {0xa0, 0xdc, 0x008b},
5202 {0xa0, 0x05, 0x0012},
5203 {0xa0, 0x01, 0x0092},
5204 {0xa0, 0x01, 0x0093},
5205 {0xa0, 0x00, 0x0094},
5206 {0xa0, 0x01, 0x0090},
5207 {0xa0, 0x06, 0x0092},
5208 {0xa0, 0x00, 0x0093},
5209 {0xa0, 0x00, 0x0094},
5210 {0xa0, 0x01, 0x0090},
5211 {0xa0, 0x08, 0x0092},
5212 {0xa0, 0x83, 0x0093},
5213 {0xa0, 0x04, 0x0094},
5214 {0xa0, 0x01, 0x0090},
5215 {0xa0, 0x01, 0x0092},
5216 {0xa0, 0x04, 0x0093},
5217 {0xa0, 0x00, 0x0094},
5218 {0xa0, 0x01, 0x0090},
5219 {0xa0, 0x08, 0x0092},
5220 {0xa0, 0x06, 0x0093},
5221 {0xa0, 0x00, 0x0094},
5222 {0xa0, 0x01, 0x0090},
5223 {0xa0, 0x02, 0x0092},
5224 {0xa0, 0x11, 0x0093},
5225 {0xa0, 0x00, 0x0094},
5226 {0xa0, 0x01, 0x0090},
5227 {0xa0, 0x03, 0x0092},
5228 {0xa0, 0xE7, 0x0093},
5229 {0xa0, 0x01, 0x0094},
5230 {0xa0, 0x01, 0x0090},
5231 {0xa0, 0x04, 0x0092},
5232 {0xa0, 0x87, 0x0093},
5233 {0xa0, 0x02, 0x0094},
5234 {0xa0, 0x01, 0x0090},
5235 {0xa0, 0x07, 0x0092},
5236 {0xa0, 0x02, 0x0093},
5237 {0xa0, 0x30, 0x0094},
5238 {0xa0, 0x01, 0x0090},
5239 {0xa0, 0x20, 0x0092},
5240 {0xa0, 0x00, 0x0093},
5241 {0xa0, 0x51, 0x0094},
5242 {0xa0, 0x01, 0x0090},
5243 {0xa0, 0x35, 0x0092},
5244 {0xa0, 0x7F, 0x0093},
5245 {0xa0, 0x00, 0x0094},
5246 {0xa0, 0x01, 0x0090},
5247 {0xa0, 0x30, 0x0092},
5248 {0xa0, 0x05, 0x0093},
5249 {0xa0, 0x00, 0x0094},
5250 {0xa0, 0x01, 0x0090},
5251 {0xa0, 0x31, 0x0092},
5252 {0xa0, 0x00, 0x0093},
5253 {0xa0, 0x00, 0x0094},
5254 {0xa0, 0x01, 0x0090},
5255 {0xa0, 0x58, 0x0092},
5256 {0xa0, 0x78, 0x0093},
5257 {0xa0, 0x00, 0x0094},
5258 {0xa0, 0x01, 0x0090},
5259 {0xa0, 0x62, 0x0092},
5260 {0xa0, 0x11, 0x0093},
5261 {0xa0, 0x04, 0x0094},
5262 {0xa0, 0x01, 0x0090},
5263 {0xa0, 0x2B, 0x0092},
5264 {0xa0, 0x7f, 0x0093},
5265 {0xa0, 0x00, 0x0094},
5266 {0xa0, 0x01, 0x0090},
5267 {0xa0, 0x2c, 0x0092},
5268 {0xa0, 0x7f, 0x0093},
5269 {0xa0, 0x00, 0x0094},
5270 {0xa0, 0x01, 0x0090},
5271 {0xa0, 0x2D, 0x0092},
5272 {0xa0, 0x7f, 0x0093},
5273 {0xa0, 0x00, 0x0094},
5274 {0xa0, 0x01, 0x0090},
5275 {0xa0, 0x2e, 0x0092},
5276 {0xa0, 0x7f, 0x0093},
5277 {0xa0, 0x00, 0x0094},
5278 {0xa0, 0x01, 0x0090},
5279 {0xa0, 0x10, 0x0087},
5280 {0xa0, 0xb7, 0x0101},
5281 {0xa0, 0x05, 0x0012},
5282 {0xa0, 0x0d, 0x0100},
5283 {0xa0, 0x06, 0x0189},
5284 {0xa0, 0x09, 0x01ad},
5285 {0xa0, 0x03, 0x01c5},
5286 {0xa0, 0x13, 0x01cb},
5287 {0xa0, 0x08, 0x0250},
5288 {0xa0, 0x08, 0x0301},
5289 {0xa0, 0x60, 0x01a8},
5290 {0xa0, 0x6c, 0x018d},
5291 {0xa0, 0x61, 0x0116},
5292 {0xa0, 0x65, 0x0118},
5293 {0xa0, 0x09, 0x01ad},
5294 {0xa0, 0x15, 0x01ae},
5295 {0xa0, 0x4c, 0x010a}, /* matrix */
5296 {0xa0, 0xf1, 0x010b},
5297 {0xa0, 0x03, 0x010c},
5298 {0xa0, 0xfe, 0x010d},
5299 {0xa0, 0x51, 0x010e},
5300 {0xa0, 0xf1, 0x010f},
5301 {0xa0, 0xec, 0x0110},
5302 {0xa0, 0x03, 0x0111},
5303 {0xa0, 0x51, 0x0112},
5304 {0xa0, 0x03, 0x0008},
5305 {0xa0, 0x08, 0x01c6},
5306 {0xa0, 0x0f, 0x01cb},
5307 {0xa0, 0x38, 0x0120}, /* gamma > 5 */
5308 {0xa0, 0x51, 0x0121},
5309 {0xa0, 0x6e, 0x0122},
5310 {0xa0, 0x8c, 0x0123},
5311 {0xa0, 0xa2, 0x0124},
5312 {0xa0, 0xb6, 0x0125},
5313 {0xa0, 0xc8, 0x0126},
5314 {0xa0, 0xd6, 0x0127},
5315 {0xa0, 0xe2, 0x0128},
5316 {0xa0, 0xed, 0x0129},
5317 {0xa0, 0xf5, 0x012a},
5318 {0xa0, 0xfc, 0x012b},
5319 {0xa0, 0xff, 0x012c},
5320 {0xa0, 0xff, 0x012d},
5321 {0xa0, 0xff, 0x012e},
5322 {0xa0, 0xff, 0x012f},
5323 {0xa0, 0x12, 0x0130},
5324 {0xa0, 0x1b, 0x0131},
5325 {0xa0, 0x1d, 0x0132},
5326 {0xa0, 0x1a, 0x0133},
5327 {0xa0, 0x15, 0x0134},
5328 {0xa0, 0x12, 0x0135},
5329 {0xa0, 0x0f, 0x0136},
5330 {0xa0, 0x0d, 0x0137},
5331 {0xa0, 0x0b, 0x0138},
5332 {0xa0, 0x09, 0x0139},
5333 {0xa0, 0x07, 0x013a},
5334 {0xa0, 0x05, 0x013b},
5335 {0xa0, 0x00, 0x013c},
5336 {0xa0, 0x00, 0x013d},
5337 {0xa0, 0x00, 0x013e},
5338 {0xa0, 0x01, 0x013f},
5339 {0xa0, 0x4c, 0x010a}, /* matrix */
5340 {0xa0, 0xf1, 0x010b},
5341 {0xa0, 0x03, 0x010c},
5342 {0xa0, 0xfe, 0x010d},
5343 {0xa0, 0x51, 0x010e},
5344 {0xa0, 0xf1, 0x010f},
5345 {0xa0, 0xec, 0x0110},
5346 {0xa0, 0x03, 0x0111},
5347 {0xa0, 0x51, 0x0112},
5348 {0xa0, 0x10, 0x0180},
5349 {0xa0, 0x00, 0x0180},
5350 {0xa0, 0x00, 0x0019},
5351 {0xa0, 0x05, 0x0092},
5352 {0xa0, 0x09, 0x0093},
5353 {0xa0, 0x00, 0x0094},
5354 {0xa0, 0x01, 0x0090},
5355 {0xa0, 0x09, 0x0092},
5356 {0xa0, 0x34, 0x0093},
5357 {0xa0, 0x01, 0x0094},
5358 {0xa0, 0x01, 0x0090},
5359 {0xa0, 0x00, 0x0190},
5360 {0xa0, 0x07, 0x0191},
5361 {0xa0, 0xd2, 0x0192},
5362 {0xa0, 0x00, 0x0195},
5363 {0xa0, 0x00, 0x0196},
5364 {0xa0, 0x9a, 0x0197},
5365 {0xa0, 0x0e, 0x018c},
5366 {0xa0, 0x1c, 0x018f},
5367 {0xa0, 0x14, 0x01a9},
5368 {0xa0, 0x66, 0x01aa},
5369 {0xa0, 0xd7, 0x001d},
5370 {0xa0, 0xf4, 0x001e},
5371 {0xa0, 0xf9, 0x001f},
5372 {0xa0, 0xff, 0x0020},
5373 {0xa0, 0x42, 0x0180},
5374 {0xa0, 0x09, 0x01ad},
5375 {0xa0, 0x15, 0x01ae},
5376 {0xa0, 0x40, 0x0180},
5377 {0xa0, 0x42, 0x0180},
5378 {0, 0, 0}
5379};
5380
5381static struct usb_action tas5130CK_InitialScale[] = {
5382 {0xa0, 0x01, 0x0000},
5383 {0xa0, 0x01, 0x003b},
5384 {0xa0, 0x0e, 0x003a},
5385 {0xa0, 0x01, 0x0038},
5386 {0xa0, 0x0b, 0x0039},
5387 {0xa0, 0x00, 0x0038},
5388 {0xa0, 0x0b, 0x0039},
5389 {0xa0, 0x01, 0x0000},
5390 {0xa0, 0x03, 0x0008},
5391 {0xa0, 0x0a, 0x0010},
5392 {0xa0, 0x00, 0x0002},
5393 {0xa0, 0x02, 0x0003},
5394 {0xa0, 0x80, 0x0004},
5395 {0xa0, 0x01, 0x0005},
5396 {0xa0, 0xe0, 0x0006},
5397 {0xa0, 0xdc, 0x008b},
5398 {0xa0, 0x01, 0x0001},
5399 {0xa0, 0x07, 0x0012},
5400 {0xa0, 0x00, 0x0098},
5401 {0xa0, 0x00, 0x009a},
5402 {0xa0, 0x00, 0x011a},
5403 {0xa0, 0x00, 0x011c},
5404 {0xa0, 0xdc, 0x008b},
5405 {0xa0, 0x05, 0x0012},
5406 {0xa0, 0x01, 0x0092},
5407 {0xa0, 0x01, 0x0093},
5408 {0xa0, 0x00, 0x0094},
5409 {0xa0, 0x01, 0x0090},
5410 {0xa0, 0x06, 0x0092},
5411 {0xa0, 0x00, 0x0093},
5412 {0xa0, 0x00, 0x0094},
5413 {0xa0, 0x01, 0x0090},
5414 {0xa0, 0x08, 0x0092},
5415 {0xa0, 0x83, 0x0093},
5416 {0xa0, 0x04, 0x0094},
5417 {0xa0, 0x01, 0x0090},
5418 {0xa0, 0x01, 0x0092},
5419 {0xa0, 0x04, 0x0093},
5420 {0xa0, 0x00, 0x0094},
5421 {0xa0, 0x01, 0x0090},
5422 {0xa0, 0x08, 0x0092},
5423 {0xa0, 0x06, 0x0093},
5424 {0xa0, 0x00, 0x0094},
5425 {0xa0, 0x01, 0x0090},
5426 {0xa0, 0x02, 0x0092},
5427 {0xa0, 0x11, 0x0093},
5428 {0xa0, 0x00, 0x0094},
5429 {0xa0, 0x01, 0x0090},
5430 {0xa0, 0x03, 0x0092},
5431 {0xa0, 0xe5, 0x0093},
5432 {0xa0, 0x01, 0x0094},
5433 {0xa0, 0x01, 0x0090},
5434 {0xa0, 0x04, 0x0092},
5435 {0xa0, 0x85, 0x0093},
5436 {0xa0, 0x02, 0x0094},
5437 {0xa0, 0x01, 0x0090},
5438 {0xa0, 0x07, 0x0092},
5439 {0xa0, 0x02, 0x0093},
5440 {0xa0, 0x30, 0x0094},
5441 {0xa0, 0x01, 0x0090},
5442 {0xa0, 0x20, 0x0092},
5443 {0xa0, 0x00, 0x0093},
5444 {0xa0, 0x51, 0x0094},
5445 {0xa0, 0x01, 0x0090},
5446 {0xa0, 0x35, 0x0092},
5447 {0xa0, 0x7F, 0x0093},
5448 {0xa0, 0x50, 0x0094},
5449 {0xa0, 0x01, 0x0090},
5450 {0xa0, 0x30, 0x0092},
5451 {0xa0, 0x05, 0x0093},
5452 {0xa0, 0x00, 0x0094},
5453 {0xa0, 0x01, 0x0090},
5454 {0xa0, 0x31, 0x0092},
5455 {0xa0, 0x00, 0x0093},
5456 {0xa0, 0x00, 0x0094},
5457 {0xa0, 0x01, 0x0090},
5458 {0xa0, 0x58, 0x0092},
5459 {0xa0, 0x78, 0x0093},
5460 {0xa0, 0x00, 0x0094},
5461 {0xa0, 0x01, 0x0090},
5462 {0xa0, 0x62, 0x0092},
5463 {0xa0, 0x11, 0x0093},
5464 {0xa0, 0x04, 0x0094},
5465 {0xa0, 0x01, 0x0090},
5466 {0xa0, 0x2B, 0x0092},
5467 {0xa0, 0x7f, 0x0093},
5468 {0xa0, 0x00, 0x0094},
5469 {0xa0, 0x01, 0x0090},
5470 {0xa0, 0x2C, 0x0092},
5471 {0xa0, 0x7F, 0x0093},
5472 {0xa0, 0x00, 0x0094},
5473 {0xa0, 0x01, 0x0090},
5474 {0xa0, 0x2D, 0x0092},
5475 {0xa0, 0x7f, 0x0093},
5476 {0xa0, 0x00, 0x0094},
5477 {0xa0, 0x01, 0x0090},
5478 {0xa0, 0x2e, 0x0092},
5479 {0xa0, 0x7f, 0x0093},
5480 {0xa0, 0x00, 0x0094},
5481 {0xa0, 0x01, 0x0090},
5482 {0xa0, 0x10, 0x0087},
5483 {0xa0, 0xb7, 0x0101},
5484 {0xa0, 0x05, 0x0012},
5485 {0xa0, 0x0d, 0x0100},
5486 {0xa0, 0x06, 0x0189},
5487 {0xa0, 0x09, 0x01ad},
5488 {0xa0, 0x03, 0x01c5},
5489 {0xa0, 0x13, 0x01cb},
5490 {0xa0, 0x08, 0x0250},
5491 {0xa0, 0x08, 0x0301},
5492 {0xa0, 0x60, 0x01a8},
5493 {0xa0, 0x6c, 0x018d},
5494 {0xa0, 0x61, 0x0116},
5495 {0xa0, 0x65, 0x0118},
5496 {0xa0, 0x09, 0x01ad},
5497 {0xa0, 0x15, 0x01ae},
5498 {0xa0, 0x4c, 0x010a}, /* matrix */
5499 {0xa0, 0xf1, 0x010b},
5500 {0xa0, 0x03, 0x010c},
5501 {0xa0, 0xfe, 0x010d},
5502 {0xa0, 0x51, 0x010e},
5503 {0xa0, 0xf1, 0x010f},
5504 {0xa0, 0xec, 0x0110},
5505 {0xa0, 0x03, 0x0111},
5506 {0xa0, 0x51, 0x0112},
5507 {0xa0, 0x03, 0x0008},
5508 {0xa0, 0x08, 0x01c6},
5509 {0xa0, 0x0f, 0x01cb},
5510 {0xa0, 0x38, 0x0120}, /* gamma > 5 */
5511 {0xa0, 0x51, 0x0121},
5512 {0xa0, 0x6e, 0x0122},
5513 {0xa0, 0x8c, 0x0123},
5514 {0xa0, 0xa2, 0x0124},
5515 {0xa0, 0xb6, 0x0125},
5516 {0xa0, 0xc8, 0x0126},
5517 {0xa0, 0xd6, 0x0127},
5518 {0xa0, 0xe2, 0x0128},
5519 {0xa0, 0xed, 0x0129},
5520 {0xa0, 0xf5, 0x012a},
5521 {0xa0, 0xfc, 0x012b},
5522 {0xa0, 0xff, 0x012c},
5523 {0xa0, 0xff, 0x012d},
5524 {0xa0, 0xff, 0x012e},
5525 {0xa0, 0xff, 0x012f},
5526 {0xa0, 0x12, 0x0130},
5527 {0xa0, 0x1b, 0x0131},
5528 {0xa0, 0x1d, 0x0132},
5529 {0xa0, 0x1a, 0x0133},
5530 {0xa0, 0x15, 0x0134},
5531 {0xa0, 0x12, 0x0135},
5532 {0xa0, 0x0f, 0x0136},
5533 {0xa0, 0x0d, 0x0137},
5534 {0xa0, 0x0b, 0x0138},
5535 {0xa0, 0x09, 0x0139},
5536 {0xa0, 0x07, 0x013a},
5537 {0xa0, 0x05, 0x013b},
5538 {0xa0, 0x00, 0x013c},
5539 {0xa0, 0x00, 0x013d},
5540 {0xa0, 0x00, 0x013e},
5541 {0xa0, 0x01, 0x013f},
5542 {0xa0, 0x4c, 0x010a}, /* matrix */
5543 {0xa0, 0xf1, 0x010b},
5544 {0xa0, 0x03, 0x010c},
5545 {0xa0, 0xfe, 0x010d},
5546 {0xa0, 0x51, 0x010e},
5547 {0xa0, 0xf1, 0x010f},
5548 {0xa0, 0xec, 0x0110},
5549 {0xa0, 0x03, 0x0111},
5550 {0xa0, 0x51, 0x0112},
5551 {0xa0, 0x10, 0x0180},
5552 {0xa0, 0x00, 0x0180},
5553 {0xa0, 0x00, 0x0019},
5554 {0xa0, 0x05, 0x0092},
5555 {0xa0, 0x62, 0x0093},
5556 {0xa0, 0x00, 0x0094},
5557 {0xa0, 0x01, 0x0090},
5558 {0xa0, 0x09, 0x0092},
5559 {0xa0, 0xaa, 0x0093},
5560 {0xa0, 0x01, 0x0094},
5561 {0xa0, 0x01, 0x0090},
5562 {0xa0, 0x00, 0x0190},
5563 {0xa0, 0x03, 0x0191},
5564 {0xa0, 0x9b, 0x0192},
5565 {0xa0, 0x00, 0x0195},
5566 {0xa0, 0x00, 0x0196},
5567 {0xa0, 0x47, 0x0197},
5568 {0xa0, 0x0e, 0x018c},
5569 {0xa0, 0x1c, 0x018f},
5570 {0xa0, 0x14, 0x01a9},
5571 {0xa0, 0x66, 0x01aa},
5572 {0xa0, 0x62, 0x001d},
5573 {0xa0, 0x90, 0x001e},
5574 {0xa0, 0xc8, 0x001f},
5575 {0xa0, 0xff, 0x0020},
5576 {0xa0, 0x60, 0x011d},
5577 {0xa0, 0x42, 0x0180},
5578 {0xa0, 0x09, 0x01ad},
5579 {0xa0, 0x15, 0x01ae},
5580 {0xa0, 0x40, 0x0180},
5581 {0xa0, 0x42, 0x0180},
5582 {0xa0, 0x30, 0x0007},
5583 {0xa0, 0x02, 0x0008},
5584 {0xa0, 0x00, 0x0007},
5585 {0xa0, 0x03, 0x0008},
5586 {0, 0, 0}
5587};
5588
5589static struct usb_action tas5130cxx_Initial[] = {
5590 {0xa0, 0x01, 0x0000},
5591 {0xa0, 0x50, 0x0002},
5592 {0xa0, 0x03, 0x0008},
5593 {0xa0, 0x02, 0x0010},
5594 {0xa0, 0x01, 0x0001},
5595 {0xa0, 0x00, 0x0001},
5596 {0xa0, 0x01, 0x0012},
5597 {0xa0, 0x01, 0x0001},
5598 {0xa0, 0x05, 0x0012},
5599 {0xa0, 0x07, 0x00a5},
5600 {0xa0, 0x02, 0x00a6},
5601
5602 {0xa0, 0x02, 0x0003},
5603 {0xa0, 0x80, 0x0004},
5604 {0xa0, 0x01, 0x0005},
5605 {0xa0, 0xe0, 0x0006},
5606
5607 {0xa0, 0x04, 0x0098},
5608 {0xa0, 0x0f, 0x009a},
5609 {0xa0, 0x04, 0x011a},
5610 {0xa0, 0x0f, 0x011c},
5611 {0xa0, 0xe8, 0x009c},
5612 {0xa0, 0x02, 0x009d},
5613 {0xa0, 0x88, 0x009e},
5614 {0xa0, 0x06, 0x008d},
5615 {0xa0, 0xf7, 0x0101},
5616 {0xa0, 0x0d, 0x0100},
5617 {0xa0, 0x06, 0x0189},
5618 {0xa0, 0x68, 0x018d},
5619 {0xa0, 0x60, 0x01a8},
5620 {0xa0, 0x00, 0x01ad},
5621 {0xa0, 0x03, 0x01c5},
5622 {0xa0, 0x13, 0x01cb},
5623 {0xa0, 0x08, 0x0250},
5624 {0xa0, 0x08, 0x0301},
5625 {0xa1, 0x01, 0x0002},
5626 {0xa1, 0x01, 0x0008},
5627 {0xa0, 0x03, 0x0008}, /* clock ? */
5628 {0xa0, 0x08, 0x01c6},
5629 {0xa1, 0x01, 0x01c8},
5630 {0xa1, 0x01, 0x01c9},
5631 {0xa1, 0x01, 0x01ca},
5632 {0xa0, 0x0f, 0x01cb},
5633
5634 {0xa0, 0x68, 0x010a}, /* matrix */
5635 {0xa0, 0xec, 0x010b},
5636 {0xa0, 0xec, 0x010c},
5637 {0xa0, 0xec, 0x010d},
5638 {0xa0, 0x68, 0x010e},
5639 {0xa0, 0xec, 0x010f},
5640 {0xa0, 0xec, 0x0110},
5641 {0xa0, 0xec, 0x0111},
5642 {0xa0, 0x68, 0x0112},
5643
5644 {0xa1, 0x01, 0x018d},
5645 {0xa0, 0x90, 0x018d}, /* 90 */
5646 {0xa1, 0x01, 0x0180},
5647 {0xa0, 0x00, 0x0180},
5648 {0xa0, 0x00, 0x0019},
5649
5650 {0xaa, 0xa3, 0x0001},
5651 {0xaa, 0xa4, 0x0077},
5652 {0xa0, 0x01, 0x00a3},
5653 {0xa0, 0x77, 0x00a4},
5654
5655 {0xa0, 0x00, 0x0190}, /* 00 */
5656 {0xa0, 0x03, 0x0191}, /* 03 */
5657 {0xa0, 0xe8, 0x0192}, /* e8 */
5658 {0xa0, 0x00, 0x0195}, /* 0 */
5659 {0xa0, 0x00, 0x0196}, /* 0 */
5660 {0xa0, 0x7d, 0x0197}, /* 7d */
5661
5662 {0xa0, 0x0c, 0x018c},
5663 {0xa0, 0x18, 0x018f},
5664 {0xa0, 0x08, 0x01a9}, /* 08 */
5665 {0xa0, 0x24, 0x01aa}, /* 24 */
5666 {0xa0, 0xf0, 0x001d},
5667 {0xa0, 0xf4, 0x001e},
5668 {0xa0, 0xf8, 0x001f},
5669 {0xa0, 0xff, 0x0020},
5670 {0xa0, 0x03, 0x009f},
5671 {0xa0, 0xc0, 0x00a0},
5672 {0xa0, 0x50, 0x011d}, /* 50 */
5673 {0xa0, 0x40, 0x0180},
5674 {0xa1, 0x01, 0x0180},
5675 {0xa0, 0x42, 0x0180},
5676 {0, 0, 0}
5677};
5678static struct usb_action tas5130cxx_InitialScale[] = {
5679 {0xa0, 0x01, 0x0000},
5680 {0xa0, 0x01, 0x0000},
5681 {0xa0, 0x40, 0x0002},
5682
5683 {0xa0, 0x03, 0x0008},
5684 {0xa1, 0x01, 0x0008},
5685
5686 {0xa0, 0x02, 0x0010},
5687 {0xa0, 0x01, 0x0001},
5688 {0xa0, 0x00, 0x0001},
5689 {0xa0, 0x01, 0x0012},
5690 {0xa0, 0x01, 0x0001},
5691 {0xa0, 0x05, 0x0012},
5692 {0xa0, 0x07, 0x00a5},
5693 {0xa0, 0x02, 0x00a6},
5694 {0xa0, 0x02, 0x0003},
5695 {0xa0, 0x80, 0x0004},
5696 {0xa0, 0x01, 0x0005},
5697 {0xa0, 0xe0, 0x0006},
5698 {0xa0, 0x05, 0x0098},
5699 {0xa0, 0x0f, 0x009a},
5700 {0xa0, 0x05, 0x011a},
5701 {0xa0, 0x0f, 0x011c},
5702 {0xa0, 0xe6, 0x009c},
5703 {0xa0, 0x02, 0x009d},
5704 {0xa0, 0x86, 0x009e},
5705 {0xa0, 0x06, 0x008d},
5706 {0xa0, 0x37, 0x0101},
5707 {0xa0, 0x0d, 0x0100},
5708 {0xa0, 0x06, 0x0189},
5709 {0xa0, 0x68, 0x018d},
5710 {0xa0, 0x60, 0x01a8},
5711 {0xa0, 0x00, 0x01ad},
5712 {0xa0, 0x03, 0x01c5},
5713 {0xa0, 0x13, 0x01cb},
5714 {0xa0, 0x08, 0x0250},
5715 {0xa0, 0x08, 0x0301},
5716 {0xa1, 0x01, 0x0002},
5717 {0xa1, 0x01, 0x0008},
5718
5719 {0xa0, 0x03, 0x0008},
5720 {0xa1, 0x01, 0x0008}, /* clock ? */
5721 {0xa0, 0x08, 0x01c6},
5722 {0xa1, 0x01, 0x01c8},
5723 {0xa1, 0x01, 0x01c9},
5724 {0xa1, 0x01, 0x01ca},
5725 {0xa0, 0x0f, 0x01cb},
5726
5727 {0xa0, 0x68, 0x010a}, /* matrix */
5728 {0xa0, 0xec, 0x010b},
5729 {0xa0, 0xec, 0x010c},
5730 {0xa0, 0xec, 0x010d},
5731 {0xa0, 0x68, 0x010e},
5732 {0xa0, 0xec, 0x010f},
5733 {0xa0, 0xec, 0x0110},
5734 {0xa0, 0xec, 0x0111},
5735 {0xa0, 0x68, 0x0112},
5736
5737 {0xa1, 0x01, 0x018d},
5738 {0xa0, 0x90, 0x018d},
5739 {0xa1, 0x01, 0x0180},
5740 {0xa0, 0x00, 0x0180},
5741 {0xa0, 0x00, 0x0019},
5742 {0xaa, 0xa3, 0x0001},
5743 {0xaa, 0xa4, 0x0063},
5744 {0xa0, 0x01, 0x00a3},
5745 {0xa0, 0x63, 0x00a4},
5746 {0xa0, 0x00, 0x0190},
5747 {0xa0, 0x02, 0x0191},
5748 {0xa0, 0x38, 0x0192},
5749 {0xa0, 0x00, 0x0195},
5750 {0xa0, 0x00, 0x0196},
5751 {0xa0, 0x47, 0x0197},
5752 {0xa0, 0x0c, 0x018c},
5753 {0xa0, 0x18, 0x018f},
5754 {0xa0, 0x08, 0x01a9},
5755 {0xa0, 0x24, 0x01aa},
5756 {0xa0, 0xd3, 0x001d},
5757 {0xa0, 0xda, 0x001e},
5758 {0xa0, 0xea, 0x001f},
5759 {0xa0, 0xff, 0x0020},
5760 {0xa0, 0x03, 0x009f},
5761 {0xa0, 0x4c, 0x00a0},
5762 {0xa0, 0x50, 0x011d},
5763 {0xa0, 0x40, 0x0180},
5764 {0xa1, 0x01, 0x0180},
5765 {0xa0, 0x42, 0x0180},
5766 {0, 0, 0}
5767};
5768static struct usb_action tas5130cxx_50HZ[] = {
5769 {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
5770 {0xaa, 0xa3, 0x0001}, /* 00,a3,01,aa */
5771 {0xaa, 0xa4, 0x0063}, /* 00,a4,63,aa */
5772 {0xa0, 0x01, 0x00a3}, /* 00,a3,01,cc */
5773 {0xa0, 0x63, 0x00a4}, /* 00,a4,63,cc */
5774 {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
5775 {0xa0, 0x02, 0x0191}, /* 01,91,02,cc */
5776 {0xa0, 0x38, 0x0192}, /* 01,92,38,cc */
5777 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */
5778 {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */
5779 {0xa0, 0x47, 0x0197}, /* 01,97,47,cc */
5780 {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */
5781 {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */
5782 {0xa0, 0x0c, 0x01a9}, /* 01,a9,0c,cc */
5783 {0xa0, 0x26, 0x01aa}, /* 01,aa,26,cc */
5784 {0xa0, 0xd3, 0x001d}, /* 00,1d,d3,cc */
5785 {0xa0, 0xda, 0x001e}, /* 00,1e,da,cc */
5786 {0xa0, 0xea, 0x001f}, /* 00,1f,ea,cc */
5787 {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc */
5788 {0xa0, 0x03, 0x009f}, /* 00,9f,03,cc */
5789 {0, 0, 0}
5790};
5791static struct usb_action tas5130cxx_50HZScale[] = {
5792 {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
5793 {0xaa, 0xa3, 0x0001}, /* 00,a3,01,aa */
5794 {0xaa, 0xa4, 0x0077}, /* 00,a4,77,aa */
5795 {0xa0, 0x01, 0x00a3}, /* 00,a3,01,cc */
5796 {0xa0, 0x77, 0x00a4}, /* 00,a4,77,cc */
5797 {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
5798 {0xa0, 0x03, 0x0191}, /* 01,91,03,cc */
5799 {0xa0, 0xe8, 0x0192}, /* 01,92,e8,cc */
5800 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */
5801 {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */
5802 {0xa0, 0x7d, 0x0197}, /* 01,97,7d,cc */
5803 {0xa0, 0x14, 0x018c}, /* 01,8c,14,cc */
5804 {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */
5805 {0xa0, 0x0c, 0x01a9}, /* 01,a9,0c,cc */
5806 {0xa0, 0x26, 0x01aa}, /* 01,aa,26,cc */
5807 {0xa0, 0xf0, 0x001d}, /* 00,1d,f0,cc */
5808 {0xa0, 0xf4, 0x001e}, /* 00,1e,f4,cc */
5809 {0xa0, 0xf8, 0x001f}, /* 00,1f,f8,cc */
5810 {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc */
5811 {0xa0, 0x03, 0x009f}, /* 00,9f,03,cc */
5812 {0, 0, 0}
5813};
5814static struct usb_action tas5130cxx_60HZ[] = {
5815 {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
5816 {0xaa, 0xa3, 0x0001}, /* 00,a3,01,aa */
5817 {0xaa, 0xa4, 0x0036}, /* 00,a4,36,aa */
5818 {0xa0, 0x01, 0x00a3}, /* 00,a3,01,cc */
5819 {0xa0, 0x36, 0x00a4}, /* 00,a4,36,cc */
5820 {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
5821 {0xa0, 0x01, 0x0191}, /* 01,91,01,cc */
5822 {0xa0, 0xf0, 0x0192}, /* 01,92,f0,cc */
5823 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */
5824 {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */
5825 {0xa0, 0x3e, 0x0197}, /* 01,97,3e,cc */
5826 {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */
5827 {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */
5828 {0xa0, 0x0c, 0x01a9}, /* 01,a9,0c,cc */
5829 {0xa0, 0x26, 0x01aa}, /* 01,aa,26,cc */
5830 {0xa0, 0xca, 0x001d}, /* 00,1d,ca,cc */
5831 {0xa0, 0xd0, 0x001e}, /* 00,1e,d0,cc */
5832 {0xa0, 0xe0, 0x001f}, /* 00,1f,e0,cc */
5833 {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc */
5834 {0xa0, 0x03, 0x009f}, /* 00,9f,03,cc */
5835 {0, 0, 0}
5836};
5837static struct usb_action tas5130cxx_60HZScale[] = {
5838 {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
5839 {0xaa, 0xa3, 0x0001}, /* 00,a3,01,aa */
5840 {0xaa, 0xa4, 0x0077}, /* 00,a4,77,aa */
5841 {0xa0, 0x01, 0x00a3}, /* 00,a3,01,cc */
5842 {0xa0, 0x77, 0x00a4}, /* 00,a4,77,cc */
5843 {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
5844 {0xa0, 0x03, 0x0191}, /* 01,91,03,cc */
5845 {0xa0, 0xe8, 0x0192}, /* 01,92,e8,cc */
5846 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */
5847 {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */
5848 {0xa0, 0x7d, 0x0197}, /* 01,97,7d,cc */
5849 {0xa0, 0x14, 0x018c}, /* 01,8c,14,cc */
5850 {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */
5851 {0xa0, 0x0c, 0x01a9}, /* 01,a9,0c,cc */
5852 {0xa0, 0x26, 0x01aa}, /* 01,aa,26,cc */
5853 {0xa0, 0xc8, 0x001d}, /* 00,1d,c8,cc */
5854 {0xa0, 0xd0, 0x001e}, /* 00,1e,d0,cc */
5855 {0xa0, 0xe0, 0x001f}, /* 00,1f,e0,cc */
5856 {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc */
5857 {0xa0, 0x03, 0x009f}, /* 00,9f,03,cc */
5858 {0, 0, 0}
5859};
5860static struct usb_action tas5130cxx_NoFliker[] = {
5861 {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
5862 {0xaa, 0xa3, 0x0001}, /* 00,a3,01,aa */
5863 {0xaa, 0xa4, 0x0040}, /* 00,a4,40,aa */
5864 {0xa0, 0x01, 0x00a3}, /* 00,a3,01,cc */
5865 {0xa0, 0x40, 0x00a4}, /* 00,a4,40,cc */
5866 {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
5867 {0xa0, 0x01, 0x0191}, /* 01,91,01,cc */
5868 {0xa0, 0xf0, 0x0192}, /* 01,92,f0,cc */
5869 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */
5870 {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */
5871 {0xa0, 0x10, 0x0197}, /* 01,97,10,cc */
5872 {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */
5873 {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */
5874 {0xa0, 0x00, 0x01a9}, /* 01,a9,00,cc */
5875 {0xa0, 0x00, 0x01aa}, /* 01,aa,00,cc */
5876 {0xa0, 0xbc, 0x001d}, /* 00,1d,bc,cc */
5877 {0xa0, 0xd0, 0x001e}, /* 00,1e,d0,cc */
5878 {0xa0, 0xe0, 0x001f}, /* 00,1f,e0,cc */
5879 {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc */
5880 {0xa0, 0x02, 0x009f}, /* 00,9f,02,cc */
5881 {0, 0, 0}
5882};
5883
5884static struct usb_action tas5130cxx_NoFlikerScale[] = {
5885 {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */
5886 {0xaa, 0xa3, 0x0001}, /* 00,a3,01,aa */
5887 {0xaa, 0xa4, 0x0090}, /* 00,a4,90,aa */
5888 {0xa0, 0x01, 0x00a3}, /* 00,a3,01,cc */
5889 {0xa0, 0x90, 0x00a4}, /* 00,a4,90,cc */
5890 {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */
5891 {0xa0, 0x03, 0x0191}, /* 01,91,03,cc */
5892 {0xa0, 0xf0, 0x0192}, /* 01,92,f0,cc */
5893 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */
5894 {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */
5895 {0xa0, 0x10, 0x0197}, /* 01,97,10,cc */
5896 {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */
5897 {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */
5898 {0xa0, 0x00, 0x01a9}, /* 01,a9,00,cc */
5899 {0xa0, 0x00, 0x01aa}, /* 01,aa,00,cc */
5900 {0xa0, 0xbc, 0x001d}, /* 00,1d,bc,cc */
5901 {0xa0, 0xd0, 0x001e}, /* 00,1e,d0,cc */
5902 {0xa0, 0xe0, 0x001f}, /* 00,1f,e0,cc */
5903 {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc */
5904 {0xa0, 0x02, 0x009f}, /* 00,9f,02,cc */
5905 {0, 0, 0}
5906};
5907
5908static struct usb_action tas5130c_vf0250_Initial[] = {
5909 {0xa0, 0x01, 0x0000}, /* 00,00,01,cc, */
5910 {0xa0, 0x02, 0x0008}, /* 00,08,02,cc, */
5911 {0xa0, 0x01, 0x0010}, /* 00,10,01,cc, */
5912 {0xa0, 0x10, 0x0002}, /* 00,02,00,cc, 0<->10 */
5913 {0xa0, 0x02, 0x0003}, /* 00,03,02,cc, */
5914 {0xa0, 0x80, 0x0004}, /* 00,04,80,cc, */
5915 {0xa0, 0x01, 0x0005}, /* 00,05,01,cc, */
5916 {0xa0, 0xe0, 0x0006}, /* 00,06,e0,cc, */
5917 {0xa0, 0x98, 0x008b}, /* 00,8b,98,cc, */
5918 {0xa0, 0x01, 0x0001}, /* 00,01,01,cc, */
5919 {0xa0, 0x03, 0x0012}, /* 00,12,03,cc, */
5920 {0xa0, 0x01, 0x0012}, /* 00,12,01,cc, */
5921 {0xa0, 0x00, 0x0098}, /* 00,98,00,cc, */
5922 {0xa0, 0x00, 0x009a}, /* 00,9a,00,cc, */
5923 {0xa0, 0x00, 0x011a}, /* 01,1a,00,cc, */
5924 {0xa0, 0x00, 0x011c}, /* 01,1c,00,cc, */
5925 {0xa0, 0xe8, 0x009c}, /* 00,9c,e6,cc, 6<->8 */
5926 {0xa0, 0x88, 0x009e}, /* 00,9e,86,cc, 6<->8 */
5927 {0xa0, 0x10, 0x0087}, /* 00,87,10,cc, */
5928 {0xa0, 0x98, 0x008b}, /* 00,8b,98,cc, */
5929 {0xaa, 0x1b, 0x0024}, /* 00,1b,24,aa, */
5930 {0xdd, 0x00, 0x0080}, /* 00,00,80,dd, */
5931 {0xaa, 0x1b, 0x0000}, /* 00,1b,00,aa, */
5932 {0xaa, 0x13, 0x0002}, /* 00,13,02,aa, */
5933 {0xaa, 0x15, 0x0004}, /* 00,15,04,aa */
5934 {0xaa, 0x01, 0x0000},
5935 {0xaa, 0x01, 0x0000},
5936 {0xaa, 0x1a, 0x0000}, /* 00,1a,00,aa, */
5937 {0xaa, 0x1c, 0x0017}, /* 00,1c,17,aa, */
5938 {0xa0, 0x82, 0x0086}, /* 00,86,82,cc, */
5939 {0xa0, 0x83, 0x0087}, /* 00,87,83,cc, */
5940 {0xa0, 0x84, 0x0088}, /* 00,88,84,cc, */
5941 {0xaa, 0x05, 0x0010}, /* 00,05,10,aa, */
5942 {0xaa, 0x0a, 0x0000}, /* 00,0a,00,aa, */
5943 {0xaa, 0x0b, 0x00a0}, /* 00,0b,a0,aa, */
5944 {0xaa, 0x0c, 0x0000}, /* 00,0c,00,aa, */
5945 {0xaa, 0x0d, 0x00a0}, /* 00,0d,a0,aa, */
5946 {0xaa, 0x0e, 0x0000}, /* 00,0e,00,aa, */
5947 {0xaa, 0x0f, 0x00a0}, /* 00,0f,a0,aa, */
5948 {0xaa, 0x10, 0x0000}, /* 00,10,00,aa, */
5949 {0xaa, 0x11, 0x00a0}, /* 00,11,a0,aa, */
5950 {0xa0, 0x00, 0x0039},
5951 {0xa1, 0x01, 0x0037},
5952 {0xaa, 0x16, 0x0001}, /* 00,16,01,aa, */
5953 {0xaa, 0x17, 0x00e8}, /* 00,17,e6,aa, (e6 -> e8) */
5954 {0xaa, 0x18, 0x0002}, /* 00,18,02,aa, */
5955 {0xaa, 0x19, 0x0088}, /* 00,19,86,aa, */
5956 {0xaa, 0x20, 0x0020}, /* 00,20,20,aa, */
5957 {0xa0, 0xb7, 0x0101}, /* 01,01,b7,cc, */
5958 {0xa0, 0x05, 0x0012}, /* 00,12,05,cc, */
5959 {0xa0, 0x0d, 0x0100}, /* 01,00,0d,cc, */
5960 {0xa0, 0x76, 0x0189}, /* 01,89,76,cc, */
5961 {0xa0, 0x09, 0x01ad}, /* 01,ad,09,cc, */
5962 {0xa0, 0x03, 0x01c5}, /* 01,c5,03,cc, */
5963 {0xa0, 0x13, 0x01cb}, /* 01,cb,13,cc, */
5964 {0xa0, 0x08, 0x0250}, /* 02,50,08,cc, */
5965 {0xa0, 0x08, 0x0301}, /* 03,01,08,cc, */
5966 {0xa0, 0x60, 0x01a8}, /* 01,a8,60,cc, */
5967 {0xa0, 0x61, 0x0116}, /* 01,16,61,cc, */
5968 {0xa0, 0x65, 0x0118}, /* 01,18,65,cc */
5969 {0, 0, 0}
5970};
5971
5972static struct usb_action tas5130c_vf0250_InitialScale[] = {
5973 {0xa0, 0x01, 0x0000}, /* 00,00,01,cc, */
5974 {0xa0, 0x02, 0x0008}, /* 00,08,02,cc, */
5975 {0xa0, 0x01, 0x0010}, /* 00,10,01,cc, */
5976 {0xa0, 0x00, 0x0002}, /* 00,02,10,cc, */
5977 {0xa0, 0x02, 0x0003}, /* 00,03,02,cc, */
5978 {0xa0, 0x80, 0x0004}, /* 00,04,80,cc, */
5979 {0xa0, 0x01, 0x0005}, /* 00,05,01,cc, */
5980 {0xa0, 0xe0, 0x0006}, /* 00,06,e0,cc, */
5981 {0xa0, 0x98, 0x008b}, /* 00,8b,98,cc, */
5982 {0xa0, 0x01, 0x0001}, /* 00,01,01,cc, */
5983 {0xa0, 0x03, 0x0012}, /* 00,12,03,cc, */
5984 {0xa0, 0x01, 0x0012}, /* 00,12,01,cc, */
5985 {0xa0, 0x00, 0x0098}, /* 00,98,00,cc, */
5986 {0xa0, 0x00, 0x009a}, /* 00,9a,00,cc, */
5987 {0xa0, 0x00, 0x011a}, /* 01,1a,00,cc, */
5988 {0xa0, 0x00, 0x011c}, /* 01,1c,00,cc, */
5989 {0xa0, 0xe8, 0x009c}, /* 00,9c,e8,cc, 8<->6 */
5990 {0xa0, 0x88, 0x009e}, /* 00,9e,88,cc, 8<->6 */
5991 {0xa0, 0x10, 0x0087}, /* 00,87,10,cc, */
5992 {0xa0, 0x98, 0x008b}, /* 00,8b,98,cc, */
5993 {0xaa, 0x1b, 0x0024}, /* 00,1b,24,aa, */
5994 {0xdd, 0x00, 0x0080}, /* 00,00,80,dd, */
5995 {0xaa, 0x1b, 0x0000}, /* 00,1b,00,aa, */
5996 {0xaa, 0x13, 0x0002}, /* 00,13,02,aa, */
5997 {0xaa, 0x15, 0x0004}, /* 00,15,04,aa */
5998 {0xaa, 0x01, 0x0000},
5999 {0xaa, 0x01, 0x0000},
6000 {0xaa, 0x1a, 0x0000}, /* 00,1a,00,aa, */
6001 {0xaa, 0x1c, 0x0017}, /* 00,1c,17,aa, */
6002 {0xa0, 0x82, 0x0086}, /* 00,86,82,cc, */
6003 {0xa0, 0x83, 0x0087}, /* 00,87,83,cc, */
6004 {0xa0, 0x84, 0x0088}, /* 00,88,84,cc, */
6005 {0xaa, 0x05, 0x0010}, /* 00,05,10,aa, */
6006 {0xaa, 0x0a, 0x0000}, /* 00,0a,00,aa, */
6007 {0xaa, 0x0b, 0x00a0}, /* 00,0b,a0,aa, */
6008 {0xaa, 0x0c, 0x0000}, /* 00,0c,00,aa, */
6009 {0xaa, 0x0d, 0x00a0}, /* 00,0d,a0,aa, */
6010 {0xaa, 0x0e, 0x0000}, /* 00,0e,00,aa, */
6011 {0xaa, 0x0f, 0x00a0}, /* 00,0f,a0,aa, */
6012 {0xaa, 0x10, 0x0000}, /* 00,10,00,aa, */
6013 {0xaa, 0x11, 0x00a0}, /* 00,11,a0,aa, */
6014 {0xa0, 0x00, 0x0039},
6015 {0xa1, 0x01, 0x0037},
6016 {0xaa, 0x16, 0x0001}, /* 00,16,01,aa, */
6017 {0xaa, 0x17, 0x00e8}, /* 00,17,e6,aa (e6 -> e8) */
6018 {0xaa, 0x18, 0x0002}, /* 00,18,02,aa, */
6019 {0xaa, 0x19, 0x0088}, /* 00,19,88,aa, */
6020 {0xaa, 0x20, 0x0020}, /* 00,20,20,aa, */
6021 {0xa0, 0xb7, 0x0101}, /* 01,01,b7,cc, */
6022 {0xa0, 0x05, 0x0012}, /* 00,12,05,cc, */
6023 {0xa0, 0x0d, 0x0100}, /* 01,00,0d,cc, */
6024 {0xa0, 0x76, 0x0189}, /* 01,89,76,cc, */
6025 {0xa0, 0x09, 0x01ad}, /* 01,ad,09,cc, */
6026 {0xa0, 0x03, 0x01c5}, /* 01,c5,03,cc, */
6027 {0xa0, 0x13, 0x01cb}, /* 01,cb,13,cc, */
6028 {0xa0, 0x08, 0x0250}, /* 02,50,08,cc, */
6029 {0xa0, 0x08, 0x0301}, /* 03,01,08,cc, */
6030 {0xa0, 0x60, 0x01a8}, /* 01,a8,60,cc, */
6031 {0xa0, 0x61, 0x0116}, /* 01,16,61,cc, */
6032 {0xa0, 0x65, 0x0118}, /* 01,18,65,cc */
6033 {0, 0, 0}
6034};
6035/* "50HZ" light frequency banding filter */
6036static struct usb_action tas5130c_vf0250_50HZ[] = {
6037 {0xaa, 0x82, 0x0000}, /* 00,82,00,aa */
6038 {0xaa, 0x83, 0x0001}, /* 00,83,01,aa */
6039 {0xaa, 0x84, 0x00aa}, /* 00,84,aa,aa */
6040 {0xa0, 0x00, 0x0190}, /* 01,90,00,cc, */
6041 {0xa0, 0x06, 0x0191}, /* 01,91,0d,cc, */
6042 {0xa0, 0xa8, 0x0192}, /* 01,92,50,cc, */
6043 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc, */
6044 {0xa0, 0x00, 0x0196}, /* 01,96,00,cc, */
6045 {0xa0, 0x8e, 0x0197}, /* 01,97,47,cc, */
6046 {0xa0, 0x0e, 0x018c}, /* 01,8c,0e,cc, */
6047 {0xa0, 0x15, 0x018f}, /* 01,8f,15,cc, */
6048 {0xa0, 0x10, 0x01a9}, /* 01,a9,10,cc, */
6049 {0xa0, 0x24, 0x01aa}, /* 01,aa,24,cc, */
6050 {0xa0, 0x62, 0x001d}, /* 00,1d,62,cc, */
6051 {0xa0, 0x90, 0x001e}, /* 00,1e,90,cc, */
6052 {0xa0, 0xc8, 0x001f}, /* 00,1f,c8,cc, */
6053 {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc, */
6054 {0xa0, 0x58, 0x011d}, /* 01,1d,58,cc, */
6055 {0xa0, 0x42, 0x0180}, /* 01,80,42,cc, */
6056 {0xa0, 0x78, 0x018d}, /* 01,8d,78,cc */
6057 {0, 0, 0}
6058};
6059
6060/* "50HZScale" light frequency banding filter */
6061static struct usb_action tas5130c_vf0250_50HZScale[] = {
6062 {0xaa, 0x82, 0x0000}, /* 00,82,00,aa */
6063 {0xaa, 0x83, 0x0003}, /* 00,83,03,aa */
6064 {0xaa, 0x84, 0x0054}, /* 00,84,54,aa */
6065 {0xa0, 0x00, 0x0190}, /* 01,90,00,cc, */
6066 {0xa0, 0x0d, 0x0191}, /* 01,91,0d,cc, */
6067 {0xa0, 0x50, 0x0192}, /* 01,92,50,cc, */
6068 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc, */
6069 {0xa0, 0x00, 0x0196}, /* 01,96,00,cc, */
6070 {0xa0, 0x8e, 0x0197}, /* 01,97,8e,cc, */
6071 {0xa0, 0x0e, 0x018c}, /* 01,8c,0e,cc, */
6072 {0xa0, 0x15, 0x018f}, /* 01,8f,15,cc, */
6073 {0xa0, 0x10, 0x01a9}, /* 01,a9,10,cc, */
6074 {0xa0, 0x24, 0x01aa}, /* 01,aa,24,cc, */
6075 {0xa0, 0x62, 0x001d}, /* 00,1d,62,cc, */
6076 {0xa0, 0x90, 0x001e}, /* 00,1e,90,cc, */
6077 {0xa0, 0xc8, 0x001f}, /* 00,1f,c8,cc, */
6078 {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc, */
6079 {0xa0, 0x58, 0x011d}, /* 01,1d,58,cc, */
6080 {0xa0, 0x42, 0x0180}, /* 01,80,42,cc, */
6081 {0xa0, 0x78, 0x018d}, /* 01,8d,78,cc */
6082 {0, 0, 0}
6083};
6084
6085/* "60HZ" light frequency banding filter */
6086static struct usb_action tas5130c_vf0250_60HZ[] = {
6087 {0xaa, 0x82, 0x0000}, /* 00,82,00,aa */
6088 {0xaa, 0x83, 0x0001}, /* 00,83,01,aa */
6089 {0xaa, 0x84, 0x0062}, /* 00,84,62,aa */
6090 {0xa0, 0x00, 0x0190}, /* 01,90,00,cc, */
6091 {0xa0, 0x05, 0x0191}, /* 01,91,05,cc, */
6092 {0xa0, 0x88, 0x0192}, /* 01,92,88,cc, */
6093 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc, */
6094 {0xa0, 0x00, 0x0196}, /* 01,96,00,cc, */
6095 {0xa0, 0x3b, 0x0197}, /* 01,97,3b,cc, */
6096 {0xa0, 0x0e, 0x018c}, /* 01,8c,0e,cc, */
6097 {0xa0, 0x15, 0x018f}, /* 01,8f,15,cc, */
6098 {0xa0, 0x10, 0x01a9}, /* 01,a9,10,cc, */
6099 {0xa0, 0x24, 0x01aa}, /* 01,aa,24,cc, */
6100 {0xa0, 0x62, 0x001d}, /* 00,1d,62,cc, */
6101 {0xa0, 0x90, 0x001e}, /* 00,1e,90,cc, */
6102 {0xa0, 0xc8, 0x001f}, /* 00,1f,c8,cc, */
6103 {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc, */
6104 {0xa0, 0x58, 0x011d}, /* 01,1d,58,cc, */
6105 {0xa0, 0x42, 0x0180}, /* 01,80,42,cc, */
6106 {0xa0, 0x78, 0x018d}, /* 01,8d,78,cc */
6107 {0, 0, 0}
6108};
6109
6110/* "60HZScale" light frequency banding ilter */
6111static struct usb_action tas5130c_vf0250_60HZScale[] = {
6112 {0xaa, 0x82, 0x0000}, /* 00,82,00,aa */
6113 {0xaa, 0x83, 0x0002}, /* 00,83,02,aa */
6114 {0xaa, 0x84, 0x00c4}, /* 00,84,c4,aa */
6115 {0xa0, 0x00, 0x0190}, /* 01,90,00,cc, */
6116 {0xa0, 0x0b, 0x0191}, /* 01,1,0b,cc, */
6117 {0xa0, 0x10, 0x0192}, /* 01,2,10,cc, */
6118 {0xa0, 0x00, 0x0195}, /* 01,5,00,cc, */
6119 {0xa0, 0x00, 0x0196}, /* 01,6,00,cc, */
6120 {0xa0, 0x76, 0x0197}, /* 01,7,76,cc, */
6121 {0xa0, 0x0e, 0x018c}, /* 01,c,0e,cc, */
6122 {0xa0, 0x15, 0x018f}, /* 01,f,15,cc, */
6123 {0xa0, 0x10, 0x01a9}, /* 01,9,10,cc, */
6124 {0xa0, 0x24, 0x01aa}, /* 01,a,24,cc, */
6125 {0xa0, 0x62, 0x001d}, /* 00,d,62,cc, */
6126 {0xa0, 0x90, 0x001e}, /* 00,e,90,cc, */
6127 {0xa0, 0xc8, 0x001f}, /* 00,f,c8,cc, */
6128 {0xa0, 0xff, 0x0020}, /* 00,0,ff,cc, */
6129 {0xa0, 0x58, 0x011d}, /* 01,d,58,cc, */
6130 {0xa0, 0x42, 0x0180}, /* 01,80,42,cc, */
6131 {0xa0, 0x78, 0x018d}, /* 01,d,78,cc */
6132 {0, 0, 0}
6133};
6134
6135/* "NoFliker" light frequency banding flter */
6136static struct usb_action tas5130c_vf0250_NoFliker[] = {
6137 {0xa0, 0x0c, 0x0100}, /* 01,00,0c,cc, */
6138 {0xaa, 0x82, 0x0000}, /* 00,82,00,aa */
6139 {0xaa, 0x83, 0x0000}, /* 00,83,00,aa */
6140 {0xaa, 0x84, 0x0020}, /* 00,84,20,aa */
6141 {0xa0, 0x00, 0x0190}, /* 01,0,00,cc, */
6142 {0xa0, 0x05, 0x0191}, /* 01,91,05,cc, */
6143 {0xa0, 0x88, 0x0192}, /* 01,92,88,cc, */
6144 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc, */
6145 {0xa0, 0x00, 0x0196}, /* 01,96,00,cc, */
6146 {0xa0, 0x10, 0x0197}, /* 01,97,10,cc, */
6147 {0xa0, 0x0e, 0x018c}, /* 01,8c,0e,cc, */
6148 {0xa0, 0x15, 0x018f}, /* 01,8f,15,cc, */
6149 {0xa0, 0x62, 0x001d}, /* 00,1d,62,cc, */
6150 {0xa0, 0x90, 0x001e}, /* 00,1e,90,cc, */
6151 {0xa0, 0xc8, 0x001f}, /* 00,1f,c8,cc, */
6152 {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc, */
6153 {0xa0, 0x58, 0x011d}, /* 01,1d,58,cc, */
6154 {0xa0, 0x03, 0x0180}, /* 01,80,03,cc */
6155 {0, 0, 0}
6156};
6157
6158/* "NoFlikerScale" light frequency banding filter */
6159static struct usb_action tas5130c_vf0250_NoFlikerScale[] = {
6160 {0xa0, 0x0c, 0x0100}, /* 01,00,0c,cc, */
6161 {0xaa, 0x82, 0x0000}, /* 00,82,00,aa */
6162 {0xaa, 0x83, 0x0000}, /* 00,83,00,aa */
6163 {0xaa, 0x84, 0x0020}, /* 00,84,20,aa */
6164 {0xa0, 0x00, 0x0190}, /* 01,90,00,cc, */
6165 {0xa0, 0x0b, 0x0191}, /* 01,91,0b,cc, */
6166 {0xa0, 0x10, 0x0192}, /* 01,92,10,cc, */
6167 {0xa0, 0x00, 0x0195}, /* 01,95,00,cc, */
6168 {0xa0, 0x00, 0x0196}, /* 01,96,00,cc, */
6169 {0xa0, 0x10, 0x0197}, /* 01,97,10,cc, */
6170 {0xa0, 0x0e, 0x018c}, /* 01,8c,0e,cc, */
6171 {0xa0, 0x15, 0x018f}, /* 01,8f,15,cc, */
6172 {0xa0, 0x62, 0x001d}, /* 00,1d,62,cc, */
6173 {0xa0, 0x90, 0x001e}, /* 00,1e,90,cc, */
6174 {0xa0, 0xc8, 0x001f}, /* 00,1f,c8,cc, */
6175 {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc, */
6176 {0xa0, 0x58, 0x011d}, /* 01,1d,58,cc, */
6177 {0xa0, 0x03, 0x0180}, /* 01,80,03,cc */
6178 {0, 0, 0}
6179};
6180
6181static void reg_r_i(struct usb_device *dev,
6182 __u16 index, __u8 *buffer)
6183{
6184 usb_control_msg(dev,
6185 usb_rcvctrlpipe(dev, 0),
6186 0xa1,
6187 USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
6188 0x01, /* value */
6189 index, buffer, 1,
6190 500);
6191}
6192
6193static void reg_r(struct usb_device *dev,
6194 __u16 index, __u8 *buffer)
6195{
6196 reg_r_i(dev, index, buffer);
6197 PDEBUG(D_USBI, "reg r [%04x] -> %02x", index, *buffer);
6198}
6199
6200static void reg_w_i(struct usb_device *dev,
6201 __u8 value,
6202 __u16 index)
6203{
6204 usb_control_msg(dev,
6205 usb_sndctrlpipe(dev, 0),
6206 0xa0,
6207 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
6208 value, index, NULL, 0,
6209 500);
6210}
6211
6212static void reg_w(struct usb_device *dev,
6213 __u8 value,
6214 __u16 index)
6215{
6216 PDEBUG(D_USBO, "reg w %02x -> [%04x]", value, index);
6217 reg_w_i(dev, value, index);
6218}
6219
6220static __u16 i2c_read(struct usb_device *dev, __u8 reg)
6221{
6222 __u8 retbyte;
6223 __u8 retval[2];
6224
6225 reg_w_i(dev, reg, 0x92);
6226 reg_w_i(dev, 0x02, 0x90); /* <- read command */
6227 msleep(25);
6228 reg_r_i(dev, 0x0091, &retbyte); /* read status */
6229 reg_r_i(dev, 0x0095, &retval[0]); /* read Lowbyte */
6230 reg_r_i(dev, 0x0096, &retval[1]); /* read Hightbyte */
6231 PDEBUG(D_USBO, "i2c r [%02x] -> (%02x) %02x%02x",
6232 reg, retbyte, retval[1], retval[0]);
6233 return (retval[1] << 8) | retval[0];
6234}
6235
6236static __u8 i2c_write(struct usb_device *dev,
6237 __u8 reg,
6238 __u8 valL,
6239 __u8 valH)
6240{
6241 __u8 retbyte;
6242
6243 reg_w_i(dev, reg, 0x92);
6244 reg_w_i(dev, valL, 0x93);
6245 reg_w_i(dev, valH, 0x94);
6246 reg_w_i(dev, 0x01, 0x90); /* <- write command */
6247 msleep(5);
6248 reg_r_i(dev, 0x0091, &retbyte); /* read status */
6249 PDEBUG(D_USBO, "i2c w [%02x] %02x%02x (%02x)",
6250 reg, valH, valL, retbyte);
6251 return retbyte;
6252}
6253
6254static void usb_exchange(struct usb_device *dev,
6255 struct usb_action *action)
6256{
6257 __u8 buffread;
6258
6259 while (action->req) {
6260 switch (action->req) {
6261 case 0xa0: /* write register */
6262 reg_w(dev, action->val, action->idx);
6263 break;
6264 case 0xa1: /* read status */
6265 reg_r(dev, action->idx, &buffread);
6266 break;
6267 case 0xaa:
6268 i2c_write(dev,
6269 action->val, /* reg */
6270 action->idx & 0xff, /* valL */
6271 action->idx >> 8); /* valH */
6272 break;
6273 default:
6274/* case 0xdd: * delay */
6275 msleep(action->val / 64 + 10);
6276 break;
6277 }
6278 action++;
6279/* msleep(1); */
6280 }
6281}
6282
6283static void setmatrix(struct gspca_dev *gspca_dev)
6284{
6285 struct sd *sd = (struct sd *) gspca_dev;
6286 int i;
6287 __u8 *matrix;
6288 static __u8 gc0305_matrix[9] =
6289 {0x50, 0xf8, 0xf8, 0xf8, 0x50, 0xf8, 0xf8, 0xf8, 0x50};
6290 static __u8 ov7620_matrix[9] =
6291 {0x58, 0xf4, 0xf4, 0xf4, 0x58, 0xf4, 0xf4, 0xf4, 0x58};
6292 static __u8 po2030_matrix[9] =
6293 {0x60, 0xf0, 0xf0, 0xf0, 0x60, 0xf0, 0xf0, 0xf0, 0x60};
6294
6295 switch (sd->sensor) {
6296 case SENSOR_GC0305:
6297 matrix = gc0305_matrix;
6298 break;
6299 case SENSOR_MC501CB:
6300 return; /* no matrix? */
6301 case SENSOR_OV7620:
6302/* case SENSOR_OV7648: */
6303 matrix = ov7620_matrix;
6304 break;
6305 case SENSOR_PO2030:
6306 matrix = po2030_matrix;
6307 break;
6308 case SENSOR_TAS5130C_VF0250: /* no matrix? */
6309 return;
6310 default: /* matrix already loaded */
6311 return;
6312 }
6313 for (i = 0; i < ARRAY_SIZE(ov7620_matrix); i++)
6314 reg_w(gspca_dev->dev, matrix[i], 0x010a + i);
6315}
6316
6317static void setbrightness(struct gspca_dev *gspca_dev)
6318{
6319 struct sd *sd = (struct sd *) gspca_dev;
6320 __u8 brightness;
6321
6322 switch (sd->sensor) {
6323 case SENSOR_GC0305:
6324 case SENSOR_OV7620:
6325 case SENSOR_PO2030:
6326 return;
6327 }
6328/*fixme: is it really 011d 018d for all other sensors? */
6329 brightness = sd->brightness;
6330 reg_w(gspca_dev->dev, brightness, 0x011d);
6331 if (brightness < 0x70)
6332 brightness += 0x10;
6333 else
6334 brightness = 0x80;
6335 reg_w(gspca_dev->dev, brightness, 0x018d);
6336}
6337
6338static void setsharpness(struct gspca_dev *gspca_dev)
6339{
6340 struct sd *sd = (struct sd *) gspca_dev;
6341 struct usb_device *dev = gspca_dev->dev;
6342 int sharpness;
6343 __u8 retbyte;
6344 static __u8 sharpness_tb[][2] = {
6345 {0x02, 0x03},
6346 {0x04, 0x07},
6347 {0x08, 0x0f},
6348 {0x10, 0x1e}
6349 };
6350
6351 switch (sd->sensor) {
6352 case SENSOR_GC0305:
6353 sharpness = 3;
6354 break;
6355 case SENSOR_OV7620:
6356 sharpness = 2;
6357 break;
6358 case SENSOR_PO2030:
6359 sharpness = 0;
6360 break;
6361 default:
6362 return;
6363 }
6364/*fixme: sharpness set by V4L2_CID_SATURATION?*/
6365 reg_w(dev, sharpness_tb[sharpness][0], 0x01c6);
6366 reg_r(dev, 0x01c8, &retbyte);
6367 reg_r(dev, 0x01c9, &retbyte);
6368 reg_r(dev, 0x01ca, &retbyte);
6369 reg_w(dev, sharpness_tb[sharpness][1], 0x01cb);
6370}
6371
6372static void setcontrast(struct gspca_dev *gspca_dev)
6373{
6374 struct sd *sd = (struct sd *) gspca_dev;
6375 struct usb_device *dev = gspca_dev->dev;
6376 __u8 *Tgamma, *Tgradient;
6377 int g, i, k;
6378 static __u8 kgamma_tb[16] = /* delta for contrast */
6379 {0x15, 0x0d, 0x0a, 0x09, 0x08, 0x08, 0x08, 0x08,
6380 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08};
6381 static __u8 kgrad_tb[16] =
6382 {0x1b, 0x06, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00,
6383 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x04};
6384 static __u8 Tgamma_1[16] =
6385 {0x00, 0x00, 0x03, 0x0d, 0x1b, 0x2e, 0x45, 0x5f,
6386 0x79, 0x93, 0xab, 0xc1, 0xd4, 0xe5, 0xf3, 0xff};
6387 static __u8 Tgradient_1[16] =
6388 {0x00, 0x01, 0x05, 0x0b, 0x10, 0x15, 0x18, 0x1a,
6389 0x1a, 0x18, 0x16, 0x14, 0x12, 0x0f, 0x0d, 0x06};
6390 static __u8 Tgamma_2[16] =
6391 {0x01, 0x0c, 0x1f, 0x3a, 0x53, 0x6d, 0x85, 0x9c,
6392 0xb0, 0xc2, 0xd1, 0xde, 0xe9, 0xf2, 0xf9, 0xff};
6393 static __u8 Tgradient_2[16] =
6394 {0x05, 0x0f, 0x16, 0x1a, 0x19, 0x19, 0x17, 0x15,
6395 0x12, 0x10, 0x0e, 0x0b, 0x09, 0x08, 0x06, 0x03};
6396 static __u8 Tgamma_3[16] =
6397 {0x04, 0x16, 0x30, 0x4e, 0x68, 0x81, 0x98, 0xac,
6398 0xbe, 0xcd, 0xda, 0xe4, 0xed, 0xf5, 0xfb, 0xff};
6399 static __u8 Tgradient_3[16] =
6400 {0x0c, 0x16, 0x1b, 0x1c, 0x19, 0x18, 0x15, 0x12,
6401 0x10, 0x0d, 0x0b, 0x09, 0x08, 0x06, 0x05, 0x03};
6402 static __u8 Tgamma_4[16] =
6403 {0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8,
6404 0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff};
6405 static __u8 Tgradient_4[16] =
6406 {0x26, 0x22, 0x20, 0x1c, 0x16, 0x13, 0x10, 0x0d,
6407 0x0b, 0x09, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02};
6408 static __u8 Tgamma_5[16] =
6409 {0x20, 0x4b, 0x6e, 0x8d, 0xa3, 0xb5, 0xc5, 0xd2,
6410 0xdc, 0xe5, 0xec, 0xf2, 0xf6, 0xfa, 0xfd, 0xff};
6411 static __u8 Tgradient_5[16] =
6412 {0x37, 0x26, 0x20, 0x1a, 0x14, 0x10, 0x0e, 0x0b,
6413 0x09, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x02};
6414 static __u8 Tgamma_6[16] = /* ?? was gama 5 */
6415 {0x24, 0x44, 0x64, 0x84, 0x9d, 0xb2, 0xc4, 0xd3,
6416 0xe0, 0xeb, 0xf4, 0xff, 0xff, 0xff, 0xff, 0xff};
6417 static __u8 Tgradient_6[16] =
6418 {0x18, 0x20, 0x20, 0x1c, 0x16, 0x13, 0x10, 0x0e,
6419 0x0b, 0x09, 0x07, 0x00, 0x00, 0x00, 0x00, 0x01};
6420 static __u8 *gamma_tb[] = {
6421 0, Tgamma_1, Tgamma_2,
6422 Tgamma_3, Tgamma_4, Tgamma_5, Tgamma_6
6423 };
6424 static __u8 *gradient_tb[] = {
6425 0, Tgradient_1, Tgradient_2,
6426 Tgradient_3, Tgradient_4, Tgradient_5, Tgradient_6
6427 };
6428#ifdef GSPCA_DEBUG
6429 __u8 v[16];
6430#endif
6431
6432 Tgamma = gamma_tb[sd->gamma];
6433 Tgradient = gradient_tb[sd->gamma];
6434
6435 k = (sd->contrast - 128) /* -128 / 128 */
6436 * Tgamma[0];
6437 PDEBUG(D_CONF, "gamma:%d contrast:%d gamma coeff: %d/128",
6438 sd->gamma, sd->contrast, k);
6439 for (i = 0; i < 16; i++) {
6440 g = Tgamma[i] + kgamma_tb[i] * k / 128;
6441 if (g > 0xff)
6442 g = 0xff;
6443 else if (g <= 0)
6444 g = 1;
6445 reg_w(dev, g, 0x0120 + i); /* gamma */
6446#ifdef GSPCA_DEBUG
6447 if (gspca_debug & D_CONF)
6448 v[i] = g;
6449#endif
6450 }
6451 PDEBUG(D_CONF, "tb: %02x %02x %02x %02x %02x %02x %02x %02x",
6452 v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7]);
6453 PDEBUG(D_CONF, " %02x %02x %02x %02x %02x %02x %02x %02x",
6454 v[8], v[9], v[10], v[11], v[12], v[13], v[14], v[15]);
6455 for (i = 0; i < 16; i++) {
6456 g = Tgradient[i] - kgrad_tb[i] * k / 128;
6457 if (g > 0xff)
6458 g = 0xff;
6459 else if (g <= 0) {
6460 if (i != 15)
6461 g = 0;
6462 else
6463 g = 1;
6464 }
6465 reg_w(dev, g, 0x0130 + i); /* gradient */
6466#ifdef GSPCA_DEBUG
6467 if (gspca_debug & D_CONF)
6468 v[i] = g;
6469#endif
6470 }
6471 PDEBUG(D_CONF, " %02x %02x %02x %02x %02x %02x %02x %02x",
6472 v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7]);
6473 PDEBUG(D_CONF, " %02x %02x %02x %02x %02x %02x %02x %02x",
6474 v[8], v[9], v[10], v[11], v[12], v[13], v[14], v[15]);
6475}
6476
6477static void setquality(struct gspca_dev *gspca_dev)
6478{
6479 struct sd *sd = (struct sd *) gspca_dev;
6480 struct usb_device *dev = gspca_dev->dev;
6481 __u8 quality;
6482 __u8 frxt;
6483
6484 switch (sd->sensor) {
6485 case SENSOR_GC0305:
6486 case SENSOR_OV7620:
6487 case SENSOR_PO2030:
6488 return;
6489 }
6490/*fixme: is it really 0008 0007 0018 for all other sensors? */
6491 quality = sd->qindex & 0x0f;
6492 reg_w(dev, quality, 0x0008);
6493 frxt = 0x30;
6494 reg_w(dev, frxt, 0x0007);
6495 switch (quality) {
6496 case 0:
6497 case 1:
6498 case 2:
6499 frxt = 0xff;
6500 break;
6501 case 3:
6502 frxt = 0xf0;
6503 break;
6504 case 4:
6505 frxt = 0xe0;
6506 break;
6507 case 5:
6508 frxt = 0x20;
6509 break;
6510 }
6511 reg_w(dev, frxt, 0x0018);
6512}
6513
6514/* Matches the sensor's internal frame rate to the lighting frequency.
6515 * Valid frequencies are:
6516 * 50Hz, for European and Asian lighting (default)
6517 * 60Hz, for American lighting
6518 * 0 = No Fliker (for outdoore usage)
6519 * Returns: 0 for success
6520 */
6521static int setlightfreq(struct gspca_dev *gspca_dev)
6522{
6523 struct sd *sd = (struct sd *) gspca_dev;
6524 int i, mode;
6525 struct usb_action *zc3_freq;
6526 static struct usb_action *freq_tb[SENSOR_MAX][6] = {
6527/* SENSOR_CS2102 0 */
6528 {cs2102_50HZ, cs2102_50HZScale,
6529 cs2102_60HZ, cs2102_60HZScale,
6530 cs2102_NoFliker, cs2102_NoFlikerScale},
6531/* SENSOR_CS2102K 1 */
6532 {cs2102_50HZ, cs2102_50HZScale,
6533 cs2102_60HZ, cs2102_60HZScale,
6534 cs2102_NoFliker, cs2102_NoFlikerScale},
6535/* SENSOR_GC0305 2 */
6536 {gc0305_50HZ, gc0305_50HZ,
6537 gc0305_60HZ, gc0305_60HZ,
6538 gc0305_NoFliker, gc0305_NoFliker},
6539/* SENSOR_HDCS2020 3 */
6540 {0, 0,
6541 0, 0,
6542 0, 0},
6543/* SENSOR_HDCS2020b 4 */
6544 {hdcs2020b_50HZ, hdcs2020b_50HZ,
6545 hdcs2020b_60HZ, hdcs2020b_60HZ,
6546 hdcs2020b_NoFliker, hdcs2020b_NoFliker},
6547/* SENSOR_HV7131B 5 */
6548 {0, 0,
6549 0, 0,
6550 0, 0},
6551/* SENSOR_HV7131C 6 */
6552 {0, 0,
6553 0, 0,
6554 0, 0},
6555/* SENSOR_ICM105A 7 */
6556 {icm105a_50HZ, icm105a_50HZScale,
6557 icm105a_60HZ, icm105a_60HZScale,
6558 icm105a_NoFliker, icm105a_NoFlikerScale},
6559/* SENSOR_MC501CB 8 */
6560 {MC501CB_50HZ, MC501CB_50HZScale,
6561 MC501CB_60HZ, MC501CB_60HZScale,
6562 MC501CB_NoFliker, MC501CB_NoFlikerScale},
6563/* SENSOR_OV7620 9 */
6564 {OV7620_50HZ, OV7620_50HZ,
6565 OV7620_60HZ, OV7620_60HZ,
6566 OV7620_NoFliker, OV7620_NoFliker},
6567/* SENSOR_OV7630C 10 */
6568 {0, 0,
6569 0, 0,
6570 0, 0},
6571/* SENSOR_free 11 */
6572 {0, 0,
6573 0, 0,
6574 0, 0},
6575/* SENSOR_PAS106 12 */
6576 {pas106b_50HZ, pas106b_50HZ,
6577 pas106b_60HZ, pas106b_60HZ,
6578 pas106b_NoFliker, pas106b_NoFliker},
6579/* SENSOR_PB0330 13 */
6580 {pb0330_50HZ, pb0330_50HZScale,
6581 pb0330_60HZ, pb0330_60HZScale,
6582 pb0330_NoFliker, pb0330_NoFlikerScale},
6583/* SENSOR_PO2030 14 */
6584 {PO2030_50HZ, PO2030_50HZ,
6585 PO2030_60HZ, PO2030_60HZ,
6586 PO2030_NoFliker, PO2030_NoFliker},
6587/* SENSOR_TAS5130CK 15 */
6588 {tas5130cxx_50HZ, tas5130cxx_50HZScale,
6589 tas5130cxx_60HZ, tas5130cxx_60HZScale,
6590 tas5130cxx_NoFliker, tas5130cxx_NoFlikerScale},
6591/* SENSOR_TAS5130CXX 16 */
6592 {tas5130cxx_50HZ, tas5130cxx_50HZScale,
6593 tas5130cxx_60HZ, tas5130cxx_60HZScale,
6594 tas5130cxx_NoFliker, tas5130cxx_NoFlikerScale},
6595/* SENSOR_TAS5130C_VF0250 17 */
6596 {tas5130c_vf0250_50HZ, tas5130c_vf0250_50HZScale,
6597 tas5130c_vf0250_60HZ, tas5130c_vf0250_60HZScale,
6598 tas5130c_vf0250_NoFliker, tas5130c_vf0250_NoFlikerScale},
6599 };
6600
6601 switch (lightfreq) {
6602 case 50:
6603 i = 0;
6604 break;
6605 case 60:
6606 i = 2;
6607 break;
6608 default:
6609 PDEBUG(D_ERR, "Invalid light freq value %d", lightfreq);
6610 lightfreq = 0; /* set to default filter value */
6611 /* fall thru */
6612 case 0:
6613 i = 4;
6614 break;
6615 }
6616 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode;
6617 if (!mode)
6618 i++; /* 640x480 */
6619 zc3_freq = freq_tb[(int) sd->sensor][i];
6620 if (zc3_freq != 0) {
6621 usb_exchange(gspca_dev->dev, zc3_freq);
6622 switch (sd->sensor) {
6623 case SENSOR_GC0305:
6624 if (mode /* if 320x240 */
6625 && lightfreq == 50)
6626 reg_w(gspca_dev->dev, 0x85, 0x018d);
6627 /* win: 0x80, 0x018d */
6628 break;
6629 case SENSOR_OV7620:
6630 if (!mode) { /* if 640x480 */
6631 if (lightfreq != 0) /* 50 or 60 Hz */
6632 reg_w(gspca_dev->dev, 0x40, 0x0002);
6633 else
6634 reg_w(gspca_dev->dev, 0x44, 0x0002);
6635 }
6636 break;
6637 }
6638 }
6639 return 0;
6640}
6641
6642static void setautogain(struct gspca_dev *gspca_dev)
6643{
6644 struct sd *sd = (struct sd *) gspca_dev;
6645 __u8 autoval;
6646
6647 if (sd->autogain)
6648 autoval = 0x42;
6649 else
6650 autoval = 0x02;
6651 reg_w(gspca_dev->dev, autoval, 0x0180);
6652}
6653
6654static void send_unknown(struct usb_device *dev, int sensor)
6655{
6656 switch (sensor) {
6657 case SENSOR_PAS106:
6658 reg_w(dev, 0x01, 0x0000);
6659 reg_w(dev, 0x03, 0x003a);
6660 reg_w(dev, 0x0c, 0x003b);
6661 reg_w(dev, 0x08, 0x0038);
6662 break;
6663 case SENSOR_GC0305:
6664 case SENSOR_OV7620:
6665 case SENSOR_PB0330:
6666 case SENSOR_PO2030:
6667 reg_w(dev, 0x01, 0x0000);
6668 reg_w(dev, 0x0d, 0x003a);
6669 reg_w(dev, 0x02, 0x003b);
6670 reg_w(dev, 0x00, 0x0038);
6671 break;
6672 }
6673}
6674
6675/* start probe 2 wires */
6676static void start_2wr_probe(struct usb_device *dev, int sensor)
6677{
6678 reg_w(dev, 0x01, 0x0000);
6679 reg_w(dev, sensor, 0x0010);
6680 reg_w(dev, 0x01, 0x0001);
6681 reg_w(dev, 0x03, 0x0012);
6682 reg_w(dev, 0x01, 0x0012);
6683/* msleep(2); */
6684}
6685
6686static int sif_probe(struct usb_device *dev)
6687{
6688 __u16 checkword;
6689
6690 start_2wr_probe(dev, 0x0f); /* PAS106 */
6691 reg_w(dev, 0x08, 0x008d);
6692 msleep(150);
6693 checkword = ((i2c_read(dev, 0x00) & 0x0f) << 4)
6694 | ((i2c_read(dev, 0x01) & 0xf0) >> 4);
6695 PDEBUG(D_PROBE, "probe sif 0x%04x", checkword);
6696 if (checkword == 0x0007) {
6697 send_unknown(dev, SENSOR_PAS106);
6698 return 0x0f; /* PAS106 */
6699 }
6700 return -1;
6701}
6702
6703static int vga_2wr_probe(struct usb_device *dev)
6704{
6705 __u8 retbyte;
6706 __u16 checkword;
6707
6708 start_2wr_probe(dev, 0x00); /* HV7131B */
6709 i2c_write(dev, 0x01, 0xaa, 0x00);
6710 retbyte = i2c_read(dev, 0x01);
6711 if (retbyte != 0)
6712 return 0x00; /* HV7131B */
6713
6714 start_2wr_probe(dev, 0x04); /* CS2102 */
6715 i2c_write(dev, 0x01, 0xaa, 0x00);
6716 retbyte = i2c_read(dev, 0x01);
6717 if (retbyte != 0)
6718 return 0x04; /* CS2102 */
6719
6720 start_2wr_probe(dev, 0x06); /* OmniVision */
6721 reg_w(dev, 0x08, 0x8d);
6722 i2c_write(dev, 0x11, 0xaa, 0x00);
6723 retbyte = i2c_read(dev, 0x11);
6724 if (retbyte != 0) {
6725 /* (should have returned 0xaa) --> Omnivision? */
6726 /* reg_r 0x10 -> 0x06 --> */
6727 goto ov_check;
6728 }
6729
6730 start_2wr_probe(dev, 0x08); /* HDCS2020 */
6731 i2c_write(dev, 0x15, 0xaa, 0x00);
6732 retbyte = i2c_read(dev, 0x15);
6733 if (retbyte != 0)
6734 return 0x08; /* HDCS2020 */
6735
6736 start_2wr_probe(dev, 0x0a); /* PB0330 */
6737 i2c_write(dev, 0x07, 0xaa, 0xaa);
6738 retbyte = i2c_read(dev, 0x07);
6739 if (retbyte != 0)
6740 return 0x0a; /* PB0330 */
6741 retbyte = i2c_read(dev, 0x03);
6742 if (retbyte != 0)
6743 return 0x0a; /* PB0330 ?? */
6744 retbyte = i2c_read(dev, 0x04);
6745 if (retbyte != 0)
6746 return 0x0a; /* PB0330 ?? */
6747
6748 start_2wr_probe(dev, 0x0c); /* ICM105A */
6749 i2c_write(dev, 0x01, 0x11, 0x00);
6750 retbyte = i2c_read(dev, 0x01);
6751 if (retbyte != 0)
6752 return 0x0c; /* ICM105A */
6753
6754 start_2wr_probe(dev, 0x0e); /* PAS202BCB */
6755 reg_w(dev, 0x08, 0x8d);
6756 i2c_write(dev, 0x03, 0xaa, 0x00);
6757 msleep(500);
6758 retbyte = i2c_read(dev, 0x03);
6759 if (retbyte != 0)
6760 return 0x0e; /* PAS202BCB */
6761
6762 start_2wr_probe(dev, 0x02); /* ?? */
6763 i2c_write(dev, 0x01, 0xaa, 0x00);
6764 retbyte = i2c_read(dev, 0x01);
6765 if (retbyte != 0)
6766 return 0x02; /* ?? */
6767ov_check:
6768 reg_r(dev, 0x0010, &retbyte); /* ?? */
6769 reg_r(dev, 0x0010, &retbyte);
6770
6771 reg_w(dev, 0x01, 0x0000);
6772 reg_w(dev, 0x01, 0x0001);
6773 reg_w(dev, 0x06, 0x0010); /* OmniVision */
6774 reg_w(dev, 0xa1, 0x008b);
6775 reg_w(dev, 0x08, 0x008d);
6776 msleep(500);
6777 reg_w(dev, 0x01, 0x0012);
6778 i2c_write(dev, 0x12, 0x80, 0x00); /* sensor reset */
6779 retbyte = i2c_read(dev, 0x0a);
6780 checkword = retbyte << 8;
6781 retbyte = i2c_read(dev, 0x0b);
6782 checkword |= retbyte;
6783 PDEBUG(D_PROBE, "probe 2wr ov vga 0x%04x", checkword);
6784 switch (checkword) {
6785 case 0x7631: /* OV7630C */
6786 reg_w(dev, 0x06, 0x0010);
6787 break;
6788 case 0x7620: /* OV7620 */
6789 case 0x7648: /* OV7648 */
6790 break;
6791 default:
6792 return -1; /* not OmniVision */
6793 }
6794 return checkword;
6795}
6796
6797struct sensor_by_chipset_revision {
6798 __u16 revision;
6799 __u8 internal_sensor_id;
6800};
6801static const struct sensor_by_chipset_revision chipset_revision_sensor[] = {
6802 {0xc001, 0x13}, /* MI0360 */
6803 {0xe001, 0x13},
6804 {0x8001, 0x13},
6805 {0x8000, 0x14}, /* CS2102K */
6806 {0x8400, 0x15}, /* TAS5130K */
6807 {0, 0}
6808};
6809
6810static int vga_3wr_probe(struct gspca_dev *gspca_dev)
6811{
6812 struct sd *sd = (struct sd *) gspca_dev;
6813 struct usb_device *dev = gspca_dev->dev;
6814 int i;
6815 __u8 retbyte;
6816 __u16 checkword;
6817
6818/*fixme: lack of 8b=b3 (11,12)-> 10, 8b=e0 (14,15,16)-> 12 found in gspcav1*/
6819 reg_w(dev, 0x02, 0x0010);
6820 reg_r(dev, 0x0010, &retbyte);
6821 reg_w(dev, 0x01, 0x0000);
6822 reg_w(dev, 0x00, 0x0010);
6823 reg_w(dev, 0x01, 0x0001);
6824 reg_w(dev, 0x91, 0x008b);
6825 reg_w(dev, 0x03, 0x0012);
6826 reg_w(dev, 0x01, 0x0012);
6827 reg_w(dev, 0x05, 0x0012);
6828 retbyte = i2c_read(dev, 0x14);
6829 if (retbyte != 0)
6830 return 0x11; /* HV7131R */
6831 retbyte = i2c_read(dev, 0x15);
6832 if (retbyte != 0)
6833 return 0x11; /* HV7131R */
6834 retbyte = i2c_read(dev, 0x16);
6835 if (retbyte != 0)
6836 return 0x11; /* HV7131R */
6837
6838 reg_w(dev, 0x02, 0x0010);
6839 reg_r(dev, 0x000b, &retbyte);
6840 checkword = retbyte << 8;
6841 reg_r(dev, 0x000a, &retbyte);
6842 checkword |= retbyte;
6843 PDEBUG(D_PROBE, "probe 3wr vga 1 0x%04x", checkword);
6844 reg_r(dev, 0x0010, &retbyte);
6845 /* this is tested only once anyway */
6846 i = 0;
6847 while (chipset_revision_sensor[i].revision) {
6848 if (chipset_revision_sensor[i].revision == checkword) {
6849 sd->chip_revision = checkword;
6850 send_unknown(dev, SENSOR_PB0330);
6851 return chipset_revision_sensor[i].internal_sensor_id;
6852 }
6853 i++;
6854 }
6855
6856 reg_w(dev, 0x01, 0x0000);
6857 reg_w(dev, 0x01, 0x0001);
6858 reg_w(dev, 0xdd, 0x008b);
6859 reg_w(dev, 0x0a, 0x0010);
6860 reg_w(dev, 0x03, 0x0012);
6861 reg_w(dev, 0x01, 0x0012);
6862 retbyte = i2c_read(dev, 0x00);
6863 if (retbyte != 0) {
6864 PDEBUG(D_PROBE, "probe 3wr vga type 0a ?");
6865 return 0x0a; /* ?? */
6866 }
6867
6868 reg_w(dev, 0x01, 0x0000);
6869 reg_w(dev, 0x01, 0x0001);
6870 reg_w(dev, 0x98, 0x008b);
6871 reg_w(dev, 0x01, 0x0010);
6872 reg_w(dev, 0x03, 0x0012);
6873 msleep(2);
6874 reg_w(dev, 0x01, 0x0012);
6875 retbyte = i2c_read(dev, 0x00);
6876 if (retbyte != 0) {
6877 PDEBUG(D_PROBE, "probe 3wr vga type %02x", retbyte);
6878 send_unknown(dev, SENSOR_GC0305);
6879 return retbyte; /* 0x29 = gc0305 - should continue? */
6880 }
6881
6882 reg_w(dev, 0x01, 0x0000); /* check OmniVision */
6883 reg_w(dev, 0x01, 0x0001);
6884 reg_w(dev, 0xa1, 0x008b);
6885 reg_w(dev, 0x08, 0x008d);
6886 reg_w(dev, 0x06, 0x0010);
6887 reg_w(dev, 0x01, 0x0012);
6888 reg_w(dev, 0x05, 0x0012);
6889 if (i2c_read(dev, 0x1c) == 0x7f /* OV7610 - manufacturer ID */
6890 && i2c_read(dev, 0x1d) == 0xa2) {
6891 send_unknown(dev, SENSOR_OV7620);
6892 return 0x06; /* OmniVision confirm ? */
6893 }
6894
6895 reg_w(dev, 0x01, 0x00);
6896 reg_w(dev, 0x00, 0x02);
6897 reg_w(dev, 0x01, 0x10);
6898 reg_w(dev, 0x01, 0x01);
6899 reg_w(dev, 0xee, 0x8b);
6900 reg_w(dev, 0x03, 0x12);
6901/* msleep(150); */
6902 reg_w(dev, 0x01, 0x12);
6903 reg_w(dev, 0x05, 0x12);
6904 retbyte = i2c_read(dev, 0x00); /* ID 0 */
6905 checkword = retbyte << 8;
6906 retbyte = i2c_read(dev, 0x01); /* ID 1 */
6907 checkword |= retbyte;
6908 PDEBUG(D_PROBE, "probe 3wr vga 2 0x%04x", checkword);
6909 if (checkword == 0x2030) {
6910 retbyte = i2c_read(dev, 0x02); /* revision number */
6911 PDEBUG(D_PROBE, "sensor PO2030 rev 0x%02x", retbyte);
6912 send_unknown(dev, SENSOR_PO2030);
6913 return checkword;
6914 }
6915
6916 reg_w(dev, 0x01, 0x00);
6917 reg_w(dev, 0x0a, 0x10);
6918 reg_w(dev, 0xd3, 0x8b);
6919 reg_w(dev, 0x01, 0x01);
6920 reg_w(dev, 0x03, 0x12);
6921 reg_w(dev, 0x01, 0x12);
6922 reg_w(dev, 0x05, 0x01);
6923 reg_w(dev, 0xd3, 0x8b);
6924 retbyte = i2c_read(dev, 0x01);
6925 if (retbyte != 0) {
6926 PDEBUG(D_PROBE, "probe 3wr vga type 0a ?");
6927 return 0x0a; /* ?? */
6928 }
6929 return -1;
6930}
6931
6932static int zcxx_probeSensor(struct gspca_dev *gspca_dev)
6933{
6934 struct sd *sd = (struct sd *) gspca_dev;
6935 struct usb_device *dev = gspca_dev->dev;
6936 int sensor, sensor2;
6937
6938 switch (sd->sensor) {
6939 case SENSOR_MC501CB:
6940 case SENSOR_TAS5130C_VF0250:
6941 return -1; /* don't probe */
6942 }
6943 sensor = vga_2wr_probe(dev);
6944 if (sensor >= 0) {
6945 if (sensor < 0x7600)
6946 return sensor;
6947 /* next probe is needed for OmniVision ? */
6948 }
6949 sensor2 = vga_3wr_probe(gspca_dev);
6950 if (sensor2 >= 0) {
6951 if (sensor >= 0)
6952 return sensor;
6953 return sensor2;
6954 }
6955 return sif_probe(dev);
6956}
6957
6958/* this function is called at probe time */
6959static int sd_config(struct gspca_dev *gspca_dev,
6960 const struct usb_device_id *id)
6961{
6962 struct sd *sd = (struct sd *) gspca_dev;
6963 struct cam *cam;
6964 int sensor;
6965 __u8 bsensor;
6966 int vga = 1; /* 1: vga, 0: sif */
6967 static unsigned char gamma[SENSOR_MAX] = {
6968 5, /* SENSOR_CS2102 0 */
6969 5, /* SENSOR_CS2102K 1 */
6970 4, /* SENSOR_GC0305 2 */
6971 4, /* SENSOR_HDCS2020 3 */
6972 4, /* SENSOR_HDCS2020b 4 */
6973 4, /* SENSOR_HV7131B 5 */
6974 4, /* SENSOR_HV7131C 6 */
6975 4, /* SENSOR_ICM105A 7 */
6976 4, /* SENSOR_MC501CB 8 */
6977 3, /* SENSOR_OV7620 9 */
6978 4, /* SENSOR_OV7630C 10 */
6979 4, /* SENSOR_free 11 */
6980 4, /* SENSOR_PAS106 12 */
6981 4, /* SENSOR_PB0330 13 */
6982 4, /* SENSOR_PO2030 14 */
6983 4, /* SENSOR_TAS5130CK 15 */
6984 4, /* SENSOR_TAS5130CXX 16 */
6985 3, /* SENSOR_TAS5130C_VF0250 17 */
6986 };
6987
6988 /* define some sensors from the vendor/product */
6989 switch (id->idVendor) {
6990 case 0x041e: /* Creative */
6991 switch (id->idProduct) {
6992 case 0x4051: /* zc301 chips */
6993 case 0x4053:
6994 sd->sensor = SENSOR_TAS5130C_VF0250;
6995 break;
6996 }
6997 break;
6998 case 0x046d: /* Logitech Labtec */
6999 switch (id->idProduct) {
7000 case 0x08dd:
7001 sd->sensor = SENSOR_MC501CB;
7002 break;
7003 }
7004 break;
7005 case 0x0ac8: /* Vimicro z-star */
7006 switch (id->idProduct) {
7007 case 0x305b:
7008 sd->sensor = SENSOR_TAS5130C_VF0250;
7009 break;
7010 }
7011 break;
7012 }
7013 sensor = zcxx_probeSensor(gspca_dev);
7014 if (sensor >= 0)
7015 PDEBUG(D_PROBE, "probe sensor -> %02x", sensor);
7016 if ((unsigned) force_sensor < SENSOR_MAX) {
7017 sd->sensor = force_sensor;
7018 PDEBUG(D_PROBE, "sensor forced to %d", force_sensor);
7019 } else {
7020 switch (sensor) {
7021 case -1:
7022 switch (sd->sensor) {
7023 case SENSOR_MC501CB:
7024 PDEBUG(D_PROBE, "Sensor MC501CB");
7025 break;
7026 case SENSOR_TAS5130C_VF0250:
7027 PDEBUG(D_PROBE, "Sensor Tas5130 (VF0250)");
7028 break;
7029 default:
7030 PDEBUG(D_PROBE,
7031 "Sensor UNKNOW_0 force Tas5130");
7032 sd->sensor = SENSOR_TAS5130CXX;
7033 }
7034 break;
7035 case 0:
7036 PDEBUG(D_PROBE, "Find Sensor HV7131B");
7037 sd->sensor = SENSOR_HV7131B;
7038 break;
7039 case 0x04:
7040 PDEBUG(D_PROBE, "Find Sensor CS2102");
7041 sd->sensor = SENSOR_CS2102;
7042 break;
7043 case 0x08:
7044 PDEBUG(D_PROBE, "Find Sensor HDCS2020(b)");
7045 sd->sensor = SENSOR_HDCS2020b;
7046 break;
7047 case 0x0a:
7048 PDEBUG(D_PROBE,
7049 "Find Sensor PB0330. Chip revision %x",
7050 sd->chip_revision);
7051 sd->sensor = SENSOR_PB0330;
7052 break;
7053 case 0x0c:
7054 PDEBUG(D_PROBE, "Find Sensor ICM105A");
7055 sd->sensor = SENSOR_ICM105A;
7056 break;
7057 case 0x0e:
7058 PDEBUG(D_PROBE, "Find Sensor PAS202BCB");
7059 sd->sensor = SENSOR_HDCS2020;
7060 break;
7061 case 0x0f:
7062 PDEBUG(D_PROBE, "Find Sensor PAS106");
7063 sd->sensor = SENSOR_PAS106;
7064 vga = 0; /* SIF */
7065 break;
7066 case 0x10:
7067 case 0x12:
7068 PDEBUG(D_PROBE, "Find Sensor TAS5130");
7069 sd->sensor = SENSOR_TAS5130CXX;
7070 break;
7071 case 0x11:
7072 PDEBUG(D_PROBE, "Find Sensor HV7131R(c)");
7073 sd->sensor = SENSOR_HV7131C;
7074 break;
7075 case 0x13:
7076 PDEBUG(D_PROBE,
7077 "Find Sensor MI0360. Chip revision %x",
7078 sd->chip_revision);
7079 sd->sensor = SENSOR_PB0330;
7080 break;
7081 case 0x14:
7082 PDEBUG(D_PROBE,
7083 "Find Sensor CS2102K?. Chip revision %x",
7084 sd->chip_revision);
7085 sd->sensor = SENSOR_CS2102K;
7086 break;
7087 case 0x15:
7088 PDEBUG(D_PROBE,
7089 "Find Sensor TAS5130CK?. Chip revision %x",
7090 sd->chip_revision);
7091 sd->sensor = SENSOR_TAS5130CK;
7092 break;
7093 case 0x29:
7094 PDEBUG(D_PROBE, "Find Sensor GC0305");
7095 sd->sensor = SENSOR_GC0305;
7096 break;
7097 case 0x2030:
7098 PDEBUG(D_PROBE, "Find Sensor PO2030");
7099 sd->sensor = SENSOR_PO2030;
7100 break;
7101 case 0x7620:
7102 PDEBUG(D_PROBE, "Find Sensor OV7620");
7103 sd->sensor = SENSOR_OV7620;
7104 break;
7105 case 0x7648:
7106 PDEBUG(D_PROBE, "Find Sensor OV7648");
7107 sd->sensor = SENSOR_OV7620; /* same sensor (?) */
7108 break;
7109 default:
7110 PDEBUG(D_ERR|D_PROBE, "Unknown sensor %02x", sensor);
7111 return -EINVAL;
7112 }
7113 }
7114 if (sensor < 0x20) {
7115 if (sensor == -1 || sensor == 0x10 || sensor == 0x12)
7116 reg_w(gspca_dev->dev, 0x02, 0x0010);
7117 else
7118 reg_w(gspca_dev->dev, sensor & 0x0f, 0x0010);
7119 reg_r(gspca_dev->dev, 0x0010, &bsensor);
7120 }
7121
7122 cam = &gspca_dev->cam;
7123 cam->dev_name = (char *) id->driver_info;
7124 cam->epaddr = 0x01;
7125/*fixme:test*/
7126 gspca_dev->nbalt--;
7127 if (vga) {
7128 cam->cam_mode = vga_mode;
7129 cam->nmodes = sizeof vga_mode / sizeof vga_mode[0];
7130 } else {
7131 cam->cam_mode = sif_mode;
7132 cam->nmodes = sizeof sif_mode / sizeof sif_mode[0];
7133 }
7134 sd->qindex = 1;
7135 sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value;
7136 sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value;
7137 sd->autogain = sd_ctrls[SD_AUTOGAIN].qctrl.default_value;
7138 sd->gamma = gamma[(int) sd->sensor];
7139
7140 /* switch the led off */
7141/*fixme: other sensors? */
7142 if (sensor == 0x06 || sensor == 0x11)
7143 reg_w(gspca_dev->dev, 0x01, 0x0000);
7144 return 0;
7145}
7146
7147/* this function is called at open time */
7148static int sd_open(struct gspca_dev *gspca_dev)
7149{
7150 reg_w(gspca_dev->dev, 0x01, 0x0000);
7151 return 0;
7152}
7153
7154static void sd_start(struct gspca_dev *gspca_dev)
7155{
7156 struct sd *sd = (struct sd *) gspca_dev;
7157 struct usb_device *dev = gspca_dev->dev;
7158 struct usb_action *zc3_init;
7159 int mode;
7160 __u8 retbyte;
7161 static struct usb_action *init_tb[SENSOR_MAX][2] = {
7162 {cs2102_InitialScale, cs2102_Initial}, /* 0 */
7163 {cs2102K_InitialScale, cs2102K_Initial}, /* 1 */
7164 {gc0305_Initial, gc0305_InitialScale}, /* 2 */
7165 {hdcs2020xx_InitialScale, hdcs2020xx_Initial}, /* 3 */
7166 {hdcs2020xb_InitialScale, hdcs2020xb_Initial}, /* 4 */
7167 {hv7131bxx_InitialScale, hv7131bxx_Initial}, /* 5 */
7168 {hv7131cxx_InitialScale, hv7131cxx_Initial}, /* 6 */
7169 {icm105axx_InitialScale, icm105axx_Initial}, /* 7 */
7170 {MC501CB_InitialScale, MC501CB_Initial}, /* 9 */
7171 {OV7620_mode0, OV7620_mode1}, /* 9 */
7172 {ov7630c_InitialScale, ov7630c_Initial}, /* 10 */
7173 {0, 0}, /* 11 */
7174 {pas106b_InitialScale, pas106b_Initial}, /* 12 */
7175 {pb0330xx_InitialScale, pb0330xx_Initial}, /* 13 */
7176/* or {pb03303x_InitialScale, pb03303x_Initial}, */
7177 {PO2030_mode0, PO2030_mode1}, /* 14 */
7178 {tas5130CK_InitialScale, tas5130CK_Initial}, /* 15 */
7179 {tas5130cxx_InitialScale, tas5130cxx_Initial}, /* 16 */
7180 {tas5130c_vf0250_InitialScale, tas5130c_vf0250_Initial},
7181 /* 17 */
7182 };
7183
7184 mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode;
7185 zc3_init = init_tb[(int) sd->sensor][mode];
7186 switch (sd->sensor) {
7187 case SENSOR_HV7131B:
7188 case SENSOR_HV7131C:
7189 zcxx_probeSensor(gspca_dev);
7190 break;
7191 case SENSOR_PAS106:
7192 usb_exchange(dev, pas106b_Initial_com);
7193 break;
7194 case SENSOR_PB0330:
7195 if (mode) {
7196 if (sd->chip_revision == 0xc001
7197 || sd->chip_revision == 0xe001
7198 || sd->chip_revision == 0x8001)
7199 zc3_init = pb03303x_Initial;
7200 } else {
7201 if (sd->chip_revision == 0xc001
7202 || sd->chip_revision == 0xe001
7203 || sd->chip_revision == 0x8001)
7204 zc3_init = pb03303x_InitialScale;
7205 }
7206 break;
7207 }
7208 usb_exchange(dev, zc3_init);
7209
7210 switch (sd->sensor) {
7211 case SENSOR_GC0305:
7212 case SENSOR_OV7620:
7213 case SENSOR_PO2030:
7214 msleep(100); /* ?? */
7215 reg_r(dev, 0x0002, &retbyte); /* --> 0x40 */
7216 reg_w(dev, 0x09, 0x01ad); /* (from win traces) */
7217 reg_w(dev, 0x15, 0x01ae);
7218 reg_w(dev, 0x0d, 0x003a);
7219 reg_w(dev, 0x02, 0x003b);
7220 reg_w(dev, 0x00, 0x0038);
7221 break;
7222 }
7223
7224 setmatrix(gspca_dev);
7225 setbrightness(gspca_dev);
7226 switch (sd->sensor) {
7227 case SENSOR_OV7620:
7228 reg_r(dev, 0x0008, &retbyte);
7229 reg_w(dev, 0x00, 0x0008);
7230 break;
7231 case SENSOR_GC0305:
7232 reg_r(dev, 0x0008, &retbyte);
7233 /* fall thru */
7234 case SENSOR_PO2030:
7235 reg_w(dev, 0x03, 0x0008);
7236 break;
7237 }
7238 setsharpness(gspca_dev);
7239
7240 /* set the gamma tables when not set */
7241 switch (sd->sensor) {
7242 case SENSOR_CS2102: /* gamma set in xxx_Initial */
7243 case SENSOR_CS2102K:
7244 case SENSOR_HDCS2020:
7245 case SENSOR_HDCS2020b:
7246 case SENSOR_PB0330: /* pb with chip_revision - see above */
7247 case SENSOR_OV7630C:
7248 case SENSOR_TAS5130CK:
7249 break;
7250 default:
7251 setcontrast(gspca_dev);
7252 break;
7253 }
7254 setmatrix(gspca_dev); /* one more time? */
7255 switch (sd->sensor) {
7256 case SENSOR_OV7620:
7257 reg_r(dev, 0x0180, &retbyte); /* from win */
7258 reg_w(dev, 0x00, 0x0180);
7259 break;
7260 default:
7261 setquality(gspca_dev);
7262 break;
7263 }
7264 setlightfreq(gspca_dev);
7265
7266 switch (sd->sensor) {
7267 case SENSOR_GC0305:
7268 case SENSOR_OV7620:
7269 reg_w(dev, 0x09, 0x01ad); /* (from win traces) */
7270 reg_w(dev, 0x15, 0x01ae);
7271 sd->autogain = 0;
7272 break;
7273 case SENSOR_PO2030:
7274 reg_w(dev, 0x40, 0x0117); /* (from win traces) */
7275 reg_r(dev, 0x0180, &retbyte);
7276 break;
7277 }
7278
7279 setautogain(gspca_dev);
7280 switch (sd->sensor) {
7281 case SENSOR_GC0305:
7282/* setlightfreq(gspca_dev); ?? (end: 80 -> [18d]) */
7283 reg_w(dev, 0x09, 0x01ad); /* (from win traces) */
7284 reg_w(dev, 0x15, 0x01ae);
7285 reg_w(dev, 0x40, 0x0180);
7286 reg_w(dev, 0x40, 0x0117);
7287 reg_r(dev, 0x0180, &retbyte);
7288 sd->autogain = 1;
7289 setautogain(gspca_dev);
7290 break;
7291 case SENSOR_OV7620:
7292 i2c_read(dev, 0x13); /*fixme: returns 0xa3 */
7293 i2c_write(dev, 0x13, 0xa3, 0x00); /*fixme: same to send? */
7294 reg_w(dev, 0x40, 0x0117); /* (from win traces) */
7295 reg_r(dev, 0x0180, &retbyte);
7296 setautogain(gspca_dev);
7297 msleep(500);
7298 break;
7299 case SENSOR_PO2030:
7300 msleep(500);
7301 reg_r(dev, 0x0008, &retbyte);
7302 reg_r(dev, 0x0007, &retbyte);
7303 reg_w(dev, 0x00, 0x0007); /* (from win traces) */
7304 reg_w(dev, 0x02, 0x0008);
7305 break;
7306 }
7307}
7308
7309static void sd_stopN(struct gspca_dev *gspca_dev)
7310{
7311}
7312
7313static void sd_stop0(struct gspca_dev *gspca_dev)
7314{
7315 struct sd *sd = (struct sd *) gspca_dev;
7316
7317 send_unknown(gspca_dev->dev, sd->sensor);
7318}
7319
7320/* this function is called at close time */
7321static void sd_close(struct gspca_dev *gspca_dev)
7322{
7323}
7324
7325static void sd_pkt_scan(struct gspca_dev *gspca_dev,
7326 struct gspca_frame *frame,
7327 unsigned char *data,
7328 int len)
7329{
7330
7331 if (data[0] == 0xff && data[1] == 0xd8) { /* start of frame */
7332 frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame,
7333 data, 0);
7334 /* put the JPEG header in the new frame */
7335 jpeg_put_header(gspca_dev, frame,
7336 ((struct sd *) gspca_dev)->qindex,
7337 0x21);
7338 /* remove the webcam's header:
7339 * ff d8 ff fe 00 0e 00 00 ss ss 00 01 ww ww hh hh pp pp
7340 * - 'ss ss' is the frame sequence number (BE)
7341 * - 'ww ww' and 'hh hh' are the window dimensions (BE)
7342 * - 'pp pp' is the packet sequence number (BE)
7343 */
7344 data += 18;
7345 len -= 18;
7346 }
7347 gspca_frame_add(gspca_dev, INTER_PACKET, frame, data, len);
7348}
7349
7350static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val)
7351{
7352 struct sd *sd = (struct sd *) gspca_dev;
7353
7354 sd->brightness = val;
7355 if (gspca_dev->streaming)
7356 setbrightness(gspca_dev);
7357 return 0;
7358}
7359
7360static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val)
7361{
7362 struct sd *sd = (struct sd *) gspca_dev;
7363
7364 *val = sd->brightness;
7365 return 0;
7366}
7367
7368static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val)
7369{
7370 struct sd *sd = (struct sd *) gspca_dev;
7371
7372 sd->contrast = val;
7373 if (gspca_dev->streaming)
7374 setcontrast(gspca_dev);
7375 return 0;
7376}
7377
7378static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val)
7379{
7380 struct sd *sd = (struct sd *) gspca_dev;
7381
7382 *val = sd->contrast;
7383 return 0;
7384}
7385
7386static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val)
7387{
7388 struct sd *sd = (struct sd *) gspca_dev;
7389
7390 sd->autogain = val;
7391 if (gspca_dev->streaming)
7392 setautogain(gspca_dev);
7393 return 0;
7394}
7395
7396static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val)
7397{
7398 struct sd *sd = (struct sd *) gspca_dev;
7399
7400 *val = sd->autogain;
7401 return 0;
7402}
7403
7404static int sd_getgamma(struct gspca_dev *gspca_dev, __s32 *val)
7405{
7406 struct sd *sd = (struct sd *) gspca_dev;
7407
7408 *val = sd->gamma;
7409 return 0;
7410}
7411
7412static struct sd_desc sd_desc = {
7413 .name = MODULE_NAME,
7414 .ctrls = sd_ctrls,
7415 .nctrls = sizeof sd_ctrls / sizeof sd_ctrls[0],
7416 .config = sd_config,
7417 .open = sd_open,
7418 .start = sd_start,
7419 .stopN = sd_stopN,
7420 .stop0 = sd_stop0,
7421 .close = sd_close,
7422 .pkt_scan = sd_pkt_scan,
7423};
7424
7425#define DVNM(name) .driver_info = (kernel_ulong_t) name
7426static __devinitdata struct usb_device_id device_table[] = {
7427 {USB_DEVICE(0x041e, 0x041e), DVNM("Creative WebCam Live!")},
7428 {USB_DEVICE(0x041e, 0x4017), DVNM("Creative Webcam Mobile PD1090")},
7429 {USB_DEVICE(0x041e, 0x401c), DVNM("Creative NX")},
7430 {USB_DEVICE(0x041e, 0x401e), DVNM("Creative Nx Pro")},
7431 {USB_DEVICE(0x041e, 0x401f), DVNM("Creative Webcam Notebook PD1171")},
7432/*0x041e, 0x4022*/
7433 {USB_DEVICE(0x041e, 0x4029), DVNM("Creative WebCam Vista Pro")},
7434 {USB_DEVICE(0x041e, 0x4034), DVNM("Creative Instant P0620")},
7435 {USB_DEVICE(0x041e, 0x4035), DVNM("Creative Instant P0620D")},
7436 {USB_DEVICE(0x041e, 0x4036), DVNM("Creative Live !")},
7437 {USB_DEVICE(0x041e, 0x403a), DVNM("Creative Nx Pro 2")},
7438 {USB_DEVICE(0x041e, 0x4051), DVNM("Creative Notebook Pro (VF0250)")},
7439 {USB_DEVICE(0x041e, 0x4053), DVNM("Creative Live!Cam Video IM")},
7440 {USB_DEVICE(0x0458, 0x7007), DVNM("Genius VideoCam V2")},
7441 {USB_DEVICE(0x0458, 0x700c), DVNM("Genius VideoCam V3")},
7442 {USB_DEVICE(0x0458, 0x700f), DVNM("Genius VideoCam Web V2")},
7443 {USB_DEVICE(0x0461, 0x0a00), DVNM("MicroInnovation WebCam320")},
7444 {USB_DEVICE(0x046d, 0x08a0), DVNM("Logitech QC IM")},
7445 {USB_DEVICE(0x046d, 0x08a1), DVNM("Logitech QC IM 0x08A1 +sound")},
7446 {USB_DEVICE(0x046d, 0x08a2), DVNM("Labtec Webcam Pro")},
7447 {USB_DEVICE(0x046d, 0x08a3), DVNM("Logitech QC Chat")},
7448 {USB_DEVICE(0x046d, 0x08a6), DVNM("Logitech QCim")},
7449 {USB_DEVICE(0x046d, 0x08a7), DVNM("Logitech QuickCam Image")},
7450 {USB_DEVICE(0x046d, 0x08a9), DVNM("Logitech Notebook Deluxe")},
7451 {USB_DEVICE(0x046d, 0x08aa), DVNM("Labtec Webcam Notebook")},
7452 {USB_DEVICE(0x046d, 0x08ac), DVNM("Logitech QuickCam Cool")},
7453 {USB_DEVICE(0x046d, 0x08ad), DVNM("Logitech QCCommunicate STX")},
7454 {USB_DEVICE(0x046d, 0x08ae), DVNM("Logitech QuickCam for Notebooks")},
7455 {USB_DEVICE(0x046d, 0x08af), DVNM("Logitech QuickCam Cool")},
7456 {USB_DEVICE(0x046d, 0x08b9), DVNM("Logitech QC IM ???")},
7457 {USB_DEVICE(0x046d, 0x08d7), DVNM("Logitech QCam STX")},
7458 {USB_DEVICE(0x046d, 0x08d9), DVNM("Logitech QuickCam IM/Connect")},
7459 {USB_DEVICE(0x046d, 0x08d8), DVNM("Logitech Notebook Deluxe")},
7460 {USB_DEVICE(0x046d, 0x08da), DVNM("Logitech QuickCam Messenger")},
7461 {USB_DEVICE(0x046d, 0x08dd), DVNM("Logitech QuickCam for Notebooks")},
7462 {USB_DEVICE(0x0471, 0x0325), DVNM("Philips SPC 200 NC")},
7463 {USB_DEVICE(0x0471, 0x0326), DVNM("Philips SPC 300 NC")},
7464 {USB_DEVICE(0x0471, 0x032d), DVNM("Philips spc210nc")},
7465 {USB_DEVICE(0x0471, 0x032e), DVNM("Philips spc315nc")},
7466 {USB_DEVICE(0x055f, 0xc005), DVNM("Mustek Wcam300A")},
7467 {USB_DEVICE(0x055f, 0xd003), DVNM("Mustek WCam300A")},
7468 {USB_DEVICE(0x055f, 0xd004), DVNM("Mustek WCam300 AN")},
7469 {USB_DEVICE(0x0698, 0x2003), DVNM("CTX M730V built in")},
7470/*0x0ac8, 0x0301*/
7471 {USB_DEVICE(0x0ac8, 0x0302), DVNM("Z-star Vimicro zc0302")},
7472 {USB_DEVICE(0x0ac8, 0x301b), DVNM("Z-Star zc301b")},
7473 {USB_DEVICE(0x0ac8, 0x303b), DVNM("Vimicro 0x303b")},
7474 {USB_DEVICE(0x0ac8, 0x305b), DVNM("Z-star Vimicro zc0305b")},
7475 {USB_DEVICE(0x0ac8, 0x307b), DVNM("Z-Star 307b")},
7476 {USB_DEVICE(0x10fd, 0x0128), DVNM("Typhoon Webshot II 300k 0x0128")},
7477/*0x10fd, 0x804e*/
7478 {USB_DEVICE(0x10fd, 0x8050), DVNM("Typhoon Webshot II USB 300k")},
7479 {} /* end of entry */
7480};
7481#undef DVNAME
7482MODULE_DEVICE_TABLE(usb, device_table);
7483
7484/* -- device connect -- */
7485static int sd_probe(struct usb_interface *intf,
7486 const struct usb_device_id *id)
7487{
7488 return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd),
7489 THIS_MODULE);
7490}
7491
7492/* USB driver */
7493static struct usb_driver sd_driver = {
7494 .name = MODULE_NAME,
7495 .id_table = device_table,
7496 .probe = sd_probe,
7497 .disconnect = gspca_disconnect,
7498};
7499
7500static int __init sd_mod_init(void)
7501{
7502 if (usb_register(&sd_driver) < 0)
7503 return -1;
7504 PDEBUG(D_PROBE, "v%s registered", version);
7505 return 0;
7506}
7507
7508static void __exit sd_mod_exit(void)
7509{
7510 usb_deregister(&sd_driver);
7511 PDEBUG(D_PROBE, "deregistered");
7512}
7513
7514module_init(sd_mod_init);
7515module_exit(sd_mod_exit);
7516
7517module_param(lightfreq, int, 0644);
7518MODULE_PARM_DESC(lightfreq,
7519 "Light frequency banding filter: 50, 60 Hz or"
7520 " 0 to NoFliker (default=50)");
7521module_param(force_sensor, int, 0644);
7522MODULE_PARM_DESC(force_sensor,
7523 "Force sensor. Only for experts!!!");