diff options
author | Jean-Francois Moine <moinejf@free.fr> | 2008-06-12 10:58:58 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-07-20 07:14:45 -0300 |
commit | d43fa32fec442571f10f5d0c3b553413288728de (patch) | |
tree | 6bbf2a57d5b9a94bca4246518094f32758eecb1e /drivers/media | |
parent | 4aa0d037a6c8e6b37ecfd986a444f83190c32a21 (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>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/gspca/Makefile | 4 | ||||
-rw-r--r-- | drivers/media/video/gspca/gspca.c | 991 | ||||
-rw-r--r-- | drivers/media/video/gspca/gspca.h | 18 | ||||
-rw-r--r-- | drivers/media/video/gspca/jpeg.h | 2 | ||||
-rw-r--r-- | drivers/media/video/gspca/pac207.c | 31 | ||||
-rw-r--r-- | drivers/media/video/gspca/stk014.c | 55 | ||||
-rw-r--r-- | drivers/media/video/gspca/zc3xx.c | 7523 |
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 @@ -obj-$(CONFIG_GSPCA) += gspca_main.o gspca_pac207.o gspca_stk014.o +obj-$(CONFIG_GSPCA) += gspca_main.o \ + gspca_pac207.o gspca_stk014.o gspca_zc3xx.o gspca_main-objs := gspca.o gspca_pac207-objs := pac207.o gspca_stk014-objs := stk014.o +gspca_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 @@ #include "gspca.h" +/* option */ +#define GSPCA_HLP 0 + +/* global values */ +#define DEF_NURBS 2 /* default number of URBs (mmap) */ + MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>"); MODULE_DESCRIPTION("GSPCA USB Camera Driver"); MODULE_LICENSE("GPL"); -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(0, 1, 1) -static const char version[] = "0.1.1"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(0, 2, 15) +static const char version[] = "0.2.15"; static int video_nr = -1; @@ -71,6 +77,229 @@ static void PDEBUG_MODE(char *txt, __u32 pixfmt, int w, int h) #define PDEBUG_MODE(txt, pixfmt, w, h) #endif +/* specific memory types - !! should different from V4L2_MEMORY_xxx */ +#define GSPCA_MEMORY_NO 0 /* V4L2_MEMORY_xxx starts from 1 */ +#define GSPCA_MEMORY_READ 7 + +#ifndef GSPCA_HLP +#define BUF_ALL_FLAGS (V4L2_BUF_FLAG_QUEUED | V4L2_BUF_FLAG_DONE) +#else +#define GSPCA_BUF_FLAG_DECODE 0x1000 /* internal buffer flag */ +#define BUF_ALL_FLAGS (V4L2_BUF_FLAG_QUEUED | V4L2_BUF_FLAG_DONE \ + | GSPCA_BUF_FLAG_DECODE) + +static int autostart = 4; +module_param(autostart, int, 0644); +MODULE_PARM_DESC(autostart, + "Automatically start the helper process"); + +/* try to start the helper process */ +static void start_hlp(void) +{ + int ret; + static char *argv[] = {"gspca_hlp", NULL}; + static char *env[] = {NULL}; + + if (autostart <= 0) { + if (autostart < 0) + PDEBUG(D_ERR|D_PROBE, "Too many helper restart"); + return; + } + autostart--; + if (autostart == 0) + autostart = -1; + ret = call_usermodehelper("/sbin/gspca_hlp", argv, env, + UMH_WAIT_EXEC); + if (ret != 0) + PDEBUG(D_ERR|D_PROBE, + "/sbin/gspca_hlp start failed %d", ret); +} + +/* /dev/gspca_hlp stuff */ +#include <linux/miscdevice.h> +#include "gspca_hlp.h" + +/* !! possible decodings defined in decoder.c */ +static __u32 bayer_to_tb[] = { + V4L2_PIX_FMT_SBGGR8, + V4L2_PIX_FMT_YUYV, + V4L2_PIX_FMT_YUV420, + V4L2_PIX_FMT_RGB24, + V4L2_PIX_FMT_BGR24, + V4L2_PIX_FMT_RGB565, +}; +static __u32 jpeg_to_tb[] = { + V4L2_PIX_FMT_JPEG, + V4L2_PIX_FMT_YUYV, + V4L2_PIX_FMT_YUV420, + V4L2_PIX_FMT_RGB24, + V4L2_PIX_FMT_BGR24, + V4L2_PIX_FMT_RGB565, +}; + +/* /dev/gspca_hlp device */ +struct hlp_dev { + struct gspca_dev *gspca_dev; /* associated device */ + struct gspca_frame *frame; /* frame being decoded */ + __u32 pixfmt; /* webcam pixel format */ + atomic_t nevent; /* nb of frames ready to decode */ + wait_queue_head_t wq; /* wait queue */ + char fr_d; /* next frame to decode */ +} *hlp; + +static int hlp_open(struct inode *inode, struct file *file) +{ + struct hlp_dev *hlp_dev; + + PDEBUG(D_CONF, "hlp open"); + if (hlp != 0) + return -EBUSY; + hlp_dev = kzalloc(sizeof *hlp_dev, GFP_KERNEL); + if (hlp_dev == NULL) { + err("couldn't kzalloc hlp struct"); + return -EIO; + } + init_waitqueue_head(&hlp_dev->wq); + file->private_data = hlp_dev; + hlp = hlp_dev; + return 0; +} + +static int hlp_close(struct inode *inode, struct file *file) +{ + struct gspca_dev *gspca_dev; + int mode; + + PDEBUG(D_CONF, "hlp close"); + file->private_data = NULL; + + /* stop decoding */ + gspca_dev = hlp->gspca_dev; + if (gspca_dev != 0) { + mode = gspca_dev->curr_mode; + gspca_dev->pixfmt = gspca_dev->cam.cam_mode[mode].pixfmt; + } + + /* destroy the helper structure */ + kfree(hlp); + hlp = 0; + + /* try to restart the helper process */ + start_hlp(); + return 0; +} + +static ssize_t hlp_read(struct file *file, char __user *buf, + size_t cnt, loff_t *ppos) +{ + struct hlp_dev *hlp_dev = file->private_data; + struct gspca_dev *gspca_dev; + struct gspca_frame *frame; + struct gspca_hlp_read_hd head; + int i, j, len, ret; + + PDEBUG(D_FRAM, "hlp read (%d)", cnt); + + /* check / wait till a frame is ready */ + for (;;) { + gspca_dev = hlp_dev->gspca_dev; + if (gspca_dev != 0 && gspca_dev->streaming) { + i = hlp_dev->fr_d; /* frame to decode */ + j = gspca_dev->fr_queue[i]; + frame = &gspca_dev->frame[j]; + if (frame->v4l2_buf.flags & GSPCA_BUF_FLAG_DECODE) + break; + } + ret = wait_event_interruptible(hlp_dev->wq, + atomic_read(&hlp_dev->nevent) > 0); + if (ret < 0) { /* helper process is killed */ + autostart = 0; /* don't restart it */ + return ret; + } + } + atomic_dec(&hlp_dev->nevent); + hlp_dev->fr_d = (i + 1) % gspca_dev->nframes; + PDEBUG(D_FRAM, "hlp read q:%d i:%d d:%d o:%d", + gspca_dev->fr_q, + gspca_dev->fr_i, + hlp_dev->fr_d, + gspca_dev->fr_o); + + hlp_dev->frame = frame; /* memorize the current frame */ + len = frame->v4l2_buf.bytesused; + if (cnt < sizeof head - sizeof head.data + len) +/*fixme: special errno?*/ + return -EINVAL; + head.pixfmt_out = gspca_dev->pixfmt; + head.pixfmt_in = hlp_dev->pixfmt; + head.width = gspca_dev->width; + head.height = gspca_dev->height; + copy_to_user(buf, &head, sizeof head); + copy_to_user(buf + sizeof head - sizeof head.data, + frame->data, len); + return sizeof head - sizeof head.data + len; +} + +static ssize_t hlp_write(struct file *file, + const char __user *buf, + size_t cnt, loff_t *ppos) +{ + struct hlp_dev *hlp_dev = file->private_data; + struct gspca_dev *gspca_dev; + struct gspca_frame *frame; + + PDEBUG(D_FRAM, "hlp write (%d)", cnt); + gspca_dev = hlp_dev->gspca_dev; + if (gspca_dev == 0) + return cnt; + if (mutex_lock_interruptible(&gspca_dev->queue_lock)) + return -ERESTARTSYS; + if (!gspca_dev->streaming) + goto out; + frame = hlp_dev->frame; + hlp_dev->frame = 0; + if (frame == 0) + goto out; + if (cnt > frame->v4l2_buf.length) { + PDEBUG(D_ERR|D_FRAM, "bad frame size %d - %d", + cnt, frame->v4l2_buf.length); + cnt = -EINVAL; + goto out; + } + copy_from_user(frame->data, buf, cnt); + frame->v4l2_buf.bytesused = cnt; + frame->v4l2_buf.flags &= ~(V4L2_BUF_FLAG_QUEUED + | GSPCA_BUF_FLAG_DECODE); + frame->v4l2_buf.flags |= V4L2_BUF_FLAG_DONE; + mutex_unlock(&gspca_dev->queue_lock); + atomic_inc(&gspca_dev->nevent); + wake_up_interruptible(&gspca_dev->wq); /* event = new frame */ + PDEBUG(D_FRAM, "hlp write q:%d i:%d d:%d o:%d", + gspca_dev->fr_q, + gspca_dev->fr_i, + hlp_dev->fr_d, + gspca_dev->fr_o); + return cnt; +out: + mutex_unlock(&gspca_dev->queue_lock); + return cnt; +} + +static struct file_operations hlp_fops = { + .owner = THIS_MODULE, + .open = hlp_open, + .release = hlp_close, + .read = hlp_read, + .write = hlp_write, + .llseek = no_llseek +}; +static struct miscdevice hlp_device = { + .minor = MISC_DYNAMIC_MINOR, + .name = "gspca_hlp", + .fops = &hlp_fops, +}; +#endif + /* * VMA operations. */ @@ -96,22 +325,16 @@ static struct vm_operations_struct gspca_vm_ops = { }; /* - * ISOC message interrupt from the USB device - * - * Analyse each packet and call the subdriver for doing the copy - * to the frame buffer. + * fill a video frame from an URB and resubmit */ -static void isoc_irq(struct urb *urb) +static void fill_frame(struct gspca_dev *gspca_dev, + struct urb *urb) { - struct gspca_dev *gspca_dev = (struct gspca_dev *) urb->context; struct gspca_frame *frame; unsigned char *data; /* address of data in the iso message */ int i, j, len, st; cam_pkt_op pkt_scan; - PDEBUG(D_PACK, "isoc irq"); - if (!gspca_dev->streaming) - return; pkt_scan = gspca_dev->sd_desc->pkt_scan; for (i = 0; i < urb->number_of_packets; i++) { @@ -119,8 +342,7 @@ static void isoc_irq(struct urb *urb) j = gspca_dev->fr_i; j = gspca_dev->fr_queue[j]; frame = &gspca_dev->frame[j]; - if ((frame->v4l2_buf.flags - & (V4L2_BUF_FLAG_QUEUED | V4L2_BUF_FLAG_DONE)) + if ((frame->v4l2_buf.flags & BUF_ALL_FLAGS) != V4L2_BUF_FLAG_QUEUED) { gspca_dev->last_packet_type = DISCARD_PACKET; break; @@ -147,6 +369,7 @@ static void isoc_irq(struct urb *urb) } /* resubmit the URB */ +/*fixme: don't do that when userptr and too many URBs sent*/ urb->status = 0; st = usb_submit_urb(urb, GFP_ATOMIC); if (st < 0) @@ -154,9 +377,78 @@ static void isoc_irq(struct urb *urb) } /* + * ISOC message interrupt from the USB device + * + * Analyse each packet and call the subdriver for copy + * to the frame buffer. + * + * There are 2 functions: + * - the first one (isoc_irq_mmap) is used when the application + * buffers are mapped. The frame detection and copy is done + * at interrupt level. + * - the second one (isoc_irq_user) is used when the application + * buffers are in user space (userptr). The frame detection + * and copy is done by the application. + */ +static void isoc_irq_mmap(struct urb *urb) +{ + struct gspca_dev *gspca_dev = (struct gspca_dev *) urb->context; + + PDEBUG(D_PACK, "isoc irq mmap"); + if (!gspca_dev->streaming) + return; + fill_frame(gspca_dev, urb); +} + +static void isoc_irq_user(struct urb *urb) +{ + struct gspca_dev *gspca_dev = (struct gspca_dev *) urb->context; + int i; + + PDEBUG(D_PACK, "isoc irq user"); + if (!gspca_dev->streaming) + return; + + i = gspca_dev->urb_in % gspca_dev->nurbs; + if (urb != gspca_dev->urb[i]) { + PDEBUG(D_ERR|D_PACK, "urb out of sequence"); + return; /* should never occur */ + } + + gspca_dev->urb_in++; + atomic_inc(&gspca_dev->nevent); /* new event */ + wake_up_interruptible(&gspca_dev->wq); +/*fixme: submit a new URBs until urb_in == urb_out (% nurbs)*/ +} + +/* + * treat the isoc messages + * + * This routine is called by the application (case userptr). + */ +static void isoc_transfer(struct gspca_dev *gspca_dev) +{ + struct urb *urb; + int i; + + for (;;) { + i = gspca_dev->urb_out; + PDEBUG(D_PACK, "isoc transf i:%d o:%d", gspca_dev->urb_in, i); + if (i == gspca_dev->urb_in) /* isoc message to read */ + break; /* no (more) message */ + atomic_dec(&gspca_dev->nevent); +/*PDEBUG(D_PACK, "isoc_trf nevent: %d", atomic_read(&gspca_dev->nevent));*/ + gspca_dev->urb_out = i + 1; /* message treated */ + urb = gspca_dev->urb[i % gspca_dev->nurbs]; + fill_frame(gspca_dev, urb); + } +} + +/* * add data to the current frame * - * This function is called by the subdrivers at interrupt level. + * This function is called by the subdrivers at interrupt level + * or user level. * To build a frame, these ones must add * - one FIRST_PACKET * - 0 or many INTER_PACKETs @@ -177,9 +469,8 @@ struct gspca_frame *gspca_frame_add(struct gspca_dev *gspca_dev, /* when start of a new frame, if the current frame buffer * is not queued, discard the whole frame */ if (packet_type == FIRST_PACKET) { - if ((frame->v4l2_buf.flags - & (V4L2_BUF_FLAG_QUEUED | V4L2_BUF_FLAG_DONE)) - != V4L2_BUF_FLAG_QUEUED) { + if ((frame->v4l2_buf.flags & BUF_ALL_FLAGS) + != V4L2_BUF_FLAG_QUEUED) { gspca_dev->last_packet_type = DISCARD_PACKET; return frame; } @@ -187,10 +478,11 @@ struct gspca_frame *gspca_frame_add(struct gspca_dev *gspca_dev, jiffies_to_timeval(get_jiffies_64(), &frame->v4l2_buf.timestamp); frame->v4l2_buf.sequence = ++gspca_dev->sequence; - } else if (gspca_dev->last_packet_type == DISCARD_PACKET) + } else if (gspca_dev->last_packet_type == DISCARD_PACKET) { return frame; + } - /* append the packet in the frame buffer */ + /* append the packet to the frame buffer */ if (len > 0) { if (frame->data_end - frame->data + len > frame->v4l2_buf.length) { @@ -211,12 +503,25 @@ struct gspca_frame *gspca_frame_add(struct gspca_dev *gspca_dev, /* if last packet, wake the application and advance in the queue */ if (packet_type == LAST_PACKET) { frame->v4l2_buf.bytesused = frame->data_end - frame->data; +#ifndef GSPCA_HLP frame->v4l2_buf.flags &= ~V4L2_BUF_FLAG_QUEUED; frame->v4l2_buf.flags |= V4L2_BUF_FLAG_DONE; atomic_inc(&gspca_dev->nevent); wake_up_interruptible(&gspca_dev->wq); /* event = new frame */ - i = gspca_dev->fr_i; - i = (i + 1) % gspca_dev->nframes; +#else /*GSPCA_HLP*/ + if (hlp != 0 && hlp->gspca_dev == gspca_dev) { + frame->v4l2_buf.flags |= GSPCA_BUF_FLAG_DECODE; + atomic_inc(&hlp->nevent); + wake_up_interruptible(&hlp->wq); + } else { + frame->v4l2_buf.flags &= ~V4L2_BUF_FLAG_QUEUED; + frame->v4l2_buf.flags |= V4L2_BUF_FLAG_DONE; + atomic_inc(&gspca_dev->nevent); + wake_up_interruptible(&gspca_dev->wq); /* new frame */ + } +#endif /*GSPCA_HLP*/ + i = (gspca_dev->fr_i + 1) % gspca_dev->nframes; + gspca_dev->fr_i = i; PDEBUG(D_FRAM, "frame complete len:%d q:%d i:%d o:%d", frame->v4l2_buf.bytesused, gspca_dev->fr_q, @@ -224,7 +529,6 @@ struct gspca_frame *gspca_frame_add(struct gspca_dev *gspca_dev, gspca_dev->fr_o); j = gspca_dev->fr_queue[i]; frame = &gspca_dev->frame[j]; - gspca_dev->fr_i = i; } return frame; } @@ -245,7 +549,7 @@ static void *rvmalloc(unsigned long size) void *mem; unsigned long adr; - size = PAGE_ALIGN(size); +/* size = PAGE_ALIGN(size); (already done) */ mem = vmalloc_32(size); if (mem != 0) { memset(mem, 0, size); @@ -274,27 +578,65 @@ static void rvfree(void *mem, unsigned long size) vfree(mem); } +static __u32 get_v4l2_depth(__u32 pixfmt) +{ + switch (pixfmt) { + case V4L2_PIX_FMT_BGR32: + case V4L2_PIX_FMT_RGB32: + return 32; + case V4L2_PIX_FMT_RGB24: /* 'RGB3' */ + case V4L2_PIX_FMT_BGR24: + return 24; + case V4L2_PIX_FMT_RGB565: /* 'RGBP' */ + case V4L2_PIX_FMT_YUYV: /* 'YUYV' packed 4.2.2 */ + case V4L2_PIX_FMT_YYUV: /* 'YYUV' */ + return 16; + case V4L2_PIX_FMT_YUV420: /* 'YU12' planar 4.2.0 */ + return 12; + case V4L2_PIX_FMT_MJPEG: + case V4L2_PIX_FMT_JPEG: + case V4L2_PIX_FMT_SBGGR8: /* 'BA81' Bayer */ + return 8; + } + PDEBUG(D_ERR|D_CONF, "Unknown pixel format %c%c%c%c", + pixfmt & 0xff, + (pixfmt >> 8) & 0xff, + (pixfmt >> 16) & 0xff, + pixfmt >> 24); + return -EINVAL; +} + +static int gspca_get_buff_size(struct gspca_dev *gspca_dev) +{ + unsigned int size; + + size = gspca_dev->width * gspca_dev->height + * get_v4l2_depth(gspca_dev->pixfmt) / 8; + if (!size) + return -ENOMEM; + return size; +} + static int frame_alloc(struct gspca_dev *gspca_dev, - unsigned int count, - unsigned int frsz, - enum v4l2_memory memory) + unsigned int count) { - int i, ret = 0; + struct gspca_frame *frame; + unsigned int frsz; + int i; + frsz = gspca_get_buff_size(gspca_dev); + if (frsz < 0) + return frsz; PDEBUG(D_STREAM, "frame alloc frsz: %d", frsz); - if (gspca_dev->nframes != 0) { - PDEBUG(D_ERR|D_STREAM, "alloc frame already done"); - return -EBUSY; - } if (count > GSPCA_MAX_FRAMES) count = GSPCA_MAX_FRAMES; - /* if compressed, reduce the buffer size */ + /* if compressed (JPEG), reduce the buffer size */ if (gspca_is_compressed(gspca_dev->pixfmt)) - frsz = (frsz * comp_fac) / 100; + frsz = (frsz * comp_fac) / 100 + 600; /* plus JPEG header */ frsz = PAGE_ALIGN(frsz); PDEBUG(D_STREAM, "new fr_sz: %d", frsz); gspca_dev->frsz = frsz; - if (memory == V4L2_MEMORY_MMAP) { + if (gspca_dev->memory == V4L2_MEMORY_MMAP) { gspca_dev->frbuf = rvmalloc(frsz * count); if (!gspca_dev->frbuf) { err("frame alloc failed"); @@ -303,25 +645,36 @@ static int frame_alloc(struct gspca_dev *gspca_dev, } gspca_dev->nframes = count; for (i = 0; i < count; i++) { - gspca_dev->frame[i].v4l2_buf.index = i; - gspca_dev->frame[i].v4l2_buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - gspca_dev->frame[i].v4l2_buf.flags = 0; - gspca_dev->frame[i].v4l2_buf.field = V4L2_FIELD_NONE; - gspca_dev->frame[i].v4l2_buf.length = frsz; - gspca_dev->frame[i].v4l2_buf.memory = memory; - if (memory == V4L2_MEMORY_MMAP) { - gspca_dev->frame[i].data - = gspca_dev->frame[i].data_end - = gspca_dev->frbuf + i * frsz; - gspca_dev->frame[i].v4l2_buf.m.offset = i * frsz; + frame = &gspca_dev->frame[i]; + frame->v4l2_buf.index = i; + frame->v4l2_buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + frame->v4l2_buf.flags = 0; + frame->v4l2_buf.field = V4L2_FIELD_NONE; + frame->v4l2_buf.length = frsz; + frame->v4l2_buf.memory = gspca_dev->memory; + frame->v4l2_buf.sequence = 0; + if (gspca_dev->memory == V4L2_MEMORY_MMAP) { + frame->data = frame->data_end = + gspca_dev->frbuf + i * frsz; + frame->v4l2_buf.m.offset = i * frsz; } - gspca_dev->frame[i].v4l2_buf.flags = 0; /* buf in app space */ } gspca_dev->fr_i = gspca_dev->fr_o = gspca_dev->fr_q = 0; +#ifdef GSPCA_HLP + { + struct hlp_dev *hlp_dev; + + hlp_dev = hlp; + if (hlp != 0 && hlp_dev->gspca_dev == gspca_dev) { + hlp_dev->fr_d = 0; + atomic_set(&hlp_dev->nevent, 0); + } + } +#endif /*GSPCA_HLP*/ gspca_dev->last_packet_type = DISCARD_PACKET; gspca_dev->sequence = 0; atomic_set(&gspca_dev->nevent, 0); - return ret; + return 0; } static void frame_free(struct gspca_dev *gspca_dev) @@ -339,16 +692,16 @@ static void frame_free(struct gspca_dev *gspca_dev) gspca_dev->nframes = 0; } -static int gspca_kill_transfer(struct gspca_dev *gspca_dev) +static void destroy_urbs(struct gspca_dev *gspca_dev) { struct urb *urb; unsigned int i; PDEBUG(D_STREAM, "kill transfer"); - for (i = 0; i < NURBS; ++i) { + for (i = 0; i < MAX_NURBS; ++i) { urb = gspca_dev->urb[i]; if (urb == NULL) - continue; + break; gspca_dev->urb[i] = NULL; usb_kill_urb(urb); @@ -359,7 +712,6 @@ static int gspca_kill_transfer(struct gspca_dev *gspca_dev) urb->transfer_dma); usb_free_urb(urb); } - return 0; } /* @@ -417,7 +769,7 @@ struct usb_host_endpoint *get_isoc_ep(struct gspca_dev *gspca_dev) err("set interface err %d", ret); return NULL; } - gspca_dev->alt = i; + gspca_dev->alt = i; /* memorize the current alt setting */ return ep; } @@ -428,28 +780,28 @@ static int create_urbs(struct gspca_dev *gspca_dev, struct usb_host_endpoint *ep) { struct urb *urb; - int n, i, psize, npkt, bsize; + int n, nurbs, i, psize, npkt, bsize; + usb_complete_t usb_complete; /* calculate the packet size and the number of packets */ - /* the URB buffer size must be a power of 2 */ psize = le16_to_cpu(ep->desc.wMaxPacketSize); + /* See paragraph 5.9 / table 5-11 of the usb 2.0 spec. */ psize = (psize & 0x07ff) * (1 + ((psize >> 11) & 3)); npkt = ISO_MAX_SIZE / psize; if (npkt > ISO_MAX_PKT) npkt = ISO_MAX_PKT; bsize = psize * npkt; - for (n = ISO_MAX_SIZE; n > 0; n >>= 1) { - if (n & bsize) /* !! assume ISO_MAX_SIZE is a power of 2 */ - break; - } - if (n != 0) { - npkt = n / psize; - bsize = psize * npkt; - } PDEBUG(D_STREAM, "isoc %d pkts size %d (bsize:%d)", npkt, psize, bsize); - for (n = 0; n < NURBS; n++) { +/*fixme:change for userptr*/ +/*fixme:don't submit all URBs when userptr*/ + gspca_dev->nurbs = nurbs = DEF_NURBS; + if (gspca_dev->memory == V4L2_MEMORY_MMAP) + usb_complete = isoc_irq_mmap; + else + usb_complete = isoc_irq_user; + for (n = 0; n < nurbs; n++) { urb = usb_alloc_urb(npkt, GFP_KERNEL); if (!urb) { err("usb_alloc_urb failed"); @@ -462,7 +814,7 @@ static int create_urbs(struct gspca_dev *gspca_dev, if (urb->transfer_buffer == NULL) { usb_free_urb(urb); - gspca_kill_transfer(gspca_dev); + destroy_urbs(gspca_dev); err("usb_buffer_urb failed"); return -ENOMEM; } @@ -474,7 +826,7 @@ static int create_urbs(struct gspca_dev *gspca_dev, urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP; urb->interval = ep->desc.bInterval; - urb->complete = isoc_irq; + urb->complete = usb_complete; urb->number_of_packets = npkt; urb->transfer_buffer_length = bsize; for (i = 0; i < npkt; i++) { @@ -482,6 +834,7 @@ static int create_urbs(struct gspca_dev *gspca_dev, urb->iso_frame_desc[i].offset = psize * i; } } + gspca_dev->urb_in = gspca_dev->urb_out = 0; return 0; } @@ -490,18 +843,17 @@ static int create_urbs(struct gspca_dev *gspca_dev, */ static int gspca_init_transfer(struct gspca_dev *gspca_dev) { - struct usb_interface *intf; struct usb_host_endpoint *ep; int n, ret; if (mutex_lock_interruptible(&gspca_dev->usb_lock)) return -ERESTARTSYS; - /* set the max alternate setting and loop until urb submit succeeds */ - intf = usb_ifnum_to_if(gspca_dev->dev, gspca_dev->iface); - gspca_dev->alt = intf->num_altsetting; + /* set the higher alternate setting and + * loop until urb submit succeeds */ + gspca_dev->alt = gspca_dev->nbalt; for (;;) { - PDEBUG(D_STREAM, "init transfer nbalt %d", gspca_dev->alt); + PDEBUG(D_STREAM, "init transfer alt %d", gspca_dev->alt); ep = get_isoc_ep(gspca_dev); if (ep == NULL) { ret = -EIO; @@ -517,13 +869,13 @@ static int gspca_init_transfer(struct gspca_dev *gspca_dev) atomic_set(&gspca_dev->nevent, 0); /* submit the URBs */ - for (n = 0; n < NURBS; n++) { + for (n = 0; n < gspca_dev->nurbs; n++) { ret = usb_submit_urb(gspca_dev->urb[n], GFP_KERNEL); if (ret < 0) { PDEBUG(D_ERR|D_STREAM, "usb_submit_urb [%d] err %d", n, ret); gspca_dev->streaming = 0; - gspca_kill_transfer(gspca_dev); + destroy_urbs(gspca_dev); if (ret == -ENOSPC) break; /* try the previous alt */ goto out; @@ -551,21 +903,32 @@ static int gspca_set_alt0(struct gspca_dev *gspca_dev) static void gspca_stream_off(struct gspca_dev *gspca_dev) { gspca_dev->streaming = 0; + atomic_set(&gspca_dev->nevent, 0); +#ifdef GSPCA_HLP + { + struct hlp_dev *hlp_dev; + + hlp_dev = hlp; + if (hlp_dev != 0 + && hlp_dev->gspca_dev == gspca_dev) + atomic_set(&hlp_dev->nevent, 0); + } +#endif if (gspca_dev->present) { gspca_dev->sd_desc->stopN(gspca_dev); - gspca_kill_transfer(gspca_dev); + destroy_urbs(gspca_dev); gspca_set_alt0(gspca_dev); gspca_dev->sd_desc->stop0(gspca_dev); PDEBUG(D_STREAM, "stream off OK"); } else { - gspca_kill_transfer(gspca_dev); + destroy_urbs(gspca_dev); atomic_inc(&gspca_dev->nevent); wake_up_interruptible(&gspca_dev->wq); PDEBUG(D_ERR|D_STREAM, "stream off no device ??"); } } -static int gspca_set_default_mode(struct gspca_dev *gspca_dev) +static void gspca_set_default_mode(struct gspca_dev *gspca_dev) { int i; @@ -574,7 +937,6 @@ static int gspca_set_default_mode(struct gspca_dev *gspca_dev) gspca_dev->width = gspca_dev->cam.cam_mode[i].width; gspca_dev->height = gspca_dev->cam.cam_mode[i].height; gspca_dev->pixfmt = gspca_dev->cam.cam_mode[i].pixfmt; - return 0; } static int wxh_to_mode(struct gspca_dev *gspca_dev, @@ -582,46 +944,14 @@ static int wxh_to_mode(struct gspca_dev *gspca_dev, { int i; - for (i = gspca_dev->cam.nmodes - 1; --i >= 0; ) { - if (width > gspca_dev->cam.cam_mode[i].width) + for (i = gspca_dev->cam.nmodes; --i > 0; ) { + if (width >= gspca_dev->cam.cam_mode[i].width + && height >= gspca_dev->cam.cam_mode[i].height) break; } - i++; - while (i < gspca_dev->cam.nmodes - 1 - && width == gspca_dev->cam.cam_mode[i + 1].width - && height < gspca_dev->cam.cam_mode[i + 1].height) - i++; return i; } -static __u32 get_v4l2_depth(__u32 pixfmt) -{ - switch (pixfmt) { - case V4L2_PIX_FMT_BGR32: - case V4L2_PIX_FMT_RGB32: - return 32; - case V4L2_PIX_FMT_RGB24: - case V4L2_PIX_FMT_BGR24: - return 24; - case V4L2_PIX_FMT_RGB565: - case V4L2_PIX_FMT_YUYV: /* packed 4.2.2 */ - case V4L2_PIX_FMT_YYUV: - return 16; - case V4L2_PIX_FMT_YUV420: /* planar 4.2.0 */ - return 12; - case V4L2_PIX_FMT_MJPEG: - case V4L2_PIX_FMT_JPEG: - case V4L2_PIX_FMT_SBGGR8: /* Bayer */ - return 8; - } - PDEBUG(D_ERR|D_CONF, "Unknown pixel format %c%c%c%c", - pixfmt & 0xff, - (pixfmt >> 8) & 0xff, - (pixfmt >> 16) & 0xff, - pixfmt >> 24); - return -EINVAL; -} - /* * search a mode with the right pixel format */ @@ -649,11 +979,15 @@ static int vidioc_enum_fmt_cap(struct file *file, void *priv, struct v4l2_fmtdesc *fmtdesc) { struct gspca_dev *gspca_dev = priv; - int i, j, index; + int i; +#ifndef GSPCA_HLP + int j, index; __u32 fmt_tb[8]; +#endif PDEBUG(D_CONF, "enum fmt cap"); +#ifndef GSPCA_HLP /* give an index to each format */ index = 0; j = 0; @@ -676,10 +1010,40 @@ static int vidioc_enum_fmt_cap(struct file *file, void *priv, if (i < 0) return -EINVAL; /* no more format */ - fmtdesc->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; fmtdesc->pixelformat = fmt_tb[index]; if (gspca_is_compressed(fmt_tb[index])) fmtdesc->flags = V4L2_FMT_FLAG_COMPRESSED; +#else /*GSPCA_HLP*/ + /* !! code tied to the decoding functions in decoder.c */ + i = gspca_dev->cam.nmodes - 1; + if (fmtdesc->index == 0) { /* (assume one format per subdriver) */ + fmtdesc->pixelformat = gspca_dev->cam.cam_mode[i].pixfmt; + if (gspca_is_compressed(fmtdesc->pixelformat)) + fmtdesc->flags = V4L2_FMT_FLAG_COMPRESSED; + } else { + if (hlp == 0 + || (hlp->gspca_dev != 0 + && hlp->gspca_dev != gspca_dev)) + return -EINVAL; + switch (gspca_dev->cam.cam_mode[i].pixfmt) { + case V4L2_PIX_FMT_JPEG: + if (fmtdesc->index >= sizeof jpeg_to_tb + / sizeof jpeg_to_tb[0]) + return -EINVAL; + fmtdesc->pixelformat = jpeg_to_tb[fmtdesc->index]; + break; + case V4L2_PIX_FMT_SBGGR8: + if (fmtdesc->index >= sizeof bayer_to_tb + / sizeof bayer_to_tb[0]) + return -EINVAL; + fmtdesc->pixelformat = bayer_to_tb[fmtdesc->index]; + break; + default: + return -EINVAL; + } + } +#endif /*GSPCA_HLP*/ + fmtdesc->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; fmtdesc->description[0] = fmtdesc->pixelformat & 0xff; fmtdesc->description[1] = (fmtdesc->pixelformat >> 8) & 0xff; fmtdesc->description[2] = (fmtdesc->pixelformat >> 16) & 0xff; @@ -688,22 +1052,26 @@ static int vidioc_enum_fmt_cap(struct file *file, void *priv, return 0; } -static int gspca_get_buff_size(struct gspca_dev *gspca_dev) -{ - unsigned int size; - - size = gspca_dev->width * gspca_dev->height - * get_v4l2_depth(gspca_dev->pixfmt) / 8; - if (!size) - return -ENOMEM; - return size; -} - static int vidioc_g_fmt_cap(struct file *file, void *priv, struct v4l2_format *fmt) { struct gspca_dev *gspca_dev = priv; +#ifdef GSPCA_HLP + int i; + + /* if the pixel format is not the one of the device and + * if the helper is inactive or busy, restore */ + i = gspca_dev->curr_mode; + if (gspca_dev->pixfmt != gspca_dev->cam.cam_mode[i].pixfmt) { + struct hlp_dev *hlp_dev; + + hlp_dev = hlp; + if (hlp_dev == 0 || hlp_dev->gspca_dev != gspca_dev) + gspca_dev->pixfmt = gspca_dev->cam.cam_mode[i].pixfmt; + } +#endif /*GSPCA_HLP*/ + fmt->fmt.pix.width = gspca_dev->width; fmt->fmt.pix.height = gspca_dev->height; fmt->fmt.pix.pixelformat = gspca_dev->pixfmt; @@ -733,6 +1101,10 @@ static int try_fmt_cap(struct gspca_dev *gspca_dev, w = fmt->fmt.pix.width; h = fmt->fmt.pix.height; + + /* (luvcview problem) */ + if (fmt->fmt.pix.pixelformat == V4L2_PIX_FMT_MJPEG) + fmt->fmt.pix.pixelformat = V4L2_PIX_FMT_JPEG; #ifdef GSPCA_DEBUG if (gspca_debug & D_CONF) 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, /* else, search the closest mode with the same pixel format */ mode2 = gspca_get_mode(gspca_dev, mode, fmt->fmt.pix.pixelformat); - if (mode2 >= 0) + if (mode2 >= 0) { mode = mode2; - else { + } else { + __u32 pixfmt; + + pixfmt = gspca_dev->cam.cam_mode[mode].pixfmt; +#ifndef GSPCA_HLP /* no chance, return this mode */ - fmt->fmt.pix.pixelformat - = gspca_dev->cam.cam_mode[mode].pixfmt; + fmt->fmt.pix.pixelformat = pixfmt; +#else /*GSPCA_HLP*/ + if (hlp != 0 + && (hlp->gspca_dev == 0 + || hlp->gspca_dev == gspca_dev) +/* decoding works for JPEG and Bayer only */ + && (pixfmt == V4L2_PIX_FMT_JPEG + || pixfmt == V4L2_PIX_FMT_SBGGR8)) { + switch (fmt->fmt.pix.pixelformat) { + case V4L2_PIX_FMT_YUYV: /* 'YUYV' */ + case V4L2_PIX_FMT_BGR24: /* 'BGR3' */ + case V4L2_PIX_FMT_RGB24: /* 'RGB3' */ + case V4L2_PIX_FMT_YUV420: /* 'YU12' */ + case V4L2_PIX_FMT_RGB565: /* 'RGBP' */ + break; + default: { + /* return any of the supported fmt's */ + __u8 u; + + u = get_jiffies_64(); + u %= sizeof bayer_to_tb + / sizeof bayer_to_tb[0] - 1; + fmt->fmt.pix.pixelformat = + bayer_to_tb[u + 1]; + break; + } + } + } else { + fmt->fmt.pix.pixelformat = pixfmt; + } +#endif /*GSPCA_HLP*/ #ifdef GSPCA_DEBUG if (gspca_debug & D_CONF) { PDEBUG_MODE("new format", @@ -791,7 +1196,7 @@ static int vidioc_s_fmt_cap(struct file *file, void *priv, struct v4l2_format *fmt) { struct gspca_dev *gspca_dev = priv; - int ret, was_streaming; + int ret; #ifdef GSPCA_DEBUG if (gspca_debug & D_CONF) { @@ -802,32 +1207,56 @@ static int vidioc_s_fmt_cap(struct file *file, void *priv, #endif if (mutex_lock_interruptible(&gspca_dev->queue_lock)) return -ERESTARTSYS; + ret = try_fmt_cap(gspca_dev, fmt); if (ret < 0) goto out; + if (gspca_dev->nframes != 0 + && fmt->fmt.pix.sizeimage > gspca_dev->frsz) { + ret = -EINVAL; + goto out; + } + +#ifndef GSPCA_HLP if (ret == gspca_dev->curr_mode) goto out; /* same mode */ - was_streaming = gspca_dev->streaming; - if (was_streaming) { - if (gspca_dev->capt_file != 0 - && gspca_dev->capt_file != file) { - ret = -EBUSY; - goto out; - } - if (mutex_lock_interruptible(&gspca_dev->usb_lock)) { - ret = -ERESTARTSYS; - goto out; - } - gspca_stream_off(gspca_dev); - mutex_unlock(&gspca_dev->usb_lock); +#else /*GSPCA_HLP*/ + if (ret == gspca_dev->curr_mode + && gspca_dev->pixfmt == fmt->fmt.pix.pixelformat) + goto out; /* same mode */ +#endif /*GSPCA_HLP*/ + + if (gspca_dev->streaming) { + ret = -EBUSY; + goto out; } gspca_dev->width = fmt->fmt.pix.width; gspca_dev->height = fmt->fmt.pix.height; gspca_dev->pixfmt = fmt->fmt.pix.pixelformat; gspca_dev->curr_mode = ret; - if (was_streaming) - ret = gspca_init_transfer(gspca_dev); + +#ifdef GSPCA_HLP + /* if frame decoding is required */ + if (gspca_dev->pixfmt != gspca_dev->cam.cam_mode[ret].pixfmt) { + struct hlp_dev *hlp_dev; + + hlp_dev = hlp; + if (hlp_dev == 0 + || (hlp_dev->gspca_dev != 0 + && hlp_dev->gspca_dev != gspca_dev)) { /* helper busy */ + fmt->fmt.pix.pixelformat = + gspca_dev->pixfmt = + gspca_dev->cam.cam_mode[ret].pixfmt; + } else { /* helper active */ + hlp_dev->gspca_dev = gspca_dev; + hlp_dev->pixfmt = gspca_dev->cam.cam_mode[ret].pixfmt; + hlp_dev->fr_d = gspca_dev->fr_i; + } + } else if (hlp != 0 && hlp->gspca_dev == gspca_dev) + hlp->gspca_dev = 0; +#endif /*GSPCA_HLP*/ + ret = 0; out: mutex_unlock(&gspca_dev->queue_lock); return ret; @@ -838,7 +1267,7 @@ static int dev_open(struct inode *inode, struct file *file) struct gspca_dev *gspca_dev; int ret; - PDEBUG(D_STREAM, "opening"); + PDEBUG(D_STREAM, "%s open", current->comm); gspca_dev = (struct gspca_dev *) video_devdata(file); if (mutex_lock_interruptible(&gspca_dev->queue_lock)) return -ERESTARTSYS; @@ -867,7 +1296,7 @@ static int dev_open(struct inode *inode, struct file *file) file->private_data = gspca_dev; #ifdef GSPCA_DEBUG /* activate the v4l2 debug */ - if (gspca_debug & D_CONF) + if (gspca_debug & D_V4L2) gspca_dev->vdev.debug |= 3; else gspca_dev->vdev.debug &= ~3; @@ -877,7 +1306,7 @@ out: if (ret != 0) PDEBUG(D_ERR|D_STREAM, "open failed err %d", ret); else - PDEBUG(D_STREAM, "open OK"); + PDEBUG(D_STREAM, "open done"); return ret; } @@ -885,7 +1314,7 @@ static int dev_close(struct inode *inode, struct file *file) { struct gspca_dev *gspca_dev = file->private_data; - PDEBUG(D_STREAM, "closing"); + PDEBUG(D_STREAM, "%s close", current->comm); if (mutex_lock_interruptible(&gspca_dev->queue_lock)) return -ERESTARTSYS; gspca_dev->users--; @@ -898,11 +1327,28 @@ static int dev_close(struct inode *inode, struct file *file) gspca_dev->sd_desc->close(gspca_dev); mutex_unlock(&gspca_dev->usb_lock); frame_free(gspca_dev); - file->private_data = NULL; gspca_dev->capt_file = 0; + gspca_dev->memory = GSPCA_MEMORY_NO; +#ifdef GSPCA_HLP + { + struct hlp_dev *hlp_dev; + int mode; + + hlp_dev = hlp; + if (hlp_dev != 0 + && hlp_dev->gspca_dev == gspca_dev) { + hlp_dev->gspca_dev = 0; + hlp_dev->frame = 0; + mode = gspca_dev->curr_mode; + gspca_dev->pixfmt = + gspca_dev->cam.cam_mode[mode].pixfmt; + } + } +#endif /*GSPCA_HLP*/ } + file->private_data = NULL; mutex_unlock(&gspca_dev->queue_lock); - PDEBUG(D_STREAM, "closed"); + PDEBUG(D_STREAM, "close done"); return 0; } @@ -1036,32 +1482,50 @@ static int vidioc_reqbufs(struct file *file, void *priv, struct v4l2_requestbuffers *rb) { struct gspca_dev *gspca_dev = priv; - int frsz, ret; + int i, ret = 0; PDEBUG(D_STREAM, "reqbufs %d", rb->count); if (rb->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; - if (rb->memory != V4L2_MEMORY_MMAP - && rb->memory != V4L2_MEMORY_USERPTR) + switch (rb->memory) { + case V4L2_MEMORY_MMAP: + break; + case V4L2_MEMORY_USERPTR: +#ifdef GSPCA_HLP + if (hlp == 0 || hlp->gspca_dev != gspca_dev) + break; +#endif return -EINVAL; - if (rb->count == 0) + default: return -EINVAL; - frsz = gspca_get_buff_size(gspca_dev); - if (frsz < 0) - return frsz; + } if (mutex_lock_interruptible(&gspca_dev->queue_lock)) return -ERESTARTSYS; - if (gspca_dev->capt_file != 0) { /* only one file may do capture */ + + for (i = 0; i < gspca_dev->nframes; i++) { + if (gspca_dev->frame[i].vma_use_count) { + ret = -EBUSY; + goto out; + } + } + + /* only one file may do capture */ + if ((gspca_dev->capt_file != 0 && gspca_dev->capt_file != file) + || gspca_dev->streaming) { ret = -EBUSY; goto out; } - ret = frame_alloc(gspca_dev, - rb->count, - (unsigned int) frsz, - rb->memory); - if (ret == 0) { - rb->count = gspca_dev->nframes; - gspca_dev->capt_file = file; + + if (rb->count == 0) { /* unrequest? */ + frame_free(gspca_dev); + gspca_dev->capt_file = 0; + } else { + gspca_dev->memory = rb->memory; + ret = frame_alloc(gspca_dev, rb->count); + if (ret == 0) { + rb->count = gspca_dev->nframes; + gspca_dev->capt_file = file; + } } out: mutex_unlock(&gspca_dev->queue_lock); @@ -1224,12 +1688,25 @@ static int vidiocgmbuf(struct file *file, void *priv, if (gspca_dev->nframes == 0) { struct v4l2_requestbuffers rb; int ret; - + __u32 pixfmt; + short width, height; + + /* as the final format is not yet defined, allocate + buffers with the max size */ + pixfmt = gspca_dev->pixfmt; + width = gspca_dev->width; + height = gspca_dev->height; + gspca_dev->pixfmt = V4L2_PIX_FMT_BGR32; + gspca_dev->width = 640; + gspca_dev->height = 480; memset(&rb, 0, sizeof rb); rb.count = 4; rb.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; rb.memory = V4L2_MEMORY_MMAP; ret = vidioc_reqbufs(file, priv, &rb); + gspca_dev->pixfmt = pixfmt; + gspca_dev->width = width; + gspca_dev->height = height; if (ret != 0) return ret; } @@ -1328,43 +1805,22 @@ out: return ret; } -static unsigned int dev_poll(struct file *file, poll_table * wait) -{ - struct gspca_dev *gspca_dev = file->private_data; - int i, ret; - - PDEBUG(D_FRAM, "poll"); - - poll_wait(file, &gspca_dev->wq, wait); - - if (mutex_lock_interruptible(&gspca_dev->queue_lock) != 0) - return POLLERR; - if (gspca_dev->dev == 0 - || !gspca_dev->streaming) /* if not streaming */ - ret = POLLERR; - else { - i = gspca_dev->fr_o; - i = gspca_dev->fr_queue[i]; - if (gspca_dev->frame[i].v4l2_buf.flags & V4L2_BUF_FLAG_DONE) - ret = POLLIN | POLLRDNORM; /* something to read */ - else - ret = 0; - } - mutex_unlock(&gspca_dev->queue_lock); - return ret; -} - /* * wait for a video frame * * If a frame is ready, its index is returned. */ -static int gspca_frame_wait(struct gspca_dev *gspca_dev, +static int frame_wait(struct gspca_dev *gspca_dev, int nonblock_ing) { struct gspca_frame *frame; int i, j, ret; + /* if userptr, treat the awaiting URBs */ + if (gspca_dev->memory == V4L2_MEMORY_USERPTR) + isoc_transfer(gspca_dev); + + /* check if a frame is ready */ i = gspca_dev->fr_o; j = gspca_dev->fr_queue[i]; frame = &gspca_dev->frame[j]; @@ -1385,13 +1841,14 @@ static int gspca_frame_wait(struct gspca_dev *gspca_dev, } if (!gspca_dev->streaming || !gspca_dev->present) return -EIO; + if (gspca_dev->memory == V4L2_MEMORY_USERPTR) + isoc_transfer(gspca_dev); i = gspca_dev->fr_o; j = gspca_dev->fr_queue[i]; frame = &gspca_dev->frame[j]; if (frame->v4l2_buf.flags & V4L2_BUF_FLAG_DONE) break; } - ok: atomic_dec(&gspca_dev->nevent); gspca_dev->fr_o = (i + 1) % gspca_dev->nframes; @@ -1434,7 +1891,7 @@ static int vidioc_dqbuf(struct file *file, void *priv, if (mutex_lock_interruptible(&gspca_dev->read_lock)) return -ERESTARTSYS; - ret = gspca_frame_wait(gspca_dev, file->f_flags & O_NONBLOCK); + ret = frame_wait(gspca_dev, file->f_flags & O_NONBLOCK); if (ret < 0) goto out; i = ret; /* frame index */ @@ -1467,14 +1924,14 @@ static int vidioc_qbuf(struct file *file, void *priv, index = v4l2_buf->index; if ((unsigned) index >= gspca_dev->nframes) { - PDEBUG(D_STREAM, + PDEBUG(D_FRAM, "qbuf idx %d >= %d", index, gspca_dev->nframes); return -EINVAL; } frame = &gspca_dev->frame[index]; if (v4l2_buf->memory != frame->v4l2_buf.memory) { - PDEBUG(D_STREAM, "qbuf bad memory type"); + PDEBUG(D_FRAM, "qbuf bad memory type"); return -EINVAL; } if (gspca_dev->capt_file != file) @@ -1483,17 +1940,16 @@ static int vidioc_qbuf(struct file *file, void *priv, if (mutex_lock_interruptible(&gspca_dev->queue_lock)) return -ERESTARTSYS; - if (frame->v4l2_buf.flags - & (V4L2_BUF_FLAG_QUEUED | V4L2_BUF_FLAG_DONE)) { - PDEBUG(D_STREAM, "qbuf bad state"); + if (frame->v4l2_buf.flags & BUF_ALL_FLAGS) { + PDEBUG(D_FRAM, "qbuf bad state"); ret = -EINVAL; goto out; } frame->v4l2_buf.flags |= V4L2_BUF_FLAG_QUEUED; - frame->v4l2_buf.flags &= ~V4L2_BUF_FLAG_DONE; +/* frame->v4l2_buf.flags &= ~V4L2_BUF_FLAG_DONE; */ - if (v4l2_buf->memory == V4L2_MEMORY_USERPTR) { + if (frame->v4l2_buf.memory == V4L2_MEMORY_USERPTR) { frame->data = frame->data_end = (unsigned char *) v4l2_buf->m.userptr; frame->v4l2_buf.m.userptr = v4l2_buf->m.userptr; @@ -1517,16 +1973,16 @@ out: return ret; } -static ssize_t dev_read(struct file *file, char __user *data, - size_t count, loff_t *ppos) +/* + * allocate the resources for read() + */ +static int read_alloc(struct gspca_dev *gspca_dev, + struct file *file) { - struct gspca_dev *gspca_dev = file->private_data; - struct gspca_frame *frame; struct v4l2_buffer v4l2_buf; - struct timeval timestamp; - int i, ret, ret2; + int i, ret; - PDEBUG(D_FRAM, "read (%p, %d)", data, count); + PDEBUG(D_STREAM, "read alloc"); if (gspca_dev->nframes == 0) { struct v4l2_requestbuffers rb; @@ -1536,7 +1992,7 @@ static ssize_t dev_read(struct file *file, char __user *data, rb.memory = V4L2_MEMORY_MMAP; ret = vidioc_reqbufs(file, gspca_dev, &rb); if (ret != 0) { - PDEBUG(D_STREAM, "read reqbuf err: %d", ret); + PDEBUG(D_STREAM, "read reqbuf err %d", ret); return ret; } memset(&v4l2_buf, 0, sizeof v4l2_buf); @@ -1553,18 +2009,89 @@ static ssize_t dev_read(struct file *file, char __user *data, return ret; } } - } else if (gspca_dev->capt_file != file) - return -EINVAL; + gspca_dev->memory = GSPCA_MEMORY_READ; + } + /* start streaming */ + ret = vidioc_streamon(file, gspca_dev, V4L2_BUF_TYPE_VIDEO_CAPTURE); + if (ret != 0) + PDEBUG(D_STREAM, "read streamon err %d", ret); + return ret; +} + +static unsigned int dev_poll(struct file *file, poll_table *wait) +{ + struct gspca_dev *gspca_dev = file->private_data; + int i, ret; + + PDEBUG(D_FRAM, "poll"); + + poll_wait(file, &gspca_dev->wq, wait); + if (!gspca_dev->present) + return POLLERR; + + /* if not streaming, the user would use read() */ if (!gspca_dev->streaming) { - ret = vidioc_streamon(file, gspca_dev, - V4L2_BUF_TYPE_VIDEO_CAPTURE); + if (gspca_dev->memory != GSPCA_MEMORY_NO) { + ret = POLLERR; /* not the 1st time */ + goto out; + } + ret = read_alloc(gspca_dev, file); if (ret != 0) { - PDEBUG(D_STREAM, "read streamon err %d", ret); - return ret; + ret = POLLERR; + goto out; } } + if (mutex_lock_interruptible(&gspca_dev->queue_lock) != 0) + return POLLERR; + if (!gspca_dev->present) { + ret = POLLERR; + goto out; + } + + /* if not mmap, treat the awaiting URBs */ + if (gspca_dev->memory == V4L2_MEMORY_USERPTR + && gspca_dev->capt_file == file) + isoc_transfer(gspca_dev); + + i = gspca_dev->fr_o; + i = gspca_dev->fr_queue[i]; + if (gspca_dev->frame[i].v4l2_buf.flags & V4L2_BUF_FLAG_DONE) + ret = POLLIN | POLLRDNORM; /* something to read */ + else + ret = 0; +out: + mutex_unlock(&gspca_dev->queue_lock); + return ret; +} + +static ssize_t dev_read(struct file *file, char __user *data, + size_t count, loff_t *ppos) +{ + struct gspca_dev *gspca_dev = file->private_data; + struct gspca_frame *frame; + struct v4l2_buffer v4l2_buf; + struct timeval timestamp; + int i, ret, ret2; + + PDEBUG(D_FRAM, "read (%d)", count); + if (!gspca_dev->present) + return -ENODEV; + switch (gspca_dev->memory) { + case GSPCA_MEMORY_NO: /* first time */ + ret = read_alloc(gspca_dev, file); + if (ret != 0) + return ret; + break; + case GSPCA_MEMORY_READ: + if (gspca_dev->capt_file != file) + return -EINVAL; + break; + default: + return -EINVAL; + } + /* get a frame */ jiffies_to_timeval(get_jiffies_64(), ×tamp); timestamp.tv_sec--; @@ -1615,7 +2142,7 @@ out: return ret; } -static void gspca_dev_release(struct video_device *vfd) +static void dev_release(struct video_device *vfd) { /* nothing */ } @@ -1635,7 +2162,7 @@ static struct video_device gspca_template = { .name = "gspca main driver", .type = VID_TYPE_CAPTURE, .fops = &dev_fops, - .release = gspca_dev_release, /* mandatory */ + .release = dev_release, /* mandatory */ .minor = -1, .vidioc_querycap = vidioc_querycap, .vidioc_dqbuf = vidioc_dqbuf, @@ -1673,7 +2200,8 @@ static struct video_device gspca_template = { int gspca_dev_probe(struct usb_interface *intf, const struct usb_device_id *id, const struct sd_desc *sd_desc, - int dev_size) + int dev_size, + struct module *module) { struct usb_interface_descriptor *interface; struct gspca_dev *gspca_dev; @@ -1682,8 +2210,8 @@ int gspca_dev_probe(struct usb_interface *intf, __u16 vendor; __u16 product; - vendor = le16_to_cpu(dev->descriptor.idVendor); - product = le16_to_cpu(dev->descriptor.idProduct); + vendor = id->idVendor; + product = id->idProduct; PDEBUG(D_PROBE, "probing %04x:%04x", vendor, product); /* we don't handle multi-config cameras */ @@ -1703,6 +2231,7 @@ int gspca_dev_probe(struct usb_interface *intf, } gspca_dev->dev = dev; gspca_dev->iface = interface->bInterfaceNumber; + gspca_dev->nbalt = intf->num_altsetting; gspca_dev->sd_desc = sd_desc; /* gspca_dev->users = 0; (done by kzalloc) */ gspca_dev->nbufread = 2; @@ -1724,6 +2253,9 @@ int gspca_dev_probe(struct usb_interface *intf, /* init video stuff */ memcpy(&gspca_dev->vdev, &gspca_template, sizeof gspca_template); gspca_dev->vdev.dev = &dev->dev; + memcpy(&gspca_dev->fops, &dev_fops, sizeof gspca_dev->fops); + gspca_dev->vdev.fops = &gspca_dev->fops; + gspca_dev->fops.owner = module; /* module protection */ ret = video_register_device(&gspca_dev->vdev, VFL_TYPE_GRABBER, video_nr); @@ -1758,7 +2290,7 @@ void gspca_disconnect(struct usb_interface *intf) mutex_lock(&gspca_dev->queue_lock); mutex_lock(&gspca_dev->usb_lock); gspca_dev->streaming = 0; - gspca_kill_transfer(gspca_dev); + destroy_urbs(gspca_dev); mutex_unlock(&gspca_dev->usb_lock); mutex_unlock(&gspca_dev->queue_lock); while (gspca_dev->users != 0) { /* wait until fully closed */ @@ -1777,11 +2309,23 @@ EXPORT_SYMBOL(gspca_disconnect); /* -- module insert / remove -- */ static int __init gspca_init(void) { +#ifdef GSPCA_HLP + int ret; + + /* create /dev/gspca_hlp */ + ret = misc_register(&hlp_device); + if (ret < 0) + err("misc_register err %d", ret); + start_hlp(); /* try to start the helper process */ +#endif info("main v%s registered", version); return 0; } static void __exit gspca_exit(void) { +#ifdef GSPCA_HLP + misc_deregister(&hlp_device); +#endif info("main deregistered"); } @@ -1791,7 +2335,8 @@ module_exit(gspca_exit); module_param_named(debug, gspca_debug, int, 0644); MODULE_PARM_DESC(debug, "Debug (bit) 0x01:error 0x02:probe 0x04:config" - " 0x08:stream 0x10:frame 0x20:packet 0x40:USBin 0x80:USBout"); + " 0x08:stream 0x10:frame 0x20:packet 0x40:USBin 0x80:USBout" + " 0x0100: v4l2"); module_param(comp_fac, int, 0644); MODULE_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; #define D_PACK 0x20 #define D_USBI 0x40 #define D_USBO 0x80 +#define D_V4L2 0x0100 #else #define PDEBUG(level, fmt, args...) #endif @@ -46,9 +47,9 @@ extern int gspca_debug; #define GSPCA_MAX_FRAMES 16 /* maximum number of video frame buffers */ /* ISOC transfers */ -#define NURBS 4 /* number of URBs */ +#define MAX_NURBS 32 /* max number of URBs (read & userptr) */ #define ISO_MAX_PKT 32 /* max number of packets in an ISOC transfer */ -#define ISO_MAX_SIZE 0x10000 /* max size of one URB buffer (64 Kb) */ +#define ISO_MAX_SIZE 0x8000 /* max size of one URB buffer (32 Kb) */ /* device information - set at probe time */ struct cam_mode { @@ -123,13 +124,14 @@ struct gspca_frame { struct gspca_dev { struct video_device vdev; /* !! must be the first item */ + struct file_operations fops; struct usb_device *dev; struct file *capt_file; /* file doing video capture */ struct cam cam; /* device information */ const struct sd_desc *sd_desc; /* subdriver description */ - struct urb *urb[NURBS]; + struct urb *urb[MAX_NURBS]; __u8 *frbuf; /* buffer for nframes */ struct gspca_frame frame[GSPCA_MAX_FRAMES]; @@ -155,15 +157,21 @@ struct gspca_dev { struct mutex queue_lock; /* ISOC queue protection */ __u32 sequence; /* frame sequence number */ char streaming; - char users; /* # open */ + char users; /* number of opens */ char present; /* device connected */ char nbufread; /* number of buffers for read() */ + char nurbs; /* number of allocated URBs */ + char memory; /* memory type (V4L2_MEMORY_xxx) */ + __u8 urb_in; /* URB pointers - used when !mmap */ + __u8 urb_out; + __u8 nbalt; /* number of USB alternate settings */ }; int gspca_dev_probe(struct usb_interface *intf, const struct usb_device_id *id, const struct sd_desc *sd_desc, - int dev_size); + int dev_size, + struct module *module); void gspca_disconnect(struct usb_interface *intf); struct gspca_frame *gspca_frame_add(struct gspca_dev *gspca_dev, 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[] = { 0x02, 0x11, 0x01, /* samples CbCr - quant CbCr */ 0x03, 0x11, 0x01, - 0xff, 0xda, 0x00, 0x0c, /* SOS (start of scan */ + 0xff, 0xda, 0x00, 0x0c, /* SOS (start of scan) */ 0x03, 0x01, 0x00, 0x02, 0x11, 0x03, 0x11, 0x00, 0x3f, 0x00 }; #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 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(0, 1, 1) -static const char version[] = "0.1.1"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(0, 2, 15) +static const char version[] = "0.2.15"; MODULE_AUTHOR("Hans de Goede <j.w.r.degoede@hhs.nl>"); MODULE_DESCRIPTION("Pixart PAC207"); @@ -188,7 +188,8 @@ static const __u8 pac207_sensor_init[][8] = { /* 48 reg_72 Rate Control end BalSize_4a =0x36 */ static const __u8 PacReg72[] = { 0x00, 0x00, 0x36, 0x00 }; -static const char pac207_sof_marker[5] = { 0xff, 0xff, 0x00, 0xff, 0x96 }; +static const unsigned char pac207_sof_marker[5] = + { 0xff, 0xff, 0x00, 0xff, 0x96 }; int pac207_write_regs(struct gspca_dev *gspca_dev, u16 index, const u8 *buffer, u16 length) @@ -327,11 +328,12 @@ static void sd_start(struct gspca_dev *gspca_dev) pac207_write_reg(gspca_dev, 0x02, sd->exposure); /* PXCK = 12MHz /n */ mode = 0x02; /* Image Format (Bit 0), LED (1), Compr. test mode (2) */ - if (gspca_dev->width == 176) { /* 176x144 */ + if (gspca_dev->width == 176) { /* 176x144 */ mode |= 0x01; PDEBUG(D_STREAM, "pac207_start mode 176x144"); - } else/* 352x288 */ + } else { /* 352x288 */ PDEBUG(D_STREAM, "pac207_start mode 352x288"); + } pac207_write_reg(gspca_dev, 0x41, mode); pac207_write_reg(gspca_dev, 0x13, 0x01); /* Bit 0, auto clear */ @@ -425,7 +427,7 @@ void init_pixart_decoder(void) } /* auto gain and exposure algorithm based on the knee algorithm described here: - http://ytse.tricolour.net/docs/LowLightOptimization.html */ + * <http://ytse.tricolour.net/docs/LowLightOptimization.html> */ static void pac207_do_auto_gain(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; @@ -508,8 +510,9 @@ static unsigned char *pac207_find_sof(struct gspca_dev *gspca_dev, sd->sof_read = 0; return m + i + 1; } - } else + } else { sd->sof_read = 0; + } } return NULL; @@ -556,9 +559,9 @@ static int pac207_decompress_row(struct gspca_dev *gspca_dev, decoder_state->line_read++; decoder_state->get_abs = 0; } else { - if (table[code].is_abs) + if (table[code].is_abs) { decoder_state->get_abs = 1; - else { + } else { /* relative to left pixel */ val = outp[-2] + table[code].val; @@ -894,13 +897,13 @@ static struct sd_desc sd_desc = { #define DVNM(name) .driver_info = (kernel_ulong_t) name static __devinitdata struct usb_device_id device_table[] = { {USB_DEVICE(0x041e, 0x4028), DVNM("Creative Webcam Vista Plus")}, - {USB_DEVICE(0x093a, 0x2460), DVNM("PAC207 Qtec Webcam 100")}, + {USB_DEVICE(0x093a, 0x2460), DVNM("Q-Tec Webcam 100")}, {USB_DEVICE(0x093a, 0x2463), DVNM("Philips spc200nc pac207")}, {USB_DEVICE(0x093a, 0x2464), DVNM("Labtec Webcam 1200")}, {USB_DEVICE(0x093a, 0x2468), DVNM("PAC207")}, {USB_DEVICE(0x093a, 0x2470), DVNM("Genius GF112")}, - {USB_DEVICE(0x093a, 0x2471), DVNM("PAC207 Genius VideoCam ge111")}, - {USB_DEVICE(0x093a, 0x2472), DVNM("PAC207 Genius VideoCam ge110")}, + {USB_DEVICE(0x093a, 0x2471), DVNM("Genius VideoCam GE111")}, + {USB_DEVICE(0x093a, 0x2472), DVNM("Genius VideoCam GE110")}, {USB_DEVICE(0x2001, 0xf115), DVNM("D-Link DSB-C120")}, {} }; @@ -910,8 +913,8 @@ MODULE_DEVICE_TABLE(usb, device_table); static int sd_probe(struct usb_interface *intf, const struct usb_device_id *id) { - PDEBUG(D_PROBE, "camera probe"); - return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd)); + return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), + THIS_MODULE); } static 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 @@ /* * Syntek DV4000 (STK014) subdriver * - * Copyright (C) Jean-Francois Moine (http://moinejf.free.fr) + * Copyright (C) 2008 Jean-Francois Moine (http://moinejf.free.fr) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * */ #define MODULE_NAME "stk014" @@ -24,8 +23,8 @@ #include "gspca.h" #include "jpeg.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(0, 1, 0) -static const char version[] = "0.1.0"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(0, 2, 7) +static const char version[] = "0.2.7"; MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>"); MODULE_DESCRIPTION("Syntek DV4000 (STK014) USB Camera Driver"); @@ -389,64 +388,32 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, unsigned char *data, /* isoc packet */ int len) /* iso packet length */ { - int l; static unsigned char ffd9[] = {0xff, 0xd9}; /* a frame starts with: * - 0xff 0xfe - * - 0x08 0x00 // length (little endian ?!) - * - 4 bytes = size of whole frame (big endian - including header) + * - 0x08 0x00 - length (little endian ?!) + * - 4 bytes = size of whole frame (BE - including header) * - 0x00 0x0c * - 0xff 0xd8 * - .. JPEG image with escape sequences (ff 00) + * (without ending - ff d9) */ if (data[0] == 0xff && data[1] == 0xfe) { - if (gspca_dev->last_packet_type == INTER_PACKET) { - PDEBUG(D_ERR|D_FRAM, "sof actual l: %d init l: %d", - frame->data_end - frame->data, - frame->v4l2_buf.bytesused); - } + frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame, + ffd9, 2); - /* put the JPEG headaer */ + /* put the JPEG 411 header */ jpeg_put_header(gspca_dev, frame, sd_quant, 0x22); /* beginning of the frame */ #define STKHDRSZ 12 - l = (data[4] << 24) /* frame size */ - + (data[5] << 16) - + (data[6] << 8) - + data[7] - - STKHDRSZ - + (frame->data_end - frame->data) - + 2; /* EOF (ff d9) */ gspca_frame_add(gspca_dev, INTER_PACKET, frame, data + STKHDRSZ, len - STKHDRSZ); #undef STKHDRSZ - frame->v4l2_buf.bytesused = l; - return; - } - if (gspca_dev->last_packet_type != INTER_PACKET) { - if (gspca_dev->last_packet_type == LAST_PACKET) { - PDEBUG(D_ERR|D_PACK, "mof actual l: %d init l: %d", - frame->data_end - frame->data, - frame->v4l2_buf.bytesused); - } - return; - } - - /* intermediate packet */ - l = frame->data_end - frame->data; - if (len < frame->v4l2_buf.bytesused - 2 - l) { - gspca_frame_add(gspca_dev, INTER_PACKET, frame, - data, len); return; } - - /* last packet */ - if (len > frame->v4l2_buf.bytesused - 2 - l) - len = frame->v4l2_buf.bytesused - 2 - l; gspca_frame_add(gspca_dev, INTER_PACKET, frame, data, len); - gspca_frame_add(gspca_dev, LAST_PACKET, frame, ffd9, 2); } static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val) @@ -529,8 +496,8 @@ MODULE_DEVICE_TABLE(usb, device_table); static int sd_probe(struct usb_interface *intf, const struct usb_device_id *id) { - PDEBUG(D_PROBE, "camera probe"); - return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd)); + return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), + THIS_MODULE); } static 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 @@ +/* + * Z-Star/Vimicro zc301/zc302p/vc30x library + * Copyright (C) 2004 2005 2006 Michel Xhaard + * mxhaard@magic.fr + * + * V4L2 by Jean-François Moine <http://moinejf.free.fr> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#define MODULE_NAME "zc3xx" + +#include "gspca.h" + +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(0, 2, 13) +static const char version[] = "0.2.13"; + +MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>, " + "Serge A. Suchkov <Serge.A.S@tochka.ru>"); +MODULE_DESCRIPTION("GSPCA ZC03xx/VC3xx USB Camera Driver"); +MODULE_LICENSE("GPL"); + +static int lightfreq = 50; +static int force_sensor = -1; + +#include "jpeg.h" + +/* specific webcam descriptor */ +struct sd { + struct gspca_dev gspca_dev; /* !! must be the first item */ + + unsigned char brightness; + unsigned char contrast; + unsigned char autogain; + unsigned char gamma; + + char qindex; + char sensor; /* Type of image sensor chip */ +/* !! values used in different tables */ +#define SENSOR_CS2102 0 +#define SENSOR_CS2102K 1 +#define SENSOR_GC0305 2 +#define SENSOR_HDCS2020 3 +#define SENSOR_HDCS2020b 4 +#define SENSOR_HV7131B 5 +#define SENSOR_HV7131C 6 +#define SENSOR_ICM105A 7 +#define SENSOR_MC501CB 8 +#define SENSOR_OV7620 9 +/*#define SENSOR_OV7648 9 - same values */ +#define SENSOR_OV7630C 10 +/*#define SENSOR_free 11 */ +#define SENSOR_PAS106 12 +#define SENSOR_PB0330 13 +#define SENSOR_PO2030 14 +#define SENSOR_TAS5130CK 15 +#define SENSOR_TAS5130CXX 16 +#define SENSOR_TAS5130C_VF0250 17 +#define SENSOR_MAX 18 + unsigned short chip_revision; +}; + +/* V4L2 controls supported by the driver */ +static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val); +static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val); +static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val); +static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val); +static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val); +static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val); +static int sd_getgamma(struct gspca_dev *gspca_dev, __s32 *val); + +static struct ctrl sd_ctrls[] = { +#define SD_BRIGHTNESS 0 + { + { + .id = V4L2_CID_BRIGHTNESS, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Brightness", + .minimum = 0, + .maximum = 255, + .step = 1, + .default_value = 128, + }, + .set = sd_setbrightness, + .get = sd_getbrightness, + }, +#define SD_CONTRAST 1 + { + { + .id = V4L2_CID_CONTRAST, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Contrast", + .minimum = 0, + .maximum = 256, + .step = 1, + .default_value = 128, + }, + .set = sd_setcontrast, + .get = sd_getcontrast, + }, +#define SD_AUTOGAIN 2 + { + { + .id = V4L2_CID_AUTOGAIN, + .type = V4L2_CTRL_TYPE_BOOLEAN, + .name = "Auto Gain", + .minimum = 0, + .maximum = 1, + .step = 1, + .default_value = 1, + }, + .set = sd_setautogain, + .get = sd_getautogain, + }, +#define SD_GAMMA 3 + { + { + .id = V4L2_CID_GAMMA, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Gamma", + .minimum = 1, + .maximum = 6, + .step = 1, + .default_value = 4, + }, + .set = sd_setcontrast, + .get = sd_getgamma, + }, +}; + +static struct cam_mode vga_mode[] = { + {V4L2_PIX_FMT_JPEG, 320, 240, 1}, + {V4L2_PIX_FMT_JPEG, 640, 480, 0}, +}; + +static struct cam_mode sif_mode[] = { + {V4L2_PIX_FMT_JPEG, 176, 144, 1}, + {V4L2_PIX_FMT_JPEG, 352, 288, 0}, +}; + +/* usb exchanges */ +struct usb_action { + __u8 req; + __u8 val; + __u16 idx; +}; + +static struct usb_action cs2102_Initial[] = { + {0xa1, 0x01, 0x0008}, + {0xa1, 0x01, 0x0008}, + {0xa0, 0x01, 0x0000}, + {0xa0, 0x10, 0x0002}, + {0xa0, 0x00, 0x0010}, + {0xa0, 0x01, 0x0001}, + {0xa0, 0x20, 0x0080}, + {0xa0, 0x21, 0x0081}, + {0xa0, 0x30, 0x0083}, + {0xa0, 0x31, 0x0084}, + {0xa0, 0x32, 0x0085}, + {0xa0, 0x23, 0x0086}, + {0xa0, 0x24, 0x0087}, + {0xa0, 0x25, 0x0088}, + {0xa0, 0xb3, 0x008b}, + {0xa0, 0x03, 0x0008}, /* 00 */ + {0xa0, 0x03, 0x0012}, + {0xa0, 0x01, 0x0012}, + {0xa0, 0x02, 0x0003}, + {0xa0, 0x80, 0x0004}, + {0xa0, 0x01, 0x0005}, + {0xa0, 0xe0, 0x0006}, + {0xa0, 0x00, 0x0098}, + {0xa0, 0x00, 0x009a}, + {0xa0, 0x00, 0x011a}, + {0xa0, 0x00, 0x011c}, + {0xaa, 0x02, 0x0008}, + {0xaa, 0x03, 0x0000}, + {0xaa, 0x11, 0x0000}, + {0xaa, 0x12, 0x0089}, + {0xaa, 0x13, 0x0000}, + {0xaa, 0x14, 0x00e9}, + {0xaa, 0x20, 0x0000}, + {0xaa, 0x22, 0x0000}, + {0xaa, 0x0b, 0x0004}, + {0xaa, 0x30, 0x0030}, + {0xaa, 0x31, 0x0030}, + {0xaa, 0x32, 0x0030}, + {0xa0, 0x37, 0x0101}, + {0xa0, 0x00, 0x0019}, + {0xa0, 0x05, 0x0012}, + {0xa0, 0x0d, 0x0100}, + {0xa0, 0x06, 0x0189}, + {0xa0, 0x03, 0x01c5}, + {0xa0, 0x13, 0x01cb}, + {0xa0, 0x10, 0x01ae}, + {0xa0, 0x08, 0x0250}, + {0xa0, 0x08, 0x0301}, + {0xa0, 0x68, 0x018d}, + {0xa0, 0x00, 0x01ad}, + {0xa1, 0x01, 0x0002}, + {0xa1, 0x01, 0x0008}, + {0xa0, 0x03, 0x0008}, /* 00 */ + {0xa0, 0x08, 0x01c6}, /* clock ? */ + {0xa1, 0x01, 0x01c8}, + {0xa1, 0x01, 0x01c9}, + {0xa1, 0x01, 0x01ca}, + {0xa0, 0x0f, 0x01cb}, + {0xa0, 0x24, 0x0120}, /* gamma 5 */ + {0xa0, 0x44, 0x0121}, + {0xa0, 0x64, 0x0122}, + {0xa0, 0x84, 0x0123}, + {0xa0, 0x9d, 0x0124}, + {0xa0, 0xb2, 0x0125}, + {0xa0, 0xc4, 0x0126}, + {0xa0, 0xd3, 0x0127}, + {0xa0, 0xe0, 0x0128}, + {0xa0, 0xeb, 0x0129}, + {0xa0, 0xf4, 0x012a}, + {0xa0, 0xfb, 0x012b}, + {0xa0, 0xff, 0x012c}, + {0xa0, 0xff, 0x012d}, + {0xa0, 0xff, 0x012e}, + {0xa0, 0xff, 0x012f}, + {0xa0, 0x18, 0x0130}, + {0xa0, 0x20, 0x0131}, + {0xa0, 0x20, 0x0132}, + {0xa0, 0x1c, 0x0133}, + {0xa0, 0x16, 0x0134}, + {0xa0, 0x13, 0x0135}, + {0xa0, 0x10, 0x0136}, + {0xa0, 0x0e, 0x0137}, + {0xa0, 0x0b, 0x0138}, + {0xa0, 0x09, 0x0139}, + {0xa0, 0x07, 0x013a}, + {0xa0, 0x06, 0x013b}, + {0xa0, 0x00, 0x013c}, + {0xa0, 0x00, 0x013d}, + {0xa0, 0x00, 0x013e}, + {0xa0, 0x01, 0x013f}, + {0xa0, 0x58, 0x010a}, /* matrix */ + {0xa0, 0xf4, 0x010b}, + {0xa0, 0xf4, 0x010c}, + {0xa0, 0xf4, 0x010d}, + {0xa0, 0x58, 0x010e}, + {0xa0, 0xf4, 0x010f}, + {0xa0, 0xf4, 0x0110}, + {0xa0, 0xf4, 0x0111}, + {0xa0, 0x58, 0x0112}, + {0xa1, 0x01, 0x0180}, + {0xa0, 0x00, 0x0180}, + {0xa0, 0x00, 0x0019}, + {0xaa, 0x23, 0x0001}, + {0xaa, 0x24, 0x0055}, + {0xaa, 0x25, 0x00cc}, + {0xaa, 0x21, 0x003f}, + {0xa0, 0x02, 0x0190}, + {0xa0, 0xab, 0x0191}, + {0xa0, 0x98, 0x0192}, + {0xa0, 0x00, 0x0195}, + {0xa0, 0x30, 0x0196}, + {0xa0, 0xd4, 0x0197}, + {0xa0, 0x10, 0x018c}, + {0xa0, 0x20, 0x018f}, + {0xa0, 0x10, 0x01a9}, + {0xa0, 0x24, 0x01aa}, + {0xa0, 0x39, 0x001d}, + {0xa0, 0x70, 0x001e}, + {0xa0, 0xb0, 0x001f}, + {0xa0, 0xff, 0x0020}, + {0xa0, 0x40, 0x0180}, + {0xa1, 0x01, 0x0180}, + {0xa0, 0x42, 0x0180}, + {0xa0, 0x40, 0x0116}, + {0xa0, 0x40, 0x0117}, + {0xa0, 0x40, 0x0118}, + {0, 0, 0} +}; + +static struct usb_action cs2102_InitialScale[] = { + {0xa1, 0x01, 0x0008}, + {0xa1, 0x01, 0x0008}, + {0xa0, 0x01, 0x0000}, + {0xa0, 0x00, 0x0002}, + {0xa0, 0x00, 0x0010}, + {0xa0, 0x01, 0x0001}, + {0xa0, 0x20, 0x0080}, + {0xa0, 0x21, 0x0081}, + {0xa0, 0x30, 0x0083}, + {0xa0, 0x31, 0x0084}, + {0xa0, 0x32, 0x0085}, + {0xa0, 0x23, 0x0086}, + {0xa0, 0x24, 0x0087}, + {0xa0, 0x25, 0x0088}, + {0xa0, 0xb3, 0x008b}, + {0xa0, 0x03, 0x0008}, /* 00 */ + {0xa0, 0x03, 0x0012}, + {0xa0, 0x01, 0x0012}, + {0xa0, 0x02, 0x0003}, + {0xa0, 0x80, 0x0004}, + {0xa0, 0x01, 0x0005}, + {0xa0, 0xe0, 0x0006}, + {0xa0, 0x00, 0x0098}, + {0xa0, 0x00, 0x009a}, + {0xa0, 0x00, 0x011a}, + {0xa0, 0x00, 0x011c}, + {0xaa, 0x02, 0x0008}, + {0xaa, 0x03, 0x0000}, + {0xaa, 0x11, 0x0001}, + {0xaa, 0x12, 0x0087}, + {0xaa, 0x13, 0x0001}, + {0xaa, 0x14, 0x00e7}, + {0xaa, 0x20, 0x0000}, + {0xaa, 0x22, 0x0000}, + {0xaa, 0x0b, 0x0004}, + {0xaa, 0x30, 0x0030}, + {0xaa, 0x31, 0x0030}, + {0xaa, 0x32, 0x0030}, + {0xa0, 0x77, 0x0101}, + {0xa0, 0x00, 0x0019}, + {0xa0, 0x05, 0x0012}, + {0xa0, 0x0d, 0x0100}, + {0xa0, 0x06, 0x0189}, + {0xa0, 0x03, 0x01c5}, + {0xa0, 0x13, 0x01cb}, + {0xa0, 0x15, 0x01ae}, + {0xa0, 0x08, 0x0250}, + {0xa0, 0x08, 0x0301}, + {0xa0, 0x68, 0x018d}, + {0xa0, 0x00, 0x01ad}, + {0xa1, 0x01, 0x0002}, + {0xa1, 0x01, 0x0008}, + {0xa0, 0x03, 0x0008}, /* 00 */ + {0xa0, 0x08, 0x01c6}, /* clock ? */ + {0xa1, 0x01, 0x01c8}, + {0xa1, 0x01, 0x01c9}, + {0xa1, 0x01, 0x01ca}, + {0xa0, 0x0f, 0x01cb}, + {0xa0, 0x24, 0x0120}, /* gamma 5 */ + {0xa0, 0x44, 0x0121}, + {0xa0, 0x64, 0x0122}, + {0xa0, 0x84, 0x0123}, + {0xa0, 0x9d, 0x0124}, + {0xa0, 0xb2, 0x0125}, + {0xa0, 0xc4, 0x0126}, + {0xa0, 0xd3, 0x0127}, + {0xa0, 0xe0, 0x0128}, + {0xa0, 0xeb, 0x0129}, + {0xa0, 0xf4, 0x012a}, + {0xa0, 0xfb, 0x012b}, + {0xa0, 0xff, 0x012c}, + {0xa0, 0xff, 0x012d}, + {0xa0, 0xff, 0x012e}, + {0xa0, 0xff, 0x012f}, + {0xa0, 0x18, 0x0130}, + {0xa0, 0x20, 0x0131}, + {0xa0, 0x20, 0x0132}, + {0xa0, 0x1c, 0x0133}, + {0xa0, 0x16, 0x0134}, + {0xa0, 0x13, 0x0135}, + {0xa0, 0x10, 0x0136}, + {0xa0, 0x0e, 0x0137}, + {0xa0, 0x0b, 0x0138}, + {0xa0, 0x09, 0x0139}, + {0xa0, 0x07, 0x013a}, + {0xa0, 0x06, 0x013b}, + {0xa0, 0x00, 0x013c}, + {0xa0, 0x00, 0x013d}, + {0xa0, 0x00, 0x013e}, + {0xa0, 0x01, 0x013f}, + {0xa0, 0x58, 0x010a}, /* matrix */ + {0xa0, 0xf4, 0x010b}, + {0xa0, 0xf4, 0x010c}, + {0xa0, 0xf4, 0x010d}, + {0xa0, 0x58, 0x010e}, + {0xa0, 0xf4, 0x010f}, + {0xa0, 0xf4, 0x0110}, + {0xa0, 0xf4, 0x0111}, + {0xa0, 0x58, 0x0112}, + {0xa1, 0x01, 0x0180}, + {0xa0, 0x00, 0x0180}, + {0xa0, 0x00, 0x0019}, + {0xaa, 0x23, 0x0000}, + {0xaa, 0x24, 0x00aa}, + {0xaa, 0x25, 0x00e6}, + {0xaa, 0x21, 0x003f}, + {0xa0, 0x01, 0x0190}, + {0xa0, 0x55, 0x0191}, + {0xa0, 0xcc, 0x0192}, + {0xa0, 0x00, 0x0195}, + {0xa0, 0x18, 0x0196}, + {0xa0, 0x6a, 0x0197}, + {0xa0, 0x10, 0x018c}, + {0xa0, 0x20, 0x018f}, + {0xa0, 0x10, 0x01a9}, + {0xa0, 0x24, 0x01aa}, + {0xa0, 0x3f, 0x001d}, + {0xa0, 0xa5, 0x001e}, + {0xa0, 0xf0, 0x001f}, + {0xa0, 0xff, 0x0020}, + {0xa0, 0x40, 0x0180}, + {0xa1, 0x01, 0x0180}, + {0xa0, 0x42, 0x0180}, + {0xa0, 0x40, 0x0116}, + {0xa0, 0x40, 0x0117}, + {0xa0, 0x40, 0x0118}, + {0, 0, 0} +}; +static struct usb_action cs2102_50HZ[] = { + {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xaa, 0x0f, 0x008c}, /* 00,0f,8c,aa */ + {0xaa, 0x03, 0x0005}, /* 00,03,05,aa */ + {0xaa, 0x04, 0x00ac}, /* 00,04,ac,aa */ + {0xaa, 0x10, 0x0005}, /* 00,10,05,aa */ + {0xaa, 0x11, 0x00ac}, /* 00,11,ac,aa */ + {0xaa, 0x1b, 0x0000}, /* 00,1b,00,aa */ + {0xaa, 0x1c, 0x0005}, /* 00,1c,05,aa */ + {0xaa, 0x1d, 0x00ac}, /* 00,1d,ac,aa */ + {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ + {0xa0, 0x3f, 0x0191}, /* 01,91,3f,cc */ + {0xa0, 0xf0, 0x0192}, /* 01,92,f0,cc */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */ + {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */ + {0xa0, 0x42, 0x0197}, /* 01,97,42,cc */ + {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */ + {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */ + {0xa0, 0x10, 0x01a9}, /* 01,a9,10,cc */ + {0xa0, 0x24, 0x01aa}, /* 01,aa,24,cc */ + {0xa0, 0x8c, 0x001d}, /* 00,1d,8c,cc */ + {0xa0, 0xb0, 0x001e}, /* 00,1e,b0,cc */ + {0xa0, 0xd0, 0x001f}, /* 00,1f,d0,cc */ + {0, 0, 0} +}; +static struct usb_action cs2102_50HZScale[] = { + {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xaa, 0x0f, 0x0093}, /* 00,0f,93,aa */ + {0xaa, 0x03, 0x0005}, /* 00,03,05,aa */ + {0xaa, 0x04, 0x00a1}, /* 00,04,a1,aa */ + {0xaa, 0x10, 0x0005}, /* 00,10,05,aa */ + {0xaa, 0x11, 0x00a1}, /* 00,11,a1,aa */ + {0xaa, 0x1b, 0x0000}, /* 00,1b,00,aa */ + {0xaa, 0x1c, 0x0005}, /* 00,1c,05,aa */ + {0xaa, 0x1d, 0x00a1}, /* 00,1d,a1,aa */ + {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ + {0xa0, 0x3f, 0x0191}, /* 01,91,3f,cc */ + {0xa0, 0xf7, 0x0192}, /* 01,92,f7,cc */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */ + {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */ + {0xa0, 0x83, 0x0197}, /* 01,97,83,cc */ + {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */ + {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */ + {0xa0, 0x10, 0x01a9}, /* 01,a9,10,cc */ + {0xa0, 0x24, 0x01aa}, /* 01,aa,24,cc */ + {0xa0, 0x93, 0x001d}, /* 00,1d,93,cc */ + {0xa0, 0xb0, 0x001e}, /* 00,1e,b0,cc */ + {0xa0, 0xd0, 0x001f}, /* 00,1f,d0,cc */ + {0, 0, 0} +}; +static struct usb_action cs2102_60HZ[] = { + {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xaa, 0x0f, 0x005d}, /* 00,0f,5d,aa */ + {0xaa, 0x03, 0x0005}, /* 00,03,05,aa */ + {0xaa, 0x04, 0x00aa}, /* 00,04,aa,aa */ + {0xaa, 0x10, 0x0005}, /* 00,10,05,aa */ + {0xaa, 0x11, 0x00aa}, /* 00,11,aa,aa */ + {0xaa, 0x1b, 0x0000}, /* 00,1b,00,aa */ + {0xaa, 0x1c, 0x0005}, /* 00,1c,05,aa */ + {0xaa, 0x1d, 0x00aa}, /* 00,1d,aa,aa */ + {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ + {0xa0, 0x3f, 0x0191}, /* 01,91,3f,cc */ + {0xa0, 0xe4, 0x0192}, /* 01,92,e4,cc */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */ + {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */ + {0xa0, 0x3a, 0x0197}, /* 01,97,3a,cc */ + {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */ + {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */ + {0xa0, 0x10, 0x01a9}, /* 01,a9,10,cc */ + {0xa0, 0x24, 0x01aa}, /* 01,aa,24,cc */ + {0xa0, 0x5d, 0x001d}, /* 00,1d,5d,cc */ + {0xa0, 0x90, 0x001e}, /* 00,1e,90,cc */ + {0xa0, 0xd0, 0x00c8}, /* 00,c8,d0,cc */ + {0, 0, 0} +}; +static struct usb_action cs2102_60HZScale[] = { + {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xaa, 0x0f, 0x00b7}, /* 00,0f,b7,aa */ + {0xaa, 0x03, 0x0005}, /* 00,03,05,aa */ + {0xaa, 0x04, 0x00be}, /* 00,04,be,aa */ + {0xaa, 0x10, 0x0005}, /* 00,10,05,aa */ + {0xaa, 0x11, 0x00be}, /* 00,11,be,aa */ + {0xaa, 0x1b, 0x0000}, /* 00,1b,00,aa */ + {0xaa, 0x1c, 0x0005}, /* 00,1c,05,aa */ + {0xaa, 0x1d, 0x00be}, /* 00,1d,be,aa */ + {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ + {0xa0, 0x3f, 0x0191}, /* 01,91,3f,cc */ + {0xa0, 0xfc, 0x0192}, /* 01,92,fc,cc */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */ + {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */ + {0xa0, 0x69, 0x0197}, /* 01,97,69,cc */ + {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */ + {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */ + {0xa0, 0x10, 0x01a9}, /* 01,a9,10,cc */ + {0xa0, 0x24, 0x01aa}, /* 01,aa,24,cc */ + {0xa0, 0xb7, 0x001d}, /* 00,1d,b7,cc */ + {0xa0, 0xd0, 0x001e}, /* 00,1e,d0,cc */ + {0xa0, 0xe8, 0x001f}, /* 00,1f,e8,cc */ + {0, 0, 0} +}; +static struct usb_action cs2102_NoFliker[] = { + {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xaa, 0x0f, 0x0059}, /* 00,0f,59,aa */ + {0xaa, 0x03, 0x0005}, /* 00,03,05,aa */ + {0xaa, 0x04, 0x0080}, /* 00,04,80,aa */ + {0xaa, 0x10, 0x0005}, /* 00,10,05,aa */ + {0xaa, 0x11, 0x0080}, /* 00,11,80,aa */ + {0xaa, 0x1b, 0x0000}, /* 00,1b,00,aa */ + {0xaa, 0x1c, 0x0005}, /* 00,1c,05,aa */ + {0xaa, 0x1d, 0x0080}, /* 00,1d,80,aa */ + {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ + {0xa0, 0x3f, 0x0191}, /* 01,91,3f,cc */ + {0xa0, 0xf0, 0x0192}, /* 01,92,f0,cc */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */ + {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */ + {0xa0, 0x10, 0x0197}, /* 01,97,10,cc */ + {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */ + {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */ + {0xa0, 0x00, 0x01a9}, /* 01,a9,00,cc */ + {0xa0, 0x00, 0x01aa}, /* 01,aa,00,cc */ + {0xa0, 0x59, 0x001d}, /* 00,1d,59,cc */ + {0xa0, 0x90, 0x001e}, /* 00,1e,90,cc */ + {0xa0, 0xc8, 0x001f}, /* 00,1f,c8,cc */ + {0, 0, 0} +}; +static struct usb_action cs2102_NoFlikerScale[] = { + {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xaa, 0x0f, 0x0059}, /* 00,0f,59,aa */ + {0xaa, 0x03, 0x0005}, /* 00,03,05,aa */ + {0xaa, 0x04, 0x0080}, /* 00,04,80,aa */ + {0xaa, 0x10, 0x0005}, /* 00,10,05,aa */ + {0xaa, 0x11, 0x0080}, /* 00,11,80,aa */ + {0xaa, 0x1b, 0x0000}, /* 00,1b,00,aa */ + {0xaa, 0x1c, 0x0005}, /* 00,1c,05,aa */ + {0xaa, 0x1d, 0x0080}, /* 00,1d,80,aa */ + {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ + {0xa0, 0x3f, 0x0191}, /* 01,91,3f,cc */ + {0xa0, 0xf0, 0x0192}, /* 01,92,f0,cc */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */ + {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */ + {0xa0, 0x10, 0x0197}, /* 01,97,10,cc */ + {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */ + {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */ + {0xa0, 0x00, 0x01a9}, /* 01,a9,00,cc */ + {0xa0, 0x00, 0x01aa}, /* 01,aa,00,cc */ + {0xa0, 0x59, 0x001d}, /* 00,1d,59,cc */ + {0xa0, 0x90, 0x001e}, /* 00,1e,90,cc */ + {0xa0, 0xc8, 0x001f}, /* 00,1f,c8,cc */ + {0, 0, 0} +}; + +/* CS2102_KOCOM */ +static struct usb_action cs2102K_Initial[] = { + {0xa0, 0x11, 0x0002}, + {0xa0, 0x03, 0x0008}, + {0xa0, 0x08, 0x0010}, + {0xa0, 0x02, 0x0003}, + {0xa0, 0x80, 0x0004}, + {0xa0, 0x01, 0x0005}, + {0xa0, 0xe0, 0x0006}, + {0xa0, 0x01, 0x0001}, + {0xa0, 0x03, 0x0012}, + {0xa0, 0x01, 0x0012}, + {0xa0, 0x00, 0x0098}, + {0xa0, 0x00, 0x009a}, + {0xa0, 0x00, 0x011a}, + {0xa0, 0x00, 0x011c}, + {0xa0, 0xe8, 0x009c}, + {0xa0, 0x88, 0x009e}, + {0xa0, 0x55, 0x008b}, + {0xa0, 0x18, 0x0092}, + {0xa0, 0x00, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x0a, 0x0092}, + {0xa0, 0x02, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x0b, 0x0092}, + {0xa0, 0x02, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x0c, 0x0092}, + {0xa0, 0x7c, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x0d, 0x0092}, + {0xa0, 0xa3, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x03, 0x0092}, + {0xa0, 0xfb, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x05, 0x0092}, + {0xa0, 0x00, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x06, 0x0092}, + {0xa0, 0x03, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x09, 0x0092}, + {0xa0, 0x08, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x0e, 0x0092}, + {0xa0, 0x04, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x0f, 0x0092}, + {0xa0, 0x18, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x10, 0x0092}, + {0xa0, 0x18, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x11, 0x0092}, + {0xa0, 0x18, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x12, 0x0092}, + {0xa0, 0x18, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x15, 0x0092}, + {0xa0, 0x00, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x16, 0x0092}, + {0xa0, 0x0c, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x17, 0x0092}, + {0xa0, 0x0c, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x18, 0x0092}, + {0xa0, 0x04, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0xb7, 0x0101}, + {0xa0, 0x05, 0x0012}, + {0xa0, 0x78, 0x018d}, + {0xa0, 0x0d, 0x0100}, + {0xa0, 0x06, 0x0189}, + {0xa0, 0x03, 0x01c5}, + {0xa0, 0x13, 0x01cb}, + {0xa0, 0x20, 0x0087}, + {0xa0, 0x21, 0x0088}, + {0xa0, 0x08, 0x0250}, + {0xa0, 0x08, 0x0301}, + {0xa0, 0x00, 0x01ad}, + {0xa0, 0x01, 0x01b1}, + {0xa0, 0x02, 0x0180}, + {0xa0, 0x60, 0x0116}, + {0xa0, 0x40, 0x0117}, + {0xa0, 0x4c, 0x0118}, + {0xa0, 0x03, 0x0008}, /* clock ? */ + {0xa0, 0x08, 0x01c6}, + {0xa0, 0x0f, 0x01cb}, + {0xa0, 0x13, 0x0120}, /* gamma 4 */ + {0xa0, 0x38, 0x0121}, + {0xa0, 0x59, 0x0122}, + {0xa0, 0x79, 0x0123}, + {0xa0, 0x92, 0x0124}, + {0xa0, 0xa7, 0x0125}, + {0xa0, 0xb9, 0x0126}, + {0xa0, 0xc8, 0x0127}, + {0xa0, 0xd4, 0x0128}, + {0xa0, 0xdf, 0x0129}, + {0xa0, 0xe7, 0x012a}, + {0xa0, 0xee, 0x012b}, + {0xa0, 0xf4, 0x012c}, + {0xa0, 0xf9, 0x012d}, + {0xa0, 0xfc, 0x012e}, + {0xa0, 0xff, 0x012f}, + {0xa0, 0x26, 0x0130}, + {0xa0, 0x22, 0x0131}, + {0xa0, 0x20, 0x0132}, + {0xa0, 0x1c, 0x0133}, + {0xa0, 0x16, 0x0134}, + {0xa0, 0x13, 0x0135}, + {0xa0, 0x10, 0x0136}, + {0xa0, 0x0d, 0x0137}, + {0xa0, 0x0b, 0x0138}, + {0xa0, 0x09, 0x0139}, + {0xa0, 0x07, 0x013a}, + {0xa0, 0x06, 0x013b}, + {0xa0, 0x05, 0x013c}, + {0xa0, 0x04, 0x013d}, + {0xa0, 0x03, 0x013e}, + {0xa0, 0x02, 0x013f}, + {0xa0, 0x58, 0x010a}, /* matrix */ + {0xa0, 0xf4, 0x010b}, + {0xa0, 0xf4, 0x010c}, + {0xa0, 0xf4, 0x010d}, + {0xa0, 0x58, 0x010e}, + {0xa0, 0xf4, 0x010f}, + {0xa0, 0xf4, 0x0110}, + {0xa0, 0xf4, 0x0111}, + {0xa0, 0x58, 0x0112}, + {0xa0, 0x00, 0x0180}, + {0xa0, 0x00, 0x0019}, + {0xa0, 0x18, 0x0092}, + {0xa0, 0x00, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x13, 0x0092}, + {0xa0, 0x22, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x14, 0x0092}, + {0xa0, 0x01, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x20, 0x0092}, + {0xa0, 0x01, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x21, 0x0092}, + {0xa0, 0x22, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x18, 0x0092}, + {0xa0, 0x04, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x01, 0x00a3}, + {0xa0, 0x22, 0x00a4}, + {0xa0, 0x00, 0x0190}, + {0xa0, 0x07, 0x0191}, + {0xa0, 0xee, 0x0192}, + {0xa0, 0x00, 0x0195}, + {0xa0, 0x00, 0x0196}, + {0xa0, 0x3a, 0x0197}, + {0xa0, 0x10, 0x018c}, + {0xa0, 0x20, 0x018f}, + {0xa0, 0x0c, 0x01a9}, + {0xa0, 0x28, 0x01aa}, + {0xa0, 0x04, 0x001d}, + {0xa0, 0x0f, 0x001e}, + {0xa0, 0x19, 0x001f}, + {0xa0, 0x1f, 0x0020}, + {0xa0, 0x60, 0x011d}, + {0xa0, 0x60, 0x011d}, + {0xa0, 0x42, 0x0180}, + {0xa0, 0x42, 0x0180}, + {0xa0, 0x60, 0x0116}, + {0xa0, 0x40, 0x0117}, + {0xa0, 0x4c, 0x0118}, + {0xa0, 0x04, 0x01a7}, + {0xa0, 0x20, 0x0092}, + {0xa0, 0x01, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x21, 0x0092}, + {0xa0, 0x5c, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x18, 0x0092}, + {0xa0, 0x00, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x13, 0x0092}, + {0xa0, 0x5c, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x14, 0x0092}, + {0xa0, 0x01, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x18, 0x0092}, + {0xa0, 0x04, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x00, 0x01a7}, + {0xa0, 0x04, 0x01a7}, + {0xa0, 0x00, 0x01a7}, + {0xa0, 0x04, 0x01a7}, + {0xa0, 0x20, 0x0092}, + {0xa0, 0x01, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x21, 0x0092}, + {0xa0, 0x96, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x18, 0x0092}, + {0xa0, 0x00, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x13, 0x0092}, + {0xa0, 0x96, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x14, 0x0092}, + {0xa0, 0x01, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x18, 0x0092}, + {0xa0, 0x04, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x00, 0x01a7}, + {0xa0, 0x04, 0x01a7}, + {0xa0, 0x00, 0x01a7}, + {0, 0, 0} +}; + +static struct usb_action cs2102K_InitialScale[] = { + {0xa0, 0x11, 0x0002}, + {0xa0, 0x00, 0x0002}, + {0xa0, 0x03, 0x0008}, + {0xa0, 0x08, 0x0010}, + {0xa0, 0x02, 0x0003}, + {0xa0, 0x80, 0x0004}, + {0xa0, 0x01, 0x0005}, + {0xa0, 0xe0, 0x0006}, + {0xa0, 0x01, 0x0001}, + {0xa0, 0x03, 0x0012}, + {0xa0, 0x01, 0x0012}, + {0xa0, 0x00, 0x0098}, + {0xa0, 0x00, 0x009a}, + {0xa0, 0x00, 0x011a}, + {0xa0, 0x00, 0x011c}, + {0xa0, 0xe8, 0x009c}, + {0xa0, 0x88, 0x009e}, + {0xa0, 0x55, 0x008b}, + {0xa0, 0x18, 0x0092}, + {0xa0, 0x00, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x0a, 0x0092}, + {0xa0, 0x02, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x0b, 0x0092}, + {0xa0, 0x02, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x0c, 0x0092}, + {0xa0, 0x7b, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x0d, 0x0092}, + {0xa0, 0xa3, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x03, 0x0092}, + {0xa0, 0xfb, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x05, 0x0092}, + {0xa0, 0x00, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x06, 0x0092}, + {0xa0, 0x03, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x09, 0x0092}, + {0xa0, 0x08, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x0e, 0x0092}, + {0xa0, 0x04, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x0f, 0x0092}, + {0xa0, 0x18, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x10, 0x0092}, + {0xa0, 0x18, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x11, 0x0092}, + {0xa0, 0x18, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x12, 0x0092}, + {0xa0, 0x18, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x15, 0x0092}, + {0xa0, 0x00, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x16, 0x0092}, + {0xa0, 0x0c, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x17, 0x0092}, + {0xa0, 0x0c, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x18, 0x0092}, + {0xa0, 0x04, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0xf7, 0x0101}, + {0xa0, 0x05, 0x0012}, + {0xa0, 0x78, 0x018d}, + {0xa0, 0x0d, 0x0100}, + {0xa0, 0x06, 0x0189}, + {0xa0, 0x03, 0x01c5}, + {0xa0, 0x13, 0x01cb}, + {0xa0, 0x20, 0x0087}, + {0xa0, 0x21, 0x0088}, + {0xa0, 0x08, 0x0250}, + {0xa0, 0x08, 0x0301}, + {0xa0, 0x00, 0x01ad}, + {0xa0, 0x01, 0x01b1}, + {0xa0, 0x02, 0x0180}, + {0xa0, 0x60, 0x0116}, + {0xa0, 0x40, 0x0117}, + {0xa0, 0x4c, 0x0118}, + {0xa0, 0x03, 0x0008}, /* clock ? */ + {0xa0, 0x08, 0x01c6}, + {0xa0, 0x0f, 0x01cb}, + {0xa0, 0x13, 0x0120}, /* gamma 4 */ + {0xa0, 0x38, 0x0121}, + {0xa0, 0x59, 0x0122}, + {0xa0, 0x79, 0x0123}, + {0xa0, 0x92, 0x0124}, + {0xa0, 0xa7, 0x0125}, + {0xa0, 0xb9, 0x0126}, + {0xa0, 0xc8, 0x0127}, + {0xa0, 0xd4, 0x0128}, + {0xa0, 0xdf, 0x0129}, + {0xa0, 0xe7, 0x012a}, + {0xa0, 0xee, 0x012b}, + {0xa0, 0xf4, 0x012c}, + {0xa0, 0xf9, 0x012d}, + {0xa0, 0xfc, 0x012e}, + {0xa0, 0xff, 0x012f}, + {0xa0, 0x26, 0x0130}, + {0xa0, 0x22, 0x0131}, + {0xa0, 0x20, 0x0132}, + {0xa0, 0x1c, 0x0133}, + {0xa0, 0x16, 0x0134}, + {0xa0, 0x13, 0x0135}, + {0xa0, 0x10, 0x0136}, + {0xa0, 0x0d, 0x0137}, + {0xa0, 0x0b, 0x0138}, + {0xa0, 0x09, 0x0139}, + {0xa0, 0x07, 0x013a}, + {0xa0, 0x06, 0x013b}, + {0xa0, 0x05, 0x013c}, + {0xa0, 0x04, 0x013d}, + {0xa0, 0x03, 0x013e}, + {0xa0, 0x02, 0x013f}, + {0xa0, 0x58, 0x010a}, /* matrix */ + {0xa0, 0xf4, 0x010b}, + {0xa0, 0xf4, 0x010c}, + {0xa0, 0xf4, 0x010d}, + {0xa0, 0x58, 0x010e}, + {0xa0, 0xf4, 0x010f}, + {0xa0, 0xf4, 0x0110}, + {0xa0, 0xf4, 0x0111}, + {0xa0, 0x58, 0x0112}, + {0xa0, 0x00, 0x0180}, + {0xa0, 0x00, 0x0019}, + {0xa0, 0x18, 0x0092}, + {0xa0, 0x00, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x13, 0x0092}, + {0xa0, 0x22, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x14, 0x0092}, + {0xa0, 0x01, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x20, 0x0092}, + {0xa0, 0x01, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x21, 0x0092}, + {0xa0, 0x22, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x18, 0x0092}, + {0xa0, 0x04, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x01, 0x00a3}, + {0xa0, 0x22, 0x00a4}, + {0xa0, 0x00, 0x0190}, + {0xa0, 0x07, 0x0191}, + {0xa0, 0xee, 0x0192}, + {0xa0, 0x00, 0x0195}, + {0xa0, 0x00, 0x0196}, + {0xa0, 0x3a, 0x0197}, + {0xa0, 0x10, 0x018c}, + {0xa0, 0x20, 0x018f}, + {0xa0, 0x0c, 0x01a9}, + {0xa0, 0x28, 0x01aa}, + {0xa0, 0x04, 0x001d}, + {0xa0, 0x0f, 0x001e}, + {0xa0, 0x19, 0x001f}, + {0xa0, 0x1f, 0x0020}, + {0xa0, 0x60, 0x011d}, + {0xa0, 0x60, 0x011d}, + {0xa0, 0x42, 0x0180}, + {0xa0, 0x42, 0x0180}, + {0xa0, 0x60, 0x0116}, + {0xa0, 0x40, 0x0117}, + {0xa0, 0x4c, 0x0118}, + {0xa0, 0x01, 0x0000}, + {0xa0, 0x01, 0x0000}, + {0xa0, 0x00, 0x0002}, + {0xa0, 0x03, 0x0008}, + {0xa0, 0x08, 0x0010}, + {0xa0, 0x02, 0x0003}, + {0xa0, 0x80, 0x0004}, + {0xa0, 0x01, 0x0005}, + {0xa0, 0xe0, 0x0006}, + {0xa0, 0x01, 0x0001}, + {0xa0, 0x03, 0x0012}, + {0xa0, 0x01, 0x0012}, + {0xa0, 0x00, 0x0098}, + {0xa0, 0x00, 0x009a}, + {0xa0, 0x00, 0x011a}, + {0xa0, 0x00, 0x011c}, + {0xa0, 0xe8, 0x009c}, + {0xa0, 0x88, 0x009e}, + {0xa0, 0x55, 0x008b}, + {0xa0, 0x18, 0x0092}, + {0xa0, 0x00, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x0A, 0x0092}, + {0xa0, 0x02, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x0B, 0x0092}, + {0xa0, 0x02, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x0C, 0x0092}, + {0xa0, 0x7b, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x0D, 0x0092}, + {0xa0, 0xA3, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x03, 0x0092}, + {0xa0, 0xfb, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x05, 0x0092}, + {0xa0, 0x00, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x06, 0x0092}, + {0xa0, 0x03, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x09, 0x0092}, + {0xa0, 0x08, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x0E, 0x0092}, + {0xa0, 0x04, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x0f, 0x0092}, + {0xa0, 0x18, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x10, 0x0092}, + {0xa0, 0x18, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x11, 0x0092}, + {0xa0, 0x18, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x12, 0x0092}, + {0xa0, 0x18, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x15, 0x0092}, + {0xa0, 0x00, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x16, 0x0092}, + {0xa0, 0x0c, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x17, 0x0092}, + {0xa0, 0x0C, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x18, 0x0092}, + {0xa0, 0x04, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0xf7, 0x0101}, + {0xa0, 0x05, 0x0012}, + {0xa0, 0x78, 0x018d}, + {0xa0, 0x0d, 0x0100}, + {0xa0, 0x06, 0x0189}, + {0xa0, 0x03, 0x01c5}, + {0xa0, 0x13, 0x01cb}, + {0xa0, 0x20, 0x0087}, + {0xa0, 0x21, 0x0088}, + {0xa0, 0x08, 0x0250}, + {0xa0, 0x08, 0x0301}, + {0xa0, 0x00, 0x01ad}, + {0xa0, 0x01, 0x01b1}, + {0xa0, 0x02, 0x0180}, + {0xa0, 0x60, 0x0116}, + {0xa0, 0x40, 0x0117}, + {0xa0, 0x4c, 0x0118}, + {0xa0, 0x03, 0x0008}, /* clock ? */ + {0xa0, 0x08, 0x01c6}, + {0xa0, 0x0f, 0x01cb}, + {0xa0, 0x13, 0x0120}, /* gamma 4 */ + {0xa0, 0x38, 0x0121}, + {0xa0, 0x59, 0x0122}, + {0xa0, 0x79, 0x0123}, + {0xa0, 0x92, 0x0124}, + {0xa0, 0xa7, 0x0125}, + {0xa0, 0xb9, 0x0126}, + {0xa0, 0xc8, 0x0127}, + {0xa0, 0xd4, 0x0128}, + {0xa0, 0xdf, 0x0129}, + {0xa0, 0xe7, 0x012a}, + {0xa0, 0xee, 0x012b}, + {0xa0, 0xf4, 0x012c}, + {0xa0, 0xf9, 0x012d}, + {0xa0, 0xfc, 0x012e}, + {0xa0, 0xff, 0x012f}, + {0xa0, 0x26, 0x0130}, + {0xa0, 0x22, 0x0131}, + {0xa0, 0x20, 0x0132}, + {0xa0, 0x1c, 0x0133}, + {0xa0, 0x16, 0x0134}, + {0xa0, 0x13, 0x0135}, + {0xa0, 0x10, 0x0136}, + {0xa0, 0x0d, 0x0137}, + {0xa0, 0x0b, 0x0138}, + {0xa0, 0x09, 0x0139}, + {0xa0, 0x07, 0x013a}, + {0xa0, 0x06, 0x013b}, + {0xa0, 0x05, 0x013c}, + {0xa0, 0x04, 0x013d}, + {0xa0, 0x03, 0x013e}, + {0xa0, 0x02, 0x013f}, + {0xa0, 0x58, 0x010a}, /* matrix */ + {0xa0, 0xf4, 0x010b}, + {0xa0, 0xf4, 0x010c}, + {0xa0, 0xf4, 0x010d}, + {0xa0, 0x58, 0x010e}, + {0xa0, 0xf4, 0x010f}, + {0xa0, 0xf4, 0x0110}, + {0xa0, 0xf4, 0x0111}, + {0xa0, 0x58, 0x0112}, + {0xa0, 0x00, 0x0180}, + {0xa0, 0x00, 0x0019}, + {0xa0, 0x18, 0x0092}, + {0xa0, 0x00, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x13, 0x0092}, + {0xa0, 0x22, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x14, 0x0092}, + {0xa0, 0x01, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x20, 0x0092}, + {0xa0, 0x01, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x21, 0x0092}, + {0xa0, 0x22, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x18, 0x0092}, + {0xa0, 0x04, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x01, 0x00a3}, + {0xa0, 0x22, 0x00a4}, + {0xa0, 0x00, 0x0190}, + {0xa0, 0x07, 0x0191}, + {0xa0, 0xee, 0x0192}, + {0xa0, 0x00, 0x0195}, + {0xa0, 0x00, 0x0196}, + {0xa0, 0x3a, 0x0197}, + {0xa0, 0x10, 0x018c}, + {0xa0, 0x20, 0x018f}, + {0xa0, 0x0c, 0x01a9}, + {0xa0, 0x28, 0x01aa}, + {0xa0, 0x04, 0x001d}, + {0xa0, 0x0f, 0x001e}, + {0xa0, 0x19, 0x001f}, + {0xa0, 0x1f, 0x0020}, + {0xa0, 0x60, 0x011d}, + {0xa0, 0x60, 0x011d}, + {0xa0, 0x42, 0x0180}, + {0xa0, 0x42, 0x0180}, + {0xa0, 0x60, 0x0116}, + {0xa0, 0x40, 0x0117}, + {0xa0, 0x4c, 0x0118}, + {0xa0, 0x04, 0x01a7}, + {0xa0, 0x20, 0x0092}, + {0xa0, 0x01, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x21, 0x0092}, + {0xa0, 0x5c, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x18, 0x0092}, + {0xa0, 0x00, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x13, 0x0092}, + {0xa0, 0x5c, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x14, 0x0092}, + {0xa0, 0x01, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x18, 0x0092}, + {0xa0, 0x04, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x00, 0x01a7}, + {0xa0, 0x04, 0x01a7}, + {0xa0, 0x00, 0x01a7}, + {0xa0, 0x04, 0x01a7}, + {0xa0, 0x20, 0x0092}, + {0xa0, 0x01, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x21, 0x0092}, + {0xa0, 0x96, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x18, 0x0092}, + {0xa0, 0x00, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x13, 0x0092}, + {0xa0, 0x96, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x14, 0x0092}, + {0xa0, 0x01, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x18, 0x0092}, + {0xa0, 0x04, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x00, 0x01a7}, + {0xa0, 0x04, 0x01a7}, + {0xa0, 0x00, 0x01a7}, + {0xa0, 0x04, 0x01a7}, + {0xa0, 0x00, 0x01a7}, + {0xa0, 0x04, 0x01a7}, + {0xa0, 0x20, 0x0092}, + {0xa0, 0x01, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x21, 0x0092}, + {0xa0, 0xd0, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x18, 0x0092}, + {0xa0, 0x00, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x13, 0x0092}, + {0xa0, 0xd0, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x14, 0x0092}, + {0xa0, 0x01, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x18, 0x0092}, + {0xa0, 0x04, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x00, 0x01a7}, + {0xa0, 0x02, 0x0008}, + {0xa0, 0x04, 0x01a7}, + {0xa0, 0x00, 0x01a7}, + {0xa0, 0x04, 0x01a7}, + {0xa0, 0x20, 0x0092}, + {0xa0, 0x02, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x21, 0x0092}, + {0xa0, 0x0a, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x18, 0x0092}, + {0xa0, 0x00, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x13, 0x0092}, + {0xa0, 0x0a, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x14, 0x0092}, + {0xa0, 0x02, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x18, 0x0092}, + {0xa0, 0x04, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x00, 0x01a7}, + {0xa0, 0x04, 0x01a7}, + {0xa0, 0x00, 0x01a7}, + {0xa0, 0x04, 0x01a7}, + {0xa0, 0x20, 0x0092}, + {0xa0, 0x02, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x21, 0x0092}, + {0xa0, 0x44, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x18, 0x0092}, + {0xa0, 0x00, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x13, 0x0092}, + {0xa0, 0x44, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x14, 0x0092}, + {0xa0, 0x02, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x18, 0x0092}, + {0xa0, 0x04, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x00, 0x01a7}, + {0xa0, 0x04, 0x01a7}, + {0xa0, 0x00, 0x01a7}, + {0xa0, 0x04, 0x01a7}, + {0xa0, 0x20, 0x0092}, + {0xa0, 0x02, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x21, 0x0092}, + {0xa0, 0x7e, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x18, 0x0092}, + {0xa0, 0x00, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x13, 0x0092}, + {0xa0, 0x7e, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x14, 0x0092}, + {0xa0, 0x02, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x18, 0x0092}, + {0xa0, 0x04, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x00, 0x01a7}, + {0xa0, 0x04, 0x01a7}, + {0xa0, 0x00, 0x01a7}, + {0xa0, 0x04, 0x01a7}, + {0, 0, 0} +}; + +static struct usb_action gc0305_Initial[] = { /* 640x480 */ + {0xa0, 0x01, 0x0000}, /* 00,00,01,cc */ + {0xa0, 0x03, 0x0008}, /* 00,08,03,cc */ + {0xa0, 0x01, 0x0010}, /* 00,10,01,cc */ + {0xa0, 0x04, 0x0002}, /* 00,02,04,cc */ + {0xa0, 0x02, 0x0003}, /* 00,03,02,cc */ + {0xa0, 0x80, 0x0004}, /* 00,04,80,cc */ + {0xa0, 0x01, 0x0005}, /* 00,05,01,cc */ + {0xa0, 0xe0, 0x0006}, /* 00,06,e0,cc */ + {0xa0, 0x01, 0x0001}, /* 00,01,01,cc */ + {0xa0, 0x03, 0x0012}, /* 00,12,03,cc */ + {0xa0, 0x01, 0x0012}, /* 00,12,01,cc */ + {0xa0, 0x00, 0x0098}, /* 00,98,00,cc */ + {0xa0, 0x00, 0x009a}, /* 00,9a,00,cc */ + {0xa0, 0x00, 0x011a}, /* 01,1a,00,cc */ + {0xa0, 0x00, 0x011c}, /* 01,1c,00,cc */ + {0xa0, 0xe6, 0x009c}, /* 00,9c,e6,cc */ + {0xa0, 0x86, 0x009e}, /* 00,9e,86,cc */ + {0xa0, 0x98, 0x008b}, /* 00,8b,98,cc */ + {0xaa, 0x13, 0x0002}, /* 00,13,02,aa */ + {0xaa, 0x15, 0x0003}, /* 00,15,03,aa */ + {0xaa, 0x01, 0x0000}, /* 00,01,00,aa */ + {0xaa, 0x02, 0x0000}, /* 00,02,00,aa */ + {0xaa, 0x1a, 0x0000}, /* 00,1a,00,aa */ + {0xaa, 0x1c, 0x0017}, /* 00,1c,17,aa */ + {0xaa, 0x1d, 0x0080}, /* 00,1d,80,aa */ + {0xaa, 0x1f, 0x0008}, /* 00,1f,08,aa */ + {0xaa, 0x21, 0x0012}, /* 00,21,12,aa */ + {0xa0, 0x82, 0x0086}, /* 00,86,82,cc */ + {0xa0, 0x83, 0x0087}, /* 00,87,83,cc */ + {0xa0, 0x84, 0x0088}, /* 00,88,84,cc */ + {0xaa, 0x05, 0x0000}, /* 00,05,00,aa */ + {0xaa, 0x0a, 0x0000}, /* 00,0a,00,aa */ + {0xaa, 0x0b, 0x00b0}, /* 00,0b,b0,aa */ + {0xaa, 0x0c, 0x0000}, /* 00,0c,00,aa */ + {0xaa, 0x0d, 0x00b0}, /* 00,0d,b0,aa */ + {0xaa, 0x0e, 0x0000}, /* 00,0e,00,aa */ + {0xaa, 0x0f, 0x00b0}, /* 00,0f,b0,aa */ + {0xaa, 0x10, 0x0000}, /* 00,10,00,aa */ + {0xaa, 0x11, 0x00b0}, /* 00,11,b0,aa */ + {0xaa, 0x16, 0x0001}, /* 00,16,01,aa */ + {0xaa, 0x17, 0x00e6}, /* 00,17,e6,aa */ + {0xaa, 0x18, 0x0002}, /* 00,18,02,aa */ + {0xaa, 0x19, 0x0086}, /* 00,19,86,aa */ + {0xaa, 0x20, 0x0000}, /* 00,20,00,aa */ + {0xaa, 0x1b, 0x0020}, /* 00,1b,20,aa */ + {0xa0, 0xb7, 0x0101}, /* 01,01,b7,cc */ + {0xa0, 0x05, 0x0012}, /* 00,12,05,cc */ + {0xa0, 0x0d, 0x0100}, /* 01,00,0d,cc */ + {0xa0, 0x76, 0x0189}, /* 01,89,76,cc */ + {0xa0, 0x09, 0x01ad}, /* 01,ad,09,cc */ + {0xa0, 0x03, 0x01c5}, /* 01,c5,03,cc */ + {0xa0, 0x13, 0x01cb}, /* 01,cb,13,cc */ + {0xa0, 0x08, 0x0250}, /* 02,50,08,cc */ + {0xa0, 0x08, 0x0301}, /* 03,01,08,cc */ + {0xa0, 0x60, 0x01a8}, /* 01,a8,60,cc */ + {0xa0, 0x85, 0x018d}, /* 01,8d,85,cc */ + {0xa0, 0x00, 0x011e}, /* 01,1e,00,cc */ + {0xa0, 0x52, 0x0116}, /* 01,16,52,cc */ + {0xa0, 0x40, 0x0117}, /* 01,17,40,cc */ + {0xa0, 0x52, 0x0118}, /* 01,18,52,cc */ + {0xa0, 0x03, 0x0113}, /* 01,13,03,cc */ + {0,0,0} +}; +static struct usb_action gc0305_InitialScale[] = { /* 320x240 */ + {0xa0, 0x01, 0x0000}, /* 00,00,01,cc */ + {0xa0, 0x03, 0x0008}, /* 00,08,03,cc */ + {0xa0, 0x01, 0x0010}, /* 00,10,01,cc */ + {0xa0, 0x10, 0x0002}, /* 00,02,10,cc */ + {0xa0, 0x02, 0x0003}, /* 00,03,02,cc */ + {0xa0, 0x80, 0x0004}, /* 00,04,80,cc */ + {0xa0, 0x01, 0x0005}, /* 00,05,01,cc */ + {0xa0, 0xe0, 0x0006}, /* 00,06,e0,cc */ + {0xa0, 0x01, 0x0001}, /* 00,01,01,cc */ + {0xa0, 0x03, 0x0012}, /* 00,12,03,cc */ + {0xa0, 0x01, 0x0012}, /* 00,12,01,cc */ + {0xa0, 0x00, 0x0098}, /* 00,98,00,cc */ + {0xa0, 0x00, 0x009a}, /* 00,9a,00,cc */ + {0xa0, 0x00, 0x011a}, /* 01,1a,00,cc */ + {0xa0, 0x00, 0x011c}, /* 01,1c,00,cc */ + {0xa0, 0xe8, 0x009c}, /* 00,9c,e8,cc */ + {0xa0, 0x88, 0x009e}, /* 00,9e,88,cc */ + {0xa0, 0x98, 0x008b}, /* 00,8b,98,cc */ + {0xaa, 0x13, 0x0000}, /* 00,13,00,aa */ + {0xaa, 0x15, 0x0001}, /* 00,15,01,aa */ + {0xaa, 0x01, 0x0000}, /* 00,01,00,aa */ + {0xaa, 0x02, 0x0000}, /* 00,02,00,aa */ + {0xaa, 0x1a, 0x0000}, /* 00,1a,00,aa */ + {0xaa, 0x1c, 0x0017}, /* 00,1c,17,aa */ + {0xaa, 0x1d, 0x0080}, /* 00,1d,80,aa */ + {0xaa, 0x1f, 0x0008}, /* 00,1f,08,aa */ + {0xaa, 0x21, 0x0012}, /* 00,21,12,aa */ + {0xa0, 0x82, 0x0086}, /* 00,86,82,cc */ + {0xa0, 0x83, 0x0087}, /* 00,87,83,cc */ + {0xa0, 0x84, 0x0088}, /* 00,88,84,cc */ + {0xaa, 0x05, 0x0000}, /* 00,05,00,aa */ + {0xaa, 0x0a, 0x0000}, /* 00,0a,00,aa */ + {0xaa, 0x0b, 0x00b0}, /* 00,0b,b0,aa */ + {0xaa, 0x0c, 0x0000}, /* 00,0c,00,aa */ + {0xaa, 0x0d, 0x00b0}, /* 00,0d,b0,aa */ + {0xaa, 0x0e, 0x0000}, /* 00,0e,00,aa */ + {0xaa, 0x0f, 0x00b0}, /* 00,0f,b0,aa */ + {0xaa, 0x10, 0x0000}, /* 00,10,00,aa */ + {0xaa, 0x11, 0x00b0}, /* 00,11,b0,aa */ + {0xaa, 0x16, 0x0001}, /* 00,16,01,aa */ + {0xaa, 0x17, 0x00e8}, /* 00,17,e8,aa */ + {0xaa, 0x18, 0x0002}, /* 00,18,02,aa */ + {0xaa, 0x19, 0x0088}, /* 00,19,88,aa */ + {0xaa, 0x20, 0x0000}, /* 00,20,00,aa */ + {0xaa, 0x1b, 0x0020}, /* 00,1b,20,aa */ + {0xa0, 0xb7, 0x0101}, /* 01,01,b7,cc */ + {0xa0, 0x05, 0x0012}, /* 00,12,05,cc */ + {0xa0, 0x0d, 0x0100}, /* 01,00,0d,cc */ + {0xa0, 0x76, 0x0189}, /* 01,89,76,cc */ + {0xa0, 0x09, 0x01ad}, /* 01,ad,09,cc */ + {0xa0, 0x03, 0x01c5}, /* 01,c5,03,cc */ + {0xa0, 0x13, 0x01cb}, /* 01,cb,13,cc */ + {0xa0, 0x08, 0x0250}, /* 02,50,08,cc */ + {0xa0, 0x08, 0x0301}, /* 03,01,08,cc */ + {0xa0, 0x60, 0x01a8}, /* 01,a8,60,cc */ + {0xa0, 0x00, 0x011e}, /* 01,1e,00,cc */ + {0xa0, 0x52, 0x0116}, /* 01,16,52,cc */ + {0xa0, 0x40, 0x0117}, /* 01,17,40,cc */ + {0xa0, 0x52, 0x0118}, /* 01,18,52,cc */ + {0xa0, 0x03, 0x0113}, /* 01,13,03,cc */ + {0,0,0} +}; +static struct usb_action gc0305_50HZ[] = { + {0xaa, 0x82, 0x0000}, /* 00,82,00,aa */ + {0xaa, 0x83, 0x0002}, /* 00,83,02,aa */ + {0xaa, 0x84, 0x0038}, /* 00,84,38,aa */ /* win: 00,84,ec */ + {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ + {0xa0, 0x0b, 0x0191}, /* 01,91,0b,cc */ + {0xa0, 0x18, 0x0192}, /* 01,92,18,cc */ /* win: 01,92,10 */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */ + {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */ + {0xa0, 0x8e, 0x0197}, /* 01,97,8e,cc */ /* win: 01,97,ec */ + {0xa0, 0x0e, 0x018c}, /* 01,8c,0e,cc */ + {0xa0, 0x15, 0x018f}, /* 01,8f,15,cc */ + {0xa0, 0x10, 0x01a9}, /* 01,a9,10,cc */ + {0xa0, 0x24, 0x01aa}, /* 01,aa,24,cc */ + {0xa0, 0x62, 0x001d}, /* 00,1d,62,cc */ + {0xa0, 0x90, 0x001e}, /* 00,1e,90,cc */ + {0xa0, 0xc8, 0x001f}, /* 00,1f,c8,cc */ + {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc */ + {0xa0, 0x60, 0x011d}, /* 01,1d,60,cc */ + {0xa0, 0x42, 0x0180}, /* 01,80,42,cc */ +/* {0xa0, 0x85, 0x018d}, * 01,8d,85,cc * * if 640x480 */ + {0,0,0} +}; +static struct usb_action gc0305_60HZ[] = { + {0xaa, 0x82, 0x0000}, /* 00,82,00,aa */ + {0xaa, 0x83, 0x0000}, /* 00,83,00,aa */ + {0xaa, 0x84, 0x00ec}, /* 00,84,ec,aa */ + {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ + {0xa0, 0x0b, 0x0191}, /* 01,91,0b,cc */ + {0xa0, 0x10, 0x0192}, /* 01,92,10,cc */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */ + {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */ + {0xa0, 0xec, 0x0197}, /* 01,97,ec,cc */ + {0xa0, 0x0e, 0x018c}, /* 01,8c,0e,cc */ + {0xa0, 0x15, 0x018f}, /* 01,8f,15,cc */ + {0xa0, 0x10, 0x01a9}, /* 01,a9,10,cc */ + {0xa0, 0x24, 0x01aa}, /* 01,aa,24,cc */ + {0xa0, 0x62, 0x001d}, /* 00,1d,62,cc */ + {0xa0, 0x90, 0x001e}, /* 00,1e,90,cc */ + {0xa0, 0xc8, 0x001f}, /* 00,1f,c8,cc */ + {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc */ + {0xa0, 0x60, 0x011d}, /* 01,1d,60,cc */ + {0xa0, 0x42, 0x0180}, /* 01,80,42,cc */ + {0xa0, 0x80, 0x018d}, /* 01,8d,80,cc */ + {0,0,0} +}; + +static struct usb_action gc0305_NoFliker[] = { + {0xa0, 0x0c, 0x0100}, /* 01,00,0c,cc */ + {0xaa, 0x82, 0x0000}, /* 00,82,00,aa */ + {0xaa, 0x83, 0x0000}, /* 00,83,00,aa */ + {0xaa, 0x84, 0x0020}, /* 00,84,20,aa */ + {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ + {0xa0, 0x00, 0x0191}, /* 01,91,00,cc */ + {0xa0, 0x48, 0x0192}, /* 01,92,48,cc */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */ + {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */ + {0xa0, 0x10, 0x0197}, /* 01,97,10,cc */ + {0xa0, 0x0e, 0x018c}, /* 01,8c,0e,cc */ + {0xa0, 0x15, 0x018f}, /* 01,8f,15,cc */ + {0xa0, 0x62, 0x001d}, /* 00,1d,62,cc */ + {0xa0, 0x90, 0x001e}, /* 00,1e,90,cc */ + {0xa0, 0xc8, 0x001f}, /* 00,1f,c8,cc */ + {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc */ + {0xa0, 0x60, 0x011d}, /* 01,1d,60,cc */ + {0xa0, 0x03, 0x0180}, /* 01,80,03,cc */ + {0xa0, 0x80, 0x018d}, /* 01,8d,80,cc */ + {0,0,0} +}; + +/* play poker with registers at your own risk !! */ +static struct usb_action hdcs2020xx_Initial[] = { + {0xa0, 0x01, 0x0000}, + {0xa0, 0x03, 0x0008}, + {0xa0, 0x0e, 0x0010}, + {0xa0, 0x10, 0x0002}, + {0xa0, 0x02, 0x0003}, + {0xa0, 0x80, 0x0004}, + {0xa0, 0x01, 0x0005}, + {0xa0, 0xd0, 0x0006}, /* D0 ?? E0 did not start */ + {0xa0, 0x01, 0x0001}, + {0xa0, 0x03, 0x0012}, + {0xa0, 0x01, 0x0012}, + {0xa0, 0x08, 0x008d}, + {0xa0, 0x08, 0x0098}, + {0xa0, 0x02, 0x009a}, + {0xa0, 0x08, 0x011a}, + {0xa0, 0x02, 0x011c}, + {0xa0, 0x01, 0x009b}, + {0xa0, 0xd8, 0x009c}, + {0xa0, 0x02, 0x009d}, + {0xa0, 0x88, 0x009e}, + {0xaa, 0x02, 0x0002}, + {0xaa, 0x07, 0x0006}, + {0xaa, 0x08, 0x0002}, + {0xaa, 0x09, 0x0006}, + {0xaa, 0x0a, 0x0001}, + {0xaa, 0x0b, 0x0001}, + {0xaa, 0x0c, 0x0008}, + {0xaa, 0x0d, 0x0000}, + {0xaa, 0x10, 0x0000}, + {0xaa, 0x12, 0x0005}, + {0xaa, 0x13, 0x0063}, + {0xaa, 0x15, 0x0070}, + {0xa0, 0x37, 0x0101}, + {0xa0, 0x0d, 0x0100}, + {0xa0, 0x06, 0x0189}, + {0xa0, 0x00, 0x01ad}, + {0xa0, 0x03, 0x01c5}, + {0xa0, 0x13, 0x01cb}, + {0xa0, 0x08, 0x0250}, + {0xa0, 0x08, 0x0301}, + {0xa0, 0x70, 0x018d}, + {0xa1, 0x01, 0x0002}, + {0xa1, 0x01, 0x0008}, + {0xa0, 0x03, 0x0008}, /* clock ? */ + {0xa0, 0x04, 0x01c6}, + {0xa1, 0x01, 0x01c8}, + {0xa1, 0x01, 0x01c9}, + {0xa1, 0x01, 0x01ca}, + {0xa0, 0x07, 0x01cb}, + {0xa0, 0x11, 0x0120}, /* gamma ~4 */ + {0xa0, 0x37, 0x0121}, + {0xa0, 0x58, 0x0122}, + {0xa0, 0x79, 0x0123}, + {0xa0, 0x91, 0x0124}, + {0xa0, 0xa6, 0x0125}, + {0xa0, 0xb8, 0x0126}, + {0xa0, 0xc7, 0x0127}, + {0xa0, 0xd3, 0x0128}, + {0xa0, 0xde, 0x0129}, + {0xa0, 0xe6, 0x012a}, + {0xa0, 0xed, 0x012b}, + {0xa0, 0xf3, 0x012c}, + {0xa0, 0xf8, 0x012d}, + {0xa0, 0xfb, 0x012e}, + {0xa0, 0xff, 0x012f}, + {0xa0, 0x26, 0x0130}, + {0xa0, 0x23, 0x0131}, + {0xa0, 0x20, 0x0132}, + {0xa0, 0x1c, 0x0133}, + {0xa0, 0x16, 0x0134}, + {0xa0, 0x13, 0x0135}, + {0xa0, 0x10, 0x0136}, + {0xa0, 0x0d, 0x0137}, + {0xa0, 0x0b, 0x0138}, + {0xa0, 0x09, 0x0139}, + {0xa0, 0x07, 0x013a}, + {0xa0, 0x06, 0x013b}, + {0xa0, 0x05, 0x013c}, + {0xa0, 0x04, 0x013d}, + {0xa0, 0x03, 0x013e}, + {0xa0, 0x02, 0x013f}, + + {0xa0, 0x4c, 0x010a}, /* matrix */ + {0xa0, 0xf5, 0x010b}, + {0xa0, 0xff, 0x010c}, + {0xa0, 0xf9, 0x010d}, + {0xa0, 0x51, 0x010e}, + {0xa0, 0xf5, 0x010f}, + {0xa0, 0xfb, 0x0110}, + {0xa0, 0xed, 0x0111}, + {0xa0, 0x5f, 0x0112}, + + {0xa1, 0x01, 0x0180}, + {0xa0, 0x00, 0x0180}, + {0xa0, 0x00, 0x0019}, + {0xa0, 0x20, 0x0087}, + {0xa0, 0x21, 0x0088}, + {0xaa, 0x20, 0x0004}, + {0xaa, 0x21, 0x003d}, + {0xaa, 0x03, 0x0041}, + {0xaa, 0x04, 0x0010}, + {0xaa, 0x05, 0x003d}, + {0xaa, 0x0e, 0x0001}, + {0xaa, 0x0f, 0x0000}, + {0xa0, 0x14, 0x01a9}, + {0xa0, 0x24, 0x01aa}, + {0xa0, 0x00, 0x0190}, + {0xa0, 0x04, 0x0191}, + {0xa0, 0x3d, 0x0192}, + {0xa0, 0x00, 0x0195}, + {0xa0, 0x00, 0x0196}, + {0xa0, 0x9b, 0x0197}, + {0xa0, 0x10, 0x018c}, + {0xa0, 0x20, 0x018f}, + {0xa0, 0x41, 0x001d}, + {0xa0, 0x6f, 0x001e}, + {0xa0, 0xad, 0x001f}, + {0xa0, 0xff, 0x0020}, + {0xa0, 0x0f, 0x0087}, + {0xa0, 0x0e, 0x0088}, + {0xa0, 0x40, 0x0180}, + {0xa1, 0x01, 0x0195}, + {0xa1, 0x01, 0x0196}, + {0xa1, 0x01, 0x0197}, + {0xa0, 0x3d, 0x0192}, + {0xa0, 0x04, 0x0191}, + {0xa0, 0x00, 0x0190}, + {0xa0, 0x1d, 0x0116}, + {0xa0, 0x40, 0x0117}, + {0xa0, 0x85, 0x0118}, + {0xa1, 0x01, 0x0116}, + {0xa1, 0x01, 0x0118}, + {0xa1, 0x01, 0x0180}, + {0xa0, 0x42, 0x0180}, + {0xa0, 0x1d, 0x0116}, + {0xa0, 0x40, 0x0117}, + {0xa0, 0x85, 0x0118}, + {0xa1, 0x01, 0x0116}, + {0xa1, 0x01, 0x0118}, +/* {0xa0, 0x02, 0x0008}, */ + {0xa0, 0x00, 0x0007}, + {0, 0, 0} +}; + +static struct usb_action hdcs2020xx_InitialScale[] = { + {0xa0, 0x01, 0x0000}, + {0xa0, 0x03, 0x0008}, + {0xa0, 0x0e, 0x0010}, + {0xa0, 0x00, 0x0002}, + {0xa0, 0x02, 0x0003}, + {0xa0, 0x80, 0x0004}, + {0xa0, 0x01, 0x0005}, + {0xa0, 0xe0, 0x0006}, + {0xa0, 0x01, 0x0001}, + {0xa0, 0x03, 0x0012}, + {0xa0, 0x01, 0x0012}, + {0xa0, 0x08, 0x008d}, + {0xa0, 0x00, 0x0098}, + {0xa0, 0x03, 0x009a}, + {0xa0, 0x00, 0x011a}, + {0xa0, 0x03, 0x011c}, + {0xa0, 0x01, 0x009b}, + {0xa0, 0xe6, 0x009c}, + {0xa0, 0x02, 0x009d}, + {0xa0, 0x86, 0x009e}, + {0xaa, 0x02, 0x0002}, + {0xaa, 0x07, 0x0006}, + {0xaa, 0x08, 0x0002}, + {0xaa, 0x09, 0x0006}, + {0xaa, 0x0a, 0x0001}, + {0xaa, 0x0b, 0x0001}, + {0xaa, 0x0c, 0x0008}, + {0xaa, 0x0d, 0x0000}, + {0xaa, 0x10, 0x0000}, + {0xaa, 0x12, 0x0005}, + {0xaa, 0x13, 0x0063}, + {0xaa, 0x15, 0x0070}, + {0xa0, 0xb7, 0x0101}, + {0xa0, 0x0d, 0x0100}, + {0xa0, 0x06, 0x0189}, + {0xa0, 0x00, 0x01ad}, + {0xa0, 0x03, 0x01c5}, + {0xa0, 0x13, 0x01cb}, + {0xa0, 0x08, 0x0250}, + {0xa0, 0x08, 0x0301}, + {0xa0, 0x70, 0x018d}, + {0xa1, 0x01, 0x0002}, + {0xa1, 0x01, 0x0008}, + {0xa0, 0x03, 0x0008}, /* clock ? */ + {0xa0, 0x04, 0x01c6}, + {0xa1, 0x01, 0x01c8}, + {0xa1, 0x01, 0x01c9}, + {0xa1, 0x01, 0x01ca}, + {0xa0, 0x07, 0x01cb}, + {0xa0, 0x11, 0x0120}, /* gamma ~4*/ + {0xa0, 0x37, 0x0121}, + {0xa0, 0x58, 0x0122}, + {0xa0, 0x79, 0x0123}, + {0xa0, 0x91, 0x0124}, + {0xa0, 0xa6, 0x0125}, + {0xa0, 0xb8, 0x0126}, + {0xa0, 0xc7, 0x0127}, + {0xa0, 0xd3, 0x0128}, + {0xa0, 0xde, 0x0129}, + {0xa0, 0xe6, 0x012a}, + {0xa0, 0xed, 0x012b}, + {0xa0, 0xf3, 0x012c}, + {0xa0, 0xf8, 0x012d}, + {0xa0, 0xfb, 0x012e}, + {0xa0, 0xff, 0x012f}, + {0xa0, 0x26, 0x0130}, + {0xa0, 0x23, 0x0131}, + {0xa0, 0x20, 0x0132}, + {0xa0, 0x1c, 0x0133}, + {0xa0, 0x16, 0x0134}, + {0xa0, 0x13, 0x0135}, + {0xa0, 0x10, 0x0136}, + {0xa0, 0x0d, 0x0137}, + {0xa0, 0x0b, 0x0138}, + {0xa0, 0x09, 0x0139}, + {0xa0, 0x07, 0x013a}, + {0xa0, 0x06, 0x013b}, + {0xa0, 0x05, 0x013c}, + {0xa0, 0x04, 0x013d}, + {0xa0, 0x03, 0x013e}, + {0xa0, 0x02, 0x013f}, + {0xa0, 0x60, 0x010a}, /* matrix */ + {0xa0, 0xff, 0x010b}, + {0xa0, 0xff, 0x010c}, + {0xa0, 0xff, 0x010d}, + {0xa0, 0x60, 0x010e}, + {0xa0, 0xff, 0x010f}, + {0xa0, 0xff, 0x0110}, + {0xa0, 0xff, 0x0111}, + {0xa0, 0x60, 0x0112}, + + {0xa1, 0x01, 0x0180}, + {0xa0, 0x00, 0x0180}, + {0xa0, 0x00, 0x0019}, + {0xa0, 0x20, 0x0087}, + {0xa0, 0x21, 0x0088}, + {0xaa, 0x20, 0x0002}, + {0xaa, 0x21, 0x001b}, + {0xaa, 0x03, 0x0044}, + {0xaa, 0x04, 0x0008}, + {0xaa, 0x05, 0x001b}, + {0xaa, 0x0e, 0x0001}, + {0xaa, 0x0f, 0x0000}, + {0xa0, 0x14, 0x01a9}, + {0xa0, 0x24, 0x01aa}, + {0xa0, 0x00, 0x0190}, + {0xa0, 0x02, 0x0191}, + {0xa0, 0x1b, 0x0192}, + {0xa0, 0x00, 0x0195}, + {0xa0, 0x00, 0x0196}, + {0xa0, 0x4d, 0x0197}, + {0xa0, 0x10, 0x018c}, + {0xa0, 0x20, 0x018f}, + {0xa0, 0x44, 0x001d}, + {0xa0, 0x6f, 0x001e}, + {0xa0, 0xad, 0x001f}, + {0xa0, 0xeb, 0x0020}, + {0xa0, 0x0f, 0x0087}, + {0xa0, 0x0e, 0x0088}, + {0xa0, 0x40, 0x0180}, + {0xa1, 0x01, 0x0195}, + {0xa1, 0x01, 0x0196}, + {0xa1, 0x01, 0x0197}, + {0xa0, 0x1b, 0x0192}, + {0xa0, 0x02, 0x0191}, + {0xa0, 0x00, 0x0190}, + {0xa0, 0x1d, 0x0116}, + {0xa0, 0x40, 0x0117}, + {0xa0, 0x99, 0x0118}, + {0xa1, 0x01, 0x0116}, + {0xa1, 0x01, 0x0118}, + {0xa1, 0x01, 0x0180}, + {0xa0, 0x42, 0x0180}, + {0xa0, 0x1d, 0x0116}, + {0xa0, 0x40, 0x0117}, + {0xa0, 0x99, 0x0118}, +/* {0xa0, 0x02, 0x0008}, */ + {0xa0, 0x00, 0x0007}, +/* {0xa0, 0x18, 0x00fe}, */ + {0, 0, 0} +}; +static struct usb_action hdcs2020xb_Initial[] = { + {0xa0, 0x01, 0x0000}, + {0xa0, 0x11, 0x0002}, + {0xa0, 0x03, 0x0008}, /* qtable 0x05 */ + {0xa0, 0x08, 0x0010}, + {0xa0, 0x02, 0x0003}, + {0xa0, 0x80, 0x0004}, + {0xa0, 0x01, 0x0005}, + {0xa0, 0xe0, 0x0006}, + {0xa0, 0x01, 0x0001}, + {0xa0, 0x03, 0x0012}, + {0xa0, 0x01, 0x0012}, + {0xa0, 0x00, 0x0098}, + {0xa0, 0x00, 0x009a}, + {0xa0, 0x00, 0x011a}, + {0xa0, 0x00, 0x011c}, + {0xa0, 0xe8, 0x009c}, + {0xa0, 0x88, 0x009e}, + {0xaa, 0x1c, 0x0000}, + {0xaa, 0x0a, 0x0001}, + {0xaa, 0x0b, 0x0006}, + {0xaa, 0x0c, 0x007b}, + {0xaa, 0x0d, 0x00a7}, + {0xaa, 0x03, 0x00fb}, + {0xaa, 0x05, 0x0000}, + {0xaa, 0x06, 0x0003}, + {0xaa, 0x09, 0x0008}, + + {0xaa, 0x0f, 0x0018}, /* set sensor gain */ + {0xaa, 0x10, 0x0018}, + {0xaa, 0x11, 0x0018}, + {0xaa, 0x12, 0x0018}, + + {0xaa, 0x15, 0x004e}, + {0xaa, 0x1c, 0x0004}, + {0xa0, 0xb7, 0x0101}, + {0xa0, 0x05, 0x0012}, + {0xa0, 0x70, 0x018d}, + {0xa0, 0x0d, 0x0100}, + {0xa0, 0x06, 0x0189}, + {0xa0, 0x03, 0x01c5}, + {0xa0, 0x13, 0x01cb}, + {0xa0, 0x08, 0x0250}, + {0xa0, 0x08, 0x0301}, + {0xa1, 0x01, 0x0002}, + {0xa1, 0x01, 0x0008}, + {0xa1, 0x01, 0x0180}, + {0xa0, 0x02, 0x0180}, + {0xa0, 0x40, 0x0116}, + {0xa0, 0x40, 0x0117}, + {0xa0, 0x40, 0x0118}, + {0xa1, 0x01, 0x0008}, + {0xa0, 0x03, 0x0008}, /* clock ? */ + {0xa0, 0x08, 0x01c6}, + {0xa1, 0x01, 0x01c8}, + {0xa1, 0x01, 0x01c9}, + {0xa1, 0x01, 0x01ca}, + {0xa0, 0x0f, 0x01cb}, + {0xa0, 0x13, 0x0120}, /* gamma 4 */ + {0xa0, 0x38, 0x0121}, + {0xa0, 0x59, 0x0122}, + {0xa0, 0x79, 0x0123}, + {0xa0, 0x92, 0x0124}, + {0xa0, 0xa7, 0x0125}, + {0xa0, 0xb9, 0x0126}, + {0xa0, 0xc8, 0x0127}, + {0xa0, 0xd4, 0x0128}, + {0xa0, 0xdf, 0x0129}, + {0xa0, 0xe7, 0x012a}, + {0xa0, 0xee, 0x012b}, + {0xa0, 0xf4, 0x012c}, + {0xa0, 0xf9, 0x012d}, + {0xa0, 0xfc, 0x012e}, + {0xa0, 0xff, 0x012f}, + {0xa0, 0x26, 0x0130}, + {0xa0, 0x22, 0x0131}, + {0xa0, 0x20, 0x0132}, + {0xa0, 0x1c, 0x0133}, + {0xa0, 0x16, 0x0134}, + {0xa0, 0x13, 0x0135}, + {0xa0, 0x10, 0x0136}, + {0xa0, 0x0d, 0x0137}, + {0xa0, 0x0b, 0x0138}, + {0xa0, 0x09, 0x0139}, + {0xa0, 0x07, 0x013a}, + {0xa0, 0x06, 0x013b}, + {0xa0, 0x05, 0x013c}, + {0xa0, 0x04, 0x013d}, + {0xa0, 0x03, 0x013e}, + {0xa0, 0x02, 0x013f}, + + {0xa0, 0x66, 0x010a}, /* matrix */ + {0xa0, 0xed, 0x010b}, + {0xa0, 0xed, 0x010c}, + {0xa0, 0xed, 0x010d}, + {0xa0, 0x66, 0x010e}, + {0xa0, 0xed, 0x010f}, + {0xa0, 0xed, 0x0110}, + {0xa0, 0xed, 0x0111}, + {0xa0, 0x66, 0x0112}, + + {0xa1, 0x01, 0x0180}, + {0xa0, 0x00, 0x0180}, + {0xa0, 0x00, 0x0019}, + {0xaa, 0x13, 0x0031}, + {0xaa, 0x14, 0x0001}, + {0xaa, 0x0e, 0x0004}, + {0xaa, 0x19, 0x00cd}, + {0xa0, 0x00, 0x0190}, + {0xa0, 0x02, 0x0191}, + {0xa0, 0x62, 0x0192}, + {0xa0, 0x00, 0x0195}, + {0xa0, 0x00, 0x0196}, + {0xa0, 0x3d, 0x0197}, + {0xa0, 0x10, 0x018c}, + {0xa0, 0x20, 0x018f}, + + {0xa0, 0x0c, 0x01a9}, /* 0x14 */ + {0xa0, 0x28, 0x01aa}, + {0xa0, 0x04, 0x001d}, + {0xa0, 0x18, 0x001e}, + {0xa0, 0x2c, 0x001f}, + {0xa0, 0x41, 0x0020}, + {0xa0, 0x60, 0x011d}, + {0xa0, 0x42, 0x0180}, + {0xa1, 0x01, 0x0180}, + {0xa0, 0x42, 0x0180}, + {0xa0, 0x40, 0x0116}, + {0xa0, 0x40, 0x0117}, + {0xa0, 0x40, 0x0118}, + {0, 0, 0} +}; +static struct usb_action hdcs2020xb_InitialScale[] = { + {0xa0, 0x01, 0x0000}, + {0xa0, 0x00, 0x0002}, + {0xa0, 0x03, 0x0008}, + {0xa0, 0x08, 0x0010}, + {0xa0, 0x02, 0x0003}, + {0xa0, 0x80, 0x0004}, + {0xa0, 0x01, 0x0005}, + {0xa0, 0xe0, 0x0006}, + {0xa0, 0x01, 0x0001}, + {0xa0, 0x03, 0x0012}, + {0xa0, 0x01, 0x0012}, + {0xa0, 0x00, 0x0098}, + {0xa0, 0x00, 0x009a}, + {0xa0, 0x00, 0x011a}, + {0xa0, 0x00, 0x011c}, + {0xa0, 0xe8, 0x009c}, + {0xa0, 0x88, 0x009e}, + {0xaa, 0x1c, 0x0000}, + {0xaa, 0x0a, 0x0001}, + {0xaa, 0x0b, 0x0006}, + {0xaa, 0x0c, 0x007a}, + {0xaa, 0x0d, 0x00a7}, + {0xaa, 0x03, 0x00fb}, + {0xaa, 0x05, 0x0000}, + {0xaa, 0x06, 0x0003}, + {0xaa, 0x09, 0x0008}, + {0xaa, 0x0f, 0x0018}, /* original setting */ + {0xaa, 0x10, 0x0018}, + {0xaa, 0x11, 0x0018}, + {0xaa, 0x12, 0x0018}, + {0xaa, 0x15, 0x004e}, + {0xaa, 0x1c, 0x0004}, + {0xa0, 0xf7, 0x0101}, + {0xa0, 0x05, 0x0012}, + {0xa0, 0x70, 0x018d}, + {0xa0, 0x0d, 0x0100}, + {0xa0, 0x06, 0x0189}, + {0xa0, 0x03, 0x01c5}, + {0xa0, 0x13, 0x01cb}, + {0xa0, 0x08, 0x0250}, + {0xa0, 0x08, 0x0301}, + {0xa1, 0x01, 0x0002}, + {0xa1, 0x01, 0x0008}, + {0xa1, 0x01, 0x0180}, + {0xa0, 0x02, 0x0180}, + {0xa0, 0x40, 0x0116}, + {0xa0, 0x40, 0x0117}, + {0xa0, 0x40, 0x0118}, + {0xa1, 0x01, 0x0008}, + {0xa0, 0x03, 0x0008}, /* clock ? */ + {0xa0, 0x08, 0x01c6}, + {0xa1, 0x01, 0x01c8}, + {0xa1, 0x01, 0x01c9}, + {0xa1, 0x01, 0x01ca}, + {0xa0, 0x0f, 0x01cb}, + {0xa0, 0x13, 0x0120}, /* gamma 4 */ + {0xa0, 0x38, 0x0121}, + {0xa0, 0x59, 0x0122}, + {0xa0, 0x79, 0x0123}, + {0xa0, 0x92, 0x0124}, + {0xa0, 0xa7, 0x0125}, + {0xa0, 0xb9, 0x0126}, + {0xa0, 0xc8, 0x0127}, + {0xa0, 0xd4, 0x0128}, + {0xa0, 0xdf, 0x0129}, + {0xa0, 0xe7, 0x012a}, + {0xa0, 0xee, 0x012b}, + {0xa0, 0xf4, 0x012c}, + {0xa0, 0xf9, 0x012d}, + {0xa0, 0xfc, 0x012e}, + {0xa0, 0xff, 0x012f}, + {0xa0, 0x26, 0x0130}, + {0xa0, 0x22, 0x0131}, + {0xa0, 0x20, 0x0132}, + {0xa0, 0x1c, 0x0133}, + {0xa0, 0x16, 0x0134}, + {0xa0, 0x13, 0x0135}, + {0xa0, 0x10, 0x0136}, + {0xa0, 0x0d, 0x0137}, + {0xa0, 0x0b, 0x0138}, + {0xa0, 0x09, 0x0139}, + {0xa0, 0x07, 0x013a}, + {0xa0, 0x06, 0x013b}, + {0xa0, 0x05, 0x013c}, + {0xa0, 0x04, 0x013d}, + {0xa0, 0x03, 0x013e}, + {0xa0, 0x02, 0x013f}, + {0xa0, 0x66, 0x010a}, /* matrix */ + {0xa0, 0xed, 0x010b}, + {0xa0, 0xed, 0x010c}, + {0xa0, 0xed, 0x010d}, + {0xa0, 0x66, 0x010e}, + {0xa0, 0xed, 0x010f}, + {0xa0, 0xed, 0x0110}, + {0xa0, 0xed, 0x0111}, + {0xa0, 0x66, 0x0112}, + {0xa1, 0x01, 0x0180}, + {0xa0, 0x00, 0x0180}, + {0xa0, 0x00, 0x0019}, + /**** set exposure ***/ + {0xaa, 0x13, 0x0031}, + {0xaa, 0x14, 0x0001}, + {0xaa, 0x0e, 0x0004}, + {0xaa, 0x19, 0x00cd}, + {0xa0, 0x00, 0x0190}, + {0xa0, 0x02, 0x0191}, + {0xa0, 0x62, 0x0192}, + {0xa0, 0x00, 0x0195}, + {0xa0, 0x00, 0x0196}, + {0xa0, 0x3d, 0x0197}, + {0xa0, 0x10, 0x018c}, + {0xa0, 0x20, 0x018f}, + {0xa0, 0x0c, 0x01a9}, + {0xa0, 0x28, 0x01aa}, + {0xa0, 0x04, 0x001d}, + {0xa0, 0x18, 0x001e}, + {0xa0, 0x2c, 0x001f}, + {0xa0, 0x41, 0x0020}, + {0xa0, 0x60, 0x011d}, + {0xa0, 0x42, 0x0180}, + {0xa1, 0x01, 0x0180}, + {0xa0, 0x42, 0x0180}, + {0xa0, 0x40, 0x0116}, + {0xa0, 0x40, 0x0117}, + {0xa0, 0x40, 0x0118}, + {0, 0, 0} +}; +static struct usb_action hdcs2020b_50HZ[] = { + {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xaa, 0x13, 0x0018}, /* 00,13,18,aa */ + {0xaa, 0x14, 0x0001}, /* 00,14,01,aa */ + {0xaa, 0x0e, 0x0005}, /* 00,0e,05,aa */ + {0xaa, 0x19, 0x001f}, /* 00,19,1f,aa */ + {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ + {0xa0, 0x02, 0x0191}, /* 01,91,02,cc */ + {0xa0, 0x76, 0x0192}, /* 01,92,76,cc */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */ + {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */ + {0xa0, 0x46, 0x0197}, /* 01,97,46,cc */ + {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */ + {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */ + {0xa0, 0x0c, 0x01a9}, /* 01,a9,0c,cc */ + {0xa0, 0x28, 0x01aa}, /* 01,aa,28,cc */ + {0xa0, 0x05, 0x001d}, /* 00,1d,05,cc */ + {0xa0, 0x1a, 0x001e}, /* 00,1e,1a,cc */ + {0xa0, 0x2f, 0x001f}, /* 00,1f,2f,cc */ + {0, 0, 0} +}; +static struct usb_action hdcs2020b_60HZ[] = { + {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xaa, 0x13, 0x0031}, /* 00,13,31,aa */ + {0xaa, 0x14, 0x0001}, /* 00,14,01,aa */ + {0xaa, 0x0e, 0x0004}, /* 00,0e,04,aa */ + {0xaa, 0x19, 0x00cd}, /* 00,19,cd,aa */ + {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ + {0xa0, 0x02, 0x0191}, /* 01,91,02,cc */ + {0xa0, 0x62, 0x0192}, /* 01,92,62,cc */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */ + {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */ + {0xa0, 0x3d, 0x0197}, /* 01,97,3d,cc */ + {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */ + {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */ + {0xa0, 0x0c, 0x01a9}, /* 01,a9,0c,cc */ + {0xa0, 0x28, 0x01aa}, /* 01,aa,28,cc */ + {0xa0, 0x04, 0x001d}, /* 00,1d,04,cc */ + {0xa0, 0x18, 0x001e}, /* 00,1e,18,cc */ + {0xa0, 0x2c, 0x001f}, /* 00,1f,2c,cc */ + {0, 0, 0} +}; +static struct usb_action hdcs2020b_NoFliker[] = { + {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xaa, 0x13, 0x0010}, /* 00,13,10,aa */ + {0xaa, 0x14, 0x0001}, /* 00,14,01,aa */ + {0xaa, 0x0e, 0x0004}, /* 00,0e,04,aa */ + {0xaa, 0x19, 0x0000}, /* 00,19,00,aa */ + {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ + {0xa0, 0x02, 0x0191}, /* 01,91,02,cc */ + {0xa0, 0x70, 0x0192}, /* 01,92,70,cc */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */ + {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */ + {0xa0, 0x10, 0x0197}, /* 01,97,10,cc */ + {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */ + {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */ + {0xa0, 0x00, 0x01a9}, /* 01,a9,00,cc */ + {0xa0, 0x00, 0x01aa}, /* 01,aa,00,cc */ + {0xa0, 0x04, 0x001d}, /* 00,1d,04,cc */ + {0xa0, 0x17, 0x001e}, /* 00,1e,17,cc */ + {0xa0, 0x2a, 0x001f}, /* 00,1f,2a,cc */ + {0, 0, 0} +}; + +static struct usb_action hv7131bxx_Initial[] = { + {0xa0, 0x01, 0x0000}, + {0xa0, 0x10, 0x0002}, + {0xa0, 0x00, 0x0010}, + {0xa0, 0x01, 0x0001}, + {0xa0, 0x77, 0x0101}, + {0xa0, 0x03, 0x0008}, /* 00 */ + {0xa0, 0x03, 0x0012}, + {0xa0, 0x01, 0x0012}, + {0xa0, 0x02, 0x0003}, + {0xa0, 0x80, 0x0004}, + {0xa0, 0x01, 0x0005}, + {0xa0, 0xe0, 0x0006}, + {0xa0, 0x00, 0x0098}, + {0xa0, 0x00, 0x009a}, + {0xa0, 0x00, 0x011a}, + {0xa0, 0x00, 0x011c}, + {0xaa, 0x30, 0x002d}, + {0xaa, 0x01, 0x0005}, + {0xaa, 0x11, 0x0000}, + {0xaa, 0x13, 0x0001}, /* {0xaa, 0x13, 0x0000}, */ + {0xaa, 0x14, 0x0001}, + {0xaa, 0x15, 0x00e8}, + {0xaa, 0x16, 0x0002}, + {0xaa, 0x17, 0x0086}, + {0xaa, 0x31, 0x0038}, + {0xaa, 0x32, 0x0038}, + {0xaa, 0x33, 0x0038}, + {0xaa, 0x5b, 0x0001}, + {0xa0, 0x00, 0x0019}, + {0xa0, 0x05, 0x0012}, + {0xa0, 0x0d, 0x0100}, + {0xa0, 0x68, 0x018d}, + {0xa0, 0x60, 0x01a8}, + {0xa0, 0x00, 0x01ad}, + {0xa0, 0xc0, 0x019b}, + {0xa0, 0xa0, 0x019c}, + {0xa0, 0x02, 0x0188}, + {0xa0, 0x06, 0x0189}, + {0xa0, 0x03, 0x01c5}, + {0xa0, 0x13, 0x01cb}, + {0xa0, 0x08, 0x0250}, + {0xa0, 0x08, 0x0301}, + {0xaa, 0x02, 0x0080}, /* {0xaa, 0x02, 0x0090}; */ + {0xa1, 0x01, 0x0002}, + {0xa0, 0x00, 0x0092}, + {0xa0, 0x02, 0x0090}, + {0xa1, 0x01, 0x0091}, + {0xa1, 0x01, 0x0095}, + {0xa1, 0x01, 0x0096}, + + {0xa1, 0x01, 0x0008}, + {0xa0, 0x03, 0x0008}, /* clock ? */ + {0xa0, 0x08, 0x01c6}, + {0xa1, 0x01, 0x01c8}, + {0xa1, 0x01, 0x01c9}, + {0xa1, 0x01, 0x01ca}, + {0xa0, 0x0f, 0x01cb}, + + {0xa0, 0x50, 0x010a}, /* matrix */ + {0xa0, 0xf8, 0x010b}, + {0xa0, 0xf8, 0x010c}, + {0xa0, 0xf8, 0x010d}, + {0xa0, 0x50, 0x010e}, + {0xa0, 0xf8, 0x010f}, + {0xa0, 0xf8, 0x0110}, + {0xa0, 0xf8, 0x0111}, + {0xa0, 0x50, 0x0112}, + {0xa1, 0x01, 0x0180}, + {0xa0, 0x10, 0x0180}, + {0xa0, 0x00, 0x0019}, + {0xaa, 0x25, 0x0007}, + {0xaa, 0x26, 0x00a1}, + {0xaa, 0x27, 0x0020}, + {0xaa, 0x20, 0x0000}, + {0xaa, 0x21, 0x00a0}, + {0xaa, 0x22, 0x0016}, + {0xaa, 0x23, 0x0040}, + + {0xa0, 0x10, 0x0190}, /* 2F */ + {0xa0, 0x04, 0x0191}, /* 4d */ + {0xa0, 0x60, 0x0192}, + {0xa0, 0x01, 0x0195}, + {0xa0, 0x86, 0x0196}, + {0xa0, 0xa0, 0x0197}, + {0xa0, 0x07, 0x018c}, + {0xa0, 0x0f, 0x018f}, + {0xa0, 0x18, 0x01a9}, + {0xa0, 0x24, 0x01aa}, + {0xa0, 0x00, 0x001d}, + {0xa0, 0xa0, 0x001e}, + {0xa0, 0x16, 0x001f}, + {0xa0, 0x40, 0x0020}, + {0xa0, 0x60, 0x011d}, + {0xa1, 0x01, 0x001d}, + {0xa1, 0x01, 0x001e}, + {0xa1, 0x01, 0x001f}, + {0xa1, 0x01, 0x0020}, + {0xa0, 0x40, 0x0180}, + {0xa1, 0x01, 0x0180}, + {0xa0, 0x42, 0x0180}, + {0xa0, 0x40, 0x0116}, + {0xa0, 0x40, 0x0117}, + {0xa0, 0x40, 0x0118}, +/* {0xa0, 0x02, 0x0008}, */ + {0, 0, 0} +}; + +static struct usb_action hv7131bxx_InitialScale[] = { + {0xa0, 0x01, 0x0000}, + {0xa0, 0x00, 0x0002}, + {0xa0, 0x00, 0x0010}, + {0xa0, 0x01, 0x0001}, + {0xa0, 0x37, 0x0101}, + {0xa0, 0x03, 0x0008}, /* 00 */ + {0xa0, 0x03, 0x0012}, + {0xa0, 0x01, 0x0012}, + {0xa0, 0x02, 0x0003}, + {0xa0, 0x80, 0x0004}, + {0xa0, 0x01, 0x0005}, + {0xa0, 0xe0, 0x0006}, + {0xa0, 0x00, 0x0098}, + {0xa0, 0x00, 0x009a}, + {0xa0, 0x00, 0x011a}, + {0xa0, 0x00, 0x011c}, + {0xaa, 0x30, 0x002d}, + {0xaa, 0x01, 0x0005}, + {0xaa, 0x11, 0x0001}, + {0xaa, 0x13, 0x0000}, /* {0xaa, 0x13, 0x0001}; */ + {0xaa, 0x14, 0x0001}, + {0xaa, 0x15, 0x00e6}, + {0xaa, 0x16, 0x0002}, + {0xaa, 0x17, 0x0086}, + {0xaa, 0x31, 0x0038}, + {0xaa, 0x32, 0x0038}, + {0xaa, 0x33, 0x0038}, + {0xaa, 0x5b, 0x0001}, + {0xa0, 0x00, 0x0019}, + {0xa0, 0x05, 0x0012}, + {0xa0, 0x0d, 0x0100}, + {0xa0, 0x70, 0x018d}, + {0xa0, 0x60, 0x01a8}, + {0xa0, 0x00, 0x01ad}, + {0xa0, 0xc0, 0x019b}, + {0xa0, 0xa0, 0x019c}, + {0xa0, 0x02, 0x0188}, + {0xa0, 0x06, 0x0189}, + {0xa0, 0x03, 0x01c5}, + {0xa0, 0x13, 0x01cb}, + {0xa0, 0x08, 0x0250}, + {0xa0, 0x08, 0x0301}, + {0xaa, 0x02, 0x0090}, /* {0xaa, 0x02, 0x0080}, */ + {0xa1, 0x01, 0x0002}, + {0xa0, 0x00, 0x0092}, + {0xa0, 0x02, 0x0090}, + {0xa1, 0x01, 0x0091}, + {0xa1, 0x01, 0x0095}, + {0xa1, 0x01, 0x0096}, + {0xa1, 0x01, 0x0008}, + {0xa0, 0x03, 0x0008}, /* clock ? */ + {0xa0, 0x08, 0x01c6}, + {0xa1, 0x01, 0x01c8}, + {0xa1, 0x01, 0x01c9}, + {0xa1, 0x01, 0x01ca}, + {0xa0, 0x0f, 0x01cb}, + + {0xa0, 0x50, 0x010a}, /* matrix */ + {0xa0, 0xf8, 0x010b}, + {0xa0, 0xf8, 0x010c}, + {0xa0, 0xf8, 0x010d}, + {0xa0, 0x50, 0x010e}, + {0xa0, 0xf8, 0x010f}, + {0xa0, 0xf8, 0x0110}, + {0xa0, 0xf8, 0x0111}, + {0xa0, 0x50, 0x0112}, + {0xa1, 0x01, 0x0180}, + {0xa0, 0x10, 0x0180}, + {0xa0, 0x00, 0x0019}, + {0xaa, 0x25, 0x0007}, + {0xaa, 0x26, 0x00a1}, + {0xaa, 0x27, 0x0020}, + {0xaa, 0x20, 0x0000}, + {0xaa, 0x21, 0x0040}, + {0xaa, 0x22, 0x0013}, + {0xaa, 0x23, 0x004c}, + {0xa0, 0x10, 0x0190}, /* 2f */ + {0xa0, 0x04, 0x0191}, /* 4d */ + {0xa0, 0x60, 0x0192}, /* 60 */ + {0xa0, 0x00, 0x0195}, + {0xa0, 0xc3, 0x0196}, + {0xa0, 0x50, 0x0197}, + {0xa0, 0x0c, 0x018c}, + {0xa0, 0x18, 0x018f}, + {0xa0, 0x18, 0x01a9}, + {0xa0, 0x24, 0x01aa}, + {0xa0, 0x00, 0x001d}, + {0xa0, 0x40, 0x001e}, + {0xa0, 0x13, 0x001f}, + {0xa0, 0x4c, 0x0020}, + {0xa0, 0x60, 0x011d}, + {0xa1, 0x01, 0x001d}, + {0xa1, 0x01, 0x001e}, + {0xa1, 0x01, 0x001f}, + {0xa1, 0x01, 0x0020}, + {0xa0, 0x40, 0x0180}, + {0xa1, 0x01, 0x0180}, + {0xa0, 0x42, 0x0180}, + {0xa0, 0x40, 0x0116}, + {0xa0, 0x40, 0x0117}, + {0xa0, 0x40, 0x0118}, +/* {0xa0, 0x02, 0x0008}, */ + {0, 0, 0} +}; + +static struct usb_action hv7131cxx_Initial[] = { + {0xa0, 0x01, 0x0000}, + {0xa0, 0x10, 0x0002}, + {0xa0, 0x01, 0x0010}, + {0xa0, 0x01, 0x0001}, + {0xa0, 0x77, 0x0101}, + {0xa0, 0x03, 0x0008}, + {0xa0, 0x05, 0x0012}, + {0xa0, 0x07, 0x0012}, + {0xa0, 0x02, 0x0003}, + {0xa0, 0x80, 0x0004}, + {0xa0, 0x01, 0x0005}, + {0xa0, 0xe0, 0x0006}, + {0xa0, 0x00, 0x0098}, + {0xa0, 0x00, 0x009a}, + {0xa0, 0x01, 0x009b}, + {0xa0, 0xe8, 0x009c}, + {0xa0, 0x02, 0x009d}, + {0xa0, 0x88, 0x009e}, + {0xa0, 0x00, 0x011a}, + {0xa0, 0x00, 0x011c}, + {0xa0, 0x05, 0x0012}, + {0xaa, 0x01, 0x000c}, + {0xaa, 0x11, 0x0000}, + {0xaa, 0x13, 0x0000}, + {0xaa, 0x14, 0x0001}, + {0xaa, 0x15, 0x00e8}, + {0xaa, 0x16, 0x0002}, + {0xaa, 0x17, 0x0088}, + + {0xa0, 0x00, 0x0019}, + {0xa0, 0x0d, 0x0100}, + {0xa0, 0x89, 0x018d}, + {0xa0, 0x50, 0x01a8}, + {0xa0, 0x00, 0x01ad}, + {0xa0, 0xc0, 0x019b}, + {0xa0, 0xa0, 0x019c}, + {0xa0, 0x06, 0x0189}, + {0xa0, 0x03, 0x01c5}, + {0xa0, 0x13, 0x01cb}, + {0xa0, 0x08, 0x0250}, + {0xa0, 0x08, 0x0301}, + {0xa1, 0x01, 0x0002}, + {0xa0, 0x00, 0x0092}, + {0xa0, 0x02, 0x0090}, + {0xa1, 0x01, 0x0091}, + {0xa1, 0x01, 0x0095}, + {0xa1, 0x01, 0x0096}, + + {0xa1, 0x01, 0x0008}, + {0xa0, 0x03, 0x0008}, /* clock ? */ + {0xa0, 0x08, 0x01c6}, + {0xa1, 0x01, 0x01c8}, + {0xa1, 0x01, 0x01c9}, + {0xa1, 0x01, 0x01ca}, + {0xa0, 0x0f, 0x01cb}, + + {0xa0, 0x60, 0x010a}, /* matrix */ + {0xa0, 0xf0, 0x010b}, + {0xa0, 0xf0, 0x010c}, + {0xa0, 0xf0, 0x010d}, + {0xa0, 0x60, 0x010e}, + {0xa0, 0xf0, 0x010f}, + {0xa0, 0xf0, 0x0110}, + {0xa0, 0xf0, 0x0111}, + {0xa0, 0x60, 0x0112}, + {0xa1, 0x01, 0x0180}, + {0xa0, 0x10, 0x0180}, + {0xa0, 0x00, 0x0019}, + {0xaa, 0x25, 0x0007}, + {0xaa, 0x26, 0x0053}, + {0xaa, 0x27, 0x0000}, + + {0xa0, 0x10, 0x0190}, /* 2f */ + {0xa0, 0x04, 0x0191}, /* 9b */ + {0xa0, 0x60, 0x0192}, /* 80 */ + {0xa0, 0x01, 0x0195}, + {0xa0, 0xd4, 0x0196}, + {0xa0, 0xc0, 0x0197}, + {0xa0, 0x10, 0x018c}, + {0xa0, 0x20, 0x018f}, + {0xa0, 0x60, 0x01a8}, + {0xa0, 0x10, 0x01a9}, + {0xa0, 0x13, 0x01aa}, + {0xa1, 0x01, 0x001d}, + {0xa1, 0x01, 0x001e}, + {0xa1, 0x01, 0x001f}, + {0xa1, 0x01, 0x0020}, + {0xa0, 0x40, 0x0180}, + {0xa1, 0x01, 0x0180}, + {0xa0, 0x42, 0x0180}, + {0, 0, 0} +}; + +static struct usb_action hv7131cxx_InitialScale[] = { + {0xa0, 0x01, 0x0000}, + + {0xa0, 0x00, 0x0002}, /* diff */ + {0xa0, 0x01, 0x0010}, + {0xa0, 0x01, 0x0001}, + {0xa0, 0x77, 0x0101}, + {0xa0, 0x03, 0x0008}, + + {0xa0, 0x05, 0x0012}, + {0xa0, 0x07, 0x0012}, + + {0xa0, 0x02, 0x0003}, + {0xa0, 0x80, 0x0004}, + {0xa0, 0x01, 0x0005}, + {0xa0, 0xe0, 0x0006}, /* 1e0 */ + + {0xa0, 0x00, 0x0098}, + {0xa0, 0x00, 0x009a}, + {0xa0, 0x01, 0x009b}, + {0xa0, 0xe8, 0x009c}, + {0xa0, 0x02, 0x009d}, + {0xa0, 0x88, 0x009e}, + {0xa0, 0x00, 0x011a}, + {0xa0, 0x00, 0x011c}, + {0xa0, 0x05, 0x0012}, + {0xaa, 0x01, 0x000c}, + {0xaa, 0x11, 0x0000}, + {0xaa, 0x13, 0x0000}, + {0xaa, 0x14, 0x0001}, + {0xaa, 0x15, 0x00e8}, + {0xaa, 0x16, 0x0002}, + {0xaa, 0x17, 0x0088}, + + {0xa0, 0x00, 0x0019}, /* 00 */ + + {0xa0, 0x0d, 0x0100}, + {0xa0, 0x89, 0x018d}, + {0xa0, 0x50, 0x01a8}, + {0xa0, 0x00, 0x01ad}, + {0xa0, 0xc0, 0x019b}, + {0xa0, 0xa0, 0x019c}, + {0xa0, 0x06, 0x0189}, + {0xa0, 0x03, 0x01c5}, + {0xa0, 0x13, 0x01cb}, + {0xa0, 0x08, 0x0250}, + {0xa0, 0x08, 0x0301}, + {0xa1, 0x01, 0x0002}, + {0xa0, 0x00, 0x0092}, /* read the i2c chips ident */ + {0xa0, 0x02, 0x0090}, + {0xa1, 0x01, 0x0091}, + {0xa1, 0x01, 0x0095}, + {0xa1, 0x01, 0x0096}, + + {0xa1, 0x01, 0x0008}, + {0xa0, 0x03, 0x0008}, /* clock ? */ + {0xa0, 0x08, 0x01c6}, + {0xa1, 0x01, 0x01c8}, + {0xa1, 0x01, 0x01c9}, + {0xa1, 0x01, 0x01ca}, + {0xa0, 0x0f, 0x01cb}, + + {0xa0, 0x60, 0x010a}, /* matrix */ + {0xa0, 0xf0, 0x010b}, + {0xa0, 0xf0, 0x010c}, + {0xa0, 0xf0, 0x010d}, + {0xa0, 0x60, 0x010e}, + {0xa0, 0xf0, 0x010f}, + {0xa0, 0xf0, 0x0110}, + {0xa0, 0xf0, 0x0111}, + {0xa0, 0x60, 0x0112}, + {0xa1, 0x01, 0x0180}, + {0xa0, 0x10, 0x0180}, + {0xa0, 0x00, 0x0019}, + {0xaa, 0x25, 0x0007}, + {0xaa, 0x26, 0x0053}, + {0xaa, 0x27, 0x0000}, + + {0xa0, 0x10, 0x0190}, /* 2f */ + {0xa0, 0x04, 0x0191}, /* 9b */ + {0xa0, 0x60, 0x0192}, /* 80 */ + + {0xa0, 0x01, 0x0195}, + {0xa0, 0xd4, 0x0196}, + {0xa0, 0xc0, 0x0197}, + + {0xa0, 0x10, 0x018c}, + {0xa0, 0x20, 0x018f}, + {0xa0, 0x60, 0x01a8}, + {0xa0, 0x10, 0x01a9}, + {0xa0, 0x13, 0x01aa}, + {0xa1, 0x01, 0x001d}, + {0xa1, 0x01, 0x001e}, + {0xa1, 0x01, 0x001f}, + {0xa1, 0x01, 0x0020}, + {0xa0, 0x40, 0x0180}, + {0xa1, 0x01, 0x0180}, + {0xa0, 0x42, 0x0180}, + {0, 0, 0} +}; + +static struct usb_action icm105axx_Initial[] = { + {0xa0, 0x01, 0x0000}, + {0xa0, 0x10, 0x0002}, + {0xa0, 0x03, 0x0008}, + {0xa0, 0x0c, 0x0010}, + {0xa0, 0x02, 0x0003}, + {0xa0, 0x80, 0x0004}, + {0xa0, 0x01, 0x0005}, + {0xa0, 0xe0, 0x0006}, + {0xa0, 0x01, 0x0001}, + {0xa0, 0x03, 0x0012}, + {0xa0, 0x01, 0x0012}, + {0xa0, 0xa1, 0x008b}, + {0xa0, 0x00, 0x0097}, + {0xa0, 0x01, 0x0098}, + {0xa0, 0x00, 0x0099}, + {0xa0, 0x01, 0x009a}, + {0xa0, 0x01, 0x011a}, + {0xa0, 0x01, 0x011c}, + {0xa0, 0x01, 0x009b}, + {0xa0, 0xe8, 0x009c}, + {0xa0, 0x02, 0x009d}, + {0xa0, 0x88, 0x009e}, + {0xa0, 0x37, 0x0101}, + {0xa0, 0x0d, 0x0100}, + {0xa0, 0x06, 0x0189}, + {0xa0, 0x03, 0x01c5}, + {0xa0, 0x13, 0x01cb}, + {0xaa, 0x01, 0x0010}, + {0xaa, 0x03, 0x0000}, + {0xaa, 0x04, 0x0001}, + {0xaa, 0x05, 0x0020}, + {0xaa, 0x06, 0x0001}, + {0xaa, 0x08, 0x0000}, + {0xaa, 0x03, 0x0001}, + {0xaa, 0x04, 0x0011}, + {0xaa, 0x05, 0x00a0}, + {0xaa, 0x06, 0x0001}, + {0xaa, 0x08, 0x0000}, + {0xaa, 0x03, 0x0002}, + {0xaa, 0x04, 0x0013}, + {0xaa, 0x05, 0x0020}, + {0xaa, 0x06, 0x0001}, + {0xaa, 0x08, 0x0000}, + {0xaa, 0x03, 0x0003}, + {0xaa, 0x04, 0x0015}, + {0xaa, 0x05, 0x0020}, + {0xaa, 0x06, 0x0005}, + {0xaa, 0x08, 0x0000}, + {0xaa, 0x03, 0x0004}, + {0xaa, 0x04, 0x0017}, + {0xaa, 0x05, 0x0020}, + {0xaa, 0x06, 0x000d}, + {0xaa, 0x08, 0x0000}, + {0xaa, 0x03, 0x0005}, + {0xaa, 0x04, 0x0019}, + {0xaa, 0x05, 0x0020}, + {0xaa, 0x06, 0x0005}, + {0xaa, 0x08, 0x0000}, + {0xaa, 0x03, 0x0006}, + {0xaa, 0x04, 0x0017}, + {0xaa, 0x05, 0x0026}, + {0xaa, 0x06, 0x0005}, + {0xaa, 0x08, 0x0000}, + {0xaa, 0x03, 0x0007}, + {0xaa, 0x04, 0x0019}, + {0xaa, 0x05, 0x0022}, + {0xaa, 0x06, 0x0005}, + {0xaa, 0x08, 0x0000}, + {0xaa, 0x03, 0x0008}, + {0xaa, 0x04, 0x0021}, + {0xaa, 0x05, 0x00aa}, + {0xaa, 0x06, 0x0005}, + {0xaa, 0x08, 0x0000}, + {0xaa, 0x03, 0x0009}, + {0xaa, 0x04, 0x0023}, + {0xaa, 0x05, 0x00aa}, + {0xaa, 0x06, 0x000d}, + {0xaa, 0x08, 0x0000}, + {0xaa, 0x03, 0x000a}, + {0xaa, 0x04, 0x0025}, + {0xaa, 0x05, 0x00aa}, + {0xaa, 0x06, 0x0005}, + {0xaa, 0x08, 0x0000}, + {0xaa, 0x03, 0x000b}, + {0xaa, 0x04, 0x00ec}, + {0xaa, 0x05, 0x002e}, + {0xaa, 0x06, 0x0005}, + {0xaa, 0x08, 0x0000}, + {0xaa, 0x03, 0x000c}, + {0xaa, 0x04, 0x00fa}, + {0xaa, 0x05, 0x002a}, + {0xaa, 0x06, 0x0005}, + {0xaa, 0x08, 0x0000}, + {0xaa, 0x07, 0x000d}, + {0xaa, 0x01, 0x0005}, + {0xaa, 0x94, 0x0002}, + {0xaa, 0x90, 0x0000}, + {0xaa, 0x91, 0x001f}, + {0xaa, 0x10, 0x0064}, + {0xaa, 0x9b, 0x00f0}, + {0xaa, 0x9c, 0x0002}, + {0xaa, 0x14, 0x001a}, + {0xaa, 0x20, 0x0080}, + {0xaa, 0x22, 0x0080}, + {0xaa, 0x24, 0x0080}, + {0xaa, 0x26, 0x0080}, + {0xaa, 0x00, 0x0084}, + {0xa0, 0x08, 0x0250}, + {0xa0, 0x08, 0x0301}, + {0xaa, 0xa8, 0x00c0}, + {0xa1, 0x01, 0x0002}, + {0xa1, 0x01, 0x0008}, + {0xa1, 0x01, 0x0180}, + {0xa0, 0x02, 0x0180}, + {0xa0, 0x40, 0x0116}, + {0xa0, 0x40, 0x0117}, + {0xa0, 0x40, 0x0118}, + {0xa1, 0x01, 0x0008}, + + {0xa0, 0x03, 0x0008}, /* clock ? */ + {0xa0, 0x08, 0x01c6}, + {0xa1, 0x01, 0x01c8}, + {0xa1, 0x01, 0x01c9}, + {0xa1, 0x01, 0x01ca}, + {0xa0, 0x0f, 0x01cb}, + {0xa0, 0x52, 0x010a}, /* matrix */ + {0xa0, 0xf7, 0x010b}, + {0xa0, 0xf7, 0x010c}, + {0xa0, 0xf7, 0x010d}, + {0xa0, 0x52, 0x010e}, + {0xa0, 0xf7, 0x010f}, + {0xa0, 0xf7, 0x0110}, + {0xa0, 0xf7, 0x0111}, + {0xa0, 0x52, 0x0112}, + {0xa1, 0x01, 0x0180}, + {0xa0, 0x00, 0x0180}, + {0xa0, 0x00, 0x0019}, + {0xaa, 0x0d, 0x0003}, + {0xaa, 0x0c, 0x008c}, + {0xaa, 0x0e, 0x0095}, + {0xaa, 0x0f, 0x0002}, + {0xaa, 0x1c, 0x0094}, + {0xaa, 0x1d, 0x0002}, + {0xaa, 0x20, 0x0080}, + {0xaa, 0x22, 0x0080}, + {0xaa, 0x24, 0x0080}, + {0xaa, 0x26, 0x0080}, + {0xaa, 0x00, 0x0084}, + {0xa0, 0x02, 0x00a3}, + {0xa0, 0x94, 0x00a4}, + {0xa0, 0x00, 0x0190}, + {0xa0, 0x04, 0x0191}, + {0xa0, 0x20, 0x0192}, + {0xa0, 0x00, 0x0195}, + {0xa0, 0x00, 0x0196}, + {0xa0, 0x84, 0x0197}, + {0xa0, 0x10, 0x018c}, + {0xa0, 0x20, 0x018f}, + {0xa0, 0x10, 0x01a9}, + {0xa0, 0x12, 0x01aa}, + {0xa0, 0xe3, 0x001d}, + {0xa0, 0xec, 0x001e}, + {0xa0, 0xf5, 0x001f}, + {0xa0, 0xff, 0x0020}, + {0xa0, 0x00, 0x01a7}, + {0xa0, 0xc0, 0x01a8}, + {0xa0, 0xc0, 0x011d}, + {0xa0, 0x42, 0x0180}, + {0xa1, 0x01, 0x0180}, + {0xa0, 0x42, 0x0180}, + {0xa0, 0x40, 0x0116}, + {0xa0, 0x40, 0x0117}, + {0xa0, 0x40, 0x0118}, + {0, 0, 0} +}; + +static struct usb_action icm105axx_InitialScale[] = { + {0xa0, 0x01, 0x0000}, + {0xa0, 0x00, 0x0002}, + {0xa0, 0x03, 0x0008}, + {0xa0, 0x0c, 0x0010}, + {0xa0, 0x02, 0x0003}, + {0xa0, 0x80, 0x0004}, + {0xa0, 0x01, 0x0005}, + {0xa0, 0xe0, 0x0006}, + {0xa0, 0x01, 0x0001}, + {0xa0, 0x03, 0x0012}, + {0xa0, 0x01, 0x0012}, + {0xa0, 0xa1, 0x008b}, + {0xa0, 0x00, 0x0097}, + {0xa0, 0x02, 0x0098}, + {0xa0, 0x00, 0x0099}, + {0xa0, 0x02, 0x009a}, + {0xa0, 0x02, 0x011a}, + {0xa0, 0x02, 0x011c}, + {0xa0, 0x01, 0x009b}, + {0xa0, 0xe6, 0x009c}, + {0xa0, 0x02, 0x009d}, + {0xa0, 0x86, 0x009e}, + {0xa0, 0x77, 0x0101}, + {0xa0, 0x0d, 0x0100}, + {0xa0, 0x06, 0x0189}, + {0xa0, 0x03, 0x01c5}, + {0xa0, 0x13, 0x01cb}, + {0xaa, 0x01, 0x0010}, + {0xaa, 0x03, 0x0000}, + {0xaa, 0x04, 0x0001}, + {0xaa, 0x05, 0x0020}, + {0xaa, 0x06, 0x0001}, + {0xaa, 0x08, 0x0000}, + {0xaa, 0x03, 0x0001}, + {0xaa, 0x04, 0x0011}, + {0xaa, 0x05, 0x00a0}, + {0xaa, 0x06, 0x0001}, + {0xaa, 0x08, 0x0000}, + {0xaa, 0x03, 0x0002}, + {0xaa, 0x04, 0x0013}, + {0xaa, 0x05, 0x0020}, + {0xaa, 0x06, 0x0001}, + {0xaa, 0x08, 0x0000}, + {0xaa, 0x03, 0x0003}, + {0xaa, 0x04, 0x0015}, + {0xaa, 0x05, 0x0020}, + {0xaa, 0x06, 0x0005}, + {0xaa, 0x08, 0x0000}, + {0xaa, 0x03, 0x0004}, + {0xaa, 0x04, 0x0017}, + {0xaa, 0x05, 0x0020}, + {0xaa, 0x06, 0x000d}, + {0xaa, 0x08, 0x0000}, + {0xaa, 0x03, 0x0005}, + {0xa0, 0x04, 0x0092}, + {0xa0, 0x19, 0x0093}, + {0xa0, 0x01, 0x0090}, + {0xa1, 0x01, 0x0091}, + {0xaa, 0x05, 0x0020}, + {0xaa, 0x06, 0x0005}, + {0xaa, 0x08, 0x0000}, + {0xaa, 0x03, 0x0006}, + {0xaa, 0x04, 0x0017}, + {0xaa, 0x05, 0x0026}, + {0xaa, 0x06, 0x0005}, + {0xaa, 0x08, 0x0000}, + {0xaa, 0x03, 0x0007}, + {0xaa, 0x04, 0x0019}, + {0xaa, 0x05, 0x0022}, + {0xaa, 0x06, 0x0005}, + {0xaa, 0x08, 0x0000}, + {0xaa, 0x03, 0x0008}, + {0xaa, 0x04, 0x0021}, + {0xaa, 0x05, 0x00aa}, + {0xaa, 0x06, 0x0005}, + {0xaa, 0x08, 0x0000}, + {0xaa, 0x03, 0x0009}, + {0xaa, 0x04, 0x0023}, + {0xaa, 0x05, 0x00aa}, + {0xaa, 0x06, 0x000d}, + {0xaa, 0x08, 0x0000}, + {0xaa, 0x03, 0x000a}, + {0xaa, 0x04, 0x0025}, + {0xaa, 0x05, 0x00aa}, + {0xaa, 0x06, 0x0005}, + {0xaa, 0x08, 0x0000}, + {0xaa, 0x03, 0x000b}, + {0xaa, 0x04, 0x00ec}, + {0xaa, 0x05, 0x002e}, + {0xaa, 0x06, 0x0005}, + {0xaa, 0x08, 0x0000}, + {0xaa, 0x03, 0x000c}, + {0xaa, 0x04, 0x00fa}, + {0xaa, 0x05, 0x002a}, + {0xaa, 0x06, 0x0005}, + {0xaa, 0x08, 0x0000}, + {0xaa, 0x07, 0x000d}, + {0xaa, 0x01, 0x0005}, + {0xaa, 0x94, 0x0002}, + {0xaa, 0x90, 0x0000}, + {0xaa, 0x91, 0x0010}, + {0xaa, 0x10, 0x0064}, + {0xaa, 0x9b, 0x00f0}, + {0xaa, 0x9c, 0x0002}, + {0xaa, 0x14, 0x001a}, + {0xaa, 0x20, 0x0080}, + {0xaa, 0x22, 0x0080}, + {0xaa, 0x24, 0x0080}, + {0xaa, 0x26, 0x0080}, + {0xaa, 0x00, 0x0084}, + {0xa0, 0x08, 0x0250}, + {0xa0, 0x08, 0x0301}, + {0xaa, 0xa8, 0x0080}, + {0xa0, 0x78, 0x018d}, + {0xa1, 0x01, 0x0002}, + {0xa1, 0x01, 0x0008}, + {0xa1, 0x01, 0x0180}, + {0xa0, 0x02, 0x0180}, + {0xa0, 0x40, 0x0116}, + {0xa0, 0x40, 0x0117}, + {0xa0, 0x40, 0x0118}, + {0xa1, 0x01, 0x0008}, + + {0xa0, 0x03, 0x0008}, /* clock ? */ + {0xa0, 0x08, 0x01c6}, + {0xa1, 0x01, 0x01c8}, + {0xa1, 0x01, 0x01c9}, + {0xa1, 0x01, 0x01ca}, + {0xa0, 0x0f, 0x01cb}, + + {0xa0, 0x52, 0x010a}, /* matrix */ + {0xa0, 0xf7, 0x010b}, + {0xa0, 0xf7, 0x010c}, + {0xa0, 0xf7, 0x010d}, + {0xa0, 0x52, 0x010e}, + {0xa0, 0xf7, 0x010f}, + {0xa0, 0xf7, 0x0110}, + {0xa0, 0xf7, 0x0111}, + {0xa0, 0x52, 0x0112}, + {0xa1, 0x01, 0x0180}, + {0xa0, 0x00, 0x0180}, + {0xa0, 0x00, 0x0019}, + {0xaa, 0x0d, 0x0003}, + {0xaa, 0x0c, 0x0020}, + {0xaa, 0x0e, 0x000e}, + {0xaa, 0x0f, 0x0002}, + {0xaa, 0x1c, 0x000d}, + {0xaa, 0x1d, 0x0002}, + {0xaa, 0x20, 0x0080}, + {0xaa, 0x22, 0x0080}, + {0xaa, 0x24, 0x0080}, + {0xaa, 0x26, 0x0080}, + {0xaa, 0x00, 0x0084}, + {0xa0, 0x02, 0x00a3}, + {0xa0, 0x0d, 0x00a4}, + {0xa0, 0x00, 0x0190}, + {0xa0, 0x04, 0x0191}, + {0xa0, 0x1a, 0x0192}, + {0xa0, 0x00, 0x0195}, + {0xa0, 0x00, 0x0196}, + {0xa0, 0x4b, 0x0197}, + {0xa0, 0x10, 0x018c}, + {0xa0, 0x20, 0x018f}, + {0xa0, 0x10, 0x01a9}, + {0xa0, 0x12, 0x01aa}, + {0xa0, 0xc8, 0x001d}, + {0xa0, 0xd8, 0x001e}, + {0xa0, 0xea, 0x001f}, + {0xa0, 0xff, 0x0020}, + {0xa0, 0x00, 0x01a7}, + {0xa0, 0x42, 0x0180}, + {0xa1, 0x01, 0x0180}, + {0xa0, 0x42, 0x0180}, + {0xa0, 0x40, 0x0116}, + {0xa0, 0x40, 0x0117}, + {0xa0, 0x40, 0x0118}, + {0, 0, 0} +}; +static struct usb_action icm105a_50HZ[] = { + {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xaa, 0x0d, 0x0003}, /* 00,0d,03,aa */ + {0xaa, 0x0c, 0x0020}, /* 00,0c,20,aa */ + {0xaa, 0x0e, 0x000e}, /* 00,0e,0e,aa */ + {0xaa, 0x0f, 0x0002}, /* 00,0f,02,aa */ + {0xaa, 0x1c, 0x000d}, /* 00,1c,0d,aa */ + {0xaa, 0x1d, 0x0002}, /* 00,1d,02,aa */ + {0xaa, 0x20, 0x0080}, /* 00,20,80,aa */ + {0xaa, 0x22, 0x0080}, /* 00,22,80,aa */ + {0xaa, 0x24, 0x0080}, /* 00,24,80,aa */ + {0xaa, 0x26, 0x0080}, /* 00,26,80,aa */ + {0xaa, 0x00, 0x0084}, /* 00,00,84,aa */ + {0xa0, 0x02, 0x00a3}, /* 00,a3,02,cc */ + {0xa0, 0x0d, 0x00a4}, /* 00,a4,0d,cc */ + {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ + {0xa0, 0x04, 0x0191}, /* 01,91,04,cc */ + {0xa0, 0x1a, 0x0192}, /* 01,92,1a,cc */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */ + {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */ + {0xa0, 0x4b, 0x0197}, /* 01,97,4b,cc */ + {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */ + {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */ + {0xa0, 0x10, 0x01a9}, /* 01,a9,10,cc */ + {0xa0, 0x12, 0x01aa}, /* 01,aa,12,cc */ + {0xa0, 0xc8, 0x001d}, /* 00,1d,c8,cc */ + {0xa0, 0xd8, 0x001e}, /* 00,1e,d8,cc */ + {0xa0, 0xea, 0x001f}, /* 00,1f,ea,cc */ + {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc */ + {0, 0, 0} +}; +static struct usb_action icm105a_50HZScale[] = { + {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xaa, 0x0d, 0x0003}, /* 00,0d,03,aa */ + {0xaa, 0x0c, 0x008c}, /* 00,0c,8c,aa */ + {0xaa, 0x0e, 0x0095}, /* 00,0e,95,aa */ + {0xaa, 0x0f, 0x0002}, /* 00,0f,02,aa */ + {0xaa, 0x1c, 0x0094}, /* 00,1c,94,aa */ + {0xaa, 0x1d, 0x0002}, /* 00,1d,02,aa */ + {0xaa, 0x20, 0x0080}, /* 00,20,80,aa */ + {0xaa, 0x22, 0x0080}, /* 00,22,80,aa */ + {0xaa, 0x24, 0x0080}, /* 00,24,80,aa */ + {0xaa, 0x26, 0x0080}, /* 00,26,80,aa */ + {0xaa, 0x00, 0x0084}, /* 00,00,84,aa */ + {0xa0, 0x02, 0x00a3}, /* 00,a3,02,cc */ + {0xa0, 0x94, 0x00a4}, /* 00,a4,94,cc */ + {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ + {0xa0, 0x04, 0x0191}, /* 01,91,04,cc */ + {0xa0, 0x20, 0x0192}, /* 01,92,20,cc */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */ + {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */ + {0xa0, 0x84, 0x0197}, /* 01,97,84,cc */ + {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */ + {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */ + {0xa0, 0x10, 0x01a9}, /* 01,a9,10,cc */ + {0xa0, 0x12, 0x01aa}, /* 01,aa,12,cc */ + {0xa0, 0xe3, 0x001d}, /* 00,1d,e3,cc */ + {0xa0, 0xec, 0x001e}, /* 00,1e,ec,cc */ + {0xa0, 0xf5, 0x001f}, /* 00,1f,f5,cc */ + {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc */ + {0xa0, 0x00, 0x01a7}, /* 01,a7,00,cc */ + {0xa0, 0xc0, 0x01a8}, /* 01,a8,c0,cc */ + {0, 0, 0} +}; +static struct usb_action icm105a_60HZ[] = { + {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xaa, 0x0d, 0x0003}, /* 00,0d,03,aa */ + {0xaa, 0x0c, 0x0004}, /* 00,0c,04,aa */ + {0xaa, 0x0e, 0x000d}, /* 00,0e,0d,aa */ + {0xaa, 0x0f, 0x0002}, /* 00,0f,02,aa */ + {0xaa, 0x1c, 0x0008}, /* 00,1c,08,aa */ + {0xaa, 0x1d, 0x0002}, /* 00,1d,02,aa */ + {0xaa, 0x20, 0x0080}, /* 00,20,80,aa */ + {0xaa, 0x22, 0x0080}, /* 00,22,80,aa */ + {0xaa, 0x24, 0x0080}, /* 00,24,80,aa */ + {0xaa, 0x26, 0x0080}, /* 00,26,80,aa */ + {0xaa, 0x00, 0x0084}, /* 00,00,84,aa */ + {0xa0, 0x02, 0x00a3}, /* 00,a3,02,cc */ + {0xa0, 0x08, 0x00a4}, /* 00,a4,08,cc */ + {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ + {0xa0, 0x04, 0x0191}, /* 01,91,04,cc */ + {0xa0, 0x10, 0x0192}, /* 01,92,10,cc */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */ + {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */ + {0xa0, 0x41, 0x0197}, /* 01,97,41,cc */ + {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */ + {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */ + {0xa0, 0x10, 0x01a9}, /* 01,a9,10,cc */ + {0xa0, 0x12, 0x01aa}, /* 01,aa,12,cc */ + {0xa0, 0xc1, 0x001d}, /* 00,1d,c1,cc */ + {0xa0, 0xd4, 0x001e}, /* 00,1e,d4,cc */ + {0xa0, 0xe8, 0x001f}, /* 00,1f,e8,cc */ + {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc */ + {0, 0, 0} +}; +static struct usb_action icm105a_60HZScale[] = { + {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xaa, 0x0d, 0x0003}, /* 00,0d,03,aa */ + {0xaa, 0x0c, 0x0008}, /* 00,0c,08,aa */ + {0xaa, 0x0e, 0x0086}, /* 00,0e,86,aa */ + {0xaa, 0x0f, 0x0002}, /* 00,0f,02,aa */ + {0xaa, 0x1c, 0x0085}, /* 00,1c,85,aa */ + {0xaa, 0x1d, 0x0002}, /* 00,1d,02,aa */ + {0xaa, 0x20, 0x0080}, /* 00,20,80,aa */ + {0xaa, 0x22, 0x0080}, /* 00,22,80,aa */ + {0xaa, 0x24, 0x0080}, /* 00,24,80,aa */ + {0xaa, 0x26, 0x0080}, /* 00,26,80,aa */ + {0xaa, 0x00, 0x0084}, /* 00,00,84,aa */ + {0xa0, 0x02, 0x00a3}, /* 00,a3,02,cc */ + {0xa0, 0x85, 0x00a4}, /* 00,a4,85,cc */ + {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ + {0xa0, 0x04, 0x0191}, /* 01,91,04,cc */ + {0xa0, 0x08, 0x0192}, /* 01,92,08,cc */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */ + {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */ + {0xa0, 0x81, 0x0197}, /* 01,97,81,cc */ + {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */ + {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */ + {0xa0, 0x10, 0x01a9}, /* 01,a9,10,cc */ + {0xa0, 0x12, 0x01aa}, /* 01,aa,12,cc */ + {0xa0, 0xc2, 0x001d}, /* 00,1d,c2,cc */ + {0xa0, 0xd6, 0x001e}, /* 00,1e,d6,cc */ + {0xa0, 0xea, 0x001f}, /* 00,1f,ea,cc */ + {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc */ + {0xa0, 0x00, 0x01a7}, /* 01,a7,00,cc */ + {0xa0, 0xc0, 0x01a8}, /* 01,a8,c0,cc */ + {0, 0, 0} +}; +static struct usb_action icm105a_NoFliker[] = { + {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xaa, 0x0d, 0x0003}, /* 00,0d,03,aa */ + {0xaa, 0x0c, 0x0004}, /* 00,0c,04,aa */ + {0xaa, 0x0e, 0x000d}, /* 00,0e,0d,aa */ + {0xaa, 0x0f, 0x0002}, /* 00,0f,02,aa */ + {0xaa, 0x1c, 0x0000}, /* 00,1c,00,aa */ + {0xaa, 0x1d, 0x0002}, /* 00,1d,02,aa */ + {0xaa, 0x20, 0x0080}, /* 00,20,80,aa */ + {0xaa, 0x22, 0x0080}, /* 00,22,80,aa */ + {0xaa, 0x24, 0x0080}, /* 00,24,80,aa */ + {0xaa, 0x26, 0x0080}, /* 00,26,80,aa */ + {0xaa, 0x00, 0x0084}, /* 00,00,84,aa */ + {0xa0, 0x02, 0x00a3}, /* 00,a3,02,cc */ + {0xa0, 0x00, 0x00a4}, /* 00,a4,00,cc */ + {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ + {0xa0, 0x04, 0x0191}, /* 01,91,04,cc */ + {0xa0, 0x20, 0x0192}, /* 01,92,20,cc */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */ + {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */ + {0xa0, 0x10, 0x0197}, /* 01,97,10,cc */ + {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */ + {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */ + {0xa0, 0x00, 0x01a9}, /* 01,a9,00,cc */ + {0xa0, 0x00, 0x01aa}, /* 01,aa,00,cc */ + {0xa0, 0xc1, 0x001d}, /* 00,1d,c1,cc */ + {0xa0, 0xd4, 0x001e}, /* 00,1e,d4,cc */ + {0xa0, 0xe8, 0x001f}, /* 00,1f,e8,cc */ + {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc */ + {0, 0, 0} +}; +static struct usb_action icm105a_NoFlikerScale[] = { + {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xaa, 0x0d, 0x0003}, /* 00,0d,03,aa */ + {0xaa, 0x0c, 0x0004}, /* 00,0c,04,aa */ + {0xaa, 0x0e, 0x0081}, /* 00,0e,81,aa */ + {0xaa, 0x0f, 0x0002}, /* 00,0f,02,aa */ + {0xaa, 0x1c, 0x0080}, /* 00,1c,80,aa */ + {0xaa, 0x1d, 0x0002}, /* 00,1d,02,aa */ + {0xaa, 0x20, 0x0080}, /* 00,20,80,aa */ + {0xaa, 0x22, 0x0080}, /* 00,22,80,aa */ + {0xaa, 0x24, 0x0080}, /* 00,24,80,aa */ + {0xaa, 0x26, 0x0080}, /* 00,26,80,aa */ + {0xaa, 0x00, 0x0084}, /* 00,00,84,aa */ + {0xa0, 0x02, 0x00a3}, /* 00,a3,02,cc */ + {0xa0, 0x80, 0x00a4}, /* 00,a4,80,cc */ + {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ + {0xa0, 0x04, 0x0191}, /* 01,91,04,cc */ + {0xa0, 0x20, 0x0192}, /* 01,92,20,cc */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */ + {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */ + {0xa0, 0x10, 0x0197}, /* 01,97,10,cc */ + {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */ + {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */ + {0xa0, 0x00, 0x01a9}, /* 01,a9,00,cc */ + {0xa0, 0x00, 0x01aa}, /* 01,aa,00,cc */ + {0xa0, 0xc1, 0x001d}, /* 00,1d,c1,cc */ + {0xa0, 0xd4, 0x001e}, /* 00,1e,d4,cc */ + {0xa0, 0xe8, 0x001f}, /* 00,1f,e8,cc */ + {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc */ + {0xa0, 0x00, 0x01a7}, /* 01,a7,00,cc */ + {0xa0, 0xc0, 0x01a8}, /* 01,a8,c0,cc */ + {0, 0, 0} +}; + +static struct usb_action MC501CB_InitialScale[] = { + {0xa0, 0x01, 0x0000}, /* 00,00,01,cc */ + {0xa0, 0x00, 0x0002}, /* 00,02,00,cc */ + {0xa0, 0x01, 0x0010}, /* 00,10,01,cc */ + {0xa0, 0x01, 0x0001}, /* 00,01,01,cc */ + {0xa0, 0x03, 0x0008}, /* 00,08,03,cc */ + {0xa0, 0x01, 0x0012}, /* 00,12,01,cc */ + {0xa0, 0x05, 0x0012}, /* 00,12,05,cc */ + {0xa0, 0x02, 0x0003}, /* 00,03,02,cc */ + {0xa0, 0x80, 0x0004}, /* 00,04,80,cc */ + {0xa0, 0x01, 0x0005}, /* 00,05,01,cc */ + {0xa0, 0xd8, 0x0006}, /* 00,06,d8,cc */ + {0xa0, 0x00, 0x0098}, /* 00,98,00,cc */ + {0xa0, 0x00, 0x009a}, /* 00,9a,00,cc */ + {0xa0, 0x00, 0x011a}, /* 01,1a,00,cc */ + {0xa0, 0x00, 0x011c}, /* 01,1c,00,cc */ + {0xa0, 0x01, 0x009b}, /* 00,9b,01,cc */ + {0xa0, 0xde, 0x009c}, /* 00,9c,de,cc */ + {0xa0, 0x02, 0x009d}, /* 00,9d,02,cc */ + {0xa0, 0x86, 0x009e}, /* 00,9e,86,cc */ + {0xa0, 0x33, 0x0086}, /* 00,86,33,cc */ + {0xa0, 0x34, 0x0087}, /* 00,87,34,cc */ + {0xa0, 0x35, 0x0088}, /* 00,88,35,cc */ + {0xa0, 0xb0, 0x008b}, /* 00,8b,b0,cc */ + {0xa0, 0x05, 0x0012}, /* 00,12,05,cc */ + {0xaa, 0x01, 0x0001}, /* 00,01,01,aa */ + {0xaa, 0x01, 0x0003}, /* 00,01,03,aa */ + {0xaa, 0x01, 0x0001}, /* 00,01,01,aa */ + {0xaa, 0x03, 0x0000}, /* 00,03,00,aa */ + {0xaa, 0x10, 0x0000}, /* 00,10,00,aa */ + {0xaa, 0x11, 0x0080}, /* 00,11,80,aa */ + {0xaa, 0x12, 0x0000}, /* 00,12,00,aa */ + {0xaa, 0x13, 0x0000}, /* 00,13,00,aa */ + {0xaa, 0x14, 0x0000}, /* 00,14,00,aa */ + {0xaa, 0x15, 0x0000}, /* 00,15,00,aa */ + {0xaa, 0x16, 0x0000}, /* 00,16,00,aa */ + {0xaa, 0x17, 0x0001}, /* 00,17,01,aa */ + {0xaa, 0x18, 0x00de}, /* 00,18,de,aa */ + {0xaa, 0x19, 0x0002}, /* 00,19,02,aa */ + {0xaa, 0x1a, 0x0086}, /* 00,1a,86,aa */ + {0xaa, 0x20, 0x00a8}, /* 00,20,a8,aa */ + {0xaa, 0x22, 0x0000}, /* 00,22,00,aa */ + {0xaa, 0x23, 0x0000}, /* 00,23,00,aa */ + {0xaa, 0x24, 0x0000}, /* 00,24,00,aa */ + {0xaa, 0x40, 0x0033}, /* 00,40,33,aa */ + {0xaa, 0x41, 0x0077}, /* 00,41,77,aa */ + {0xaa, 0x42, 0x0053}, /* 00,42,53,aa */ + {0xaa, 0x43, 0x00b0}, /* 00,43,b0,aa */ + {0xaa, 0x4b, 0x0001}, /* 00,4b,01,aa */ + {0xaa, 0x72, 0x0020}, /* 00,72,20,aa */ + {0xaa, 0x73, 0x0000}, /* 00,73,00,aa */ + {0xaa, 0x80, 0x0000}, /* 00,80,00,aa */ + {0xaa, 0x85, 0x0050}, /* 00,85,50,aa */ + {0xaa, 0x91, 0x0070}, /* 00,91,70,aa */ + {0xaa, 0x92, 0x0072}, /* 00,92,72,aa */ + {0xaa, 0x03, 0x0001}, /* 00,03,01,aa */ + {0xaa, 0x10, 0x00a0}, /* 00,10,a0,aa */ + {0xaa, 0x11, 0x0001}, /* 00,11,01,aa */ + {0xaa, 0x30, 0x0000}, /* 00,30,00,aa */ + {0xaa, 0x60, 0x0000}, /* 00,60,00,aa */ + {0xaa, 0xa0, 0x001a}, /* 00,a0,1a,aa */ + {0xaa, 0xa1, 0x0000}, /* 00,a1,00,aa */ + {0xaa, 0xa2, 0x003f}, /* 00,a2,3f,aa */ + {0xaa, 0xa3, 0x0028}, /* 00,a3,28,aa */ + {0xaa, 0xa4, 0x0010}, /* 00,a4,10,aa */ + {0xaa, 0xa5, 0x0020}, /* 00,a5,20,aa */ + {0xaa, 0xb1, 0x0044}, /* 00,b1,44,aa */ + {0xaa, 0xd0, 0x0001}, /* 00,d0,01,aa */ + {0xaa, 0xd1, 0x0085}, /* 00,d1,85,aa */ + {0xaa, 0xd2, 0x0080}, /* 00,d2,80,aa */ + {0xaa, 0xd3, 0x0080}, /* 00,d3,80,aa */ + {0xaa, 0xd4, 0x0080}, /* 00,d4,80,aa */ + {0xaa, 0xd5, 0x0080}, /* 00,d5,80,aa */ + {0xaa, 0xc0, 0x00c3}, /* 00,c0,c3,aa */ + {0xaa, 0xc2, 0x0044}, /* 00,c2,44,aa */ + {0xaa, 0xc4, 0x0040}, /* 00,c4,40,aa */ + {0xaa, 0xc5, 0x0020}, /* 00,c5,20,aa */ + {0xaa, 0xc6, 0x0008}, /* 00,c6,08,aa */ + {0xaa, 0x03, 0x0004}, /* 00,03,04,aa */ + {0xaa, 0x10, 0x0000}, /* 00,10,00,aa */ + {0xaa, 0x40, 0x0030}, /* 00,40,30,aa */ + {0xaa, 0x41, 0x0020}, /* 00,41,20,aa */ + {0xaa, 0x42, 0x002d}, /* 00,42,2d,aa */ + {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */ + {0xaa, 0x1c, 0x0050}, /* 00,1C,50,aa */ + {0xaa, 0x11, 0x0081}, /* 00,11,81,aa */ + {0xaa, 0x3b, 0x001d}, /* 00,3b,1D,aa */ + {0xaa, 0x3c, 0x004c}, /* 00,3c,4C,aa */ + {0xaa, 0x3d, 0x0018}, /* 00,3d,18,aa */ + {0xaa, 0x3e, 0x006a}, /* 00,3e,6A,aa */ + {0xaa, 0x01, 0x0000}, /* 00,01,00,aa */ + {0xaa, 0x52, 0x00ff}, /* 00,52,FF,aa */ + {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xa0, 0x0d, 0x0100}, /* 01,00,0d,cc */ + {0xa0, 0x37, 0x0101}, /* 01,01,37,cc */ + {0xa0, 0x06, 0x0189}, /* 01,89,06,cc */ + {0xa0, 0x03, 0x01c5}, /* 01,c5,03,cc */ + {0xa0, 0x13, 0x01cb}, /* 01,cb,13,cc */ + {0xa0, 0x08, 0x0250}, /* 02,50,08,cc */ + {0xa0, 0x08, 0x0301}, /* 03,01,08,cc */ + {0xa0, 0x02, 0x0180}, /* 01,80,02,cc */ + {0xaa, 0x03, 0x0002}, /* 00,03,02,aa */ + {0xaa, 0x51, 0x0027}, /* 00,51,27,aa */ + {0xaa, 0x52, 0x0020}, /* 00,52,20,aa */ + {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */ + {0xaa, 0x50, 0x0010}, /* 00,50,10,aa */ + {0xaa, 0x51, 0x0010}, /* 00,51,10,aa */ + {0xaa, 0x54, 0x0010}, /* 00,54,10,aa */ + {0xaa, 0x55, 0x0010}, /* 00,55,10,aa */ + {0xa0, 0xf0, 0x0199}, /* 01,99,F0,cc */ + {0xa0, 0x80, 0x019a}, /* 01,9A,80,cc */ + + {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */ + {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */ + {0xaa, 0x36, 0x001d}, /* 00,36,1D,aa */ + {0xaa, 0x37, 0x004c}, /* 00,37,4C,aa */ + {0xaa, 0x3b, 0x001d}, /* 00,3B,1D,aa */ + {0, 0, 0} +}; + +static struct usb_action MC501CB_Initial[] = { /* 320x240 */ + {0xa0, 0x01, 0x0000}, /* 00,00,01,cc */ + {0xa0, 0x10, 0x0002}, /* 00,02,10,cc */ + {0xa0, 0x01, 0x0010}, /* 00,10,01,cc */ + {0xa0, 0x01, 0x0001}, /* 00,01,01,cc */ + {0xa0, 0x03, 0x0008}, /* 00,08,03,cc */ + {0xa0, 0x01, 0x0012}, /* 00,12,01,cc */ + {0xa0, 0x05, 0x0012}, /* 00,12,05,cc */ + {0xa0, 0x02, 0x0003}, /* 00,03,02,cc */ + {0xa0, 0x80, 0x0004}, /* 00,04,80,cc */ + {0xa0, 0x01, 0x0005}, /* 00,05,01,cc */ + {0xa0, 0xd0, 0x0006}, /* 00,06,d0,cc */ + {0xa0, 0x00, 0x0098}, /* 00,98,00,cc */ + {0xa0, 0x00, 0x009a}, /* 00,9a,00,cc */ + {0xa0, 0x00, 0x011a}, /* 01,1a,00,cc */ + {0xa0, 0x00, 0x011c}, /* 01,1c,00,cc */ + {0xa0, 0x01, 0x009b}, /* 00,9b,01,cc */ + {0xa0, 0xd8, 0x009c}, /* 00,9c,d8,cc */ + {0xa0, 0x02, 0x009d}, /* 00,9d,02,cc */ + {0xa0, 0x88, 0x009e}, /* 00,9e,88,cc */ + {0xa0, 0x33, 0x0086}, /* 00,86,33,cc */ + {0xa0, 0x34, 0x0087}, /* 00,87,34,cc */ + {0xa0, 0x35, 0x0088}, /* 00,88,35,cc */ + {0xa0, 0xb0, 0x008b}, /* 00,8b,b0,cc */ + {0xa0, 0x05, 0x0012}, /* 00,12,05,cc */ + {0xaa, 0x01, 0x0001}, /* 00,01,01,aa */ + {0xaa, 0x01, 0x0003}, /* 00,01,03,aa */ + {0xaa, 0x01, 0x0001}, /* 00,01,01,aa */ + {0xaa, 0x03, 0x0000}, /* 00,03,00,aa */ + {0xaa, 0x10, 0x0000}, /* 00,10,00,aa */ + {0xaa, 0x11, 0x0080}, /* 00,11,80,aa */ + {0xaa, 0x12, 0x0000}, /* 00,12,00,aa */ + {0xaa, 0x13, 0x0000}, /* 00,13,00,aa */ + {0xaa, 0x14, 0x0000}, /* 00,14,00,aa */ + {0xaa, 0x15, 0x0000}, /* 00,15,00,aa */ + {0xaa, 0x16, 0x0000}, /* 00,16,00,aa */ + {0xaa, 0x17, 0x0001}, /* 00,17,01,aa */ + {0xaa, 0x18, 0x00d8}, /* 00,18,d8,aa */ + {0xaa, 0x19, 0x0002}, /* 00,19,02,aa */ + {0xaa, 0x1a, 0x0088}, /* 00,1a,88,aa */ + {0xaa, 0x20, 0x00a8}, /* 00,20,a8,aa */ + {0xaa, 0x22, 0x0000}, /* 00,22,00,aa */ + {0xaa, 0x23, 0x0000}, /* 00,23,00,aa */ + {0xaa, 0x24, 0x0000}, /* 00,24,00,aa */ + {0xaa, 0x40, 0x0033}, /* 00,40,33,aa */ + {0xaa, 0x41, 0x0077}, /* 00,41,77,aa */ + {0xaa, 0x42, 0x0053}, /* 00,42,53,aa */ + {0xaa, 0x43, 0x00b0}, /* 00,43,b0,aa */ + {0xaa, 0x4b, 0x0001}, /* 00,4b,01,aa */ + {0xaa, 0x72, 0x0020}, /* 00,72,20,aa */ + {0xaa, 0x73, 0x0000}, /* 00,73,00,aa */ + {0xaa, 0x80, 0x0000}, /* 00,80,00,aa */ + {0xaa, 0x85, 0x0050}, /* 00,85,50,aa */ + {0xaa, 0x91, 0x0070}, /* 00,91,70,aa */ + {0xaa, 0x92, 0x0072}, /* 00,92,72,aa */ + {0xaa, 0x03, 0x0001}, /* 00,03,01,aa */ + {0xaa, 0x10, 0x00a0}, /* 00,10,a0,aa */ + {0xaa, 0x11, 0x0001}, /* 00,11,01,aa */ + {0xaa, 0x30, 0x0000}, /* 00,30,00,aa */ + {0xaa, 0x60, 0x0000}, /* 00,60,00,aa */ + {0xaa, 0xa0, 0x001a}, /* 00,a0,1a,aa */ + {0xaa, 0xa1, 0x0000}, /* 00,a1,00,aa */ + {0xaa, 0xa2, 0x003f}, /* 00,a2,3f,aa */ + {0xaa, 0xa3, 0x0028}, /* 00,a3,28,aa */ + {0xaa, 0xa4, 0x0010}, /* 00,a4,10,aa */ + {0xaa, 0xa5, 0x0020}, /* 00,a5,20,aa */ + {0xaa, 0xb1, 0x0044}, /* 00,b1,44,aa */ + {0xaa, 0xd0, 0x0001}, /* 00,d0,01,aa */ + {0xaa, 0xd1, 0x0085}, /* 00,d1,85,aa */ + {0xaa, 0xd2, 0x0080}, /* 00,d2,80,aa */ + {0xaa, 0xd3, 0x0080}, /* 00,d3,80,aa */ + {0xaa, 0xd4, 0x0080}, /* 00,d4,80,aa */ + {0xaa, 0xd5, 0x0080}, /* 00,d5,80,aa */ + {0xaa, 0xc0, 0x00c3}, /* 00,c0,c3,aa */ + {0xaa, 0xc2, 0x0044}, /* 00,c2,44,aa */ + {0xaa, 0xc4, 0x0040}, /* 00,c4,40,aa */ + {0xaa, 0xc5, 0x0020}, /* 00,c5,20,aa */ + {0xaa, 0xc6, 0x0008}, /* 00,c6,08,aa */ + {0xaa, 0x03, 0x0004}, /* 00,03,04,aa */ + {0xaa, 0x10, 0x0000}, /* 00,10,00,aa */ + {0xaa, 0x40, 0x0030}, /* 00,40,30,aa */ + {0xaa, 0x41, 0x0020}, /* 00,41,20,aa */ + {0xaa, 0x42, 0x002d}, /* 00,42,2d,aa */ + {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */ + {0xaa, 0x1c, 0x0050}, /* 00,1c,50,aa */ + {0xaa, 0x11, 0x0081}, /* 00,11,81,aa */ + {0xaa, 0x3b, 0x003a}, /* 00,3b,3A,aa */ + {0xaa, 0x3c, 0x0098}, /* 00,3c,98,aa */ + {0xaa, 0x3d, 0x0030}, /* 00,3d,30,aa */ + {0xaa, 0x3e, 0x00d4}, /* 00,3E,D4,aa */ + {0xaa, 0x01, 0x0000}, /* 00,01,00,aa */ + {0xaa, 0x52, 0x00ff}, /* 00,52,FF,aa */ + {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xa0, 0x0d, 0x0100}, /* 01,00,0d,cc */ + {0xa0, 0x37, 0x0101}, /* 01,01,37,cc */ + {0xa0, 0x06, 0x0189}, /* 01,89,06,cc */ + {0xa0, 0x03, 0x01c5}, /* 01,c5,03,cc */ + {0xa0, 0x13, 0x01cb}, /* 01,cb,13,cc */ + {0xa0, 0x08, 0x0250}, /* 02,50,08,cc */ + {0xa0, 0x08, 0x0301}, /* 03,01,08,cc */ + {0xa0, 0x02, 0x0180}, /* 01,80,02,cc */ + {0xaa, 0x03, 0x0002}, /* 00,03,02,aa */ + {0xaa, 0x51, 0x004e}, /* 00,51,4E,aa */ + {0xaa, 0x52, 0x0041}, /* 00,52,41,aa */ + {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */ + {0xaa, 0x50, 0x0010}, /* 00,50,10,aa */ + {0xaa, 0x51, 0x0010}, /* 00,51,10,aa */ + {0xaa, 0x54, 0x0010}, /* 00,54,10,aa */ + {0xaa, 0x55, 0x0010}, /* 00,55,10,aa */ + {0xa0, 0xf0, 0x0199}, /* 01,99,F0,cc */ + {0xa0, 0x80, 0x019a}, /* 01,9A,80,cc */ + {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */ + {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */ + {0xaa, 0x36, 0x001d}, /* 00,36,1D,aa */ + {0xaa, 0x37, 0x004c}, /* 00,37,4C,aa */ + {0xaa, 0x3b, 0x001d}, /* 00,3B,1D,aa */ + {0, 0, 0} +}; + +static struct usb_action MC501CB_50HZ[] = { + {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */ + {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */ + {0xaa, 0x36, 0x001d}, /* 00,36,1D,aa */ + {0xaa, 0x37, 0x004c}, /* 00,37,4C,aa */ + {0xaa, 0x3b, 0x001d}, /* 00,3B,1D,aa */ + {0xaa, 0x3c, 0x004c}, /* 00,3C,4C,aa */ + {0xaa, 0x3d, 0x001d}, /* 00,3D,1D,aa */ + {0xaa, 0x3e, 0x004c}, /* 00,3E,4C,aa */ + {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */ + {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */ + {0xaa, 0x36, 0x003a}, /* 00,36,3A,aa */ + {0xaa, 0x37, 0x0098}, /* 00,37,98,aa */ + {0xaa, 0x3b, 0x003a}, /* 00,3B,3A,aa */ + {0, 0, 0} +}; + +static struct usb_action MC501CB_50HZScale[] = { + {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */ + {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */ + {0xaa, 0x36, 0x003a}, /* 00,36,3A,aa */ + {0xaa, 0x37, 0x0098}, /* 00,37,98,aa */ + {0xaa, 0x3b, 0x003a}, /* 00,3B,3A,aa */ + {0xaa, 0x3c, 0x0098}, /* 00,3C,98,aa */ + {0xaa, 0x3d, 0x003a}, /* 00,3D,3A,aa */ + {0xaa, 0x3e, 0x0098}, /* 00,3E,98,aa */ + {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */ + {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */ + {0xaa, 0x36, 0x0018}, /* 00,36,18,aa */ + {0xaa, 0x37, 0x006a}, /* 00,37,6A,aa */ + {0xaa, 0x3d, 0x0018}, /* 00,3D,18,aa */ + {0, 0, 0} +}; + +static struct usb_action MC501CB_60HZ[] = { + {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */ + {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */ + {0xaa, 0x36, 0x0018}, /* 00,36,18,aa */ + {0xaa, 0x37, 0x006a}, /* 00,37,6A,aa */ + {0xaa, 0x3d, 0x0018}, /* 00,3D,18,aa */ + {0xaa, 0x3e, 0x006a}, /* 00,3E,6A,aa */ + {0xaa, 0x3b, 0x0018}, /* 00,3B,18,aa */ + {0xaa, 0x3c, 0x006a}, /* 00,3C,6A,aa */ + {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */ + {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */ + {0xaa, 0x36, 0x0030}, /* 00,36,30,aa */ + {0xaa, 0x37, 0x00d4}, /* 00,37,D4,aa */ + {0xaa, 0x3d, 0x0030}, /* 00,3D,30,aa */ + {0, 0, 0} +}; + +static struct usb_action MC501CB_60HZScale[] = { + {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */ + {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */ + {0xaa, 0x36, 0x0030}, /* 00,36,30,aa */ + {0xaa, 0x37, 0x00d4}, /* 00,37,D4,aa */ + {0xaa, 0x3d, 0x0030}, /* 00,3D,30,aa */ + {0xaa, 0x3e, 0x00d4}, /* 00,3E,D4,aa */ + {0xaa, 0x3b, 0x0030}, /* 00,3B,30,aa */ + {0xaa, 0x3c, 0x00d4}, /* 00,3C,D4,aa */ + {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */ + {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */ + {0xaa, 0x36, 0x0018}, /* 00,36,18,aa */ + {0xaa, 0x37, 0x006a}, /* 00,37,6A,aa */ + {0xaa, 0x3d, 0x0018}, /* 00,3D,18,aa */ + {0, 0, 0} +}; + +static struct usb_action MC501CB_NoFliker[] = { + {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */ + {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */ + {0xaa, 0x36, 0x0018}, /* 00,36,18,aa */ + {0xaa, 0x37, 0x006a}, /* 00,37,6A,aa */ + {0xaa, 0x3d, 0x0018}, /* 00,3D,18,aa */ + {0xaa, 0x3e, 0x006a}, /* 00,3E,6A,aa */ + {0xaa, 0x3b, 0x0018}, /* 00,3B,18,aa */ + {0xaa, 0x3c, 0x006a}, /* 00,3C,6A,aa */ + {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */ + {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */ + {0xaa, 0x36, 0x0030}, /* 00,36,30,aa */ + {0xaa, 0x37, 0x00d4}, /* 00,37,D4,aa */ + {0xaa, 0x3d, 0x0030}, /* 00,3D,30,aa */ + {0, 0, 0} +}; + +static struct usb_action MC501CB_NoFlikerScale[] = { + {0xaa, 0x03, 0x0003}, /* 00,03,03,aa */ + {0xaa, 0x10, 0x00fc}, /* 00,10,fc,aa */ + {0xaa, 0x36, 0x0030}, /* 00,36,30,aa */ + {0xaa, 0x37, 0x00d4}, /* 00,37,D4,aa */ + {0xaa, 0x3d, 0x0030}, /* 00,3D,30,aa */ + {0xaa, 0x3e, 0x00d4}, /* 00,3E,D4,aa */ + {0xaa, 0x3b, 0x0030}, /* 00,3B,30,aa */ + {0xaa, 0x3c, 0x00d4}, /* 00,3C,D4,aa */ + {0, 0, 0} +}; + +/* from zs211.inf - HKR,%OV7620%,Initial - 640x480 */ +static struct usb_action OV7620_mode0[] = { + {0xa0, 0x01, 0x0000}, /* 00,00,01,cc */ + {0xa0, 0x40, 0x0002}, /* 00,02,40,cc */ + {0xa0, 0x00, 0x0008}, /* 00,08,00,cc */ + {0xa0, 0x01, 0x0001}, /* 00,01,01,cc */ + {0xa0, 0x06, 0x0010}, /* 00,10,06,cc */ + {0xa0, 0x02, 0x0083}, /* 00,83,02,cc */ + {0xa0, 0x01, 0x0085}, /* 00,85,01,cc */ + {0xa0, 0x80, 0x0086}, /* 00,86,80,cc */ + {0xa0, 0x81, 0x0087}, /* 00,87,81,cc */ + {0xa0, 0x10, 0x0088}, /* 00,88,10,cc */ + {0xa0, 0xa1, 0x008b}, /* 00,8b,a1,cc */ + {0xa0, 0x08, 0x008d}, /* 00,8d,08,cc */ + {0xa0, 0x02, 0x0003}, /* 00,03,02,cc */ + {0xa0, 0x80, 0x0004}, /* 00,04,80,cc */ + {0xa0, 0x01, 0x0005}, /* 00,05,01,cc */ + {0xa0, 0xd8, 0x0006}, /* 00,06,d8,cc */ + {0xa0, 0x03, 0x0012}, /* 00,12,03,cc */ + {0xa0, 0x01, 0x0012}, /* 00,12,01,cc */ + {0xa0, 0x00, 0x0098}, /* 00,98,00,cc */ + {0xa0, 0x00, 0x009a}, /* 00,9a,00,cc */ + {0xa0, 0x00, 0x011a}, /* 01,1a,00,cc */ + {0xa0, 0x00, 0x011c}, /* 01,1c,00,cc */ + {0xa0, 0xde, 0x009c}, /* 00,9c,de,cc */ + {0xa0, 0x86, 0x009e}, /* 00,9e,86,cc */ + {0xaa, 0x12, 0x0088}, /* 00,12,88,aa */ + {0xaa, 0x12, 0x0048}, /* 00,12,48,aa */ + {0xaa, 0x75, 0x008a}, /* 00,75,8a,aa */ + {0xaa, 0x13, 0x00a3}, /* 00,13,a3,aa */ + {0xaa, 0x04, 0x0000}, /* 00,04,00,aa */ + {0xaa, 0x05, 0x0000}, /* 00,05,00,aa */ + {0xaa, 0x14, 0x0000}, /* 00,14,00,aa */ + {0xaa, 0x15, 0x0004}, /* 00,15,04,aa */ + {0xaa, 0x17, 0x0018}, /* 00,17,18,aa */ + {0xaa, 0x18, 0x00ba}, /* 00,18,ba,aa */ + {0xaa, 0x19, 0x0002}, /* 00,19,02,aa */ + {0xaa, 0x1a, 0x00f1}, /* 00,1a,f1,aa */ + {0xaa, 0x20, 0x0040}, /* 00,20,40,aa */ + {0xaa, 0x24, 0x0088}, /* 00,24,88,aa */ + {0xaa, 0x25, 0x0078}, /* 00,25,78,aa */ + {0xaa, 0x27, 0x00f6}, /* 00,27,f6,aa */ + {0xaa, 0x28, 0x00a0}, /* 00,28,a0,aa */ + {0xaa, 0x21, 0x0000}, /* 00,21,00,aa */ + {0xaa, 0x2a, 0x0083}, /* 00,2a,83,aa */ + {0xaa, 0x2b, 0x0096}, /* 00,2b,96,aa */ + {0xaa, 0x2d, 0x0005}, /* 00,2d,05,aa */ + {0xaa, 0x74, 0x0020}, /* 00,74,20,aa */ + {0xaa, 0x61, 0x0068}, /* 00,61,68,aa */ + {0xaa, 0x64, 0x0088}, /* 00,64,88,aa */ + {0xaa, 0x00, 0x0000}, /* 00,00,00,aa */ + {0xaa, 0x06, 0x0080}, /* 00,06,80,aa */ + {0xaa, 0x01, 0x0090}, /* 00,01,90,aa */ + {0xaa, 0x02, 0x0030}, /* 00,02,30,aa */ + {0xa0, 0x77, 0x0101}, /* 01,01,77,cc */ + {0xa0, 0x05, 0x0012}, /* 00,12,05,cc */ + {0xa0, 0x0d, 0x0100}, /* 01,00,0d,cc */ + {0xa0, 0x06, 0x0189}, /* 01,89,06,cc */ + {0xa0, 0x00, 0x01ad}, /* 01,ad,00,cc */ + {0xa0, 0x03, 0x01c5}, /* 01,c5,03,cc */ + {0xa0, 0x13, 0x01cb}, /* 01,cb,13,cc */ + {0xa0, 0x08, 0x0250}, /* 02,50,08,cc */ + {0xa0, 0x08, 0x0301}, /* 03,01,08,cc */ + {0xa0, 0x68, 0x0116}, /* 01,16,68,cc */ + {0xa0, 0x52, 0x0118}, /* 01,18,52,cc */ + {0xa0, 0x40, 0x011d}, /* 01,1d,40,cc */ + {0xa0, 0x02, 0x0180}, /* 01,80,02,cc */ + {0xa0, 0x50, 0x01a8}, /* 01,a8,50,cc */ + {0, 0, 0} +}; + +/* from zs211.inf - HKR,%OV7620%,InitialScale - 320x240 */ +static struct usb_action OV7620_mode1[] = { + {0xa0, 0x01, 0x0000}, /* 00,00,01,cc */ + {0xa0, 0x50, 0x0002}, /* 00,02,50,cc */ + {0xa0, 0x03, 0x0008}, /* 00,08,00,cc */ /* mx change? */ + {0xa0, 0x01, 0x0001}, /* 00,01,01,cc */ + {0xa0, 0x06, 0x0010}, /* 00,10,06,cc */ + {0xa0, 0x02, 0x0083}, /* 00,83,02,cc */ + {0xa0, 0x01, 0x0085}, /* 00,85,01,cc */ + {0xa0, 0x80, 0x0086}, /* 00,86,80,cc */ + {0xa0, 0x81, 0x0087}, /* 00,87,81,cc */ + {0xa0, 0x10, 0x0088}, /* 00,88,10,cc */ + {0xa0, 0xa1, 0x008b}, /* 00,8b,a1,cc */ + {0xa0, 0x08, 0x008d}, /* 00,8d,08,cc */ + {0xa0, 0x02, 0x0003}, /* 00,03,02,cc */ + {0xa0, 0x80, 0x0004}, /* 00,04,80,cc */ + {0xa0, 0x01, 0x0005}, /* 00,05,01,cc */ + {0xa0, 0xd0, 0x0006}, /* 00,06,d0,cc */ + {0xa0, 0x03, 0x0012}, /* 00,12,03,cc */ + {0xa0, 0x01, 0x0012}, /* 00,12,01,cc */ + {0xa0, 0x00, 0x0098}, /* 00,98,00,cc */ + {0xa0, 0x00, 0x009a}, /* 00,9a,00,cc */ + {0xa0, 0x00, 0x011a}, /* 01,1a,00,cc */ + {0xa0, 0x00, 0x011c}, /* 01,1c,00,cc */ + {0xa0, 0xd6, 0x009c}, /* 00,9c,d6,cc */ /* OV7648 00,9c,d8,cc */ + {0xa0, 0x88, 0x009e}, /* 00,9e,88,cc */ + {0xaa, 0x12, 0x0088}, /* 00,12,88,aa */ + {0xaa, 0x12, 0x0048}, /* 00,12,48,aa */ + {0xaa, 0x75, 0x008a}, /* 00,75,8a,aa */ + {0xaa, 0x13, 0x00a3}, /* 00,13,a3,aa */ + {0xaa, 0x04, 0x0000}, /* 00,04,00,aa */ + {0xaa, 0x05, 0x0000}, /* 00,05,00,aa */ + {0xaa, 0x14, 0x0000}, /* 00,14,00,aa */ + {0xaa, 0x15, 0x0004}, /* 00,15,04,aa */ + {0xaa, 0x24, 0x0088}, /* 00,24,88,aa */ + {0xaa, 0x25, 0x0078}, /* 00,25,78,aa */ + {0xaa, 0x17, 0x0018}, /* 00,17,18,aa */ + {0xaa, 0x18, 0x00ba}, /* 00,18,ba,aa */ + {0xaa, 0x19, 0x0002}, /* 00,19,02,aa */ + {0xaa, 0x1a, 0x00f2}, /* 00,1a,f2,aa */ + {0xaa, 0x20, 0x0040}, /* 00,20,40,aa */ + {0xaa, 0x27, 0x00f6}, /* 00,27,f6,aa */ + {0xaa, 0x28, 0x00a0}, /* 00,28,a0,aa */ + {0xaa, 0x21, 0x0000}, /* 00,21,00,aa */ + {0xaa, 0x2a, 0x0083}, /* 00,2a,83,aa */ + {0xaa, 0x2b, 0x0096}, /* 00,2b,96,aa */ + {0xaa, 0x2d, 0x0005}, /* 00,2d,05,aa */ + {0xaa, 0x74, 0x0020}, /* 00,74,20,aa */ + {0xaa, 0x61, 0x0068}, /* 00,61,68,aa */ + {0xaa, 0x64, 0x0088}, /* 00,64,88,aa */ + {0xaa, 0x00, 0x0000}, /* 00,00,00,aa */ + {0xaa, 0x06, 0x0080}, /* 00,06,80,aa */ + {0xaa, 0x01, 0x0090}, /* 00,01,90,aa */ + {0xaa, 0x02, 0x0030}, /* 00,02,30,aa */ + {0xa0, 0x77, 0x0101}, /* 01,01,77,cc */ + {0xa0, 0x05, 0x0012}, /* 00,12,05,cc */ + {0xa0, 0x0d, 0x0100}, /* 01,00,0d,cc */ + {0xa0, 0x06, 0x0189}, /* 01,89,06,cc */ + {0xa0, 0x00, 0x01ad}, /* 01,ad,00,cc */ + {0xa0, 0x03, 0x01c5}, /* 01,c5,03,cc */ + {0xa0, 0x13, 0x01cb}, /* 01,cb,13,cc */ + {0xa0, 0x08, 0x0250}, /* 02,50,08,cc */ + {0xa0, 0x08, 0x0301}, /* 03,01,08,cc */ + {0xa0, 0x68, 0x0116}, /* 01,16,68,cc */ + {0xa0, 0x52, 0x0118}, /* 01,18,52,cc */ + {0xa0, 0x50, 0x011d}, /* 01,1d,50,cc */ + {0xa0, 0x02, 0x0180}, /* 01,80,02,cc */ + {0xa0, 0x50, 0x01a8}, /* 01,a8,50,cc */ + {0, 0, 0} +}; + +/* from zs211.inf - HKR,%OV7620%\AE,50HZ */ +static struct usb_action OV7620_50HZ[] = { + {0xaa, 0x13, 0x00a3}, /* 00,13,a3,aa */ + {0xdd, 0x00, 0x0100}, /* 00,01,00,dd */ + {0xaa, 0x2b, 0x0096}, /* 00,2b,96,aa */ + {0xaa, 0x75, 0x008a}, /* 00,75,8a,aa */ + {0xaa, 0x2d, 0x0005}, /* 00,2d,05,aa */ + {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ + {0xa0, 0x04, 0x0191}, /* 01,91,04,cc */ + {0xa0, 0x18, 0x0192}, /* 01,92,18,cc */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */ + {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */ + {0xa0, 0x83, 0x0197}, /* 01,97,83,cc */ + {0xaa, 0x10, 0x0082}, /* 00,10,82,aa */ + {0xaa, 0x76, 0x0003}, /* 00,76,03,aa */ +/* {0xa0, 0x40, 0x0002}, * 00,02,40,cc - if mode0 (640x480) */ + {0, 0, 0} +}; + +/* from zs211.inf - HKR,%OV7620%\AE,60HZ */ +static struct usb_action OV7620_60HZ[] = { + {0xaa, 0x13, 0x00a3}, /* 00,13,a3,aa */ /* (bug in zs211.inf) */ + {0xdd, 0x00, 0x0100}, /* 00,01,00,dd */ + {0xaa, 0x2b, 0x0000}, /* 00,2b,00,aa */ + {0xaa, 0x75, 0x008a}, /* 00,75,8a,aa */ + {0xaa, 0x2d, 0x0005}, /* 00,2d,05,aa */ + {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ + {0xa0, 0x04, 0x0191}, /* 01,91,04,cc */ + {0xa0, 0x18, 0x0192}, /* 01,92,18,cc */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */ + {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */ + {0xa0, 0x83, 0x0197}, /* 01,97,83,cc */ + {0xaa, 0x10, 0x0020}, /* 00,10,20,aa */ + {0xaa, 0x76, 0x0003}, /* 00,76,03,aa */ +/* {0xa0, 0x40, 0x0002}, * 00,02,40,cc - if mode0 (640x480) */ +/* ?? in gspca v1, it was + {0xa0, 0x00, 0x0039}, * 00,00,00,dd * + {0xa1, 0x01, 0x0037}, */ + {0, 0, 0} +}; + +/* from zs211.inf - HKR,%OV7620%\AE,NoFliker */ +static struct usb_action OV7620_NoFliker[] = { + {0xaa, 0x13, 0x00a3}, /* 00,13,a3,aa */ /* (bug in zs211.inf) */ + {0xdd, 0x00, 0x0100}, /* 00,01,00,dd */ + {0xaa, 0x2b, 0x0000}, /* 00,2b,00,aa */ + {0xaa, 0x75, 0x008e}, /* 00,75,8e,aa */ + {0xaa, 0x2d, 0x0001}, /* 00,2d,01,aa */ + {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ + {0xa0, 0x04, 0x0191}, /* 01,91,04,cc */ + {0xa0, 0x18, 0x0192}, /* 01,92,18,cc */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */ + {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */ + {0xa0, 0x01, 0x0197}, /* 01,97,01,cc */ +/* {0xa0, 0x44, 0x0002}, * 00,02,44,cc - if mode1 (320x240) */ +/* ?? was + {0xa0, 0x00, 0x0039}, * 00,00,00,dd * + {0xa1, 0x01, 0x0037}, */ + {0, 0, 0} +}; + +static struct usb_action ov7630c_Initial[] = { + {0xa0, 0x01, 0x0000}, + {0xa0, 0x10, 0x0002}, + {0xa0, 0x01, 0x0000}, + {0xa0, 0x10, 0x0002}, + {0xa0, 0x03, 0x0008}, + {0xa0, 0x01, 0x0001}, + {0xa0, 0x06, 0x0010}, + {0xa0, 0xa1, 0x008b}, + {0xa0, 0x08, 0x008d}, + {0xa0, 0x02, 0x0003}, + {0xa0, 0x80, 0x0004}, + {0xa0, 0x01, 0x0005}, + {0xa0, 0xe0, 0x0006}, + {0xa0, 0x01, 0x0012}, + {0xaa, 0x12, 0x0080}, + {0xa0, 0x02, 0x0083}, + {0xa0, 0x01, 0x0085}, + {0xa0, 0x90, 0x0086}, + {0xa0, 0x91, 0x0087}, + {0xa0, 0x10, 0x0088}, + {0xa0, 0x00, 0x0098}, + {0xa0, 0x00, 0x009a}, + {0xa0, 0x00, 0x011a}, + {0xa0, 0x00, 0x011c}, + {0xa0, 0xd8, 0x009c}, + {0xa0, 0x88, 0x009e}, + {0xaa, 0x12, 0x0069}, + {0xaa, 0x04, 0x0020}, + {0xaa, 0x06, 0x0050}, + {0xaa, 0x13, 0x0083}, + {0xaa, 0x14, 0x0000}, + {0xaa, 0x15, 0x0024}, + {0xaa, 0x17, 0x0018}, + {0xaa, 0x18, 0x00ba}, + {0xaa, 0x19, 0x0002}, + {0xaa, 0x1a, 0x00f6}, + {0xaa, 0x1b, 0x0002}, + {0xaa, 0x20, 0x00c2}, + {0xaa, 0x24, 0x0060}, + {0xaa, 0x25, 0x0040}, + {0xaa, 0x26, 0x0030}, + {0xaa, 0x27, 0x00ea}, + {0xaa, 0x28, 0x00a0}, + {0xaa, 0x21, 0x0000}, + {0xaa, 0x2a, 0x0081}, + {0xaa, 0x2b, 0x0096}, + {0xaa, 0x2d, 0x0094}, + {0xaa, 0x2f, 0x003d}, + {0xaa, 0x30, 0x0024}, + {0xaa, 0x60, 0x0000}, + {0xaa, 0x61, 0x0040}, + {0xaa, 0x68, 0x007c}, + {0xaa, 0x6f, 0x0015}, + {0xaa, 0x75, 0x0088}, + {0xaa, 0x77, 0x00b5}, + {0xaa, 0x01, 0x0060}, + {0xaa, 0x02, 0x0060}, + {0xa0, 0x05, 0x0012}, + {0xa0, 0x77, 0x0101}, + {0xa0, 0x0d, 0x0100}, + {0xa0, 0x06, 0x0189}, + {0xa0, 0x04, 0x01a7}, + {0xa0, 0x00, 0x01ad}, + {0xa0, 0x03, 0x01c5}, + {0xa0, 0x13, 0x01cb}, + {0xa0, 0x08, 0x0250}, + {0xa0, 0x08, 0x0301}, + {0xa0, 0x60, 0x0116}, + {0xa0, 0x46, 0x0118}, + {0xa0, 0x04, 0x0113}, +/* 0x10, */ + {0xa1, 0x01, 0x0002}, + {0xa0, 0x50, 0x010a}, /* matrix */ + {0xa0, 0xf8, 0x010b}, + {0xa0, 0xf8, 0x010c}, + {0xa0, 0xf8, 0x010d}, + {0xa0, 0x50, 0x010e}, + {0xa0, 0xf8, 0x010f}, + {0xa0, 0xf8, 0x0110}, + {0xa0, 0xf8, 0x0111}, + {0xa0, 0x50, 0x0112}, +/* 0x03, */ + {0xa1, 0x01, 0x0008}, + {0xa0, 0x03, 0x0008}, /* clock ? */ + {0xa0, 0x08, 0x01c6}, +/* 0x05, */ + {0xa1, 0x01, 0x01c8}, +/* 0x07, */ + {0xa1, 0x01, 0x01c9}, +/* 0x0f, */ + {0xa1, 0x01, 0x01ca}, + {0xa0, 0x0f, 0x01cb}, + {0xa0, 0x01, 0x0120}, /* gamma 2 ?*/ + {0xa0, 0x0c, 0x0121}, + {0xa0, 0x1f, 0x0122}, + {0xa0, 0x3a, 0x0123}, + {0xa0, 0x53, 0x0124}, + {0xa0, 0x6d, 0x0125}, + {0xa0, 0x85, 0x0126}, + {0xa0, 0x9c, 0x0127}, + {0xa0, 0xb0, 0x0128}, + {0xa0, 0xc2, 0x0129}, + {0xa0, 0xd1, 0x012a}, + {0xa0, 0xde, 0x012b}, + {0xa0, 0xe9, 0x012c}, + {0xa0, 0xf2, 0x012d}, + {0xa0, 0xf9, 0x012e}, + {0xa0, 0xff, 0x012f}, + {0xa0, 0x05, 0x0130}, + {0xa0, 0x0f, 0x0131}, + {0xa0, 0x16, 0x0132}, + {0xa0, 0x1a, 0x0133}, + {0xa0, 0x19, 0x0134}, + {0xa0, 0x19, 0x0135}, + {0xa0, 0x17, 0x0136}, + {0xa0, 0x15, 0x0137}, + {0xa0, 0x12, 0x0138}, + {0xa0, 0x10, 0x0139}, + {0xa0, 0x0e, 0x013a}, + {0xa0, 0x0b, 0x013b}, + {0xa0, 0x09, 0x013c}, + {0xa0, 0x08, 0x013d}, + {0xa0, 0x06, 0x013e}, + {0xa0, 0x03, 0x013f}, + {0xa0, 0x50, 0x010a}, /* matrix */ + {0xa0, 0xf8, 0x010b}, + {0xa0, 0xf8, 0x010c}, + {0xa0, 0xf8, 0x010d}, + {0xa0, 0x50, 0x010e}, + {0xa0, 0xf8, 0x010f}, + {0xa0, 0xf8, 0x0110}, + {0xa0, 0xf8, 0x0111}, + {0xa0, 0x50, 0x0112}, + + {0xa1, 0x01, 0x0180}, + {0xa0, 0x00, 0x0180}, + {0xaa, 0x10, 0x001b}, + {0xaa, 0x76, 0x0002}, + {0xaa, 0x2a, 0x0081}, + {0xaa, 0x2b, 0x0000}, + {0xa0, 0x00, 0x0190}, + {0xa0, 0x01, 0x0191}, + {0xa0, 0xb8, 0x0192}, + {0xa0, 0x00, 0x0195}, + {0xa0, 0x00, 0x0196}, + {0xa0, 0x37, 0x0197}, + {0xa0, 0x10, 0x018c}, + {0xa0, 0x20, 0x018f}, + {0xa0, 0x10, 0x01a9}, + {0xa0, 0x26, 0x01aa}, + {0xa0, 0x50, 0x011d}, + {0xa0, 0x02, 0x0180}, + {0xa0, 0x40, 0x0180}, + {0xaa, 0x13, 0x0083}, /* 40 */ + {0xa1, 0x01, 0x0180}, + {0xa0, 0x42, 0x0180}, + {0, 0, 0} +}; + +static struct usb_action ov7630c_InitialScale[] = { + {0xa0, 0x01, 0x0000}, + {0xa0, 0x00, 0x0002}, + {0xa0, 0x03, 0x0008}, + {0xa0, 0x01, 0x0001}, + {0xa0, 0x06, 0x0010}, + {0xa0, 0xa1, 0x008b}, + {0xa0, 0x08, 0x008d}, + {0xa0, 0x02, 0x0003}, + {0xa0, 0x80, 0x0004}, + {0xa0, 0x01, 0x0005}, + {0xa0, 0xe0, 0x0006}, + {0xa0, 0x01, 0x0012}, + + {0xaa, 0x12, 0x0080}, + {0xa0, 0x02, 0x0083}, + {0xa0, 0x01, 0x0085}, + {0xa0, 0x90, 0x0086}, + {0xa0, 0x91, 0x0087}, + {0xa0, 0x10, 0x0088}, + {0xa0, 0x00, 0x0098}, + {0xa0, 0x00, 0x009a}, + {0xa0, 0x00, 0x011a}, + {0xa0, 0x00, 0x011c}, + {0xa0, 0xe6, 0x009c}, + {0xa0, 0x86, 0x009e}, + {0xaa, 0x12, 0x0069}, /* i2c */ + {0xaa, 0x04, 0x0020}, + {0xaa, 0x06, 0x0050}, + {0xaa, 0x13, 0x00c3}, + {0xaa, 0x14, 0x0000}, + {0xaa, 0x15, 0x0024}, + {0xaa, 0x19, 0x0003}, + {0xaa, 0x1a, 0x00f6}, + {0xaa, 0x1b, 0x0002}, + {0xaa, 0x20, 0x00c2}, + {0xaa, 0x24, 0x0060}, + {0xaa, 0x25, 0x0040}, + {0xaa, 0x26, 0x0030}, + {0xaa, 0x27, 0x00ea}, + {0xaa, 0x28, 0x00a0}, + {0xaa, 0x21, 0x0000}, + {0xaa, 0x2a, 0x0081}, + {0xaa, 0x2b, 0x0096}, + {0xaa, 0x2d, 0x0084}, + {0xaa, 0x2f, 0x003d}, + {0xaa, 0x30, 0x0024}, + {0xaa, 0x60, 0x0000}, + {0xaa, 0x61, 0x0040}, + {0xaa, 0x68, 0x007c}, + {0xaa, 0x6f, 0x0015}, + {0xaa, 0x75, 0x0088}, + {0xaa, 0x77, 0x00b5}, + {0xaa, 0x01, 0x0060}, + {0xaa, 0x02, 0x0060}, + {0xaa, 0x17, 0x0018}, + {0xaa, 0x18, 0x00ba}, + {0xa0, 0x05, 0x0012}, + {0xa0, 0x77, 0x0101}, + {0xa0, 0x0d, 0x0100}, + {0xa0, 0x06, 0x0189}, + {0xa0, 0x04, 0x01a7}, + {0xa0, 0x00, 0x01ad}, + {0xa0, 0x03, 0x01c5}, + {0xa0, 0x13, 0x01cb}, + {0xa0, 0x08, 0x0250}, + {0xa0, 0x08, 0x0301}, + {0xa0, 0x60, 0x0116}, + {0xa0, 0x46, 0x0118}, + {0xa0, 0x04, 0x0113}, + + {0xa1, 0x01, 0x0002}, + {0xa0, 0x4e, 0x010a}, /* matrix */ + {0xa0, 0xfe, 0x010b}, + {0xa0, 0xf4, 0x010c}, + {0xa0, 0xf7, 0x010d}, + {0xa0, 0x4d, 0x010e}, + {0xa0, 0xfc, 0x010f}, + {0xa0, 0x00, 0x0110}, + {0xa0, 0xf6, 0x0111}, + {0xa0, 0x4a, 0x0112}, + + {0xa1, 0x01, 0x0008}, + {0xa0, 0x03, 0x0008}, /* clock ? */ + {0xa0, 0x08, 0x01c6}, + + {0xa1, 0x01, 0x01c8}, + + {0xa1, 0x01, 0x01c9}, + + {0xa1, 0x01, 0x01ca}, + {0xa0, 0x0f, 0x01cb}, + {0xa0, 0x16, 0x0120}, /* gamma ~4 */ + {0xa0, 0x3a, 0x0121}, + {0xa0, 0x5b, 0x0122}, + {0xa0, 0x7c, 0x0123}, + {0xa0, 0x94, 0x0124}, + {0xa0, 0xa9, 0x0125}, + {0xa0, 0xbb, 0x0126}, + {0xa0, 0xca, 0x0127}, + {0xa0, 0xd7, 0x0128}, + {0xa0, 0xe1, 0x0129}, + {0xa0, 0xea, 0x012a}, + {0xa0, 0xf1, 0x012b}, + {0xa0, 0xf7, 0x012c}, + {0xa0, 0xfc, 0x012d}, + {0xa0, 0xff, 0x012e}, + {0xa0, 0xff, 0x012f}, + {0xa0, 0x20, 0x0130}, + {0xa0, 0x22, 0x0131}, + {0xa0, 0x20, 0x0132}, + {0xa0, 0x1c, 0x0133}, + {0xa0, 0x16, 0x0134}, + {0xa0, 0x13, 0x0135}, + {0xa0, 0x10, 0x0136}, + {0xa0, 0x0d, 0x0137}, + {0xa0, 0x0b, 0x0138}, + {0xa0, 0x09, 0x0139}, + {0xa0, 0x07, 0x013a}, + {0xa0, 0x06, 0x013b}, + {0xa0, 0x05, 0x013c}, + {0xa0, 0x04, 0x013d}, + {0xa0, 0x00, 0x013e}, + {0xa0, 0x01, 0x013f}, + {0xa0, 0x4e, 0x010a}, /* matrix */ + {0xa0, 0xfe, 0x010b}, + {0xa0, 0xf4, 0x010c}, + {0xa0, 0xf7, 0x010d}, + {0xa0, 0x4d, 0x010e}, + {0xa0, 0xfc, 0x010f}, + {0xa0, 0x00, 0x0110}, + {0xa0, 0xf6, 0x0111}, + {0xa0, 0x4a, 0x0112}, + + {0xa1, 0x01, 0x0180}, + {0xa0, 0x00, 0x0180}, + {0xaa, 0x10, 0x000d}, + {0xaa, 0x76, 0x0002}, + {0xaa, 0x2a, 0x0081}, + {0xaa, 0x2b, 0x0000}, + {0xa0, 0x00, 0x0190}, + {0xa0, 0x00, 0x0191}, + {0xa0, 0xd8, 0x0192}, + {0xa0, 0x00, 0x0195}, + {0xa0, 0x00, 0x0196}, + {0xa0, 0x1b, 0x0197}, + {0xa0, 0x10, 0x018c}, + {0xa0, 0x20, 0x018f}, + {0xa0, 0x10, 0x01a9}, + {0xa0, 0x26, 0x01aa}, + {0xa0, 0x50, 0x011d}, + {0xa0, 0x02, 0x0180}, + {0xa0, 0x40, 0x0180}, + {0xaa, 0x13, 0x00c3}, + + {0xa1, 0x01, 0x0180}, + {0xa0, 0x42, 0x0180}, + {0, 0, 0} +}; + +static struct usb_action pas106b_Initial_com[] = { +/* Sream and Sensor specific */ + {0xa1, 0x01, 0x0010}, /* CMOSSensorSelect */ +/* System */ + {0xa0, 0x01, 0x0000}, /* SystemControl */ + {0xa0, 0x01, 0x0000}, /* SystemControl */ +/* Picture size */ + {0xa0, 0x00, 0x0002}, /* ClockSelect */ + {0xa0, 0x03, 0x003a}, + {0xa0, 0x0c, 0x003b}, + {0xa0, 0x04, 0x0038}, + {0, 0, 0} +}; + +static struct usb_action pas106b_Initial[] = { /* 176x144 */ +/* JPEG control */ + {0xa0, 0x03, 0x0008}, /* ClockSetting */ +/* Sream and Sensor specific */ + {0xa0, 0x0f, 0x0010}, /* CMOSSensorSelect */ +/* Picture size */ + {0xa0, 0x00, 0x0003}, /* FrameWidthHigh 00 */ + {0xa0, 0xb0, 0x0004}, /* FrameWidthLow B0 */ + {0xa0, 0x00, 0x0005}, /* FrameHeightHigh 00 */ + {0xa0, 0x90, 0x0006}, /* FrameHightLow 90 */ +/* System */ + {0xa0, 0x01, 0x0001}, /* SystemOperating */ +/* Sream and Sensor specific */ + {0xa0, 0x03, 0x0012}, /* VideoControlFunction */ + {0xa0, 0x01, 0x0012}, /* VideoControlFunction */ +/* Sensor Interface */ + {0xa0, 0x08, 0x008d}, /* Compatibily Mode */ +/* Window inside sensor array */ + {0xa0, 0x03, 0x009a}, /* WinXStartLow */ + {0xa0, 0x00, 0x011a}, /* FirstYLow */ + {0xa0, 0x03, 0x011c}, /* FirstxLow */ + {0xa0, 0x28, 0x009c}, /* WinHeightLow */ + {0xa0, 0x68, 0x009e}, /* WinWidthLow */ +/* Init the sensor */ + {0xaa, 0x02, 0x0004}, + {0xaa, 0x08, 0x0000}, + {0xaa, 0x09, 0x0005}, + {0xaa, 0x0a, 0x0002}, + {0xaa, 0x0b, 0x0002}, + {0xaa, 0x0c, 0x0005}, + {0xaa, 0x0d, 0x0000}, + {0xaa, 0x0e, 0x0002}, + {0xaa, 0x14, 0x0081}, + +/* Other registors */ + {0xa0, 0x37, 0x0101}, /* SensorCorrection */ +/* Frame retreiving */ + {0xa0, 0x00, 0x0019}, /* AutoAdjustFPS */ +/* Gains */ + {0xa0, 0xa0, 0x01a8}, /* DigitalGain */ +/* Unknown */ + {0xa0, 0x00, 0x01ad}, +/* Sharpness */ + {0xa0, 0x03, 0x01c5}, /* SharpnessMode */ + {0xa0, 0x13, 0x01cb}, /* Sharpness05 */ +/* Other registors */ + {0xa0, 0x0d, 0x0100}, /* OperationMode */ +/* Auto exposure and white balance */ + {0xa0, 0x06, 0x0189}, /* AWBStatus */ +/*Dead pixels */ + {0xa0, 0x08, 0x0250}, /* DeadPixelsMode */ +/* EEPROM */ + {0xa0, 0x08, 0x0301}, /* EEPROMAccess */ +/* JPEG control */ + {0xa0, 0x03, 0x0008}, /* ClockSetting */ +/* Unknown */ + {0xa0, 0x08, 0x01c6}, +/* Sharpness */ + {0xa0, 0x0f, 0x01cb}, /* Sharpness05 */ +/* Other registers */ + {0xa0, 0x0d, 0x0100}, /* OperationMode */ +/* Auto exposure and white balance */ + {0xa0, 0x06, 0x0189}, /* AWBStatus */ +/*Dead pixels */ + {0xa0, 0x08, 0x0250}, /* DeadPixelsMode */ +/* EEPROM */ + {0xa0, 0x08, 0x0301}, /* EEPROMAccess */ +/* JPEG control */ + {0xa0, 0x03, 0x0008}, /* ClockSetting */ +/* Sharpness */ + {0xa0, 0x08, 0x01c6}, /* Sharpness00 */ + {0xa0, 0x0f, 0x01cb}, /* Sharpness05 */ + + {0xa0, 0x58, 0x010a}, /* matrix */ + {0xa0, 0xf4, 0x010b}, + {0xa0, 0xf4, 0x010c}, + {0xa0, 0xf4, 0x010d}, + {0xa0, 0x58, 0x010e}, + {0xa0, 0xf4, 0x010f}, + {0xa0, 0xf4, 0x0110}, + {0xa0, 0xf4, 0x0111}, + {0xa0, 0x58, 0x0112}, +/* Auto correction */ + {0xa0, 0x03, 0x0181}, /* WinXstart */ + {0xa0, 0x08, 0x0182}, /* WinXWidth */ + {0xa0, 0x16, 0x0183}, /* WinXCenter */ + {0xa0, 0x03, 0x0184}, /* WinYStart */ + {0xa0, 0x05, 0x0185}, /* WinYWidth */ + {0xa0, 0x14, 0x0186}, /* WinYCenter */ + {0xa0, 0x00, 0x0180}, /* AutoCorrectEnable */ + +/* Auto exposure and white balance */ + {0xa0, 0x00, 0x0190}, /* ExposureLimitHigh */ + {0xa0, 0x03, 0x0191}, /* ExposureLimitMid */ + {0xa0, 0xb1, 0x0192}, /* ExposureLimitLow */ + {0xa0, 0x00, 0x0195}, /* AntiFlickerHigh */ + {0xa0, 0x00, 0x0196}, /* AntiFlickerLow */ + {0xa0, 0x87, 0x0197}, /* AntiFlickerLow */ + {0xa0, 0x0c, 0x018c}, /* AEBFreeze */ + {0xa0, 0x18, 0x018f}, /* AEBUnfreeze */ +/* sensor on */ + {0xaa, 0x07, 0x00b1}, + {0xaa, 0x05, 0x0003}, + {0xaa, 0x04, 0x0001}, + {0xaa, 0x03, 0x003b}, +/* Gains */ + {0xa0, 0x20, 0x01a9}, /* DigitalLimitDiff */ + {0xa0, 0x26, 0x01aa}, /* DigitalGainStep */ + {0xa0, 0xa0, 0x011d}, /* GlobalGain */ + {0xa0, 0x60, 0x011d}, /* GlobalGain */ +/* Auto correction */ + {0xa0, 0x40, 0x0180}, /* AutoCorrectEnable */ + {0xa1, 0x01, 0x0180}, /* AutoCorrectEnable */ + {0xa0, 0x42, 0x0180}, /* AutoCorrectEnable */ +/* Gains */ + {0xa0, 0x40, 0x0116}, /* RGain */ + {0xa0, 0x40, 0x0117}, /* GGain */ + {0xa0, 0x40, 0x0118}, /* BGain */ + {0, 0, 0} +}; + +static struct usb_action pas106b_InitialScale[] = { /* 352x288 */ +/* JPEG control */ + {0xa0, 0x03, 0x0008}, /* ClockSetting */ +/* Sream and Sensor specific */ + {0xa0, 0x0f, 0x0010}, /* CMOSSensorSelect */ +/* Picture size */ + {0xa0, 0x01, 0x0003}, /* FrameWidthHigh */ + {0xa0, 0x60, 0x0004}, /* FrameWidthLow */ + {0xa0, 0x01, 0x0005}, /* FrameHeightHigh */ + {0xa0, 0x20, 0x0006}, /* FrameHightLow */ +/* System */ + {0xa0, 0x01, 0x0001}, /* SystemOperating */ +/* Sream and Sensor specific */ + {0xa0, 0x03, 0x0012}, /* VideoControlFunction */ + {0xa0, 0x01, 0x0012}, /* VideoControlFunction */ +/* Sensor Interface */ + {0xa0, 0x08, 0x008d}, /* Compatibily Mode */ +/* Window inside sensor array */ + {0xa0, 0x03, 0x009a}, /* WinXStartLow */ + {0xa0, 0x00, 0x011a}, /* FirstYLow */ + {0xa0, 0x03, 0x011c}, /* FirstxLow */ + {0xa0, 0x28, 0x009c}, /* WinHeightLow */ + {0xa0, 0x68, 0x009e}, /* WinWidthLow */ +/* Init the sensor */ + {0xaa, 0x02, 0x0004}, + {0xaa, 0x08, 0x0000}, + {0xaa, 0x09, 0x0005}, + {0xaa, 0x0a, 0x0002}, + {0xaa, 0x0b, 0x0002}, + {0xaa, 0x0c, 0x0005}, + {0xaa, 0x0d, 0x0000}, + {0xaa, 0x0e, 0x0002}, + {0xaa, 0x14, 0x0081}, + +/* Other registors */ + {0xa0, 0x37, 0x0101}, /* SensorCorrection */ +/* Frame retreiving */ + {0xa0, 0x00, 0x0019}, /* AutoAdjustFPS */ +/* Gains */ + {0xa0, 0xa0, 0x01a8}, /* DigitalGain */ +/* Unknown */ + {0xa0, 0x00, 0x01ad}, +/* Sharpness */ + {0xa0, 0x03, 0x01c5}, /* SharpnessMode */ + {0xa0, 0x13, 0x01cb}, /* Sharpness05 */ +/* Other registors */ + {0xa0, 0x0d, 0x0100}, /* OperationMode */ +/* Auto exposure and white balance */ + {0xa0, 0x06, 0x0189}, /* AWBStatus */ + {0xa0, 0x80, 0x018d}, /* ????????? */ +/*Dead pixels */ + {0xa0, 0x08, 0x0250}, /* DeadPixelsMode */ +/* EEPROM */ + {0xa0, 0x08, 0x0301}, /* EEPROMAccess */ +/* JPEG control */ + {0xa0, 0x03, 0x0008}, /* ClockSetting */ +/* Unknown */ + {0xa0, 0x08, 0x01c6}, +/* Sharpness */ + {0xa0, 0x0f, 0x01cb}, /* Sharpness05 */ +/* Other registers */ + {0xa0, 0x0d, 0x0100}, /* OperationMode */ +/* Auto exposure and white balance */ + {0xa0, 0x06, 0x0189}, /* AWBStatus */ +/*Dead pixels */ + {0xa0, 0x08, 0x0250}, /* DeadPixelsMode */ +/* EEPROM */ + {0xa0, 0x08, 0x0301}, /* EEPROMAccess */ +/* JPEG control */ + {0xa0, 0x03, 0x0008}, /* ClockSetting */ +/* Sharpness */ + {0xa0, 0x08, 0x01c6}, /* Sharpness00 */ + {0xa0, 0x0f, 0x01cb}, /* Sharpness05 */ + + {0xa0, 0x58, 0x010a}, /* matrix */ + {0xa0, 0xf4, 0x010b}, + {0xa0, 0xf4, 0x010c}, + {0xa0, 0xf4, 0x010d}, + {0xa0, 0x58, 0x010e}, + {0xa0, 0xf4, 0x010f}, + {0xa0, 0xf4, 0x0110}, + {0xa0, 0xf4, 0x0111}, + {0xa0, 0x58, 0x0112}, +/* Auto correction */ + {0xa0, 0x03, 0x0181}, /* WinXstart */ + {0xa0, 0x08, 0x0182}, /* WinXWidth */ + {0xa0, 0x16, 0x0183}, /* WinXCenter */ + {0xa0, 0x03, 0x0184}, /* WinYStart */ + {0xa0, 0x05, 0x0185}, /* WinYWidth */ + {0xa0, 0x14, 0x0186}, /* WinYCenter */ + {0xa0, 0x00, 0x0180}, /* AutoCorrectEnable */ + +/* Auto exposure and white balance */ + {0xa0, 0x00, 0x0190}, /* ExposureLimitHigh 0 */ + {0xa0, 0x03, 0x0191}, /* ExposureLimitMid */ + {0xa0, 0xb1, 0x0192}, /* ExposureLimitLow 0xb1 */ + + {0xa0, 0x00, 0x0195}, /* AntiFlickerHigh 0x00 */ + {0xa0, 0x00, 0x0196}, /* AntiFlickerLow 0x00 */ + {0xa0, 0x87, 0x0197}, /* AntiFlickerLow 0x87 */ + + {0xa0, 0x10, 0x018c}, /* AEBFreeze 0x10 0x0c */ + {0xa0, 0x20, 0x018f}, /* AEBUnfreeze 0x30 0x18 */ +/* sensor on */ + {0xaa, 0x07, 0x00b1}, + {0xaa, 0x05, 0x0003}, + {0xaa, 0x04, 0x0001}, + {0xaa, 0x03, 0x003b}, +/* Gains */ + {0xa0, 0x20, 0x01a9}, /* DigitalLimitDiff */ + {0xa0, 0x26, 0x01aa}, /* DigitalGainStep */ + {0xa0, 0xa0, 0x011d}, /* GlobalGain */ + {0xa0, 0x60, 0x011d}, /* GlobalGain */ +/* Auto correction */ + {0xa0, 0x40, 0x0180}, /* AutoCorrectEnable */ + {0xa1, 0x01, 0x0180}, /* AutoCorrectEnable */ + {0xa0, 0x42, 0x0180}, /* AutoCorrectEnable */ +/* Gains */ + {0xa0, 0x40, 0x0116}, /* RGain */ + {0xa0, 0x40, 0x0117}, /* GGain */ + {0xa0, 0x40, 0x0118}, /* BGain */ + + {0xa0, 0x00, 0x0007}, /* AutoCorrectEnable */ + {0xa0, 0xff, 0x0018}, /* Frame adjust */ + {0, 0, 0} +}; +static struct usb_action pas106b_50HZ[] = { + {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ + {0xa0, 0x06, 0x0191}, /* 01,91,06,cc */ + {0xa0, 0x54, 0x0192}, /* 01,92,54,cc */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */ + {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */ + {0xa0, 0x87, 0x0197}, /* 01,97,87,cc */ + {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */ + {0xa0, 0x30, 0x018f}, /* 01,8f,30,cc */ + {0xaa, 0x03, 0x0021}, /* 00,03,21,aa */ + {0xaa, 0x04, 0x000c}, /* 00,04,0c,aa */ + {0xaa, 0x05, 0x0002}, /* 00,05,02,aa */ + {0xaa, 0x07, 0x001c}, /* 00,07,1c,aa */ + {0xa0, 0x04, 0x01a9}, /* 01,a9,04,cc */ + {0, 0, 0} +}; +static struct usb_action pas106b_60HZ[] = { + {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ + {0xa0, 0x06, 0x0191}, /* 01,91,06,cc */ + {0xa0, 0x2e, 0x0192}, /* 01,92,2e,cc */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */ + {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */ + {0xa0, 0x71, 0x0197}, /* 01,97,71,cc */ + {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */ + {0xa0, 0x30, 0x018f}, /* 01,8f,30,cc */ + {0xaa, 0x03, 0x001c}, /* 00,03,1c,aa */ + {0xaa, 0x04, 0x0004}, /* 00,04,04,aa */ + {0xaa, 0x05, 0x0001}, /* 00,05,01,aa */ + {0xaa, 0x07, 0x00c4}, /* 00,07,c4,aa */ + {0xa0, 0x04, 0x01a9}, /* 01,a9,04,cc */ + {0, 0, 0} +}; +static struct usb_action pas106b_NoFliker[] = { + {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ + {0xa0, 0x06, 0x0191}, /* 01,91,06,cc */ + {0xa0, 0x50, 0x0192}, /* 01,92,50,cc */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */ + {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */ + {0xa0, 0x10, 0x0197}, /* 01,97,10,cc */ + {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */ + {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */ + {0xaa, 0x03, 0x0013}, /* 00,03,13,aa */ + {0xaa, 0x04, 0x0000}, /* 00,04,00,aa */ + {0xaa, 0x05, 0x0001}, /* 00,05,01,aa */ + {0xaa, 0x07, 0x0030}, /* 00,07,30,aa */ + {0xa0, 0x00, 0x01a9}, /* 01,a9,00,cc */ + {0, 0, 0} +}; + +/* Aurelien setting from snoop */ +static struct usb_action pb03303x_Initial[] = { + {0xa0, 0x01, 0x0000}, + {0xa0, 0x03, 0x0008}, + {0xa0, 0x0a, 0x0010}, + {0xa0, 0x10, 0x0002}, + {0xa0, 0x02, 0x0003}, + {0xa0, 0x80, 0x0004}, + {0xa0, 0x01, 0x0005}, + {0xa0, 0xe0, 0x0006}, + {0xa0, 0xdc, 0x008b}, /* 8b -> dc */ + {0xa0, 0x01, 0x0001}, + {0xa0, 0x03, 0x0012}, + {0xa0, 0x01, 0x0012}, + {0xa0, 0x00, 0x0098}, + {0xa0, 0x00, 0x009a}, + {0xa0, 0x00, 0x011a}, + {0xa0, 0x00, 0x011c}, + {0xa0, 0xdc, 0x008b}, + {0xaa, 0x01, 0x0001}, + {0xaa, 0x06, 0x0000}, + {0xaa, 0x08, 0x0483}, + {0xaa, 0x01, 0x0004}, + {0xaa, 0x08, 0x0006}, + {0xaa, 0x02, 0x0011}, + {0xaa, 0x03, 0x01e7}, + {0xaa, 0x04, 0x0287}, + {0xaa, 0x07, 0x3002}, + {0xaa, 0x20, 0x1100}, + {0xaa, 0x35, 0x0050}, + {0xaa, 0x30, 0x0005}, + {0xaa, 0x31, 0x0000}, + {0xaa, 0x58, 0x0078}, + {0xaa, 0x62, 0x0411}, + {0xaa, 0x2b, 0x0028}, + {0xaa, 0x2c, 0x0030}, + {0xaa, 0x2d, 0x0030}, + {0xaa, 0x2e, 0x0028}, + {0xa0, 0x10, 0x0087}, + {0xa0, 0x37, 0x0101}, + {0xa0, 0x05, 0x0012}, + {0xa0, 0x0d, 0x0100}, + {0xa0, 0x06, 0x0189}, + {0xa0, 0x00, 0x01ad}, + {0xa0, 0x03, 0x01c5}, + {0xa0, 0x13, 0x01cb}, + {0xa0, 0x08, 0x0250}, + {0xa0, 0x08, 0x0301}, + {0xa0, 0x60, 0x01a8}, + {0xa0, 0x78, 0x018d}, + {0xa0, 0x61, 0x0116}, + {0xa0, 0x65, 0x0118}, + + {0xa1, 0x01, 0x0002}, + {0xa0, 0x09, 0x01ad}, + {0xa0, 0x15, 0x01ae}, + {0xa0, 0x0d, 0x003a}, + {0xa0, 0x02, 0x003b}, + {0xa0, 0x00, 0x0038}, + {0xa0, 0x50, 0x010a}, /* matrix */ + {0xa0, 0xf8, 0x010b}, + {0xa0, 0xf8, 0x010c}, + {0xa0, 0xf8, 0x010d}, + {0xa0, 0x50, 0x010e}, + {0xa0, 0xf8, 0x010f}, + {0xa0, 0xf8, 0x0110}, + {0xa0, 0xf8, 0x0111}, + {0xa0, 0x50, 0x0112}, + + {0xa1, 0x01, 0x0008}, + {0xa0, 0x03, 0x0008}, /* clock ? */ + {0xa0, 0x08, 0x01c6}, + {0xa1, 0x01, 0x01c8}, + {0xa1, 0x01, 0x01c9}, + {0xa1, 0x01, 0x01ca}, + {0xa0, 0x0f, 0x01cb}, + {0xa0, 0x13, 0x0120}, /* gamma 4 */ + {0xa0, 0x38, 0x0121}, + {0xa0, 0x59, 0x0122}, + {0xa0, 0x79, 0x0123}, + {0xa0, 0x92, 0x0124}, + {0xa0, 0xa7, 0x0125}, + {0xa0, 0xb9, 0x0126}, + {0xa0, 0xc8, 0x0127}, + {0xa0, 0xd4, 0x0128}, + {0xa0, 0xdf, 0x0129}, + {0xa0, 0xe7, 0x012a}, + {0xa0, 0xee, 0x012b}, + {0xa0, 0xf4, 0x012c}, + {0xa0, 0xf9, 0x012d}, + {0xa0, 0xfc, 0x012e}, + {0xa0, 0xff, 0x012f}, + {0xa0, 0x26, 0x0130}, + {0xa0, 0x22, 0x0131}, + {0xa0, 0x20, 0x0132}, + {0xa0, 0x1c, 0x0133}, + {0xa0, 0x16, 0x0134}, + {0xa0, 0x13, 0x0135}, + {0xa0, 0x10, 0x0136}, + {0xa0, 0x0d, 0x0137}, + {0xa0, 0x0b, 0x0138}, + {0xa0, 0x09, 0x0139}, + {0xa0, 0x07, 0x013a}, + {0xa0, 0x06, 0x013b}, + {0xa0, 0x05, 0x013c}, + {0xa0, 0x04, 0x013d}, + {0xa0, 0x03, 0x013e}, + {0xa0, 0x02, 0x013f}, + {0xa0, 0x50, 0x010a}, /* matrix */ + {0xa0, 0xf8, 0x010b}, + {0xa0, 0xf8, 0x010c}, + {0xa0, 0xf8, 0x010d}, + {0xa0, 0x50, 0x010e}, + {0xa0, 0xf8, 0x010f}, + {0xa0, 0xf8, 0x0110}, + {0xa0, 0xf8, 0x0111}, + {0xa0, 0x50, 0x0112}, + + {0xa1, 0x01, 0x0180}, + {0xa0, 0x00, 0x0180}, + {0xa0, 0x00, 0x0180}, + {0xa0, 0x00, 0x0019}, + {0xaa, 0x05, 0x0009}, + {0xaa, 0x09, 0x0134}, + {0xa0, 0x00, 0x0190}, + {0xa0, 0x07, 0x0191}, + {0xa0, 0xec, 0x0192}, + {0xa0, 0x00, 0x0195}, + {0xa0, 0x00, 0x0196}, + {0xa0, 0x9c, 0x0197}, + {0xa0, 0x0e, 0x018c}, + {0xa0, 0x1c, 0x018f}, + {0xa0, 0x14, 0x01a9}, + {0xa0, 0x24, 0x01aa}, + {0xa0, 0xd7, 0x001d}, + {0xa0, 0xf4, 0x001e}, + {0xa0, 0xf9, 0x001f}, + {0xa0, 0xff, 0x0020}, + {0xa0, 0x42, 0x0180}, + {0xa0, 0x09, 0x01ad}, + {0xa0, 0x15, 0x01ae}, + {0xa0, 0x40, 0x0180}, + {0xa1, 0x01, 0x0180}, + {0xa0, 0x42, 0x0180}, + {0, 0, 0} +}; + +static struct usb_action pb03303x_InitialScale[] = { + {0xa0, 0x01, 0x0000}, + {0xa0, 0x03, 0x0008}, + {0xa0, 0x0a, 0x0010}, + {0xa0, 0x00, 0x0002}, + {0xa0, 0x02, 0x0003}, + {0xa0, 0x80, 0x0004}, + {0xa0, 0x01, 0x0005}, + {0xa0, 0xe0, 0x0006}, + {0xa0, 0xdc, 0x008b}, /* 8b -> dc */ + {0xa0, 0x01, 0x0001}, + {0xa0, 0x03, 0x0012}, + {0xa0, 0x01, 0x0012}, + {0xa0, 0x00, 0x0098}, + {0xa0, 0x00, 0x009a}, + {0xa0, 0x00, 0x011a}, + {0xa0, 0x00, 0x011c}, + {0xa0, 0xdc, 0x008b}, + {0xaa, 0x01, 0x0001}, + {0xaa, 0x06, 0x0000}, + {0xaa, 0x08, 0x0483}, + {0xaa, 0x01, 0x0004}, + {0xaa, 0x08, 0x0006}, + {0xaa, 0x02, 0x0011}, + {0xaa, 0x03, 0x01e7}, + {0xaa, 0x04, 0x0287}, + {0xaa, 0x07, 0x3002}, + {0xaa, 0x20, 0x1100}, + {0xaa, 0x35, 0x0050}, + {0xaa, 0x30, 0x0005}, + {0xaa, 0x31, 0x0000}, + {0xaa, 0x58, 0x0078}, + {0xaa, 0x62, 0x0411}, + {0xaa, 0x2b, 0x0028}, + {0xaa, 0x2c, 0x0030}, + {0xaa, 0x2d, 0x0030}, + {0xaa, 0x2e, 0x0028}, + {0xa0, 0x10, 0x0087}, + {0xa0, 0x37, 0x0101}, + {0xa0, 0x05, 0x0012}, + {0xa0, 0x0d, 0x0100}, + {0xa0, 0x06, 0x0189}, + {0xa0, 0x00, 0x01ad}, + {0xa0, 0x03, 0x01c5}, + {0xa0, 0x13, 0x01cb}, + {0xa0, 0x08, 0x0250}, + {0xa0, 0x08, 0x0301}, + {0xa0, 0x60, 0x01a8}, + {0xa0, 0x78, 0x018d}, + {0xa0, 0x61, 0x0116}, + {0xa0, 0x65, 0x0118}, + + {0xa1, 0x01, 0x0002}, + + {0xa0, 0x09, 0x01ad}, + {0xa0, 0x15, 0x01ae}, + + {0xa0, 0x0d, 0x003a}, + {0xa0, 0x02, 0x003b}, + {0xa0, 0x00, 0x0038}, + {0xa0, 0x50, 0x010a}, /* matrix */ + {0xa0, 0xf8, 0x010b}, + {0xa0, 0xf8, 0x010c}, + {0xa0, 0xf8, 0x010d}, + {0xa0, 0x50, 0x010e}, + {0xa0, 0xf8, 0x010f}, + {0xa0, 0xf8, 0x0110}, + {0xa0, 0xf8, 0x0111}, + {0xa0, 0x50, 0x0112}, + + {0xa1, 0x01, 0x0008}, + {0xa0, 0x03, 0x0008}, /* clock ? */ + {0xa0, 0x08, 0x01c6}, + {0xa1, 0x01, 0x01c8}, + {0xa1, 0x01, 0x01c9}, + {0xa1, 0x01, 0x01ca}, + {0xa0, 0x0f, 0x01cb}, + + {0xa0, 0x13, 0x0120}, /* gamma 4 */ + {0xa0, 0x38, 0x0121}, + {0xa0, 0x59, 0x0122}, + {0xa0, 0x79, 0x0123}, + {0xa0, 0x92, 0x0124}, + {0xa0, 0xa7, 0x0125}, + {0xa0, 0xb9, 0x0126}, + {0xa0, 0xc8, 0x0127}, + {0xa0, 0xd4, 0x0128}, + {0xa0, 0xdf, 0x0129}, + {0xa0, 0xe7, 0x012a}, + {0xa0, 0xee, 0x012b}, + {0xa0, 0xf4, 0x012c}, + {0xa0, 0xf9, 0x012d}, + {0xa0, 0xfc, 0x012e}, + {0xa0, 0xff, 0x012f}, + {0xa0, 0x26, 0x0130}, + {0xa0, 0x22, 0x0131}, + {0xa0, 0x20, 0x0132}, + {0xa0, 0x1c, 0x0133}, + {0xa0, 0x16, 0x0134}, + {0xa0, 0x13, 0x0135}, + {0xa0, 0x10, 0x0136}, + {0xa0, 0x0d, 0x0137}, + {0xa0, 0x0b, 0x0138}, + {0xa0, 0x09, 0x0139}, + {0xa0, 0x07, 0x013a}, + {0xa0, 0x06, 0x013b}, + {0xa0, 0x05, 0x013c}, + {0xa0, 0x04, 0x013d}, + {0xa0, 0x03, 0x013e}, + {0xa0, 0x02, 0x013f}, + {0xa0, 0x50, 0x010a}, /* matrix */ + {0xa0, 0xf8, 0x010b}, + {0xa0, 0xf8, 0x010c}, + {0xa0, 0xf8, 0x010d}, + {0xa0, 0x50, 0x010e}, + {0xa0, 0xf8, 0x010f}, + {0xa0, 0xf8, 0x0110}, + {0xa0, 0xf8, 0x0111}, + {0xa0, 0x50, 0x0112}, + + {0xa1, 0x01, 0x0180}, + {0xa0, 0x00, 0x0180}, + {0xa0, 0x00, 0x0180}, + {0xa0, 0x00, 0x0019}, + {0xaa, 0x05, 0x0009}, + {0xaa, 0x09, 0x0134}, + {0xa0, 0x00, 0x0190}, + {0xa0, 0x07, 0x0191}, + {0xa0, 0xec, 0x0192}, + {0xa0, 0x00, 0x0195}, + {0xa0, 0x00, 0x0196}, + {0xa0, 0x9c, 0x0197}, + {0xa0, 0x0e, 0x018c}, + {0xa0, 0x1c, 0x018f}, + {0xa0, 0x14, 0x01a9}, + {0xa0, 0x24, 0x01aa}, + {0xa0, 0xd7, 0x001d}, + {0xa0, 0xf4, 0x001e}, + {0xa0, 0xf9, 0x001f}, + {0xa0, 0xff, 0x0020}, + {0xa0, 0x42, 0x0180}, + {0xa0, 0x09, 0x01ad}, + {0xa0, 0x15, 0x01ae}, + {0xa0, 0x40, 0x0180}, + {0xa1, 0x01, 0x0180}, + {0xa0, 0x42, 0x0180}, + {0, 0, 0} +}; +static struct usb_action pb0330xx_Initial[] = { + {0xa1, 0x01, 0x0008}, + {0xa1, 0x01, 0x0008}, + {0xa0, 0x01, 0x0000}, + {0xa0, 0x03, 0x0008}, /* 00 */ + {0xa0, 0x0a, 0x0010}, + {0xa0, 0x10, 0x0002}, + {0xa0, 0x02, 0x0003}, + {0xa0, 0x80, 0x0004}, + {0xa0, 0x01, 0x0005}, + {0xa0, 0xe0, 0x0006}, + {0xa0, 0x01, 0x0001}, + {0xa0, 0x05, 0x0012}, + {0xa0, 0x07, 0x0012}, + {0xa0, 0x00, 0x0098}, + {0xa0, 0x00, 0x009a}, + {0xa0, 0x00, 0x011a}, + {0xa0, 0x00, 0x011c}, + {0xa0, 0x05, 0x0012}, + {0xaa, 0x01, 0x0006}, + {0xaa, 0x02, 0x0011}, + {0xaa, 0x03, 0x01e7}, + {0xaa, 0x04, 0x0287}, + {0xaa, 0x06, 0x0003}, + {0xaa, 0x07, 0x3002}, + {0xaa, 0x20, 0x1100}, + {0xaa, 0x2f, 0xf7b0}, + {0xaa, 0x30, 0x0005}, + {0xaa, 0x31, 0x0000}, + {0xaa, 0x34, 0x0100}, + {0xaa, 0x35, 0x0060}, + {0xaa, 0x3d, 0x068f}, + {0xaa, 0x40, 0x01e0}, + {0xaa, 0x58, 0x0078}, + {0xaa, 0x62, 0x0411}, + {0xa0, 0x10, 0x0087}, + {0xa0, 0x37, 0x0101}, + {0xa0, 0x05, 0x0012}, + {0xa0, 0x0d, 0x0100}, + {0xa0, 0x06, 0x0189}, + {0xa0, 0x00, 0x01ad}, + {0xa0, 0x03, 0x01c5}, + {0xa0, 0x13, 0x01cb}, + {0xa0, 0x08, 0x0250}, + {0xa0, 0x08, 0x0301}, + {0xa0, 0x60, 0x01a8}, + {0xa0, 0x6c, 0x018d}, + {0xa1, 0x01, 0x0002}, + {0xa0, 0x09, 0x01ad}, + {0xa0, 0x15, 0x01ae}, + {0xa0, 0x00, 0x0092}, + {0xa0, 0x02, 0x0090}, + {0xa1, 0x01, 0x0091}, + {0xa1, 0x01, 0x0095}, + {0xa1, 0x01, 0x0096}, + {0xa0, 0x50, 0x010a}, /* matrix */ + {0xa0, 0xf8, 0x010b}, + {0xa0, 0xf8, 0x010c}, + {0xa0, 0xf8, 0x010d}, + {0xa0, 0x50, 0x010e}, + {0xa0, 0xf8, 0x010f}, + {0xa0, 0xf8, 0x0110}, + {0xa0, 0xf8, 0x0111}, + {0xa0, 0x50, 0x0112}, + {0xa1, 0x01, 0x0008}, + {0xa0, 0x03, 0x0008}, /* clock ? */ + {0xa0, 0x08, 0x01c6}, + {0xa1, 0x01, 0x01c8}, + {0xa1, 0x01, 0x01c9}, + {0xa1, 0x01, 0x01ca}, + {0xa0, 0x0f, 0x01cb}, + + {0xa0, 0x50, 0x010a}, /* matrix */ + {0xa0, 0xf8, 0x010b}, + {0xa0, 0xf8, 0x010c}, + {0xa0, 0xf8, 0x010d}, + {0xa0, 0x50, 0x010e}, + {0xa0, 0xf8, 0x010f}, + {0xa0, 0xf8, 0x0110}, + {0xa0, 0xf8, 0x0111}, + {0xa0, 0x50, 0x0112}, + {0xa1, 0x01, 0x0180}, + {0xa0, 0x00, 0x0180}, + {0xa0, 0x00, 0x0019}, + {0xaa, 0x05, 0x0066}, + {0xaa, 0x09, 0x02b2}, + {0xaa, 0x10, 0x0002}, + + {0xa0, 0x60, 0x011d}, + {0xa0, 0x00, 0x0190}, + {0xa0, 0x07, 0x0191}, + {0xa0, 0x8c, 0x0192}, + {0xa0, 0x00, 0x0195}, + {0xa0, 0x00, 0x0196}, + {0xa0, 0x8a, 0x0197}, + {0xa0, 0x10, 0x018c}, + {0xa0, 0x20, 0x018f}, + {0xa0, 0x14, 0x01a9}, + {0xa0, 0x24, 0x01aa}, + {0xa0, 0xd7, 0x001d}, + {0xa0, 0xf0, 0x001e}, + {0xa0, 0xf8, 0x001f}, + {0xa0, 0xff, 0x0020}, + {0xa0, 0x09, 0x01ad}, + {0xa0, 0x15, 0x01ae}, + {0xa0, 0x40, 0x0180}, + {0xa1, 0x01, 0x0180}, + {0xa0, 0x42, 0x0180}, + {0xa1, 0x01, 0x0008}, + {0xa1, 0x01, 0x0007}, +/* {0xa0, 0x30, 0x0007}, */ +/* {0xa0, 0x00, 0x0007}, */ + {0, 0, 0} +}; + +static struct usb_action pb0330xx_InitialScale[] = { + {0xa1, 0x01, 0x0008}, + {0xa1, 0x01, 0x0008}, + {0xa0, 0x01, 0x0000}, + {0xa0, 0x03, 0x0008}, /* 00 */ + {0xa0, 0x0a, 0x0010}, + {0xa0, 0x00, 0x0002}, /* 10 */ + {0xa0, 0x02, 0x0003}, + {0xa0, 0x80, 0x0004}, + {0xa0, 0x01, 0x0005}, + {0xa0, 0xe0, 0x0006}, + {0xa0, 0x01, 0x0001}, + {0xa0, 0x05, 0x0012}, + {0xa0, 0x07, 0x0012}, + {0xa0, 0x00, 0x0098}, + {0xa0, 0x00, 0x009a}, + {0xa0, 0x00, 0x011a}, + {0xa0, 0x00, 0x011c}, + {0xa0, 0x05, 0x0012}, + {0xaa, 0x01, 0x0006}, + {0xaa, 0x02, 0x0011}, + {0xaa, 0x03, 0x01e7}, + {0xaa, 0x04, 0x0287}, + {0xaa, 0x06, 0x0003}, + {0xaa, 0x07, 0x3002}, + {0xaa, 0x20, 0x1100}, + {0xaa, 0x2f, 0xf7b0}, + {0xaa, 0x30, 0x0005}, + {0xaa, 0x31, 0x0000}, + {0xaa, 0x34, 0x0100}, + {0xaa, 0x35, 0x0060}, + {0xaa, 0x3d, 0x068f}, + {0xaa, 0x40, 0x01e0}, + {0xaa, 0x58, 0x0078}, + {0xaa, 0x62, 0x0411}, + {0xa0, 0x10, 0x0087}, + {0xa0, 0x37, 0x0101}, + {0xa0, 0x05, 0x0012}, + {0xa0, 0x0d, 0x0100}, + {0xa0, 0x06, 0x0189}, + {0xa0, 0x00, 0x01ad}, + {0xa0, 0x03, 0x01c5}, + {0xa0, 0x13, 0x01cb}, + {0xa0, 0x08, 0x0250}, + {0xa0, 0x08, 0x0301}, + {0xa0, 0x60, 0x01a8}, + {0xa0, 0x6c, 0x018d}, + {0xa1, 0x01, 0x0002}, + {0xa0, 0x09, 0x01ad}, + {0xa0, 0x15, 0x01ae}, + {0xa0, 0x00, 0x0092}, + {0xa0, 0x02, 0x0090}, + {0xa1, 0x01, 0x0091}, + {0xa1, 0x01, 0x0095}, + {0xa1, 0x01, 0x0096}, + {0xa0, 0x50, 0x010a}, /* matrix */ + {0xa0, 0xf8, 0x010b}, + {0xa0, 0xf8, 0x010c}, + {0xa0, 0xf8, 0x010d}, + {0xa0, 0x50, 0x010e}, + {0xa0, 0xf8, 0x010f}, + {0xa0, 0xf8, 0x0110}, + {0xa0, 0xf8, 0x0111}, + {0xa0, 0x50, 0x0112}, + {0xa1, 0x01, 0x0008}, + {0xa0, 0x03, 0x0008}, /* clock ? */ + {0xa0, 0x08, 0x01c6}, + {0xa1, 0x01, 0x01c8}, + {0xa1, 0x01, 0x01c9}, + {0xa1, 0x01, 0x01ca}, + {0xa0, 0x0f, 0x01cb}, + + {0xa0, 0x50, 0x010a}, /* matrix */ + {0xa0, 0xf8, 0x010b}, + {0xa0, 0xf8, 0x010c}, + {0xa0, 0xf8, 0x010d}, + {0xa0, 0x50, 0x010e}, + {0xa0, 0xf8, 0x010f}, + {0xa0, 0xf8, 0x0110}, + {0xa0, 0xf8, 0x0111}, + {0xa0, 0x50, 0x0112}, + {0xa1, 0x01, 0x0180}, + {0xa0, 0x00, 0x0180}, + {0xa0, 0x00, 0x0019}, + {0xaa, 0x05, 0x0066}, + {0xaa, 0x09, 0x02b2}, + {0xaa, 0x10, 0x0002}, + {0xa0, 0x60, 0x011d}, + {0xa0, 0x00, 0x0190}, + {0xa0, 0x07, 0x0191}, + {0xa0, 0x8c, 0x0192}, + {0xa0, 0x00, 0x0195}, + {0xa0, 0x00, 0x0196}, + {0xa0, 0x8a, 0x0197}, + {0xa0, 0x10, 0x018c}, + {0xa0, 0x20, 0x018f}, + {0xa0, 0x14, 0x01a9}, + {0xa0, 0x24, 0x01aa}, + {0xa0, 0xd7, 0x001d}, + {0xa0, 0xf0, 0x001e}, + {0xa0, 0xf8, 0x001f}, + {0xa0, 0xff, 0x0020}, + {0xa0, 0x09, 0x01ad}, + {0xa0, 0x15, 0x01ae}, + {0xa0, 0x40, 0x0180}, + {0xa1, 0x01, 0x0180}, + {0xa0, 0x42, 0x0180}, + {0xa1, 0x01, 0x0008}, + {0xa1, 0x01, 0x0007}, +/* {0xa0, 0x30, 0x0007}, */ +/* {0xa0, 0x00, 0x0007}, */ + {0, 0, 0} +}; +static struct usb_action pb0330_50HZ[] = { + {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ + {0xa0, 0x07, 0x0191}, /* 01,91,07,cc */ + {0xa0, 0xee, 0x0192}, /* 01,92,ee,cc */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */ + {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */ + {0xa0, 0x46, 0x0197}, /* 01,97,46,cc */ + {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */ + {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */ + {0xa0, 0x0c, 0x01a9}, /* 01,a9,0c,cc */ + {0xa0, 0x26, 0x01aa}, /* 01,aa,26,cc */ + {0xa0, 0x68, 0x001d}, /* 00,1d,68,cc */ + {0xa0, 0x90, 0x001e}, /* 00,1e,90,cc */ + {0xa0, 0xc8, 0x001f}, /* 00,1f,c8,cc */ + {0, 0, 0} +}; +static struct usb_action pb0330_50HZScale[] = { + {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ + {0xa0, 0x07, 0x0191}, /* 01,91,07,cc */ + {0xa0, 0xa0, 0x0192}, /* 01,92,a0,cc */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */ + {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */ + {0xa0, 0x7a, 0x0197}, /* 01,97,7a,cc */ + {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */ + {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */ + {0xa0, 0x0c, 0x01a9}, /* 01,a9,0c,cc */ + {0xa0, 0x26, 0x01aa}, /* 01,aa,26,cc */ + {0xa0, 0xe5, 0x001d}, /* 00,1d,e5,cc */ + {0xa0, 0xf0, 0x001e}, /* 00,1e,f0,cc */ + {0xa0, 0xf8, 0x001f}, /* 00,1f,f8,cc */ + {0, 0, 0} +}; +static struct usb_action pb0330_60HZ[] = { + {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ + {0xa0, 0x07, 0x0191}, /* 01,91,07,cc */ + {0xa0, 0xdd, 0x0192}, /* 01,92,dd,cc */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */ + {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */ + {0xa0, 0x3d, 0x0197}, /* 01,97,3d,cc */ + {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */ + {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */ + {0xa0, 0x0c, 0x01a9}, /* 01,a9,0c,cc */ + {0xa0, 0x26, 0x01aa}, /* 01,aa,26,cc */ + {0xa0, 0x43, 0x001d}, /* 00,1d,43,cc */ + {0xa0, 0x50, 0x001e}, /* 00,1e,50,cc */ + {0xa0, 0x90, 0x001f}, /* 00,1f,90,cc */ + {0, 0, 0} +}; +static struct usb_action pb0330_60HZScale[] = { + {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ + {0xa0, 0x07, 0x0191}, /* 01,91,07,cc */ + {0xa0, 0xa0, 0x0192}, /* 01,92,a0,cc */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */ + {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */ + {0xa0, 0x7a, 0x0197}, /* 01,97,7a,cc */ + {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */ + {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */ + {0xa0, 0x0c, 0x01a9}, /* 01,a9,0c,cc */ + {0xa0, 0x26, 0x01aa}, /* 01,aa,26,cc */ + {0xa0, 0x41, 0x001d}, /* 00,1d,41,cc */ + {0xa0, 0x50, 0x001e}, /* 00,1e,50,cc */ + {0xa0, 0x90, 0x001f}, /* 00,1f,90,cc */ + {0, 0, 0} +}; +static struct usb_action pb0330_NoFliker[] = { + {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ + {0xa0, 0x07, 0x0191}, /* 01,91,07,cc */ + {0xa0, 0xf0, 0x0192}, /* 01,92,f0,cc */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */ + {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */ + {0xa0, 0x10, 0x0197}, /* 01,97,10,cc */ + {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */ + {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */ + {0xa0, 0x00, 0x01a9}, /* 01,a9,00,cc */ + {0xa0, 0x00, 0x01aa}, /* 01,aa,00,cc */ + {0xa0, 0x09, 0x001d}, /* 00,1d,09,cc */ + {0xa0, 0x40, 0x001e}, /* 00,1e,40,cc */ + {0xa0, 0x90, 0x001f}, /* 00,1f,90,cc */ + {0, 0, 0} +}; +static struct usb_action pb0330_NoFlikerScale[] = { + {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ + {0xa0, 0x07, 0x0191}, /* 01,91,07,cc */ + {0xa0, 0xf0, 0x0192}, /* 01,92,f0,cc */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */ + {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */ + {0xa0, 0x10, 0x0197}, /* 01,97,10,cc */ + {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */ + {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */ + {0xa0, 0x00, 0x01a9}, /* 01,a9,00,cc */ + {0xa0, 0x00, 0x01aa}, /* 01,aa,00,cc */ + {0xa0, 0x09, 0x001d}, /* 00,1d,09,cc */ + {0xa0, 0x40, 0x001e}, /* 00,1e,40,cc */ + {0xa0, 0x90, 0x001f}, /* 00,1f,90,cc */ + {0, 0, 0} +}; + +/* from oem9.inf - HKR,%PO2030%,Initial - 640x480 - (close to CS2102) */ +static struct usb_action PO2030_mode0[] = { + {0xa0, 0x01, 0x0000}, /* 00,00,01,cc */ + {0xa0, 0x04, 0x0002}, /* 00,02,04,cc */ + {0xa0, 0x01, 0x0010}, /* 00,10,01,cc */ + {0xa0, 0x01, 0x0001}, /* 00,01,01,cc */ + {0xa0, 0x04, 0x0080}, /* 00,80,04,cc */ + {0xa0, 0x05, 0x0081}, /* 00,81,05,cc */ + {0xa0, 0x16, 0x0083}, /* 00,83,16,cc */ + {0xa0, 0x18, 0x0085}, /* 00,85,18,cc */ + {0xa0, 0x1a, 0x0086}, /* 00,86,1a,cc */ + {0xa0, 0x1b, 0x0087}, /* 00,87,1b,cc */ + {0xa0, 0x1c, 0x0088}, /* 00,88,1c,cc */ + {0xa0, 0xee, 0x008b}, /* 00,8b,ee,cc */ + {0xa0, 0x03, 0x0008}, /* 00,08,03,cc */ + {0xa0, 0x03, 0x0012}, /* 00,12,03,cc */ + {0xa0, 0x01, 0x0012}, /* 00,12,01,cc */ + {0xa0, 0x02, 0x0003}, /* 00,03,02,cc */ + {0xa0, 0x80, 0x0004}, /* 00,04,80,cc */ + {0xa0, 0x01, 0x0005}, /* 00,05,01,cc */ + {0xa0, 0xe0, 0x0006}, /* 00,06,e0,cc */ + {0xa0, 0x42, 0x0180}, /* 01,80,42,cc */ + {0xaa, 0x8d, 0x0008}, /* 00,8d,08,aa */ + {0xa0, 0x00, 0x0098}, /* 00,98,00,cc */ + {0xa0, 0x00, 0x009a}, /* 00,9a,00,cc */ + {0xa0, 0x00, 0x011a}, /* 01,1a,00,cc */ + {0xa0, 0x00, 0x011c}, /* 01,1c,00,cc */ + {0xa0, 0xe6, 0x009c}, /* 00,9c,e6,cc */ + {0xa0, 0x86, 0x009e}, /* 00,9e,86,cc */ + {0xaa, 0x09, 0x00ce}, /* 00,09,ce,aa */ + {0xaa, 0x0b, 0x0005}, /* 00,0b,05,aa */ + {0xaa, 0x0d, 0x0054}, /* 00,0d,54,aa */ + {0xaa, 0x0f, 0x00eb}, /* 00,0f,eb,aa */ + {0xaa, 0x87, 0x0000}, /* 00,87,00,aa */ + {0xaa, 0x88, 0x0004}, /* 00,88,04,aa */ + {0xaa, 0x89, 0x0000}, /* 00,89,00,aa */ + {0xaa, 0x8a, 0x0005}, /* 00,8a,05,aa */ + {0xaa, 0x13, 0x0003}, /* 00,13,03,aa */ + {0xaa, 0x16, 0x0040}, /* 00,16,40,aa */ + {0xaa, 0x18, 0x0040}, /* 00,18,40,aa */ + {0xaa, 0x1d, 0x0002}, /* 00,1d,02,aa */ + {0xaa, 0x29, 0x00e8}, /* 00,29,e8,aa */ + {0xaa, 0x45, 0x0045}, /* 00,45,45,aa */ + {0xaa, 0x50, 0x00ed}, /* 00,50,ed,aa */ + {0xaa, 0x51, 0x0025}, /* 00,51,25,aa */ + {0xaa, 0x52, 0x0042}, /* 00,52,42,aa */ + {0xaa, 0x53, 0x002f}, /* 00,53,2f,aa */ + {0xaa, 0x79, 0x0025}, /* 00,79,25,aa */ + {0xaa, 0x7b, 0x0000}, /* 00,7b,00,aa */ + {0xaa, 0x7e, 0x0025}, /* 00,7e,25,aa */ + {0xaa, 0x7f, 0x0025}, /* 00,7f,25,aa */ + {0xaa, 0x21, 0x0000}, /* 00,21,00,aa */ + {0xaa, 0x33, 0x0036}, /* 00,33,36,aa */ + {0xaa, 0x36, 0x0060}, /* 00,36,60,aa */ + {0xaa, 0x37, 0x0008}, /* 00,37,08,aa */ + {0xaa, 0x3b, 0x0031}, /* 00,3b,31,aa */ + {0xaa, 0x44, 0x000f}, /* 00,44,0f,aa */ + {0xaa, 0x58, 0x0002}, /* 00,58,02,aa */ + {0xaa, 0x66, 0x00c0}, /* 00,66,c0,aa */ + {0xaa, 0x67, 0x0044}, /* 00,67,44,aa */ + {0xaa, 0x6b, 0x00a0}, /* 00,6b,a0,aa */ + {0xaa, 0x6c, 0x0054}, /* 00,6c,54,aa */ + {0xaa, 0xd6, 0x0007}, /* 00,d6,07,aa */ + {0xa0, 0xf7, 0x0101}, /* 01,01,f7,cc */ + {0xa0, 0x05, 0x0012}, /* 00,12,05,cc */ + {0xa0, 0x0d, 0x0100}, /* 01,00,0d,cc */ + {0xa0, 0x06, 0x0189}, /* 01,89,06,cc */ + {0xa0, 0x00, 0x01ad}, /* 01,ad,00,cc */ + {0xa0, 0x03, 0x01c5}, /* 01,c5,03,cc */ + {0xa0, 0x13, 0x01cb}, /* 01,cb,13,cc */ + {0xa0, 0x08, 0x0250}, /* 02,50,08,cc */ + {0xa0, 0x08, 0x0301}, /* 03,01,08,cc */ + {0xa0, 0x7a, 0x0116}, /* 01,16,7a,cc */ + {0xa0, 0x4a, 0x0118}, /* 01,18,4a,cc */ + {0, 0, 0} +}; + +/* from oem9.inf - HKR,%PO2030%,InitialScale - 320x240 */ +static struct usb_action PO2030_mode1[] = { + {0xa0, 0x01, 0x0000}, /* 00,00,01,cc */ + {0xa0, 0x10, 0x0002}, /* 00,02,10,cc */ + {0xa0, 0x01, 0x0010}, /* 00,10,01,cc */ + {0xa0, 0x01, 0x0001}, /* 00,01,01,cc */ + {0xa0, 0x04, 0x0080}, /* 00,80,04,cc */ + {0xa0, 0x05, 0x0081}, /* 00,81,05,cc */ + {0xa0, 0x16, 0x0083}, /* 00,83,16,cc */ + {0xa0, 0x18, 0x0085}, /* 00,85,18,cc */ + {0xa0, 0x1a, 0x0086}, /* 00,86,1a,cc */ + {0xa0, 0x1b, 0x0087}, /* 00,87,1b,cc */ + {0xa0, 0x1c, 0x0088}, /* 00,88,1c,cc */ + {0xa0, 0xee, 0x008b}, /* 00,8b,ee,cc */ + {0xa0, 0x03, 0x0008}, /* 00,08,03,cc */ + {0xa0, 0x03, 0x0012}, /* 00,12,03,cc */ + {0xa0, 0x01, 0x0012}, /* 00,12,01,cc */ + {0xa0, 0x02, 0x0003}, /* 00,03,02,cc */ + {0xa0, 0x80, 0x0004}, /* 00,04,80,cc */ + {0xa0, 0x01, 0x0005}, /* 00,05,01,cc */ + {0xa0, 0xe0, 0x0006}, /* 00,06,e0,cc */ + {0xa0, 0x42, 0x0180}, /* 01,80,42,cc */ + {0xaa, 0x8d, 0x0008}, /* 00,8d,08,aa */ + {0xa0, 0x00, 0x0098}, /* 00,98,00,cc */ + {0xa0, 0x00, 0x009a}, /* 00,9a,00,cc */ + {0xa0, 0x00, 0x011a}, /* 01,1a,00,cc */ + {0xa0, 0x00, 0x011c}, /* 01,1c,00,cc */ + {0xa0, 0xe8, 0x009c}, /* 00,9c,e8,cc */ + {0xa0, 0x88, 0x009e}, /* 00,9e,88,cc */ + {0xaa, 0x09, 0x00cc}, /* 00,09,cc,aa */ + {0xaa, 0x0b, 0x0005}, /* 00,0b,05,aa */ + {0xaa, 0x0d, 0x0058}, /* 00,0d,58,aa */ + {0xaa, 0x0f, 0x00ed}, /* 00,0f,ed,aa */ + {0xaa, 0x87, 0x0000}, /* 00,87,00,aa */ + {0xaa, 0x88, 0x0004}, /* 00,88,04,aa */ + {0xaa, 0x89, 0x0000}, /* 00,89,00,aa */ + {0xaa, 0x8a, 0x0005}, /* 00,8a,05,aa */ + {0xaa, 0x13, 0x0003}, /* 00,13,03,aa */ + {0xaa, 0x16, 0x0040}, /* 00,16,40,aa */ + {0xaa, 0x18, 0x0040}, /* 00,18,40,aa */ + {0xaa, 0x1d, 0x0002}, /* 00,1d,02,aa */ + {0xaa, 0x29, 0x00e8}, /* 00,29,e8,aa */ + {0xaa, 0x45, 0x0045}, /* 00,45,45,aa */ + {0xaa, 0x50, 0x00ed}, /* 00,50,ed,aa */ + {0xaa, 0x51, 0x0025}, /* 00,51,25,aa */ + {0xaa, 0x52, 0x0042}, /* 00,52,42,aa */ + {0xaa, 0x53, 0x002f}, /* 00,53,2f,aa */ + {0xaa, 0x79, 0x0025}, /* 00,79,25,aa */ + {0xaa, 0x7b, 0x0000}, /* 00,7b,00,aa */ + {0xaa, 0x7e, 0x0025}, /* 00,7e,25,aa */ + {0xaa, 0x7f, 0x0025}, /* 00,7f,25,aa */ + {0xaa, 0x21, 0x0000}, /* 00,21,00,aa */ + {0xaa, 0x33, 0x0036}, /* 00,33,36,aa */ + {0xaa, 0x36, 0x0060}, /* 00,36,60,aa */ + {0xaa, 0x37, 0x0008}, /* 00,37,08,aa */ + {0xaa, 0x3b, 0x0031}, /* 00,3b,31,aa */ + {0xaa, 0x44, 0x000f}, /* 00,44,0f,aa */ + {0xaa, 0x58, 0x0002}, /* 00,58,02,aa */ + {0xaa, 0x66, 0x00c0}, /* 00,66,c0,aa */ + {0xaa, 0x67, 0x0044}, /* 00,67,44,aa */ + {0xaa, 0x6b, 0x00a0}, /* 00,6b,a0,aa */ + {0xaa, 0x6c, 0x0054}, /* 00,6c,54,aa */ + {0xaa, 0xd6, 0x0007}, /* 00,d6,07,aa */ + {0xa0, 0xf7, 0x0101}, /* 01,01,f7,cc */ + {0xa0, 0x05, 0x0012}, /* 00,12,05,cc */ + {0xa0, 0x0d, 0x0100}, /* 01,00,0d,cc */ + {0xa0, 0x06, 0x0189}, /* 01,89,06,cc */ + {0xa0, 0x00, 0x01ad}, /* 01,ad,00,cc */ + {0xa0, 0x03, 0x01c5}, /* 01,c5,03,cc */ + {0xa0, 0x13, 0x01cb}, /* 01,cb,13,cc */ + {0xa0, 0x08, 0x0250}, /* 02,50,08,cc */ + {0xa0, 0x08, 0x0301}, /* 03,01,08,cc */ + {0xa0, 0x7a, 0x0116}, /* 01,16,7a,cc */ + {0xa0, 0x4a, 0x0118}, /* 01,18,4a,cc */ + {0, 0, 0} +}; + +static struct usb_action PO2030_50HZ[] = { + {0xaa, 0x8d, 0x0008}, /* 00,8d,08,aa */ + {0xaa, 0x1a, 0x0001}, /* 00,1a,01,aa */ + {0xaa, 0x1b, 0x000a}, /* 00,1b,0a,aa */ + {0xaa, 0x1c, 0x00b0}, /* 00,1c,b0,aa */ + {0xa0, 0x05, 0x0190}, /* 01,90,05,cc */ + {0xa0, 0x35, 0x0191}, /* 01,91,35,cc */ + {0xa0, 0x70, 0x0192}, /* 01,92,70,cc */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */ + {0xa0, 0x85, 0x0196}, /* 01,96,85,cc */ + {0xa0, 0x58, 0x0197}, /* 01,97,58,cc */ + {0xa0, 0x0c, 0x018c}, /* 01,8c,0c,cc */ + {0xa0, 0x18, 0x018f}, /* 01,8f,18,cc */ + {0xa0, 0x60, 0x01a8}, /* 01,a8,60,cc */ + {0xa0, 0x10, 0x01a9}, /* 01,a9,10,cc */ + {0xa0, 0x22, 0x01aa}, /* 01,aa,22,cc */ + {0xa0, 0x88, 0x018d}, /* 01,8d,88,cc */ + {0xa0, 0x58, 0x011d}, /* 01,1d,58,cc */ + {0xa0, 0x42, 0x0180}, /* 01,80,42,cc */ + {0, 0, 0} +}; + +static struct usb_action PO2030_60HZ[] = { + {0xaa, 0x8d, 0x0008}, /* 00,8d,08,aa */ + {0xaa, 0x1a, 0x0000}, /* 00,1a,00,aa */ + {0xaa, 0x1b, 0x00de}, /* 00,1b,de,aa */ + {0xaa, 0x1c, 0x0040}, /* 00,1c,40,aa */ + {0xa0, 0x08, 0x0190}, /* 01,90,08,cc */ + {0xa0, 0xae, 0x0191}, /* 01,91,ae,cc */ + {0xa0, 0x80, 0x0192}, /* 01,92,80,cc */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */ + {0xa0, 0x6f, 0x0196}, /* 01,96,6f,cc */ + {0xa0, 0x20, 0x0197}, /* 01,97,20,cc */ + {0xa0, 0x0c, 0x018c}, /* 01,8c,0c,cc */ + {0xa0, 0x18, 0x018f}, /* 01,8f,18,cc */ + {0xa0, 0x60, 0x01a8}, /* 01,a8,60,cc */ + {0xa0, 0x10, 0x01a9}, /* 01,a9,10,cc */ + {0xa0, 0x22, 0x01aa}, /* 01,aa,22,cc */ + {0xa0, 0x88, 0x018d}, /* 01,8d,88,cc */ /* win: 01,8d,80 */ + {0xa0, 0x58, 0x011d}, /* 01,1d,58,cc */ + {0xa0, 0x42, 0x0180}, /* 01,80,42,cc */ + {0, 0, 0} +}; + +static struct usb_action PO2030_NoFliker[] = { + {0xa0, 0x02, 0x0180}, /* 01,80,02,cc */ + {0xaa, 0x8d, 0x000d}, /* 00,8d,0d,aa */ + {0xaa, 0x1a, 0x0000}, /* 00,1a,00,aa */ + {0xaa, 0x1b, 0x0002}, /* 00,1b,02,aa */ + {0xaa, 0x1c, 0x0078}, /* 00,1c,78,aa */ + {0xaa, 0x46, 0x0000}, /* 00,46,00,aa */ + {0xaa, 0x15, 0x0000}, /* 00,15,00,aa */ + {0, 0, 0} +}; + +/* TEST */ +static struct usb_action tas5130CK_Initial[] = { + {0xa0, 0x01, 0x0000}, + {0xa0, 0x01, 0x003b}, + {0xa0, 0x0e, 0x003a}, + {0xa0, 0x01, 0x0038}, + {0xa0, 0x0b, 0x0039}, + {0xa0, 0x00, 0x0038}, + {0xa0, 0x0b, 0x0039}, + {0xa0, 0x01, 0x0000}, + {0xa0, 0x03, 0x0008}, + {0xa0, 0x0a, 0x0010}, + {0xa0, 0x10, 0x0002}, + {0xa0, 0x02, 0x0003}, + {0xa0, 0x80, 0x0004}, + {0xa0, 0x01, 0x0005}, + {0xa0, 0xe0, 0x0006}, + {0xa0, 0xdc, 0x008b}, + {0xa0, 0x01, 0x0001}, + {0xa0, 0x07, 0x0012}, + {0xa0, 0x00, 0x0098}, + {0xa0, 0x00, 0x009a}, + {0xa0, 0x00, 0x011a}, + {0xa0, 0x00, 0x011c}, + {0xa0, 0xdc, 0x008b}, + {0xa0, 0x05, 0x0012}, + {0xa0, 0x01, 0x0092}, + {0xa0, 0x01, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x06, 0x0092}, + {0xa0, 0x00, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x08, 0x0092}, + {0xa0, 0x83, 0x0093}, + {0xa0, 0x04, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x01, 0x0092}, + {0xa0, 0x04, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x08, 0x0092}, + {0xa0, 0x06, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x02, 0x0092}, + {0xa0, 0x11, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x03, 0x0092}, + {0xa0, 0xE7, 0x0093}, + {0xa0, 0x01, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x04, 0x0092}, + {0xa0, 0x87, 0x0093}, + {0xa0, 0x02, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x07, 0x0092}, + {0xa0, 0x02, 0x0093}, + {0xa0, 0x30, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x20, 0x0092}, + {0xa0, 0x00, 0x0093}, + {0xa0, 0x51, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x35, 0x0092}, + {0xa0, 0x7F, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x30, 0x0092}, + {0xa0, 0x05, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x31, 0x0092}, + {0xa0, 0x00, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x58, 0x0092}, + {0xa0, 0x78, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x62, 0x0092}, + {0xa0, 0x11, 0x0093}, + {0xa0, 0x04, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x2B, 0x0092}, + {0xa0, 0x7f, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x2c, 0x0092}, + {0xa0, 0x7f, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x2D, 0x0092}, + {0xa0, 0x7f, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x2e, 0x0092}, + {0xa0, 0x7f, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x10, 0x0087}, + {0xa0, 0xb7, 0x0101}, + {0xa0, 0x05, 0x0012}, + {0xa0, 0x0d, 0x0100}, + {0xa0, 0x06, 0x0189}, + {0xa0, 0x09, 0x01ad}, + {0xa0, 0x03, 0x01c5}, + {0xa0, 0x13, 0x01cb}, + {0xa0, 0x08, 0x0250}, + {0xa0, 0x08, 0x0301}, + {0xa0, 0x60, 0x01a8}, + {0xa0, 0x6c, 0x018d}, + {0xa0, 0x61, 0x0116}, + {0xa0, 0x65, 0x0118}, + {0xa0, 0x09, 0x01ad}, + {0xa0, 0x15, 0x01ae}, + {0xa0, 0x4c, 0x010a}, /* matrix */ + {0xa0, 0xf1, 0x010b}, + {0xa0, 0x03, 0x010c}, + {0xa0, 0xfe, 0x010d}, + {0xa0, 0x51, 0x010e}, + {0xa0, 0xf1, 0x010f}, + {0xa0, 0xec, 0x0110}, + {0xa0, 0x03, 0x0111}, + {0xa0, 0x51, 0x0112}, + {0xa0, 0x03, 0x0008}, + {0xa0, 0x08, 0x01c6}, + {0xa0, 0x0f, 0x01cb}, + {0xa0, 0x38, 0x0120}, /* gamma > 5 */ + {0xa0, 0x51, 0x0121}, + {0xa0, 0x6e, 0x0122}, + {0xa0, 0x8c, 0x0123}, + {0xa0, 0xa2, 0x0124}, + {0xa0, 0xb6, 0x0125}, + {0xa0, 0xc8, 0x0126}, + {0xa0, 0xd6, 0x0127}, + {0xa0, 0xe2, 0x0128}, + {0xa0, 0xed, 0x0129}, + {0xa0, 0xf5, 0x012a}, + {0xa0, 0xfc, 0x012b}, + {0xa0, 0xff, 0x012c}, + {0xa0, 0xff, 0x012d}, + {0xa0, 0xff, 0x012e}, + {0xa0, 0xff, 0x012f}, + {0xa0, 0x12, 0x0130}, + {0xa0, 0x1b, 0x0131}, + {0xa0, 0x1d, 0x0132}, + {0xa0, 0x1a, 0x0133}, + {0xa0, 0x15, 0x0134}, + {0xa0, 0x12, 0x0135}, + {0xa0, 0x0f, 0x0136}, + {0xa0, 0x0d, 0x0137}, + {0xa0, 0x0b, 0x0138}, + {0xa0, 0x09, 0x0139}, + {0xa0, 0x07, 0x013a}, + {0xa0, 0x05, 0x013b}, + {0xa0, 0x00, 0x013c}, + {0xa0, 0x00, 0x013d}, + {0xa0, 0x00, 0x013e}, + {0xa0, 0x01, 0x013f}, + {0xa0, 0x4c, 0x010a}, /* matrix */ + {0xa0, 0xf1, 0x010b}, + {0xa0, 0x03, 0x010c}, + {0xa0, 0xfe, 0x010d}, + {0xa0, 0x51, 0x010e}, + {0xa0, 0xf1, 0x010f}, + {0xa0, 0xec, 0x0110}, + {0xa0, 0x03, 0x0111}, + {0xa0, 0x51, 0x0112}, + {0xa0, 0x10, 0x0180}, + {0xa0, 0x00, 0x0180}, + {0xa0, 0x00, 0x0019}, + {0xa0, 0x05, 0x0092}, + {0xa0, 0x09, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x09, 0x0092}, + {0xa0, 0x34, 0x0093}, + {0xa0, 0x01, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x00, 0x0190}, + {0xa0, 0x07, 0x0191}, + {0xa0, 0xd2, 0x0192}, + {0xa0, 0x00, 0x0195}, + {0xa0, 0x00, 0x0196}, + {0xa0, 0x9a, 0x0197}, + {0xa0, 0x0e, 0x018c}, + {0xa0, 0x1c, 0x018f}, + {0xa0, 0x14, 0x01a9}, + {0xa0, 0x66, 0x01aa}, + {0xa0, 0xd7, 0x001d}, + {0xa0, 0xf4, 0x001e}, + {0xa0, 0xf9, 0x001f}, + {0xa0, 0xff, 0x0020}, + {0xa0, 0x42, 0x0180}, + {0xa0, 0x09, 0x01ad}, + {0xa0, 0x15, 0x01ae}, + {0xa0, 0x40, 0x0180}, + {0xa0, 0x42, 0x0180}, + {0, 0, 0} +}; + +static struct usb_action tas5130CK_InitialScale[] = { + {0xa0, 0x01, 0x0000}, + {0xa0, 0x01, 0x003b}, + {0xa0, 0x0e, 0x003a}, + {0xa0, 0x01, 0x0038}, + {0xa0, 0x0b, 0x0039}, + {0xa0, 0x00, 0x0038}, + {0xa0, 0x0b, 0x0039}, + {0xa0, 0x01, 0x0000}, + {0xa0, 0x03, 0x0008}, + {0xa0, 0x0a, 0x0010}, + {0xa0, 0x00, 0x0002}, + {0xa0, 0x02, 0x0003}, + {0xa0, 0x80, 0x0004}, + {0xa0, 0x01, 0x0005}, + {0xa0, 0xe0, 0x0006}, + {0xa0, 0xdc, 0x008b}, + {0xa0, 0x01, 0x0001}, + {0xa0, 0x07, 0x0012}, + {0xa0, 0x00, 0x0098}, + {0xa0, 0x00, 0x009a}, + {0xa0, 0x00, 0x011a}, + {0xa0, 0x00, 0x011c}, + {0xa0, 0xdc, 0x008b}, + {0xa0, 0x05, 0x0012}, + {0xa0, 0x01, 0x0092}, + {0xa0, 0x01, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x06, 0x0092}, + {0xa0, 0x00, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x08, 0x0092}, + {0xa0, 0x83, 0x0093}, + {0xa0, 0x04, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x01, 0x0092}, + {0xa0, 0x04, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x08, 0x0092}, + {0xa0, 0x06, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x02, 0x0092}, + {0xa0, 0x11, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x03, 0x0092}, + {0xa0, 0xe5, 0x0093}, + {0xa0, 0x01, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x04, 0x0092}, + {0xa0, 0x85, 0x0093}, + {0xa0, 0x02, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x07, 0x0092}, + {0xa0, 0x02, 0x0093}, + {0xa0, 0x30, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x20, 0x0092}, + {0xa0, 0x00, 0x0093}, + {0xa0, 0x51, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x35, 0x0092}, + {0xa0, 0x7F, 0x0093}, + {0xa0, 0x50, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x30, 0x0092}, + {0xa0, 0x05, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x31, 0x0092}, + {0xa0, 0x00, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x58, 0x0092}, + {0xa0, 0x78, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x62, 0x0092}, + {0xa0, 0x11, 0x0093}, + {0xa0, 0x04, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x2B, 0x0092}, + {0xa0, 0x7f, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x2C, 0x0092}, + {0xa0, 0x7F, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x2D, 0x0092}, + {0xa0, 0x7f, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x2e, 0x0092}, + {0xa0, 0x7f, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x10, 0x0087}, + {0xa0, 0xb7, 0x0101}, + {0xa0, 0x05, 0x0012}, + {0xa0, 0x0d, 0x0100}, + {0xa0, 0x06, 0x0189}, + {0xa0, 0x09, 0x01ad}, + {0xa0, 0x03, 0x01c5}, + {0xa0, 0x13, 0x01cb}, + {0xa0, 0x08, 0x0250}, + {0xa0, 0x08, 0x0301}, + {0xa0, 0x60, 0x01a8}, + {0xa0, 0x6c, 0x018d}, + {0xa0, 0x61, 0x0116}, + {0xa0, 0x65, 0x0118}, + {0xa0, 0x09, 0x01ad}, + {0xa0, 0x15, 0x01ae}, + {0xa0, 0x4c, 0x010a}, /* matrix */ + {0xa0, 0xf1, 0x010b}, + {0xa0, 0x03, 0x010c}, + {0xa0, 0xfe, 0x010d}, + {0xa0, 0x51, 0x010e}, + {0xa0, 0xf1, 0x010f}, + {0xa0, 0xec, 0x0110}, + {0xa0, 0x03, 0x0111}, + {0xa0, 0x51, 0x0112}, + {0xa0, 0x03, 0x0008}, + {0xa0, 0x08, 0x01c6}, + {0xa0, 0x0f, 0x01cb}, + {0xa0, 0x38, 0x0120}, /* gamma > 5 */ + {0xa0, 0x51, 0x0121}, + {0xa0, 0x6e, 0x0122}, + {0xa0, 0x8c, 0x0123}, + {0xa0, 0xa2, 0x0124}, + {0xa0, 0xb6, 0x0125}, + {0xa0, 0xc8, 0x0126}, + {0xa0, 0xd6, 0x0127}, + {0xa0, 0xe2, 0x0128}, + {0xa0, 0xed, 0x0129}, + {0xa0, 0xf5, 0x012a}, + {0xa0, 0xfc, 0x012b}, + {0xa0, 0xff, 0x012c}, + {0xa0, 0xff, 0x012d}, + {0xa0, 0xff, 0x012e}, + {0xa0, 0xff, 0x012f}, + {0xa0, 0x12, 0x0130}, + {0xa0, 0x1b, 0x0131}, + {0xa0, 0x1d, 0x0132}, + {0xa0, 0x1a, 0x0133}, + {0xa0, 0x15, 0x0134}, + {0xa0, 0x12, 0x0135}, + {0xa0, 0x0f, 0x0136}, + {0xa0, 0x0d, 0x0137}, + {0xa0, 0x0b, 0x0138}, + {0xa0, 0x09, 0x0139}, + {0xa0, 0x07, 0x013a}, + {0xa0, 0x05, 0x013b}, + {0xa0, 0x00, 0x013c}, + {0xa0, 0x00, 0x013d}, + {0xa0, 0x00, 0x013e}, + {0xa0, 0x01, 0x013f}, + {0xa0, 0x4c, 0x010a}, /* matrix */ + {0xa0, 0xf1, 0x010b}, + {0xa0, 0x03, 0x010c}, + {0xa0, 0xfe, 0x010d}, + {0xa0, 0x51, 0x010e}, + {0xa0, 0xf1, 0x010f}, + {0xa0, 0xec, 0x0110}, + {0xa0, 0x03, 0x0111}, + {0xa0, 0x51, 0x0112}, + {0xa0, 0x10, 0x0180}, + {0xa0, 0x00, 0x0180}, + {0xa0, 0x00, 0x0019}, + {0xa0, 0x05, 0x0092}, + {0xa0, 0x62, 0x0093}, + {0xa0, 0x00, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x09, 0x0092}, + {0xa0, 0xaa, 0x0093}, + {0xa0, 0x01, 0x0094}, + {0xa0, 0x01, 0x0090}, + {0xa0, 0x00, 0x0190}, + {0xa0, 0x03, 0x0191}, + {0xa0, 0x9b, 0x0192}, + {0xa0, 0x00, 0x0195}, + {0xa0, 0x00, 0x0196}, + {0xa0, 0x47, 0x0197}, + {0xa0, 0x0e, 0x018c}, + {0xa0, 0x1c, 0x018f}, + {0xa0, 0x14, 0x01a9}, + {0xa0, 0x66, 0x01aa}, + {0xa0, 0x62, 0x001d}, + {0xa0, 0x90, 0x001e}, + {0xa0, 0xc8, 0x001f}, + {0xa0, 0xff, 0x0020}, + {0xa0, 0x60, 0x011d}, + {0xa0, 0x42, 0x0180}, + {0xa0, 0x09, 0x01ad}, + {0xa0, 0x15, 0x01ae}, + {0xa0, 0x40, 0x0180}, + {0xa0, 0x42, 0x0180}, + {0xa0, 0x30, 0x0007}, + {0xa0, 0x02, 0x0008}, + {0xa0, 0x00, 0x0007}, + {0xa0, 0x03, 0x0008}, + {0, 0, 0} +}; + +static struct usb_action tas5130cxx_Initial[] = { + {0xa0, 0x01, 0x0000}, + {0xa0, 0x50, 0x0002}, + {0xa0, 0x03, 0x0008}, + {0xa0, 0x02, 0x0010}, + {0xa0, 0x01, 0x0001}, + {0xa0, 0x00, 0x0001}, + {0xa0, 0x01, 0x0012}, + {0xa0, 0x01, 0x0001}, + {0xa0, 0x05, 0x0012}, + {0xa0, 0x07, 0x00a5}, + {0xa0, 0x02, 0x00a6}, + + {0xa0, 0x02, 0x0003}, + {0xa0, 0x80, 0x0004}, + {0xa0, 0x01, 0x0005}, + {0xa0, 0xe0, 0x0006}, + + {0xa0, 0x04, 0x0098}, + {0xa0, 0x0f, 0x009a}, + {0xa0, 0x04, 0x011a}, + {0xa0, 0x0f, 0x011c}, + {0xa0, 0xe8, 0x009c}, + {0xa0, 0x02, 0x009d}, + {0xa0, 0x88, 0x009e}, + {0xa0, 0x06, 0x008d}, + {0xa0, 0xf7, 0x0101}, + {0xa0, 0x0d, 0x0100}, + {0xa0, 0x06, 0x0189}, + {0xa0, 0x68, 0x018d}, + {0xa0, 0x60, 0x01a8}, + {0xa0, 0x00, 0x01ad}, + {0xa0, 0x03, 0x01c5}, + {0xa0, 0x13, 0x01cb}, + {0xa0, 0x08, 0x0250}, + {0xa0, 0x08, 0x0301}, + {0xa1, 0x01, 0x0002}, + {0xa1, 0x01, 0x0008}, + {0xa0, 0x03, 0x0008}, /* clock ? */ + {0xa0, 0x08, 0x01c6}, + {0xa1, 0x01, 0x01c8}, + {0xa1, 0x01, 0x01c9}, + {0xa1, 0x01, 0x01ca}, + {0xa0, 0x0f, 0x01cb}, + + {0xa0, 0x68, 0x010a}, /* matrix */ + {0xa0, 0xec, 0x010b}, + {0xa0, 0xec, 0x010c}, + {0xa0, 0xec, 0x010d}, + {0xa0, 0x68, 0x010e}, + {0xa0, 0xec, 0x010f}, + {0xa0, 0xec, 0x0110}, + {0xa0, 0xec, 0x0111}, + {0xa0, 0x68, 0x0112}, + + {0xa1, 0x01, 0x018d}, + {0xa0, 0x90, 0x018d}, /* 90 */ + {0xa1, 0x01, 0x0180}, + {0xa0, 0x00, 0x0180}, + {0xa0, 0x00, 0x0019}, + + {0xaa, 0xa3, 0x0001}, + {0xaa, 0xa4, 0x0077}, + {0xa0, 0x01, 0x00a3}, + {0xa0, 0x77, 0x00a4}, + + {0xa0, 0x00, 0x0190}, /* 00 */ + {0xa0, 0x03, 0x0191}, /* 03 */ + {0xa0, 0xe8, 0x0192}, /* e8 */ + {0xa0, 0x00, 0x0195}, /* 0 */ + {0xa0, 0x00, 0x0196}, /* 0 */ + {0xa0, 0x7d, 0x0197}, /* 7d */ + + {0xa0, 0x0c, 0x018c}, + {0xa0, 0x18, 0x018f}, + {0xa0, 0x08, 0x01a9}, /* 08 */ + {0xa0, 0x24, 0x01aa}, /* 24 */ + {0xa0, 0xf0, 0x001d}, + {0xa0, 0xf4, 0x001e}, + {0xa0, 0xf8, 0x001f}, + {0xa0, 0xff, 0x0020}, + {0xa0, 0x03, 0x009f}, + {0xa0, 0xc0, 0x00a0}, + {0xa0, 0x50, 0x011d}, /* 50 */ + {0xa0, 0x40, 0x0180}, + {0xa1, 0x01, 0x0180}, + {0xa0, 0x42, 0x0180}, + {0, 0, 0} +}; +static struct usb_action tas5130cxx_InitialScale[] = { + {0xa0, 0x01, 0x0000}, + {0xa0, 0x01, 0x0000}, + {0xa0, 0x40, 0x0002}, + + {0xa0, 0x03, 0x0008}, + {0xa1, 0x01, 0x0008}, + + {0xa0, 0x02, 0x0010}, + {0xa0, 0x01, 0x0001}, + {0xa0, 0x00, 0x0001}, + {0xa0, 0x01, 0x0012}, + {0xa0, 0x01, 0x0001}, + {0xa0, 0x05, 0x0012}, + {0xa0, 0x07, 0x00a5}, + {0xa0, 0x02, 0x00a6}, + {0xa0, 0x02, 0x0003}, + {0xa0, 0x80, 0x0004}, + {0xa0, 0x01, 0x0005}, + {0xa0, 0xe0, 0x0006}, + {0xa0, 0x05, 0x0098}, + {0xa0, 0x0f, 0x009a}, + {0xa0, 0x05, 0x011a}, + {0xa0, 0x0f, 0x011c}, + {0xa0, 0xe6, 0x009c}, + {0xa0, 0x02, 0x009d}, + {0xa0, 0x86, 0x009e}, + {0xa0, 0x06, 0x008d}, + {0xa0, 0x37, 0x0101}, + {0xa0, 0x0d, 0x0100}, + {0xa0, 0x06, 0x0189}, + {0xa0, 0x68, 0x018d}, + {0xa0, 0x60, 0x01a8}, + {0xa0, 0x00, 0x01ad}, + {0xa0, 0x03, 0x01c5}, + {0xa0, 0x13, 0x01cb}, + {0xa0, 0x08, 0x0250}, + {0xa0, 0x08, 0x0301}, + {0xa1, 0x01, 0x0002}, + {0xa1, 0x01, 0x0008}, + + {0xa0, 0x03, 0x0008}, + {0xa1, 0x01, 0x0008}, /* clock ? */ + {0xa0, 0x08, 0x01c6}, + {0xa1, 0x01, 0x01c8}, + {0xa1, 0x01, 0x01c9}, + {0xa1, 0x01, 0x01ca}, + {0xa0, 0x0f, 0x01cb}, + + {0xa0, 0x68, 0x010a}, /* matrix */ + {0xa0, 0xec, 0x010b}, + {0xa0, 0xec, 0x010c}, + {0xa0, 0xec, 0x010d}, + {0xa0, 0x68, 0x010e}, + {0xa0, 0xec, 0x010f}, + {0xa0, 0xec, 0x0110}, + {0xa0, 0xec, 0x0111}, + {0xa0, 0x68, 0x0112}, + + {0xa1, 0x01, 0x018d}, + {0xa0, 0x90, 0x018d}, + {0xa1, 0x01, 0x0180}, + {0xa0, 0x00, 0x0180}, + {0xa0, 0x00, 0x0019}, + {0xaa, 0xa3, 0x0001}, + {0xaa, 0xa4, 0x0063}, + {0xa0, 0x01, 0x00a3}, + {0xa0, 0x63, 0x00a4}, + {0xa0, 0x00, 0x0190}, + {0xa0, 0x02, 0x0191}, + {0xa0, 0x38, 0x0192}, + {0xa0, 0x00, 0x0195}, + {0xa0, 0x00, 0x0196}, + {0xa0, 0x47, 0x0197}, + {0xa0, 0x0c, 0x018c}, + {0xa0, 0x18, 0x018f}, + {0xa0, 0x08, 0x01a9}, + {0xa0, 0x24, 0x01aa}, + {0xa0, 0xd3, 0x001d}, + {0xa0, 0xda, 0x001e}, + {0xa0, 0xea, 0x001f}, + {0xa0, 0xff, 0x0020}, + {0xa0, 0x03, 0x009f}, + {0xa0, 0x4c, 0x00a0}, + {0xa0, 0x50, 0x011d}, + {0xa0, 0x40, 0x0180}, + {0xa1, 0x01, 0x0180}, + {0xa0, 0x42, 0x0180}, + {0, 0, 0} +}; +static struct usb_action tas5130cxx_50HZ[] = { + {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xaa, 0xa3, 0x0001}, /* 00,a3,01,aa */ + {0xaa, 0xa4, 0x0063}, /* 00,a4,63,aa */ + {0xa0, 0x01, 0x00a3}, /* 00,a3,01,cc */ + {0xa0, 0x63, 0x00a4}, /* 00,a4,63,cc */ + {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ + {0xa0, 0x02, 0x0191}, /* 01,91,02,cc */ + {0xa0, 0x38, 0x0192}, /* 01,92,38,cc */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */ + {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */ + {0xa0, 0x47, 0x0197}, /* 01,97,47,cc */ + {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */ + {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */ + {0xa0, 0x0c, 0x01a9}, /* 01,a9,0c,cc */ + {0xa0, 0x26, 0x01aa}, /* 01,aa,26,cc */ + {0xa0, 0xd3, 0x001d}, /* 00,1d,d3,cc */ + {0xa0, 0xda, 0x001e}, /* 00,1e,da,cc */ + {0xa0, 0xea, 0x001f}, /* 00,1f,ea,cc */ + {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc */ + {0xa0, 0x03, 0x009f}, /* 00,9f,03,cc */ + {0, 0, 0} +}; +static struct usb_action tas5130cxx_50HZScale[] = { + {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xaa, 0xa3, 0x0001}, /* 00,a3,01,aa */ + {0xaa, 0xa4, 0x0077}, /* 00,a4,77,aa */ + {0xa0, 0x01, 0x00a3}, /* 00,a3,01,cc */ + {0xa0, 0x77, 0x00a4}, /* 00,a4,77,cc */ + {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ + {0xa0, 0x03, 0x0191}, /* 01,91,03,cc */ + {0xa0, 0xe8, 0x0192}, /* 01,92,e8,cc */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */ + {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */ + {0xa0, 0x7d, 0x0197}, /* 01,97,7d,cc */ + {0xa0, 0x14, 0x018c}, /* 01,8c,14,cc */ + {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */ + {0xa0, 0x0c, 0x01a9}, /* 01,a9,0c,cc */ + {0xa0, 0x26, 0x01aa}, /* 01,aa,26,cc */ + {0xa0, 0xf0, 0x001d}, /* 00,1d,f0,cc */ + {0xa0, 0xf4, 0x001e}, /* 00,1e,f4,cc */ + {0xa0, 0xf8, 0x001f}, /* 00,1f,f8,cc */ + {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc */ + {0xa0, 0x03, 0x009f}, /* 00,9f,03,cc */ + {0, 0, 0} +}; +static struct usb_action tas5130cxx_60HZ[] = { + {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xaa, 0xa3, 0x0001}, /* 00,a3,01,aa */ + {0xaa, 0xa4, 0x0036}, /* 00,a4,36,aa */ + {0xa0, 0x01, 0x00a3}, /* 00,a3,01,cc */ + {0xa0, 0x36, 0x00a4}, /* 00,a4,36,cc */ + {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ + {0xa0, 0x01, 0x0191}, /* 01,91,01,cc */ + {0xa0, 0xf0, 0x0192}, /* 01,92,f0,cc */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */ + {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */ + {0xa0, 0x3e, 0x0197}, /* 01,97,3e,cc */ + {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */ + {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */ + {0xa0, 0x0c, 0x01a9}, /* 01,a9,0c,cc */ + {0xa0, 0x26, 0x01aa}, /* 01,aa,26,cc */ + {0xa0, 0xca, 0x001d}, /* 00,1d,ca,cc */ + {0xa0, 0xd0, 0x001e}, /* 00,1e,d0,cc */ + {0xa0, 0xe0, 0x001f}, /* 00,1f,e0,cc */ + {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc */ + {0xa0, 0x03, 0x009f}, /* 00,9f,03,cc */ + {0, 0, 0} +}; +static struct usb_action tas5130cxx_60HZScale[] = { + {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xaa, 0xa3, 0x0001}, /* 00,a3,01,aa */ + {0xaa, 0xa4, 0x0077}, /* 00,a4,77,aa */ + {0xa0, 0x01, 0x00a3}, /* 00,a3,01,cc */ + {0xa0, 0x77, 0x00a4}, /* 00,a4,77,cc */ + {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ + {0xa0, 0x03, 0x0191}, /* 01,91,03,cc */ + {0xa0, 0xe8, 0x0192}, /* 01,92,e8,cc */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */ + {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */ + {0xa0, 0x7d, 0x0197}, /* 01,97,7d,cc */ + {0xa0, 0x14, 0x018c}, /* 01,8c,14,cc */ + {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */ + {0xa0, 0x0c, 0x01a9}, /* 01,a9,0c,cc */ + {0xa0, 0x26, 0x01aa}, /* 01,aa,26,cc */ + {0xa0, 0xc8, 0x001d}, /* 00,1d,c8,cc */ + {0xa0, 0xd0, 0x001e}, /* 00,1e,d0,cc */ + {0xa0, 0xe0, 0x001f}, /* 00,1f,e0,cc */ + {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc */ + {0xa0, 0x03, 0x009f}, /* 00,9f,03,cc */ + {0, 0, 0} +}; +static struct usb_action tas5130cxx_NoFliker[] = { + {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xaa, 0xa3, 0x0001}, /* 00,a3,01,aa */ + {0xaa, 0xa4, 0x0040}, /* 00,a4,40,aa */ + {0xa0, 0x01, 0x00a3}, /* 00,a3,01,cc */ + {0xa0, 0x40, 0x00a4}, /* 00,a4,40,cc */ + {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ + {0xa0, 0x01, 0x0191}, /* 01,91,01,cc */ + {0xa0, 0xf0, 0x0192}, /* 01,92,f0,cc */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */ + {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */ + {0xa0, 0x10, 0x0197}, /* 01,97,10,cc */ + {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */ + {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */ + {0xa0, 0x00, 0x01a9}, /* 01,a9,00,cc */ + {0xa0, 0x00, 0x01aa}, /* 01,aa,00,cc */ + {0xa0, 0xbc, 0x001d}, /* 00,1d,bc,cc */ + {0xa0, 0xd0, 0x001e}, /* 00,1e,d0,cc */ + {0xa0, 0xe0, 0x001f}, /* 00,1f,e0,cc */ + {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc */ + {0xa0, 0x02, 0x009f}, /* 00,9f,02,cc */ + {0, 0, 0} +}; + +static struct usb_action tas5130cxx_NoFlikerScale[] = { + {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xaa, 0xa3, 0x0001}, /* 00,a3,01,aa */ + {0xaa, 0xa4, 0x0090}, /* 00,a4,90,aa */ + {0xa0, 0x01, 0x00a3}, /* 00,a3,01,cc */ + {0xa0, 0x90, 0x00a4}, /* 00,a4,90,cc */ + {0xa0, 0x00, 0x0190}, /* 01,90,00,cc */ + {0xa0, 0x03, 0x0191}, /* 01,91,03,cc */ + {0xa0, 0xf0, 0x0192}, /* 01,92,f0,cc */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc */ + {0xa0, 0x00, 0x0196}, /* 01,96,00,cc */ + {0xa0, 0x10, 0x0197}, /* 01,97,10,cc */ + {0xa0, 0x10, 0x018c}, /* 01,8c,10,cc */ + {0xa0, 0x20, 0x018f}, /* 01,8f,20,cc */ + {0xa0, 0x00, 0x01a9}, /* 01,a9,00,cc */ + {0xa0, 0x00, 0x01aa}, /* 01,aa,00,cc */ + {0xa0, 0xbc, 0x001d}, /* 00,1d,bc,cc */ + {0xa0, 0xd0, 0x001e}, /* 00,1e,d0,cc */ + {0xa0, 0xe0, 0x001f}, /* 00,1f,e0,cc */ + {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc */ + {0xa0, 0x02, 0x009f}, /* 00,9f,02,cc */ + {0, 0, 0} +}; + +static struct usb_action tas5130c_vf0250_Initial[] = { + {0xa0, 0x01, 0x0000}, /* 00,00,01,cc, */ + {0xa0, 0x02, 0x0008}, /* 00,08,02,cc, */ + {0xa0, 0x01, 0x0010}, /* 00,10,01,cc, */ + {0xa0, 0x10, 0x0002}, /* 00,02,00,cc, 0<->10 */ + {0xa0, 0x02, 0x0003}, /* 00,03,02,cc, */ + {0xa0, 0x80, 0x0004}, /* 00,04,80,cc, */ + {0xa0, 0x01, 0x0005}, /* 00,05,01,cc, */ + {0xa0, 0xe0, 0x0006}, /* 00,06,e0,cc, */ + {0xa0, 0x98, 0x008b}, /* 00,8b,98,cc, */ + {0xa0, 0x01, 0x0001}, /* 00,01,01,cc, */ + {0xa0, 0x03, 0x0012}, /* 00,12,03,cc, */ + {0xa0, 0x01, 0x0012}, /* 00,12,01,cc, */ + {0xa0, 0x00, 0x0098}, /* 00,98,00,cc, */ + {0xa0, 0x00, 0x009a}, /* 00,9a,00,cc, */ + {0xa0, 0x00, 0x011a}, /* 01,1a,00,cc, */ + {0xa0, 0x00, 0x011c}, /* 01,1c,00,cc, */ + {0xa0, 0xe8, 0x009c}, /* 00,9c,e6,cc, 6<->8 */ + {0xa0, 0x88, 0x009e}, /* 00,9e,86,cc, 6<->8 */ + {0xa0, 0x10, 0x0087}, /* 00,87,10,cc, */ + {0xa0, 0x98, 0x008b}, /* 00,8b,98,cc, */ + {0xaa, 0x1b, 0x0024}, /* 00,1b,24,aa, */ + {0xdd, 0x00, 0x0080}, /* 00,00,80,dd, */ + {0xaa, 0x1b, 0x0000}, /* 00,1b,00,aa, */ + {0xaa, 0x13, 0x0002}, /* 00,13,02,aa, */ + {0xaa, 0x15, 0x0004}, /* 00,15,04,aa */ + {0xaa, 0x01, 0x0000}, + {0xaa, 0x01, 0x0000}, + {0xaa, 0x1a, 0x0000}, /* 00,1a,00,aa, */ + {0xaa, 0x1c, 0x0017}, /* 00,1c,17,aa, */ + {0xa0, 0x82, 0x0086}, /* 00,86,82,cc, */ + {0xa0, 0x83, 0x0087}, /* 00,87,83,cc, */ + {0xa0, 0x84, 0x0088}, /* 00,88,84,cc, */ + {0xaa, 0x05, 0x0010}, /* 00,05,10,aa, */ + {0xaa, 0x0a, 0x0000}, /* 00,0a,00,aa, */ + {0xaa, 0x0b, 0x00a0}, /* 00,0b,a0,aa, */ + {0xaa, 0x0c, 0x0000}, /* 00,0c,00,aa, */ + {0xaa, 0x0d, 0x00a0}, /* 00,0d,a0,aa, */ + {0xaa, 0x0e, 0x0000}, /* 00,0e,00,aa, */ + {0xaa, 0x0f, 0x00a0}, /* 00,0f,a0,aa, */ + {0xaa, 0x10, 0x0000}, /* 00,10,00,aa, */ + {0xaa, 0x11, 0x00a0}, /* 00,11,a0,aa, */ + {0xa0, 0x00, 0x0039}, + {0xa1, 0x01, 0x0037}, + {0xaa, 0x16, 0x0001}, /* 00,16,01,aa, */ + {0xaa, 0x17, 0x00e8}, /* 00,17,e6,aa, (e6 -> e8) */ + {0xaa, 0x18, 0x0002}, /* 00,18,02,aa, */ + {0xaa, 0x19, 0x0088}, /* 00,19,86,aa, */ + {0xaa, 0x20, 0x0020}, /* 00,20,20,aa, */ + {0xa0, 0xb7, 0x0101}, /* 01,01,b7,cc, */ + {0xa0, 0x05, 0x0012}, /* 00,12,05,cc, */ + {0xa0, 0x0d, 0x0100}, /* 01,00,0d,cc, */ + {0xa0, 0x76, 0x0189}, /* 01,89,76,cc, */ + {0xa0, 0x09, 0x01ad}, /* 01,ad,09,cc, */ + {0xa0, 0x03, 0x01c5}, /* 01,c5,03,cc, */ + {0xa0, 0x13, 0x01cb}, /* 01,cb,13,cc, */ + {0xa0, 0x08, 0x0250}, /* 02,50,08,cc, */ + {0xa0, 0x08, 0x0301}, /* 03,01,08,cc, */ + {0xa0, 0x60, 0x01a8}, /* 01,a8,60,cc, */ + {0xa0, 0x61, 0x0116}, /* 01,16,61,cc, */ + {0xa0, 0x65, 0x0118}, /* 01,18,65,cc */ + {0, 0, 0} +}; + +static struct usb_action tas5130c_vf0250_InitialScale[] = { + {0xa0, 0x01, 0x0000}, /* 00,00,01,cc, */ + {0xa0, 0x02, 0x0008}, /* 00,08,02,cc, */ + {0xa0, 0x01, 0x0010}, /* 00,10,01,cc, */ + {0xa0, 0x00, 0x0002}, /* 00,02,10,cc, */ + {0xa0, 0x02, 0x0003}, /* 00,03,02,cc, */ + {0xa0, 0x80, 0x0004}, /* 00,04,80,cc, */ + {0xa0, 0x01, 0x0005}, /* 00,05,01,cc, */ + {0xa0, 0xe0, 0x0006}, /* 00,06,e0,cc, */ + {0xa0, 0x98, 0x008b}, /* 00,8b,98,cc, */ + {0xa0, 0x01, 0x0001}, /* 00,01,01,cc, */ + {0xa0, 0x03, 0x0012}, /* 00,12,03,cc, */ + {0xa0, 0x01, 0x0012}, /* 00,12,01,cc, */ + {0xa0, 0x00, 0x0098}, /* 00,98,00,cc, */ + {0xa0, 0x00, 0x009a}, /* 00,9a,00,cc, */ + {0xa0, 0x00, 0x011a}, /* 01,1a,00,cc, */ + {0xa0, 0x00, 0x011c}, /* 01,1c,00,cc, */ + {0xa0, 0xe8, 0x009c}, /* 00,9c,e8,cc, 8<->6 */ + {0xa0, 0x88, 0x009e}, /* 00,9e,88,cc, 8<->6 */ + {0xa0, 0x10, 0x0087}, /* 00,87,10,cc, */ + {0xa0, 0x98, 0x008b}, /* 00,8b,98,cc, */ + {0xaa, 0x1b, 0x0024}, /* 00,1b,24,aa, */ + {0xdd, 0x00, 0x0080}, /* 00,00,80,dd, */ + {0xaa, 0x1b, 0x0000}, /* 00,1b,00,aa, */ + {0xaa, 0x13, 0x0002}, /* 00,13,02,aa, */ + {0xaa, 0x15, 0x0004}, /* 00,15,04,aa */ + {0xaa, 0x01, 0x0000}, + {0xaa, 0x01, 0x0000}, + {0xaa, 0x1a, 0x0000}, /* 00,1a,00,aa, */ + {0xaa, 0x1c, 0x0017}, /* 00,1c,17,aa, */ + {0xa0, 0x82, 0x0086}, /* 00,86,82,cc, */ + {0xa0, 0x83, 0x0087}, /* 00,87,83,cc, */ + {0xa0, 0x84, 0x0088}, /* 00,88,84,cc, */ + {0xaa, 0x05, 0x0010}, /* 00,05,10,aa, */ + {0xaa, 0x0a, 0x0000}, /* 00,0a,00,aa, */ + {0xaa, 0x0b, 0x00a0}, /* 00,0b,a0,aa, */ + {0xaa, 0x0c, 0x0000}, /* 00,0c,00,aa, */ + {0xaa, 0x0d, 0x00a0}, /* 00,0d,a0,aa, */ + {0xaa, 0x0e, 0x0000}, /* 00,0e,00,aa, */ + {0xaa, 0x0f, 0x00a0}, /* 00,0f,a0,aa, */ + {0xaa, 0x10, 0x0000}, /* 00,10,00,aa, */ + {0xaa, 0x11, 0x00a0}, /* 00,11,a0,aa, */ + {0xa0, 0x00, 0x0039}, + {0xa1, 0x01, 0x0037}, + {0xaa, 0x16, 0x0001}, /* 00,16,01,aa, */ + {0xaa, 0x17, 0x00e8}, /* 00,17,e6,aa (e6 -> e8) */ + {0xaa, 0x18, 0x0002}, /* 00,18,02,aa, */ + {0xaa, 0x19, 0x0088}, /* 00,19,88,aa, */ + {0xaa, 0x20, 0x0020}, /* 00,20,20,aa, */ + {0xa0, 0xb7, 0x0101}, /* 01,01,b7,cc, */ + {0xa0, 0x05, 0x0012}, /* 00,12,05,cc, */ + {0xa0, 0x0d, 0x0100}, /* 01,00,0d,cc, */ + {0xa0, 0x76, 0x0189}, /* 01,89,76,cc, */ + {0xa0, 0x09, 0x01ad}, /* 01,ad,09,cc, */ + {0xa0, 0x03, 0x01c5}, /* 01,c5,03,cc, */ + {0xa0, 0x13, 0x01cb}, /* 01,cb,13,cc, */ + {0xa0, 0x08, 0x0250}, /* 02,50,08,cc, */ + {0xa0, 0x08, 0x0301}, /* 03,01,08,cc, */ + {0xa0, 0x60, 0x01a8}, /* 01,a8,60,cc, */ + {0xa0, 0x61, 0x0116}, /* 01,16,61,cc, */ + {0xa0, 0x65, 0x0118}, /* 01,18,65,cc */ + {0, 0, 0} +}; +/* "50HZ" light frequency banding filter */ +static struct usb_action tas5130c_vf0250_50HZ[] = { + {0xaa, 0x82, 0x0000}, /* 00,82,00,aa */ + {0xaa, 0x83, 0x0001}, /* 00,83,01,aa */ + {0xaa, 0x84, 0x00aa}, /* 00,84,aa,aa */ + {0xa0, 0x00, 0x0190}, /* 01,90,00,cc, */ + {0xa0, 0x06, 0x0191}, /* 01,91,0d,cc, */ + {0xa0, 0xa8, 0x0192}, /* 01,92,50,cc, */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc, */ + {0xa0, 0x00, 0x0196}, /* 01,96,00,cc, */ + {0xa0, 0x8e, 0x0197}, /* 01,97,47,cc, */ + {0xa0, 0x0e, 0x018c}, /* 01,8c,0e,cc, */ + {0xa0, 0x15, 0x018f}, /* 01,8f,15,cc, */ + {0xa0, 0x10, 0x01a9}, /* 01,a9,10,cc, */ + {0xa0, 0x24, 0x01aa}, /* 01,aa,24,cc, */ + {0xa0, 0x62, 0x001d}, /* 00,1d,62,cc, */ + {0xa0, 0x90, 0x001e}, /* 00,1e,90,cc, */ + {0xa0, 0xc8, 0x001f}, /* 00,1f,c8,cc, */ + {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc, */ + {0xa0, 0x58, 0x011d}, /* 01,1d,58,cc, */ + {0xa0, 0x42, 0x0180}, /* 01,80,42,cc, */ + {0xa0, 0x78, 0x018d}, /* 01,8d,78,cc */ + {0, 0, 0} +}; + +/* "50HZScale" light frequency banding filter */ +static struct usb_action tas5130c_vf0250_50HZScale[] = { + {0xaa, 0x82, 0x0000}, /* 00,82,00,aa */ + {0xaa, 0x83, 0x0003}, /* 00,83,03,aa */ + {0xaa, 0x84, 0x0054}, /* 00,84,54,aa */ + {0xa0, 0x00, 0x0190}, /* 01,90,00,cc, */ + {0xa0, 0x0d, 0x0191}, /* 01,91,0d,cc, */ + {0xa0, 0x50, 0x0192}, /* 01,92,50,cc, */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc, */ + {0xa0, 0x00, 0x0196}, /* 01,96,00,cc, */ + {0xa0, 0x8e, 0x0197}, /* 01,97,8e,cc, */ + {0xa0, 0x0e, 0x018c}, /* 01,8c,0e,cc, */ + {0xa0, 0x15, 0x018f}, /* 01,8f,15,cc, */ + {0xa0, 0x10, 0x01a9}, /* 01,a9,10,cc, */ + {0xa0, 0x24, 0x01aa}, /* 01,aa,24,cc, */ + {0xa0, 0x62, 0x001d}, /* 00,1d,62,cc, */ + {0xa0, 0x90, 0x001e}, /* 00,1e,90,cc, */ + {0xa0, 0xc8, 0x001f}, /* 00,1f,c8,cc, */ + {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc, */ + {0xa0, 0x58, 0x011d}, /* 01,1d,58,cc, */ + {0xa0, 0x42, 0x0180}, /* 01,80,42,cc, */ + {0xa0, 0x78, 0x018d}, /* 01,8d,78,cc */ + {0, 0, 0} +}; + +/* "60HZ" light frequency banding filter */ +static struct usb_action tas5130c_vf0250_60HZ[] = { + {0xaa, 0x82, 0x0000}, /* 00,82,00,aa */ + {0xaa, 0x83, 0x0001}, /* 00,83,01,aa */ + {0xaa, 0x84, 0x0062}, /* 00,84,62,aa */ + {0xa0, 0x00, 0x0190}, /* 01,90,00,cc, */ + {0xa0, 0x05, 0x0191}, /* 01,91,05,cc, */ + {0xa0, 0x88, 0x0192}, /* 01,92,88,cc, */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc, */ + {0xa0, 0x00, 0x0196}, /* 01,96,00,cc, */ + {0xa0, 0x3b, 0x0197}, /* 01,97,3b,cc, */ + {0xa0, 0x0e, 0x018c}, /* 01,8c,0e,cc, */ + {0xa0, 0x15, 0x018f}, /* 01,8f,15,cc, */ + {0xa0, 0x10, 0x01a9}, /* 01,a9,10,cc, */ + {0xa0, 0x24, 0x01aa}, /* 01,aa,24,cc, */ + {0xa0, 0x62, 0x001d}, /* 00,1d,62,cc, */ + {0xa0, 0x90, 0x001e}, /* 00,1e,90,cc, */ + {0xa0, 0xc8, 0x001f}, /* 00,1f,c8,cc, */ + {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc, */ + {0xa0, 0x58, 0x011d}, /* 01,1d,58,cc, */ + {0xa0, 0x42, 0x0180}, /* 01,80,42,cc, */ + {0xa0, 0x78, 0x018d}, /* 01,8d,78,cc */ + {0, 0, 0} +}; + +/* "60HZScale" light frequency banding ilter */ +static struct usb_action tas5130c_vf0250_60HZScale[] = { + {0xaa, 0x82, 0x0000}, /* 00,82,00,aa */ + {0xaa, 0x83, 0x0002}, /* 00,83,02,aa */ + {0xaa, 0x84, 0x00c4}, /* 00,84,c4,aa */ + {0xa0, 0x00, 0x0190}, /* 01,90,00,cc, */ + {0xa0, 0x0b, 0x0191}, /* 01,1,0b,cc, */ + {0xa0, 0x10, 0x0192}, /* 01,2,10,cc, */ + {0xa0, 0x00, 0x0195}, /* 01,5,00,cc, */ + {0xa0, 0x00, 0x0196}, /* 01,6,00,cc, */ + {0xa0, 0x76, 0x0197}, /* 01,7,76,cc, */ + {0xa0, 0x0e, 0x018c}, /* 01,c,0e,cc, */ + {0xa0, 0x15, 0x018f}, /* 01,f,15,cc, */ + {0xa0, 0x10, 0x01a9}, /* 01,9,10,cc, */ + {0xa0, 0x24, 0x01aa}, /* 01,a,24,cc, */ + {0xa0, 0x62, 0x001d}, /* 00,d,62,cc, */ + {0xa0, 0x90, 0x001e}, /* 00,e,90,cc, */ + {0xa0, 0xc8, 0x001f}, /* 00,f,c8,cc, */ + {0xa0, 0xff, 0x0020}, /* 00,0,ff,cc, */ + {0xa0, 0x58, 0x011d}, /* 01,d,58,cc, */ + {0xa0, 0x42, 0x0180}, /* 01,80,42,cc, */ + {0xa0, 0x78, 0x018d}, /* 01,d,78,cc */ + {0, 0, 0} +}; + +/* "NoFliker" light frequency banding flter */ +static struct usb_action tas5130c_vf0250_NoFliker[] = { + {0xa0, 0x0c, 0x0100}, /* 01,00,0c,cc, */ + {0xaa, 0x82, 0x0000}, /* 00,82,00,aa */ + {0xaa, 0x83, 0x0000}, /* 00,83,00,aa */ + {0xaa, 0x84, 0x0020}, /* 00,84,20,aa */ + {0xa0, 0x00, 0x0190}, /* 01,0,00,cc, */ + {0xa0, 0x05, 0x0191}, /* 01,91,05,cc, */ + {0xa0, 0x88, 0x0192}, /* 01,92,88,cc, */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc, */ + {0xa0, 0x00, 0x0196}, /* 01,96,00,cc, */ + {0xa0, 0x10, 0x0197}, /* 01,97,10,cc, */ + {0xa0, 0x0e, 0x018c}, /* 01,8c,0e,cc, */ + {0xa0, 0x15, 0x018f}, /* 01,8f,15,cc, */ + {0xa0, 0x62, 0x001d}, /* 00,1d,62,cc, */ + {0xa0, 0x90, 0x001e}, /* 00,1e,90,cc, */ + {0xa0, 0xc8, 0x001f}, /* 00,1f,c8,cc, */ + {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc, */ + {0xa0, 0x58, 0x011d}, /* 01,1d,58,cc, */ + {0xa0, 0x03, 0x0180}, /* 01,80,03,cc */ + {0, 0, 0} +}; + +/* "NoFlikerScale" light frequency banding filter */ +static struct usb_action tas5130c_vf0250_NoFlikerScale[] = { + {0xa0, 0x0c, 0x0100}, /* 01,00,0c,cc, */ + {0xaa, 0x82, 0x0000}, /* 00,82,00,aa */ + {0xaa, 0x83, 0x0000}, /* 00,83,00,aa */ + {0xaa, 0x84, 0x0020}, /* 00,84,20,aa */ + {0xa0, 0x00, 0x0190}, /* 01,90,00,cc, */ + {0xa0, 0x0b, 0x0191}, /* 01,91,0b,cc, */ + {0xa0, 0x10, 0x0192}, /* 01,92,10,cc, */ + {0xa0, 0x00, 0x0195}, /* 01,95,00,cc, */ + {0xa0, 0x00, 0x0196}, /* 01,96,00,cc, */ + {0xa0, 0x10, 0x0197}, /* 01,97,10,cc, */ + {0xa0, 0x0e, 0x018c}, /* 01,8c,0e,cc, */ + {0xa0, 0x15, 0x018f}, /* 01,8f,15,cc, */ + {0xa0, 0x62, 0x001d}, /* 00,1d,62,cc, */ + {0xa0, 0x90, 0x001e}, /* 00,1e,90,cc, */ + {0xa0, 0xc8, 0x001f}, /* 00,1f,c8,cc, */ + {0xa0, 0xff, 0x0020}, /* 00,20,ff,cc, */ + {0xa0, 0x58, 0x011d}, /* 01,1d,58,cc, */ + {0xa0, 0x03, 0x0180}, /* 01,80,03,cc */ + {0, 0, 0} +}; + +static void reg_r_i(struct usb_device *dev, + __u16 index, __u8 *buffer) +{ + usb_control_msg(dev, + usb_rcvctrlpipe(dev, 0), + 0xa1, + USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + 0x01, /* value */ + index, buffer, 1, + 500); +} + +static void reg_r(struct usb_device *dev, + __u16 index, __u8 *buffer) +{ + reg_r_i(dev, index, buffer); + PDEBUG(D_USBI, "reg r [%04x] -> %02x", index, *buffer); +} + +static void reg_w_i(struct usb_device *dev, + __u8 value, + __u16 index) +{ + usb_control_msg(dev, + usb_sndctrlpipe(dev, 0), + 0xa0, + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + value, index, NULL, 0, + 500); +} + +static void reg_w(struct usb_device *dev, + __u8 value, + __u16 index) +{ + PDEBUG(D_USBO, "reg w %02x -> [%04x]", value, index); + reg_w_i(dev, value, index); +} + +static __u16 i2c_read(struct usb_device *dev, __u8 reg) +{ + __u8 retbyte; + __u8 retval[2]; + + reg_w_i(dev, reg, 0x92); + reg_w_i(dev, 0x02, 0x90); /* <- read command */ + msleep(25); + reg_r_i(dev, 0x0091, &retbyte); /* read status */ + reg_r_i(dev, 0x0095, &retval[0]); /* read Lowbyte */ + reg_r_i(dev, 0x0096, &retval[1]); /* read Hightbyte */ + PDEBUG(D_USBO, "i2c r [%02x] -> (%02x) %02x%02x", + reg, retbyte, retval[1], retval[0]); + return (retval[1] << 8) | retval[0]; +} + +static __u8 i2c_write(struct usb_device *dev, + __u8 reg, + __u8 valL, + __u8 valH) +{ + __u8 retbyte; + + reg_w_i(dev, reg, 0x92); + reg_w_i(dev, valL, 0x93); + reg_w_i(dev, valH, 0x94); + reg_w_i(dev, 0x01, 0x90); /* <- write command */ + msleep(5); + reg_r_i(dev, 0x0091, &retbyte); /* read status */ + PDEBUG(D_USBO, "i2c w [%02x] %02x%02x (%02x)", + reg, valH, valL, retbyte); + return retbyte; +} + +static void usb_exchange(struct usb_device *dev, + struct usb_action *action) +{ + __u8 buffread; + + while (action->req) { + switch (action->req) { + case 0xa0: /* write register */ + reg_w(dev, action->val, action->idx); + break; + case 0xa1: /* read status */ + reg_r(dev, action->idx, &buffread); + break; + case 0xaa: + i2c_write(dev, + action->val, /* reg */ + action->idx & 0xff, /* valL */ + action->idx >> 8); /* valH */ + break; + default: +/* case 0xdd: * delay */ + msleep(action->val / 64 + 10); + break; + } + action++; +/* msleep(1); */ + } +} + +static void setmatrix(struct gspca_dev *gspca_dev) +{ + struct sd *sd = (struct sd *) gspca_dev; + int i; + __u8 *matrix; + static __u8 gc0305_matrix[9] = + {0x50, 0xf8, 0xf8, 0xf8, 0x50, 0xf8, 0xf8, 0xf8, 0x50}; + static __u8 ov7620_matrix[9] = + {0x58, 0xf4, 0xf4, 0xf4, 0x58, 0xf4, 0xf4, 0xf4, 0x58}; + static __u8 po2030_matrix[9] = + {0x60, 0xf0, 0xf0, 0xf0, 0x60, 0xf0, 0xf0, 0xf0, 0x60}; + + switch (sd->sensor) { + case SENSOR_GC0305: + matrix = gc0305_matrix; + break; + case SENSOR_MC501CB: + return; /* no matrix? */ + case SENSOR_OV7620: +/* case SENSOR_OV7648: */ + matrix = ov7620_matrix; + break; + case SENSOR_PO2030: + matrix = po2030_matrix; + break; + case SENSOR_TAS5130C_VF0250: /* no matrix? */ + return; + default: /* matrix already loaded */ + return; + } + for (i = 0; i < ARRAY_SIZE(ov7620_matrix); i++) + reg_w(gspca_dev->dev, matrix[i], 0x010a + i); +} + +static void setbrightness(struct gspca_dev *gspca_dev) +{ + struct sd *sd = (struct sd *) gspca_dev; + __u8 brightness; + + switch (sd->sensor) { + case SENSOR_GC0305: + case SENSOR_OV7620: + case SENSOR_PO2030: + return; + } +/*fixme: is it really 011d 018d for all other sensors? */ + brightness = sd->brightness; + reg_w(gspca_dev->dev, brightness, 0x011d); + if (brightness < 0x70) + brightness += 0x10; + else + brightness = 0x80; + reg_w(gspca_dev->dev, brightness, 0x018d); +} + +static void setsharpness(struct gspca_dev *gspca_dev) +{ + struct sd *sd = (struct sd *) gspca_dev; + struct usb_device *dev = gspca_dev->dev; + int sharpness; + __u8 retbyte; + static __u8 sharpness_tb[][2] = { + {0x02, 0x03}, + {0x04, 0x07}, + {0x08, 0x0f}, + {0x10, 0x1e} + }; + + switch (sd->sensor) { + case SENSOR_GC0305: + sharpness = 3; + break; + case SENSOR_OV7620: + sharpness = 2; + break; + case SENSOR_PO2030: + sharpness = 0; + break; + default: + return; + } +/*fixme: sharpness set by V4L2_CID_SATURATION?*/ + reg_w(dev, sharpness_tb[sharpness][0], 0x01c6); + reg_r(dev, 0x01c8, &retbyte); + reg_r(dev, 0x01c9, &retbyte); + reg_r(dev, 0x01ca, &retbyte); + reg_w(dev, sharpness_tb[sharpness][1], 0x01cb); +} + +static void setcontrast(struct gspca_dev *gspca_dev) +{ + struct sd *sd = (struct sd *) gspca_dev; + struct usb_device *dev = gspca_dev->dev; + __u8 *Tgamma, *Tgradient; + int g, i, k; + static __u8 kgamma_tb[16] = /* delta for contrast */ + {0x15, 0x0d, 0x0a, 0x09, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08}; + static __u8 kgrad_tb[16] = + {0x1b, 0x06, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x04}; + static __u8 Tgamma_1[16] = + {0x00, 0x00, 0x03, 0x0d, 0x1b, 0x2e, 0x45, 0x5f, + 0x79, 0x93, 0xab, 0xc1, 0xd4, 0xe5, 0xf3, 0xff}; + static __u8 Tgradient_1[16] = + {0x00, 0x01, 0x05, 0x0b, 0x10, 0x15, 0x18, 0x1a, + 0x1a, 0x18, 0x16, 0x14, 0x12, 0x0f, 0x0d, 0x06}; + static __u8 Tgamma_2[16] = + {0x01, 0x0c, 0x1f, 0x3a, 0x53, 0x6d, 0x85, 0x9c, + 0xb0, 0xc2, 0xd1, 0xde, 0xe9, 0xf2, 0xf9, 0xff}; + static __u8 Tgradient_2[16] = + {0x05, 0x0f, 0x16, 0x1a, 0x19, 0x19, 0x17, 0x15, + 0x12, 0x10, 0x0e, 0x0b, 0x09, 0x08, 0x06, 0x03}; + static __u8 Tgamma_3[16] = + {0x04, 0x16, 0x30, 0x4e, 0x68, 0x81, 0x98, 0xac, + 0xbe, 0xcd, 0xda, 0xe4, 0xed, 0xf5, 0xfb, 0xff}; + static __u8 Tgradient_3[16] = + {0x0c, 0x16, 0x1b, 0x1c, 0x19, 0x18, 0x15, 0x12, + 0x10, 0x0d, 0x0b, 0x09, 0x08, 0x06, 0x05, 0x03}; + static __u8 Tgamma_4[16] = + {0x13, 0x38, 0x59, 0x79, 0x92, 0xa7, 0xb9, 0xc8, + 0xd4, 0xdf, 0xe7, 0xee, 0xf4, 0xf9, 0xfc, 0xff}; + static __u8 Tgradient_4[16] = + {0x26, 0x22, 0x20, 0x1c, 0x16, 0x13, 0x10, 0x0d, + 0x0b, 0x09, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02}; + static __u8 Tgamma_5[16] = + {0x20, 0x4b, 0x6e, 0x8d, 0xa3, 0xb5, 0xc5, 0xd2, + 0xdc, 0xe5, 0xec, 0xf2, 0xf6, 0xfa, 0xfd, 0xff}; + static __u8 Tgradient_5[16] = + {0x37, 0x26, 0x20, 0x1a, 0x14, 0x10, 0x0e, 0x0b, + 0x09, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x02}; + static __u8 Tgamma_6[16] = /* ?? was gama 5 */ + {0x24, 0x44, 0x64, 0x84, 0x9d, 0xb2, 0xc4, 0xd3, + 0xe0, 0xeb, 0xf4, 0xff, 0xff, 0xff, 0xff, 0xff}; + static __u8 Tgradient_6[16] = + {0x18, 0x20, 0x20, 0x1c, 0x16, 0x13, 0x10, 0x0e, + 0x0b, 0x09, 0x07, 0x00, 0x00, 0x00, 0x00, 0x01}; + static __u8 *gamma_tb[] = { + 0, Tgamma_1, Tgamma_2, + Tgamma_3, Tgamma_4, Tgamma_5, Tgamma_6 + }; + static __u8 *gradient_tb[] = { + 0, Tgradient_1, Tgradient_2, + Tgradient_3, Tgradient_4, Tgradient_5, Tgradient_6 + }; +#ifdef GSPCA_DEBUG + __u8 v[16]; +#endif + + Tgamma = gamma_tb[sd->gamma]; + Tgradient = gradient_tb[sd->gamma]; + + k = (sd->contrast - 128) /* -128 / 128 */ + * Tgamma[0]; + PDEBUG(D_CONF, "gamma:%d contrast:%d gamma coeff: %d/128", + sd->gamma, sd->contrast, k); + for (i = 0; i < 16; i++) { + g = Tgamma[i] + kgamma_tb[i] * k / 128; + if (g > 0xff) + g = 0xff; + else if (g <= 0) + g = 1; + reg_w(dev, g, 0x0120 + i); /* gamma */ +#ifdef GSPCA_DEBUG + if (gspca_debug & D_CONF) + v[i] = g; +#endif + } + PDEBUG(D_CONF, "tb: %02x %02x %02x %02x %02x %02x %02x %02x", + v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7]); + PDEBUG(D_CONF, " %02x %02x %02x %02x %02x %02x %02x %02x", + v[8], v[9], v[10], v[11], v[12], v[13], v[14], v[15]); + for (i = 0; i < 16; i++) { + g = Tgradient[i] - kgrad_tb[i] * k / 128; + if (g > 0xff) + g = 0xff; + else if (g <= 0) { + if (i != 15) + g = 0; + else + g = 1; + } + reg_w(dev, g, 0x0130 + i); /* gradient */ +#ifdef GSPCA_DEBUG + if (gspca_debug & D_CONF) + v[i] = g; +#endif + } + PDEBUG(D_CONF, " %02x %02x %02x %02x %02x %02x %02x %02x", + v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7]); + PDEBUG(D_CONF, " %02x %02x %02x %02x %02x %02x %02x %02x", + v[8], v[9], v[10], v[11], v[12], v[13], v[14], v[15]); +} + +static void setquality(struct gspca_dev *gspca_dev) +{ + struct sd *sd = (struct sd *) gspca_dev; + struct usb_device *dev = gspca_dev->dev; + __u8 quality; + __u8 frxt; + + switch (sd->sensor) { + case SENSOR_GC0305: + case SENSOR_OV7620: + case SENSOR_PO2030: + return; + } +/*fixme: is it really 0008 0007 0018 for all other sensors? */ + quality = sd->qindex & 0x0f; + reg_w(dev, quality, 0x0008); + frxt = 0x30; + reg_w(dev, frxt, 0x0007); + switch (quality) { + case 0: + case 1: + case 2: + frxt = 0xff; + break; + case 3: + frxt = 0xf0; + break; + case 4: + frxt = 0xe0; + break; + case 5: + frxt = 0x20; + break; + } + reg_w(dev, frxt, 0x0018); +} + +/* Matches the sensor's internal frame rate to the lighting frequency. + * Valid frequencies are: + * 50Hz, for European and Asian lighting (default) + * 60Hz, for American lighting + * 0 = No Fliker (for outdoore usage) + * Returns: 0 for success + */ +static int setlightfreq(struct gspca_dev *gspca_dev) +{ + struct sd *sd = (struct sd *) gspca_dev; + int i, mode; + struct usb_action *zc3_freq; + static struct usb_action *freq_tb[SENSOR_MAX][6] = { +/* SENSOR_CS2102 0 */ + {cs2102_50HZ, cs2102_50HZScale, + cs2102_60HZ, cs2102_60HZScale, + cs2102_NoFliker, cs2102_NoFlikerScale}, +/* SENSOR_CS2102K 1 */ + {cs2102_50HZ, cs2102_50HZScale, + cs2102_60HZ, cs2102_60HZScale, + cs2102_NoFliker, cs2102_NoFlikerScale}, +/* SENSOR_GC0305 2 */ + {gc0305_50HZ, gc0305_50HZ, + gc0305_60HZ, gc0305_60HZ, + gc0305_NoFliker, gc0305_NoFliker}, +/* SENSOR_HDCS2020 3 */ + {0, 0, + 0, 0, + 0, 0}, +/* SENSOR_HDCS2020b 4 */ + {hdcs2020b_50HZ, hdcs2020b_50HZ, + hdcs2020b_60HZ, hdcs2020b_60HZ, + hdcs2020b_NoFliker, hdcs2020b_NoFliker}, +/* SENSOR_HV7131B 5 */ + {0, 0, + 0, 0, + 0, 0}, +/* SENSOR_HV7131C 6 */ + {0, 0, + 0, 0, + 0, 0}, +/* SENSOR_ICM105A 7 */ + {icm105a_50HZ, icm105a_50HZScale, + icm105a_60HZ, icm105a_60HZScale, + icm105a_NoFliker, icm105a_NoFlikerScale}, +/* SENSOR_MC501CB 8 */ + {MC501CB_50HZ, MC501CB_50HZScale, + MC501CB_60HZ, MC501CB_60HZScale, + MC501CB_NoFliker, MC501CB_NoFlikerScale}, +/* SENSOR_OV7620 9 */ + {OV7620_50HZ, OV7620_50HZ, + OV7620_60HZ, OV7620_60HZ, + OV7620_NoFliker, OV7620_NoFliker}, +/* SENSOR_OV7630C 10 */ + {0, 0, + 0, 0, + 0, 0}, +/* SENSOR_free 11 */ + {0, 0, + 0, 0, + 0, 0}, +/* SENSOR_PAS106 12 */ + {pas106b_50HZ, pas106b_50HZ, + pas106b_60HZ, pas106b_60HZ, + pas106b_NoFliker, pas106b_NoFliker}, +/* SENSOR_PB0330 13 */ + {pb0330_50HZ, pb0330_50HZScale, + pb0330_60HZ, pb0330_60HZScale, + pb0330_NoFliker, pb0330_NoFlikerScale}, +/* SENSOR_PO2030 14 */ + {PO2030_50HZ, PO2030_50HZ, + PO2030_60HZ, PO2030_60HZ, + PO2030_NoFliker, PO2030_NoFliker}, +/* SENSOR_TAS5130CK 15 */ + {tas5130cxx_50HZ, tas5130cxx_50HZScale, + tas5130cxx_60HZ, tas5130cxx_60HZScale, + tas5130cxx_NoFliker, tas5130cxx_NoFlikerScale}, +/* SENSOR_TAS5130CXX 16 */ + {tas5130cxx_50HZ, tas5130cxx_50HZScale, + tas5130cxx_60HZ, tas5130cxx_60HZScale, + tas5130cxx_NoFliker, tas5130cxx_NoFlikerScale}, +/* SENSOR_TAS5130C_VF0250 17 */ + {tas5130c_vf0250_50HZ, tas5130c_vf0250_50HZScale, + tas5130c_vf0250_60HZ, tas5130c_vf0250_60HZScale, + tas5130c_vf0250_NoFliker, tas5130c_vf0250_NoFlikerScale}, + }; + + switch (lightfreq) { + case 50: + i = 0; + break; + case 60: + i = 2; + break; + default: + PDEBUG(D_ERR, "Invalid light freq value %d", lightfreq); + lightfreq = 0; /* set to default filter value */ + /* fall thru */ + case 0: + i = 4; + break; + } + mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode; + if (!mode) + i++; /* 640x480 */ + zc3_freq = freq_tb[(int) sd->sensor][i]; + if (zc3_freq != 0) { + usb_exchange(gspca_dev->dev, zc3_freq); + switch (sd->sensor) { + case SENSOR_GC0305: + if (mode /* if 320x240 */ + && lightfreq == 50) + reg_w(gspca_dev->dev, 0x85, 0x018d); + /* win: 0x80, 0x018d */ + break; + case SENSOR_OV7620: + if (!mode) { /* if 640x480 */ + if (lightfreq != 0) /* 50 or 60 Hz */ + reg_w(gspca_dev->dev, 0x40, 0x0002); + else + reg_w(gspca_dev->dev, 0x44, 0x0002); + } + break; + } + } + return 0; +} + +static void setautogain(struct gspca_dev *gspca_dev) +{ + struct sd *sd = (struct sd *) gspca_dev; + __u8 autoval; + + if (sd->autogain) + autoval = 0x42; + else + autoval = 0x02; + reg_w(gspca_dev->dev, autoval, 0x0180); +} + +static void send_unknown(struct usb_device *dev, int sensor) +{ + switch (sensor) { + case SENSOR_PAS106: + reg_w(dev, 0x01, 0x0000); + reg_w(dev, 0x03, 0x003a); + reg_w(dev, 0x0c, 0x003b); + reg_w(dev, 0x08, 0x0038); + break; + case SENSOR_GC0305: + case SENSOR_OV7620: + case SENSOR_PB0330: + case SENSOR_PO2030: + reg_w(dev, 0x01, 0x0000); + reg_w(dev, 0x0d, 0x003a); + reg_w(dev, 0x02, 0x003b); + reg_w(dev, 0x00, 0x0038); + break; + } +} + +/* start probe 2 wires */ +static void start_2wr_probe(struct usb_device *dev, int sensor) +{ + reg_w(dev, 0x01, 0x0000); + reg_w(dev, sensor, 0x0010); + reg_w(dev, 0x01, 0x0001); + reg_w(dev, 0x03, 0x0012); + reg_w(dev, 0x01, 0x0012); +/* msleep(2); */ +} + +static int sif_probe(struct usb_device *dev) +{ + __u16 checkword; + + start_2wr_probe(dev, 0x0f); /* PAS106 */ + reg_w(dev, 0x08, 0x008d); + msleep(150); + checkword = ((i2c_read(dev, 0x00) & 0x0f) << 4) + | ((i2c_read(dev, 0x01) & 0xf0) >> 4); + PDEBUG(D_PROBE, "probe sif 0x%04x", checkword); + if (checkword == 0x0007) { + send_unknown(dev, SENSOR_PAS106); + return 0x0f; /* PAS106 */ + } + return -1; +} + +static int vga_2wr_probe(struct usb_device *dev) +{ + __u8 retbyte; + __u16 checkword; + + start_2wr_probe(dev, 0x00); /* HV7131B */ + i2c_write(dev, 0x01, 0xaa, 0x00); + retbyte = i2c_read(dev, 0x01); + if (retbyte != 0) + return 0x00; /* HV7131B */ + + start_2wr_probe(dev, 0x04); /* CS2102 */ + i2c_write(dev, 0x01, 0xaa, 0x00); + retbyte = i2c_read(dev, 0x01); + if (retbyte != 0) + return 0x04; /* CS2102 */ + + start_2wr_probe(dev, 0x06); /* OmniVision */ + reg_w(dev, 0x08, 0x8d); + i2c_write(dev, 0x11, 0xaa, 0x00); + retbyte = i2c_read(dev, 0x11); + if (retbyte != 0) { + /* (should have returned 0xaa) --> Omnivision? */ + /* reg_r 0x10 -> 0x06 --> */ + goto ov_check; + } + + start_2wr_probe(dev, 0x08); /* HDCS2020 */ + i2c_write(dev, 0x15, 0xaa, 0x00); + retbyte = i2c_read(dev, 0x15); + if (retbyte != 0) + return 0x08; /* HDCS2020 */ + + start_2wr_probe(dev, 0x0a); /* PB0330 */ + i2c_write(dev, 0x07, 0xaa, 0xaa); + retbyte = i2c_read(dev, 0x07); + if (retbyte != 0) + return 0x0a; /* PB0330 */ + retbyte = i2c_read(dev, 0x03); + if (retbyte != 0) + return 0x0a; /* PB0330 ?? */ + retbyte = i2c_read(dev, 0x04); + if (retbyte != 0) + return 0x0a; /* PB0330 ?? */ + + start_2wr_probe(dev, 0x0c); /* ICM105A */ + i2c_write(dev, 0x01, 0x11, 0x00); + retbyte = i2c_read(dev, 0x01); + if (retbyte != 0) + return 0x0c; /* ICM105A */ + + start_2wr_probe(dev, 0x0e); /* PAS202BCB */ + reg_w(dev, 0x08, 0x8d); + i2c_write(dev, 0x03, 0xaa, 0x00); + msleep(500); + retbyte = i2c_read(dev, 0x03); + if (retbyte != 0) + return 0x0e; /* PAS202BCB */ + + start_2wr_probe(dev, 0x02); /* ?? */ + i2c_write(dev, 0x01, 0xaa, 0x00); + retbyte = i2c_read(dev, 0x01); + if (retbyte != 0) + return 0x02; /* ?? */ +ov_check: + reg_r(dev, 0x0010, &retbyte); /* ?? */ + reg_r(dev, 0x0010, &retbyte); + + reg_w(dev, 0x01, 0x0000); + reg_w(dev, 0x01, 0x0001); + reg_w(dev, 0x06, 0x0010); /* OmniVision */ + reg_w(dev, 0xa1, 0x008b); + reg_w(dev, 0x08, 0x008d); + msleep(500); + reg_w(dev, 0x01, 0x0012); + i2c_write(dev, 0x12, 0x80, 0x00); /* sensor reset */ + retbyte = i2c_read(dev, 0x0a); + checkword = retbyte << 8; + retbyte = i2c_read(dev, 0x0b); + checkword |= retbyte; + PDEBUG(D_PROBE, "probe 2wr ov vga 0x%04x", checkword); + switch (checkword) { + case 0x7631: /* OV7630C */ + reg_w(dev, 0x06, 0x0010); + break; + case 0x7620: /* OV7620 */ + case 0x7648: /* OV7648 */ + break; + default: + return -1; /* not OmniVision */ + } + return checkword; +} + +struct sensor_by_chipset_revision { + __u16 revision; + __u8 internal_sensor_id; +}; +static const struct sensor_by_chipset_revision chipset_revision_sensor[] = { + {0xc001, 0x13}, /* MI0360 */ + {0xe001, 0x13}, + {0x8001, 0x13}, + {0x8000, 0x14}, /* CS2102K */ + {0x8400, 0x15}, /* TAS5130K */ + {0, 0} +}; + +static int vga_3wr_probe(struct gspca_dev *gspca_dev) +{ + struct sd *sd = (struct sd *) gspca_dev; + struct usb_device *dev = gspca_dev->dev; + int i; + __u8 retbyte; + __u16 checkword; + +/*fixme: lack of 8b=b3 (11,12)-> 10, 8b=e0 (14,15,16)-> 12 found in gspcav1*/ + reg_w(dev, 0x02, 0x0010); + reg_r(dev, 0x0010, &retbyte); + reg_w(dev, 0x01, 0x0000); + reg_w(dev, 0x00, 0x0010); + reg_w(dev, 0x01, 0x0001); + reg_w(dev, 0x91, 0x008b); + reg_w(dev, 0x03, 0x0012); + reg_w(dev, 0x01, 0x0012); + reg_w(dev, 0x05, 0x0012); + retbyte = i2c_read(dev, 0x14); + if (retbyte != 0) + return 0x11; /* HV7131R */ + retbyte = i2c_read(dev, 0x15); + if (retbyte != 0) + return 0x11; /* HV7131R */ + retbyte = i2c_read(dev, 0x16); + if (retbyte != 0) + return 0x11; /* HV7131R */ + + reg_w(dev, 0x02, 0x0010); + reg_r(dev, 0x000b, &retbyte); + checkword = retbyte << 8; + reg_r(dev, 0x000a, &retbyte); + checkword |= retbyte; + PDEBUG(D_PROBE, "probe 3wr vga 1 0x%04x", checkword); + reg_r(dev, 0x0010, &retbyte); + /* this is tested only once anyway */ + i = 0; + while (chipset_revision_sensor[i].revision) { + if (chipset_revision_sensor[i].revision == checkword) { + sd->chip_revision = checkword; + send_unknown(dev, SENSOR_PB0330); + return chipset_revision_sensor[i].internal_sensor_id; + } + i++; + } + + reg_w(dev, 0x01, 0x0000); + reg_w(dev, 0x01, 0x0001); + reg_w(dev, 0xdd, 0x008b); + reg_w(dev, 0x0a, 0x0010); + reg_w(dev, 0x03, 0x0012); + reg_w(dev, 0x01, 0x0012); + retbyte = i2c_read(dev, 0x00); + if (retbyte != 0) { + PDEBUG(D_PROBE, "probe 3wr vga type 0a ?"); + return 0x0a; /* ?? */ + } + + reg_w(dev, 0x01, 0x0000); + reg_w(dev, 0x01, 0x0001); + reg_w(dev, 0x98, 0x008b); + reg_w(dev, 0x01, 0x0010); + reg_w(dev, 0x03, 0x0012); + msleep(2); + reg_w(dev, 0x01, 0x0012); + retbyte = i2c_read(dev, 0x00); + if (retbyte != 0) { + PDEBUG(D_PROBE, "probe 3wr vga type %02x", retbyte); + send_unknown(dev, SENSOR_GC0305); + return retbyte; /* 0x29 = gc0305 - should continue? */ + } + + reg_w(dev, 0x01, 0x0000); /* check OmniVision */ + reg_w(dev, 0x01, 0x0001); + reg_w(dev, 0xa1, 0x008b); + reg_w(dev, 0x08, 0x008d); + reg_w(dev, 0x06, 0x0010); + reg_w(dev, 0x01, 0x0012); + reg_w(dev, 0x05, 0x0012); + if (i2c_read(dev, 0x1c) == 0x7f /* OV7610 - manufacturer ID */ + && i2c_read(dev, 0x1d) == 0xa2) { + send_unknown(dev, SENSOR_OV7620); + return 0x06; /* OmniVision confirm ? */ + } + + reg_w(dev, 0x01, 0x00); + reg_w(dev, 0x00, 0x02); + reg_w(dev, 0x01, 0x10); + reg_w(dev, 0x01, 0x01); + reg_w(dev, 0xee, 0x8b); + reg_w(dev, 0x03, 0x12); +/* msleep(150); */ + reg_w(dev, 0x01, 0x12); + reg_w(dev, 0x05, 0x12); + retbyte = i2c_read(dev, 0x00); /* ID 0 */ + checkword = retbyte << 8; + retbyte = i2c_read(dev, 0x01); /* ID 1 */ + checkword |= retbyte; + PDEBUG(D_PROBE, "probe 3wr vga 2 0x%04x", checkword); + if (checkword == 0x2030) { + retbyte = i2c_read(dev, 0x02); /* revision number */ + PDEBUG(D_PROBE, "sensor PO2030 rev 0x%02x", retbyte); + send_unknown(dev, SENSOR_PO2030); + return checkword; + } + + reg_w(dev, 0x01, 0x00); + reg_w(dev, 0x0a, 0x10); + reg_w(dev, 0xd3, 0x8b); + reg_w(dev, 0x01, 0x01); + reg_w(dev, 0x03, 0x12); + reg_w(dev, 0x01, 0x12); + reg_w(dev, 0x05, 0x01); + reg_w(dev, 0xd3, 0x8b); + retbyte = i2c_read(dev, 0x01); + if (retbyte != 0) { + PDEBUG(D_PROBE, "probe 3wr vga type 0a ?"); + return 0x0a; /* ?? */ + } + return -1; +} + +static int zcxx_probeSensor(struct gspca_dev *gspca_dev) +{ + struct sd *sd = (struct sd *) gspca_dev; + struct usb_device *dev = gspca_dev->dev; + int sensor, sensor2; + + switch (sd->sensor) { + case SENSOR_MC501CB: + case SENSOR_TAS5130C_VF0250: + return -1; /* don't probe */ + } + sensor = vga_2wr_probe(dev); + if (sensor >= 0) { + if (sensor < 0x7600) + return sensor; + /* next probe is needed for OmniVision ? */ + } + sensor2 = vga_3wr_probe(gspca_dev); + if (sensor2 >= 0) { + if (sensor >= 0) + return sensor; + return sensor2; + } + return sif_probe(dev); +} + +/* this function is called at probe time */ +static int sd_config(struct gspca_dev *gspca_dev, + const struct usb_device_id *id) +{ + struct sd *sd = (struct sd *) gspca_dev; + struct cam *cam; + int sensor; + __u8 bsensor; + int vga = 1; /* 1: vga, 0: sif */ + static unsigned char gamma[SENSOR_MAX] = { + 5, /* SENSOR_CS2102 0 */ + 5, /* SENSOR_CS2102K 1 */ + 4, /* SENSOR_GC0305 2 */ + 4, /* SENSOR_HDCS2020 3 */ + 4, /* SENSOR_HDCS2020b 4 */ + 4, /* SENSOR_HV7131B 5 */ + 4, /* SENSOR_HV7131C 6 */ + 4, /* SENSOR_ICM105A 7 */ + 4, /* SENSOR_MC501CB 8 */ + 3, /* SENSOR_OV7620 9 */ + 4, /* SENSOR_OV7630C 10 */ + 4, /* SENSOR_free 11 */ + 4, /* SENSOR_PAS106 12 */ + 4, /* SENSOR_PB0330 13 */ + 4, /* SENSOR_PO2030 14 */ + 4, /* SENSOR_TAS5130CK 15 */ + 4, /* SENSOR_TAS5130CXX 16 */ + 3, /* SENSOR_TAS5130C_VF0250 17 */ + }; + + /* define some sensors from the vendor/product */ + switch (id->idVendor) { + case 0x041e: /* Creative */ + switch (id->idProduct) { + case 0x4051: /* zc301 chips */ + case 0x4053: + sd->sensor = SENSOR_TAS5130C_VF0250; + break; + } + break; + case 0x046d: /* Logitech Labtec */ + switch (id->idProduct) { + case 0x08dd: + sd->sensor = SENSOR_MC501CB; + break; + } + break; + case 0x0ac8: /* Vimicro z-star */ + switch (id->idProduct) { + case 0x305b: + sd->sensor = SENSOR_TAS5130C_VF0250; + break; + } + break; + } + sensor = zcxx_probeSensor(gspca_dev); + if (sensor >= 0) + PDEBUG(D_PROBE, "probe sensor -> %02x", sensor); + if ((unsigned) force_sensor < SENSOR_MAX) { + sd->sensor = force_sensor; + PDEBUG(D_PROBE, "sensor forced to %d", force_sensor); + } else { + switch (sensor) { + case -1: + switch (sd->sensor) { + case SENSOR_MC501CB: + PDEBUG(D_PROBE, "Sensor MC501CB"); + break; + case SENSOR_TAS5130C_VF0250: + PDEBUG(D_PROBE, "Sensor Tas5130 (VF0250)"); + break; + default: + PDEBUG(D_PROBE, + "Sensor UNKNOW_0 force Tas5130"); + sd->sensor = SENSOR_TAS5130CXX; + } + break; + case 0: + PDEBUG(D_PROBE, "Find Sensor HV7131B"); + sd->sensor = SENSOR_HV7131B; + break; + case 0x04: + PDEBUG(D_PROBE, "Find Sensor CS2102"); + sd->sensor = SENSOR_CS2102; + break; + case 0x08: + PDEBUG(D_PROBE, "Find Sensor HDCS2020(b)"); + sd->sensor = SENSOR_HDCS2020b; + break; + case 0x0a: + PDEBUG(D_PROBE, + "Find Sensor PB0330. Chip revision %x", + sd->chip_revision); + sd->sensor = SENSOR_PB0330; + break; + case 0x0c: + PDEBUG(D_PROBE, "Find Sensor ICM105A"); + sd->sensor = SENSOR_ICM105A; + break; + case 0x0e: + PDEBUG(D_PROBE, "Find Sensor PAS202BCB"); + sd->sensor = SENSOR_HDCS2020; + break; + case 0x0f: + PDEBUG(D_PROBE, "Find Sensor PAS106"); + sd->sensor = SENSOR_PAS106; + vga = 0; /* SIF */ + break; + case 0x10: + case 0x12: + PDEBUG(D_PROBE, "Find Sensor TAS5130"); + sd->sensor = SENSOR_TAS5130CXX; + break; + case 0x11: + PDEBUG(D_PROBE, "Find Sensor HV7131R(c)"); + sd->sensor = SENSOR_HV7131C; + break; + case 0x13: + PDEBUG(D_PROBE, + "Find Sensor MI0360. Chip revision %x", + sd->chip_revision); + sd->sensor = SENSOR_PB0330; + break; + case 0x14: + PDEBUG(D_PROBE, + "Find Sensor CS2102K?. Chip revision %x", + sd->chip_revision); + sd->sensor = SENSOR_CS2102K; + break; + case 0x15: + PDEBUG(D_PROBE, + "Find Sensor TAS5130CK?. Chip revision %x", + sd->chip_revision); + sd->sensor = SENSOR_TAS5130CK; + break; + case 0x29: + PDEBUG(D_PROBE, "Find Sensor GC0305"); + sd->sensor = SENSOR_GC0305; + break; + case 0x2030: + PDEBUG(D_PROBE, "Find Sensor PO2030"); + sd->sensor = SENSOR_PO2030; + break; + case 0x7620: + PDEBUG(D_PROBE, "Find Sensor OV7620"); + sd->sensor = SENSOR_OV7620; + break; + case 0x7648: + PDEBUG(D_PROBE, "Find Sensor OV7648"); + sd->sensor = SENSOR_OV7620; /* same sensor (?) */ + break; + default: + PDEBUG(D_ERR|D_PROBE, "Unknown sensor %02x", sensor); + return -EINVAL; + } + } + if (sensor < 0x20) { + if (sensor == -1 || sensor == 0x10 || sensor == 0x12) + reg_w(gspca_dev->dev, 0x02, 0x0010); + else + reg_w(gspca_dev->dev, sensor & 0x0f, 0x0010); + reg_r(gspca_dev->dev, 0x0010, &bsensor); + } + + cam = &gspca_dev->cam; + cam->dev_name = (char *) id->driver_info; + cam->epaddr = 0x01; +/*fixme:test*/ + gspca_dev->nbalt--; + if (vga) { + cam->cam_mode = vga_mode; + cam->nmodes = sizeof vga_mode / sizeof vga_mode[0]; + } else { + cam->cam_mode = sif_mode; + cam->nmodes = sizeof sif_mode / sizeof sif_mode[0]; + } + sd->qindex = 1; + sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value; + sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value; + sd->autogain = sd_ctrls[SD_AUTOGAIN].qctrl.default_value; + sd->gamma = gamma[(int) sd->sensor]; + + /* switch the led off */ +/*fixme: other sensors? */ + if (sensor == 0x06 || sensor == 0x11) + reg_w(gspca_dev->dev, 0x01, 0x0000); + return 0; +} + +/* this function is called at open time */ +static int sd_open(struct gspca_dev *gspca_dev) +{ + reg_w(gspca_dev->dev, 0x01, 0x0000); + return 0; +} + +static void sd_start(struct gspca_dev *gspca_dev) +{ + struct sd *sd = (struct sd *) gspca_dev; + struct usb_device *dev = gspca_dev->dev; + struct usb_action *zc3_init; + int mode; + __u8 retbyte; + static struct usb_action *init_tb[SENSOR_MAX][2] = { + {cs2102_InitialScale, cs2102_Initial}, /* 0 */ + {cs2102K_InitialScale, cs2102K_Initial}, /* 1 */ + {gc0305_Initial, gc0305_InitialScale}, /* 2 */ + {hdcs2020xx_InitialScale, hdcs2020xx_Initial}, /* 3 */ + {hdcs2020xb_InitialScale, hdcs2020xb_Initial}, /* 4 */ + {hv7131bxx_InitialScale, hv7131bxx_Initial}, /* 5 */ + {hv7131cxx_InitialScale, hv7131cxx_Initial}, /* 6 */ + {icm105axx_InitialScale, icm105axx_Initial}, /* 7 */ + {MC501CB_InitialScale, MC501CB_Initial}, /* 9 */ + {OV7620_mode0, OV7620_mode1}, /* 9 */ + {ov7630c_InitialScale, ov7630c_Initial}, /* 10 */ + {0, 0}, /* 11 */ + {pas106b_InitialScale, pas106b_Initial}, /* 12 */ + {pb0330xx_InitialScale, pb0330xx_Initial}, /* 13 */ +/* or {pb03303x_InitialScale, pb03303x_Initial}, */ + {PO2030_mode0, PO2030_mode1}, /* 14 */ + {tas5130CK_InitialScale, tas5130CK_Initial}, /* 15 */ + {tas5130cxx_InitialScale, tas5130cxx_Initial}, /* 16 */ + {tas5130c_vf0250_InitialScale, tas5130c_vf0250_Initial}, + /* 17 */ + }; + + mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].mode; + zc3_init = init_tb[(int) sd->sensor][mode]; + switch (sd->sensor) { + case SENSOR_HV7131B: + case SENSOR_HV7131C: + zcxx_probeSensor(gspca_dev); + break; + case SENSOR_PAS106: + usb_exchange(dev, pas106b_Initial_com); + break; + case SENSOR_PB0330: + if (mode) { + if (sd->chip_revision == 0xc001 + || sd->chip_revision == 0xe001 + || sd->chip_revision == 0x8001) + zc3_init = pb03303x_Initial; + } else { + if (sd->chip_revision == 0xc001 + || sd->chip_revision == 0xe001 + || sd->chip_revision == 0x8001) + zc3_init = pb03303x_InitialScale; + } + break; + } + usb_exchange(dev, zc3_init); + + switch (sd->sensor) { + case SENSOR_GC0305: + case SENSOR_OV7620: + case SENSOR_PO2030: + msleep(100); /* ?? */ + reg_r(dev, 0x0002, &retbyte); /* --> 0x40 */ + reg_w(dev, 0x09, 0x01ad); /* (from win traces) */ + reg_w(dev, 0x15, 0x01ae); + reg_w(dev, 0x0d, 0x003a); + reg_w(dev, 0x02, 0x003b); + reg_w(dev, 0x00, 0x0038); + break; + } + + setmatrix(gspca_dev); + setbrightness(gspca_dev); + switch (sd->sensor) { + case SENSOR_OV7620: + reg_r(dev, 0x0008, &retbyte); + reg_w(dev, 0x00, 0x0008); + break; + case SENSOR_GC0305: + reg_r(dev, 0x0008, &retbyte); + /* fall thru */ + case SENSOR_PO2030: + reg_w(dev, 0x03, 0x0008); + break; + } + setsharpness(gspca_dev); + + /* set the gamma tables when not set */ + switch (sd->sensor) { + case SENSOR_CS2102: /* gamma set in xxx_Initial */ + case SENSOR_CS2102K: + case SENSOR_HDCS2020: + case SENSOR_HDCS2020b: + case SENSOR_PB0330: /* pb with chip_revision - see above */ + case SENSOR_OV7630C: + case SENSOR_TAS5130CK: + break; + default: + setcontrast(gspca_dev); + break; + } + setmatrix(gspca_dev); /* one more time? */ + switch (sd->sensor) { + case SENSOR_OV7620: + reg_r(dev, 0x0180, &retbyte); /* from win */ + reg_w(dev, 0x00, 0x0180); + break; + default: + setquality(gspca_dev); + break; + } + setlightfreq(gspca_dev); + + switch (sd->sensor) { + case SENSOR_GC0305: + case SENSOR_OV7620: + reg_w(dev, 0x09, 0x01ad); /* (from win traces) */ + reg_w(dev, 0x15, 0x01ae); + sd->autogain = 0; + break; + case SENSOR_PO2030: + reg_w(dev, 0x40, 0x0117); /* (from win traces) */ + reg_r(dev, 0x0180, &retbyte); + break; + } + + setautogain(gspca_dev); + switch (sd->sensor) { + case SENSOR_GC0305: +/* setlightfreq(gspca_dev); ?? (end: 80 -> [18d]) */ + reg_w(dev, 0x09, 0x01ad); /* (from win traces) */ + reg_w(dev, 0x15, 0x01ae); + reg_w(dev, 0x40, 0x0180); + reg_w(dev, 0x40, 0x0117); + reg_r(dev, 0x0180, &retbyte); + sd->autogain = 1; + setautogain(gspca_dev); + break; + case SENSOR_OV7620: + i2c_read(dev, 0x13); /*fixme: returns 0xa3 */ + i2c_write(dev, 0x13, 0xa3, 0x00); /*fixme: same to send? */ + reg_w(dev, 0x40, 0x0117); /* (from win traces) */ + reg_r(dev, 0x0180, &retbyte); + setautogain(gspca_dev); + msleep(500); + break; + case SENSOR_PO2030: + msleep(500); + reg_r(dev, 0x0008, &retbyte); + reg_r(dev, 0x0007, &retbyte); + reg_w(dev, 0x00, 0x0007); /* (from win traces) */ + reg_w(dev, 0x02, 0x0008); + break; + } +} + +static void sd_stopN(struct gspca_dev *gspca_dev) +{ +} + +static void sd_stop0(struct gspca_dev *gspca_dev) +{ + struct sd *sd = (struct sd *) gspca_dev; + + send_unknown(gspca_dev->dev, sd->sensor); +} + +/* this function is called at close time */ +static void sd_close(struct gspca_dev *gspca_dev) +{ +} + +static void sd_pkt_scan(struct gspca_dev *gspca_dev, + struct gspca_frame *frame, + unsigned char *data, + int len) +{ + + if (data[0] == 0xff && data[1] == 0xd8) { /* start of frame */ + frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame, + data, 0); + /* put the JPEG header in the new frame */ + jpeg_put_header(gspca_dev, frame, + ((struct sd *) gspca_dev)->qindex, + 0x21); + /* remove the webcam's header: + * ff d8 ff fe 00 0e 00 00 ss ss 00 01 ww ww hh hh pp pp + * - 'ss ss' is the frame sequence number (BE) + * - 'ww ww' and 'hh hh' are the window dimensions (BE) + * - 'pp pp' is the packet sequence number (BE) + */ + data += 18; + len -= 18; + } + gspca_frame_add(gspca_dev, INTER_PACKET, frame, data, len); +} + +static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val) +{ + struct sd *sd = (struct sd *) gspca_dev; + + sd->brightness = val; + if (gspca_dev->streaming) + setbrightness(gspca_dev); + return 0; +} + +static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val) +{ + struct sd *sd = (struct sd *) gspca_dev; + + *val = sd->brightness; + return 0; +} + +static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val) +{ + struct sd *sd = (struct sd *) gspca_dev; + + sd->contrast = val; + if (gspca_dev->streaming) + setcontrast(gspca_dev); + return 0; +} + +static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val) +{ + struct sd *sd = (struct sd *) gspca_dev; + + *val = sd->contrast; + return 0; +} + +static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val) +{ + struct sd *sd = (struct sd *) gspca_dev; + + sd->autogain = val; + if (gspca_dev->streaming) + setautogain(gspca_dev); + return 0; +} + +static int sd_getautogain(struct gspca_dev *gspca_dev, __s32 *val) +{ + struct sd *sd = (struct sd *) gspca_dev; + + *val = sd->autogain; + return 0; +} + +static int sd_getgamma(struct gspca_dev *gspca_dev, __s32 *val) +{ + struct sd *sd = (struct sd *) gspca_dev; + + *val = sd->gamma; + return 0; +} + +static struct sd_desc sd_desc = { + .name = MODULE_NAME, + .ctrls = sd_ctrls, + .nctrls = sizeof sd_ctrls / sizeof sd_ctrls[0], + .config = sd_config, + .open = sd_open, + .start = sd_start, + .stopN = sd_stopN, + .stop0 = sd_stop0, + .close = sd_close, + .pkt_scan = sd_pkt_scan, +}; + +#define DVNM(name) .driver_info = (kernel_ulong_t) name +static __devinitdata struct usb_device_id device_table[] = { + {USB_DEVICE(0x041e, 0x041e), DVNM("Creative WebCam Live!")}, + {USB_DEVICE(0x041e, 0x4017), DVNM("Creative Webcam Mobile PD1090")}, + {USB_DEVICE(0x041e, 0x401c), DVNM("Creative NX")}, + {USB_DEVICE(0x041e, 0x401e), DVNM("Creative Nx Pro")}, + {USB_DEVICE(0x041e, 0x401f), DVNM("Creative Webcam Notebook PD1171")}, +/*0x041e, 0x4022*/ + {USB_DEVICE(0x041e, 0x4029), DVNM("Creative WebCam Vista Pro")}, + {USB_DEVICE(0x041e, 0x4034), DVNM("Creative Instant P0620")}, + {USB_DEVICE(0x041e, 0x4035), DVNM("Creative Instant P0620D")}, + {USB_DEVICE(0x041e, 0x4036), DVNM("Creative Live !")}, + {USB_DEVICE(0x041e, 0x403a), DVNM("Creative Nx Pro 2")}, + {USB_DEVICE(0x041e, 0x4051), DVNM("Creative Notebook Pro (VF0250)")}, + {USB_DEVICE(0x041e, 0x4053), DVNM("Creative Live!Cam Video IM")}, + {USB_DEVICE(0x0458, 0x7007), DVNM("Genius VideoCam V2")}, + {USB_DEVICE(0x0458, 0x700c), DVNM("Genius VideoCam V3")}, + {USB_DEVICE(0x0458, 0x700f), DVNM("Genius VideoCam Web V2")}, + {USB_DEVICE(0x0461, 0x0a00), DVNM("MicroInnovation WebCam320")}, + {USB_DEVICE(0x046d, 0x08a0), DVNM("Logitech QC IM")}, + {USB_DEVICE(0x046d, 0x08a1), DVNM("Logitech QC IM 0x08A1 +sound")}, + {USB_DEVICE(0x046d, 0x08a2), DVNM("Labtec Webcam Pro")}, + {USB_DEVICE(0x046d, 0x08a3), DVNM("Logitech QC Chat")}, + {USB_DEVICE(0x046d, 0x08a6), DVNM("Logitech QCim")}, + {USB_DEVICE(0x046d, 0x08a7), DVNM("Logitech QuickCam Image")}, + {USB_DEVICE(0x046d, 0x08a9), DVNM("Logitech Notebook Deluxe")}, + {USB_DEVICE(0x046d, 0x08aa), DVNM("Labtec Webcam Notebook")}, + {USB_DEVICE(0x046d, 0x08ac), DVNM("Logitech QuickCam Cool")}, + {USB_DEVICE(0x046d, 0x08ad), DVNM("Logitech QCCommunicate STX")}, + {USB_DEVICE(0x046d, 0x08ae), DVNM("Logitech QuickCam for Notebooks")}, + {USB_DEVICE(0x046d, 0x08af), DVNM("Logitech QuickCam Cool")}, + {USB_DEVICE(0x046d, 0x08b9), DVNM("Logitech QC IM ???")}, + {USB_DEVICE(0x046d, 0x08d7), DVNM("Logitech QCam STX")}, + {USB_DEVICE(0x046d, 0x08d9), DVNM("Logitech QuickCam IM/Connect")}, + {USB_DEVICE(0x046d, 0x08d8), DVNM("Logitech Notebook Deluxe")}, + {USB_DEVICE(0x046d, 0x08da), DVNM("Logitech QuickCam Messenger")}, + {USB_DEVICE(0x046d, 0x08dd), DVNM("Logitech QuickCam for Notebooks")}, + {USB_DEVICE(0x0471, 0x0325), DVNM("Philips SPC 200 NC")}, + {USB_DEVICE(0x0471, 0x0326), DVNM("Philips SPC 300 NC")}, + {USB_DEVICE(0x0471, 0x032d), DVNM("Philips spc210nc")}, + {USB_DEVICE(0x0471, 0x032e), DVNM("Philips spc315nc")}, + {USB_DEVICE(0x055f, 0xc005), DVNM("Mustek Wcam300A")}, + {USB_DEVICE(0x055f, 0xd003), DVNM("Mustek WCam300A")}, + {USB_DEVICE(0x055f, 0xd004), DVNM("Mustek WCam300 AN")}, + {USB_DEVICE(0x0698, 0x2003), DVNM("CTX M730V built in")}, +/*0x0ac8, 0x0301*/ + {USB_DEVICE(0x0ac8, 0x0302), DVNM("Z-star Vimicro zc0302")}, + {USB_DEVICE(0x0ac8, 0x301b), DVNM("Z-Star zc301b")}, + {USB_DEVICE(0x0ac8, 0x303b), DVNM("Vimicro 0x303b")}, + {USB_DEVICE(0x0ac8, 0x305b), DVNM("Z-star Vimicro zc0305b")}, + {USB_DEVICE(0x0ac8, 0x307b), DVNM("Z-Star 307b")}, + {USB_DEVICE(0x10fd, 0x0128), DVNM("Typhoon Webshot II 300k 0x0128")}, +/*0x10fd, 0x804e*/ + {USB_DEVICE(0x10fd, 0x8050), DVNM("Typhoon Webshot II USB 300k")}, + {} /* end of entry */ +}; +#undef DVNAME +MODULE_DEVICE_TABLE(usb, device_table); + +/* -- device connect -- */ +static int sd_probe(struct usb_interface *intf, + const struct usb_device_id *id) +{ + return gspca_dev_probe(intf, id, &sd_desc, sizeof(struct sd), + THIS_MODULE); +} + +/* USB driver */ +static struct usb_driver sd_driver = { + .name = MODULE_NAME, + .id_table = device_table, + .probe = sd_probe, + .disconnect = gspca_disconnect, +}; + +static int __init sd_mod_init(void) +{ + if (usb_register(&sd_driver) < 0) + return -1; + PDEBUG(D_PROBE, "v%s registered", version); + return 0; +} + +static void __exit sd_mod_exit(void) +{ + usb_deregister(&sd_driver); + PDEBUG(D_PROBE, "deregistered"); +} + +module_init(sd_mod_init); +module_exit(sd_mod_exit); + +module_param(lightfreq, int, 0644); +MODULE_PARM_DESC(lightfreq, + "Light frequency banding filter: 50, 60 Hz or" + " 0 to NoFliker (default=50)"); +module_param(force_sensor, int, 0644); +MODULE_PARM_DESC(force_sensor, + "Force sensor. Only for experts!!!"); |