diff options
Diffstat (limited to 'linux')
24 files changed, 6845 insertions, 6248 deletions
diff --git a/linux/Documentation/video4linux/gspca.txt b/linux/Documentation/video4linux/gspca.txt index 6e68cdeb2..24f55a0cc 100644 --- a/linux/Documentation/video4linux/gspca.txt +++ b/linux/Documentation/video4linux/gspca.txt @@ -199,11 +199,11 @@ vc032x 0ac8:c002 Sony embedded vimicro spca508 0af9:0010 Hama USB Sightcam 100 spca508 0af9:0011 Hama USB Sightcam 100 sonixb 0c45:6001 Genius VideoCAM NB -sonixb 0c45:6005 Sweex Tas5110 +sonixb 0c45:6005 Microdia Sweex Mini Webcam sonixb 0c45:6007 Sonix sn9c101 + Tas5110D sonixb 0c45:6009 spcaCam@120 sonixb 0c45:600d spcaCam@120 -sonixb 0c45:6011 MAX Webcam (Microdia - OV6650 - SN9C101G) +sonixb 0c45:6011 Microdia PC Camera (SN9C102) sonixb 0c45:6019 Generic Sonix OV7630 sonixb 0c45:6024 Generic Sonix Tas5130c sonixb 0c45:6025 Xcam Shanga diff --git a/linux/drivers/media/video/gspca/conex.c b/linux/drivers/media/video/gspca/conex.c index b5481017d..013d593b0 100644 --- a/linux/drivers/media/video/gspca/conex.c +++ b/linux/drivers/media/video/gspca/conex.c @@ -25,8 +25,8 @@ #define CONEX_CAM 1 /* special JPEG header */ #include "jpeg.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) -static const char version[] = "2.1.5"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7) +static const char version[] = "2.1.7"; MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_DESCRIPTION("GSPCA USB Conexant Camera Driver"); @@ -119,40 +119,67 @@ static struct v4l2_pix_format vga_mode[] = { .priv = 0}, }; -static void reg_r(struct usb_device *dev, - __u16 index, - __u8 *buffer, __u16 length) +/* the read bytes are found in gspca_dev->usb_buf */ +static void reg_r(struct gspca_dev *gspca_dev, + __u16 index, + __u16 len) { + struct usb_device *dev = gspca_dev->dev; + +#ifdef CONFIG_VIDEO_ADV_DEBUG + if (len > sizeof gspca_dev->usb_buf) { + err("reg_r: buffer overflow"); + return; + } +#endif usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), 0, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0, - index, buffer, length, + index, gspca_dev->usb_buf, len, 500); - PDEBUG(D_USBI, "reg read [%02x] -> %02x ..", index, *buffer); + PDEBUG(D_USBI, "reg read [%02x] -> %02x ..", + index, gspca_dev->usb_buf[0]); +} + +/* the bytes to write are in gspca_dev->usb_buf */ +static void reg_w_val(struct gspca_dev *gspca_dev, + __u16 index, + __u8 val) +{ + struct usb_device *dev = gspca_dev->dev; + + gspca_dev->usb_buf[0] = val; + usb_control_msg(dev, + usb_sndctrlpipe(dev, 0), + 0, + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + 0, + index, gspca_dev->usb_buf, 1, 500); } -static void reg_w(struct usb_device *dev, +static void reg_w(struct gspca_dev *gspca_dev, __u16 index, - const __u8 *buffer, __u16 len) + const __u8 *buffer, + __u16 len) { - __u8 tmpbuf[8]; + struct usb_device *dev = gspca_dev->dev; #ifdef CONFIG_VIDEO_ADV_DEBUG - if (len > sizeof tmpbuf) { - PDEBUG(D_ERR|D_PACK, "reg_w: buffer overflow"); + if (len > sizeof gspca_dev->usb_buf) { + err("reg_w: buffer overflow"); return; } PDEBUG(D_USBO, "reg write [%02x] = %02x..", index, *buffer); #endif - memcpy(tmpbuf, buffer, len); + memcpy(gspca_dev->usb_buf, buffer, len); usb_control_msg(dev, usb_sndctrlpipe(dev, 0), 0, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0, - index, tmpbuf, len, 500); + index, gspca_dev->usb_buf, len, 500); } static const __u8 cx_sensor_init[][4] = { @@ -232,17 +259,14 @@ static const __u8 cx11646_fw1[][3] = { }; static void cx11646_fw(struct gspca_dev*gspca_dev) { - __u8 val; int i = 0; - val = 0x02; - reg_w(gspca_dev->dev, 0x006a, &val, 1); + reg_w_val(gspca_dev, 0x006a, 0x02); while (cx11646_fw1[i][1]) { - reg_w(gspca_dev->dev, 0x006b, cx11646_fw1[i], 3); + reg_w(gspca_dev, 0x006b, cx11646_fw1[i], 3); i++; } - val = 0x00; - reg_w(gspca_dev->dev, 0x006a, &val, 1); + reg_w_val(gspca_dev, 0x006a, 0x00); } static const __u8 cxsensor[] = { @@ -273,52 +297,47 @@ static const __u8 reg7b[] = { 0x00, 0xff, 0x00, 0xff, 0x00, 0xff }; static void cx_sensor(struct gspca_dev*gspca_dev) { - __u8 val; int i = 0; - __u8 bufread[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; int length; const __u8 *ptsensor = cxsensor; - reg_w(gspca_dev->dev, 0x0020, reg20, 8); - reg_w(gspca_dev->dev, 0x0028, reg28, 8); - reg_w(gspca_dev->dev, 0x0010, reg10, 8); - val = 0x03; - reg_w(gspca_dev->dev, 0x0092, &val, 1); + reg_w(gspca_dev, 0x0020, reg20, 8); + reg_w(gspca_dev, 0x0028, reg28, 8); + reg_w(gspca_dev, 0x0010, reg10, 8); + reg_w_val(gspca_dev, 0x0092, 0x03); switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) { case 0: - reg_w(gspca_dev->dev, 0x0071, reg71a, 4); + reg_w(gspca_dev, 0x0071, reg71a, 4); break; case 1: - reg_w(gspca_dev->dev, 0x0071, reg71b, 4); + reg_w(gspca_dev, 0x0071, reg71b, 4); break; default: /* case 2: */ - reg_w(gspca_dev->dev, 0x0071, reg71c, 4); + reg_w(gspca_dev, 0x0071, reg71c, 4); break; case 3: - reg_w(gspca_dev->dev, 0x0071, reg71d, 4); + reg_w(gspca_dev, 0x0071, reg71d, 4); break; } - reg_w(gspca_dev->dev, 0x007b, reg7b, 6); - val = 0x00; - reg_w(gspca_dev->dev, 0x00f8, &val, 1); - reg_w(gspca_dev->dev, 0x0010, reg10, 8); - val = 0x41; - reg_w(gspca_dev->dev, 0x0098, &val, 1); + reg_w(gspca_dev, 0x007b, reg7b, 6); + reg_w_val(gspca_dev, 0x00f8, 0x00); + reg_w(gspca_dev, 0x0010, reg10, 8); + reg_w_val(gspca_dev, 0x0098, 0x41); for (i = 0; i < 11; i++) { if (i == 3 || i == 5 || i == 8) length = 8; else length = 4; - reg_w(gspca_dev->dev, 0x00e5, ptsensor, length); + reg_w(gspca_dev, 0x00e5, ptsensor, length); if (length == 4) - reg_r(gspca_dev->dev, 0x00e8, &val, 1); + reg_r(gspca_dev, 0x00e8, 1); else - reg_r(gspca_dev->dev, 0x00e8, bufread, length); + reg_r(gspca_dev, 0x00e8, length); ptsensor += length; } - reg_r(gspca_dev->dev, 0x00e7, bufread, 8); + reg_r(gspca_dev, 0x00e7, 8); } static const __u8 cx_inits_176[] = { @@ -358,10 +377,9 @@ static const __u8 cx_inits_640[] = { 0x77, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static int cx11646_initsize(struct gspca_dev *gspca_dev) +static void cx11646_initsize(struct gspca_dev *gspca_dev) { const __u8 *cxinit; - __u8 val; static const __u8 reg12[] = { 0x08, 0x05, 0x07, 0x04, 0x24 }; static const __u8 reg17[] = { 0x0a, 0x00, 0xf2, 0x01, 0x0f, 0x00, 0x97, 0x02 }; @@ -381,35 +399,29 @@ static int cx11646_initsize(struct gspca_dev *gspca_dev) cxinit = cx_inits_176; break; } - val = 0x01; - reg_w(gspca_dev->dev, 0x009a, &val, 1); - val = 0x10; - reg_w(gspca_dev->dev, 0x0010, &val, 1); - reg_w(gspca_dev->dev, 0x0012, reg12, 5); - reg_w(gspca_dev->dev, 0x0017, reg17, 8); - val = 0x00; - reg_w(gspca_dev->dev, 0x00c0, &val, 1); - val = 0x04; - reg_w(gspca_dev->dev, 0x00c1, &val, 1); - val = 0x04; - reg_w(gspca_dev->dev, 0x00c2, &val, 1); - - reg_w(gspca_dev->dev, 0x0061, cxinit, 8); + reg_w_val(gspca_dev, 0x009a, 0x01); + reg_w_val(gspca_dev, 0x0010, 0x10); + reg_w(gspca_dev, 0x0012, reg12, 5); + reg_w(gspca_dev, 0x0017, reg17, 8); + reg_w_val(gspca_dev, 0x00c0, 0x00); + reg_w_val(gspca_dev, 0x00c1, 0x04); + reg_w_val(gspca_dev, 0x00c2, 0x04); + + reg_w(gspca_dev, 0x0061, cxinit, 8); cxinit += 8; - reg_w(gspca_dev->dev, 0x00ca, cxinit, 8); + reg_w(gspca_dev, 0x00ca, cxinit, 8); cxinit += 8; - reg_w(gspca_dev->dev, 0x00d2, cxinit, 8); + reg_w(gspca_dev, 0x00d2, cxinit, 8); cxinit += 8; - reg_w(gspca_dev->dev, 0x00da, cxinit, 6); + reg_w(gspca_dev, 0x00da, cxinit, 6); cxinit += 8; - reg_w(gspca_dev->dev, 0x0041, cxinit, 8); + reg_w(gspca_dev, 0x0041, cxinit, 8); cxinit += 8; - reg_w(gspca_dev->dev, 0x0049, cxinit, 8); + reg_w(gspca_dev, 0x0049, cxinit, 8); cxinit += 8; - reg_w(gspca_dev->dev, 0x0051, cxinit, 2); + reg_w(gspca_dev, 0x0051, cxinit, 2); - reg_r(gspca_dev->dev, 0x0010, &val, 1); - return val; + reg_r(gspca_dev, 0x0010, 1); } static const __u8 cx_jpeg_init[][8] = { @@ -636,26 +648,21 @@ static const __u8 cxjpeg_qtable[][8] = { static void cx11646_jpegInit(struct gspca_dev*gspca_dev) { - __u8 val; int i; int length; - val = 0x01; - reg_w(gspca_dev->dev, 0x00c0, &val, 1); - val = 0x00; - reg_w(gspca_dev->dev, 0x00c3, &val, 1); - val = 0x00; - reg_w(gspca_dev->dev, 0x00c0, &val, 1); - reg_r(gspca_dev->dev, 0x0001, &val, 1); + reg_w_val(gspca_dev, 0x00c0, 0x01); + reg_w_val(gspca_dev, 0x00c3, 0x00); + reg_w_val(gspca_dev, 0x00c0, 0x00); + reg_r(gspca_dev, 0x0001, 1); length = 8; for (i = 0; i < 79; i++) { if (i == 78) length = 6; - reg_w(gspca_dev->dev, 0x0008, cx_jpeg_init[i], length); + reg_w(gspca_dev, 0x0008, cx_jpeg_init[i], length); } - reg_r(gspca_dev->dev, 0x0002, &val, 1); - val = 0x14; - reg_w(gspca_dev->dev, 0x0055, &val, 1); + reg_r(gspca_dev, 0x0002, 1); + reg_w_val(gspca_dev, 0x0055, 0x14); } static const __u8 reg12[] = { 0x0a, 0x05, 0x07, 0x04, 0x19 }; @@ -665,31 +672,26 @@ static const __u8 regE5a[] = { 0x88, 0x0a, 0x0c, 0x01 }; static const __u8 regE5b[] = { 0x88, 0x0b, 0x12, 0x01 }; static const __u8 regE5c[] = { 0x88, 0x05, 0x01, 0x01 }; static const __u8 reg51[] = { 0x77, 0x03 }; -static const __u8 reg70 = 0x03; +#define reg70 0x03 static void cx11646_jpeg(struct gspca_dev*gspca_dev) { - __u8 val; int i; int length; __u8 Reg55; - __u8 bufread[8]; int retry; - val = 0x01; - reg_w(gspca_dev->dev, 0x00c0, &val, 1); - val = 0x00; - reg_w(gspca_dev->dev, 0x00c3, &val, 1); - val = 0x00; - reg_w(gspca_dev->dev, 0x00c0, &val, 1); - reg_r(gspca_dev->dev, 0x0001, &val, 1); + reg_w_val(gspca_dev, 0x00c0, 0x01); + reg_w_val(gspca_dev, 0x00c3, 0x00); + reg_w_val(gspca_dev, 0x00c0, 0x00); + reg_r(gspca_dev, 0x0001, 1); length = 8; switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) { case 0: for (i = 0; i < 27; i++) { if (i == 26) length = 2; - reg_w(gspca_dev->dev, 0x0008, cxjpeg_640[i], length); + reg_w(gspca_dev, 0x0008, cxjpeg_640[i], length); } Reg55 = 0x28; break; @@ -697,7 +699,7 @@ static void cx11646_jpeg(struct gspca_dev*gspca_dev) for (i = 0; i < 27; i++) { if (i == 26) length = 2; - reg_w(gspca_dev->dev, 0x0008, cxjpeg_352[i], length); + reg_w(gspca_dev, 0x0008, cxjpeg_352[i], length); } Reg55 = 0x16; break; @@ -706,7 +708,7 @@ static void cx11646_jpeg(struct gspca_dev*gspca_dev) for (i = 0; i < 27; i++) { if (i == 26) length = 2; - reg_w(gspca_dev->dev, 0x0008, cxjpeg_320[i], length); + reg_w(gspca_dev, 0x0008, cxjpeg_320[i], length); } Reg55 = 0x14; break; @@ -714,124 +716,98 @@ static void cx11646_jpeg(struct gspca_dev*gspca_dev) for (i = 0; i < 27; i++) { if (i == 26) length = 2; - reg_w(gspca_dev->dev, 0x0008, cxjpeg_176[i], length); + reg_w(gspca_dev, 0x0008, cxjpeg_176[i], length); } Reg55 = 0x0B; break; } - reg_r(gspca_dev->dev, 0x0002, &val, 1); - val = Reg55; - reg_w(gspca_dev->dev, 0x0055, &val, 1); - reg_r(gspca_dev->dev, 0x0002, &val, 1); - reg_w(gspca_dev->dev, 0x0010, reg10, 2); - val = 0x02; - reg_w(gspca_dev->dev, 0x0054, &val, 1); - val = 0x01; - reg_w(gspca_dev->dev, 0x0054, &val, 1); - val = 0x94; - reg_w(gspca_dev->dev, 0x0000, &val, 1); - val = 0xc0; - reg_w(gspca_dev->dev, 0x0053, &val, 1); - val = 0xe1; - reg_w(gspca_dev->dev, 0x00fc, &val, 1); - val = 0x00; - reg_w(gspca_dev->dev, 0x0000, &val, 1); + reg_r(gspca_dev, 0x0002, 1); + reg_w_val(gspca_dev, 0x0055, Reg55); + reg_r(gspca_dev, 0x0002, 1); + reg_w(gspca_dev, 0x0010, reg10, 2); + reg_w_val(gspca_dev, 0x0054, 0x02); + reg_w_val(gspca_dev, 0x0054, 0x01); + reg_w_val(gspca_dev, 0x0000, 0x94); + reg_w_val(gspca_dev, 0x0053, 0xc0); + reg_w_val(gspca_dev, 0x00fc, 0xe1); + reg_w_val(gspca_dev, 0x0000, 0x00); /* wait for completion */ retry = 50; while (retry--) { - reg_r(gspca_dev->dev, 0x0002, &val, 1); + reg_r(gspca_dev, 0x0002, 1); /* 0x07 until 0x00 */ - if (val == 0x00) + if (gspca_dev->usb_buf[0] == 0x00) break; - val = 0x00; - reg_w(gspca_dev->dev, 0x0053, &val, 1); + reg_w_val(gspca_dev, 0x0053, 0x00); } if (retry == 0) PDEBUG(D_ERR, "Damned Errors sending jpeg Table"); /* send the qtable now */ - reg_r(gspca_dev->dev, 0x0001, &val, 1); /* -> 0x18 */ + reg_r(gspca_dev, 0x0001, 1); /* -> 0x18 */ length = 8; for (i = 0; i < 18; i++) { if (i == 17) length = 2; - reg_w(gspca_dev->dev, 0x0008, cxjpeg_qtable[i], length); + reg_w(gspca_dev, 0x0008, cxjpeg_qtable[i], length); } - reg_r(gspca_dev->dev, 0x0002, &val, 1); /* 0x00 */ - reg_r(gspca_dev->dev, 0x0053, &val, 1); /* 0x00 */ - val = 0x02; - reg_w(gspca_dev->dev, 0x0054, &val, 1); - val = 0x01; - reg_w(gspca_dev->dev, 0x0054, &val, 1); - val = 0x94; - reg_w(gspca_dev->dev, 0x0000, &val, 1); - val = 0xc0; - reg_w(gspca_dev->dev, 0x0053, &val, 1); - - reg_r(gspca_dev->dev, 0x0038, &val, 1); /* 0x40 */ - reg_r(gspca_dev->dev, 0x0038, &val, 1); /* 0x40 */ - reg_r(gspca_dev->dev, 0x001f, &val, 1); /* 0x38 */ - reg_w(gspca_dev->dev, 0x0012, reg12, 5); - reg_w(gspca_dev->dev, 0x00e5, regE5_8, 8); - reg_r(gspca_dev->dev, 0x00e8, bufread, 8); - reg_w(gspca_dev->dev, 0x00e5, regE5a, 4); - reg_r(gspca_dev->dev, 0x00e8, &val, 1); /* 0x00 */ - val = 0x01; - reg_w(gspca_dev->dev, 0x009a, &val, 1); - reg_w(gspca_dev->dev, 0x00e5, regE5b, 4); - reg_r(gspca_dev->dev, 0x00e8, &val, 1); /* 0x00 */ - reg_w(gspca_dev->dev, 0x00e5, regE5c, 4); - reg_r(gspca_dev->dev, 0x00e8, &val, 1); /* 0x00 */ - - reg_w(gspca_dev->dev, 0x0051, reg51, 2); - reg_w(gspca_dev->dev, 0x0010, reg10, 2); - reg_w(gspca_dev->dev, 0x0070, ®70, 1); + reg_r(gspca_dev, 0x0002, 1); /* 0x00 */ + reg_r(gspca_dev, 0x0053, 1); /* 0x00 */ + reg_w_val(gspca_dev, 0x0054, 0x02); + reg_w_val(gspca_dev, 0x0054, 0x01); + reg_w_val(gspca_dev, 0x0000, 0x94); + reg_w_val(gspca_dev, 0x0053, 0xc0); + + reg_r(gspca_dev, 0x0038, 1); /* 0x40 */ + reg_r(gspca_dev, 0x0038, 1); /* 0x40 */ + reg_r(gspca_dev, 0x001f, 1); /* 0x38 */ + reg_w(gspca_dev, 0x0012, reg12, 5); + reg_w(gspca_dev, 0x00e5, regE5_8, 8); + reg_r(gspca_dev, 0x00e8, 8); + reg_w(gspca_dev, 0x00e5, regE5a, 4); + reg_r(gspca_dev, 0x00e8, 1); /* 0x00 */ + reg_w_val(gspca_dev, 0x009a, 0x01); + reg_w(gspca_dev, 0x00e5, regE5b, 4); + reg_r(gspca_dev, 0x00e8, 1); /* 0x00 */ + reg_w(gspca_dev, 0x00e5, regE5c, 4); + reg_r(gspca_dev, 0x00e8, 1); /* 0x00 */ + + reg_w(gspca_dev, 0x0051, reg51, 2); + reg_w(gspca_dev, 0x0010, reg10, 2); + reg_w_val(gspca_dev, 0x0070, reg70); } static void cx11646_init1(struct gspca_dev *gspca_dev) { - __u8 val; int i = 0; - val = 0; - reg_w(gspca_dev->dev, 0x0010, &val, 1); - reg_w(gspca_dev->dev, 0x0053, &val, 1); - reg_w(gspca_dev->dev, 0x0052, &val, 1); - val = 0x2f; - reg_w(gspca_dev->dev, 0x009b, &val, 1); - val = 0x10; - reg_w(gspca_dev->dev, 0x009c, &val, 1); - reg_r(gspca_dev->dev, 0x0098, &val, 1); - val = 0x40; - reg_w(gspca_dev->dev, 0x0098, &val, 1); - reg_r(gspca_dev->dev, 0x0099, &val, 1); - val = 0x07; - reg_w(gspca_dev->dev, 0x0099, &val, 1); - val = 0x40; - reg_w(gspca_dev->dev, 0x0039, &val, 1); - val = 0xff; - reg_w(gspca_dev->dev, 0x003c, &val, 1); - val = 0x1f; - reg_w(gspca_dev->dev, 0x003f, &val, 1); - val = 0x40; - reg_w(gspca_dev->dev, 0x003d, &val, 1); -/* val= 0x60; */ -/* reg_w(gspca_dev->dev, 0x00, 0x00, 0x003d, &val, 1); */ - reg_r(gspca_dev->dev, 0x0099, &val, 1); /* ->0x07 */ + reg_w_val(gspca_dev, 0x0010, 0x00); + reg_w_val(gspca_dev, 0x0053, 0x00); + reg_w_val(gspca_dev, 0x0052, 0x00); + reg_w_val(gspca_dev, 0x009b, 0x2f); + reg_w_val(gspca_dev, 0x009c, 0x10); + reg_r(gspca_dev, 0x0098, 1); + reg_w_val(gspca_dev, 0x0098, 0x40); + reg_r(gspca_dev, 0x0099, 1); + reg_w_val(gspca_dev, 0x0099, 0x07); + reg_w_val(gspca_dev, 0x0039, 0x40); + reg_w_val(gspca_dev, 0x003c, 0xff); + reg_w_val(gspca_dev, 0x003f, 0x1f); + reg_w_val(gspca_dev, 0x003d, 0x40); +/* reg_w_val(gspca_dev, 0x003d, 0x60); */ + reg_r(gspca_dev, 0x0099, 1); /* ->0x07 */ while (cx_sensor_init[i][0]) { - reg_w(gspca_dev->dev, 0x00e5, cx_sensor_init[i], 1); - reg_r(gspca_dev->dev, 0x00e8, &val, 1); /* -> 0x00 */ + reg_w_val(gspca_dev, 0x00e5, cx_sensor_init[i][0]); + reg_r(gspca_dev, 0x00e8, 1); /* -> 0x00 */ if (i == 1) { - val = 1; - reg_w(gspca_dev->dev, 0x00ed, &val, 1); - reg_r(gspca_dev->dev, 0x00ed, &val, 1); /* -> 0x01 */ + reg_w_val(gspca_dev, 0x00ed, 0x01); + reg_r(gspca_dev, 0x00ed, 1); /* -> 0x01 */ } i++; } - val = 0x00; - reg_w(gspca_dev->dev, 0x00c3, &val, 1); + reg_w_val(gspca_dev, 0x00c3, 0x00); } /* this function is called at probe time */ @@ -880,29 +856,23 @@ static void sd_stopN(struct gspca_dev *gspca_dev) static void sd_stop0(struct gspca_dev *gspca_dev) { int retry = 50; - __u8 val; - val = 0; - reg_w(gspca_dev->dev, 0x0000, &val, 1); - reg_r(gspca_dev->dev, 0x0002, &val, 1); - val = 0; - reg_w(gspca_dev->dev, 0x0053, &val, 1); + reg_w_val(gspca_dev, 0x0000, 0x00); + reg_r(gspca_dev, 0x0002, 1); + reg_w_val(gspca_dev, 0x0053, 0x00); while (retry--) { -/* reg_r(gspca_dev->dev, 0x0002, &val, 1);*/ - reg_r(gspca_dev->dev, 0x0053, &val, 1); - if (val == 0) +/* reg_r(gspca_dev, 0x0002, 1);*/ + reg_r(gspca_dev, 0x0053, 1); + if (gspca_dev->usb_buf[0] == 0) break; } - val = 0; - reg_w(gspca_dev->dev, 0x0000, &val, 1); - reg_r(gspca_dev->dev, 0x0002, &val, 1); - - val = 0; - reg_w(gspca_dev->dev, 0x0010, &val, 1); - reg_r(gspca_dev->dev, 0x0033, &val, 1); - val = 0xe0; - reg_w(gspca_dev->dev, 0x00fc, &val, 1); + reg_w_val(gspca_dev, 0x0000, 0x00); + reg_r(gspca_dev, 0x0002, 1); + + reg_w_val(gspca_dev, 0x0010, 0x00); + reg_r(gspca_dev, 0x0033, 1); + reg_w_val(gspca_dev, 0x00fc, 0xe0); } static void sd_close(struct gspca_dev *gspca_dev) @@ -937,22 +907,20 @@ static void setbrightness(struct gspca_dev*gspca_dev) __u8 reg51c[2]; __u8 bright; __u8 colors; - __u8 val; - __u8 bufread[8]; bright = sd->brightness; regE5cbx[2] = bright; - reg_w(gspca_dev->dev, 0x00e5, regE5cbx, 8); - reg_r(gspca_dev->dev, 0x00e8, bufread, 8); - reg_w(gspca_dev->dev, 0x00e5, regE5c, 4); - reg_r(gspca_dev->dev, 0x00e8, &val, 1); /* 0x00 */ + reg_w(gspca_dev, 0x00e5, regE5cbx, 8); + reg_r(gspca_dev, 0x00e8, 8); + reg_w(gspca_dev, 0x00e5, regE5c, 4); + reg_r(gspca_dev, 0x00e8, 1); /* 0x00 */ colors = sd->colors; reg51c[0] = 0x77; reg51c[1] = colors; - reg_w(gspca_dev->dev, 0x0051, reg51c, 2); - reg_w(gspca_dev->dev, 0x0010, reg10, 2); - reg_w(gspca_dev->dev, 0x0070, ®70, 1); + reg_w(gspca_dev, 0x0051, reg51c, 2); + reg_w(gspca_dev, 0x0010, reg10, 2); + reg_w_val(gspca_dev, 0x0070, reg70); } static void setcontrast(struct gspca_dev*gspca_dev) @@ -961,16 +929,15 @@ static void setcontrast(struct gspca_dev*gspca_dev) __u8 regE5acx[] = { 0x88, 0x0a, 0x0c, 0x01 }; /* seem MSB */ /* __u8 regE5bcx[] = { 0x88, 0x0b, 0x12, 0x01}; * LSB */ __u8 reg51c[2]; - __u8 val; regE5acx[2] = sd->contrast; - reg_w(gspca_dev->dev, 0x00e5, regE5acx, 4); - reg_r(gspca_dev->dev, 0x00e8, &val, 1); /* 0x00 */ + reg_w(gspca_dev, 0x00e5, regE5acx, 4); + reg_r(gspca_dev, 0x00e8, 1); /* 0x00 */ reg51c[0] = 0x77; reg51c[1] = sd->colors; - reg_w(gspca_dev->dev, 0x0051, reg51c, 2); - reg_w(gspca_dev->dev, 0x0010, reg10, 2); - reg_w(gspca_dev->dev, 0x0070, ®70, 1); + reg_w(gspca_dev, 0x0051, reg51c, 2); + reg_w(gspca_dev, 0x0010, reg10, 2); + reg_w_val(gspca_dev, 0x0070, reg70); } static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val) diff --git a/linux/drivers/media/video/gspca/etoms.c b/linux/drivers/media/video/gspca/etoms.c index 25d59ae1f..531449eaf 100644 --- a/linux/drivers/media/video/gspca/etoms.c +++ b/linux/drivers/media/video/gspca/etoms.c @@ -22,8 +22,8 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) -static const char version[] = "2.1.5"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7) +static const char version[] = "2.1.7"; MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_DESCRIPTION("Etoms USB Camera Driver"); @@ -229,201 +229,215 @@ static const __u8 I2c3[] = { 0x12, 0x05 }; static const __u8 I2c4[] = { 0x41, 0x08 }; -static void reg_r(struct usb_device *dev, - __u16 index, __u8 *buffer, int len) +/* read 'len' bytes to gspca_dev->usb_buf */ +static void reg_r(struct gspca_dev *gspca_dev, + __u16 index, + __u16 len) { + struct usb_device *dev = gspca_dev->dev; + +#ifdef CONFIG_VIDEO_ADV_DEBUG + if (len > sizeof gspca_dev->usb_buf) { + err("reg_r: buffer overflow"); + return; + } +#endif usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), 0, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, - 0, index, buffer, len, 500); + 0, + index, gspca_dev->usb_buf, len, 500); + PDEBUG(D_USBI, "reg read [%02x] -> %02x ..", + index, gspca_dev->usb_buf[0]); } -static void reg_w_val(struct usb_device *dev, - __u16 index, __u8 val) +static void reg_w_val(struct gspca_dev *gspca_dev, + __u16 index, + __u8 val) { - __u8 data; + struct usb_device *dev = gspca_dev->dev; - data = val; + gspca_dev->usb_buf[0] = val; usb_control_msg(dev, usb_sndctrlpipe(dev, 0), 0, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, - 0, index, &data, 1, 500); + 0, + index, gspca_dev->usb_buf, 1, 500); } -static void reg_w(struct usb_device *dev, - __u16 index, const __u8 *buffer, __u16 len) +static void reg_w(struct gspca_dev *gspca_dev, + __u16 index, + const __u8 *buffer, + __u16 len) { - __u8 tmpbuf[8]; + struct usb_device *dev = gspca_dev->dev; - memcpy(tmpbuf, buffer, len); +#ifdef CONFIG_VIDEO_ADV_DEBUG + if (len > sizeof gspca_dev->usb_buf) { + err("reg_w: buffer overflow"); + return; + } + PDEBUG(D_USBO, "reg write [%02x] = %02x..", index, *buffer); +#endif + memcpy(gspca_dev->usb_buf, buffer, len); usb_control_msg(dev, usb_sndctrlpipe(dev, 0), 0, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, - 0, index, tmpbuf, len, 500); + 0, index, gspca_dev->usb_buf, len, 500); } -static int Et_i2cwrite(struct usb_device *dev, __u8 reg, - const __u8 *buffer, - __u16 len, __u8 mode) +static int i2c_w(struct gspca_dev *gspca_dev, + __u8 reg, + const __u8 *buffer, + __u16 len, __u8 mode) { /* buffer should be [D0..D7] */ __u8 ptchcount; /* set the base address */ - reg_w_val(dev, ET_I2C_BASE, 0x40); /* sensor base for the pas106 */ + reg_w_val(gspca_dev, ET_I2C_BASE, 0x40); + /* sensor base for the pas106 */ /* set count and prefetch */ ptchcount = ((len & 0x07) << 4) | (mode & 0x03); - reg_w_val(dev, ET_I2C_COUNT, ptchcount); + reg_w_val(gspca_dev, ET_I2C_COUNT, ptchcount); /* set the register base */ - reg_w_val(dev, ET_I2C_REG, reg); + reg_w_val(gspca_dev, ET_I2C_REG, reg); while (--len >= 0) - reg_w_val(dev, ET_I2C_DATA0 + len, buffer[len]); + reg_w_val(gspca_dev, ET_I2C_DATA0 + len, buffer[len]); return 0; } -static int Et_i2cread(struct usb_device *dev, __u8 reg, - __u8 *buffer, - __u16 length, __u8 mode) +static int i2c_r(struct gspca_dev *gspca_dev, + __u8 reg) { - /* buffer should be [D0..D7] */ - int i, j; - __u8 ptchcount; - /* set the base address */ - reg_w_val(dev, ET_I2C_BASE, 0x40); /* sensor base for the pas106 */ - /* set count and prefetch */ - ptchcount = ((length & 0x07) << 4) | (mode & 0x03); - reg_w_val(dev, ET_I2C_COUNT, ptchcount); - /* set the register base */ - reg_w_val(dev, ET_I2C_REG, reg); - reg_w_val(dev, ET_I2C_PREFETCH, 0x02); /* prefetch */ - reg_w_val(dev, ET_I2C_PREFETCH, 0); - j = length - 1; - for (i = 0; i < length; i++) { - reg_r(dev, (ET_I2C_DATA0 + j), &buffer[j], 1); - j--; - } + reg_w_val(gspca_dev, ET_I2C_BASE, 0x40); + /* sensor base for the pas106 */ + /* set count and prefetch (cnd: 4 bits - mode: 4 bits) */ + reg_w_val(gspca_dev, ET_I2C_COUNT, 0x11); + reg_w_val(gspca_dev, ET_I2C_REG, reg); /* set the register base */ + reg_w_val(gspca_dev, ET_I2C_PREFETCH, 0x02); /* prefetch */ + reg_w_val(gspca_dev, ET_I2C_PREFETCH, 0x00); + reg_r(gspca_dev, ET_I2C_DATA0, 1); /* read one byte */ return 0; } -static int Et_WaitStatus(struct usb_device *dev) +static int Et_WaitStatus(struct gspca_dev *gspca_dev) { - __u8 bytereceived; int retry = 10; while (retry--) { - reg_r(dev, ET_ClCK, &bytereceived, 1); - if (bytereceived != 0) + reg_r(gspca_dev, ET_ClCK, 1); + if (gspca_dev->usb_buf[0] != 0) return 1; } return 0; } -static int et_video(struct usb_device *dev, int on) +static int et_video(struct gspca_dev *gspca_dev, + int on) { - int err; + int ret; - reg_w_val(dev, ET_GPIO_OUT, on - ? 0x10 /* startvideo - set Bit5 */ - : 0); /* stopvideo */ - err = Et_WaitStatus(dev); - if (!err) + reg_w_val(gspca_dev, ET_GPIO_OUT, + on ? 0x10 /* startvideo - set Bit5 */ + : 0); /* stopvideo */ + ret = Et_WaitStatus(gspca_dev); + if (ret != 0) PDEBUG(D_ERR, "timeout video on/off"); - return err; + return ret; } static void Et_init2(struct gspca_dev *gspca_dev) { - struct usb_device *dev = gspca_dev->dev; __u8 value; - __u8 received; static const __u8 FormLine[] = { 0x84, 0x03, 0x14, 0xf4, 0x01, 0x05 }; PDEBUG(D_STREAM, "Open Init2 ET"); - reg_w_val(dev, ET_GPIO_DIR_CTRL, 0x2f); - reg_w_val(dev, ET_GPIO_OUT, 0x10); - reg_r(dev, ET_GPIO_IN, &received, 1); - reg_w_val(dev, ET_ClCK, 0x14); /* 0x14 // 0x16 enabled pattern */ - reg_w_val(dev, ET_CTRL, 0x1b); + reg_w_val(gspca_dev, ET_GPIO_DIR_CTRL, 0x2f); + reg_w_val(gspca_dev, ET_GPIO_OUT, 0x10); + reg_r(gspca_dev, ET_GPIO_IN, 1); + reg_w_val(gspca_dev, ET_ClCK, 0x14); /* 0x14 // 0x16 enabled pattern */ + reg_w_val(gspca_dev, ET_CTRL, 0x1b); /* compression et subsampling */ if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) value = ET_COMP_VAL1; /* 320 */ else value = ET_COMP_VAL0; /* 640 */ - reg_w_val(dev, ET_COMP, value); - reg_w_val(dev, ET_MAXQt, 0x1f); - reg_w_val(dev, ET_MINQt, 0x04); + reg_w_val(gspca_dev, ET_COMP, value); + reg_w_val(gspca_dev, ET_MAXQt, 0x1f); + reg_w_val(gspca_dev, ET_MINQt, 0x04); /* undocumented registers */ - reg_w_val(dev, ET_REG1d, 0xff); - reg_w_val(dev, ET_REG1e, 0xff); - reg_w_val(dev, ET_REG1f, 0xff); - reg_w_val(dev, ET_REG20, 0x35); - reg_w_val(dev, ET_REG21, 0x01); - reg_w_val(dev, ET_REG22, 0x00); - reg_w_val(dev, ET_REG23, 0xff); - reg_w_val(dev, ET_REG24, 0xff); - reg_w_val(dev, ET_REG25, 0x0f); + reg_w_val(gspca_dev, ET_REG1d, 0xff); + reg_w_val(gspca_dev, ET_REG1e, 0xff); + reg_w_val(gspca_dev, ET_REG1f, 0xff); + reg_w_val(gspca_dev, ET_REG20, 0x35); + reg_w_val(gspca_dev, ET_REG21, 0x01); + reg_w_val(gspca_dev, ET_REG22, 0x00); + reg_w_val(gspca_dev, ET_REG23, 0xff); + reg_w_val(gspca_dev, ET_REG24, 0xff); + reg_w_val(gspca_dev, ET_REG25, 0x0f); /* colors setting */ - reg_w_val(dev, 0x30, 0x11); /* 0x30 */ - reg_w_val(dev, 0x31, 0x40); - reg_w_val(dev, 0x32, 0x00); - reg_w_val(dev, ET_O_RED, 0x00); /* 0x34 */ - reg_w_val(dev, ET_O_GREEN1, 0x00); - reg_w_val(dev, ET_O_BLUE, 0x00); - reg_w_val(dev, ET_O_GREEN2, 0x00); + reg_w_val(gspca_dev, 0x30, 0x11); /* 0x30 */ + reg_w_val(gspca_dev, 0x31, 0x40); + reg_w_val(gspca_dev, 0x32, 0x00); + reg_w_val(gspca_dev, ET_O_RED, 0x00); /* 0x34 */ + reg_w_val(gspca_dev, ET_O_GREEN1, 0x00); + reg_w_val(gspca_dev, ET_O_BLUE, 0x00); + reg_w_val(gspca_dev, ET_O_GREEN2, 0x00); /*************/ - reg_w_val(dev, ET_G_RED, 0x80); /* 0x4d */ - reg_w_val(dev, ET_G_GREEN1, 0x80); - reg_w_val(dev, ET_G_BLUE, 0x80); - reg_w_val(dev, ET_G_GREEN2, 0x80); - reg_w_val(dev, ET_G_GR_H, 0x00); - reg_w_val(dev, ET_G_GB_H, 0x00); /* 0x52 */ + reg_w_val(gspca_dev, ET_G_RED, 0x80); /* 0x4d */ + reg_w_val(gspca_dev, ET_G_GREEN1, 0x80); + reg_w_val(gspca_dev, ET_G_BLUE, 0x80); + reg_w_val(gspca_dev, ET_G_GREEN2, 0x80); + reg_w_val(gspca_dev, ET_G_GR_H, 0x00); + reg_w_val(gspca_dev, ET_G_GB_H, 0x00); /* 0x52 */ /* Window control registers */ - reg_w_val(dev, 0x61, 0x80); /* use cmc_out */ - reg_w_val(dev, 0x62, 0x02); - reg_w_val(dev, 0x63, 0x03); - reg_w_val(dev, 0x64, 0x14); - reg_w_val(dev, 0x65, 0x0e); - reg_w_val(dev, 0x66, 0x02); - reg_w_val(dev, 0x67, 0x02); + reg_w_val(gspca_dev, 0x61, 0x80); /* use cmc_out */ + reg_w_val(gspca_dev, 0x62, 0x02); + reg_w_val(gspca_dev, 0x63, 0x03); + reg_w_val(gspca_dev, 0x64, 0x14); + reg_w_val(gspca_dev, 0x65, 0x0e); + reg_w_val(gspca_dev, 0x66, 0x02); + reg_w_val(gspca_dev, 0x67, 0x02); /**************************************/ - reg_w_val(dev, ET_SYNCHRO, 0x8f); /* 0x68 */ - reg_w_val(dev, ET_STARTX, 0x69); /* 0x6a //0x69 */ - reg_w_val(dev, ET_STARTY, 0x0d); /* 0x0d //0x0c */ - reg_w_val(dev, ET_WIDTH_LOW, 0x80); - reg_w_val(dev, ET_HEIGTH_LOW, 0xe0); - reg_w_val(dev, ET_W_H_HEIGTH, 0x60); /* 6d */ - reg_w_val(dev, ET_REG6e, 0x86); - reg_w_val(dev, ET_REG6f, 0x01); - reg_w_val(dev, ET_REG70, 0x26); - reg_w_val(dev, ET_REG71, 0x7a); - reg_w_val(dev, ET_REG72, 0x01); + reg_w_val(gspca_dev, ET_SYNCHRO, 0x8f); /* 0x68 */ + reg_w_val(gspca_dev, ET_STARTX, 0x69); /* 0x6a //0x69 */ + reg_w_val(gspca_dev, ET_STARTY, 0x0d); /* 0x0d //0x0c */ + reg_w_val(gspca_dev, ET_WIDTH_LOW, 0x80); + reg_w_val(gspca_dev, ET_HEIGTH_LOW, 0xe0); + reg_w_val(gspca_dev, ET_W_H_HEIGTH, 0x60); /* 6d */ + reg_w_val(gspca_dev, ET_REG6e, 0x86); + reg_w_val(gspca_dev, ET_REG6f, 0x01); + reg_w_val(gspca_dev, ET_REG70, 0x26); + reg_w_val(gspca_dev, ET_REG71, 0x7a); + reg_w_val(gspca_dev, ET_REG72, 0x01); /* Clock Pattern registers ***************** */ - reg_w_val(dev, ET_REG73, 0x00); - reg_w_val(dev, ET_REG74, 0x18); /* 0x28 */ - reg_w_val(dev, ET_REG75, 0x0f); /* 0x01 */ + reg_w_val(gspca_dev, ET_REG73, 0x00); + reg_w_val(gspca_dev, ET_REG74, 0x18); /* 0x28 */ + reg_w_val(gspca_dev, ET_REG75, 0x0f); /* 0x01 */ /**********************************************/ - reg_w_val(dev, 0x8a, 0x20); - reg_w_val(dev, 0x8d, 0x0f); - reg_w_val(dev, 0x8e, 0x08); + reg_w_val(gspca_dev, 0x8a, 0x20); + reg_w_val(gspca_dev, 0x8d, 0x0f); + reg_w_val(gspca_dev, 0x8e, 0x08); /**************************************/ - reg_w_val(dev, 0x03, 0x08); - reg_w_val(dev, ET_PXL_CLK, 0x03); - reg_w_val(dev, 0x81, 0xff); - reg_w_val(dev, 0x80, 0x00); - reg_w_val(dev, 0x81, 0xff); - reg_w_val(dev, 0x80, 0x20); - reg_w_val(dev, 0x03, 0x01); - reg_w_val(dev, 0x03, 0x00); - reg_w_val(dev, 0x03, 0x08); + reg_w_val(gspca_dev, 0x03, 0x08); + reg_w_val(gspca_dev, ET_PXL_CLK, 0x03); + reg_w_val(gspca_dev, 0x81, 0xff); + reg_w_val(gspca_dev, 0x80, 0x00); + reg_w_val(gspca_dev, 0x81, 0xff); + reg_w_val(gspca_dev, 0x80, 0x20); + reg_w_val(gspca_dev, 0x03, 0x01); + reg_w_val(gspca_dev, 0x03, 0x00); + reg_w_val(gspca_dev, 0x03, 0x08); /********************************************/ -/* reg_r(dev, ET_I2C_BASE, &received, 1); +/* reg_r(gspca_dev, ET_I2C_BASE, 1); always 0x40 as the pas106 ??? */ /* set the sensor */ if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) @@ -435,25 +449,24 @@ static void Et_init2(struct gspca_dev *gspca_dev) * 0x0b -> 24/(11+1) = 2 Mhz * 0x17 -> 24/(23+1) = 1 Mhz */ - reg_w_val(dev, ET_PXL_CLK, value); + reg_w_val(gspca_dev, ET_PXL_CLK, value); /* now set by fifo the FormatLine setting */ - reg_w(dev, 0x62, FormLine, 6); + reg_w(gspca_dev, 0x62, FormLine, 6); /* set exposure times [ 0..0x78] 0->longvalue 0x78->shortvalue */ - reg_w_val(dev, 0x81, 0x47); /* 0x47; */ - reg_w_val(dev, 0x80, 0x40); /* 0x40; */ + reg_w_val(gspca_dev, 0x81, 0x47); /* 0x47; */ + reg_w_val(gspca_dev, 0x80, 0x40); /* 0x40; */ /* Pedro change */ /* Brightness change Brith+ decrease value */ /* Brigth- increase value */ /* original value = 0x70; */ - reg_w_val(dev, 0x81, 0x30); /* 0x20; - set brightness */ - reg_w_val(dev, 0x80, 0x20); /* 0x20; */ + reg_w_val(gspca_dev, 0x81, 0x30); /* 0x20; - set brightness */ + reg_w_val(gspca_dev, 0x80, 0x20); /* 0x20; */ } static void setcolors(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - struct usb_device *dev = gspca_dev->dev; __u8 I2cc[] = { 0x05, 0x02, 0x02, 0x05, 0x0d }; __u8 i2cflags = 0x01; /* __u8 green = 0; */ @@ -464,8 +477,8 @@ static void setcolors(struct gspca_dev *gspca_dev) /* green = 15 - ((((7*I2cc[0]) >> 2 ) + I2cc[3]) >> 1); */ /* I2cc[1] = I2cc[2] = green; */ if (sd->sensor == SENSOR_PAS106) { - Et_i2cwrite(dev, PAS106_REG13, &i2cflags, 1, 3); - Et_i2cwrite(dev, PAS106_REG9, I2cc, sizeof I2cc, 1); + i2c_w(gspca_dev, PAS106_REG13, &i2cflags, 1, 3); + i2c_w(gspca_dev, PAS106_REG9, I2cc, sizeof I2cc, 1); } /* PDEBUG(D_CONF , "Etoms red %d blue %d green %d", I2cc[3], I2cc[0], green); */ @@ -474,21 +487,17 @@ static void setcolors(struct gspca_dev *gspca_dev) static void getcolors(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; -/* __u8 valblue; */ - __u8 valred; if (sd->sensor == SENSOR_PAS106) { -/* Et_i2cread(gspca_dev->dev, PAS106_REG9, &valblue, 1, 1); */ - Et_i2cread(gspca_dev->dev, PAS106_REG9 + 3, &valred, 1, 1); - sd->colors = valred & 0x0f; +/* i2c_r(gspca_dev, PAS106_REG9); * blue */ + i2c_r(gspca_dev, PAS106_REG9 + 3); /* red */ + sd->colors = gspca_dev->usb_buf[0] & 0x0f; } } static void Et_init1(struct gspca_dev *gspca_dev) { - struct usb_device *dev = gspca_dev->dev; __u8 value; - __u8 received; /* __u8 I2c0 [] = {0x0a, 0x12, 0x05, 0x22, 0xac, 0x00, 0x01, 0x00}; */ __u8 I2c0[] = { 0x0a, 0x12, 0x05, 0x6d, 0xcd, 0x00, 0x01, 0x00 }; /* try 1/120 0x6d 0xcd 0x40 */ @@ -496,12 +505,12 @@ static void Et_init1(struct gspca_dev *gspca_dev) * 1/60000 hmm ?? */ PDEBUG(D_STREAM, "Open Init1 ET"); - reg_w_val(dev, ET_GPIO_DIR_CTRL, 7); - reg_r(dev, ET_GPIO_IN, &received, 1); - reg_w_val(dev, ET_RESET_ALL, 1); - reg_w_val(dev, ET_RESET_ALL, 0); - reg_w_val(dev, ET_ClCK, 0x10); - reg_w_val(dev, ET_CTRL, 0x19); + reg_w_val(gspca_dev, ET_GPIO_DIR_CTRL, 7); + reg_r(gspca_dev, ET_GPIO_IN, 1); + reg_w_val(gspca_dev, ET_RESET_ALL, 1); + reg_w_val(gspca_dev, ET_RESET_ALL, 0); + reg_w_val(gspca_dev, ET_ClCK, 0x10); + reg_w_val(gspca_dev, ET_CTRL, 0x19); /* compression et subsampling */ if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) value = ET_COMP_VAL1; @@ -510,80 +519,79 @@ static void Et_init1(struct gspca_dev *gspca_dev) PDEBUG(D_STREAM, "Open mode %d Compression %d", gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv, value); - reg_w_val(dev, ET_COMP, value); - reg_w_val(dev, ET_MAXQt, 0x1d); - reg_w_val(dev, ET_MINQt, 0x02); + reg_w_val(gspca_dev, ET_COMP, value); + reg_w_val(gspca_dev, ET_MAXQt, 0x1d); + reg_w_val(gspca_dev, ET_MINQt, 0x02); /* undocumented registers */ - reg_w_val(dev, ET_REG1d, 0xff); - reg_w_val(dev, ET_REG1e, 0xff); - reg_w_val(dev, ET_REG1f, 0xff); - reg_w_val(dev, ET_REG20, 0x35); - reg_w_val(dev, ET_REG21, 0x01); - reg_w_val(dev, ET_REG22, 0x00); - reg_w_val(dev, ET_REG23, 0xf7); - reg_w_val(dev, ET_REG24, 0xff); - reg_w_val(dev, ET_REG25, 0x07); + reg_w_val(gspca_dev, ET_REG1d, 0xff); + reg_w_val(gspca_dev, ET_REG1e, 0xff); + reg_w_val(gspca_dev, ET_REG1f, 0xff); + reg_w_val(gspca_dev, ET_REG20, 0x35); + reg_w_val(gspca_dev, ET_REG21, 0x01); + reg_w_val(gspca_dev, ET_REG22, 0x00); + reg_w_val(gspca_dev, ET_REG23, 0xf7); + reg_w_val(gspca_dev, ET_REG24, 0xff); + reg_w_val(gspca_dev, ET_REG25, 0x07); /* colors setting */ - reg_w_val(dev, ET_G_RED, 0x80); - reg_w_val(dev, ET_G_GREEN1, 0x80); - reg_w_val(dev, ET_G_BLUE, 0x80); - reg_w_val(dev, ET_G_GREEN2, 0x80); - reg_w_val(dev, ET_G_GR_H, 0x00); - reg_w_val(dev, ET_G_GB_H, 0x00); + reg_w_val(gspca_dev, ET_G_RED, 0x80); + reg_w_val(gspca_dev, ET_G_GREEN1, 0x80); + reg_w_val(gspca_dev, ET_G_BLUE, 0x80); + reg_w_val(gspca_dev, ET_G_GREEN2, 0x80); + reg_w_val(gspca_dev, ET_G_GR_H, 0x00); + reg_w_val(gspca_dev, ET_G_GB_H, 0x00); /* Window control registers */ - reg_w_val(dev, ET_SYNCHRO, 0xf0); - reg_w_val(dev, ET_STARTX, 0x56); /* 0x56 */ - reg_w_val(dev, ET_STARTY, 0x05); /* 0x04 */ - reg_w_val(dev, ET_WIDTH_LOW, 0x60); - reg_w_val(dev, ET_HEIGTH_LOW, 0x20); - reg_w_val(dev, ET_W_H_HEIGTH, 0x50); - reg_w_val(dev, ET_REG6e, 0x86); - reg_w_val(dev, ET_REG6f, 0x01); - reg_w_val(dev, ET_REG70, 0x86); - reg_w_val(dev, ET_REG71, 0x14); - reg_w_val(dev, ET_REG72, 0x00); + reg_w_val(gspca_dev, ET_SYNCHRO, 0xf0); + reg_w_val(gspca_dev, ET_STARTX, 0x56); /* 0x56 */ + reg_w_val(gspca_dev, ET_STARTY, 0x05); /* 0x04 */ + reg_w_val(gspca_dev, ET_WIDTH_LOW, 0x60); + reg_w_val(gspca_dev, ET_HEIGTH_LOW, 0x20); + reg_w_val(gspca_dev, ET_W_H_HEIGTH, 0x50); + reg_w_val(gspca_dev, ET_REG6e, 0x86); + reg_w_val(gspca_dev, ET_REG6f, 0x01); + reg_w_val(gspca_dev, ET_REG70, 0x86); + reg_w_val(gspca_dev, ET_REG71, 0x14); + reg_w_val(gspca_dev, ET_REG72, 0x00); /* Clock Pattern registers */ - reg_w_val(dev, ET_REG73, 0x00); - reg_w_val(dev, ET_REG74, 0x00); - reg_w_val(dev, ET_REG75, 0x0a); - reg_w_val(dev, ET_I2C_CLK, 0x04); - reg_w_val(dev, ET_PXL_CLK, 0x01); + reg_w_val(gspca_dev, ET_REG73, 0x00); + reg_w_val(gspca_dev, ET_REG74, 0x00); + reg_w_val(gspca_dev, ET_REG75, 0x0a); + reg_w_val(gspca_dev, ET_I2C_CLK, 0x04); + reg_w_val(gspca_dev, ET_PXL_CLK, 0x01); /* set the sensor */ if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) { I2c0[0] = 0x06; - Et_i2cwrite(dev, PAS106_REG2, I2c0, sizeof I2c0, 1); - Et_i2cwrite(dev, PAS106_REG9, I2c2, sizeof I2c2, 1); + i2c_w(gspca_dev, PAS106_REG2, I2c0, sizeof I2c0, 1); + i2c_w(gspca_dev, PAS106_REG9, I2c2, sizeof I2c2, 1); value = 0x06; - Et_i2cwrite(dev, PAS106_REG2, &value, 1, 1); - Et_i2cwrite(dev, PAS106_REG3, I2c3, sizeof I2c3, 1); + i2c_w(gspca_dev, PAS106_REG2, &value, 1, 1); + i2c_w(gspca_dev, PAS106_REG3, I2c3, sizeof I2c3, 1); /* value = 0x1f; */ value = 0x04; - Et_i2cwrite(dev, PAS106_REG0e, &value, 1, 1); + i2c_w(gspca_dev, PAS106_REG0e, &value, 1, 1); } else { I2c0[0] = 0x0a; - Et_i2cwrite(dev, PAS106_REG2, I2c0, sizeof I2c0, 1); - Et_i2cwrite(dev, PAS106_REG9, I2c2, sizeof I2c2, 1); + i2c_w(gspca_dev, PAS106_REG2, I2c0, sizeof I2c0, 1); + i2c_w(gspca_dev, PAS106_REG9, I2c2, sizeof I2c2, 1); value = 0x0a; - - Et_i2cwrite(dev, PAS106_REG2, &value, 1, 1); - Et_i2cwrite(dev, PAS106_REG3, I2c3, sizeof I2c3, 1); + i2c_w(gspca_dev, PAS106_REG2, &value, 1, 1); + i2c_w(gspca_dev, PAS106_REG3, I2c3, sizeof I2c3, 1); value = 0x04; /* value = 0x10; */ - Et_i2cwrite(dev, PAS106_REG0e, &value, 1, 1); + i2c_w(gspca_dev, PAS106_REG0e, &value, 1, 1); /* bit 2 enable bit 1:2 select 0 1 2 3 value = 0x07; * curve 0 * - Et_i2cwrite(dev,PAS106_REG0f,&value,1,1); + i2c_w(gspca_dev, PAS106_REG0f, &value, 1, 1); */ } /* value = 0x01; */ /* value = 0x22; */ -/* Et_i2cwrite(dev, PAS106_REG5, &value, 1, 1); */ +/* i2c_w(gspca_dev, PAS106_REG5, &value, 1, 1); */ /* magnetude and sign bit for DAC */ - Et_i2cwrite(dev, PAS106_REG7, I2c4, sizeof I2c4, 1); + i2c_w(gspca_dev, PAS106_REG7, I2c4, sizeof I2c4, 1); /* now set by fifo the whole colors setting */ - reg_w(dev, ET_G_RED, GainRGBG, 6); + reg_w(gspca_dev, ET_G_RED, GainRGBG, 6); getcolors(gspca_dev); setcolors(gspca_dev); } @@ -632,14 +640,13 @@ static int sd_config(struct gspca_dev *gspca_dev, static int sd_open(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - struct usb_device *dev = gspca_dev->dev; if (sd->sensor == SENSOR_PAS106) Et_init1(gspca_dev); else Et_init2(gspca_dev); - reg_w_val(dev, ET_RESET_ALL, 0x08); - et_video(dev, 0); /* video off */ + reg_w_val(gspca_dev, ET_RESET_ALL, 0x08); + et_video(gspca_dev, 0); /* video off */ return 0; } @@ -647,20 +654,19 @@ static int sd_open(struct gspca_dev *gspca_dev) static void sd_start(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - struct usb_device *dev = gspca_dev->dev; if (sd->sensor == SENSOR_PAS106) Et_init1(gspca_dev); else Et_init2(gspca_dev); - reg_w_val(dev, ET_RESET_ALL, 0x08); - et_video(dev, 1); /* video on */ + reg_w_val(gspca_dev, ET_RESET_ALL, 0x08); + et_video(gspca_dev, 1); /* video on */ } static void sd_stopN(struct gspca_dev *gspca_dev) { - et_video(gspca_dev->dev, 0); /* video off */ + et_video(gspca_dev, 0); /* video off */ } static void sd_stop0(struct gspca_dev *gspca_dev) @@ -678,7 +684,7 @@ static void setbrightness(struct gspca_dev *gspca_dev) __u8 brightness = sd->brightness; for (i = 0; i < 4; i++) - reg_w_val(gspca_dev->dev, (ET_O_RED + i), brightness); + reg_w_val(gspca_dev, ET_O_RED + i, brightness); } static void getbrightness(struct gspca_dev *gspca_dev) @@ -686,11 +692,10 @@ static void getbrightness(struct gspca_dev *gspca_dev) struct sd *sd = (struct sd *) gspca_dev; int i; int brightness = 0; - __u8 value; for (i = 0; i < 4; i++) { - reg_r(gspca_dev->dev, (ET_O_RED + i), &value, 1); - brightness += value; + reg_r(gspca_dev, ET_O_RED + i, 1); + brightness += gspca_dev->usb_buf[0]; } sd->brightness = brightness >> 3; } @@ -701,8 +706,8 @@ static void setcontrast(struct gspca_dev *gspca_dev) __u8 RGBG[] = { 0x80, 0x80, 0x80, 0x80, 0x00, 0x00 }; __u8 contrast = sd->contrast; - memset(RGBG, contrast, sizeof RGBG - 2); - reg_w(gspca_dev->dev, ET_G_RED, RGBG, 6); + memset(RGBG, contrast, sizeof(RGBG) - 2); + reg_w(gspca_dev, ET_G_RED, RGBG, 6); } static void getcontrast(struct gspca_dev *gspca_dev) @@ -710,11 +715,10 @@ static void getcontrast(struct gspca_dev *gspca_dev) struct sd *sd = (struct sd *) gspca_dev; int i; int contrast = 0; - __u8 value = 0; for (i = 0; i < 4; i++) { - reg_r(gspca_dev->dev, (ET_G_RED + i), &value, 1); - contrast += value; + reg_r(gspca_dev, ET_G_RED + i, 1); + contrast += gspca_dev->usb_buf[0]; } sd->contrast = contrast >> 2; } @@ -722,12 +726,11 @@ static void getcontrast(struct gspca_dev *gspca_dev) static __u8 Et_getgainG(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - __u8 value = 0; if (sd->sensor == SENSOR_PAS106) { - Et_i2cread(gspca_dev->dev, PAS106_REG0e, &value, 1, 1); - PDEBUG(D_CONF, "Etoms gain G %d", value); - return value; + i2c_r(gspca_dev, PAS106_REG0e); + PDEBUG(D_CONF, "Etoms gain G %d", gspca_dev->usb_buf[0]); + return gspca_dev->usb_buf[0]; } return 0x1f; } @@ -735,17 +738,17 @@ static __u8 Et_getgainG(struct gspca_dev *gspca_dev) static void Et_setgainG(struct gspca_dev *gspca_dev, __u8 gain) { struct sd *sd = (struct sd *) gspca_dev; - struct usb_device *dev = gspca_dev->dev; - __u8 i2cflags = 0x01; if (sd->sensor == SENSOR_PAS106) { - Et_i2cwrite(dev, PAS106_REG13, &i2cflags, 1, 3); - Et_i2cwrite(dev, PAS106_REG0e, &gain, 1, 1); + __u8 i2cflags = 0x01; + + i2c_w(gspca_dev, PAS106_REG13, &i2cflags, 1, 3); + i2c_w(gspca_dev, PAS106_REG0e, &gain, 1, 1); #if 0 - Et_i2cwrite(dev, 0x09, &gain, 1, 1); - Et_i2cwrite(dev, 0x0a, &gain, 1, 1); - Et_i2cwrite(dev, 0x0b, &gain, 1, 1); - Et_i2cwrite(dev, 0x0c, &gain, 1, 1); + i2c_w(gspca_dev, 0x09, &gain, 1, 1); + i2c_w(gspca_dev, 0x0a, &gain, 1, 1); + i2c_w(gspca_dev, 0x0b, &gain, 1, 1); + i2c_w(gspca_dev, 0x0c, &gain, 1, 1); #endif } } @@ -757,8 +760,6 @@ static void Et_setgainG(struct gspca_dev *gspca_dev, __u8 gain) static void setautogain(struct gspca_dev *gspca_dev) { - struct usb_device *dev = gspca_dev->dev; - __u8 GRBG[] = { 0, 0, 0, 0 }; __u8 luma = 0; __u8 luma_mean = 128; __u8 luma_delta = 20; @@ -767,10 +768,10 @@ static void setautogain(struct gspca_dev *gspca_dev) __u8 r, g, b; Gbright = Et_getgainG(gspca_dev); - reg_r(dev, ET_LUMA_CENTER, GRBG, 4); - g = (GRBG[0] + GRBG[3]) >> 1; - r = GRBG[1]; - b = GRBG[2]; + reg_r(gspca_dev, ET_LUMA_CENTER, 4); + g = (gspca_dev->usb_buf[0] + gspca_dev->usb_buf[3]) >> 1; + r = gspca_dev->usb_buf[1]; + b = gspca_dev->usb_buf[2]; r = ((r << 8) - (r << 4) - (r << 3)) >> 10; b = ((b << 7) >> 10); g = ((g << 9) + (g << 7) + (g << 5)) >> 10; diff --git a/linux/drivers/media/video/gspca/gspca.c b/linux/drivers/media/video/gspca/gspca.c index 943c5981f..4d65b1be4 100644 --- a/linux/drivers/media/video/gspca/gspca.c +++ b/linux/drivers/media/video/gspca/gspca.c @@ -42,8 +42,8 @@ MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>"); MODULE_DESCRIPTION("GSPCA USB Camera Driver"); MODULE_LICENSE("GPL"); -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 6) -static const char version[] = "2.1.6"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7) +static const char version[] = "2.1.7"; static int video_nr = -1; @@ -171,7 +171,7 @@ static void isoc_irq(struct urb *urb { struct gspca_dev *gspca_dev = (struct gspca_dev *) urb->context; - PDEBUG(D_PACK, "isoc irq mmap"); + PDEBUG(D_PACK, "isoc irq"); if (!gspca_dev->streaming) return; fill_frame(gspca_dev, urb); @@ -561,11 +561,6 @@ static void gspca_stream_off(struct gspca_dev *gspca_dev) gspca_set_alt0(gspca_dev); gspca_dev->sd_desc->stop0(gspca_dev); PDEBUG(D_STREAM, "stream off OK"); - } else { - destroy_urbs(gspca_dev); - atomic_inc(&gspca_dev->nevent); - wake_up_interruptible(&gspca_dev->wq); - PDEBUG(D_ERR|D_STREAM, "stream off no device ??"); } } @@ -683,9 +678,6 @@ static int try_fmt_vid_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 CONFIG_VIDEO_ADV_DEBUG if (gspca_debug & D_CONF) PDEBUG_MODE("try fmt cap", fmt->fmt.pix.pixelformat, w, h); @@ -819,7 +811,7 @@ static int dev_close(struct inode *inode, struct file *file) return -ERESTARTSYS; gspca_dev->users--; - /* if the file did capture, free the streaming resources */ + /* if the file did the capture, free the streaming resources */ if (gspca_dev->capt_file == file) { mutex_lock(&gspca_dev->usb_lock); if (gspca_dev->streaming) @@ -984,7 +976,7 @@ static int vidioc_reqbufs(struct file *file, void *priv, if (rb->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; switch (rb->memory) { - case GSPCA_MEMORY_READ: + case GSPCA_MEMORY_READ: /* (internal call) */ case V4L2_MEMORY_MMAP: case V4L2_MEMORY_USERPTR: break; @@ -994,33 +986,46 @@ static int vidioc_reqbufs(struct file *file, void *priv, if (mutex_lock_interruptible(&gspca_dev->queue_lock)) return -ERESTARTSYS; - /* only one file may do capture */ - if ((gspca_dev->capt_file != NULL && gspca_dev->capt_file != file) - || gspca_dev->streaming) { + if (gspca_dev->memory != GSPCA_MEMORY_NO + && gspca_dev->memory != rb->memory) { ret = -EBUSY; goto out; } - if (rb->count == 0) { /* unrequest */ - for (i = 0; i < gspca_dev->nframes; i++) { - if (gspca_dev->frame[i].vma_use_count) { - ret = -EBUSY; - goto out; - } - } - frame_free(gspca_dev); - gspca_dev->capt_file = NULL; - } else { - if (gspca_dev->nframes != 0) { + /* only one file may do the capture */ + if (gspca_dev->capt_file != NULL + && gspca_dev->capt_file != file) { + ret = -EBUSY; + goto out; + } + + /* if allocated, the buffers must not be mapped */ + for (i = 0; i < gspca_dev->nframes; i++) { + if (gspca_dev->frame[i].vma_use_count) { ret = -EBUSY; goto out; } - 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; - } + } + + /* stop streaming */ + if (gspca_dev->streaming) { + mutex_lock(&gspca_dev->usb_lock); + gspca_stream_off(gspca_dev); + mutex_unlock(&gspca_dev->usb_lock); + } + + /* free the previous allocated buffers, if any */ + if (gspca_dev->nframes != 0) { + frame_free(gspca_dev); + gspca_dev->capt_file = NULL; + } + if (rb->count == 0) /* unrequest */ + goto out; + 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); @@ -1062,10 +1067,6 @@ static int vidioc_streamon(struct file *file, void *priv, ret = -EINVAL; goto out; } - if (gspca_dev->capt_file != file) { - ret = -EINVAL; - goto out; - } if (!gspca_dev->streaming) { ret = gspca_init_transfer(gspca_dev); if (ret < 0) @@ -1089,7 +1090,7 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type buf_type) { struct gspca_dev *gspca_dev = priv; - int ret; + int i, ret; if (buf_type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; @@ -1097,18 +1098,23 @@ static int vidioc_streamoff(struct file *file, void *priv, return 0; if (mutex_lock_interruptible(&gspca_dev->queue_lock)) return -ERESTARTSYS; + + /* stop streaming */ if (mutex_lock_interruptible(&gspca_dev->usb_lock)) { ret = -ERESTARTSYS; goto out; } - if (gspca_dev->capt_file != file) { - ret = -EINVAL; - goto out2; - } gspca_stream_off(gspca_dev); - ret = 0; -out2: mutex_unlock(&gspca_dev->usb_lock); + + /* empty the application queues */ + for (i = 0; i < gspca_dev->nframes; i++) + gspca_dev->frame[i].v4l2_buf.flags &= ~BUF_ALL_FLAGS; + gspca_dev->fr_i = gspca_dev->fr_o = gspca_dev->fr_q = 0; + gspca_dev->last_packet_type = DISCARD_PACKET; + gspca_dev->sequence = 0; + atomic_set(&gspca_dev->nevent, 0); + ret = 0; out: mutex_unlock(&gspca_dev->queue_lock); return ret; @@ -1344,9 +1350,11 @@ ok: gspca_dev->fr_i, gspca_dev->fr_o); - if (gspca_dev->sd_desc->dq_callback) + if (gspca_dev->sd_desc->dq_callback) { + mutex_lock(&gspca_dev->usb_lock); gspca_dev->sd_desc->dq_callback(gspca_dev); - + mutex_unlock(&gspca_dev->usb_lock); + } return j; } @@ -1367,14 +1375,17 @@ static int vidioc_dqbuf(struct file *file, void *priv, return -EINVAL; if (v4l2_buf->memory != gspca_dev->memory) return -EINVAL; - if (!gspca_dev->streaming) + + /* if not streaming, be sure the application will not loop forever */ + if (!(file->f_flags & O_NONBLOCK) + && !gspca_dev->streaming && gspca_dev->users == 1) return -EINVAL; - if (gspca_dev->capt_file != file) { - ret = -EINVAL; - goto out; - } - /* only one read */ + /* only the capturing file may dequeue */ + if (gspca_dev->capt_file != file) + return -EINVAL; + + /* only one dequeue / read at a time */ if (mutex_lock_interruptible(&gspca_dev->read_lock)) return -ERESTARTSYS; @@ -1419,24 +1430,23 @@ static int vidioc_qbuf(struct file *file, void *priv, if (v4l2_buf->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; + if (mutex_lock_interruptible(&gspca_dev->queue_lock)) + return -ERESTARTSYS; + index = v4l2_buf->index; if ((unsigned) index >= gspca_dev->nframes) { PDEBUG(D_FRAM, "qbuf idx %d >= %d", index, gspca_dev->nframes); - return -EINVAL; + ret = -EINVAL; + goto out; } - frame = &gspca_dev->frame[index]; - - if (v4l2_buf->memory != frame->v4l2_buf.memory) { + if (v4l2_buf->memory != gspca_dev->memory) { PDEBUG(D_FRAM, "qbuf bad memory type"); - return -EINVAL; + ret = -EINVAL; + goto out; } - if (gspca_dev->capt_file != file) - return -EINVAL; - - if (mutex_lock_interruptible(&gspca_dev->queue_lock)) - return -ERESTARTSYS; + frame = &gspca_dev->frame[index]; if (frame->v4l2_buf.flags & BUF_ALL_FLAGS) { PDEBUG(D_FRAM, "qbuf bad state"); ret = -EINVAL; @@ -1495,9 +1505,6 @@ static int read_alloc(struct gspca_dev *gspca_dev, v4l2_buf.memory = GSPCA_MEMORY_READ; for (i = 0; i < gspca_dev->nbufread; i++) { v4l2_buf.index = i; -/*fixme: ugly!*/ - gspca_dev->frame[i].v4l2_buf.flags |= - V4L2_BUF_FLAG_MAPPED; ret = vidioc_qbuf(file, gspca_dev, &v4l2_buf); if (ret != 0) { PDEBUG(D_STREAM, "read qbuf err: %d", ret); @@ -1525,17 +1532,13 @@ static unsigned int dev_poll(struct file *file, poll_table *wait) if (!gspca_dev->present) return POLLERR; - /* if not streaming, the user would use read() */ - if (!gspca_dev->streaming) { - if (gspca_dev->memory != GSPCA_MEMORY_NO) { - ret = POLLERR; /* not the 1st time */ - goto out; - } + /* if reqbufs is not done, the user would use read() */ + if (gspca_dev->nframes == 0) { + if (gspca_dev->memory != GSPCA_MEMORY_NO) + return POLLERR; /* not the 1st time */ ret = read_alloc(gspca_dev, file); - if (ret != 0) { - ret = POLLERR; - goto out; - } + if (ret != 0) + return POLLERR; } if (mutex_lock_interruptible(&gspca_dev->queue_lock) != 0) @@ -1545,6 +1548,7 @@ static unsigned int dev_poll(struct file *file, poll_table *wait) goto out; } + /* check the next incoming buffer */ i = gspca_dev->fr_o; i = gspca_dev->fr_queue[i]; if (gspca_dev->frame[i].v4l2_buf.flags & V4L2_BUF_FLAG_DONE) @@ -1793,6 +1797,94 @@ void gspca_disconnect(struct usb_interface *intf) } EXPORT_SYMBOL(gspca_disconnect); +/* -- cam driver utility functions -- */ + +/* auto gain and exposure algorithm based on the knee algorithm described here: + http://ytse.tricolour.net/docs/LowLightOptimization.html + + Returns 0 if no changes were made, 1 if the gain and or exposure settings + where changed. */ +int gspca_auto_gain_n_exposure(struct gspca_dev *gspca_dev, int avg_lum, + int desired_avg_lum, int deadzone, int gain_knee, int exposure_knee) +{ + int i, steps, gain, orig_gain, exposure, orig_exposure, autogain; + const struct ctrl *gain_ctrl = NULL; + const struct ctrl *exposure_ctrl = NULL; + const struct ctrl *autogain_ctrl = NULL; + int retval = 0; + + for (i = 0; i < gspca_dev->sd_desc->nctrls; i++) { + if (gspca_dev->sd_desc->ctrls[i].qctrl.id == V4L2_CID_GAIN) + gain_ctrl = &gspca_dev->sd_desc->ctrls[i]; + if (gspca_dev->sd_desc->ctrls[i].qctrl.id == V4L2_CID_EXPOSURE) + exposure_ctrl = &gspca_dev->sd_desc->ctrls[i]; + if (gspca_dev->sd_desc->ctrls[i].qctrl.id == V4L2_CID_AUTOGAIN) + autogain_ctrl = &gspca_dev->sd_desc->ctrls[i]; + } + if (!gain_ctrl || !exposure_ctrl || !autogain_ctrl) { + PDEBUG(D_ERR, "Error: gspca_auto_gain_n_exposure called " + "on cam without (auto)gain/exposure"); + return 0; + } + + if (gain_ctrl->get(gspca_dev, &gain) || + exposure_ctrl->get(gspca_dev, &exposure) || + autogain_ctrl->get(gspca_dev, &autogain) || !autogain) + return 0; + + orig_gain = gain; + orig_exposure = exposure; + + /* If we are of a multiple of deadzone, do multiple steps to reach the + desired lumination fast (with the risc of a slight overshoot) */ + steps = abs(desired_avg_lum - avg_lum) / deadzone; + + PDEBUG(D_FRAM, "autogain: lum: %d, desired: %d, steps: %d\n", + avg_lum, desired_avg_lum, steps); + + for (i = 0; i < steps; i++) { + if (avg_lum > desired_avg_lum) { + if (gain > gain_knee) + gain--; + else if (exposure > exposure_knee) + exposure--; + else if (gain > gain_ctrl->qctrl.default_value) + gain--; + else if (exposure > exposure_ctrl->qctrl.minimum) + exposure--; + else if (gain > gain_ctrl->qctrl.minimum) + gain--; + else + break; + } else { + if (gain < gain_ctrl->qctrl.default_value) + gain++; + else if (exposure < exposure_knee) + exposure++; + else if (gain < gain_knee) + gain++; + else if (exposure < exposure_ctrl->qctrl.maximum) + exposure++; + else if (gain < gain_ctrl->qctrl.maximum) + gain++; + else + break; + } + } + + if (gain != orig_gain) { + gain_ctrl->set(gspca_dev, gain); + retval = 1; + } + if (exposure != orig_exposure) { + exposure_ctrl->set(gspca_dev, exposure); + retval = 1; + } + + return retval; +} +EXPORT_SYMBOL(gspca_auto_gain_n_exposure); + /* -- module insert / remove -- */ static int __init gspca_init(void) { diff --git a/linux/drivers/media/video/gspca/gspca.h b/linux/drivers/media/video/gspca/gspca.h index 9b645af81..3fd2c4eee 100644 --- a/linux/drivers/media/video/gspca/gspca.h +++ b/linux/drivers/media/video/gspca/gspca.h @@ -125,6 +125,7 @@ struct gspca_dev { struct cam cam; /* device information */ const struct sd_desc *sd_desc; /* subdriver description */ + __u8 usb_buf[8]; /* buffer for USB exchanges */ struct urb *urb[MAX_NURBS]; __u8 *frbuf; /* buffer for nframes */ @@ -170,4 +171,6 @@ struct gspca_frame *gspca_frame_add(struct gspca_dev *gspca_dev, struct gspca_frame *frame, const __u8 *data, int len); +int gspca_auto_gain_n_exposure(struct gspca_dev *gspca_dev, int avg_lum, + int desired_avg_lum, int deadzone, int gain_knee, int exposure_knee); #endif /* GSPCAV2_H */ diff --git a/linux/drivers/media/video/gspca/mars.c b/linux/drivers/media/video/gspca/mars.c index 23f3dba80..88c2b02f3 100644 --- a/linux/drivers/media/video/gspca/mars.c +++ b/linux/drivers/media/video/gspca/mars.c @@ -24,8 +24,8 @@ #include "gspca.h" #include "jpeg.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) -static const char version[] = "2.1.5"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7) +static const char version[] = "2.1.7"; MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_DESCRIPTION("GSPCA/Mars USB Camera Driver"); @@ -83,39 +83,53 @@ enum { REG_HW_MI_63, REG_HW_MI_64, REG_HW_MI_F1 = 0xf1, - ATTR_TOTAL_MI_REG = 242 + ATTR_TOTAL_MI_REG = 0xf2 }; -static int pcam_reg_write(struct usb_device *dev, - __u16 index, __u8 *value, int len) +/* the bytes to write are in gspca_dev->usb_buf */ +static int reg_w(struct gspca_dev *gspca_dev, + __u16 index, int len) { int rc; - rc = usb_control_msg(dev, - usb_sndbulkpipe(dev, 4), + rc = usb_control_msg(gspca_dev->dev, + usb_sndbulkpipe(gspca_dev->dev, 4), 0x12, -/* ?? 0xc8 = USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_??? !? */ - 0xc8, + 0xc8, /* ?? */ 0, /* value */ - index, value, len, 500); + index, gspca_dev->usb_buf, len, 500); if (rc < 0) PDEBUG(D_ERR, "reg write [%02x] error %d", index, rc); return rc; } -static void MISensor_BulkWrite(struct usb_device *dev, - unsigned short *pch, - char Address) +static int reg_w_buf(struct gspca_dev *gspca_dev, + __u16 index, __u8 *buf, int len) { - __u8 data[6]; + int rc; + + rc = usb_control_msg(gspca_dev->dev, + usb_sndbulkpipe(gspca_dev->dev, 4), + 0x12, + 0xc8, /* ?? */ + 0, /* value */ + index, buf, len, 500); + if (rc < 0) + PDEBUG(D_ERR, "reg write [%02x] error %d", index, rc); + return rc; +} - data[0] = 0x1f; - data[1] = 0; /* control byte */ - data[2] = Address; - data[3] = *pch >> 8; /* high byte */ - data[4] = *pch; /* low byte */ +static void bulk_w(struct gspca_dev *gspca_dev, + __u16 *pch, + __u16 Address) +{ + gspca_dev->usb_buf[0] = 0x1f; + gspca_dev->usb_buf[1] = 0; /* control byte */ + gspca_dev->usb_buf[2] = Address; + gspca_dev->usb_buf[3] = *pch >> 8; /* high byte */ + gspca_dev->usb_buf[4] = *pch; /* low byte */ - pcam_reg_write(dev, Address, data, 5); + reg_w(gspca_dev, Address, 5); } /* this function is called at probe time */ @@ -142,33 +156,30 @@ static int sd_open(struct gspca_dev *gspca_dev) static void sd_start(struct gspca_dev *gspca_dev) { - struct usb_device *dev = gspca_dev->dev; int err_code; - __u8 data[12]; - __u16 MI_buf[242]; + __u8 *data; + __u16 *MI_buf; int h_size, v_size; int intpipe; -/* struct usb_device *dev = pcam->dev; */ - - memset(data, 0, sizeof data); - memset(MI_buf, 0, sizeof MI_buf); PDEBUG(D_STREAM, "camera start, iface %d, alt 8", gspca_dev->iface); - if (usb_set_interface(dev, gspca_dev->iface, 8) < 0) { + if (usb_set_interface(gspca_dev->dev, gspca_dev->iface, 8) < 0) { PDEBUG(D_ERR|D_STREAM, "Set packet size: set interface error"); return; } + data = gspca_dev->usb_buf; data[0] = 0x01; /* address */ data[1] = 0x01; - err_code = pcam_reg_write(dev, data[0], data, 2); + err_code = reg_w(gspca_dev, data[0], 2); if (err_code < 0) return; /* Initialize the MR97113 chip register */ + data = kmalloc(16, GFP_KERNEL); data[0] = 0x00; /* address */ data[1] = 0x0c | 0x01; /* reg 0 */ data[2] = 0x01; /* reg 1 */ @@ -181,34 +192,34 @@ static void sd_start(struct gspca_dev *gspca_dev) data[6] = 4; /* reg 5, H start */ data[7] = 0xc0; /* reg 6, gamma 1.5 */ data[8] = 3; /* reg 7, V start */ -/* if(h_size == 320 ) */ +/* if (h_size == 320 ) */ /* data[9]= 0x56; * reg 8, 24MHz, 2:1 scale down */ /* else */ data[9] = 0x52; /* reg 8, 24MHz, no scale down */ data[10] = 0x5d; /* reg 9, I2C device address * [for PAS5101 (0x40)] [for MI (0x5d)] */ - err_code = pcam_reg_write(dev, data[0], data, 11); + err_code = reg_w_buf(gspca_dev, data[0], data, 11); + kfree(data); if (err_code < 0) return; + data = gspca_dev->usb_buf; data[0] = 0x23; /* address */ data[1] = 0x09; /* reg 35, append frame header */ - err_code = pcam_reg_write(dev, data[0], data, 2); - if (err_code < 0) { - PDEBUG(D_ERR, "Register write failed"); + err_code = reg_w(gspca_dev, data[0], 2); + if (err_code < 0) return; - } - data[0] = 0x3C; /* address */ -/* if (pcam->width == 1280) */ + data[0] = 0x3c; /* address */ +/* if (gspca_dev->width == 1280) */ /* data[1] = 200; * reg 60, pc-cam frame size * (unit: 4KB) 800KB */ /* else */ data[1] = 50; /* 50 reg 60, pc-cam frame size * (unit: 4KB) 200KB */ - err_code = pcam_reg_write(dev, data[0], data, 2); + err_code = reg_w(gspca_dev, data[0], 2); if (err_code < 0) return; @@ -250,19 +261,20 @@ static void sd_start(struct gspca_dev *gspca_dev) /* auto dark-gain */ data[0] = 0x5e; /* address */ - err_code = pcam_reg_write(dev, data[0], data, 6); + err_code = reg_w(gspca_dev, data[0], 6); if (err_code < 0) return; data[0] = 0x67; data[1] = 0x13; /* reg 103, first pixel B, disable sharpness */ - err_code = pcam_reg_write(dev, data[0], data, 2); + err_code = reg_w(gspca_dev, data[0], 2); if (err_code < 0) return; /* * initialize the value of MI sensor... */ + MI_buf = kzalloc(ATTR_TOTAL_MI_REG * sizeof *MI_buf, GFP_KERNEL); MI_buf[REG_HW_MI_1] = 0x000a; MI_buf[REG_HW_MI_2] = 0x000c; MI_buf[REG_HW_MI_3] = 0x0405; @@ -304,48 +316,48 @@ static void sd_start(struct gspca_dev *gspca_dev) } MI_buf[0x20] = 0x1104; - MISensor_BulkWrite(dev, MI_buf + 1, 1); - MISensor_BulkWrite(dev, MI_buf + 2, 2); - MISensor_BulkWrite(dev, MI_buf + 3, 3); - MISensor_BulkWrite(dev, MI_buf + 4, 4); - MISensor_BulkWrite(dev, MI_buf + 5, 5); - MISensor_BulkWrite(dev, MI_buf + 6, 6); - MISensor_BulkWrite(dev, MI_buf + 7, 7); - MISensor_BulkWrite(dev, MI_buf + 9, 9); - MISensor_BulkWrite(dev, MI_buf + 0x0b, 0x0b); - MISensor_BulkWrite(dev, MI_buf + 0x0c, 0x0c); - MISensor_BulkWrite(dev, MI_buf + 0x0d, 0x0d); - MISensor_BulkWrite(dev, MI_buf + 0x1e, 0x1e); - MISensor_BulkWrite(dev, MI_buf + 0x20, 0x20); - MISensor_BulkWrite(dev, MI_buf + 0x2b, 0x2b); - MISensor_BulkWrite(dev, MI_buf + 0x2c, 0x2c); - MISensor_BulkWrite(dev, MI_buf + 0x2d, 0x2d); - MISensor_BulkWrite(dev, MI_buf + 0x2e, 0x2e); - MISensor_BulkWrite(dev, MI_buf + 0x35, 0x35); - MISensor_BulkWrite(dev, MI_buf + 0x5f, 0x5f); - MISensor_BulkWrite(dev, MI_buf + 0x60, 0x60); - MISensor_BulkWrite(dev, MI_buf + 0x61, 0x61); - MISensor_BulkWrite(dev, MI_buf + 0x62, 0x62); - MISensor_BulkWrite(dev, MI_buf + 0x63, 0x63); - MISensor_BulkWrite(dev, MI_buf + 0x64, 0x64); - MISensor_BulkWrite(dev, MI_buf + 0xf1, 0xf1); - - intpipe = usb_sndintpipe(dev, 0); - err_code = usb_clear_halt(dev, intpipe); + bulk_w(gspca_dev, MI_buf + 1, 1); + bulk_w(gspca_dev, MI_buf + 2, 2); + bulk_w(gspca_dev, MI_buf + 3, 3); + bulk_w(gspca_dev, MI_buf + 4, 4); + bulk_w(gspca_dev, MI_buf + 5, 5); + bulk_w(gspca_dev, MI_buf + 6, 6); + bulk_w(gspca_dev, MI_buf + 7, 7); + bulk_w(gspca_dev, MI_buf + 9, 9); + bulk_w(gspca_dev, MI_buf + 0x0b, 0x0b); + bulk_w(gspca_dev, MI_buf + 0x0c, 0x0c); + bulk_w(gspca_dev, MI_buf + 0x0d, 0x0d); + bulk_w(gspca_dev, MI_buf + 0x1e, 0x1e); + bulk_w(gspca_dev, MI_buf + 0x20, 0x20); + bulk_w(gspca_dev, MI_buf + 0x2b, 0x2b); + bulk_w(gspca_dev, MI_buf + 0x2c, 0x2c); + bulk_w(gspca_dev, MI_buf + 0x2d, 0x2d); + bulk_w(gspca_dev, MI_buf + 0x2e, 0x2e); + bulk_w(gspca_dev, MI_buf + 0x35, 0x35); + bulk_w(gspca_dev, MI_buf + 0x5f, 0x5f); + bulk_w(gspca_dev, MI_buf + 0x60, 0x60); + bulk_w(gspca_dev, MI_buf + 0x61, 0x61); + bulk_w(gspca_dev, MI_buf + 0x62, 0x62); + bulk_w(gspca_dev, MI_buf + 0x63, 0x63); + bulk_w(gspca_dev, MI_buf + 0x64, 0x64); + bulk_w(gspca_dev, MI_buf + 0xf1, 0xf1); + kfree(MI_buf); + + intpipe = usb_sndintpipe(gspca_dev->dev, 0); + err_code = usb_clear_halt(gspca_dev->dev, intpipe); data[0] = 0x00; data[1] = 0x4d; /* ISOC transfering enable... */ - pcam_reg_write(dev, data[0], data, 2); + reg_w(gspca_dev, data[0], 2); } static void sd_stopN(struct gspca_dev *gspca_dev) { int result; - __u8 data[2]; - data[0] = 1; - data[1] = 0; - result = pcam_reg_write(gspca_dev->dev, data[0], data, 2); + gspca_dev->usb_buf[0] = 1; + gspca_dev->usb_buf[1] = 0; + result = reg_w(gspca_dev, gspca_dev->usb_buf[0], 2); if (result < 0) PDEBUG(D_ERR, "Camera Stop failed"); } diff --git a/linux/drivers/media/video/gspca/ov519.c b/linux/drivers/media/video/gspca/ov519.c index 402b3ed12..3e402931f 100644 --- a/linux/drivers/media/video/gspca/ov519.c +++ b/linux/drivers/media/video/gspca/ov519.c @@ -24,8 +24,8 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) -static const char version[] = "2.1.5"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7) +static const char version[] = "2.1.7"; MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>"); MODULE_DESCRIPTION("OV519 USB Camera Driver"); @@ -282,15 +282,14 @@ static unsigned char ov7670_abs_to_sm(unsigned char v) static int reg_w(struct sd *sd, __u16 index, __u8 value) { int ret; - __u8 data; - data = value; + sd->gspca_dev.usb_buf[0] = value; ret = usb_control_msg(sd->gspca_dev.dev, usb_sndctrlpipe(sd->gspca_dev.dev, 0), 1, /* REQ_IO (ov518/519) */ USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0, index, - &data, 1, 500); + sd->gspca_dev.usb_buf, 1, 500); if (ret < 0) PDEBUG(D_ERR, "Write reg [%02x] %02x failed", index, value); return ret; @@ -301,16 +300,15 @@ static int reg_w(struct sd *sd, __u16 index, __u8 value) static int reg_r(struct sd *sd, __u16 index) { int ret; - __u8 data; ret = usb_control_msg(sd->gspca_dev.dev, usb_rcvctrlpipe(sd->gspca_dev.dev, 0), 1, /* REQ_IO */ USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - 0, index, &data, 1, 500); + 0, index, sd->gspca_dev.usb_buf, 1, 500); if (ret >= 0) - ret = data; + ret = sd->gspca_dev.usb_buf[0]; else PDEBUG(D_ERR, "Read reg [0x%02x] failed", index); return ret; @@ -321,16 +319,15 @@ static int reg_r8(struct sd *sd, __u16 index) { int ret; - __u8 buf[8]; ret = usb_control_msg(sd->gspca_dev.dev, usb_rcvctrlpipe(sd->gspca_dev.dev, 0), 1, /* REQ_IO */ USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - 0, index, &buf[0], 8, 500); + 0, index, sd->gspca_dev.usb_buf, 8, 500); if (ret >= 0) - ret = buf[0]; + ret = sd->gspca_dev.usb_buf[0]; else PDEBUG(D_ERR, "Read reg 8 [0x%02x] failed", index); return ret; diff --git a/linux/drivers/media/video/gspca/pac207.c b/linux/drivers/media/video/gspca/pac207.c index 4f197c1f4..fa7abc411 100644 --- a/linux/drivers/media/video/gspca/pac207.c +++ b/linux/drivers/media/video/gspca/pac207.c @@ -27,8 +27,8 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) -static const char version[] = "2.1.5"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7) +static const char version[] = "2.1.7"; MODULE_AUTHOR("Hans de Goede <j.w.r.degoede@hhs.nl>"); MODULE_DESCRIPTION("Pixart PAC207"); @@ -187,18 +187,18 @@ static const __u8 PacReg72[] = { 0x00, 0x00, 0x36, 0x00 }; static const unsigned char pac207_sof_marker[5] = { 0xff, 0xff, 0x00, 0xff, 0x96 }; -int pac207_write_regs(struct gspca_dev *gspca_dev, u16 index, +static int pac207_write_regs(struct gspca_dev *gspca_dev, u16 index, const u8 *buffer, u16 length) { struct usb_device *udev = gspca_dev->dev; int err; - u8 kbuf[8]; - memcpy(kbuf, buffer, length); + memcpy(gspca_dev->usb_buf, buffer, length); err = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x01, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, - 0x00, index, kbuf, length, PAC207_CTRL_TIMEOUT); + 0x00, index, + gspca_dev->usb_buf, length, PAC207_CTRL_TIMEOUT); if (err < 0) PDEBUG(D_ERR, "Failed to write registers to index 0x%04X, error %d)", @@ -227,12 +227,12 @@ int pac207_write_reg(struct gspca_dev *gspca_dev, u16 index, u16 value) int pac207_read_reg(struct gspca_dev *gspca_dev, u16 index) { struct usb_device *udev = gspca_dev->dev; - u8 buff; int res; res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, - 0x00, index, &buff, 1, PAC207_CTRL_TIMEOUT); + 0x00, index, + gspca_dev->usb_buf, 1, PAC207_CTRL_TIMEOUT); if (res < 0) { PDEBUG(D_ERR, "Failed to read a register (index 0x%04X, error %d)", @@ -240,10 +240,9 @@ int pac207_read_reg(struct gspca_dev *gspca_dev, u16 index) return res; } - return buff; + return gspca_dev->usb_buf[0]; } - /* this function is called at probe time */ static int sd_config(struct gspca_dev *gspca_dev, const struct usb_device_id *id) @@ -357,70 +356,20 @@ static void sd_close(struct gspca_dev *gspca_dev) { } -/* auto gain and exposure algorithm based on the knee algorithm described here: - * <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; - int i, steps, desired_avg_lum; - int orig_gain = sd->gain; - int orig_exposure = sd->exposure; int avg_lum = atomic_read(&sd->avg_lum); - if (!sd->autogain || avg_lum == -1) + if (avg_lum == -1) return; - if (sd->autogain_ignore_frames > 0) { + if (sd->autogain_ignore_frames > 0) sd->autogain_ignore_frames--; - return; - } - - /* correct desired lumination for the configured brightness */ - desired_avg_lum = 100 + sd->brightness / 2; - - /* If we are of a multiple of deadzone, do multiple step to reach the - desired lumination fast (with the risc of a slight overshoot) */ - steps = abs(desired_avg_lum - avg_lum) / PAC207_AUTOGAIN_DEADZONE; - - for (i = 0; i < steps; i++) { - if (avg_lum > desired_avg_lum) { - if (sd->gain > PAC207_GAIN_KNEE) - sd->gain--; - else if (sd->exposure > PAC207_EXPOSURE_KNEE) - sd->exposure--; - else if (sd->gain > PAC207_GAIN_DEFAULT) - sd->gain--; - else if (sd->exposure > PAC207_EXPOSURE_MIN) - sd->exposure--; - else if (sd->gain > PAC207_GAIN_MIN) - sd->gain--; - else - break; - } else { - if (sd->gain < PAC207_GAIN_DEFAULT) - sd->gain++; - else if (sd->exposure < PAC207_EXPOSURE_KNEE) - sd->exposure++; - else if (sd->gain < PAC207_GAIN_KNEE) - sd->gain++; - else if (sd->exposure < PAC207_EXPOSURE_MAX) - sd->exposure++; - else if (sd->gain < PAC207_GAIN_MAX) - sd->gain++; - else - break; - } - } - - if (sd->exposure != orig_exposure || sd->gain != orig_gain) { - if (sd->exposure != orig_exposure) - pac207_write_reg(gspca_dev, 0x0002, sd->exposure); - if (sd->gain != orig_gain) - pac207_write_reg(gspca_dev, 0x000e, sd->gain); - pac207_write_reg(gspca_dev, 0x13, 0x01); /* load reg to sen */ - pac207_write_reg(gspca_dev, 0x1c, 0x01); /* not documented */ + else if (gspca_auto_gain_n_exposure(gspca_dev, avg_lum, + 100 + sd->brightness / 2, PAC207_AUTOGAIN_DEADZONE, + PAC207_GAIN_KNEE, PAC207_EXPOSURE_KNEE)) sd->autogain_ignore_frames = PAC207_AUTOGAIN_IGNORE_FRAMES; - } } static unsigned char *pac207_find_sof(struct gspca_dev *gspca_dev, @@ -546,10 +495,6 @@ static int sd_setexposure(struct gspca_dev *gspca_dev, __s32 val) { struct sd *sd = (struct sd *) gspca_dev; - /* don't allow mucking with exposure when using autogain */ - if (sd->autogain) - return -EINVAL; - sd->exposure = val; if (gspca_dev->streaming) setexposure(gspca_dev); @@ -568,10 +513,6 @@ static int sd_setgain(struct gspca_dev *gspca_dev, __s32 val) { struct sd *sd = (struct sd *) gspca_dev; - /* don't allow mucking with gain when using autogain */ - if (sd->autogain) - return -EINVAL; - sd->gain = val; if (gspca_dev->streaming) setgain(gspca_dev); diff --git a/linux/drivers/media/video/gspca/pac7311.c b/linux/drivers/media/video/gspca/pac7311.c index 5519c2f70..48faf3a5c 100644 --- a/linux/drivers/media/video/gspca/pac7311.c +++ b/linux/drivers/media/video/gspca/pac7311.c @@ -23,8 +23,8 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) -static const char version[] = "2.1.5"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7) +static const char version[] = "2.1.7"; MODULE_AUTHOR("Thomas Kaiser thomas@kaiser-linux.li"); MODULE_DESCRIPTION("Pixart PAC7311"); @@ -206,46 +206,43 @@ static const __u8 pac7311_jpeg_header[] = { 0x11, 0x00, 0x3f, 0x00 }; -static void reg_w(struct usb_device *dev, +static void reg_w_buf(struct gspca_dev *gspca_dev, __u16 index, const char *buffer, __u16 len) { - __u8 tmpbuf[8]; - - memcpy(tmpbuf, buffer, len); - usb_control_msg(dev, - usb_sndctrlpipe(dev, 0), + memcpy(gspca_dev->usb_buf, buffer, len); + usb_control_msg(gspca_dev->dev, + usb_sndctrlpipe(gspca_dev->dev, 0), 1, /* request */ USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0, /* value */ - index, tmpbuf, len, + index, gspca_dev->usb_buf, len, 500); } -static void pac7311_reg_read(struct usb_device *dev, __u16 index, - __u8 *buffer) +static __u8 reg_r(struct gspca_dev *gspca_dev, + __u16 index) { - usb_control_msg(dev, - usb_rcvctrlpipe(dev, 0), + usb_control_msg(gspca_dev->dev, + usb_rcvctrlpipe(gspca_dev->dev, 0), 0, /* request */ USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0, /* value */ - index, buffer, 1, + index, gspca_dev->usb_buf, 1, 500); + return gspca_dev->usb_buf[0]; } -static void pac7311_reg_write(struct usb_device *dev, - __u16 index, - __u8 value) +static void reg_w(struct gspca_dev *gspca_dev, + __u16 index, + __u8 value) { - __u8 buf; - - buf = value; - usb_control_msg(dev, - usb_sndctrlpipe(dev, 0), + gspca_dev->usb_buf[0] = value; + usb_control_msg(gspca_dev->dev, + usb_sndctrlpipe(gspca_dev->dev, 0), 0, /* request */ USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - value, index, &buf, 1, + value, index, gspca_dev->usb_buf, 1, 500); } @@ -254,20 +251,19 @@ static int sd_config(struct gspca_dev *gspca_dev, const struct usb_device_id *id) { struct sd *sd = (struct sd *) gspca_dev; - struct usb_device *dev = gspca_dev->dev; struct cam *cam; PDEBUG(D_CONF, "Find Sensor PAC7311"); - pac7311_reg_write(dev, 0x78, 0x40); /* Bit_0=start stream, Bit_7=LED */ - pac7311_reg_write(dev, 0x78, 0x40); /* Bit_0=start stream, Bit_7=LED */ - pac7311_reg_write(dev, 0x78, 0x44); /* Bit_0=start stream, Bit_7=LED */ - pac7311_reg_write(dev, 0xff, 0x04); - pac7311_reg_write(dev, 0x27, 0x80); - pac7311_reg_write(dev, 0x28, 0xca); - pac7311_reg_write(dev, 0x29, 0x53); - pac7311_reg_write(dev, 0x2a, 0x0e); - pac7311_reg_write(dev, 0xff, 0x01); - pac7311_reg_write(dev, 0x3e, 0x20); + reg_w(gspca_dev, 0x78, 0x40); /* Bit_0=start stream, Bit_7=LED */ + reg_w(gspca_dev, 0x78, 0x40); /* Bit_0=start stream, Bit_7=LED */ + reg_w(gspca_dev, 0x78, 0x44); /* Bit_0=start stream, Bit_7=LED */ + reg_w(gspca_dev, 0xff, 0x04); + reg_w(gspca_dev, 0x27, 0x80); + reg_w(gspca_dev, 0x28, 0xca); + reg_w(gspca_dev, 0x29, 0x53); + reg_w(gspca_dev, 0x2a, 0x0e); + reg_w(gspca_dev, 0xff, 0x01); + reg_w(gspca_dev, 0x3e, 0x20); cam = &gspca_dev->cam; cam->dev_name = (char *) id->driver_info; @@ -289,11 +285,11 @@ static void setbrightness(struct gspca_dev *gspca_dev) /*jfm: inverted?*/ brightness = BRIGHTNESS_MAX - sd->brightness; - pac7311_reg_write(gspca_dev->dev, 0xff, 0x04); -/* pac7311_reg_write(gspca_dev->dev, 0x0e, 0x00); */ - pac7311_reg_write(gspca_dev->dev, 0x0f, brightness); + reg_w(gspca_dev, 0xff, 0x04); +/* reg_w(gspca_dev, 0x0e, 0x00); */ + reg_w(gspca_dev, 0x0f, brightness); /* load registers to sensor (Bit 0, auto clear) */ - pac7311_reg_write(gspca_dev->dev, 0x11, 0x01); + reg_w(gspca_dev, 0x11, 0x01); PDEBUG(D_CONF|D_STREAM, "brightness: %i", brightness); } @@ -301,10 +297,10 @@ static void setcontrast(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - pac7311_reg_write(gspca_dev->dev, 0xff, 0x01); - pac7311_reg_write(gspca_dev->dev, 0x80, sd->contrast); + reg_w(gspca_dev, 0xff, 0x01); + reg_w(gspca_dev, 0x80, sd->contrast); /* load registers to sensor (Bit 0, auto clear) */ - pac7311_reg_write(gspca_dev->dev, 0x11, 0x01); + reg_w(gspca_dev, 0x11, 0x01); PDEBUG(D_CONF|D_STREAM, "contrast: %i", sd->contrast); } @@ -312,94 +308,93 @@ static void setcolors(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - pac7311_reg_write(gspca_dev->dev, 0xff, 0x01); - pac7311_reg_write(gspca_dev->dev, 0x10, sd->colors); + reg_w(gspca_dev, 0xff, 0x01); + reg_w(gspca_dev, 0x10, sd->colors); /* load registers to sensor (Bit 0, auto clear) */ - pac7311_reg_write(gspca_dev->dev, 0x11, 0x01); + reg_w(gspca_dev, 0x11, 0x01); PDEBUG(D_CONF|D_STREAM, "color: %i", sd->colors); } /* this function is called at open time */ static int sd_open(struct gspca_dev *gspca_dev) { - pac7311_reg_write(gspca_dev->dev, 0x78, 0x00); /* Turn on LED */ + reg_w(gspca_dev, 0x78, 0x00); /* Turn on LED */ return 0; } static void sd_start(struct gspca_dev *gspca_dev) { - struct usb_device *dev = gspca_dev->dev; struct sd *sd = (struct sd *) gspca_dev; - pac7311_reg_write(dev, 0xff, 0x01); - reg_w(dev, 0x0002, "\x48\x0a\x40\x08\x00\x00\x08\x00", 8); - reg_w(dev, 0x000a, "\x06\xff\x11\xff\x5a\x30\x90\x4c", 8); - reg_w(dev, 0x0012, "\x00\x07\x00\x0a\x10\x00\xa0\x10", 8); - reg_w(dev, 0x001a, "\x02\x00\x00\x00\x00\x0b\x01\x00", 8); - reg_w(dev, 0x0022, "\x00\x00\x00\x00\x00\x00\x00\x00", 8); - reg_w(dev, 0x002a, "\x00\x00\x00", 3); - reg_w(dev, 0x003e, "\x00\x00\x78\x52\x4a\x52\x78\x6e", 8); - reg_w(dev, 0x0046, "\x48\x46\x48\x6e\x5f\x49\x42\x49", 8); - reg_w(dev, 0x004e, "\x5f\x5f\x49\x42\x49\x5f\x6e\x48", 8); - reg_w(dev, 0x0056, "\x46\x48\x6e\x78\x52\x4a\x52\x78", 8); - reg_w(dev, 0x005e, "\x00\x00\x09\x1b\x34\x49\x5c\x9b", 8); - reg_w(dev, 0x0066, "\xd0\xff", 2); - reg_w(dev, 0x0078, "\x44\x00\xf2\x01\x01\x80", 6); - reg_w(dev, 0x007f, "\x2a\x1c\x00\xc8\x02\x58\x03\x84", 8); - reg_w(dev, 0x0087, "\x12\x00\x1a\x04\x08\x0c\x10\x14", 8); - reg_w(dev, 0x008f, "\x18\x20", 2); - reg_w(dev, 0x0096, "\x01\x08\x04", 3); - reg_w(dev, 0x00a0, "\x44\x44\x44\x04", 4); - reg_w(dev, 0x00f0, "\x01\x00\x00\x00\x22\x00\x20\x00", 8); - reg_w(dev, 0x00f8, "\x3f\x00\x0a\x01\x00", 5); - - pac7311_reg_write(dev, 0xff, 0x04); - pac7311_reg_write(dev, 0x02, 0x04); - pac7311_reg_write(dev, 0x03, 0x54); - pac7311_reg_write(dev, 0x04, 0x07); - pac7311_reg_write(dev, 0x05, 0x2b); - pac7311_reg_write(dev, 0x06, 0x09); - pac7311_reg_write(dev, 0x07, 0x0f); - pac7311_reg_write(dev, 0x08, 0x09); - pac7311_reg_write(dev, 0x09, 0x00); - pac7311_reg_write(dev, 0x0c, 0x07); - pac7311_reg_write(dev, 0x0d, 0x00); - pac7311_reg_write(dev, 0x0e, 0x00); - pac7311_reg_write(dev, 0x0f, 0x62); - pac7311_reg_write(dev, 0x10, 0x08); - pac7311_reg_write(dev, 0x12, 0x07); - pac7311_reg_write(dev, 0x13, 0x00); - pac7311_reg_write(dev, 0x14, 0x00); - pac7311_reg_write(dev, 0x15, 0x00); - pac7311_reg_write(dev, 0x16, 0x00); - pac7311_reg_write(dev, 0x17, 0x00); - pac7311_reg_write(dev, 0x18, 0x00); - pac7311_reg_write(dev, 0x19, 0x00); - pac7311_reg_write(dev, 0x1a, 0x00); - pac7311_reg_write(dev, 0x1b, 0x03); - pac7311_reg_write(dev, 0x1c, 0xa0); - pac7311_reg_write(dev, 0x1d, 0x01); - pac7311_reg_write(dev, 0x1e, 0xf4); - pac7311_reg_write(dev, 0x21, 0x00); - pac7311_reg_write(dev, 0x22, 0x08); - pac7311_reg_write(dev, 0x24, 0x03); - pac7311_reg_write(dev, 0x26, 0x00); - pac7311_reg_write(dev, 0x27, 0x01); - pac7311_reg_write(dev, 0x28, 0xca); - pac7311_reg_write(dev, 0x29, 0x10); - pac7311_reg_write(dev, 0x2a, 0x06); - pac7311_reg_write(dev, 0x2b, 0x78); - pac7311_reg_write(dev, 0x2c, 0x00); - pac7311_reg_write(dev, 0x2d, 0x00); - pac7311_reg_write(dev, 0x2e, 0x00); - pac7311_reg_write(dev, 0x2f, 0x00); - pac7311_reg_write(dev, 0x30, 0x23); - pac7311_reg_write(dev, 0x31, 0x28); - pac7311_reg_write(dev, 0x32, 0x04); - pac7311_reg_write(dev, 0x33, 0x11); - pac7311_reg_write(dev, 0x34, 0x00); - pac7311_reg_write(dev, 0x35, 0x00); - pac7311_reg_write(dev, 0x11, 0x01); + reg_w(gspca_dev, 0xff, 0x01); + reg_w_buf(gspca_dev, 0x0002, "\x48\x0a\x40\x08\x00\x00\x08\x00", 8); + reg_w_buf(gspca_dev, 0x000a, "\x06\xff\x11\xff\x5a\x30\x90\x4c", 8); + reg_w_buf(gspca_dev, 0x0012, "\x00\x07\x00\x0a\x10\x00\xa0\x10", 8); + reg_w_buf(gspca_dev, 0x001a, "\x02\x00\x00\x00\x00\x0b\x01\x00", 8); + reg_w_buf(gspca_dev, 0x0022, "\x00\x00\x00\x00\x00\x00\x00\x00", 8); + reg_w_buf(gspca_dev, 0x002a, "\x00\x00\x00", 3); + reg_w_buf(gspca_dev, 0x003e, "\x00\x00\x78\x52\x4a\x52\x78\x6e", 8); + reg_w_buf(gspca_dev, 0x0046, "\x48\x46\x48\x6e\x5f\x49\x42\x49", 8); + reg_w_buf(gspca_dev, 0x004e, "\x5f\x5f\x49\x42\x49\x5f\x6e\x48", 8); + reg_w_buf(gspca_dev, 0x0056, "\x46\x48\x6e\x78\x52\x4a\x52\x78", 8); + reg_w_buf(gspca_dev, 0x005e, "\x00\x00\x09\x1b\x34\x49\x5c\x9b", 8); + reg_w_buf(gspca_dev, 0x0066, "\xd0\xff", 2); + reg_w_buf(gspca_dev, 0x0078, "\x44\x00\xf2\x01\x01\x80", 6); + reg_w_buf(gspca_dev, 0x007f, "\x2a\x1c\x00\xc8\x02\x58\x03\x84", 8); + reg_w_buf(gspca_dev, 0x0087, "\x12\x00\x1a\x04\x08\x0c\x10\x14", 8); + reg_w_buf(gspca_dev, 0x008f, "\x18\x20", 2); + reg_w_buf(gspca_dev, 0x0096, "\x01\x08\x04", 3); + reg_w_buf(gspca_dev, 0x00a0, "\x44\x44\x44\x04", 4); + reg_w_buf(gspca_dev, 0x00f0, "\x01\x00\x00\x00\x22\x00\x20\x00", 8); + reg_w_buf(gspca_dev, 0x00f8, "\x3f\x00\x0a\x01\x00", 5); + + reg_w(gspca_dev, 0xff, 0x04); + reg_w(gspca_dev, 0x02, 0x04); + reg_w(gspca_dev, 0x03, 0x54); + reg_w(gspca_dev, 0x04, 0x07); + reg_w(gspca_dev, 0x05, 0x2b); + reg_w(gspca_dev, 0x06, 0x09); + reg_w(gspca_dev, 0x07, 0x0f); + reg_w(gspca_dev, 0x08, 0x09); + reg_w(gspca_dev, 0x09, 0x00); + reg_w(gspca_dev, 0x0c, 0x07); + reg_w(gspca_dev, 0x0d, 0x00); + reg_w(gspca_dev, 0x0e, 0x00); + reg_w(gspca_dev, 0x0f, 0x62); + reg_w(gspca_dev, 0x10, 0x08); + reg_w(gspca_dev, 0x12, 0x07); + reg_w(gspca_dev, 0x13, 0x00); + reg_w(gspca_dev, 0x14, 0x00); + reg_w(gspca_dev, 0x15, 0x00); + reg_w(gspca_dev, 0x16, 0x00); + reg_w(gspca_dev, 0x17, 0x00); + reg_w(gspca_dev, 0x18, 0x00); + reg_w(gspca_dev, 0x19, 0x00); + reg_w(gspca_dev, 0x1a, 0x00); + reg_w(gspca_dev, 0x1b, 0x03); + reg_w(gspca_dev, 0x1c, 0xa0); + reg_w(gspca_dev, 0x1d, 0x01); + reg_w(gspca_dev, 0x1e, 0xf4); + reg_w(gspca_dev, 0x21, 0x00); + reg_w(gspca_dev, 0x22, 0x08); + reg_w(gspca_dev, 0x24, 0x03); + reg_w(gspca_dev, 0x26, 0x00); + reg_w(gspca_dev, 0x27, 0x01); + reg_w(gspca_dev, 0x28, 0xca); + reg_w(gspca_dev, 0x29, 0x10); + reg_w(gspca_dev, 0x2a, 0x06); + reg_w(gspca_dev, 0x2b, 0x78); + reg_w(gspca_dev, 0x2c, 0x00); + reg_w(gspca_dev, 0x2d, 0x00); + reg_w(gspca_dev, 0x2e, 0x00); + reg_w(gspca_dev, 0x2f, 0x00); + reg_w(gspca_dev, 0x30, 0x23); + reg_w(gspca_dev, 0x31, 0x28); + reg_w(gspca_dev, 0x32, 0x04); + reg_w(gspca_dev, 0x33, 0x11); + reg_w(gspca_dev, 0x34, 0x00); + reg_w(gspca_dev, 0x35, 0x00); + reg_w(gspca_dev, 0x11, 0x01); setcontrast(gspca_dev); setbrightness(gspca_dev); setcolors(gspca_dev); @@ -407,39 +402,39 @@ static void sd_start(struct gspca_dev *gspca_dev) /* set correct resolution */ switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) { case 2: /* 160x120 */ - pac7311_reg_write(dev, 0xff, 0x04); - pac7311_reg_write(dev, 0x02, 0x03); - pac7311_reg_write(dev, 0xff, 0x01); - pac7311_reg_write(dev, 0x08, 0x09); - pac7311_reg_write(dev, 0x17, 0x20); - pac7311_reg_write(dev, 0x1b, 0x00); -/* pac7311_reg_write(dev, 0x80, 0x69); */ - pac7311_reg_write(dev, 0x87, 0x10); + reg_w(gspca_dev, 0xff, 0x04); + reg_w(gspca_dev, 0x02, 0x03); + reg_w(gspca_dev, 0xff, 0x01); + reg_w(gspca_dev, 0x08, 0x09); + reg_w(gspca_dev, 0x17, 0x20); + reg_w(gspca_dev, 0x1b, 0x00); +/* reg_w(gspca_dev, 0x80, 0x69); */ + reg_w(gspca_dev, 0x87, 0x10); break; case 1: /* 320x240 */ - pac7311_reg_write(dev, 0xff, 0x04); - pac7311_reg_write(dev, 0x02, 0x03); - pac7311_reg_write(dev, 0xff, 0x01); - pac7311_reg_write(dev, 0x08, 0x09); - pac7311_reg_write(dev, 0x17, 0x30); -/* pac7311_reg_write(dev, 0x80, 0x3f); */ - pac7311_reg_write(dev, 0x87, 0x11); + reg_w(gspca_dev, 0xff, 0x04); + reg_w(gspca_dev, 0x02, 0x03); + reg_w(gspca_dev, 0xff, 0x01); + reg_w(gspca_dev, 0x08, 0x09); + reg_w(gspca_dev, 0x17, 0x30); +/* reg_w(gspca_dev, 0x80, 0x3f); */ + reg_w(gspca_dev, 0x87, 0x11); break; case 0: /* 640x480 */ - pac7311_reg_write(dev, 0xff, 0x04); - pac7311_reg_write(dev, 0x02, 0x03); - pac7311_reg_write(dev, 0xff, 0x01); - pac7311_reg_write(dev, 0x08, 0x08); - pac7311_reg_write(dev, 0x17, 0x00); -/* pac7311_reg_write(dev, 0x80, 0x1c); */ - pac7311_reg_write(dev, 0x87, 0x12); + reg_w(gspca_dev, 0xff, 0x04); + reg_w(gspca_dev, 0x02, 0x03); + reg_w(gspca_dev, 0xff, 0x01); + reg_w(gspca_dev, 0x08, 0x08); + reg_w(gspca_dev, 0x17, 0x00); +/* reg_w(gspca_dev, 0x80, 0x1c); */ + reg_w(gspca_dev, 0x87, 0x12); break; } /* start stream */ - pac7311_reg_write(dev, 0xff, 0x01); - pac7311_reg_write(dev, 0x78, 0x04); - pac7311_reg_write(dev, 0x78, 0x05); + reg_w(gspca_dev, 0xff, 0x01); + reg_w(gspca_dev, 0x78, 0x04); + reg_w(gspca_dev, 0x78, 0x05); if (sd->autogain) { sd->ag_cnt = AG_CNT_START; @@ -451,18 +446,16 @@ static void sd_start(struct gspca_dev *gspca_dev) static void sd_stopN(struct gspca_dev *gspca_dev) { - struct usb_device *dev = gspca_dev->dev; - - pac7311_reg_write(dev, 0xff, 0x04); - pac7311_reg_write(dev, 0x27, 0x80); - pac7311_reg_write(dev, 0x28, 0xca); - pac7311_reg_write(dev, 0x29, 0x53); - pac7311_reg_write(dev, 0x2a, 0x0e); - pac7311_reg_write(dev, 0xff, 0x01); - pac7311_reg_write(dev, 0x3e, 0x20); - pac7311_reg_write(dev, 0x78, 0x04); /* Bit_0=start stream, Bit_7=LED */ - pac7311_reg_write(dev, 0x78, 0x44); /* Bit_0=start stream, Bit_7=LED */ - pac7311_reg_write(dev, 0x78, 0x44); /* Bit_0=start stream, Bit_7=LED */ + reg_w(gspca_dev, 0xff, 0x04); + reg_w(gspca_dev, 0x27, 0x80); + reg_w(gspca_dev, 0x28, 0xca); + reg_w(gspca_dev, 0x29, 0x53); + reg_w(gspca_dev, 0x2a, 0x0e); + reg_w(gspca_dev, 0xff, 0x01); + reg_w(gspca_dev, 0x3e, 0x20); + reg_w(gspca_dev, 0x78, 0x04); /* Bit_0=start stream, Bit_7=LED */ + reg_w(gspca_dev, 0x78, 0x44); /* Bit_0=start stream, Bit_7=LED */ + reg_w(gspca_dev, 0x78, 0x44); /* Bit_0=start stream, Bit_7=LED */ } static void sd_stop0(struct gspca_dev *gspca_dev) @@ -472,18 +465,16 @@ static void sd_stop0(struct gspca_dev *gspca_dev) /* this function is called at close time */ static void sd_close(struct gspca_dev *gspca_dev) { - struct usb_device *dev = gspca_dev->dev; - - pac7311_reg_write(dev, 0xff, 0x04); - pac7311_reg_write(dev, 0x27, 0x80); - pac7311_reg_write(dev, 0x28, 0xca); - pac7311_reg_write(dev, 0x29, 0x53); - pac7311_reg_write(dev, 0x2a, 0x0e); - pac7311_reg_write(dev, 0xff, 0x01); - pac7311_reg_write(dev, 0x3e, 0x20); - pac7311_reg_write(dev, 0x78, 0x04); /* Bit_0=start stream, Bit_7=LED */ - pac7311_reg_write(dev, 0x78, 0x44); /* Bit_0=start stream, Bit_7=LED */ - pac7311_reg_write(dev, 0x78, 0x44); /* Bit_0=start stream, Bit_7=LED */ + reg_w(gspca_dev, 0xff, 0x04); + reg_w(gspca_dev, 0x27, 0x80); + reg_w(gspca_dev, 0x28, 0xca); + reg_w(gspca_dev, 0x29, 0x53); + reg_w(gspca_dev, 0x2a, 0x0e); + reg_w(gspca_dev, 0xff, 0x01); + reg_w(gspca_dev, 0x3e, 0x20); + reg_w(gspca_dev, 0x78, 0x04); /* Bit_0=start stream, Bit_7=LED */ + reg_w(gspca_dev, 0x78, 0x44); /* Bit_0=start stream, Bit_7=LED */ + reg_w(gspca_dev, 0x78, 0x44); /* Bit_0=start stream, Bit_7=LED */ } static void setautogain(struct gspca_dev *gspca_dev, int luma) @@ -491,11 +482,9 @@ static void setautogain(struct gspca_dev *gspca_dev, int luma) int luma_mean = 128; int luma_delta = 20; __u8 spring = 5; - __u8 Pxclk; int Gbright; - pac7311_reg_read(gspca_dev->dev, 0x02, &Pxclk); - Gbright = Pxclk; + Gbright = reg_r(gspca_dev, 0x02); PDEBUG(D_FRAM, "luma mean %d", luma); if (luma < luma_mean - luma_delta || luma > luma_mean + luma_delta) { @@ -505,10 +494,10 @@ static void setautogain(struct gspca_dev *gspca_dev, int luma) else if (Gbright < 4) Gbright = 4; PDEBUG(D_FRAM, "gbright %d", Gbright); - pac7311_reg_write(gspca_dev->dev, 0xff, 0x04); - pac7311_reg_write(gspca_dev->dev, 0x0f, Gbright); + reg_w(gspca_dev, 0xff, 0x04); + reg_w(gspca_dev, 0x0f, Gbright); /* load registers to sensor (Bit 0, auto clear) */ - pac7311_reg_write(gspca_dev->dev, 0x11, 0x01); + reg_w(gspca_dev, 0x11, 0x01); } } @@ -623,22 +612,16 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, static void getbrightness(struct gspca_dev *gspca_dev) { -/* __u8 brightness = 0; - - pac7311_reg_read(gspca_dev->dev, 0x0008, &brightness); - spca50x->brightness = brightness; - return spca50x->brightness; */ +/* sd->brightness = reg_r(gspca_dev, 0x08); + return sd->brightness; */ /* PDEBUG(D_CONF, "Called pac7311_getbrightness: Not implemented yet"); */ } #if 0 static void getcontrast(struct gspca_dev *gspca_dev) { -/* __u8 contrast = 0; - - pac7311_reg_read(gspca_dev->dev, 0x000e, &contrast); - spca50x->contrast = contrast << 3; - return spca50x->contrast; */ +/* sd->contrast = reg_r(gspca_dev, 0x0e); + return sd->contrast; */ PDEBUG(D_CONF, "getcontrast: Not implemented yet"); } #endif diff --git a/linux/drivers/media/video/gspca/sonixb.c b/linux/drivers/media/video/gspca/sonixb.c index a4594dc0e..255d12c5a 100644 --- a/linux/drivers/media/video/gspca/sonixb.c +++ b/linux/drivers/media/video/gspca/sonixb.c @@ -24,8 +24,8 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) -static const char version[] = "2.1.5"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7) +static const char version[] = "2.1.7"; MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_DESCRIPTION("GSPCA/SN9C102 USB Camera Driver"); @@ -35,8 +35,16 @@ MODULE_LICENSE("GPL"); struct sd { struct gspca_dev gspca_dev; /* !! must be the first item */ + struct sd_desc sd_desc; /* our nctrls differ dependend upon the + sensor, so we use a per cam copy */ + atomic_t avg_lum; + + unsigned char gain; + unsigned char exposure; unsigned char brightness; - unsigned char contrast; + unsigned char autogain; + unsigned char autogain_ignore_frames; + unsigned char freq; /* light freq filter setting */ unsigned char fr_h_sz; /* size of frame header */ char sensor; /* Type of image sensor chip */ @@ -48,6 +56,8 @@ struct sd { #define SENSOR_PAS202 5 #define SENSOR_TAS5110 6 #define SENSOR_TAS5130CXX 7 + char sensor_has_gain; + __u8 sensor_addr; }; #define COMP2 0x8f @@ -59,14 +69,28 @@ struct sd { #define SYS_CLK 0x04 +/* We calculate the autogain at the end of the transfer of a frame, at this + moment a frame with the old settings is being transmitted, and a frame is + being captured with the old settings. So if we adjust the autogain we must + ignore atleast the 2 next frames for the new settings to come into effect + before doing any other adjustments */ +#define AUTOGAIN_IGNORE_FRAMES 3 +#define AUTOGAIN_DEADZONE 1000 +#define DESIRED_AVG_LUM 7000 + /* 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_setgain(struct gspca_dev *gspca_dev, __s32 val); +static int sd_getgain(struct gspca_dev *gspca_dev, __s32 *val); +static int sd_setexposure(struct gspca_dev *gspca_dev, __s32 val); +static int sd_getexposure(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_setfreq(struct gspca_dev *gspca_dev, __s32 val); +static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val); static struct ctrl sd_ctrls[] = { -#define SD_BRIGHTNESS 0 { { .id = V4L2_CID_BRIGHTNESS, @@ -75,24 +99,71 @@ static struct ctrl sd_ctrls[] = { .minimum = 0, .maximum = 255, .step = 1, - .default_value = 127, +#define BRIGHTNESS_DEF 127 + .default_value = BRIGHTNESS_DEF, }, .set = sd_setbrightness, .get = sd_getbrightness, }, -#define SD_CONTRAST 1 { { - .id = V4L2_CID_CONTRAST, + .id = V4L2_CID_GAIN, .type = V4L2_CTRL_TYPE_INTEGER, - .name = "Contrast", + .name = "Gain", .minimum = 0, .maximum = 255, .step = 1, - .default_value = 127, +#define GAIN_DEF 127 +#define GAIN_KNEE 200 + .default_value = GAIN_DEF, }, - .set = sd_setcontrast, - .get = sd_getcontrast, + .set = sd_setgain, + .get = sd_getgain, + }, + { + { + .id = V4L2_CID_EXPOSURE, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Exposure", +#define EXPOSURE_DEF 16 /* 32 ms / 30 fps */ +#define EXPOSURE_KNEE 50 /* 100 ms / 10 fps */ + .minimum = 0, + .maximum = 255, + .step = 1, + .default_value = EXPOSURE_DEF, + .flags = 0, + }, + .set = sd_setexposure, + .get = sd_getexposure, + }, + { + { + .id = V4L2_CID_AUTOGAIN, + .type = V4L2_CTRL_TYPE_BOOLEAN, + .name = "Automatic Gain (and Exposure)", + .minimum = 0, + .maximum = 1, + .step = 1, +#define AUTOGAIN_DEF 1 + .default_value = AUTOGAIN_DEF, + .flags = 0, + }, + .set = sd_setautogain, + .get = sd_getautogain, + }, + { + { + .id = V4L2_CID_POWER_LINE_FREQUENCY, + .type = V4L2_CTRL_TYPE_MENU, + .name = "Light frequency filter", + .minimum = 0, + .maximum = 2, /* 0: 0, 1: 50Hz, 2:60Hz */ + .step = 1, +#define FREQ_DEF 1 + .default_value = FREQ_DEF, + }, + .set = sd_setfreq, + .get = sd_getfreq, }, }; @@ -161,8 +232,12 @@ static const __u8 ov6650_sensor_init[][8] = /* Bright, contrast, etc are set througth SCBB interface. * AVCAP on win2 do not send any data on this controls. */ /* Anyway, some registers appears to alter bright and constrat */ + + /* Reset sensor */ {0xa0, 0x60, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10}, + /* Set clock register 0x11 low nibble is clock divider */ {0xd0, 0x60, 0x11, 0xc0, 0x1b, 0x18, 0xc1, 0x10}, + /* Next some unknown stuff */ {0xb0, 0x60, 0x15, 0x00, 0x02, 0x18, 0xc1, 0x10}, /* {0xa0, 0x60, 0x1b, 0x01, 0x02, 0x18, 0xc1, 0x10}, * THIS SET GREEN SCREEN @@ -171,31 +246,31 @@ static const __u8 ov6650_sensor_init[][8] = {0xd0, 0x60, 0x26, 0x01, 0x14, 0xd8, 0xa4, 0x10}, /* format out? */ {0xd0, 0x60, 0x26, 0x01, 0x14, 0xd8, 0xa4, 0x10}, {0xa0, 0x60, 0x30, 0x3d, 0x0A, 0xd8, 0xa4, 0x10}, + /* Disable autobright ? */ {0xb0, 0x60, 0x60, 0x66, 0x68, 0xd8, 0xa4, 0x10}, + /* Some more unknown stuff */ {0xa0, 0x60, 0x68, 0x04, 0x68, 0xd8, 0xa4, 0x10}, {0xd0, 0x60, 0x17, 0x24, 0xd6, 0x04, 0x94, 0x10}, /* Clipreg */ - {0xa0, 0x60, 0x10, 0x5d, 0x99, 0x04, 0x94, 0x16}, +#if 0 + /* HDG, don't change registers 0x2d, 0x32 & 0x33 from their reset + defaults, doing so mucks up the framerate, where as the defaults + seem to work good, the combinations below have been observed + under windows and are kept for future reference */ {0xa0, 0x60, 0x2d, 0x0a, 0x99, 0x04, 0x94, 0x16}, {0xa0, 0x60, 0x32, 0x00, 0x99, 0x04, 0x94, 0x16}, {0xa0, 0x60, 0x33, 0x40, 0x99, 0x04, 0x94, 0x16}, - {0xa0, 0x60, 0x11, 0xc0, 0x99, 0x04, 0x94, 0x16}, - {0xa0, 0x60, 0x00, 0x16, 0x99, 0x04, 0x94, 0x15}, /* bright / Lumino */ - {0xa0, 0x60, 0x2b, 0xab, 0x99, 0x04, 0x94, 0x15}, - /* ?flicker o brillo */ {0xa0, 0x60, 0x2d, 0x2a, 0x99, 0x04, 0x94, 0x15}, {0xa0, 0x60, 0x2d, 0x2b, 0x99, 0x04, 0x94, 0x16}, {0xa0, 0x60, 0x32, 0x00, 0x99, 0x04, 0x94, 0x16}, {0xa0, 0x60, 0x33, 0x00, 0x99, 0x04, 0x94, 0x16}, - {0xa0, 0x60, 0x10, 0x57, 0x99, 0x04, 0x94, 0x16}, {0xa0, 0x60, 0x2d, 0x2b, 0x99, 0x04, 0x94, 0x16}, {0xa0, 0x60, 0x32, 0x00, 0x99, 0x04, 0x94, 0x16}, /* Low Light (Enabled: 0x32 0x1 | Disabled: 0x32 0x00) */ {0xa0, 0x60, 0x33, 0x29, 0x99, 0x04, 0x94, 0x16}, /* Low Ligth (Enabled: 0x33 0x13 | Disabled: 0x33 0x29) */ -/* {0xa0, 0x60, 0x11, 0xc1, 0x99, 0x04, 0x94, 0x16}, */ - {0xa0, 0x60, 0x00, 0x17, 0x99, 0x04, 0x94, 0x15}, /* clip? r */ - {0xa0, 0x60, 0x00, 0x18, 0x99, 0x04, 0x94, 0x15}, /* clip? r */ +#endif }; + static const __u8 initOv7630[] = { 0x04, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, /* r01 .. r08 */ 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* r09 .. r10 */ @@ -207,16 +282,18 @@ static const __u8 initOv7630[] = { static const __u8 initOv7630_3[] = { 0x44, 0x44, 0x00, 0x1a, 0x20, 0x20, 0x20, 0x80, /* r01 .. r08 */ 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, /* r09 .. r10 */ - 0x00, 0x02, 0x01, 0x0a, /* r11 .. r14 */ + 0x00, 0x01, 0x01, 0x0a, /* r11 .. r14 */ 0x28, 0x1e, /* H & V sizes r15 .. r16 */ - 0x68, COMP1, MCK_INIT1, /* r17 .. r19 */ - 0x1d, 0x10, 0x02, 0x03, 0x0f, 0x0c /* r1a .. r1f */ + 0x68, 0x8f, MCK_INIT1, /* r17 .. r19 */ + 0x1d, 0x10, 0x02, 0x03, 0x0f, 0x0c, 0x00, /* r1a .. r20 */ + 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x80, /* r21 .. r28 */ + 0x90, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0, 0xff /* r29 .. r30 */ }; static const __u8 ov7630_sensor_init_com[][8] = { {0xa0, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10}, {0xb0, 0x21, 0x01, 0x77, 0x3a, 0x00, 0x00, 0x10}, /* {0xd0, 0x21, 0x12, 0x7c, 0x01, 0x80, 0x34, 0x10}, jfm */ - {0xd0, 0x21, 0x12, 0x78, 0x00, 0x80, 0x34, 0x10}, /* jfm */ + {0xd0, 0x21, 0x12, 0x1c, 0x00, 0x80, 0x34, 0x10}, /* jfm */ {0xa0, 0x21, 0x1b, 0x04, 0x00, 0x80, 0x34, 0x10}, {0xa0, 0x21, 0x20, 0x44, 0x00, 0x80, 0x34, 0x10}, {0xa0, 0x21, 0x23, 0xee, 0x00, 0x80, 0x34, 0x10}, @@ -224,8 +301,8 @@ static const __u8 ov7630_sensor_init_com[][8] = { {0xb0, 0x21, 0x2a, 0x80, 0x00, 0xa0, 0x30, 0x10}, {0xb0, 0x21, 0x2f, 0x3d, 0x24, 0xa0, 0x30, 0x10}, {0xa0, 0x21, 0x32, 0x86, 0x24, 0xa0, 0x30, 0x10}, -/* {0xb0, 0x21, 0x60, 0xa9, 0x4a, 0xa0, 0x30, 0x10}, jfm */ - {0xb0, 0x21, 0x60, 0xa9, 0x42, 0xa0, 0x30, 0x10}, /* jfm */ + {0xb0, 0x21, 0x60, 0xa9, 0x4a, 0xa0, 0x30, 0x10}, +/* {0xb0, 0x21, 0x60, 0xa9, 0x42, 0xa0, 0x30, 0x10}, * jfm */ {0xa0, 0x21, 0x65, 0x00, 0x42, 0xa0, 0x30, 0x10}, {0xa0, 0x21, 0x69, 0x38, 0x42, 0xa0, 0x30, 0x10}, {0xc0, 0x21, 0x6f, 0x88, 0x0b, 0x00, 0x30, 0x10}, @@ -241,14 +318,8 @@ static const __u8 ov7630_sensor_init[][8] = { {0xa0, 0x21, 0x00, 0x10, 0xbd, 0x06, 0xf6, 0x15}, /* gain */ }; static const __u8 ov7630_sensor_init_3[][8] = { - {0xa0, 0x21, 0x10, 0x36, 0xbd, 0x06, 0xf6, 0x16}, /* exposure */ - {0xa0, 0x21, 0x76, 0x03, 0xbd, 0x06, 0xf6, 0x16}, - {0xa0, 0x21, 0x11, 0x01, 0xbd, 0x06, 0xf6, 0x16}, - {0xa0, 0x21, 0x00, 0x10, 0xbd, 0x06, 0xf6, 0x15}, /* gain */ -/* {0xb0, 0x21, 0x2a, 0xc0, 0x3c, 0x06, 0xf6, 0x1d}, - * a0 1c,a0 1f,c0 3c frame rate ?line interval from ov6630 */ -/* {0xb0, 0x21, 0x2a, 0xa0, 0x1f, 0x06, 0xf6, 0x1d}, * from win */ - {0xb0, 0x21, 0x2a, 0xa0, 0x1c, 0x06, 0xf6, 0x1d}, + {0xa0, 0x21, 0x2a, 0xa0, 0x00, 0x00, 0x00, 0x10}, + {0xa0, 0x21, 0x2a, 0x80, 0x00, 0x00, 0x00, 0x10}, }; static const __u8 initPas106[] = { @@ -346,64 +417,85 @@ static const __u8 tas5130_sensor_init[][8] = { {0x30, 0x11, 0x02, 0x20, 0x70, 0x00, 0x00, 0x10}, }; -static void reg_r(struct usb_device *dev, - __u16 value, __u8 *buffer) +/* get one byte in gspca_dev->usb_buf */ +static void reg_r(struct gspca_dev *gspca_dev, + __u16 value) { - usb_control_msg(dev, - usb_rcvctrlpipe(dev, 0), + usb_control_msg(gspca_dev->dev, + usb_rcvctrlpipe(gspca_dev->dev, 0), 0, /* request */ USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, value, 0, /* index */ - buffer, 1, + gspca_dev->usb_buf, 1, 500); } -static void reg_w(struct usb_device *dev, - __u16 value, - const __u8 *buffer, - int len) +static void reg_w(struct gspca_dev *gspca_dev, + __u16 value, + const __u8 *buffer, + int len) { - __u8 tmpbuf[32]; - #ifdef CONFIG_VIDEO_ADV_DEBUG - if (len > sizeof tmpbuf) { + if (len > sizeof gspca_dev->usb_buf) { PDEBUG(D_ERR|D_PACK, "reg_w: buffer overflow"); return; } #endif + memcpy(gspca_dev->usb_buf, buffer, len); + usb_control_msg(gspca_dev->dev, + usb_sndctrlpipe(gspca_dev->dev, 0), + 0x08, /* request */ + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, + value, + 0, /* index */ + gspca_dev->usb_buf, len, + 500); +} + +static void reg_w_big(struct gspca_dev *gspca_dev, + __u16 value, + const __u8 *buffer, + int len) +{ + __u8 *tmpbuf; + + tmpbuf = kmalloc(len, GFP_KERNEL); memcpy(tmpbuf, buffer, len); - usb_control_msg(dev, - usb_sndctrlpipe(dev, 0), + usb_control_msg(gspca_dev->dev, + usb_sndctrlpipe(gspca_dev->dev, 0), 0x08, /* request */ USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, value, 0, /* index */ tmpbuf, len, 500); + kfree(tmpbuf); } -static int i2c_w(struct usb_device *dev, const __u8 *buffer) +static int i2c_w(struct gspca_dev *gspca_dev, const __u8 *buffer) { int retry = 60; - __u8 ByteReceive; /* is i2c ready */ - reg_w(dev, 0x08, buffer, 8); + reg_w(gspca_dev, 0x08, buffer, 8); while (retry--) { msleep(10); - reg_r(dev, 0x08, &ByteReceive); - if (ByteReceive == 4) + reg_r(gspca_dev, 0x08); + if (gspca_dev->usb_buf[0] & 0x04) { + if (gspca_dev->usb_buf[0] & 0x08) + return -1; return 0; + } } return -1; } -static void i2c_w_vector(struct usb_device *dev, +static void i2c_w_vector(struct gspca_dev *gspca_dev, const __u8 buffer[][8], int len) { for (;;) { - reg_w(dev, 0x08, *buffer, 8); + reg_w(gspca_dev, 0x08, *buffer, 8); len -= 8; if (len <= 0) break; @@ -417,22 +509,16 @@ static void setbrightness(struct gspca_dev *gspca_dev) __u8 value; switch (sd->sensor) { - case SENSOR_OV6650: { - __u8 i2cOV6650[] = - {0xa0, 0x60, 0x06, 0x11, 0x99, 0x04, 0x94, 0x15}; - - i2cOV6650[3] = sd->brightness; - if (i2c_w(gspca_dev->dev, i2cOV6650) < 0) - goto err; - break; - } + case SENSOR_OV6650: + case SENSOR_OV7630_3: case SENSOR_OV7630: { __u8 i2cOV[] = - {0xa0, 0x21, 0x06, 0x36, 0xbd, 0x06, 0xf6, 0x16}; + {0xa0, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x10}; /* change reg 0x06 */ + i2cOV[1] = sd->sensor_addr; i2cOV[3] = sd->brightness; - if (i2c_w(gspca_dev->dev, i2cOV) < 0) + if (i2c_w(gspca_dev, i2cOV) < 0) goto err; break; } @@ -442,11 +528,11 @@ static void setbrightness(struct gspca_dev *gspca_dev) i2c1[3] = sd->brightness >> 3; i2c1[2] = 0x0e; - if (i2c_w(gspca_dev->dev, i2c1) < 0) + if (i2c_w(gspca_dev, i2c1) < 0) goto err; i2c1[3] = 0x01; i2c1[2] = 0x13; - if (i2c_w(gspca_dev->dev, i2c1) < 0) + if (i2c_w(gspca_dev, i2c1) < 0) goto err; break; } @@ -462,51 +548,228 @@ static void setbrightness(struct gspca_dev *gspca_dev) /* change reg 0x10 */ i2cpexpo[4] = 0xff - sd->brightness; -/* if(i2c_w(gspca_dev->dev,i2cpexpo1) < 0) +/* if(i2c_w(gspca_dev,i2cpexpo1) < 0) goto err; */ -/* if(i2c_w(gspca_dev->dev,i2cpdoit) < 0) +/* if(i2c_w(gspca_dev,i2cpdoit) < 0) goto err; */ - if (i2c_w(gspca_dev->dev, i2cpexpo) < 0) + if (i2c_w(gspca_dev, i2cpexpo) < 0) goto err; - if (i2c_w(gspca_dev->dev, i2cpdoit) < 0) + if (i2c_w(gspca_dev, i2cpdoit) < 0) goto err; i2cp202[3] = sd->brightness >> 3; - if (i2c_w(gspca_dev->dev, i2cp202) < 0) + if (i2c_w(gspca_dev, i2cp202) < 0) goto err; - if (i2c_w(gspca_dev->dev, i2cpdoit) < 0) + if (i2c_w(gspca_dev, i2cpdoit) < 0) goto err; break; } - case SENSOR_TAS5130CXX: - case SENSOR_TAS5110: { + case SENSOR_TAS5130CXX: { __u8 i2c[] = {0x30, 0x11, 0x02, 0x20, 0x70, 0x00, 0x00, 0x10}; value = 0xff - sd->brightness; i2c[4] = value; PDEBUG(D_CONF, "brightness %d : %d", value, i2c[4]); - if (i2c_w(gspca_dev->dev, i2c) < 0) + if (i2c_w(gspca_dev, i2c) < 0) goto err; break; } + case SENSOR_TAS5110: + /* FIXME figure out howto control brightness on TAS5110 */ + break; } return; err: PDEBUG(D_ERR, "i2c error brightness"); } -static void setcontrast(struct gspca_dev *gspca_dev) + +static void setsensorgain(struct gspca_dev *gspca_dev) +{ + struct sd *sd = (struct sd *) gspca_dev; + unsigned char gain = sd->gain; + + switch (sd->sensor) { + + case SENSOR_TAS5110: { + __u8 i2c[] = + {0x30, 0x11, 0x02, 0x20, 0x70, 0x00, 0x00, 0x10}; + + i2c[4] = 255 - gain; + if (i2c_w(gspca_dev, i2c) < 0) + goto err; + break; + } + + case SENSOR_OV6650: + gain >>= 1; + /* fall thru */ + case SENSOR_OV7630_3: { + __u8 i2c[] = {0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10}; + + i2c[1] = sd->sensor_addr; + i2c[3] = gain >> 2; + if (i2c_w(gspca_dev, i2c) < 0) + goto err; + break; + } + } + return; +err: + PDEBUG(D_ERR, "i2c error gain"); +} + +static void setgain(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; __u8 gain; __u8 rgb_value; - gain = sd->contrast >> 4; + gain = sd->gain >> 4; + /* red and blue gain */ rgb_value = gain << 4 | gain; - reg_w(gspca_dev->dev, 0x10, &rgb_value, 1); + reg_w(gspca_dev, 0x10, &rgb_value, 1); /* green gain */ rgb_value = gain; - reg_w(gspca_dev->dev, 0x11, &rgb_value, 1); + reg_w(gspca_dev, 0x11, &rgb_value, 1); + + if (sd->sensor_has_gain) + setsensorgain(gspca_dev); +} + +static void setexposure(struct gspca_dev *gspca_dev) +{ + struct sd *sd = (struct sd *) gspca_dev; + + switch (sd->sensor) { + case SENSOR_TAS5110: { + __u8 reg; + + /* register 19's high nibble contains the sn9c10x clock divider + The high nibble configures the no fps according to the + formula: 60 / high_nibble. With a maximum of 30 fps */ + reg = 120 * sd->exposure / 1000; + if (reg < 2) + reg = 2; + else if (reg > 15) + reg = 15; + reg = (reg << 4) | 0x0b; + reg_w(gspca_dev, 0x19, ®, 1); + break; + } + case SENSOR_OV6650: + case SENSOR_OV7630_3: { + /* The ov6650 / ov7630 have 2 registers which both influence + exposure, register 11, whose low nibble sets the nr off fps + according to: fps = 30 / (low_nibble + 1) + + The fps configures the maximum exposure setting, but it is + possible to use less exposure then what the fps maximum + allows by setting register 10. register 10 configures the + actual exposure as quotient of the full exposure, with 0 + being no exposure at all (not very usefull) and reg10_max + being max exposure possible at that framerate. + + The code maps our 0 - 510 ms exposure ctrl to these 2 + registers, trying to keep fps as high as possible. + */ + __u8 i2c[] = {0xb0, 0x00, 0x10, 0x00, 0xc0, 0x00, 0x00, 0x10}; + int reg10, reg11; + /* ov6645 datasheet says reg10_max is 9a, but that uses + tline * 2 * reg10 as formula for calculating texpo, the + ov6650 probably uses the same formula as the 7730 which uses + tline * 4 * reg10, which explains why the reg10max we've + found experimentally for the ov6650 is exactly half that of + the ov6645. The ov7630 datasheet says the max is 0x41. */ + const int reg10_max = (sd->sensor == SENSOR_OV6650)? 0x4d:0x41; + + reg11 = (60 * sd->exposure + 999) / 1000; + if (reg11 < 1) + reg11 = 1; + else if (reg11 > 16) + reg11 = 16; + + /* frame exposure time in ms = 1000 * reg11 / 30 -> + reg10 = sd->exposure * 2 * reg10_max / (1000 * reg11 / 30) */ + reg10 = (sd->exposure * 60 * reg10_max) / (1000 * reg11); + + /* Don't allow this to get below 10 when using autogain, the + steps become very large (relatively) when below 10 causing + the image to oscilate from much too dark, to much too bright + and back again. */ + if (sd->autogain && reg10 < 10) + reg10 = 10; + else if (reg10 > reg10_max) + reg10 = reg10_max; + + /* Write reg 10 and reg11 low nibble */ + i2c[1] = sd->sensor_addr; + i2c[3] = reg10; + i2c[4] |= reg11 - 1; + if (sd->sensor == SENSOR_OV7630_3) { + __u8 reg76 = reg10 & 0x03; + __u8 i2c_reg76[] = {0xa0, 0x21, 0x76, 0x00, + 0x00, 0x00, 0x00, 0x10}; + reg10 >>= 2; + i2c_reg76[3] = reg76; + if (i2c_w(gspca_dev, i2c_reg76) < 0) + PDEBUG(D_ERR, "i2c error exposure"); + } + if (i2c_w(gspca_dev, i2c) < 0) + PDEBUG(D_ERR, "i2c error exposure"); + break; + } + } +} + +static void setfreq(struct gspca_dev *gspca_dev) +{ + struct sd *sd = (struct sd *) gspca_dev; + + switch (sd->sensor) { + case SENSOR_OV6650: + case SENSOR_OV7630_3: { + /* Framerate adjust register for artificial light 50 hz flicker + compensation, identical to ov6630 0x2b register, see ov6630 + datasheet. + 0x4f -> (30 fps -> 25 fps), 0x00 -> no adjustment */ + __u8 i2c[] = {0xa0, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x10}; + switch (sd->freq) { + default: +/* case 0: * no filter*/ +/* case 2: * 60 hz */ + i2c[3] = 0; + break; + case 1: /* 50 hz */ + i2c[3] = (sd->sensor == SENSOR_OV6650)? 0x4f:0x8a; + break; + } + i2c[1] = sd->sensor_addr; + if (i2c_w(gspca_dev, i2c) < 0) + PDEBUG(D_ERR, "i2c error setfreq"); + break; + } + } +} + + +static void do_autogain(struct gspca_dev *gspca_dev) +{ + struct sd *sd = (struct sd *) gspca_dev; + int avg_lum = atomic_read(&sd->avg_lum); + + if (avg_lum == -1) + return; + + if (sd->autogain_ignore_frames > 0) + sd->autogain_ignore_frames--; + else if (gspca_auto_gain_n_exposure(gspca_dev, avg_lum, + sd->brightness * DESIRED_AVG_LUM / 127, + AUTOGAIN_DEADZONE, GAIN_KNEE, EXPOSURE_KNEE)) { + PDEBUG(D_FRAM, "autogain: gain changed: gain: %d expo: %d\n", + (int)sd->gain, (int)sd->exposure); + sd->autogain_ignore_frames = AUTOGAIN_IGNORE_FRAMES; + } } /* this function is called at probe time */ @@ -515,20 +778,29 @@ static int sd_config(struct gspca_dev *gspca_dev, { struct sd *sd = (struct sd *) gspca_dev; struct cam *cam; -/* __u16 vendor; */ __u16 product; int sif = 0; + /* nctrls depends upon the sensor, so we use a per cam copy */ + memcpy(&sd->sd_desc, gspca_dev->sd_desc, sizeof(struct sd_desc)); + gspca_dev->sd_desc = &sd->sd_desc; + sd->fr_h_sz = 12; /* default size of the frame header */ -/* vendor = id->idVendor; */ + sd->sd_desc.nctrls = 2; /* default nb of ctrls */ + sd->autogain = AUTOGAIN_DEF; /* default is autogain active */ + sd->freq = FREQ_DEF; + product = id->idProduct; -/* switch (vendor) { */ +/* switch (id->idVendor) { */ /* case 0x0c45: * Sonix */ switch (product) { case 0x6001: /* SN9C102 */ case 0x6005: /* SN9C101 */ case 0x6007: /* SN9C101 */ sd->sensor = SENSOR_TAS5110; + sd->sensor_has_gain = 1; + sd->sd_desc.nctrls = 4; + sd->sd_desc.dq_callback = do_autogain; sif = 1; break; case 0x6009: /* SN9C101 */ @@ -539,16 +811,26 @@ static int sd_config(struct gspca_dev *gspca_dev, break; case 0x6011: /* SN9C101 - SN9C101G */ sd->sensor = SENSOR_OV6650; + sd->sensor_has_gain = 1; + sd->sensor_addr = 0x60; + sd->sd_desc.nctrls = 4; + sd->sd_desc.dq_callback = do_autogain; sif = 1; break; case 0x6019: /* SN9C101 */ case 0x602c: /* SN9C102 */ case 0x602e: /* SN9C102 */ sd->sensor = SENSOR_OV7630; + sd->sensor_addr = 0x21; break; case 0x60b0: /* SN9C103 */ sd->sensor = SENSOR_OV7630_3; + sd->sensor_addr = 0x21; sd->fr_h_sz = 18; /* size of frame header */ + sd->sensor_has_gain = 1; + sd->sd_desc.nctrls = 5; + sd->sd_desc.dq_callback = do_autogain; + sd->autogain = 0; break; case 0x6024: /* SN9C102 */ case 0x6025: /* SN9C102 */ @@ -573,30 +855,34 @@ static int sd_config(struct gspca_dev *gspca_dev, cam->epaddr = 0x01; if (!sif) { cam->cam_mode = vga_mode; - cam->nmodes = sizeof vga_mode / sizeof vga_mode[0]; + cam->nmodes = ARRAY_SIZE(vga_mode); + if (sd->sensor == SENSOR_OV7630_3) { + /* We only have 320x240 & 640x480 */ + cam->cam_mode++; + cam->nmodes--; + } } else { cam->cam_mode = sif_mode; - cam->nmodes = sizeof sif_mode / sizeof sif_mode[0]; + cam->nmodes = ARRAY_SIZE(sif_mode); } - sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value; - sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value; + sd->brightness = BRIGHTNESS_DEF; + sd->gain = GAIN_DEF; + sd->exposure = EXPOSURE_DEF; if (sd->sensor == SENSOR_OV7630_3) /* jfm: from win trace */ - reg_w(gspca_dev->dev, 0x01, probe_ov7630, sizeof probe_ov7630); + reg_w(gspca_dev, 0x01, probe_ov7630, sizeof probe_ov7630); return 0; } /* this function is called at open time */ static int sd_open(struct gspca_dev *gspca_dev) { - __u8 ByteReceive; - - reg_r(gspca_dev->dev, 0x00, &ByteReceive); - if (ByteReceive != 0x10) + reg_r(gspca_dev, 0x00); + if (gspca_dev->usb_buf[0] != 0x10) return -ENODEV; return 0; } -static void pas106_i2cinit(struct usb_device *dev) +static void pas106_i2cinit(struct gspca_dev *gspca_dev) { int i; const __u8 *data; @@ -607,7 +893,7 @@ static void pas106_i2cinit(struct usb_device *dev) while (--i >= 0) { memcpy(&i2c1[2], data, 2); /* copy 2 bytes from the template */ - if (i2c_w(dev, i2c1) < 0) + if (i2c_w(gspca_dev, i2c1) < 0) PDEBUG(D_ERR, "i2c error pas106"); data += 2; } @@ -617,7 +903,6 @@ static void pas106_i2cinit(struct usb_device *dev) static void sd_start(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - struct usb_device *dev = gspca_dev->dev; int mode, l; const __u8 *sn9c10x; __u8 reg01, reg17; @@ -684,7 +969,7 @@ static void sd_start(struct gspca_dev *gspca_dev) case SENSOR_OV7630_3: reg01 = 0x44; reg17 = 0x68; - l = 0x10; + l = sizeof initOv7630_3; break; default: reg01 = sn9c10x[0]; @@ -694,84 +979,88 @@ static void sd_start(struct gspca_dev *gspca_dev) } /* reg 0x01 bit 2 video transfert on */ - reg_w(dev, 0x01, ®01, 1); + reg_w(gspca_dev, 0x01, ®01, 1); /* reg 0x17 SensorClk enable inv Clk 0x60 */ - reg_w(dev, 0x17, ®17, 1); + reg_w(gspca_dev, 0x17, ®17, 1); /*fixme: for ov7630 102 - reg_w(dev, 0x01, {0x06, sn9c10x[1]}, 2); */ + reg_w(gspca_dev, 0x01, {0x06, sn9c10x[1]}, 2); */ /* Set the registers from the template */ - reg_w(dev, 0x01, sn9c10x, l); + reg_w_big(gspca_dev, 0x01, sn9c10x, l); switch (sd->sensor) { case SENSOR_HV7131R: - i2c_w_vector(dev, hv7131_sensor_init, + i2c_w_vector(gspca_dev, hv7131_sensor_init, sizeof hv7131_sensor_init); break; case SENSOR_OV6650: - i2c_w_vector(dev, ov6650_sensor_init, + i2c_w_vector(gspca_dev, ov6650_sensor_init, sizeof ov6650_sensor_init); break; case SENSOR_OV7630: - i2c_w_vector(dev, ov7630_sensor_init_com, + i2c_w_vector(gspca_dev, ov7630_sensor_init_com, sizeof ov7630_sensor_init_com); msleep(200); - i2c_w_vector(dev, ov7630_sensor_init, + i2c_w_vector(gspca_dev, ov7630_sensor_init, sizeof ov7630_sensor_init); break; case SENSOR_OV7630_3: - i2c_w_vector(dev, ov7630_sensor_init_com, + i2c_w_vector(gspca_dev, ov7630_sensor_init_com, sizeof ov7630_sensor_init_com); msleep(200); - i2c_w_vector(dev, ov7630_sensor_init_3, - sizeof ov7630_sensor_init_3); + i2c_w(gspca_dev, ov7630_sensor_init_3[mode]); break; case SENSOR_PAS106: - pas106_i2cinit(dev); + pas106_i2cinit(gspca_dev); break; case SENSOR_PAS202: - i2c_w_vector(dev, pas202_sensor_init, + i2c_w_vector(gspca_dev, pas202_sensor_init, sizeof pas202_sensor_init); break; case SENSOR_TAS5110: - i2c_w_vector(dev, tas5110_sensor_init, + i2c_w_vector(gspca_dev, tas5110_sensor_init, sizeof tas5110_sensor_init); break; default: /* case SENSOR_TAS5130CXX: */ - i2c_w_vector(dev, tas5130_sensor_init, + i2c_w_vector(gspca_dev, tas5130_sensor_init, sizeof tas5130_sensor_init); break; } - /* H_size V_size 0x28, 0x1e maybe 640x480 */ - reg_w(dev, 0x15, &sn9c10x[0x15 - 1], 2); + /* H_size V_size 0x28, 0x1e -> 640x480. 0x16, 0x12 -> 352x288 */ + reg_w(gspca_dev, 0x15, &sn9c10x[0x15 - 1], 2); /* compression register */ - reg_w(dev, 0x18, ®17_19[1], 1); - /* H_start */ /*fixme: not ov7630*/ - reg_w(dev, 0x12, &sn9c10x[0x12 - 1], 1); - /* V_START */ /*fixme: not ov7630*/ - reg_w(dev, 0x13, &sn9c10x[0x13 - 1], 1); + reg_w(gspca_dev, 0x18, ®17_19[1], 1); + /* H_start */ + reg_w(gspca_dev, 0x12, &sn9c10x[0x12 - 1], 1); + /* V_START */ + reg_w(gspca_dev, 0x13, &sn9c10x[0x13 - 1], 1); /* reset 0x17 SensorClk enable inv Clk 0x60 */ /*fixme: ov7630 [17]=68 8f (+20 if 102)*/ - reg_w(dev, 0x17, ®17_19[0], 1); + reg_w(gspca_dev, 0x17, ®17_19[0], 1); /*MCKSIZE ->3 */ /*fixme: not ov7630*/ - reg_w(dev, 0x19, ®17_19[2], 1); + reg_w(gspca_dev, 0x19, ®17_19[2], 1); /* AE_STRX AE_STRY AE_ENDX AE_ENDY */ - reg_w(dev, 0x1c, &sn9c10x[0x1c - 1], 4); + reg_w(gspca_dev, 0x1c, &sn9c10x[0x1c - 1], 4); /* Enable video transfert */ - reg_w(dev, 0x01, &sn9c10x[0], 1); + reg_w(gspca_dev, 0x01, &sn9c10x[0], 1); /* Compression */ - reg_w(dev, 0x18, ®17_19[1], 2); + reg_w(gspca_dev, 0x18, ®17_19[1], 2); msleep(20); - setcontrast(gspca_dev); + setgain(gspca_dev); setbrightness(gspca_dev); + setexposure(gspca_dev); + setfreq(gspca_dev); + + sd->autogain_ignore_frames = 0; + atomic_set(&sd->avg_lum, -1); } static void sd_stopN(struct gspca_dev *gspca_dev) { - __u8 ByteSend = 0; + __u8 ByteSend; ByteSend = 0x09; /* 0X00 */ - reg_w(gspca_dev->dev, 0x01, &ByteSend, 1); + reg_w(gspca_dev, 0x01, &ByteSend, 1); } static void sd_stop0(struct gspca_dev *gspca_dev) @@ -787,9 +1076,18 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, unsigned char *data, /* isoc packet */ int len) /* iso packet length */ { - struct sd *sd; int i; + struct sd *sd = (struct sd *) gspca_dev; + /* frames start with: + * ff ff 00 c4 c4 96 synchro + * 00 (unknown) + * xx (frame sequence / size / compression) + * (xx) (idem - extra byte for sn9c103) + * ll mm brightness sum inside auto exposure + * ll mm brightness sum outside auto exposure + * (xx xx xx xx xx) audio values for snc103 + */ if (len > 6 && len < 24) { for (i = 0; i < len - 6; i++) { if (data[0 + i] == 0xff @@ -800,7 +1098,19 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, && data[5 + i] == 0x96) { /* start of frame */ frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame, data, 0); - sd = (struct sd *) gspca_dev; + if (len - i < sd->fr_h_sz) { + atomic_set(&sd->avg_lum, -1); + PDEBUG(D_STREAM, "packet too short to" + " get avg brightness"); + } else if (sd->fr_h_sz == 12) { + atomic_set(&sd->avg_lum, + data[i + 8] + + (data[i + 9] << 8)); + } else { + atomic_set(&sd->avg_lum, + data[i + 9] + + (data[i + 10] << 8)); + } data += i + sd->fr_h_sz; len -= i + sd->fr_h_sz; gspca_frame_add(gspca_dev, FIRST_PACKET, @@ -831,26 +1141,113 @@ static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val) return 0; } -static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val) +static int sd_setgain(struct gspca_dev *gspca_dev, __s32 val) +{ + struct sd *sd = (struct sd *) gspca_dev; + + sd->gain = val; + if (gspca_dev->streaming) + setgain(gspca_dev); + return 0; +} + +static int sd_getgain(struct gspca_dev *gspca_dev, __s32 *val) +{ + struct sd *sd = (struct sd *) gspca_dev; + + *val = sd->gain; + return 0; +} + +static int sd_setexposure(struct gspca_dev *gspca_dev, __s32 val) { struct sd *sd = (struct sd *) gspca_dev; - sd->contrast = val; + sd->exposure = val; if (gspca_dev->streaming) - setcontrast(gspca_dev); + setexposure(gspca_dev); return 0; } -static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val) +static int sd_getexposure(struct gspca_dev *gspca_dev, __s32 *val) { struct sd *sd = (struct sd *) gspca_dev; - *val = sd->contrast; + *val = sd->exposure; return 0; } +static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val) +{ + struct sd *sd = (struct sd *) gspca_dev; + + sd->autogain = val; + /* when switching to autogain set defaults to make sure + we are on a valid point of the autogain gain / + exposure knee graph, and give this change time to + take effect before doing autogain. */ + if (sd->autogain) { + sd->exposure = EXPOSURE_DEF; + sd->gain = GAIN_DEF; + if (gspca_dev->streaming) { + sd->autogain_ignore_frames = AUTOGAIN_IGNORE_FRAMES; + setexposure(gspca_dev); + setgain(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_setfreq(struct gspca_dev *gspca_dev, __s32 val) +{ + struct sd *sd = (struct sd *) gspca_dev; + + sd->freq = val; + if (gspca_dev->streaming) + setfreq(gspca_dev); + return 0; +} + +static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val) +{ + struct sd *sd = (struct sd *) gspca_dev; + + *val = sd->freq; + return 0; +} + +static int sd_querymenu(struct gspca_dev *gspca_dev, + struct v4l2_querymenu *menu) +{ + switch (menu->id) { + case V4L2_CID_POWER_LINE_FREQUENCY: + switch (menu->index) { + case 0: /* V4L2_CID_POWER_LINE_FREQUENCY_DISABLED */ + strcpy((char *) menu->name, "NoFliker"); + return 0; + case 1: /* V4L2_CID_POWER_LINE_FREQUENCY_50HZ */ + strcpy((char *) menu->name, "50 Hz"); + return 0; + case 2: /* V4L2_CID_POWER_LINE_FREQUENCY_60HZ */ + strcpy((char *) menu->name, "60 Hz"); + return 0; + } + break; + } + return -EINVAL; +} + /* sub-driver description */ -static struct sd_desc sd_desc = { +static const struct sd_desc sd_desc = { .name = MODULE_NAME, .ctrls = sd_ctrls, .nctrls = ARRAY_SIZE(sd_ctrls), @@ -861,6 +1258,7 @@ static struct sd_desc sd_desc = { .stop0 = sd_stop0, .close = sd_close, .pkt_scan = sd_pkt_scan, + .querymenu = sd_querymenu, }; /* -- module initialisation -- */ diff --git a/linux/drivers/media/video/gspca/sonixj.c b/linux/drivers/media/video/gspca/sonixj.c index 785ca2e50..9bdd2256f 100644 --- a/linux/drivers/media/video/gspca/sonixj.c +++ b/linux/drivers/media/video/gspca/sonixj.c @@ -24,8 +24,8 @@ #include "gspca.h" #include "jpeg.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) -static const char version[] = "2.1.5"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7) +static const char version[] = "2.1.7"; MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_DESCRIPTION("GSPCA/SONIX JPEG USB Camera Driver"); @@ -47,20 +47,19 @@ struct sd { #define AG_CNT_START 13 char qindex; + unsigned char bridge; +#define BRIDGE_SN9C102P 0 +#define BRIDGE_SN9C105 1 +#define BRIDGE_SN9C110 2 +#define BRIDGE_SN9C120 3 +#define BRIDGE_SN9C325 4 char sensor; /* Type of image sensor chip */ #define SENSOR_HV7131R 0 #define SENSOR_MI0360 1 #define SENSOR_MO4000 2 #define SENSOR_OV7648 3 #define SENSOR_OV7660 4 - unsigned char customid; -#define SN9C102P 0 -#define SN9C105 1 -#define SN9C110 2 -#define SN9C120 3 -#define SN9C325 4 unsigned char i2c_base; - unsigned char i2c_ctrl_reg; }; /* V4L2 controls supported by the driver */ @@ -152,36 +151,36 @@ static struct v4l2_pix_format vga_mode[] = { /*Data from sn9c102p+hv71331r */ static const __u8 sn_hv7131[] = { - 0x00, 0x03, 0x64, 0x00, 0x1A, 0x20, 0x20, 0x20, 0xA1, 0x11, /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 reg9 */ - 0x02, 0x09, 0x00, 0x00, 0x00, 0x10, 0x03, 0x00, /* 00 */ + 0x00, 0x03, 0x64, 0x00, 0x1A, 0x20, 0x20, 0x20, 0xA1, 0x11, /* rega regb regc regd rege regf reg10 reg11 */ - 0x00, 0x01, 0x03, 0x28, 0x1e, 0x41, 0x0a, 0x00, 0x00, 0x00, + 0x02, 0x09, 0x00, 0x00, 0x00, 0x10, 0x03, 0x00, /* 00 */ /* reg12 reg13 reg14 reg15 reg16 reg17 reg18 reg19 reg1a reg1b */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + 0x00, 0x01, 0x03, 0x28, 0x1e, 0x41, 0x0a, 0x00, 0x00, 0x00, /* reg1c reg1d reg1e reg1f reg20 reg21 reg22 reg23 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; static const __u8 sn_mi0360[] = { - 0x00, 0x61, 0x44, 0x00, 0x1a, 0x20, 0x20, 0x20, 0xb1, 0x5d, /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 reg9 */ - 0x07, 0x00, 0x00, 0x00, 0x00, 0x10, 0x03, 0x00, + 0x00, 0x61, 0x44, 0x00, 0x1a, 0x20, 0x20, 0x20, 0xb1, 0x5d, /* rega regb regc regd rege regf reg10 reg11 */ - 0x00, 0x02, 0x0a, 0x28, 0x1e, 0x61, 0x06, 0x00, 0x00, 0x00, + 0x07, 0x00, 0x00, 0x00, 0x00, 0x10, 0x03, 0x00, /* reg12 reg13 reg14 reg15 reg16 reg17 reg18 reg19 reg1a reg1b */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + 0x00, 0x02, 0x0a, 0x28, 0x1e, 0x61, 0x06, 0x00, 0x00, 0x00, /* reg1c reg1d reg1e reg1f reg20 reg21 reg22 reg23 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; static const __u8 sn_mo4000[] = { - 0x12, 0x23, 0x60, 0x00, 0x1A, 0x00, 0x20, 0x18, 0x81, /* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 */ - 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, + 0x12, 0x23, 0x60, 0x00, 0x1A, 0x00, 0x20, 0x18, 0x81, /* reg9 rega regb regc regd rege regf reg10 reg11*/ - 0x0b, 0x0f, 0x14, 0x28, 0x1e, 0x40, 0x08, 0x00, 0x00, + 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, /* reg12 reg13 reg14 reg15 reg16 reg17 reg18 reg19 reg1a*/ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x25, 0x39, 0x4b, + 0x0b, 0x0f, 0x14, 0x28, 0x1e, 0x40, 0x08, 0x00, 0x00, /* reg1b reg1c reg1d reg1e reg1f reg20 reg21 reg22 reg23*/ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x25, 0x39, 0x4b, 0x5c, 0x6b, 0x79, 0x87, 0x95, 0xa2, 0xaf, 0xbb, 0xc7, 0xd3, 0xdf, 0xea, 0xf5 }; @@ -199,7 +198,7 @@ static const __u8 sn_ov7660[] = { /* reg9 rega regb regc regd rege regf reg10 reg11*/ 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, /* reg12 reg13 reg14 reg15 reg16 reg17 reg18 reg19 reg1a*/ - 0x01, 0x01, 0x08, 0x28, 0x1e, 0x20, 0x07, 0x00, 0x00, + 0x01, 0x01, 0x14, 0x28, 0x1e, 0x00, 0x07, 0x00, 0x00, /* reg1b reg1c reg1d reg1e reg1f reg20 reg21 reg22 reg23*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 #else @@ -227,6 +226,10 @@ static const __u8 regsn20[] = { 0x00, 0x2d, 0x46, 0x5a, 0x6c, 0x7c, 0x8b, 0x99, 0xa6, 0xb2, 0xbf, 0xca, 0xd5, 0xe0, 0xeb, 0xf5, 0xff }; +static const __u8 regsn20_sn9c120[] = { + 0x00, 0x25, 0x3c, 0x50, 0x62, 0x72, 0x81, 0x90, + 0x9e, 0xab, 0xb8, 0xc5, 0xd1, 0xdd, 0xe9, 0xf4, 0xff +}; static const __u8 regsn20_sn9c325[] = { 0x0a, 0x3a, 0x56, 0x6c, 0x7e, 0x8d, 0x9a, 0xa4, 0xaf, 0xbb, 0xc5, 0xcd, 0xd5, 0xde, 0xe8, 0xed, 0xf5 @@ -238,6 +241,21 @@ static const __u8 reg84[] = { /* 0x00, 0x00, 0x00, 0x00, 0x00 */ 0xf7, 0x0f, 0x0a, 0x00, 0x00 }; +static const __u8 reg84_sn9c120_1[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x0c, 0x00, 0x00 +}; +static const __u8 reg84_sn9c120_2[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x0c, 0x02, 0x3b +}; +static const __u8 reg84_sn9c120_3[] = { + 0x14, 0x00, 0x27, 0x00, 0x08, 0x00, 0xeb, 0x0f, + 0xd5, 0x0f, 0x42, 0x00, 0x41, 0x00, 0xca, 0x0f, + 0xf5, 0x0f, 0x0c, 0x02, 0x3b +}; static const __u8 reg84_sn9c325[] = { 0x14, 0x00, 0x27, 0x00, 0x07, 0x00, 0xe4, 0x0f, 0xd3, 0x0f, 0x4b, 0x00, 0x48, 0x00, 0xc0, 0x0f, @@ -357,17 +375,15 @@ static const __u8 ov7660_sensor_init[][8] = { {0xa1, 0x21, 0x12, 0x05, 0x00, 0x00, 0x00, 0x10}, /* Outformat ?? rawRGB */ {0xa1, 0x21, 0x13, 0xb8, 0x00, 0x00, 0x00, 0x10}, /* init COM8 */ -/* {0xd1, 0x21, 0x00, 0x01, 0x74, 0x92, 0x00, 0x10}, - * GAIN BLUE RED VREF */ - {0xd1, 0x21, 0x00, 0x01, 0x74, 0x74, 0x00, 0x10}, + {0xd1, 0x21, 0x00, 0x01, 0x74, 0x92, 0x00, 0x10}, +/* {0xd1, 0x21, 0x00, 0x01, 0x74, 0x74, 0x00, 0x10}, */ /* GAIN BLUE RED VREF */ {0xd1, 0x21, 0x04, 0x00, 0x7d, 0x62, 0x00, 0x10}, /* COM 1 BAVE GEAVE AECHH */ {0xb1, 0x21, 0x08, 0x83, 0x01, 0x00, 0x00, 0x10}, /* RAVE COM2 */ {0xd1, 0x21, 0x0c, 0x00, 0x08, 0x04, 0x4f, 0x10}, /* COM 3 4 5 6 */ -/* {0xd1, 0x21, 0x10, 0x7f, 0x40, 0x05, 0xf8, 0x10}, - * AECH CLKRC COM7 COM8 */ - {0xd1, 0x21, 0x10, 0x7f, 0x40, 0x05, 0xff, 0x10}, + {0xd1, 0x21, 0x10, 0x7f, 0x40, 0x05, 0xf8, 0x10}, +/* {0xd1, 0x21, 0x10, 0x7f, 0x40, 0x05, 0xff, 0x10}, */ /* AECH CLKRC COM7 COM8 */ {0xc1, 0x21, 0x14, 0x2c, 0x00, 0x02, 0x00, 0x10}, /* COM9 COM10 */ {0xd1, 0x21, 0x17, 0x10, 0x60, 0x02, 0x7b, 0x10}, @@ -376,9 +392,8 @@ static const __u8 ov7660_sensor_init[][8] = { {0xb1, 0x21, 0x1e, 0x01, 0x0e, 0x00, 0x00, 0x10}, /* MVFP LAEC */ {0xd1, 0x21, 0x20, 0x07, 0x07, 0x07, 0x07, 0x10}, /* BOS GBOS GROS ROS (BGGR offset) */ -/* {0xd1, 0x21, 0x24, 0x68, 0x58, 0xd4, 0x80, 0x10}, - * AEW AEB VPT BBIAS */ - {0xd1, 0x21, 0x24, 0x78, 0x68, 0xd4, 0x80, 0x10}, + {0xd1, 0x21, 0x24, 0x68, 0x58, 0xd4, 0x80, 0x10}, +/* {0xd1, 0x21, 0x24, 0x78, 0x68, 0xd4, 0x80, 0x10}, */ /* AEW AEB VPT BBIAS */ {0xd1, 0x21, 0x28, 0x80, 0x30, 0x00, 0x00, 0x10}, /* GbBIAS RSVD EXHCH EXHCL */ @@ -428,14 +443,15 @@ static const __u8 ov7660_sensor_init[][8] = { {0xa1, 0x21, 0x10, 0x20, 0x00, 0x00, 0x00, 0x10}, /* 0x20 */ {0xa1, 0x21, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x10}, {0xa1, 0x21, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x10}, - {0xa1, 0x21, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x10}, -/* {0xb1, 0x21, 0x01, 0x78, 0x78, 0x00, 0x00, 0x10}, */ +/* {0xa1, 0x21, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x10}, */ + {0xa1, 0x21, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x10}, + {0xb1, 0x21, 0x01, 0x78, 0x78, 0x00, 0x00, 0x10}, /****** (some exchanges in the win trace) ******/ {0xa1, 0x21, 0x93, 0x00, 0x00, 0x00, 0x00, 0x10},/* dummy line hight */ {0xa1, 0x21, 0x92, 0x25, 0x00, 0x00, 0x00, 0x10},/* dummy line low */ {0xa1, 0x21, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x10}, {0xa1, 0x21, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x10}, -/* {0xa1, 0x21, 0x02, 0x90, 0x00, 0x00, 0x00, 0x10}, */ + {0xa1, 0x21, 0x02, 0x90, 0x00, 0x00, 0x00, 0x10}, /****** (some exchanges in the win trace) ******/ /**********startsensor KO if changed !!****/ {0xa1, 0x21, 0x93, 0x01, 0x00, 0x00, 0x00, 0x10}, @@ -523,42 +539,40 @@ static const __u8 qtable4[] = { 0x29, 0x29, 0x29, 0x29 }; -static void reg_r(struct usb_device *dev, - __u16 value, - __u8 *buffer, int len) +/* read <len> bytes (len < sizeof gspca_dev->usb_buf) to gspca_dev->usb_buf */ +static void reg_r(struct gspca_dev *gspca_dev, + __u16 value, int len) { - usb_control_msg(dev, - usb_rcvctrlpipe(dev, 0), + usb_control_msg(gspca_dev->dev, + usb_rcvctrlpipe(gspca_dev->dev, 0), 0, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, value, 0, - buffer, len, + gspca_dev->usb_buf, len, 500); } -static void reg_w(struct usb_device *dev, +static void reg_w(struct gspca_dev *gspca_dev, __u16 value, const __u8 *buffer, int len) { - if (len < 16) { - __u8 tmpbuf[16]; - - memcpy(tmpbuf, buffer, len); - usb_control_msg(dev, - usb_sndctrlpipe(dev, 0), + if (len <= sizeof gspca_dev->usb_buf) { + memcpy(gspca_dev->usb_buf, buffer, len); + usb_control_msg(gspca_dev->dev, + usb_sndctrlpipe(gspca_dev->dev, 0), 0x08, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, value, 0, - tmpbuf, len, + gspca_dev->usb_buf, len, 500); } else { __u8 *tmpbuf; tmpbuf = kmalloc(len, GFP_KERNEL); memcpy(tmpbuf, buffer, len); - usb_control_msg(dev, - usb_sndctrlpipe(dev, 0), + usb_control_msg(gspca_dev->dev, + usb_sndctrlpipe(gspca_dev->dev, 0), 0x08, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, value, 0, @@ -568,16 +582,15 @@ static void reg_w(struct usb_device *dev, } } -/* write 2 bytes */ +/* I2C write 2 bytes */ static void i2c_w2(struct gspca_dev *gspca_dev, const __u8 *buffer) { struct sd *sd = (struct sd *) gspca_dev; - struct usb_device *dev = gspca_dev->dev; __u8 mode[8]; /* is i2c ready */ - mode[0] = sd->i2c_ctrl_reg | (2 << 4); + mode[0] = 0x81 | (2 << 4); mode[1] = sd->i2c_base; mode[2] = buffer[0]; mode[3] = buffer[1]; @@ -585,25 +598,24 @@ static void i2c_w2(struct gspca_dev *gspca_dev, mode[5] = 0; mode[6] = 0; mode[7] = 0x10; - reg_w(dev, 0x08, mode, 8); + reg_w(gspca_dev, 0x08, mode, 8); } -/* write 8 bytes */ -static void i2c_w8(struct usb_device *dev, const __u8 *buffer) +/* I2C write 8 bytes */ +static void i2c_w8(struct gspca_dev *gspca_dev, + const __u8 *buffer) { - reg_w(dev, 0x08, buffer, 8); + reg_w(gspca_dev, 0x08, buffer, 8); msleep(1); } -/* read 5 bytes */ -static void i2c_r5(struct gspca_dev *gspca_dev, __u8 reg, - __u8 *buffer) +/* read 5 bytes in gspca_dev->usb_buf */ +static void i2c_r5(struct gspca_dev *gspca_dev, __u8 reg) { struct sd *sd = (struct sd *) gspca_dev; - struct usb_device *dev = gspca_dev->dev; __u8 mode[8]; - mode[0] = sd->i2c_ctrl_reg | 0x10; + mode[0] = 0x81 | 0x10; mode[1] = sd->i2c_base; mode[2] = reg; mode[3] = 0; @@ -611,40 +623,39 @@ static void i2c_r5(struct gspca_dev *gspca_dev, __u8 reg, mode[5] = 0; mode[6] = 0; mode[7] = 0x10; - i2c_w8(dev, mode); - mode[0] = sd->i2c_ctrl_reg | (5 << 4) | 0x02; + i2c_w8(gspca_dev, mode); + mode[0] = 0x81 | (5 << 4) | 0x02; mode[2] = 0; - i2c_w8(dev, mode); - reg_r(dev, 0x0a, buffer, 5); + i2c_w8(gspca_dev, mode); + reg_r(gspca_dev, 0x0a, 5); } static int probesensor(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - struct usb_device *dev = gspca_dev->dev; __u8 reg02; static const __u8 datasend[] = { 2, 0 }; /* reg val1 val2 val3 val4 */ - __u8 datarecd[6]; i2c_w2(gspca_dev, datasend); /* should write 0xa1 0x11 0x02 0x00 0x00 0x00 0x00 the 0x10 is add by i2cw */ msleep(10); reg02 = 0x66; - reg_w(dev, 0x02, ®02, 1); /* Gpio on */ + reg_w(gspca_dev, 0x02, ®02, 1); /* Gpio on */ msleep(10); - i2c_r5(gspca_dev, 0, datarecd); /* read sensor id */ - if (datarecd[0] == 0x02 - && datarecd[1] == 0x09 - && datarecd[2] == 0x01 - && datarecd[3] == 0x00 - && datarecd[4] == 0x00) { + i2c_r5(gspca_dev, 0); /* read sensor id */ + if (gspca_dev->usb_buf[0] == 0x02 + && gspca_dev->usb_buf[1] == 0x09 + && gspca_dev->usb_buf[2] == 0x01 + && gspca_dev->usb_buf[3] == 0x00 + && gspca_dev->usb_buf[4] == 0x00) { PDEBUG(D_PROBE, "Find Sensor sn9c102P HV7131R"); sd->sensor = SENSOR_HV7131R; return SENSOR_HV7131R; } PDEBUG(D_PROBE, "Find Sensor %d %d %d", - datarecd[0], datarecd[1], datarecd[2]); + gspca_dev->usb_buf[0], gspca_dev->usb_buf[1], + gspca_dev->usb_buf[2]); PDEBUG(D_PROBE, "Sensor sn9c102P Not found"); return -ENODEV; } @@ -653,7 +664,6 @@ static int configure_gpio(struct gspca_dev *gspca_dev, const __u8 *sn9c1xx) { struct sd *sd = (struct sd *) gspca_dev; - struct usb_device *dev = gspca_dev->dev; __u8 data; __u8 regF1; const __u8 *reg9a; @@ -666,56 +676,55 @@ static int configure_gpio(struct gspca_dev *gspca_dev, regF1 = 0x00; - reg_w(dev, 0xf1, ®F1, 1); - - reg_w(dev, 0x01, &sn9c1xx[0], 1); /*fixme:jfm was [1] en v1*/ + reg_w(gspca_dev, 0xf1, ®F1, 1); + reg_w(gspca_dev, 0x01, &sn9c1xx[0], 1); /*fixme:jfm was [1] en v1*/ /* configure gpio */ - reg_w(dev, 0x01, &sn9c1xx[1], 2); - reg_w(dev, 0x08, &sn9c1xx[8], 2); - reg_w(dev, 0x17, &sn9c1xx[0x17], 3); - switch (sd->customid) { - case SN9C325: + reg_w(gspca_dev, 0x01, &sn9c1xx[1], 2); + reg_w(gspca_dev, 0x08, &sn9c1xx[8], 2); + reg_w(gspca_dev, 0x17, &sn9c1xx[0x17], 5); /* jfm was 3 */ + switch (sd->bridge) { + case BRIDGE_SN9C325: reg9a = reg9a_sn9c325; break; - case SN9C120: + case BRIDGE_SN9C120: reg9a = reg9a_sn9c120; break; default: reg9a = reg9a_def; break; } - reg_w(dev, 0x9a, reg9a, 6); + reg_w(gspca_dev, 0x9a, reg9a, 6); data = 0x60; /*fixme:jfm 60 00 00 (3) */ - reg_w(dev, 0xd4, &data, 1); + reg_w(gspca_dev, 0xd4, &data, 1); - reg_w(dev, 0x03, &sn9c1xx[3], 0x0f); + reg_w(gspca_dev, 0x03, &sn9c1xx[3], 0x0f); - switch (sd->customid) { - case SN9C120: /* from win trace */ + switch (sd->bridge) { + case BRIDGE_SN9C120: /* from win trace */ data = 0x61; - reg_w(dev, 0x01, &data, 1); + reg_w(gspca_dev, 0x01, &data, 1); data = 0x20; - reg_w(dev, 0x17, &data, 1); + reg_w(gspca_dev, 0x17, &data, 1); data = 0x60; - reg_w(dev, 0x01, &data, 1); + reg_w(gspca_dev, 0x01, &data, 1); break; - case SN9C325: + case BRIDGE_SN9C325: data = 0x43; - reg_w(dev, 0x01, &data, 1); + reg_w(gspca_dev, 0x01, &data, 1); data = 0xae; - reg_w(dev, 0x17, &data, 1); + reg_w(gspca_dev, 0x17, &data, 1); data = 0x42; - reg_w(dev, 0x01, &data, 1); + reg_w(gspca_dev, 0x01, &data, 1); break; default: data = 0x43; - reg_w(dev, 0x01, &data, 1); + reg_w(gspca_dev, 0x01, &data, 1); data = 0x61; - reg_w(dev, 0x17, &data, 1); + reg_w(gspca_dev, 0x17, &data, 1); data = 0x42; - reg_w(dev, 0x01, &data, 1); + reg_w(gspca_dev, 0x01, &data, 1); } if (sd->sensor == SENSOR_HV7131R) { @@ -728,24 +737,22 @@ static int configure_gpio(struct gspca_dev *gspca_dev, static void hv7131R_InitSensor(struct gspca_dev *gspca_dev) { int i = 0; - struct usb_device *dev = gspca_dev->dev; static const __u8 SetSensorClk[] = /* 0x08 Mclk */ { 0xa1, 0x11, 0x01, 0x18, 0x00, 0x00, 0x00, 0x10 }; while (hv7131r_sensor_init[i][0]) { - i2c_w8(dev, hv7131r_sensor_init[i]); + i2c_w8(gspca_dev, hv7131r_sensor_init[i]); i++; } - i2c_w8(dev, SetSensorClk); + i2c_w8(gspca_dev, SetSensorClk); } static void mi0360_InitSensor(struct gspca_dev *gspca_dev) { int i = 0; - struct usb_device *dev = gspca_dev->dev; while (mi0360_sensor_init[i][0]) { - i2c_w8(dev, mi0360_sensor_init[i]); + i2c_w8(gspca_dev, mi0360_sensor_init[i]); i++; } } @@ -753,21 +760,19 @@ static void mi0360_InitSensor(struct gspca_dev *gspca_dev) static void mo4000_InitSensor(struct gspca_dev *gspca_dev) { int i = 0; - struct usb_device *dev = gspca_dev->dev; while (mo4000_sensor_init[i][0]) { - i2c_w8(dev, mo4000_sensor_init[i]); + i2c_w8(gspca_dev, mo4000_sensor_init[i]); i++; } } static void ov7648_InitSensor(struct gspca_dev *gspca_dev) { - struct usb_device *dev = gspca_dev->dev; int i = 0; while (ov7648_sensor_init[i][0]) { - i2c_w8(dev, ov7648_sensor_init[i]); + i2c_w8(gspca_dev, ov7648_sensor_init[i]); i++; } } @@ -775,10 +780,9 @@ static void ov7648_InitSensor(struct gspca_dev *gspca_dev) static void ov7660_InitSensor(struct gspca_dev *gspca_dev) { int i = 0; - struct usb_device *dev = gspca_dev->dev; while (ov7660_sensor_init[i][0]) { - i2c_w8(dev, ov7660_sensor_init[i]); + i2c_w8(gspca_dev, ov7660_sensor_init[i]); i++; } } @@ -799,9 +803,8 @@ static int sd_config(struct gspca_dev *gspca_dev, case 0x0458: /* Genius */ /* switch (product) { case 0x7025: */ - sd->customid = SN9C120; + sd->bridge = BRIDGE_SN9C120; sd->sensor = SENSOR_MI0360; - sd->i2c_ctrl_reg = 0x81; sd->i2c_base = 0x5d; /* break; } */ @@ -810,9 +813,8 @@ static int sd_config(struct gspca_dev *gspca_dev, /* switch (product) { case 0x00f5: case 0x00f7: */ - sd->customid = SN9C105; + sd->bridge = BRIDGE_SN9C105; sd->sensor = SENSOR_OV7660; - sd->i2c_ctrl_reg = 0x81; sd->i2c_base = 0x21; /* break; } */ @@ -822,9 +824,8 @@ static int sd_config(struct gspca_dev *gspca_dev, case 0x0327: case 0x0328: case 0x0330: */ - sd->customid = SN9C105; + sd->bridge = BRIDGE_SN9C105; sd->sensor = SENSOR_MI0360; - sd->i2c_ctrl_reg = 0x81; sd->i2c_base = 0x5d; /* break; } */ @@ -832,161 +833,137 @@ static int sd_config(struct gspca_dev *gspca_dev, case 0x0c45: /* Sonix */ switch (product) { case 0x6040: - sd->customid = SN9C102P; - sd->sensor = SENSOR_MI0360; /* from BW600.inf */ -/* sd->sensor = SENSOR_HV7131R; * gspcav1 value */ - sd->i2c_ctrl_reg = 0x81; + sd->bridge = BRIDGE_SN9C102P; +/* sd->sensor = SENSOR_MI0360; * from BW600.inf */ +/*fixme: MI0360 base=5d ? */ + sd->sensor = SENSOR_HV7131R; /* gspcav1 value */ sd->i2c_base = 0x11; break; /* case 0x607a: * from BW600.inf - sd->customid = SN9C102P; + sd->bridge = BRIDGE_SN9C102P; sd->sensor = SENSOR_OV7648; - sd->i2c_ctrl_reg = 0x??; sd->i2c_base = 0x??; break; */ case 0x607c: - sd->customid = SN9C102P; + sd->bridge = BRIDGE_SN9C102P; sd->sensor = SENSOR_HV7131R; - sd->i2c_ctrl_reg = 0x81; sd->i2c_base = 0x11; break; /* case 0x607e: * from BW600.inf - sd->customid = SN9C102P; + sd->bridge = BRIDGE_SN9C102P; sd->sensor = SENSOR_OV7630; - sd->i2c_ctrl_reg = 0x??; sd->i2c_base = 0x??; break; */ case 0x60c0: - sd->customid = SN9C105; + sd->bridge = BRIDGE_SN9C105; sd->sensor = SENSOR_MI0360; - sd->i2c_ctrl_reg = 0x81; sd->i2c_base = 0x5d; break; /* case 0x60c8: * from BW600.inf - sd->customid = SN9C105; + sd->bridge = BRIDGE_SN9C105; sd->sensor = SENSOR_OM6801; - sd->i2c_ctrl_reg = 0x??; sd->i2c_base = 0x??; break; */ /* case 0x60cc: * from BW600.inf - sd->customid = SN9C105; + sd->bridge = BRIDGE_SN9C105; sd->sensor = SENSOR_HV7131GP; - sd->i2c_ctrl_reg = 0x??; sd->i2c_base = 0x??; break; */ case 0x60ec: - sd->customid = SN9C105; + sd->bridge = BRIDGE_SN9C105; sd->sensor = SENSOR_MO4000; - sd->i2c_ctrl_reg = 0x81; sd->i2c_base = 0x21; break; /* case 0x60ef: * from BW600.inf - sd->customid = SN9C105; + sd->bridge = BRIDGE_SN9C105; sd->sensor = SENSOR_ICM105C; - sd->i2c_ctrl_reg = 0x??; sd->i2c_base = 0x??; break; */ /* case 0x60fa: * from BW600.inf - sd->customid = SN9C105; + sd->bridge = BRIDGE_SN9C105; sd->sensor = SENSOR_OV7648; - sd->i2c_ctrl_reg = 0x??; sd->i2c_base = 0x??; break; */ case 0x60fb: - sd->customid = SN9C105; + sd->bridge = BRIDGE_SN9C105; sd->sensor = SENSOR_OV7660; - sd->i2c_ctrl_reg = 0x81; sd->i2c_base = 0x21; break; case 0x60fc: - sd->customid = SN9C105; + sd->bridge = BRIDGE_SN9C105; sd->sensor = SENSOR_HV7131R; - sd->i2c_ctrl_reg = 0x81; sd->i2c_base = 0x11; break; /* case 0x60fe: * from BW600.inf - sd->customid = SN9C105; + sd->bridge = BRIDGE_SN9C105; sd->sensor = SENSOR_OV7630; - sd->i2c_ctrl_reg = 0x??; sd->i2c_base = 0x??; break; */ /* case 0x6108: * from BW600.inf - sd->customid = SN9C120; + sd->bridge = BRIDGE_SN9C120; sd->sensor = SENSOR_OM6801; - sd->i2c_ctrl_reg = 0x??; sd->i2c_base = 0x??; break; */ /* case 0x6122: * from BW600.inf - sd->customid = SN9C110; + sd->bridge = BRIDGE_SN9C110; sd->sensor = SENSOR_ICM105C; - sd->i2c_ctrl_reg = 0x??; sd->i2c_base = 0x??; break; */ case 0x612a: -/* sd->customid = SN9C110; * in BW600.inf */ - sd->customid = SN9C325; +/* sd->bridge = BRIDGE_SN9C110; * in BW600.inf */ + sd->bridge = BRIDGE_SN9C325; sd->sensor = SENSOR_OV7648; - sd->i2c_ctrl_reg = 0x81; sd->i2c_base = 0x21; +/*fixme: sensor_init has base = 00 et 6e!*/ break; /* case 0x6123: * from BW600.inf - sd->customid = SN9C110; + sd->bridge = BRIDGE_SN9C110; sd->sensor = SENSOR_SanyoCCD; - sd->i2c_ctrl_reg = 0x??; sd->i2c_base = 0x??; break; */ case 0x612c: - sd->customid = SN9C110; + sd->bridge = BRIDGE_SN9C110; sd->sensor = SENSOR_MO4000; - sd->i2c_ctrl_reg = 0x81; sd->i2c_base = 0x21; break; /* case 0x612e: * from BW600.inf - sd->customid = SN9C110; + sd->bridge = BRIDGE_SN9C110; sd->sensor = SENSOR_OV7630; - sd->i2c_ctrl_reg = 0x??; sd->i2c_base = 0x??; break; */ /* case 0x612f: * from BW600.inf - sd->customid = SN9C110; + sd->bridge = BRIDGE_SN9C110; sd->sensor = SENSOR_ICM105C; - sd->i2c_ctrl_reg = 0x??; sd->i2c_base = 0x??; break; */ case 0x6130: - sd->customid = SN9C120; + sd->bridge = BRIDGE_SN9C120; sd->sensor = SENSOR_MI0360; - sd->i2c_ctrl_reg = 0x81; sd->i2c_base = 0x5d; break; case 0x6138: - sd->customid = SN9C120; + sd->bridge = BRIDGE_SN9C120; sd->sensor = SENSOR_MO4000; - sd->i2c_ctrl_reg = 0x81; sd->i2c_base = 0x21; break; /* case 0x613a: * from BW600.inf - sd->customid = SN9C120; + sd->bridge = BRIDGE_SN9C120; sd->sensor = SENSOR_OV7648; - sd->i2c_ctrl_reg = 0x??; sd->i2c_base = 0x??; break; */ case 0x613b: - sd->customid = SN9C120; + sd->bridge = BRIDGE_SN9C120; sd->sensor = SENSOR_OV7660; - sd->i2c_ctrl_reg = 0x81; sd->i2c_base = 0x21; break; case 0x613c: - sd->customid = SN9C120; + sd->bridge = BRIDGE_SN9C120; sd->sensor = SENSOR_HV7131R; - sd->i2c_ctrl_reg = 0x81; sd->i2c_base = 0x11; break; /* case 0x613e: * from BW600.inf - sd->customid = SN9C120; + sd->bridge = BRIDGE_SN9C120; sd->sensor = SENSOR_OV7630; - sd->i2c_ctrl_reg = 0x??; sd->i2c_base = 0x??; break; */ } @@ -1016,51 +993,52 @@ static int sd_config(struct gspca_dev *gspca_dev, static int sd_open(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - struct usb_device *dev = gspca_dev->dev; /* const __u8 *sn9c1xx; */ __u8 regF1; __u8 regGpio[] = { 0x29, 0x74 }; - /* setup a selector by customid */ + /* setup a selector by bridge */ regF1 = 0x01; - reg_w(dev, 0xf1, ®F1, 1); - reg_r(dev, 0x00, ®F1, 1); /* -> regF1 = 0x00 */ - reg_w(dev, 0xf1, ®F1, 1); - reg_r(dev, 0x00, ®F1, 1); - switch (sd->customid) { - case SN9C102P: + reg_w(gspca_dev, 0xf1, ®F1, 1); + reg_r(gspca_dev, 0x00, 1); /* -> regF1 = 0x00 */ + regF1 = gspca_dev->usb_buf[0]; + reg_w(gspca_dev, 0xf1, ®F1, 1); + reg_r(gspca_dev, 0x00, 1); + regF1 = gspca_dev->usb_buf[0]; + switch (sd->bridge) { + case BRIDGE_SN9C102P: if (regF1 != 0x11) return -ENODEV; - reg_w(dev, 0x02, ®Gpio[1], 1); + reg_w(gspca_dev, 0x02, ®Gpio[1], 1); break; - case SN9C105: + case BRIDGE_SN9C105: if (regF1 != 0x11) return -ENODEV; - reg_w(dev, 0x02, regGpio, 2); + reg_w(gspca_dev, 0x02, regGpio, 2); break; - case SN9C110: + case BRIDGE_SN9C110: if (regF1 != 0x12) return -ENODEV; regGpio[1] = 0x62; - reg_w(dev, 0x02, ®Gpio[1], 1); + reg_w(gspca_dev, 0x02, ®Gpio[1], 1); break; - case SN9C120: + case BRIDGE_SN9C120: if (regF1 != 0x12) return -ENODEV; regGpio[1] = 0x70; - reg_w(dev, 0x02, regGpio, 2); + reg_w(gspca_dev, 0x02, regGpio, 2); break; default: -/* case SN9C325: */ +/* case BRIDGE_SN9C325: */ if (regF1 != 0x12) return -ENODEV; regGpio[1] = 0x62; - reg_w(dev, 0x02, ®Gpio[1], 1); + reg_w(gspca_dev, 0x02, ®Gpio[1], 1); break; } regF1 = 0x01; - reg_w(dev, 0xf1, ®F1, 1); + reg_w(gspca_dev, 0xf1, ®F1, 1); #if 1 /*jfm: from win trace*/ return 0; @@ -1089,7 +1067,7 @@ static unsigned int setexposure(struct gspca_dev *gspca_dev, Expodoit[3] = expo >> 16; Expodoit[4] = expo >> 8; Expodoit[5] = expo; - i2c_w8(gspca_dev->dev, Expodoit); + i2c_w8(gspca_dev, Expodoit); break; } case SENSOR_MI0360: { @@ -1102,9 +1080,9 @@ static unsigned int setexposure(struct gspca_dev *gspca_dev, expo = 0x0001; expoMi[3] = expo >> 8; expoMi[4] = expo; - i2c_w8(gspca_dev->dev, expoMi); - i2c_w8(gspca_dev->dev, doit); - i2c_w8(gspca_dev->dev, sensorgo); + i2c_w8(gspca_dev, expoMi); + i2c_w8(gspca_dev, doit); + i2c_w8(gspca_dev, sensorgo); break; } case SENSOR_MO4000: { @@ -1118,11 +1096,11 @@ static unsigned int setexposure(struct gspca_dev *gspca_dev, else if (expo < 0x0001) expo = 0x0001; expoMof[3] = (expo & 0x03fc) >> 2; - i2c_w8(gspca_dev->dev, expoMof); + i2c_w8(gspca_dev, expoMof); expoMo10[3] = ((expo & 0x1c00) >> 10) | ((expo & 0x0003) << 4); - i2c_w8(gspca_dev->dev, expoMo10); - i2c_w8(gspca_dev->dev, gainMo); + i2c_w8(gspca_dev, expoMo10); + i2c_w8(gspca_dev, gainMo); PDEBUG(D_CONF, "set exposure %d", ((expoMo10[3] & 0x07) << 10) | (expoMof[3] << 2) @@ -1161,7 +1139,7 @@ static void setbrightness(struct gspca_dev *gspca_dev) } k2 = sd->brightness >> 10; - reg_w(gspca_dev->dev, 0x96, &k2, 1); + reg_w(gspca_dev, 0x96, &k2, 1); } static void setcontrast(struct gspca_dev *gspca_dev) @@ -1176,7 +1154,7 @@ static void setcontrast(struct gspca_dev *gspca_dev) contrast[2] = k2; contrast[0] = (k2 + 1) >> 1; contrast[4] = (k2 + 1) / 5; - reg_w(gspca_dev->dev, 0x84, contrast, 6); + reg_w(gspca_dev, 0x84, contrast, 6); } static void setcolors(struct gspca_dev *gspca_dev) @@ -1190,14 +1168,13 @@ static void setcolors(struct gspca_dev *gspca_dev) data = (colour + 32) & 0x7f; /* blue */ else data = (-colour + 32) & 0x7f; /* red */ - reg_w(gspca_dev->dev, 0x05, &data, 1); + reg_w(gspca_dev, 0x05, &data, 1); } /* -- start the camera -- */ static void sd_start(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - struct usb_device *dev = gspca_dev->dev; int i; __u8 data; __u8 reg1; @@ -1219,45 +1196,73 @@ static void sd_start(struct gspca_dev *gspca_dev) /*fixme:jfm this sequence should appear at end of sd_start */ /* with data = 0x44; - reg_w(dev, 0x01, &data, 1); */ - reg_w(dev, 0x15, &sn9c1xx[0x15], 1); - reg_w(dev, 0x16, &sn9c1xx[0x16], 1); - reg_w(dev, 0x12, &sn9c1xx[0x12], 1); - reg_w(dev, 0x13, &sn9c1xx[0x13], 1); - reg_w(dev, 0x18, &sn9c1xx[0x18], 1); - reg_w(dev, 0xd2, &DC29[0], 1); - reg_w(dev, 0xd3, &DC29[1], 1); - reg_w(dev, 0xc6, &DC29[2], 1); - reg_w(dev, 0xc7, &DC29[3], 1); - reg_w(dev, 0xc8, &DC29[4], 1); - reg_w(dev, 0xc9, &DC29[5], 1); + reg_w(gspca_dev, 0x01, &data, 1); */ + reg_w(gspca_dev, 0x15, &sn9c1xx[0x15], 1); + reg_w(gspca_dev, 0x16, &sn9c1xx[0x16], 1); + reg_w(gspca_dev, 0x12, &sn9c1xx[0x12], 1); + reg_w(gspca_dev, 0x13, &sn9c1xx[0x13], 1); + reg_w(gspca_dev, 0x18, &sn9c1xx[0x18], 1); + reg_w(gspca_dev, 0xd2, &DC29[0], 1); + reg_w(gspca_dev, 0xd3, &DC29[1], 1); + reg_w(gspca_dev, 0xc6, &DC29[2], 1); + reg_w(gspca_dev, 0xc7, &DC29[3], 1); + reg_w(gspca_dev, 0xc8, &DC29[4], 1); + reg_w(gspca_dev, 0xc9, &DC29[5], 1); /*fixme:jfm end of ending sequence */ - reg_w(dev, 0x18, &sn9c1xx[0x18], 1); - if (sd->customid == SN9C325) + reg_w(gspca_dev, 0x18, &sn9c1xx[0x18], 1); + switch (sd->bridge) { + case BRIDGE_SN9C325: data = 0xae; - else + break; + case BRIDGE_SN9C120: + data = 0xa0; + break; + default: data = 0x60; - reg_w(dev, 0x17, &data, 1); - reg_w(dev, 0x05, &sn9c1xx[5], 1); - reg_w(dev, 0x07, &sn9c1xx[7], 1); - reg_w(dev, 0x06, &sn9c1xx[6], 1); - reg_w(dev, 0x14, &sn9c1xx[0x14], 1); - if (sd->customid == SN9C325) { - reg_w(dev, 0x20, regsn20_sn9c325, 0x11); + break; + } + reg_w(gspca_dev, 0x17, &data, 1); + reg_w(gspca_dev, 0x05, &sn9c1xx[5], 1); + reg_w(gspca_dev, 0x07, &sn9c1xx[7], 1); + reg_w(gspca_dev, 0x06, &sn9c1xx[6], 1); + reg_w(gspca_dev, 0x14, &sn9c1xx[0x14], 1); + switch (sd->bridge) { + case BRIDGE_SN9C325: + reg_w(gspca_dev, 0x20, regsn20_sn9c325, + sizeof regsn20_sn9c325); for (i = 0; i < 8; i++) - reg_w(dev, 0x84, reg84_sn9c325, 0x15); + reg_w(gspca_dev, 0x84, reg84_sn9c325, + sizeof reg84_sn9c325); data = 0x0a; - reg_w(dev, 0x9a, &data, 1); + reg_w(gspca_dev, 0x9a, &data, 1); data = 0x60; - reg_w(dev, 0x99, &data, 1); - } else { - reg_w(dev, 0x20, regsn20, 0x11); + reg_w(gspca_dev, 0x99, &data, 1); + break; + case BRIDGE_SN9C120: + reg_w(gspca_dev, 0x20, regsn20_sn9c120, + sizeof regsn20_sn9c120); + for (i = 0; i < 2; i++) + reg_w(gspca_dev, 0x84, reg84_sn9c120_1, + sizeof reg84_sn9c120_1); + for (i = 0; i < 6; i++) + reg_w(gspca_dev, 0x84, reg84_sn9c120_2, + sizeof reg84_sn9c120_2); + reg_w(gspca_dev, 0x84, reg84_sn9c120_3, + sizeof reg84_sn9c120_3); + data = 0x05; + reg_w(gspca_dev, 0x9a, &data, 1); + data = 0x5b; + reg_w(gspca_dev, 0x99, &data, 1); + break; + default: + reg_w(gspca_dev, 0x20, regsn20, sizeof regsn20); for (i = 0; i < 8; i++) - reg_w(dev, 0x84, reg84, 0x15); + reg_w(gspca_dev, 0x84, reg84, sizeof reg84); data = 0x08; - reg_w(dev, 0x9a, &data, 1); + reg_w(gspca_dev, 0x9a, &data, 1); data = 0x59; - reg_w(dev, 0x99, &data, 1); + reg_w(gspca_dev, 0x99, &data, 1); + break; } mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv; @@ -1315,38 +1320,38 @@ static void sd_start(struct gspca_dev *gspca_dev) } break; } - reg_w(dev, 0xc0, C0, 6); - switch (sd->customid) { - case SN9C120: /*jfm ?? */ - reg_w(dev, 0xca, CA_sn9c120, 4); + reg_w(gspca_dev, 0xc0, C0, 6); + switch (sd->bridge) { + case BRIDGE_SN9C120: /*jfm ?? */ + reg_w(gspca_dev, 0xca, CA_sn9c120, 4); break; default: - reg_w(dev, 0xca, CA, 4); + reg_w(gspca_dev, 0xca, CA, 4); break; } - switch (sd->customid) { - case SN9C120: /*jfm ?? */ - case SN9C325: - reg_w(dev, 0xce, CE_sn9c325, 4); + switch (sd->bridge) { + case BRIDGE_SN9C120: /*jfm ?? */ + case BRIDGE_SN9C325: + reg_w(gspca_dev, 0xce, CE_sn9c325, 4); break; default: - reg_w(dev, 0xce, CE, 4); + reg_w(gspca_dev, 0xce, CE, 4); /* ?? {0x1e, 0xdd, 0x2d, 0xe7} */ break; } /* here change size mode 0 -> VGA; 1 -> CIF */ data = 0x40 | sn9c1xx[0x18] | (mode << 4); - reg_w(dev, 0x18, &data, 1); + reg_w(gspca_dev, 0x18, &data, 1); - reg_w(dev, 0x100, qtable4, 0x40); - reg_w(dev, 0x140, qtable4 + 0x40, 0x40); + reg_w(gspca_dev, 0x100, qtable4, 0x40); + reg_w(gspca_dev, 0x140, qtable4 + 0x40, 0x40); data = sn9c1xx[0x18] | (mode << 4); - reg_w(dev, 0x18, &data, 1); + reg_w(gspca_dev, 0x18, &data, 1); - reg_w(dev, 0x17, ®17, 1); - reg_w(dev, 0x01, ®1, 1); + reg_w(gspca_dev, 0x17, ®17, 1); + reg_w(gspca_dev, 0x01, ®1, 1); setbrightness(gspca_dev); setcontrast(gspca_dev); } @@ -1354,7 +1359,6 @@ static void sd_start(struct gspca_dev *gspca_dev) static void sd_stopN(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - struct usb_device *dev = gspca_dev->dev; static const __u8 stophv7131[] = { 0xa1, 0x11, 0x02, 0x09, 0x00, 0x00, 0x00, 0x10 }; static const __u8 stopmi0360[] = @@ -1366,11 +1370,11 @@ static void sd_stopN(struct gspca_dev *gspca_dev) data = 0x0b; switch (sd->sensor) { case SENSOR_HV7131R: - i2c_w8(dev, stophv7131); + i2c_w8(gspca_dev, stophv7131); data = 0x2b; break; case SENSOR_MI0360: - i2c_w8(dev, stopmi0360); + i2c_w8(gspca_dev, stopmi0360); data = 0x29; break; case SENSOR_MO4000: @@ -1383,12 +1387,12 @@ static void sd_stopN(struct gspca_dev *gspca_dev) break; } sn9c1xx = sn_tb[(int) sd->sensor]; - reg_w(dev, 0x01, &sn9c1xx[1], 1); - reg_w(dev, 0x17, &sn9c1xx[0x17], 1); - reg_w(dev, 0x01, &sn9c1xx[1], 1); - reg_w(dev, 0x01, &data, 1); + reg_w(gspca_dev, 0x01, &sn9c1xx[1], 1); + reg_w(gspca_dev, 0x17, &sn9c1xx[0x17], 1); + reg_w(gspca_dev, 0x01, &sn9c1xx[1], 1); + reg_w(gspca_dev, 0x01, &data, 1); regF1 = 0x01; - reg_w(dev, 0xf1, ®F1, 1); + reg_w(gspca_dev, 0xf1, ®F1, 1); } static void sd_stop0(struct gspca_dev *gspca_dev) @@ -1484,33 +1488,35 @@ static unsigned int getexposure(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; __u8 hexpo, mexpo, lexpo; - __u8 expo[6]; switch (sd->sensor) { case SENSOR_HV7131R: /* read sensor exposure */ - i2c_r5(gspca_dev, 0x25, expo); - return (expo[0] << 16) | (expo[1] << 8) | expo[2]; + i2c_r5(gspca_dev, 0x25); + return (gspca_dev->usb_buf[0] << 16) + | (gspca_dev->usb_buf[1] << 8) + | gspca_dev->usb_buf[2]; case SENSOR_MI0360: /* read sensor exposure */ - i2c_r5(gspca_dev, 0x09, expo); - return (expo[0] << 8) | expo[1]; + i2c_r5(gspca_dev, 0x09); + return (gspca_dev->usb_buf[0] << 8) + | gspca_dev->usb_buf[1]; case SENSOR_MO4000: - i2c_r5(gspca_dev, 0x0e, expo); - hexpo = 0; /* expo[1] & 0x07; */ - mexpo = 0x40; /* expo[2] &0xff; */ - lexpo = (expo[1] & 0x30) >> 4; + i2c_r5(gspca_dev, 0x0e); + hexpo = 0; /* gspca_dev->usb_buf[1] & 0x07; */ + mexpo = 0x40; /* gspca_dev->usb_buf[2] & 0xff; */ + lexpo = (gspca_dev->usb_buf[1] & 0x30) >> 4; PDEBUG(D_CONF, "exposure %d", (hexpo << 10) | (mexpo << 2) | lexpo); return (hexpo << 10) | (mexpo << 2) | lexpo; default: /* case SENSOR_OV7660: */ /* read sensor exposure */ - i2c_r5(gspca_dev, 0x04, expo); - hexpo = expo[3] & 0x2f; - lexpo = expo[0] & 0x02; - i2c_r5(gspca_dev, 0x08, expo); - mexpo = expo[2]; + i2c_r5(gspca_dev, 0x04); + hexpo = gspca_dev->usb_buf[3] & 0x2f; + lexpo = gspca_dev->usb_buf[0] & 0x02; + i2c_r5(gspca_dev, 0x08); + mexpo = gspca_dev->usb_buf[2]; return (hexpo << 10) | (mexpo << 2) | lexpo; } } diff --git a/linux/drivers/media/video/gspca/spca500.c b/linux/drivers/media/video/gspca/spca500.c index 1860fc7f5..a54addd1d 100644 --- a/linux/drivers/media/video/gspca/spca500.c +++ b/linux/drivers/media/video/gspca/spca500.c @@ -24,8 +24,8 @@ #include "gspca.h" #include "jpeg.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) -static const char version[] = "2.1.5"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7) +static const char version[] = "2.1.7"; MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_DESCRIPTION("GSPCA/SPCA500 USB Camera Driver"); @@ -389,26 +389,27 @@ static const __u8 qtable_pocketdv[2][64] = { 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28} }; -static void reg_r(struct usb_device *dev, - __u16 index, - __u8 *buffer, __u16 length) +/* read 'len' bytes to gspca_dev->usb_buf */ +static void reg_r(struct gspca_dev *gspca_dev, + __u16 index, + __u16 length) { - usb_control_msg(dev, - usb_rcvctrlpipe(dev, 0), + usb_control_msg(gspca_dev->dev, + usb_rcvctrlpipe(gspca_dev->dev, 0), 0, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0, /* value */ - index, buffer, length, 500); + index, gspca_dev->usb_buf, length, 500); } -static int reg_w(struct usb_device *dev, +static int reg_w(struct gspca_dev *gspca_dev, __u16 req, __u16 index, __u16 value) { int ret; PDEBUG(D_USBO, "reg write: [0x%02x] = 0x%02x", index, value); - ret = usb_control_msg(dev, - usb_sndctrlpipe(dev, 0), + ret = usb_control_msg(gspca_dev->dev, + usb_sndctrlpipe(gspca_dev->dev, 0), req, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, value, index, NULL, 0, 500); @@ -418,28 +419,27 @@ static int reg_w(struct usb_device *dev, } /* returns: negative is error, pos or zero is data */ -static int reg_r_12(struct usb_device *dev, +static int reg_r_12(struct gspca_dev *gspca_dev, __u16 req, /* bRequest */ __u16 index, /* wIndex */ __u16 length) /* wLength (1 or 2 only) */ { int ret; - __u8 buf[2]; - buf[1] = 0; - ret = usb_control_msg(dev, - usb_rcvctrlpipe(dev, 0), + gspca_dev->usb_buf[1] = 0; + ret = usb_control_msg(gspca_dev->dev, + usb_rcvctrlpipe(gspca_dev->dev, 0), req, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0, /* value */ index, - buf, length, + gspca_dev->usb_buf, length, 500); /* timeout */ if (ret < 0) { PDEBUG(D_ERR, "reg_r_12 err %d", ret); return -1; } - return (buf[1] << 8) + buf[0]; + return (gspca_dev->usb_buf[1] << 8) + gspca_dev->usb_buf[0]; } /* @@ -447,13 +447,13 @@ static int reg_r_12(struct usb_device *dev, * a reg_read call. * Returns: negative is error or timeout, zero is success. */ -static int reg_r_wait(struct usb_device *dev, +static int reg_r_wait(struct gspca_dev *gspca_dev, __u16 reg, __u16 index, __u16 value) { int ret, cnt = 20; while (--cnt > 0) { - ret = reg_r_12(dev, reg, index, 1); + ret = reg_r_12(gspca_dev, reg, index, 1); if (ret == value) return 0; msleep(50); @@ -464,11 +464,10 @@ static int reg_r_wait(struct usb_device *dev, static int write_vector(struct gspca_dev *gspca_dev, const __u16 data[][3]) { - struct usb_device *dev = gspca_dev->dev; int ret, i = 0; while (data[i][0] != 0 || data[i][1] != 0 || data[i][2] != 0) { - ret = reg_w(dev, data[i][0], data[i][2], data[i][1]); + ret = reg_w(gspca_dev, data[i][0], data[i][2], data[i][1]); if (ret < 0) return ret; i++; @@ -482,19 +481,18 @@ static int spca50x_setup_qtable(struct gspca_dev *gspca_dev, unsigned int cbase, const __u8 qtable[2][64]) { - struct usb_device *dev = gspca_dev->dev; int i, err; /* loop over y components */ for (i = 0; i < 64; i++) { - err = reg_w(dev, request, ybase + i, qtable[0][i]); + err = reg_w(gspca_dev, request, ybase + i, qtable[0][i]); if (err < 0) return err; } /* loop over c components */ for (i = 0; i < 64; i++) { - err = reg_w(dev, request, cbase + i, qtable[1][i]); + err = reg_w(gspca_dev, request, cbase + i, qtable[1][i]); if (err < 0) return err; } @@ -503,37 +501,33 @@ static int spca50x_setup_qtable(struct gspca_dev *gspca_dev, static void spca500_ping310(struct gspca_dev *gspca_dev) { - __u8 Data[2]; - - reg_r(gspca_dev->dev, 0x0d04, Data, 2); + reg_r(gspca_dev, 0x0d04, 2); PDEBUG(D_STREAM, "ClickSmart310 ping 0x0d04 0x%02x 0x%02x", - Data[0], Data[1]); + gspca_dev->usb_buf[0], gspca_dev->usb_buf[1]); } static void spca500_clksmart310_init(struct gspca_dev *gspca_dev) { - __u8 Data[2]; - - reg_r(gspca_dev->dev, 0x0d05, Data, 2); + reg_r(gspca_dev, 0x0d05, 2); PDEBUG(D_STREAM, "ClickSmart310 init 0x0d05 0x%02x 0x%02x", - Data[0], Data[1]); - reg_w(gspca_dev->dev, 0x00, 0x8167, 0x5a); + gspca_dev->usb_buf[0], gspca_dev->usb_buf[1]); + reg_w(gspca_dev, 0x00, 0x8167, 0x5a); spca500_ping310(gspca_dev); - reg_w(gspca_dev->dev, 0x00, 0x8168, 0x22); - reg_w(gspca_dev->dev, 0x00, 0x816a, 0xc0); - reg_w(gspca_dev->dev, 0x00, 0x816b, 0x0b); - reg_w(gspca_dev->dev, 0x00, 0x8169, 0x25); - reg_w(gspca_dev->dev, 0x00, 0x8157, 0x5b); - reg_w(gspca_dev->dev, 0x00, 0x8158, 0x5b); - reg_w(gspca_dev->dev, 0x00, 0x813f, 0x03); - reg_w(gspca_dev->dev, 0x00, 0x8151, 0x4a); - reg_w(gspca_dev->dev, 0x00, 0x8153, 0x78); - reg_w(gspca_dev->dev, 0x00, 0x0d01, 0x04); + reg_w(gspca_dev, 0x00, 0x8168, 0x22); + reg_w(gspca_dev, 0x00, 0x816a, 0xc0); + reg_w(gspca_dev, 0x00, 0x816b, 0x0b); + reg_w(gspca_dev, 0x00, 0x8169, 0x25); + reg_w(gspca_dev, 0x00, 0x8157, 0x5b); + reg_w(gspca_dev, 0x00, 0x8158, 0x5b); + reg_w(gspca_dev, 0x00, 0x813f, 0x03); + reg_w(gspca_dev, 0x00, 0x8151, 0x4a); + reg_w(gspca_dev, 0x00, 0x8153, 0x78); + reg_w(gspca_dev, 0x00, 0x0d01, 0x04); /* 00 for adjust shutter */ - reg_w(gspca_dev->dev, 0x00, 0x0d02, 0x01); - reg_w(gspca_dev->dev, 0x00, 0x8169, 0x25); - reg_w(gspca_dev->dev, 0x00, 0x0d01, 0x02); + reg_w(gspca_dev, 0x00, 0x0d02, 0x01); + reg_w(gspca_dev, 0x00, 0x8169, 0x25); + reg_w(gspca_dev, 0x00, 0x0d01, 0x02); } static void spca500_setmode(struct gspca_dev *gspca_dev, @@ -542,14 +536,14 @@ static void spca500_setmode(struct gspca_dev *gspca_dev, int mode; /* set x multiplier */ - reg_w(gspca_dev->dev, 0, 0x8001, xmult); + reg_w(gspca_dev, 0, 0x8001, xmult); /* set y multiplier */ - reg_w(gspca_dev->dev, 0, 0x8002, ymult); + reg_w(gspca_dev, 0, 0x8002, ymult); /* use compressed mode, VGA, with mode specific subsample */ mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv; - reg_w(gspca_dev->dev, 0, 0x8003, mode << 4); + reg_w(gspca_dev, 0, 0x8003, mode << 4); } static int spca500_full_reset(struct gspca_dev *gspca_dev) @@ -557,18 +551,18 @@ static int spca500_full_reset(struct gspca_dev *gspca_dev) int err; /* send the reset command */ - err = reg_w(gspca_dev->dev, 0xe0, 0x0001, 0x0000); + err = reg_w(gspca_dev, 0xe0, 0x0001, 0x0000); if (err < 0) return err; /* wait for the reset to complete */ - err = reg_r_wait(gspca_dev->dev, 0x06, 0x0000, 0x0000); + err = reg_r_wait(gspca_dev, 0x06, 0x0000, 0x0000); if (err < 0) return err; - err = reg_w(gspca_dev->dev, 0xe0, 0x0000, 0x0000); + err = reg_w(gspca_dev, 0xe0, 0x0000, 0x0000); if (err < 0) return err; - err = reg_r_wait(gspca_dev->dev, 0x06, 0, 0); + err = reg_r_wait(gspca_dev, 0x06, 0, 0); if (err < 0) { PDEBUG(D_ERR, "reg_r_wait() failed"); return err; @@ -585,15 +579,13 @@ static int spca500_full_reset(struct gspca_dev *gspca_dev) /* up-port the same feature as in 2.4.x kernel */ static int spca500_synch310(struct gspca_dev *gspca_dev) { - __u8 Data; - if (usb_set_interface(gspca_dev->dev, gspca_dev->iface, 0) < 0) { PDEBUG(D_ERR, "Set packet size: set interface error"); goto error; } spca500_ping310(gspca_dev); - reg_r(gspca_dev->dev, 0x0d00, &Data, 1); + reg_r(gspca_dev, 0x0d00, 1); /* need alt setting here */ PDEBUG(D_PACK, "ClickSmart310 sync alt: %d", gspca_dev->alt); @@ -617,12 +609,12 @@ static void spca500_reinit(struct gspca_dev *gspca_dev) /* some unknow command from Aiptek pocket dv and family300 */ - reg_w(gspca_dev->dev, 0x00, 0x0d01, 0x01); - reg_w(gspca_dev->dev, 0x00, 0x0d03, 0x00); - reg_w(gspca_dev->dev, 0x00, 0x0d02, 0x01); + reg_w(gspca_dev, 0x00, 0x0d01, 0x01); + reg_w(gspca_dev, 0x00, 0x0d03, 0x00); + reg_w(gspca_dev, 0x00, 0x0d02, 0x01); /* enable drop packet */ - reg_w(gspca_dev->dev, 0x00, 0x850a, 0x0001); + reg_w(gspca_dev, 0x00, 0x850a, 0x0001); err = spca50x_setup_qtable(gspca_dev, 0x00, 0x8800, 0x8840, qtable_pocketdv); @@ -630,22 +622,23 @@ static void spca500_reinit(struct gspca_dev *gspca_dev) PDEBUG(D_ERR|D_STREAM, "spca50x_setup_qtable failed on init"); /* set qtable index */ - reg_w(gspca_dev->dev, 0x00, 0x8880, 2); + reg_w(gspca_dev, 0x00, 0x8880, 2); /* family cam Quicksmart stuff */ - reg_w(gspca_dev->dev, 0x00, 0x800a, 0x00); + reg_w(gspca_dev, 0x00, 0x800a, 0x00); /* Set agc transfer: synced inbetween frames */ - reg_w(gspca_dev->dev, 0x00, 0x820f, 0x01); + reg_w(gspca_dev, 0x00, 0x820f, 0x01); /* Init SDRAM - needed for SDRAM access */ - reg_w(gspca_dev->dev, 0x00, 0x870a, 0x04); + reg_w(gspca_dev, 0x00, 0x870a, 0x04); /*Start init sequence or stream */ - - reg_w(gspca_dev->dev, 0, 0x8003, 0x00); + reg_w(gspca_dev, 0, 0x8003, 0x00); /* switch to video camera mode */ - reg_w(gspca_dev->dev, 0x00, 0x8000, 0x0004); + reg_w(gspca_dev, 0x00, 0x8000, 0x0004); msleep(2000); - if (reg_r_wait(gspca_dev->dev, 0, 0x8000, 0x44) != 0) - reg_r(gspca_dev->dev, 0x816b, &Data, 1); - reg_w(gspca_dev->dev, 0x00, 0x816b, Data); + if (reg_r_wait(gspca_dev, 0, 0x8000, 0x44) != 0) { + reg_r(gspca_dev, 0x816b, 1); + Data = gspca_dev->usb_buf[0]; + reg_w(gspca_dev, 0x00, 0x816b, Data); + } } /* this function is called at probe time */ @@ -802,9 +795,10 @@ static void sd_start(struct gspca_dev *gspca_dev) } /* is there a sensor here ? */ - reg_r(gspca_dev->dev, 0x8a04, &Data, 1); - PDEBUG(D_STREAM, "Spca500 Sensor Address 0x%02X", Data); - PDEBUG(D_STREAM, "Spca500 curr_mode: %d Xmult: 0x%02X, Ymult: 0x%02X", + reg_r(gspca_dev, 0x8a04, 1); + PDEBUG(D_STREAM, "Spca500 Sensor Address 0x%02x", + gspca_dev->usb_buf[0]); + PDEBUG(D_STREAM, "Spca500 curr_mode: %d Xmult: 0x%02x, Ymult: 0x%02x", gspca_dev->curr_mode, xmult, ymult); /* setup qtable */ @@ -813,33 +807,34 @@ static void sd_start(struct gspca_dev *gspca_dev) spca500_setmode(gspca_dev, xmult, ymult); /* enable drop packet */ - reg_w(gspca_dev->dev, 0x00, 0x850a, 0x0001); - reg_w(gspca_dev->dev, 0x00, 0x8880, 3); + reg_w(gspca_dev, 0x00, 0x850a, 0x0001); + reg_w(gspca_dev, 0x00, 0x8880, 3); err = spca50x_setup_qtable(gspca_dev, 0x00, 0x8800, 0x8840, qtable_creative_pccam); if (err < 0) PDEBUG(D_ERR, "spca50x_setup_qtable failed"); /* Init SDRAM - needed for SDRAM access */ - reg_w(gspca_dev->dev, 0x00, 0x870a, 0x04); + reg_w(gspca_dev, 0x00, 0x870a, 0x04); /* switch to video camera mode */ - reg_w(gspca_dev->dev, 0x00, 0x8000, 0x0004); + reg_w(gspca_dev, 0x00, 0x8000, 0x0004); msleep(500); - if (reg_r_wait(gspca_dev->dev, 0, 0x8000, 0x44) != 0) + if (reg_r_wait(gspca_dev, 0, 0x8000, 0x44) != 0) PDEBUG(D_ERR, "reg_r_wait() failed"); - reg_r(gspca_dev->dev, 0x816b, &Data, 1); - reg_w(gspca_dev->dev, 0x00, 0x816b, Data); + reg_r(gspca_dev, 0x816b, 1); + Data = gspca_dev->usb_buf[0]; + reg_w(gspca_dev, 0x00, 0x816b, Data); spca500_synch310(gspca_dev); write_vector(gspca_dev, spca500_visual_defaults); spca500_setmode(gspca_dev, xmult, ymult); /* enable drop packet */ - reg_w(gspca_dev->dev, 0x00, 0x850a, 0x0001); + reg_w(gspca_dev, 0x00, 0x850a, 0x0001); PDEBUG(D_ERR, "failed to enable drop packet"); - reg_w(gspca_dev->dev, 0x00, 0x8880, 3); + reg_w(gspca_dev, 0x00, 0x8880, 3); err = spca50x_setup_qtable(gspca_dev, 0x00, 0x8800, 0x8840, qtable_creative_pccam); @@ -847,16 +842,17 @@ static void sd_start(struct gspca_dev *gspca_dev) PDEBUG(D_ERR, "spca50x_setup_qtable failed"); /* Init SDRAM - needed for SDRAM access */ - reg_w(gspca_dev->dev, 0x00, 0x870a, 0x04); + reg_w(gspca_dev, 0x00, 0x870a, 0x04); /* switch to video camera mode */ - reg_w(gspca_dev->dev, 0x00, 0x8000, 0x0004); + reg_w(gspca_dev, 0x00, 0x8000, 0x0004); - if (reg_r_wait(gspca_dev->dev, 0, 0x8000, 0x44) != 0) + if (reg_r_wait(gspca_dev, 0, 0x8000, 0x44) != 0) PDEBUG(D_ERR, "reg_r_wait() failed"); - reg_r(gspca_dev->dev, 0x816b, &Data, 1); - reg_w(gspca_dev->dev, 0x00, 0x816b, Data); + reg_r(gspca_dev, 0x816b, 1); + Data = gspca_dev->usb_buf[0]; + reg_w(gspca_dev, 0x00, 0x816b, Data); break; case CreativePCCam300: /* Creative PC-CAM 300 640x480 CCD */ case IntelPocketPCCamera: /* FIXME: Temporary fix for @@ -869,10 +865,10 @@ static void sd_start(struct gspca_dev *gspca_dev) PDEBUG(D_ERR, "spca500_full_reset failed"); /* enable drop packet */ - err = reg_w(gspca_dev->dev, 0x00, 0x850a, 0x0001); + err = reg_w(gspca_dev, 0x00, 0x850a, 0x0001); if (err < 0) PDEBUG(D_ERR, "failed to enable drop packet"); - reg_w(gspca_dev->dev, 0x00, 0x8880, 3); + reg_w(gspca_dev, 0x00, 0x8880, 3); err = spca50x_setup_qtable(gspca_dev, 0x00, 0x8800, 0x8840, qtable_creative_pccam); @@ -880,16 +876,17 @@ static void sd_start(struct gspca_dev *gspca_dev) PDEBUG(D_ERR, "spca50x_setup_qtable failed"); spca500_setmode(gspca_dev, xmult, ymult); - reg_w(gspca_dev->dev, 0x20, 0x0001, 0x0004); + reg_w(gspca_dev, 0x20, 0x0001, 0x0004); /* switch to video camera mode */ - reg_w(gspca_dev->dev, 0x00, 0x8000, 0x0004); + reg_w(gspca_dev, 0x00, 0x8000, 0x0004); - if (reg_r_wait(gspca_dev->dev, 0, 0x8000, 0x44) != 0) + if (reg_r_wait(gspca_dev, 0, 0x8000, 0x44) != 0) PDEBUG(D_ERR, "reg_r_wait() failed"); - reg_r(gspca_dev->dev, 0x816b, &Data, 1); - reg_w(gspca_dev->dev, 0x00, 0x816b, Data); + reg_r(gspca_dev, 0x816b, 1); + Data = gspca_dev->usb_buf[0]; + reg_w(gspca_dev, 0x00, 0x816b, Data); /* write_vector(gspca_dev, spca500_visual_defaults); */ break; @@ -900,8 +897,8 @@ static void sd_start(struct gspca_dev *gspca_dev) if (err < 0) PDEBUG(D_ERR, "spca500_full_reset failed"); /* enable drop packet */ - reg_w(gspca_dev->dev, 0x00, 0x850a, 0x0001); - reg_w(gspca_dev->dev, 0x00, 0x8880, 0); + reg_w(gspca_dev, 0x00, 0x850a, 0x0001); + reg_w(gspca_dev, 0x00, 0x8880, 0); err = spca50x_setup_qtable(gspca_dev, 0x00, 0x8800, 0x8840, qtable_kodak_ez200); @@ -909,16 +906,17 @@ static void sd_start(struct gspca_dev *gspca_dev) PDEBUG(D_ERR, "spca50x_setup_qtable failed"); spca500_setmode(gspca_dev, xmult, ymult); - reg_w(gspca_dev->dev, 0x20, 0x0001, 0x0004); + reg_w(gspca_dev, 0x20, 0x0001, 0x0004); /* switch to video camera mode */ - reg_w(gspca_dev->dev, 0x00, 0x8000, 0x0004); + reg_w(gspca_dev, 0x00, 0x8000, 0x0004); - if (reg_r_wait(gspca_dev->dev, 0, 0x8000, 0x44) != 0) + if (reg_r_wait(gspca_dev, 0, 0x8000, 0x44) != 0) PDEBUG(D_ERR, "reg_r_wait() failed"); - reg_r(gspca_dev->dev, 0x816b, &Data, 1); - reg_w(gspca_dev->dev, 0x00, 0x816b, Data); + reg_r(gspca_dev, 0x816b, 1); + Data = gspca_dev->usb_buf[0]; + reg_w(gspca_dev, 0x00, 0x816b, Data); /* write_vector(gspca_dev, spca500_visual_defaults); */ break; @@ -933,56 +931,58 @@ static void sd_start(struct gspca_dev *gspca_dev) case ToptroIndus: case AgfaCl20: spca500_reinit(gspca_dev); - reg_w(gspca_dev->dev, 0x00, 0x0d01, 0x01); + reg_w(gspca_dev, 0x00, 0x0d01, 0x01); /* enable drop packet */ - reg_w(gspca_dev->dev, 0x00, 0x850a, 0x0001); + reg_w(gspca_dev, 0x00, 0x850a, 0x0001); err = spca50x_setup_qtable(gspca_dev, 0x00, 0x8800, 0x8840, qtable_pocketdv); if (err < 0) PDEBUG(D_ERR, "spca50x_setup_qtable failed"); - reg_w(gspca_dev->dev, 0x00, 0x8880, 2); + reg_w(gspca_dev, 0x00, 0x8880, 2); /* familycam Quicksmart pocketDV stuff */ - reg_w(gspca_dev->dev, 0x00, 0x800a, 0x00); + reg_w(gspca_dev, 0x00, 0x800a, 0x00); /* Set agc transfer: synced inbetween frames */ - reg_w(gspca_dev->dev, 0x00, 0x820f, 0x01); + reg_w(gspca_dev, 0x00, 0x820f, 0x01); /* Init SDRAM - needed for SDRAM access */ - reg_w(gspca_dev->dev, 0x00, 0x870a, 0x04); + reg_w(gspca_dev, 0x00, 0x870a, 0x04); spca500_setmode(gspca_dev, xmult, ymult); /* switch to video camera mode */ - reg_w(gspca_dev->dev, 0x00, 0x8000, 0x0004); + reg_w(gspca_dev, 0x00, 0x8000, 0x0004); - reg_r_wait(gspca_dev->dev, 0, 0x8000, 0x44); + reg_r_wait(gspca_dev, 0, 0x8000, 0x44); - reg_r(gspca_dev->dev, 0x816b, &Data, 1); - reg_w(gspca_dev->dev, 0x00, 0x816b, Data); + reg_r(gspca_dev, 0x816b, 1); + Data = gspca_dev->usb_buf[0]; + reg_w(gspca_dev, 0x00, 0x816b, Data); break; case LogitechTraveler: case LogitechClickSmart510: - reg_w(gspca_dev->dev, 0x02, 0x00, 0x00); + reg_w(gspca_dev, 0x02, 0x00, 0x00); /* enable drop packet */ - reg_w(gspca_dev->dev, 0x00, 0x850a, 0x0001); + reg_w(gspca_dev, 0x00, 0x850a, 0x0001); err = spca50x_setup_qtable(gspca_dev, 0x00, 0x8800, 0x8840, qtable_creative_pccam); if (err < 0) PDEBUG(D_ERR, "spca50x_setup_qtable failed"); - reg_w(gspca_dev->dev, 0x00, 0x8880, 3); - reg_w(gspca_dev->dev, 0x00, 0x800a, 0x00); + reg_w(gspca_dev, 0x00, 0x8880, 3); + reg_w(gspca_dev, 0x00, 0x800a, 0x00); /* Init SDRAM - needed for SDRAM access */ - reg_w(gspca_dev->dev, 0x00, 0x870a, 0x04); + reg_w(gspca_dev, 0x00, 0x870a, 0x04); spca500_setmode(gspca_dev, xmult, ymult); /* switch to video camera mode */ - reg_w(gspca_dev->dev, 0x00, 0x8000, 0x0004); - reg_r_wait(gspca_dev->dev, 0, 0x8000, 0x44); + reg_w(gspca_dev, 0x00, 0x8000, 0x0004); + reg_r_wait(gspca_dev, 0, 0x8000, 0x44); - reg_r(gspca_dev->dev, 0x816b, &Data, 1); - reg_w(gspca_dev->dev, 0x00, 0x816b, Data); + reg_r(gspca_dev, 0x816b, 1); + Data = gspca_dev->usb_buf[0]; + reg_w(gspca_dev, 0x00, 0x816b, Data); write_vector(gspca_dev, Clicksmart510_defaults); break; } @@ -990,14 +990,13 @@ static void sd_start(struct gspca_dev *gspca_dev) static void sd_stopN(struct gspca_dev *gspca_dev) { - __u8 data; - - reg_w(gspca_dev->dev, 0, 0x8003, 0x00); + reg_w(gspca_dev, 0, 0x8003, 0x00); /* switch to video camera mode */ - reg_w(gspca_dev->dev, 0x00, 0x8000, 0x0004); - reg_r(gspca_dev->dev, 0x8000, &data, 1); - PDEBUG(D_STREAM, "stop SPCA500 done reg8000: 0x%2x", data); + reg_w(gspca_dev, 0x00, 0x8000, 0x0004); + reg_r(gspca_dev, 0x8000, 1); + PDEBUG(D_STREAM, "stop SPCA500 done reg8000: 0x%2x", + gspca_dev->usb_buf[0]); } static void sd_stop0(struct gspca_dev *gspca_dev) @@ -1060,7 +1059,7 @@ static void setbrightness(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - reg_w(gspca_dev->dev, 0x00, 0x8167, + reg_w(gspca_dev, 0x00, 0x8167, (__u8) (sd->brightness - 128)); } @@ -1069,7 +1068,7 @@ static void getbrightness(struct gspca_dev *gspca_dev) struct sd *sd = (struct sd *) gspca_dev; int ret; - ret = reg_r_12(gspca_dev->dev, 0x00, 0x8167, 1); + ret = reg_r_12(gspca_dev, 0x00, 0x8167, 1); if (ret >= 0) sd->brightness = ret + 128; } @@ -1078,7 +1077,7 @@ static void setcontrast(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - reg_w(gspca_dev->dev, 0x00, 0x8168, sd->contrast); + reg_w(gspca_dev, 0x00, 0x8168, sd->contrast); } static void getcontrast(struct gspca_dev *gspca_dev) @@ -1086,7 +1085,7 @@ static void getcontrast(struct gspca_dev *gspca_dev) struct sd *sd = (struct sd *) gspca_dev; int ret; - ret = reg_r_12(gspca_dev->dev, 0x0, 0x8168, 1); + ret = reg_r_12(gspca_dev, 0x0, 0x8168, 1); if (ret >= 0) sd->contrast = ret; } @@ -1095,7 +1094,7 @@ static void setcolors(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - reg_w(gspca_dev->dev, 0x00, 0x8169, sd->colors); + reg_w(gspca_dev, 0x00, 0x8169, sd->colors); } static void getcolors(struct gspca_dev *gspca_dev) @@ -1103,7 +1102,7 @@ static void getcolors(struct gspca_dev *gspca_dev) struct sd *sd = (struct sd *) gspca_dev; int ret; - ret = reg_r_12(gspca_dev->dev, 0x0, 0x8169, 1); + ret = reg_r_12(gspca_dev, 0x0, 0x8169, 1); if (ret >= 0) sd->colors = ret; } diff --git a/linux/drivers/media/video/gspca/spca501.c b/linux/drivers/media/video/gspca/spca501.c index 762e8ae97..fb3655dd5 100644 --- a/linux/drivers/media/video/gspca/spca501.c +++ b/linux/drivers/media/video/gspca/spca501.c @@ -23,8 +23,8 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) -static const char version[] = "2.1.5"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7) +static const char version[] = "2.1.7"; MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_DESCRIPTION("GSPCA/SPCA501 USB Camera Driver"); @@ -104,17 +104,17 @@ static struct ctrl sd_ctrls[] = { static struct v4l2_pix_format vga_mode[] = { {160, 120, V4L2_PIX_FMT_SPCA501, V4L2_FIELD_NONE, .bytesperline = 160, - .sizeimage = 160 * 120 * 3 / 8, + .sizeimage = 160 * 120 * 3 / 2, .colorspace = V4L2_COLORSPACE_SRGB, .priv = 2}, {320, 240, V4L2_PIX_FMT_SPCA501, V4L2_FIELD_NONE, .bytesperline = 320, - .sizeimage = 320 * 240 * 3 / 8, + .sizeimage = 320 * 240 * 3 / 2, .colorspace = V4L2_COLORSPACE_SRGB, .priv = 1}, {640, 480, V4L2_PIX_FMT_SPCA501, V4L2_FIELD_NONE, .bytesperline = 640, - .sizeimage = 640 * 480 * 3 / 8, + .sizeimage = 640 * 480 * 3 / 2, .colorspace = V4L2_COLORSPACE_SRGB, .priv = 0}, }; @@ -1826,28 +1826,27 @@ static int reg_write(struct usb_device *dev, } /* returns: negative is error, pos or zero is data */ -static int reg_read(struct usb_device *dev, +static int reg_read(struct gspca_dev *gspca_dev, __u16 req, /* bRequest */ __u16 index, /* wIndex */ __u16 length) /* wLength (1 or 2 only) */ { int ret; - __u8 buf[2]; - buf[1] = 0; - ret = usb_control_msg(dev, - usb_rcvctrlpipe(dev, 0), + gspca_dev->usb_buf[1] = 0; + ret = usb_control_msg(gspca_dev->dev, + usb_rcvctrlpipe(gspca_dev->dev, 0), req, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0, /* value */ index, - buf, length, + gspca_dev->usb_buf, length, 500); /* timeout */ if (ret < 0) { PDEBUG(D_ERR, "reg_read err %d", ret); return -1; } - return (buf[1] << 8) + buf[0]; + return (gspca_dev->usb_buf[1] << 8) + gspca_dev->usb_buf[0]; } static int write_vector(struct gspca_dev *gspca_dev, @@ -1883,7 +1882,7 @@ static void getbrightness(struct gspca_dev *gspca_dev) struct sd *sd = (struct sd *) gspca_dev; __u16 brightness; - brightness = reg_read(gspca_dev->dev, SPCA501_REG_CCDSP, 0x11, 2); + brightness = reg_read(gspca_dev, SPCA501_REG_CCDSP, 0x11, 2); sd->brightness = brightness << 1; } @@ -1901,11 +1900,11 @@ static void getcontrast(struct gspca_dev *gspca_dev) { #if 0 __u8 byte = 0; - byte = (reg_read(gspca_dev->dev, + byte = (reg_read(gspca_dev, 0x00, 0x00, 1) & 0xff) << 8; - ss->contrast = byte | (reg_read(gspca_dev->dev, + ss->contrast = byte | (reg_read(gspca_dev, 0x00, 0x01, 1) & 0xff); @@ -1924,8 +1923,8 @@ static void getcolors(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - sd->colors = reg_read(gspca_dev->dev, SPCA501_REG_CCDSP, 0x0c, 2); -/* sd->hue = (reg_read(gspca_dev->dev, SPCA501_REG_CCDSP, 0x13, */ + sd->colors = reg_read(gspca_dev, SPCA501_REG_CCDSP, 0x0c, 2); +/* sd->hue = (reg_read(gspca_dev, SPCA501_REG_CCDSP, 0x13, */ /* 2) & 0xFF) << 8; */ } diff --git a/linux/drivers/media/video/gspca/spca505.c b/linux/drivers/media/video/gspca/spca505.c index cecbc4362..f8c46e571 100644 --- a/linux/drivers/media/video/gspca/spca505.c +++ b/linux/drivers/media/video/gspca/spca505.c @@ -23,8 +23,8 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) -static const char version[] = "2.1.5"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7) +static const char version[] = "2.1.7"; MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_DESCRIPTION("GSPCA/SPCA505 USB Camera Driver"); @@ -662,29 +662,27 @@ static int reg_write(struct usb_device *dev, } /* returns: negative is error, pos or zero is data */ -static int reg_read(struct usb_device *dev, +static int reg_read(struct gspca_dev *gspca_dev, __u16 reg, /* bRequest */ __u16 index, /* wIndex */ __u16 length) /* wLength (1 or 2 only) */ { int ret; - __u8 buf[4]; - buf[1] = 0; - ret = usb_control_msg(dev, - usb_rcvctrlpipe(dev, 0), + gspca_dev->usb_buf[1] = 0; + ret = usb_control_msg(gspca_dev->dev, + usb_rcvctrlpipe(gspca_dev->dev, 0), reg, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, (__u16) 0, /* value */ (__u16) index, - buf, - length, + gspca_dev->usb_buf, length, 500); /* timeout */ if (ret < 0) { PDEBUG(D_ERR, "reg_read err %d", ret); return -1; } - return (buf[1] << 8) + buf[0]; + return (gspca_dev->usb_buf[1] << 8) + gspca_dev->usb_buf[0]; } static int write_vector(struct gspca_dev *gspca_dev, @@ -766,7 +764,7 @@ static int sd_open(struct gspca_dev *gspca_dev) write_vector(gspca_dev, spca505b_open_data_ccd); else write_vector(gspca_dev, spca505_open_data_ccd); - ret = reg_read(gspca_dev->dev, 6, 0x16, 2); + ret = reg_read(gspca_dev, 6, 0x16, 2); if (ret < 0) { PDEBUG(D_ERR|D_STREAM, @@ -943,8 +941,8 @@ static void getbrightness(struct gspca_dev *gspca_dev) struct sd *sd = (struct sd *) gspca_dev; sd->brightness = 255 - - ((reg_read(gspca_dev->dev, 5, 0x01, 1) >> 2) - + (reg_read(gspca_dev->dev, 5, 0x0, 1) << 6)); + - ((reg_read(gspca_dev, 5, 0x01, 1) >> 2) + + (reg_read(gspca_dev, 5, 0x0, 1) << 6)); } static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val) diff --git a/linux/drivers/media/video/gspca/spca506.c b/linux/drivers/media/video/gspca/spca506.c index 2d249b00b..143203c1f 100644 --- a/linux/drivers/media/video/gspca/spca506.c +++ b/linux/drivers/media/video/gspca/spca506.c @@ -25,8 +25,8 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) -static const char version[] = "2.1.5"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7) +static const char version[] = "2.1.7"; MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_DESCRIPTION("GSPCA/SPCA506 USB Camera Driver"); @@ -153,17 +153,18 @@ static struct v4l2_pix_format vga_mode[] = { #define SAA7113_hue 0x0d /* defaults 0x00 */ #define SAA7113_I2C_BASE_WRITE 0x4a -static void reg_r(struct usb_device *dev, +/* read 'len' bytes to gspca_dev->usb_buf */ +static void reg_r(struct gspca_dev *gspca_dev, __u16 req, __u16 index, - __u8 *buffer, __u16 length) + __u16 length) { - usb_control_msg(dev, - usb_rcvctrlpipe(dev, 0), + usb_control_msg(gspca_dev->dev, + usb_rcvctrlpipe(gspca_dev->dev, 0), req, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0, /* value */ - index, buffer, length, + index, gspca_dev->usb_buf, length, 500); } @@ -189,13 +190,12 @@ static void spca506_WriteI2c(struct gspca_dev *gspca_dev, __u16 valeur, __u16 reg) { int retry = 60; - __u8 Data[2]; reg_w(gspca_dev->dev, 0x07, reg, 0x0001); reg_w(gspca_dev->dev, 0x07, valeur, 0x0000); while (retry--) { - reg_r(gspca_dev->dev, 0x07, 0x0003, Data, 2); - if ((Data[0] | Data[1]) == 0x00) + reg_r(gspca_dev, 0x07, 0x0003, 2); + if ((gspca_dev->usb_buf[0] | gspca_dev->usb_buf[1]) == 0x00) break; } } @@ -203,21 +203,19 @@ static void spca506_WriteI2c(struct gspca_dev *gspca_dev, __u16 valeur, static int spca506_ReadI2c(struct gspca_dev *gspca_dev, __u16 reg) { int retry = 60; - __u8 Data[2]; - __u8 value; reg_w(gspca_dev->dev, 0x07, SAA7113_I2C_BASE_WRITE, 0x0004); reg_w(gspca_dev->dev, 0x07, reg, 0x0001); reg_w(gspca_dev->dev, 0x07, 0x01, 0x0002); while (--retry) { - reg_r(gspca_dev->dev, 0x07, 0x0003, Data, 2); - if ((Data[0] | Data[1]) == 0x00) + reg_r(gspca_dev, 0x07, 0x0003, 2); + if ((gspca_dev->usb_buf[0] | gspca_dev->usb_buf[1]) == 0x00) break; } if (retry == 0) return -1; - reg_r(gspca_dev->dev, 0x07, 0x0000, &value, 1); - return value; + reg_r(gspca_dev, 0x07, 0x0000, 1); + return gspca_dev->usb_buf[0]; } static void spca506_SetNormeInput(struct gspca_dev *gspca_dev, @@ -437,7 +435,6 @@ static void sd_start(struct gspca_dev *gspca_dev) struct usb_device *dev = gspca_dev->dev; __u16 norme; __u16 channel; - __u8 Data[2]; /**************************************/ reg_w(dev, 0x03, 0x00, 0x0004); @@ -555,8 +552,8 @@ static void sd_start(struct gspca_dev *gspca_dev) /* compress setting and size */ /* set i2c luma */ reg_w(dev, 0x02, 0x01, 0x0000); - reg_w(dev, 0x03, 0x12, 0x000); - reg_r(dev, 0x04, 0x0001, Data, 2); + reg_w(dev, 0x03, 0x12, 0x0000); + reg_r(gspca_dev, 0x04, 0x0001, 2); PDEBUG(D_STREAM, "webcam started"); spca506_GetNormeInput(gspca_dev, &norme, &channel); spca506_SetNormeInput(gspca_dev, norme, channel); diff --git a/linux/drivers/media/video/gspca/spca508.c b/linux/drivers/media/video/gspca/spca508.c index a70d51117..ab568dfd5 100644 --- a/linux/drivers/media/video/gspca/spca508.c +++ b/linux/drivers/media/video/gspca/spca508.c @@ -22,8 +22,8 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) -static const char version[] = "2.1.5"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7) +static const char version[] = "2.1.7"; MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_DESCRIPTION("GSPCA/SPCA508 USB Camera Driver"); @@ -1471,26 +1471,26 @@ static int reg_write(struct usb_device *dev, /* read 1 byte */ /* returns: negative is error, pos or zero is data */ -static int reg_read(struct usb_device *dev, +static int reg_read(struct gspca_dev *gspca_dev, __u16 index) /* wIndex */ { int ret; - __u8 data; - ret = usb_control_msg(dev, - usb_rcvctrlpipe(dev, 0), + ret = usb_control_msg(gspca_dev->dev, + usb_rcvctrlpipe(gspca_dev->dev, 0), 0, /* register */ USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - (__u16) 0, /* value */ + 0, /* value */ index, - &data, 1, + gspca_dev->usb_buf, 1, 500); /* timeout */ - PDEBUG(D_USBI, "reg read i:%04x --> %02x", index, data); + PDEBUG(D_USBI, "reg read i:%04x --> %02x", + index, gspca_dev->usb_buf[0]); if (ret < 0) { PDEBUG(D_ERR|D_USBI, "reg_read err %d", ret); return ret; } - return data; + return gspca_dev->usb_buf[0]; } static int write_vector(struct gspca_dev *gspca_dev, @@ -1513,15 +1513,12 @@ static int sd_config(struct gspca_dev *gspca_dev, const struct usb_device_id *id) { struct sd *sd = (struct sd *) gspca_dev; - struct usb_device *dev = gspca_dev->dev; struct cam *cam; - __u16 vendor; __u16 product; int data1, data2; - vendor = id->idVendor; product = id->idProduct; - switch (vendor) { + switch (id->idVendor) { case 0x0130: /* Clone webcam */ /* switch (product) { */ /* case 0x0130: */ @@ -1573,15 +1570,15 @@ static int sd_config(struct gspca_dev *gspca_dev, * prove that we can communicate with the device. This works, which * confirms at we are communicating properly and that the device * is a 508. */ - data1 = reg_read(dev, 0x8104); - data2 = reg_read(dev, 0x8105); + data1 = reg_read(gspca_dev, 0x8104); + data2 = reg_read(gspca_dev, 0x8105); PDEBUG(D_PROBE, "Webcam Vendor ID: 0x%02x%02x", data2, data1); - data1 = reg_read(dev, 0x8106); - data2 = reg_read(dev, 0x8107); + data1 = reg_read(gspca_dev, 0x8106); + data2 = reg_read(gspca_dev, 0x8107); PDEBUG(D_PROBE, "Webcam Product ID: 0x%02x%02x", data2, data1); - data1 = reg_read(dev, 0x8621); + data1 = reg_read(gspca_dev, 0x8621); PDEBUG(D_PROBE, "Window 1 average luminance: %d", data1); cam = &gspca_dev->cam; @@ -1749,7 +1746,7 @@ static void getbrightness(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - sd->brightness = reg_read(gspca_dev->dev, 0x8651); + sd->brightness = reg_read(gspca_dev, 0x8651); } static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val) diff --git a/linux/drivers/media/video/gspca/spca561.c b/linux/drivers/media/video/gspca/spca561.c index f0770ee59..b659bd0f7 100644 --- a/linux/drivers/media/video/gspca/spca561.c +++ b/linux/drivers/media/video/gspca/spca561.c @@ -24,8 +24,8 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) -static const char version[] = "2.1.5"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7) +static const char version[] = "2.1.7"; MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_DESCRIPTION("GSPCA/SPCA561 USB Camera Driver"); @@ -177,27 +177,28 @@ static void write_vector(struct gspca_dev *gspca_dev, } } -static void reg_r(struct usb_device *dev, - __u16 index, __u8 *buffer, __u16 length) +/* read 'len' bytes to gspca_dev->usb_buf */ +static void reg_r(struct gspca_dev *gspca_dev, + __u16 index, __u16 length) { - usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), + usb_control_msg(gspca_dev->dev, + usb_rcvctrlpipe(gspca_dev->dev, 0), 0, /* request */ USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0, /* value */ - index, buffer, length, 500); + index, gspca_dev->usb_buf, length, 500); } -static void reg_w_buf(struct usb_device *dev, +static void reg_w_buf(struct gspca_dev *gspca_dev, __u16 index, const __u8 *buffer, __u16 len) { - __u8 tmpbuf[8]; - - memcpy(tmpbuf, buffer, len); - usb_control_msg(dev, usb_sndctrlpipe(dev, 0), + memcpy(gspca_dev->usb_buf, buffer, len); + usb_control_msg(gspca_dev->dev, + usb_sndctrlpipe(gspca_dev->dev, 0), 0, /* request */ USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0, /* value */ - index, tmpbuf, len, 500); + index, gspca_dev->usb_buf, len, 500); } static void i2c_init(struct gspca_dev *gspca_dev, __u8 mode) @@ -211,7 +212,6 @@ static void i2c_write(struct gspca_dev *gspca_dev, __u16 valeur, __u16 reg) int retry = 60; __u8 DataLow; __u8 DataHight; - __u8 Data; DataLow = valeur; DataHight = valeur >> 8; @@ -219,8 +219,8 @@ static void i2c_write(struct gspca_dev *gspca_dev, __u16 valeur, __u16 reg) reg_w_val(gspca_dev->dev, DataLow, 0x8805); reg_w_val(gspca_dev->dev, DataHight, 0x8800); while (retry--) { - reg_r(gspca_dev->dev, 0x8803, &Data, 1); - if (!Data) + reg_r(gspca_dev, 0x8803, 1); + if (!gspca_dev->usb_buf[0]) break; } } @@ -230,20 +230,21 @@ static int i2c_read(struct gspca_dev *gspca_dev, __u16 reg, __u8 mode) int retry = 60; __u8 value; __u8 vallsb; - __u8 Data; reg_w_val(gspca_dev->dev, 0x92, 0x8804); reg_w_val(gspca_dev->dev, reg, 0x8801); reg_w_val(gspca_dev->dev, (mode | 0x01), 0x8802); while (retry--) { - reg_r(gspca_dev->dev, 0x8803, &Data, 1); - if (!Data) + reg_r(gspca_dev, 0x8803, 1); + if (!gspca_dev->usb_buf) break; } if (retry == 0) return -1; - reg_r(gspca_dev->dev, 0x8800, &value, 1); - reg_r(gspca_dev->dev, 0x8805, &vallsb, 1); + reg_r(gspca_dev, 0x8800, 1); + value = gspca_dev->usb_buf[0]; + reg_r(gspca_dev, 0x8805, 1); + vallsb = gspca_dev->usb_buf[0]; return ((int) value << 8) | vallsb; } @@ -541,7 +542,7 @@ static void sensor_mapwrite(struct gspca_dev *gspca_dev, while (sensormap[i][0]) { usbval[0] = sensormap[i][1]; usbval[1] = sensormap[i][1] >> 8; - reg_w_buf(gspca_dev->dev, sensormap[i][0], usbval, 2); + reg_w_buf(gspca_dev, sensormap[i][0], usbval, 2); i++; } } @@ -559,7 +560,6 @@ static int sd_config(struct gspca_dev *gspca_dev, const struct usb_device_id *id) { struct sd *sd = (struct sd *) gspca_dev; - struct usb_device *dev = gspca_dev->dev; struct cam *cam; __u16 vendor, product; __u8 data1, data2; @@ -568,11 +568,15 @@ static int sd_config(struct gspca_dev *gspca_dev, * prove that we can communicate with the device. This works, which * confirms at we are communicating properly and that the device * is a 561. */ - reg_r(dev, 0x8104, &data1, 1); - reg_r(dev, 0x8105, &data2, 1); + reg_r(gspca_dev, 0x8104, 1); + data1 = gspca_dev->usb_buf[0]; + reg_r(gspca_dev, 0x8105, 1); + data2 = gspca_dev->usb_buf[0]; vendor = (data2 << 8) | data1; - reg_r(dev, 0x8106, &data1, 1); - reg_r(dev, 0x8107, &data2, 1); + reg_r(gspca_dev, 0x8106, 1); + data1 = gspca_dev->usb_buf[0]; + reg_r(gspca_dev, 0x8107, 1); + data2 = gspca_dev->usb_buf[0]; product = (data2 << 8) | data1; if (vendor != id->idVendor || product != id->idProduct) { PDEBUG(D_PROBE, "Bad vendor / product from device"); @@ -656,8 +660,8 @@ static void setcontrast(struct gspca_dev *gspca_dev) Reg8391[0] = expotimes & 0xff; /* exposure */ Reg8391[1] = 0x18 | (expotimes >> 8); Reg8391[2] = sd->brightness; /* gain */ - reg_w_buf(dev, 0x8391, Reg8391, 8); - reg_w_buf(dev, 0x8390, Reg8391, 8); + reg_w_buf(gspca_dev, 0x8391, Reg8391, 8); + reg_w_buf(gspca_dev, 0x8390, Reg8391, 8); break; } } @@ -714,10 +718,11 @@ static void sd_start(struct gspca_dev *gspca_dev) * is sufficient to push raw frames at ~20fps */ reg_w_val(dev, 0x8500, mode); } /* -- qq@kuku.eu.org */ - reg_w_buf(dev, 0x8307, Reg8307, 2); - reg_w_val(dev, 0x8700, Clck); /* 0x8f 0x85 0x27 clock */ - reg_w_val(dev, 0x8112, 0x1e | 0x20); - reg_w_val(dev, 0x850b, 0x03); + reg_w_buf(gspca_dev, 0x8307, Reg8307, 2); + reg_w_val(gspca_dev->dev, 0x8700, Clck); + /* 0x8f 0x85 0x27 clock */ + reg_w_val(gspca_dev->dev, 0x8112, 0x1e | 0x20); + reg_w_val(gspca_dev->dev, 0x850b, 0x03); setcontrast(gspca_dev); break; } @@ -752,10 +757,14 @@ static void setautogain(struct gspca_dev *gspca_dev) switch (sd->chip_revision) { case Rev072A: - reg_r(gspca_dev->dev, 0x8621, &Gr, 1); - reg_r(gspca_dev->dev, 0x8622, &R, 1); - reg_r(gspca_dev->dev, 0x8623, &B, 1); - reg_r(gspca_dev->dev, 0x8624, &Gb, 1); + reg_r(gspca_dev, 0x8621, 1); + Gr = gspca_dev->usb_buf[0]; + reg_r(gspca_dev, 0x8622, 1); + R = gspca_dev->usb_buf[0]; + reg_r(gspca_dev, 0x8623, 1); + B = gspca_dev->usb_buf[0]; + reg_r(gspca_dev, 0x8624, 1); + Gb = gspca_dev->usb_buf[0]; y = (77 * R + 75 * (Gr + Gb) + 29 * B) >> 8; /* u= (128*B-(43*(Gr+Gb+R))) >> 8; */ /* v= (128*R-(53*(Gr+Gb))-21*B) >> 8; */ @@ -867,20 +876,19 @@ static void setbrightness(struct gspca_dev *gspca_dev) static void getbrightness(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - __u8 value; __u16 tot; switch (sd->chip_revision) { case Rev072A: tot = 0; - reg_r(gspca_dev->dev, 0x8611, &value, 1); - tot += value; - reg_r(gspca_dev->dev, 0x8612, &value, 1); - tot += value; - reg_r(gspca_dev->dev, 0x8613, &value, 1); - tot += value; - reg_r(gspca_dev->dev, 0x8614, &value, 1); - tot += value; + reg_r(gspca_dev, 0x8611, 1); + tot += gspca_dev->usb_buf[0]; + reg_r(gspca_dev, 0x8612, 1); + tot += gspca_dev->usb_buf[0]; + reg_r(gspca_dev, 0x8613, 1); + tot += gspca_dev->usb_buf[0]; + reg_r(gspca_dev, 0x8614, 1); + tot += gspca_dev->usb_buf[0]; sd->brightness = tot >> 2; break; default: @@ -893,20 +901,19 @@ static void getbrightness(struct gspca_dev *gspca_dev) static void getcontrast(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - __u8 value; __u16 tot; switch (sd->chip_revision) { case Rev072A: tot = 0; - reg_r(gspca_dev->dev, 0x8651, &value, 1); - tot += value; - reg_r(gspca_dev->dev, 0x8652, &value, 1); - tot += value; - reg_r(gspca_dev->dev, 0x8653, &value, 1); - tot += value; - reg_r(gspca_dev->dev, 0x8654, &value, 1); - tot += value; + reg_r(gspca_dev, 0x8651, 1); + tot += gspca_dev->usb_buf[0]; + reg_r(gspca_dev, 0x8652, 1); + tot += gspca_dev->usb_buf[0]; + reg_r(gspca_dev, 0x8653, 1); + tot += gspca_dev->usb_buf[0]; + reg_r(gspca_dev, 0x8654, 1); + tot += gspca_dev->usb_buf[0]; sd->contrast = tot << 6; break; default: diff --git a/linux/drivers/media/video/gspca/stk014.c b/linux/drivers/media/video/gspca/stk014.c index d676cd16a..c78ee0d3e 100644 --- a/linux/drivers/media/video/gspca/stk014.c +++ b/linux/drivers/media/video/gspca/stk014.c @@ -23,8 +23,8 @@ #include "gspca.h" #include "jpeg.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) -static const char version[] = "2.1.5"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7) +static const char version[] = "2.1.7"; MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>"); MODULE_DESCRIPTION("Syntek DV4000 (STK014) USB Camera Driver"); @@ -127,7 +127,7 @@ static struct v4l2_pix_format vga_mode[] = { /* -- read a register -- */ static int reg_r(struct gspca_dev *gspca_dev, - __u16 index, __u8 *buf) + __u16 index) { struct usb_device *dev = gspca_dev->dev; int ret; @@ -137,11 +137,13 @@ static int reg_r(struct gspca_dev *gspca_dev, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0x00, index, - buf, 1, + gspca_dev->usb_buf, 1, 500); - if (ret < 0) + if (ret < 0) { PDEBUG(D_ERR, "reg_r err %d", ret); - return ret; + return ret; + } + return gspca_dev->usb_buf[0]; } /* -- write a register -- */ @@ -164,58 +166,55 @@ static int reg_w(struct gspca_dev *gspca_dev, return ret; } -/* -- get a value -- */ +/* -- get a bulk value (4 bytes) -- */ static int rcv_val(struct gspca_dev *gspca_dev, - int ads, - int len) + int ads) { struct usb_device *dev = gspca_dev->dev; int alen, ret; - unsigned char bulk_buf[4]; reg_w(gspca_dev, 0x634, (ads >> 16) & 0xff); reg_w(gspca_dev, 0x635, (ads >> 8) & 0xff); reg_w(gspca_dev, 0x636, ads & 0xff); reg_w(gspca_dev, 0x637, 0); - reg_w(gspca_dev, 0x638, len & 0xff); - reg_w(gspca_dev, 0x639, len >> 8); + reg_w(gspca_dev, 0x638, 4); /* len & 0xff */ + reg_w(gspca_dev, 0x639, 0); /* len >> 8 */ reg_w(gspca_dev, 0x63a, 0); reg_w(gspca_dev, 0x63b, 0); reg_w(gspca_dev, 0x630, 5); - if (len > sizeof bulk_buf) - return -1; ret = usb_bulk_msg(dev, usb_rcvbulkpipe(dev, 5), - bulk_buf, - len, + gspca_dev->usb_buf, + 4, /* length */ &alen, - 500); /* timeout in milliseconds */ + 500); /* timeout in milliseconds */ return ret; } -/* -- send a value -- */ +/* -- send a bulk value -- */ static int snd_val(struct gspca_dev *gspca_dev, int ads, unsigned int val) { struct usb_device *dev = gspca_dev->dev; int alen, ret; - __u8 value, seq; - unsigned char bulk_buf[4]; + __u8 seq = 0; if (ads == 0x003f08) { - ret = reg_r(gspca_dev, 0x0704, &value); + ret = reg_r(gspca_dev, 0x0704); if (ret < 0) goto ko; - ret = reg_r(gspca_dev, 0x0705, &seq); + ret = reg_r(gspca_dev, 0x0705); if (ret < 0) goto ko; - ret = reg_r(gspca_dev, 0x0650, &value); + seq = ret; /* keep the sequence number */ + ret = reg_r(gspca_dev, 0x0650); if (ret < 0) goto ko; reg_w(gspca_dev, 0x654, seq); - } else + } else { reg_w(gspca_dev, 0x654, (ads >> 16) & 0xff); + } reg_w(gspca_dev, 0x655, (ads >> 8) & 0xff); reg_w(gspca_dev, 0x656, ads & 0xff); reg_w(gspca_dev, 0x657, 0); @@ -224,13 +223,13 @@ static int snd_val(struct gspca_dev *gspca_dev, reg_w(gspca_dev, 0x65a, 0); reg_w(gspca_dev, 0x65b, 0); reg_w(gspca_dev, 0x650, 5); - bulk_buf[0] = (val >> 24) & 0xff; - bulk_buf[1] = (val >> 16) & 0xff; - bulk_buf[2] = (val >> 8) & 0xff; - bulk_buf[3] = val & 0xff; + gspca_dev->usb_buf[0] = val >> 24; + gspca_dev->usb_buf[1] = val >> 16; + gspca_dev->usb_buf[2] = val >> 8; + gspca_dev->usb_buf[3] = val; ret = usb_bulk_msg(dev, usb_sndbulkpipe(dev, 6), - bulk_buf, + gspca_dev->usb_buf, 4, &alen, 500); /* timeout in milliseconds */ @@ -303,7 +302,7 @@ static int sd_config(struct gspca_dev *gspca_dev, cam->dev_name = (char *) id->driver_info; cam->epaddr = 0x02; gspca_dev->cam.cam_mode = vga_mode; - gspca_dev->cam.nmodes = sizeof vga_mode / sizeof vga_mode[0]; + gspca_dev->cam.nmodes = ARRAY_SIZE(vga_mode); sd->brightness = BRIGHTNESS_DEF; sd->contrast = CONTRAST_DEF; sd->colors = COLOR_DEF; @@ -314,16 +313,15 @@ static int sd_config(struct gspca_dev *gspca_dev, /* this function is called at open time */ static int sd_open(struct gspca_dev *gspca_dev) { - __u8 value; int ret; /* check if the device responds */ usb_set_interface(gspca_dev->dev, gspca_dev->iface, 1); - ret = reg_r(gspca_dev, 0x0740, &value); + ret = reg_r(gspca_dev, 0x0740); if (ret < 0) return ret; - if (value != 0xff) { - PDEBUG(D_ERR|D_STREAM, "init reg: 0x%02x", value); + if (ret != 0xff) { + PDEBUG(D_ERR|D_STREAM, "init reg: 0x%02x", ret); return -1; } return 0; @@ -332,7 +330,6 @@ static int sd_open(struct gspca_dev *gspca_dev) /* -- start the camera -- */ static void sd_start(struct gspca_dev *gspca_dev) { - __u8 dum; int ret, value; /* work on alternate 1 */ @@ -355,11 +352,11 @@ static void sd_start(struct gspca_dev *gspca_dev) gspca_dev->iface, gspca_dev->alt); goto out; } - ret = reg_r(gspca_dev, 0x0630, &dum); + ret = reg_r(gspca_dev, 0x0630); if (ret < 0) goto out; - rcv_val(gspca_dev, 0x000020, 4); /* << (value ff ff ff ff) */ - ret = reg_r(gspca_dev, 0x0650, &dum); + rcv_val(gspca_dev, 0x000020); /* << (value ff ff ff ff) */ + ret = reg_r(gspca_dev, 0x0650); if (ret < 0) goto out; snd_val(gspca_dev, 0x000020, 0xffffffff); @@ -389,14 +386,13 @@ out: static void sd_stopN(struct gspca_dev *gspca_dev) { struct usb_device *dev = gspca_dev->dev; - __u8 value; set_par(gspca_dev, 0x02000000); set_par(gspca_dev, 0x02000000); usb_set_interface(dev, gspca_dev->iface, 1); - reg_r(gspca_dev, 0x0630, &value); - rcv_val(gspca_dev, 0x000020, 4); /* << (value ff ff ff ff) */ - reg_r(gspca_dev, 0x0650, &value); + reg_r(gspca_dev, 0x0630); + rcv_val(gspca_dev, 0x000020); /* << (value ff ff ff ff) */ + reg_r(gspca_dev, 0x0650); snd_val(gspca_dev, 0x000020, 0xffffffff); reg_w(gspca_dev, 0x0620, 0); reg_w(gspca_dev, 0x0630, 0); @@ -538,10 +534,10 @@ static int sd_querymenu(struct gspca_dev *gspca_dev, } /* sub-driver description */ -static struct sd_desc sd_desc = { +static const struct sd_desc sd_desc = { .name = MODULE_NAME, .ctrls = sd_ctrls, - .nctrls = sizeof sd_ctrls / sizeof sd_ctrls[0], + .nctrls = ARRAY_SIZE(sd_ctrls), .config = sd_config, .open = sd_open, .start = sd_start, @@ -554,7 +550,7 @@ static struct sd_desc sd_desc = { /* -- module initialisation -- */ #define DVNM(name) .driver_info = (kernel_ulong_t) name -static __devinitdata struct usb_device_id device_table[] = { +static const __devinitdata struct usb_device_id device_table[] = { {USB_DEVICE(0x05e1, 0x0893), DVNM("Syntek DV4000")}, {} }; diff --git a/linux/drivers/media/video/gspca/sunplus.c b/linux/drivers/media/video/gspca/sunplus.c index 6e02726ee..9622ee643 100644 --- a/linux/drivers/media/video/gspca/sunplus.c +++ b/linux/drivers/media/video/gspca/sunplus.c @@ -24,8 +24,8 @@ #include "gspca.h" #include "jpeg.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) -static const char version[] = "2.1.5"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7) +static const char version[] = "2.1.7"; MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_DESCRIPTION("GSPCA/SPCA5xx USB Camera Driver"); @@ -483,7 +483,7 @@ static const __u8 qtable_spca504_default[2][64] = { 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e} }; -static void spca5xxRegRead(struct usb_device *dev, +static void reg_r(struct usb_device *dev, __u16 req, __u16 index, __u8 *buffer, __u16 length) @@ -497,7 +497,7 @@ static void spca5xxRegRead(struct usb_device *dev, 500); } -static void spca5xxRegWrite(struct usb_device *dev, +static void reg_w(struct usb_device *dev, __u16 req, __u16 value, __u16 index, @@ -511,7 +511,8 @@ static void spca5xxRegWrite(struct usb_device *dev, 500); } -static int reg_write(struct usb_device *dev, +/* write req / index / value */ +static int reg_w_riv(struct usb_device *dev, __u16 req, __u16 index, __u16 value) { int ret; @@ -521,57 +522,56 @@ static int reg_write(struct usb_device *dev, req, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, value, index, NULL, 0, 500); - PDEBUG(D_PACK, "reg write: 0x%02x,0x%02x:0x%02x, 0x%x", + PDEBUG(D_USBO, "reg write: 0x%02x,0x%02x:0x%02x, %d", req, index, value, ret); if (ret < 0) PDEBUG(D_ERR, "reg write: error %d", ret); return ret; } -static int reg_read_info(struct usb_device *dev, +/* read 1 byte */ +static int reg_r_1(struct gspca_dev *gspca_dev, __u16 value) /* wValue */ { int ret; - __u8 data; - ret = usb_control_msg(dev, - usb_rcvctrlpipe(dev, 0), + ret = usb_control_msg(gspca_dev->dev, + usb_rcvctrlpipe(gspca_dev->dev, 0), 0x20, /* request */ USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, value, 0, /* index */ - &data, 1, + gspca_dev->usb_buf, 1, 500); /* timeout */ if (ret < 0) { - PDEBUG(D_ERR, "reg_read_info err %d", ret); + PDEBUG(D_ERR, "reg_r_1 err %d", ret); return 0; } - return data; + return gspca_dev->usb_buf[0]; } -/* returns: negative is error, pos or zero is data */ -static int reg_read(struct usb_device *dev, +/* read 1 or 2 bytes - returns < 0 if error */ +static int reg_r_12(struct gspca_dev *gspca_dev, __u16 req, /* bRequest */ __u16 index, /* wIndex */ __u16 length) /* wLength (1 or 2 only) */ { int ret; - __u8 buf[2]; - buf[1] = 0; - ret = usb_control_msg(dev, - usb_rcvctrlpipe(dev, 0), + gspca_dev->usb_buf[1] = 0; + ret = usb_control_msg(gspca_dev->dev, + usb_rcvctrlpipe(gspca_dev->dev, 0), req, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0, /* value */ index, - buf, length, + gspca_dev->usb_buf, length, 500); if (ret < 0) { PDEBUG(D_ERR, "reg_read err %d", ret); return -1; } - return (buf[1] << 8) + buf[0]; + return (gspca_dev->usb_buf[1] << 8) + gspca_dev->usb_buf[0]; } static int write_vector(struct gspca_dev *gspca_dev, @@ -581,7 +581,7 @@ static int write_vector(struct gspca_dev *gspca_dev, int ret, i = 0; while (data[i][0] != 0 || data[i][1] != 0 || data[i][2] != 0) { - ret = reg_write(dev, data[i][0], data[i][2], data[i][1]); + ret = reg_w_riv(dev, data[i][0], data[i][2], data[i][1]); if (ret < 0) { PDEBUG(D_ERR, "Register write failed for 0x%x,0x%x,0x%x", @@ -604,14 +604,14 @@ static int spca50x_setup_qtable(struct gspca_dev *gspca_dev, /* loop over y components */ for (i = 0; i < 64; i++) { - err = reg_write(dev, request, ybase + i, qtable[0][i]); + err = reg_w_riv(dev, request, ybase + i, qtable[0][i]); if (err < 0) return err; } /* loop over c components */ for (i = 0; i < 64; i++) { - err = reg_write(dev, request, cbase + i, qtable[1][i]); + err = reg_w_riv(dev, request, cbase + i, qtable[1][i]); if (err < 0) return err; } @@ -624,14 +624,14 @@ static void spca504_acknowledged_command(struct gspca_dev *gspca_dev, struct usb_device *dev = gspca_dev->dev; __u8 notdone; - reg_write(dev, req, idx, val); - notdone = reg_read(dev, 0x01, 0x0001, 1); - reg_write(dev, req, idx, val); + reg_w_riv(dev, req, idx, val); + notdone = reg_r_12(gspca_dev, 0x01, 0x0001, 1); + reg_w_riv(dev, req, idx, val); PDEBUG(D_FRAM, "before wait 0x%x", notdone); msleep(200); - notdone = reg_read(dev, 0x01, 0x0001, 1); + notdone = reg_r_12(gspca_dev, 0x01, 0x0001, 1); PDEBUG(D_FRAM, "after wait 0x%x", notdone); } @@ -643,8 +643,8 @@ static void spca504A_acknowledged_command(struct gspca_dev *gspca_dev, __u8 status; __u8 endcode; - reg_write(dev, req, idx, val); - status = reg_read(dev, 0x01, 0x0001, 1); + reg_w_riv(dev, req, idx, val); + status = reg_r_12(gspca_dev, 0x01, 0x0001, 1); endcode = stat; PDEBUG(D_FRAM, "Status 0x%x Need 0x%x", status, stat); if (!count) @@ -653,8 +653,8 @@ static void spca504A_acknowledged_command(struct gspca_dev *gspca_dev, while (--count > 0) { msleep(10); /* gsmart mini2 write a each wait setting 1 ms is enought */ -/* reg_write(dev, req, idx, val); */ - status = reg_read(dev, 0x01, 0x0001, 1); +/* reg_w_riv(dev, req, idx, val); */ + status = reg_r_12(gspca_dev, 0x01, 0x0001, 1); if (status == endcode) { PDEBUG(D_FRAM, "status 0x%x after wait 0x%x", status, 200 - count); @@ -663,34 +663,31 @@ static void spca504A_acknowledged_command(struct gspca_dev *gspca_dev, } } -static int spca504B_PollingDataReady(struct usb_device *dev) +static int spca504B_PollingDataReady(struct gspca_dev *gspca_dev) { - __u8 DataReady; int count = 10; while (--count > 0) { - spca5xxRegRead(dev, 0x21, 0, &DataReady, 1); - if ((DataReady & 0x01) == 0) + reg_r(gspca_dev->dev, 0x21, 0, gspca_dev->usb_buf, 1); + if ((gspca_dev->usb_buf[0] & 0x01) == 0) break; msleep(10); } - return DataReady; + return gspca_dev->usb_buf[0]; } static void spca504B_WaitCmdStatus(struct gspca_dev *gspca_dev) { struct usb_device *dev = gspca_dev->dev; - __u8 DataReady; int count = 50; while (--count > 0) { - spca5xxRegRead(dev, 0x21, 1, &DataReady, 1); - - if (DataReady) { - DataReady = 0; - spca5xxRegWrite(dev, 0x21, 0, 1, &DataReady, 1); - spca5xxRegRead(dev, 0x21, 1, &DataReady, 1); - spca504B_PollingDataReady(dev); + reg_r(dev, 0x21, 1, gspca_dev->usb_buf, 1); + if (gspca_dev->usb_buf[0] != 0) { + gspca_dev->usb_buf[0] = 0; + reg_w(dev, 0x21, 0, 1, gspca_dev->usb_buf, 1); + reg_r(dev, 0x21, 1, gspca_dev->usb_buf, 1); + spca504B_PollingDataReady(gspca_dev); break; } msleep(10); @@ -700,14 +697,15 @@ static void spca504B_WaitCmdStatus(struct gspca_dev *gspca_dev) static void spca50x_GetFirmware(struct gspca_dev *gspca_dev) { struct usb_device *dev = gspca_dev->dev; - __u8 FW[5]; - __u8 ProductInfo[64]; + __u8 *data; - spca5xxRegRead(dev, 0x20, 0, FW, 5); + data = kmalloc(64, GFP_KERNEL); + reg_r(dev, 0x20, 0, data, 5); PDEBUG(D_STREAM, "FirmWare : %d %d %d %d %d ", - FW[0], FW[1], FW[2], FW[3], FW[4]); - spca5xxRegRead(dev, 0x23, 0, ProductInfo, 64); - spca5xxRegRead(dev, 0x23, 1, ProductInfo, 64); + data[0], data[1], data[2], data[3], data[4]); + reg_r(dev, 0x23, 0, data, 64); + reg_r(dev, 0x23, 1, data, 64); + kfree(data); } static void spca504B_SetSizeType(struct gspca_dev *gspca_dev) @@ -722,32 +720,35 @@ static void spca504B_SetSizeType(struct gspca_dev *gspca_dev) Type = 0; switch (sd->bridge) { case BRIDGE_SPCA533: - spca5xxRegWrite(dev, 0x31, 0, 0, NULL, 0); + reg_w(dev, 0x31, 0, 0, NULL, 0); spca504B_WaitCmdStatus(gspca_dev); - rc = spca504B_PollingDataReady(dev); + rc = spca504B_PollingDataReady(gspca_dev); spca50x_GetFirmware(gspca_dev); - Type = 2; - spca5xxRegWrite(dev, 0x24, 0, 8, &Type, 1); - spca5xxRegRead(dev, 0x24, 8, &Type, 1); + gspca_dev->usb_buf[0] = 2; /* type */ + reg_w(dev, 0x24, 0, 8, gspca_dev->usb_buf, 1); + reg_r(dev, 0x24, 8, gspca_dev->usb_buf, 1); - spca5xxRegWrite(dev, 0x25, 0, 4, &Size, 1); - spca5xxRegRead(dev, 0x25, 4, &Size, 1); - rc = spca504B_PollingDataReady(dev); + gspca_dev->usb_buf[0] = Size; + reg_w(dev, 0x25, 0, 4, gspca_dev->usb_buf, 1); + reg_r(dev, 0x25, 4, gspca_dev->usb_buf, 1); /* size */ + rc = spca504B_PollingDataReady(gspca_dev); /* Init the cam width height with some values get on init ? */ - spca5xxRegWrite(dev, 0x31, 0, 4, NULL, 0); + reg_w(dev, 0x31, 0, 4, NULL, 0); spca504B_WaitCmdStatus(gspca_dev); - rc = spca504B_PollingDataReady(dev); + rc = spca504B_PollingDataReady(gspca_dev); break; default: /* case BRIDGE_SPCA504B: */ /* case BRIDGE_SPCA536: */ + gspca_dev->usb_buf[0] = Size; + reg_w(dev, 0x25, 0, 4, gspca_dev->usb_buf, 1); + reg_r(dev, 0x25, 4, gspca_dev->usb_buf, 1); /* size */ Type = 6; - spca5xxRegWrite(dev, 0x25, 0, 4, &Size, 1); - spca5xxRegRead(dev, 0x25, 4, &Size, 1); - spca5xxRegWrite(dev, 0x27, 0, 0, &Type, 1); - spca5xxRegRead(dev, 0x27, 0, &Type, 1); - rc = spca504B_PollingDataReady(dev); + gspca_dev->usb_buf[0] = Type; + reg_w(dev, 0x27, 0, 0, gspca_dev->usb_buf, 1); + reg_r(dev, 0x27, 0, gspca_dev->usb_buf, 1); /* type */ + rc = spca504B_PollingDataReady(gspca_dev); break; case BRIDGE_SPCA504: Size += 3; @@ -764,21 +765,20 @@ static void spca504B_SetSizeType(struct gspca_dev *gspca_dev) break; case BRIDGE_SPCA504C: /* capture mode */ - reg_write(dev, 0xa0, (0x0500 | (Size & 0x0f)), 0x0); - reg_write(dev, 0x20, 0x01, 0x0500 | (Size & 0x0f)); + reg_w_riv(dev, 0xa0, (0x0500 | (Size & 0x0f)), 0x00); + reg_w_riv(dev, 0x20, 0x01, 0x0500 | (Size & 0x0f)); break; } } static void spca504_wait_status(struct gspca_dev *gspca_dev) { - struct usb_device *dev = gspca_dev->dev; int cnt; cnt = 256; while (--cnt > 0) { /* With this we get the status, when return 0 it's all ok */ - if (reg_read(dev, 0x06, 0x00, 1) == 0) + if (reg_r_12(gspca_dev, 0x06, 0x00, 1) == 0) return; msleep(10); } @@ -787,11 +787,11 @@ static void spca504_wait_status(struct gspca_dev *gspca_dev) static void spca504B_setQtable(struct gspca_dev *gspca_dev) { struct usb_device *dev = gspca_dev->dev; - __u8 Data = 3; - spca5xxRegWrite(dev, 0x26, 0, 0, &Data, 1); - spca5xxRegRead(dev, 0x26, 0, &Data, 1); - spca504B_PollingDataReady(dev); + gspca_dev->usb_buf[0] = 3; + reg_w(dev, 0x26, 0, 0, gspca_dev->usb_buf, 1); + reg_r(dev, 0x26, 0, gspca_dev->usb_buf, 1); + spca504B_PollingDataReady(gspca_dev); } static void sp5xx_initContBrigHueRegisters(struct gspca_dev *gspca_dev) @@ -808,24 +808,24 @@ static void sp5xx_initContBrigHueRegisters(struct gspca_dev *gspca_dev) default: /* case BRIDGE_SPCA533: */ /* case BRIDGE_SPCA504B: */ - spca5xxRegWrite(dev, 0, 0, 0x21a7, NULL, 0); /* brightness */ - spca5xxRegWrite(dev, 0, 0x20, 0x21a8, NULL, 0); /* contrast */ - spca5xxRegWrite(dev, 0, 0, 0x21ad, NULL, 0); /* hue */ - spca5xxRegWrite(dev, 0, 1, 0x21ac, NULL, 0); /* sat/hue */ - spca5xxRegWrite(dev, 0, 0x20, 0x21ae, NULL, 0); /* saturation */ - spca5xxRegWrite(dev, 0, 0, 0x21a3, NULL, 0); /* gamma */ + reg_w(dev, 0, 0, 0x21a7, NULL, 0); /* brightness */ + reg_w(dev, 0, 0x20, 0x21a8, NULL, 0); /* contrast */ + reg_w(dev, 0, 0, 0x21ad, NULL, 0); /* hue */ + reg_w(dev, 0, 1, 0x21ac, NULL, 0); /* sat/hue */ + reg_w(dev, 0, 0x20, 0x21ae, NULL, 0); /* saturation */ + reg_w(dev, 0, 0, 0x21a3, NULL, 0); /* gamma */ break; case BRIDGE_SPCA536: - spca5xxRegWrite(dev, 0, 0, 0x20f0, NULL, 0); - spca5xxRegWrite(dev, 0, 0x21, 0x20f1, NULL, 0); - spca5xxRegWrite(dev, 0, 0x40, 0x20f5, NULL, 0); - spca5xxRegWrite(dev, 0, 1, 0x20f4, NULL, 0); - spca5xxRegWrite(dev, 0, 0x40, 0x20f6, NULL, 0); - spca5xxRegWrite(dev, 0, 0, 0x2089, NULL, 0); + reg_w(dev, 0, 0, 0x20f0, NULL, 0); + reg_w(dev, 0, 0x21, 0x20f1, NULL, 0); + reg_w(dev, 0, 0x40, 0x20f5, NULL, 0); + reg_w(dev, 0, 1, 0x20f4, NULL, 0); + reg_w(dev, 0, 0x40, 0x20f6, NULL, 0); + reg_w(dev, 0, 0, 0x2089, NULL, 0); break; } if (pollreg) - spca504B_PollingDataReady(dev); + spca504B_PollingDataReady(gspca_dev); } /* this function is called at probe time */ @@ -903,7 +903,8 @@ static int sd_config(struct gspca_dev *gspca_dev, case 0x504a: /* try to get the firmware as some cam answer 2.0.1.2.2 * and should be a spca504b then overwrite that setting */ - spca5xxRegRead(dev, 0x20, 0, &fw, 1); + reg_r(dev, 0x20, 0, gspca_dev->usb_buf, 1); + fw = gspca_dev->usb_buf[0]; if (fw == 1) { sd->subtype = AiptekMiniPenCam13; sd->bridge = BRIDGE_SPCA504; @@ -1079,38 +1080,37 @@ static int sd_open(struct gspca_dev *gspca_dev) struct sd *sd = (struct sd *) gspca_dev; struct usb_device *dev = gspca_dev->dev; int rc; - __u8 Data; __u8 i; __u8 info[6]; int err_code; switch (sd->bridge) { case BRIDGE_SPCA504B: - spca5xxRegWrite(dev, 0x1d, 0, 0, NULL, 0); - spca5xxRegWrite(dev, 0, 1, 0x2306, NULL, 0); - spca5xxRegWrite(dev, 0, 0, 0x0d04, NULL, 0); - spca5xxRegWrite(dev, 0, 0, 0x2000, NULL, 0); - spca5xxRegWrite(dev, 0, 0x13, 0x2301, NULL, 0); - spca5xxRegWrite(dev, 0, 0, 0x2306, NULL, 0); + reg_w(dev, 0x1d, 0, 0, NULL, 0); + reg_w(dev, 0, 1, 0x2306, NULL, 0); + reg_w(dev, 0, 0, 0x0d04, NULL, 0); + reg_w(dev, 0, 0, 0x2000, NULL, 0); + reg_w(dev, 0, 0x13, 0x2301, NULL, 0); + reg_w(dev, 0, 0, 0x2306, NULL, 0); /* fall thru */ case BRIDGE_SPCA533: - rc = spca504B_PollingDataReady(dev); + rc = spca504B_PollingDataReady(gspca_dev); spca50x_GetFirmware(gspca_dev); break; case BRIDGE_SPCA536: spca50x_GetFirmware(gspca_dev); - spca5xxRegRead(dev, 0x00, 0x5002, &Data, 1); - Data = 0; - spca5xxRegWrite(dev, 0x24, 0, 0, &Data, 1); - spca5xxRegRead(dev, 0x24, 0, &Data, 1); - rc = spca504B_PollingDataReady(dev); - spca5xxRegWrite(dev, 0x34, 0, 0, NULL, 0); + reg_r(dev, 0x00, 0x5002, gspca_dev->usb_buf, 1); + gspca_dev->usb_buf[0] = 0; + reg_w(dev, 0x24, 0, 0, gspca_dev->usb_buf, 1); + reg_r(dev, 0x24, 0, gspca_dev->usb_buf, 1); + rc = spca504B_PollingDataReady(gspca_dev); + reg_w(dev, 0x34, 0, 0, NULL, 0); spca504B_WaitCmdStatus(gspca_dev); break; case BRIDGE_SPCA504C: /* pccam600 */ PDEBUG(D_STREAM, "Opening SPCA504 (PC-CAM 600)"); - reg_write(dev, 0xe0, 0x0000, 0x0000); - reg_write(dev, 0xe0, 0x0000, 0x0001); /* reset */ + reg_w_riv(dev, 0xe0, 0x0000, 0x0000); + reg_w_riv(dev, 0xe0, 0x0000, 0x0001); /* reset */ spca504_wait_status(gspca_dev); if (sd->subtype == LogitechClickSmart420) write_vector(gspca_dev, @@ -1131,7 +1131,7 @@ static int sd_open(struct gspca_dev *gspca_dev) if (sd->subtype == AiptekMiniPenCam13) { /*****************************/ for (i = 0; i < 6; i++) - info[i] = reg_read_info(dev, i); + info[i] = reg_r_1(gspca_dev, i); PDEBUG(D_STREAM, "Read info: %d %d %d %d %d %d." " Should be 1,0,2,2,0,0", @@ -1157,14 +1157,14 @@ static int sd_open(struct gspca_dev *gspca_dev) 6, 0, 0x86, 1); */ /* spca504A_acknowledged_command (gspca_dev, 0x24, 0, 0, 0x9D, 1); */ - reg_write(dev, 0x0, 0x270c, 0x5); /* L92 sno1t.txt */ - reg_write(dev, 0x0, 0x2310, 0x5); + reg_w_riv(dev, 0x0, 0x270c, 0x05); /* L92 sno1t.txt */ + reg_w_riv(dev, 0x0, 0x2310, 0x05); spca504A_acknowledged_command(gspca_dev, 0x01, 0x0f, 0, 0xff, 0); } /* setup qtable */ - reg_write(dev, 0, 0x2000, 0); - reg_write(dev, 0, 0x2883, 1); + reg_w_riv(dev, 0, 0x2000, 0); + reg_w_riv(dev, 0, 0x2883, 1); err_code = spca50x_setup_qtable(gspca_dev, 0x00, 0x2800, 0x2840, @@ -1197,20 +1197,20 @@ static void sd_start(struct gspca_dev *gspca_dev) /* case BRIDGE_SPCA536: */ if (sd->subtype == MegapixV4 || sd->subtype == LogitechClickSmart820) { - spca5xxRegWrite(dev, 0xf0, 0, 0, NULL, 0); + reg_w(dev, 0xf0, 0, 0, NULL, 0); spca504B_WaitCmdStatus(gspca_dev); - spca5xxRegRead(dev, 0xf0, 4, NULL, 0); + reg_r(dev, 0xf0, 4, NULL, 0); spca504B_WaitCmdStatus(gspca_dev); } else { - spca5xxRegWrite(dev, 0x31, 0, 4, NULL, 0); + reg_w(dev, 0x31, 0, 4, NULL, 0); spca504B_WaitCmdStatus(gspca_dev); - rc = spca504B_PollingDataReady(dev); + rc = spca504B_PollingDataReady(gspca_dev); } break; case BRIDGE_SPCA504: if (sd->subtype == AiptekMiniPenCam13) { for (i = 0; i < 6; i++) - info[i] = reg_read_info(dev, i); + info[i] = reg_r_1(gspca_dev, i); PDEBUG(D_STREAM, "Read info: %d %d %d %d %d %d." " Should be 1,0,2,2,0,0", @@ -1228,7 +1228,7 @@ static void sd_start(struct gspca_dev *gspca_dev) } else { spca504_acknowledged_command(gspca_dev, 0x24, 8, 3); for (i = 0; i < 6; i++) - info[i] = reg_read_info(dev, i); + info[i] = reg_r_1(gspca_dev, i); PDEBUG(D_STREAM, "Read info: %d %d %d %d %d %d." " Should be 1,0,2,2,0,0", @@ -1238,8 +1238,8 @@ static void sd_start(struct gspca_dev *gspca_dev) spca504_acknowledged_command(gspca_dev, 0x24, 0, 0); } spca504B_SetSizeType(gspca_dev); - reg_write(dev, 0x0, 0x270c, 0x5); /* L92 sno1t.txt */ - reg_write(dev, 0x0, 0x2310, 0x5); + reg_w_riv(dev, 0x0, 0x270c, 0x05); /* L92 sno1t.txt */ + reg_w_riv(dev, 0x0, 0x2310, 0x05); break; case BRIDGE_SPCA504C: if (sd->subtype == LogitechClickSmart420) { @@ -1248,13 +1248,13 @@ static void sd_start(struct gspca_dev *gspca_dev) } else { write_vector(gspca_dev, spca504_pccam600_init_data); } - enable = (sd->autogain ? 0x4 : 0x1); - reg_write(dev, 0x0c, 0x0000, enable); /* auto exposure */ - reg_write(dev, 0xb0, 0x0000, enable); /* auto whiteness */ + enable = (sd->autogain ? 0x04 : 0x01); + reg_w_riv(dev, 0x0c, 0x0000, enable); /* auto exposure */ + reg_w_riv(dev, 0xb0, 0x0000, enable); /* auto whiteness */ /* set default exposure compensation and whiteness balance */ - reg_write(dev, 0x30, 0x0001, 800); /* ~ 20 fps */ - reg_write(dev, 0x30, 0x0002, 1600); + reg_w_riv(dev, 0x30, 0x0001, 800); /* ~ 20 fps */ + reg_w_riv(dev, 0x30, 0x0002, 1600); spca504B_SetSizeType(gspca_dev); break; } @@ -1271,13 +1271,13 @@ static void sd_stopN(struct gspca_dev *gspca_dev) /* case BRIDGE_SPCA533: */ /* case BRIDGE_SPCA536: */ /* case BRIDGE_SPCA504B: */ - spca5xxRegWrite(dev, 0x31, 0, 0, NULL, 0); + reg_w(dev, 0x31, 0, 0, NULL, 0); spca504B_WaitCmdStatus(gspca_dev); - spca504B_PollingDataReady(dev); + spca504B_PollingDataReady(gspca_dev); break; case BRIDGE_SPCA504: case BRIDGE_SPCA504C: - reg_write(dev, 0x00, 0x2000, 0x0000); + reg_w_riv(dev, 0x00, 0x2000, 0x0000); if (sd->subtype == AiptekMiniPenCam13) { /* spca504a aiptek */ @@ -1289,7 +1289,7 @@ static void sd_stopN(struct gspca_dev *gspca_dev) 0x0f, 0x00, 0xff, 1); } else { spca504_acknowledged_command(gspca_dev, 0x24, 0, 0); - reg_write(dev, 0x01, 0x000f, 0x0); + reg_w_riv(dev, 0x01, 0x000f, 0x00); } break; } @@ -1414,10 +1414,10 @@ static void setbrightness(struct gspca_dev *gspca_dev) /* case BRIDGE_SPCA504B: */ /* case BRIDGE_SPCA504: */ /* case BRIDGE_SPCA504C: */ - reg_write(dev, 0x0, 0x21a7, sd->brightness); + reg_w_riv(dev, 0x0, 0x21a7, sd->brightness); break; case BRIDGE_SPCA536: - reg_write(dev, 0x0, 0x20f0, sd->brightness); + reg_w_riv(dev, 0x0, 0x20f0, sd->brightness); break; } } @@ -1425,7 +1425,6 @@ static void setbrightness(struct gspca_dev *gspca_dev) static void getbrightness(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - struct usb_device *dev = gspca_dev->dev; __u16 brightness = 0; switch (sd->bridge) { @@ -1434,10 +1433,10 @@ static void getbrightness(struct gspca_dev *gspca_dev) /* case BRIDGE_SPCA504B: */ /* case BRIDGE_SPCA504: */ /* case BRIDGE_SPCA504C: */ - brightness = reg_read(dev, 0x0, 0x21a7, 2); + brightness = reg_r_12(gspca_dev, 0x00, 0x21a7, 2); break; case BRIDGE_SPCA536: - brightness = reg_read(dev, 0x0, 0x20f0, 2); + brightness = reg_r_12(gspca_dev, 0x00, 0x20f0, 2); break; } sd->brightness = ((brightness & 0xff) - 128) % 255; @@ -1454,10 +1453,10 @@ static void setcontrast(struct gspca_dev *gspca_dev) /* case BRIDGE_SPCA504B: */ /* case BRIDGE_SPCA504: */ /* case BRIDGE_SPCA504C: */ - reg_write(dev, 0x0, 0x21a8, sd->contrast); + reg_w_riv(dev, 0x0, 0x21a8, sd->contrast); break; case BRIDGE_SPCA536: - reg_write(dev, 0x0, 0x20f1, sd->contrast); + reg_w_riv(dev, 0x0, 0x20f1, sd->contrast); break; } } @@ -1465,7 +1464,6 @@ static void setcontrast(struct gspca_dev *gspca_dev) static void getcontrast(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - struct usb_device *dev = gspca_dev->dev; switch (sd->bridge) { default: @@ -1473,10 +1471,10 @@ static void getcontrast(struct gspca_dev *gspca_dev) /* case BRIDGE_SPCA504B: */ /* case BRIDGE_SPCA504: */ /* case BRIDGE_SPCA504C: */ - sd->contrast = reg_read(dev, 0x0, 0x21a8, 2); + sd->contrast = reg_r_12(gspca_dev, 0x00, 0x21a8, 2); break; case BRIDGE_SPCA536: - sd->contrast = reg_read(dev, 0x0, 0x20f1, 2); + sd->contrast = reg_r_12(gspca_dev, 0x00, 0x20f1, 2); break; } } @@ -1492,10 +1490,10 @@ static void setcolors(struct gspca_dev *gspca_dev) /* case BRIDGE_SPCA504B: */ /* case BRIDGE_SPCA504: */ /* case BRIDGE_SPCA504C: */ - reg_write(dev, 0x0, 0x21ae, sd->colors); + reg_w_riv(dev, 0x0, 0x21ae, sd->colors); break; case BRIDGE_SPCA536: - reg_write(dev, 0x0, 0x20f6, sd->colors); + reg_w_riv(dev, 0x0, 0x20f6, sd->colors); break; } } @@ -1503,7 +1501,6 @@ static void setcolors(struct gspca_dev *gspca_dev) static void getcolors(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - struct usb_device *dev = gspca_dev->dev; switch (sd->bridge) { default: @@ -1511,10 +1508,10 @@ static void getcolors(struct gspca_dev *gspca_dev) /* case BRIDGE_SPCA504B: */ /* case BRIDGE_SPCA504: */ /* case BRIDGE_SPCA504C: */ - sd->colors = reg_read(dev, 0x0, 0x21ae, 2) >> 1; + sd->colors = reg_r_12(gspca_dev, 0x00, 0x21ae, 2) >> 1; break; case BRIDGE_SPCA536: - sd->colors = reg_read(dev, 0x0, 0x20f6, 2) >> 1; + sd->colors = reg_r_12(gspca_dev, 0x00, 0x20f6, 2) >> 1; break; } } diff --git a/linux/drivers/media/video/gspca/t613.c b/linux/drivers/media/video/gspca/t613.c index 78ee480e2..144d31fb5 100644 --- a/linux/drivers/media/video/gspca/t613.c +++ b/linux/drivers/media/video/gspca/t613.c @@ -26,8 +26,8 @@ #define MODULE_NAME "t613" #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) -static const char version[] = "2.1.5"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7) +static const char version[] = "2.1.7"; #define MAX_GAMMA 0x10 /* 0 to 15 */ @@ -365,48 +365,49 @@ static const __u8 tas5130a_sensor_init[][8] = { {}, }; -static void t16RegRead(struct usb_device *dev, - __u16 index, __u8 *buffer, __u16 length) +/* read 1 byte */ +static int reg_r_1(struct gspca_dev *gspca_dev, + __u16 index) { - usb_control_msg(dev, - usb_rcvctrlpipe(dev, 0), + usb_control_msg(gspca_dev->dev, + usb_rcvctrlpipe(gspca_dev->dev, 0), 0, /* request */ USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0, /* value */ - index, buffer, length, 500); + index, + gspca_dev->usb_buf, 1, 500); + return gspca_dev->usb_buf[0]; } -static void t16RegWrite(struct usb_device *dev, +static void reg_w(struct gspca_dev *gspca_dev, __u16 value, __u16 index, const __u8 *buffer, __u16 len) { if (buffer == NULL) { - usb_control_msg(dev, - usb_sndctrlpipe(dev, 0), + usb_control_msg(gspca_dev->dev, + usb_sndctrlpipe(gspca_dev->dev, 0), 0, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, value, index, NULL, 0, 500); return; } - if (len < 16) { - __u8 tmpbuf[16]; - - memcpy(tmpbuf, buffer, len); - usb_control_msg(dev, - usb_sndctrlpipe(dev, 0), + if (len <= sizeof gspca_dev->usb_buf) { + memcpy(gspca_dev->usb_buf, buffer, len); + usb_control_msg(gspca_dev->dev, + usb_sndctrlpipe(gspca_dev->dev, 0), 0, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, value, index, - tmpbuf, len, 500); + gspca_dev->usb_buf, len, 500); } else { __u8 *tmpbuf; tmpbuf = kmalloc(len, GFP_KERNEL); memcpy(tmpbuf, buffer, len); - usb_control_msg(dev, - usb_sndctrlpipe(dev, 0), + usb_control_msg(gspca_dev->dev, + usb_sndctrlpipe(gspca_dev->dev, 0), 0, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, value, index, @@ -456,8 +457,6 @@ static int sd_config(struct gspca_dev *gspca_dev, static int init_default_parameters(struct gspca_dev *gspca_dev) { - struct usb_device *dev = gspca_dev->dev; - /* some of this registers are not really neded, because * they are overriden by setbrigthness, setcontrast, etc, * but wont hurt anyway, and can help someone with similar webcam @@ -533,49 +532,49 @@ static int init_default_parameters(struct gspca_dev *gspca_dev) static const __u8 nset10[6] = { 0x0c, 0x03, 0xab, 0x10, 0x81, 0x20 }; - t16RegWrite(dev, 0x01, 0x0000, n1, 0x06); - t16RegWrite(dev, 0x01, 0x0000, nset, 0x06); - t16RegRead(dev, 0x0063, &test_byte, 1); - t16RegWrite(dev, 0x01, 0x0000, n2, 0x02); + reg_w(gspca_dev, 0x01, 0x0000, n1, 0x06); + reg_w(gspca_dev, 0x01, 0x0000, nset, 0x06); + reg_r_1(gspca_dev, 0x0063); + reg_w(gspca_dev, 0x01, 0x0000, n2, 0x02); while (read_indexs[i] != 0x00) { - t16RegRead(dev, read_indexs[i], &test_byte, 1); - PDEBUG(D_CONF, "Reg 0x%x => 0x%x", read_indexs[i], + test_byte = reg_r_1(gspca_dev, read_indexs[i]); + PDEBUG(D_CONF, "Reg 0x%02x => 0x%02x", read_indexs[i], test_byte); i++; } - t16RegWrite(dev, 0x01, 0x0000, n3, 0x06); - t16RegWrite(dev, 0x01, 0x0000, n4, 0x46); - t16RegRead(dev, 0x0080, &test_byte, 1); - t16RegWrite(dev, 0x00, 0x2c80, NULL, 0); - t16RegWrite(dev, 0x01, 0x0000, nset2, 0x14); - t16RegWrite(dev, 0x01, 0x0000, nset3, 0x12); - t16RegWrite(dev, 0x01, 0x0000, nset4, 0x12); - t16RegWrite(dev, 0x00, 0x3880, NULL, 0); - t16RegWrite(dev, 0x00, 0x3880, NULL, 0); - t16RegWrite(dev, 0x00, 0x338e, NULL, 0); - t16RegWrite(dev, 0x01, 0x0000, nset5, 0x04); - t16RegWrite(dev, 0x00, 0x00a9, NULL, 0); - t16RegWrite(dev, 0x01, 0x0000, nset6, 0x22); - t16RegWrite(dev, 0x00, 0x86bb, NULL, 0); - t16RegWrite(dev, 0x00, 0x4aa6, NULL, 0); - - t16RegWrite(dev, 0x01, 0x0000, missing, 0x08); - - t16RegWrite(dev, 0x00, 0x2087, NULL, 0); - t16RegWrite(dev, 0x00, 0x2088, NULL, 0); - t16RegWrite(dev, 0x00, 0x2089, NULL, 0); - - t16RegWrite(dev, 0x01, 0x0000, nset7, 0x04); - t16RegWrite(dev, 0x01, 0x0000, nset10, 0x06); - t16RegWrite(dev, 0x01, 0x0000, nset8, 0x06); - t16RegWrite(dev, 0x01, 0x0000, nset9, 0x04); - - t16RegWrite(dev, 0x00, 0x2880, NULL, 0); - t16RegWrite(dev, 0x01, 0x0000, nset2, 0x14); - t16RegWrite(dev, 0x01, 0x0000, nset3, 0x12); - t16RegWrite(dev, 0x01, 0x0000, nset4, 0x12); + reg_w(gspca_dev, 0x01, 0x0000, n3, 0x06); + reg_w(gspca_dev, 0x01, 0x0000, n4, 0x46); + reg_r_1(gspca_dev, 0x0080); + reg_w(gspca_dev, 0x00, 0x2c80, NULL, 0); + reg_w(gspca_dev, 0x01, 0x0000, nset2, 0x14); + reg_w(gspca_dev, 0x01, 0x0000, nset3, 0x12); + reg_w(gspca_dev, 0x01, 0x0000, nset4, 0x12); + reg_w(gspca_dev, 0x00, 0x3880, NULL, 0); + reg_w(gspca_dev, 0x00, 0x3880, NULL, 0); + reg_w(gspca_dev, 0x00, 0x338e, NULL, 0); + reg_w(gspca_dev, 0x01, 0x0000, nset5, 0x04); + reg_w(gspca_dev, 0x00, 0x00a9, NULL, 0); + reg_w(gspca_dev, 0x01, 0x0000, nset6, 0x22); + reg_w(gspca_dev, 0x00, 0x86bb, NULL, 0); + reg_w(gspca_dev, 0x00, 0x4aa6, NULL, 0); + + reg_w(gspca_dev, 0x01, 0x0000, missing, 0x08); + + reg_w(gspca_dev, 0x00, 0x2087, NULL, 0); + reg_w(gspca_dev, 0x00, 0x2088, NULL, 0); + reg_w(gspca_dev, 0x00, 0x2089, NULL, 0); + + reg_w(gspca_dev, 0x01, 0x0000, nset7, 0x04); + reg_w(gspca_dev, 0x01, 0x0000, nset10, 0x06); + reg_w(gspca_dev, 0x01, 0x0000, nset8, 0x06); + reg_w(gspca_dev, 0x01, 0x0000, nset9, 0x04); + + reg_w(gspca_dev, 0x00, 0x2880, NULL, 0); + reg_w(gspca_dev, 0x01, 0x0000, nset2, 0x14); + reg_w(gspca_dev, 0x01, 0x0000, nset3, 0x12); + reg_w(gspca_dev, 0x01, 0x0000, nset4, 0x12); return 0; } @@ -583,7 +582,6 @@ static int init_default_parameters(struct gspca_dev *gspca_dev) static void setbrightness(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - struct usb_device *dev = gspca_dev->dev; unsigned int brightness; __u8 set6[4] = { 0x8f, 0x26, 0xc3, 0x80 }; brightness = sd->brightness; @@ -595,13 +593,12 @@ static void setbrightness(struct gspca_dev *gspca_dev) set6[3] = 0x00 + ((brightness - 7) * 0xa); } - t16RegWrite(dev, 0x01, 0x0000, set6, 4); + reg_w(gspca_dev, 0x01, 0x0000, set6, 4); } static void setflip(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - struct usb_device *dev = gspca_dev->dev; __u8 flipcmd[8] = { 0x62, 0x07, 0x63, 0x03, 0x64, 0x00, 0x60, 0x09 }; @@ -609,15 +606,14 @@ static void setflip(struct gspca_dev *gspca_dev) if (sd->mirror == 1) flipcmd[3] = 0x01; - t16RegWrite(dev, 0x01, 0x0000, flipcmd, 8); + reg_w(gspca_dev, 0x01, 0x0000, flipcmd, 8); } static void seteffect(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - struct usb_device *dev = gspca_dev->dev; - t16RegWrite(dev, 0x01, 0x0000, effects_table[sd->effect], 0x06); + reg_w(gspca_dev, 0x01, 0x0000, effects_table[sd->effect], 0x06); if (sd->effect == 1 || sd->effect == 5) { PDEBUG(D_CONF, "This effect have been disabled for webcam \"safety\""); @@ -625,15 +621,14 @@ static void seteffect(struct gspca_dev *gspca_dev) } if (sd->effect == 1 || sd->effect == 4) - t16RegWrite(dev, 0x00, 0x4aa6, NULL, 0); + reg_w(gspca_dev, 0x00, 0x4aa6, NULL, 0); else - t16RegWrite(dev, 0x00, 0xfaa6, NULL, 0); + reg_w(gspca_dev, 0x00, 0xfaa6, NULL, 0); } static void setwhitebalance(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - struct usb_device *dev = gspca_dev->dev; __u8 white_balance[8] = { 0x87, 0x20, 0x88, 0x20, 0x89, 0x20, 0x80, 0x38 }; @@ -641,25 +636,23 @@ static void setwhitebalance(struct gspca_dev *gspca_dev) if (sd->whitebalance == 1) white_balance[7] = 0x3c; - t16RegWrite(dev, 0x01, 0x0000, white_balance, 8); + reg_w(gspca_dev, 0x01, 0x0000, white_balance, 8); } static void setlightfreq(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - struct usb_device *dev = gspca_dev->dev; __u8 freq[4] = { 0x66, 0x40, 0xa8, 0xe8 }; if (sd->freq == 2) /* 60hz */ freq[1] = 0x00; - t16RegWrite(dev, 0x1, 0x0000, freq, 0x4); + reg_w(gspca_dev, 0x1, 0x0000, freq, 0x4); } static void setcontrast(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - struct usb_device *dev = gspca_dev->dev; unsigned int contrast = sd->contrast; __u16 reg_to_write = 0x00; @@ -668,17 +661,16 @@ static void setcontrast(struct gspca_dev *gspca_dev) else reg_to_write = (0x00a9 + ((contrast - 7) * 0x200)); - t16RegWrite(dev, 0x00, reg_to_write, NULL, 0); + reg_w(gspca_dev, 0x00, reg_to_write, NULL, 0); } static void setcolors(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - struct usb_device *dev = gspca_dev->dev; __u16 reg_to_write; reg_to_write = 0xc0bb + sd->colors * 0x100; - t16RegWrite(dev, 0x00, reg_to_write, NULL, 0); + reg_w(gspca_dev, 0x00, reg_to_write, NULL, 0); } static void setgamma(struct gspca_dev *gspca_dev) @@ -689,19 +681,18 @@ static void setgamma(struct gspca_dev *gspca_dev) PDEBUG(D_CONF, "Gamma: %d", sd->gamma); - t16RegWrite(dev, 0x01, 0x0000, gamma_table[sd->gamma], 34); + reg_w(gspca_dev, 0x01, 0x0000, gamma_table[sd->gamma], 34); #endif } static void setsharpness(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - struct usb_device *dev = gspca_dev->dev; __u16 reg_to_write; reg_to_write = 0x0aa6 + 0x1000 * sd->sharpness; - t16RegWrite(dev, 0x00, reg_to_write, NULL, 0); + reg_w(gspca_dev, 0x00, reg_to_write, NULL, 0); } static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val) @@ -869,13 +860,12 @@ static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val) static int sd_setlowlight(struct gspca_dev *gspca_dev, __s32 val) { struct sd *sd = (struct sd *) gspca_dev; - struct usb_device *dev = gspca_dev->dev; sd->autogain = val; if (val != 0) - t16RegWrite(dev, 0x00, 0xf48e, NULL, 0); + reg_w(gspca_dev, 0x00, 0xf48e, NULL, 0); else - t16RegWrite(dev, 0x00, 0xb48e, NULL, 0); + reg_w(gspca_dev, 0x00, 0xb48e, NULL, 0); return 0; } @@ -889,9 +879,7 @@ static int sd_getlowlight(struct gspca_dev *gspca_dev, __s32 *val) static void sd_start(struct gspca_dev *gspca_dev) { - struct usb_device *dev = gspca_dev->dev; int mode; - __u8 test_byte; static const __u8 t1[] = { 0x66, 0x00, 0xa8, 0xe8 }; __u8 t2[] = { 0x07, 0x00, 0x0d, 0x60, 0x0e, 0x80 }; @@ -918,21 +906,21 @@ static void sd_start(struct gspca_dev *gspca_dev) break; } - t16RegWrite(dev, 0x01, 0x0000, tas5130a_sensor_init[0], 0x8); - t16RegWrite(dev, 0x01, 0x0000, tas5130a_sensor_init[1], 0x8); - t16RegWrite(dev, 0x01, 0x0000, tas5130a_sensor_init[2], 0x8); - t16RegWrite(dev, 0x01, 0x0000, tas5130a_sensor_init[3], 0x8); - t16RegWrite(dev, 0x00, 0x3c80, NULL, 0); + reg_w(gspca_dev, 0x01, 0x0000, tas5130a_sensor_init[0], 0x8); + reg_w(gspca_dev, 0x01, 0x0000, tas5130a_sensor_init[1], 0x8); + reg_w(gspca_dev, 0x01, 0x0000, tas5130a_sensor_init[2], 0x8); + reg_w(gspca_dev, 0x01, 0x0000, tas5130a_sensor_init[3], 0x8); + reg_w(gspca_dev, 0x00, 0x3c80, NULL, 0); /* just in case and to keep sync with logs (for mine) */ - t16RegWrite(dev, 0x01, 0x0000, tas5130a_sensor_init[3], 0x8); - t16RegWrite(dev, 0x00, 0x3c80, NULL, 0); + reg_w(gspca_dev, 0x01, 0x0000, tas5130a_sensor_init[3], 0x8); + reg_w(gspca_dev, 0x00, 0x3c80, NULL, 0); /* just in case and to keep sync with logs (for mine) */ - t16RegWrite(dev, 0x01, 0x0000, t1, 4); - t16RegWrite(dev, 0x01, 0x0000, t2, 6); - t16RegRead(dev, 0x0012, &test_byte, 0x01); - t16RegWrite(dev, 0x01, 0x0000, t3, 0x10); - t16RegWrite(dev, 0x00, 0x0013, NULL, 0); - t16RegWrite(dev, 0x01, 0x0000, t4, 0x4); + reg_w(gspca_dev, 0x01, 0x0000, t1, 4); + reg_w(gspca_dev, 0x01, 0x0000, t2, 6); + reg_r_1(gspca_dev, 0x0012); + reg_w(gspca_dev, 0x01, 0x0000, t3, 0x10); + reg_w(gspca_dev, 0x00, 0x0013, NULL, 0); + reg_w(gspca_dev, 0x01, 0x0000, t4, 0x4); /* restart on each start, just in case, sometimes regs goes wrong * when using controls from app */ setbrightness(gspca_dev); diff --git a/linux/drivers/media/video/gspca/tv8532.c b/linux/drivers/media/video/gspca/tv8532.c index b9837841c..4b885f1c3 100644 --- a/linux/drivers/media/video/gspca/tv8532.c +++ b/linux/drivers/media/video/gspca/tv8532.c @@ -22,8 +22,8 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) -static const char version[] = "2.1.5"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7) +static const char version[] = "2.1.7"; MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_DESCRIPTION("TV8532 USB Camera Driver"); @@ -168,63 +168,74 @@ static const __u32 tv_8532_eeprom_data[] = { 0x0c0509f1, 0 }; -static void reg_r(struct usb_device *dev, - __u16 index, __u8 *buffer) +static int reg_r(struct gspca_dev *gspca_dev, + __u16 index) { - usb_control_msg(dev, - usb_rcvctrlpipe(dev, 0), + usb_control_msg(gspca_dev->dev, + usb_rcvctrlpipe(gspca_dev->dev, 0), TV8532_REQ_RegRead, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0, /* value */ - index, buffer, sizeof(__u8), + index, gspca_dev->usb_buf, 1, 500); + return gspca_dev->usb_buf[0]; } -static void reg_w(struct usb_device *dev, - __u16 index, __u8 *buffer, __u16 length) +/* write 1 byte */ +static void reg_w_1(struct gspca_dev *gspca_dev, + __u16 index, __u8 value) { - usb_control_msg(dev, - usb_sndctrlpipe(dev, 0), + gspca_dev->usb_buf[0] = value; + usb_control_msg(gspca_dev->dev, + usb_sndctrlpipe(gspca_dev->dev, 0), TV8532_REQ_RegWrite, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0, /* value */ - index, buffer, length, 500); + index, gspca_dev->usb_buf, 1, 500); +} + +/* write 2 bytes */ +static void reg_w_2(struct gspca_dev *gspca_dev, + __u16 index, __u8 val1, __u8 val2) +{ + gspca_dev->usb_buf[0] = val1; + gspca_dev->usb_buf[1] = val2; + usb_control_msg(gspca_dev->dev, + usb_sndctrlpipe(gspca_dev->dev, 0), + TV8532_REQ_RegWrite, + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + 0, /* value */ + index, gspca_dev->usb_buf, 2, 500); } static void tv_8532WriteEEprom(struct gspca_dev *gspca_dev) { int i = 0; - __u8 reg, data0, data1, data2, datacmd; - struct usb_device *dev = gspca_dev->dev; + __u8 reg, data0, data1, data2; - datacmd = 0xb0;; - reg_w(dev, TV8532_GPIO, &datacmd, 1); - datacmd = TV8532_CMD_EEprom_Open; - reg_w(dev, TV8532_CTRL, &datacmd, 1); + reg_w_1(gspca_dev, TV8532_GPIO, 0xb0); + reg_w_1(gspca_dev, TV8532_CTRL, TV8532_CMD_EEprom_Open); /* msleep(1); */ while (tv_8532_eeprom_data[i]) { reg = (tv_8532_eeprom_data[i] & 0xff000000) >> 24; - reg_w(dev, TV8532_EEprom_Add, ®, 1); + reg_w_1(gspca_dev, TV8532_EEprom_Add, reg); /* msleep(1); */ data0 = (tv_8532_eeprom_data[i] & 0x000000ff); - reg_w(dev, TV8532_EEprom_DataL, &data0, 1); + reg_w_1(gspca_dev, TV8532_EEprom_DataL, data0); /* msleep(1); */ - data1 = (tv_8532_eeprom_data[i] & 0x0000FF00) >> 8; - reg_w(dev, TV8532_EEprom_DataM, &data1, 1); + data1 = (tv_8532_eeprom_data[i] & 0x0000ff00) >> 8; + reg_w_1(gspca_dev, TV8532_EEprom_DataM, data1); /* msleep(1); */ - data2 = (tv_8532_eeprom_data[i] & 0x00FF0000) >> 16; - reg_w(dev, TV8532_EEprom_DataH, &data2, 1); + data2 = (tv_8532_eeprom_data[i] & 0x00ff0000) >> 16; + reg_w_1(gspca_dev, TV8532_EEprom_DataH, data2); /* msleep(1); */ - datacmd = 0; - reg_w(dev, TV8532_EEprom_Write, &datacmd, 1); + reg_w_1(gspca_dev, TV8532_EEprom_Write, 0); /* msleep(10); */ i++; } - datacmd = i; - reg_w(dev, TV8532_EEprom_TableLength, &datacmd, 1); + reg_w_1(gspca_dev, TV8532_EEprom_TableLength, i); /* msleep(1); */ - datacmd = TV8532_CMD_EEprom_Close; - reg_w(dev, TV8532_CTRL, &datacmd, 1); + reg_w_1(gspca_dev, TV8532_CTRL, TV8532_CMD_EEprom_Close); msleep(10); } @@ -250,154 +261,121 @@ static int sd_config(struct gspca_dev *gspca_dev, static void tv_8532ReadRegisters(struct gspca_dev *gspca_dev) { - struct usb_device *dev = gspca_dev->dev; __u8 data; -/* __u16 vid, pid; */ - reg_r(dev, 0x0001, &data); + data = reg_r(gspca_dev, 0x0001); PDEBUG(D_USBI, "register 0x01-> %x", data); - reg_r(dev, 0x0002, &data); + data = reg_r(gspca_dev, 0x0002); PDEBUG(D_USBI, "register 0x02-> %x", data); - reg_r(dev, TV8532_ADWIDTH_L, &data); - reg_r(dev, TV8532_ADWIDTH_H, &data); - reg_r(dev, TV8532_QUANT_COMP, &data); - reg_r(dev, TV8532_MODE_PACKET, &data); - reg_r(dev, TV8532_SETCLK, &data); - reg_r(dev, TV8532_POINT_L, &data); - reg_r(dev, TV8532_POINT_H, &data); - reg_r(dev, TV8532_POINTB_L, &data); - reg_r(dev, TV8532_POINTB_H, &data); - reg_r(dev, TV8532_BUDGET_L, &data); - reg_r(dev, TV8532_BUDGET_H, &data); - reg_r(dev, TV8532_VID_L, &data); - reg_r(dev, TV8532_VID_H, &data); - reg_r(dev, TV8532_PID_L, &data); - reg_r(dev, TV8532_PID_H, &data); - reg_r(dev, TV8532_DeviceID, &data); - reg_r(dev, TV8532_AD_COLBEGIN_L, &data); - reg_r(dev, TV8532_AD_COLBEGIN_H, &data); - reg_r(dev, TV8532_AD_ROWBEGIN_L, &data); - reg_r(dev, TV8532_AD_ROWBEGIN_H, &data); + reg_r(gspca_dev, TV8532_ADWIDTH_L); + reg_r(gspca_dev, TV8532_ADWIDTH_H); + reg_r(gspca_dev, TV8532_QUANT_COMP); + reg_r(gspca_dev, TV8532_MODE_PACKET); + reg_r(gspca_dev, TV8532_SETCLK); + reg_r(gspca_dev, TV8532_POINT_L); + reg_r(gspca_dev, TV8532_POINT_H); + reg_r(gspca_dev, TV8532_POINTB_L); + reg_r(gspca_dev, TV8532_POINTB_H); + reg_r(gspca_dev, TV8532_BUDGET_L); + reg_r(gspca_dev, TV8532_BUDGET_H); + reg_r(gspca_dev, TV8532_VID_L); + reg_r(gspca_dev, TV8532_VID_H); + reg_r(gspca_dev, TV8532_PID_L); + reg_r(gspca_dev, TV8532_PID_H); + reg_r(gspca_dev, TV8532_DeviceID); + reg_r(gspca_dev, TV8532_AD_COLBEGIN_L); + reg_r(gspca_dev, TV8532_AD_COLBEGIN_H); + reg_r(gspca_dev, TV8532_AD_ROWBEGIN_L); + reg_r(gspca_dev, TV8532_AD_ROWBEGIN_H); } static void tv_8532_setReg(struct gspca_dev *gspca_dev) { - struct usb_device *dev = gspca_dev->dev; - __u8 data; - __u8 value[2] = { 0, 0 }; - - data = ADCBEGINL; - reg_w(dev, TV8532_AD_COLBEGIN_L, &data, 1); /* 0x10 */ - data = ADCBEGINH; /* also digital gain */ - reg_w(dev, TV8532_AD_COLBEGIN_H, &data, 1); - data = TV8532_CMD_UPDATE; - reg_w(dev, TV8532_PART_CTRL, &data, 1); /* 0x00<-0x84 */ - - data = 0x0a; - reg_w(dev, TV8532_GPIO_OE, &data, 1); + reg_w_1(gspca_dev, TV8532_AD_COLBEGIN_L, + ADCBEGINL); /* 0x10 */ + reg_w_1(gspca_dev, TV8532_AD_COLBEGIN_H, + ADCBEGINH); /* also digital gain */ + reg_w_1(gspca_dev, TV8532_PART_CTRL, + TV8532_CMD_UPDATE); /* 0x00<-0x84 */ + + reg_w_1(gspca_dev, TV8532_GPIO_OE, 0x0a); /******************************************************/ - data = ADHEIGHL; - reg_w(dev, TV8532_ADHEIGHT_L, &data, 1); /* 0e */ - data = ADHEIGHH; - reg_w(dev, TV8532_ADHEIGHT_H, &data, 1); /* 0f */ - value[0] = EXPOL; - value[1] = EXPOH; /* 350d 0x014c; */ - reg_w(dev, TV8532_EXPOSURE, value, 2); /* 1c */ - data = ADCBEGINL; - reg_w(dev, TV8532_AD_COLBEGIN_L, &data, 1); /* 0x10 */ - data = ADCBEGINH; /* also digital gain */ - reg_w(dev, TV8532_AD_COLBEGIN_H, &data, 1); - data = ADRBEGINL; - reg_w(dev, TV8532_AD_ROWBEGIN_L, &data, 1); /* 0x14 */ - - data = 0x00; - reg_w(dev, TV8532_AD_SLOPE, &data, 1); /* 0x91 */ - data = 0x02; - reg_w(dev, TV8532_AD_BITCTRL, &data, 1); /* 0x94 */ - - - data = TV8532_CMD_EEprom_Close; - reg_w(dev, TV8532_CTRL, &data, 1); /* 0x01 */ - - data = 0x00; - reg_w(dev, TV8532_AD_SLOPE, &data, 1); /* 0x91 */ - data = TV8532_CMD_UPDATE; - reg_w(dev, TV8532_PART_CTRL, &data, 1); /* 0x00<-0x84 */ + reg_w_1(gspca_dev, TV8532_ADHEIGHT_L, ADHEIGHL); /* 0e */ + reg_w_1(gspca_dev, TV8532_ADHEIGHT_H, ADHEIGHH); /* 0f */ + reg_w_2(gspca_dev, TV8532_EXPOSURE, + EXPOL, EXPOH); /* 350d 0x014c; 1c */ + reg_w_1(gspca_dev, TV8532_AD_COLBEGIN_L, + ADCBEGINL); /* 0x10 */ + reg_w_1(gspca_dev, TV8532_AD_COLBEGIN_H, + ADCBEGINH); /* also digital gain */ + reg_w_1(gspca_dev, TV8532_AD_ROWBEGIN_L, + ADRBEGINL); /* 0x14 */ + + reg_w_1(gspca_dev, TV8532_AD_SLOPE, 0x00); /* 0x91 */ + reg_w_1(gspca_dev, TV8532_AD_BITCTRL, 0x02); /* 0x94 */ + + reg_w_1(gspca_dev, TV8532_CTRL, + TV8532_CMD_EEprom_Close); /* 0x01 */ + + reg_w_1(gspca_dev, TV8532_AD_SLOPE, 0x00); /* 0x91 */ + reg_w_1(gspca_dev, TV8532_PART_CTRL, + TV8532_CMD_UPDATE); /* 0x00<-0x84 */ } static void tv_8532_PollReg(struct gspca_dev *gspca_dev) { - struct usb_device *dev = gspca_dev->dev; - __u8 data; int i; /* strange polling from tgc */ for (i = 0; i < 10; i++) { - data = TESTCLK; /* 0x48; //0x08; */ - reg_w(dev, TV8532_SETCLK, &data, 1); /* 0x2c */ - data = TV8532_CMD_UPDATE; - reg_w(dev, TV8532_PART_CTRL, &data, 1); - data = 0x01; - reg_w(dev, TV8532_UDP_UPDATE, &data, 1); /* 0x31 */ + reg_w_1(gspca_dev, TV8532_SETCLK, + TESTCLK); /* 0x48; //0x08; 0x2c */ + reg_w_1(gspca_dev, TV8532_PART_CTRL, TV8532_CMD_UPDATE); + reg_w_1(gspca_dev, TV8532_UDP_UPDATE, 0x01); /* 0x31 */ } } /* this function is called at open time */ static int sd_open(struct gspca_dev *gspca_dev) { - struct usb_device *dev = gspca_dev->dev; - __u8 data; - __u8 dataStart; - __u8 value[2]; - - data = 0x32; - reg_w(dev, TV8532_AD_SLOPE, &data, 1); - data = 0; - reg_w(dev, TV8532_AD_BITCTRL, &data, 1); + reg_w_1(gspca_dev, TV8532_AD_SLOPE, 0x32); + reg_w_1(gspca_dev, TV8532_AD_BITCTRL, 0x00); tv_8532ReadRegisters(gspca_dev); - data = 0x0b; - reg_w(dev, TV8532_GPIO_OE, &data, 1); - value[0] = ADHEIGHL; - value[1] = ADHEIGHH; /* 401d 0x0169; */ - reg_w(dev, TV8532_ADHEIGHT_L, value, 2); /* 0e */ - value[0] = EXPOL; - value[1] = EXPOH; /* 350d 0x014c; */ - reg_w(dev, TV8532_EXPOSURE, value, 2); /* 1c */ - data = ADWIDTHL; /* 0x20; */ - reg_w(dev, TV8532_ADWIDTH_L, &data, 1); /* 0x0c */ - data = ADWIDTHH; - reg_w(dev, TV8532_ADWIDTH_H, &data, 1); /* 0x0d */ + reg_w_1(gspca_dev, TV8532_GPIO_OE, 0x0b); + reg_w_2(gspca_dev, TV8532_ADHEIGHT_L, ADHEIGHL, + ADHEIGHH); /* 401d 0x0169; 0e */ + reg_w_2(gspca_dev, TV8532_EXPOSURE, EXPOL, + EXPOH); /* 350d 0x014c; 1c */ + reg_w_1(gspca_dev, TV8532_ADWIDTH_L, ADWIDTHL); /* 0x20; 0x0c */ + reg_w_1(gspca_dev, TV8532_ADWIDTH_H, ADWIDTHH); /* 0x0d */ /*******************************************************************/ - data = TESTCOMP; /* 0x72 compressed mode */ - reg_w(dev, TV8532_QUANT_COMP, &data, 1); /* 0x28 */ - data = TESTLINE; /* 0x84; // CIF | 4 packet */ - reg_w(dev, TV8532_MODE_PACKET, &data, 1); /* 0x29 */ + reg_w_1(gspca_dev, TV8532_QUANT_COMP, + TESTCOMP); /* 0x72 compressed mode 0x28 */ + reg_w_1(gspca_dev, TV8532_MODE_PACKET, + TESTLINE); /* 0x84; // CIF | 4 packet 0x29 */ /************************************************/ - data = TESTCLK; /* 0x48; //0x08; */ - reg_w(dev, TV8532_SETCLK, &data, 1); /* 0x2c */ - data = TESTPTL; /* 0x38; */ - reg_w(dev, TV8532_POINT_L, &data, 1); /* 0x2d */ - data = TESTPTH; /* 0x04; */ - reg_w(dev, TV8532_POINT_H, &data, 1); /* 0x2e */ - dataStart = TESTPTBL; /* 0x04; */ - reg_w(dev, TV8532_POINTB_L, &dataStart, 1); /* 0x2f */ - data = TESTPTBH; /* 0x04; */ - reg_w(dev, TV8532_POINTB_H, &data, 1); /* 0x30 */ - data = TV8532_CMD_UPDATE; - reg_w(dev, TV8532_PART_CTRL, &data, 1); /* 0x00<-0x84 */ + reg_w_1(gspca_dev, TV8532_SETCLK, + TESTCLK); /* 0x48; //0x08; 0x2c */ + reg_w_1(gspca_dev, TV8532_POINT_L, + TESTPTL); /* 0x38; 0x2d */ + reg_w_1(gspca_dev, TV8532_POINT_H, + TESTPTH); /* 0x04; 0x2e */ + reg_w_1(gspca_dev, TV8532_POINTB_L, + TESTPTBL); /* 0x04; 0x2f */ + reg_w_1(gspca_dev, TV8532_POINTB_H, + TESTPTBH); /* 0x04; 0x30 */ + reg_w_1(gspca_dev, TV8532_PART_CTRL, + TV8532_CMD_UPDATE); /* 0x00<-0x84 */ /*************************************************/ - data = 0x01; - reg_w(dev, TV8532_UDP_UPDATE, &data, 1); /* 0x31 */ + reg_w_1(gspca_dev, TV8532_UDP_UPDATE, 0x01); /* 0x31 */ msleep(200); - data = 0x00; - reg_w(dev, TV8532_UDP_UPDATE, &data, 1); /* 0x31 */ + reg_w_1(gspca_dev, TV8532_UDP_UPDATE, 0x00); /* 0x31 */ /*************************************************/ tv_8532_setReg(gspca_dev); /*************************************************/ - data = 0x0b; - reg_w(dev, TV8532_GPIO_OE, &data, 1); + reg_w_1(gspca_dev, TV8532_GPIO_OE, 0x0b); /*************************************************/ tv_8532_setReg(gspca_dev); /*************************************************/ @@ -408,94 +386,72 @@ static int sd_open(struct gspca_dev *gspca_dev) static void setbrightness(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; - __u8 value[2]; - __u8 data; int brightness = sd->brightness; - value[1] = (brightness >> 8) & 0xff; - value[0] = (brightness) & 0xff; - reg_w(gspca_dev->dev, TV8532_EXPOSURE, value, 2); /* 1c */ - data = TV8532_CMD_UPDATE; - reg_w(gspca_dev->dev, TV8532_PART_CTRL, &data, 1); + reg_w_2(gspca_dev, TV8532_EXPOSURE, + brightness >> 8, brightness); /* 1c */ + reg_w_1(gspca_dev, TV8532_PART_CTRL, TV8532_CMD_UPDATE); } /* -- start the camera -- */ static void sd_start(struct gspca_dev *gspca_dev) { - struct usb_device *dev = gspca_dev->dev; - __u8 data; - __u8 value[2]; - - data = 0x32; - reg_w(dev, TV8532_AD_SLOPE, &data, 1); - data = 0; - reg_w(dev, TV8532_AD_BITCTRL, &data, 1); + reg_w_1(gspca_dev, TV8532_AD_SLOPE, 0x32); + reg_w_1(gspca_dev, TV8532_AD_BITCTRL, 0x00); tv_8532ReadRegisters(gspca_dev); - data = 0x0b; - reg_w(dev, TV8532_GPIO_OE, &data, 1); - value[0] = ADHEIGHL; - value[1] = ADHEIGHH; /* 401d 0x0169; */ - reg_w(dev, TV8532_ADHEIGHT_L, value, 2); /* 0e */ -/* value[0] = EXPOL; value[1] =EXPOH; * 350d 0x014c; */ -/* reg_w(dev,TV8532_REQ_RegWrite,0,TV8532_EXPOSURE,value,2); * 1c */ + reg_w_1(gspca_dev, TV8532_GPIO_OE, 0x0b); + reg_w_2(gspca_dev, TV8532_ADHEIGHT_L, + ADHEIGHL, ADHEIGHH); /* 401d 0x0169; 0e */ +/* reg_w_2(gspca_dev, TV8532_EXPOSURE, + EXPOL, EXPOH); * 350d 0x014c; 1c */ setbrightness(gspca_dev); - data = ADWIDTHL; /* 0x20; */ - reg_w(dev, TV8532_ADWIDTH_L, &data, 1); /* 0x0c */ - data = ADWIDTHH; - reg_w(dev, TV8532_ADWIDTH_H, &data, 1); /* 0x0d */ + reg_w_1(gspca_dev, TV8532_ADWIDTH_L, ADWIDTHL); /* 0x20; 0x0c */ + reg_w_1(gspca_dev, TV8532_ADWIDTH_H, ADWIDTHH); /* 0x0d */ /************************************************/ - data = TESTCOMP; /* 0x72 compressed mode */ - reg_w(dev, TV8532_QUANT_COMP, &data, 1); /* 0x28 */ + reg_w_1(gspca_dev, TV8532_QUANT_COMP, + TESTCOMP); /* 0x72 compressed mode 0x28 */ if (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) { /* 176x144 */ - data = QCIFLINE; /* 0x84; // CIF | 4 packet */ - reg_w(dev, TV8532_MODE_PACKET, &data, 1); /* 0x29 */ + reg_w_1(gspca_dev, TV8532_MODE_PACKET, + QCIFLINE); /* 0x84; // CIF | 4 packet 0x29 */ } else { /* 352x288 */ - data = TESTLINE; /* 0x84; // CIF | 4 packet */ - reg_w(dev, TV8532_MODE_PACKET, &data, 1); /* 0x29 */ + reg_w_1(gspca_dev, TV8532_MODE_PACKET, + TESTLINE); /* 0x84; // CIF | 4 packet 0x29 */ } /************************************************/ - data = TESTCLK; /* 0x48; //0x08; */ - reg_w(dev, TV8532_SETCLK, &data, 1); /* 0x2c */ - data = TESTPTL; /* 0x38; */ - reg_w(dev, TV8532_POINT_L, &data, 1); /* 0x2d */ - data = TESTPTH; /* 0x04; */ - reg_w(dev, TV8532_POINT_H, &data, 1); /* 0x2e */ - data = TESTPTBL; /* 0x04; */ - reg_w(dev, TV8532_POINTB_L, &data, 1); /* 0x2f */ - data = TESTPTBH; /* 0x04; */ - reg_w(dev, TV8532_POINTB_H, &data, 1); /* 0x30 */ - data = TV8532_CMD_UPDATE; - reg_w(dev, TV8532_PART_CTRL, &data, 1); /* 0x00<-0x84 */ + reg_w_1(gspca_dev, TV8532_SETCLK, + TESTCLK); /* 0x48; //0x08; 0x2c */ + reg_w_1(gspca_dev, TV8532_POINT_L, + TESTPTL); /* 0x38; 0x2d */ + reg_w_1(gspca_dev, TV8532_POINT_H, + TESTPTH); /* 0x04; 0x2e */ + reg_w_1(gspca_dev, TV8532_POINTB_L, + TESTPTBL); /* 0x04; 0x2f */ + reg_w_1(gspca_dev, TV8532_POINTB_H, + TESTPTBH); /* 0x04; 0x30 */ + reg_w_1(gspca_dev, TV8532_PART_CTRL, + TV8532_CMD_UPDATE); /* 0x00<-0x84 */ /************************************************/ - data = 0x01; - reg_w(dev, TV8532_UDP_UPDATE, &data, 1); /* 0x31 */ + reg_w_1(gspca_dev, TV8532_UDP_UPDATE, 0x01); /* 0x31 */ msleep(200); - data = 0x00; - reg_w(dev, TV8532_UDP_UPDATE, &data, 1); /* 0x31 */ + reg_w_1(gspca_dev, TV8532_UDP_UPDATE, 0x00); /* 0x31 */ /************************************************/ tv_8532_setReg(gspca_dev); /************************************************/ - data = 0x0b; - reg_w(dev, TV8532_GPIO_OE, &data, 1); + reg_w_1(gspca_dev, TV8532_GPIO_OE, 0x0b); /************************************************/ tv_8532_setReg(gspca_dev); /************************************************/ tv_8532_PollReg(gspca_dev); - data = 0x00; - reg_w(dev, TV8532_UDP_UPDATE, &data, 1); /* 0x31 */ + reg_w_1(gspca_dev, TV8532_UDP_UPDATE, 0x00); /* 0x31 */ } static void sd_stopN(struct gspca_dev *gspca_dev) { - struct usb_device *dev = gspca_dev->dev; - __u8 data; - - data = 0x0b; - reg_w(dev, TV8532_GPIO_OE, &data, 1); + reg_w_1(gspca_dev, TV8532_GPIO_OE, 0x0b); } static void sd_stop0(struct gspca_dev *gspca_dev) @@ -616,17 +572,13 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, static void setcontrast(struct gspca_dev *gspca_dev) { #if 0 - __u8 value[2]; - __u8 data; - value[0] = (gspca_dev->contrast) & 0xff; value[1] = (gspca_dev->contrast >> 8) & 0xff; - reg_w(gspca_dev->dev, 0x0020, &value[1], 1); - reg_w(gspca_dev->dev, 0x0022, &value[1], 1); - reg_w(gspca_dev->dev, 0x0024, &value[1], 1); - reg_w(gspca_dev->dev, 0x0026, &value[1], 1); - data = TV8532_CMD_UPDATE; - reg_w(gspca_dev->dev, TV8532_PART_CTRL, &data, 1); + reg_w_1(gspca_dev, 0x0020, value[1]); + reg_w_1(gspca_dev, 0x0022, value[1]); + reg_w_1(gspca_dev, 0x0024, value[1]); + reg_w_1(gspca_dev, 0x0026, value[1]); + reg_w_1(gspca_dev, TV8532_PART_CTRL, TV8532_CMD_UPDATE); #endif } diff --git a/linux/drivers/media/video/gspca/vc032x.c b/linux/drivers/media/video/gspca/vc032x.c index 1129cbeb8..5960b2577 100644 --- a/linux/drivers/media/video/gspca/vc032x.c +++ b/linux/drivers/media/video/gspca/vc032x.c @@ -24,8 +24,8 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) -static const char version[] = "2.1.5"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7) +static const char version[] = "2.1.7"; MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_DESCRIPTION("GSPCA/VC032X USB Camera Driver"); @@ -58,7 +58,6 @@ static int sd_setfreq(struct gspca_dev *gspca_dev, __s32 val); static int sd_getfreq(struct gspca_dev *gspca_dev, __s32 *val); static struct ctrl sd_ctrls[] = { -#define SD_AUTOGAIN 0 { { .id = V4L2_CID_AUTOGAIN, @@ -67,20 +66,22 @@ static struct ctrl sd_ctrls[] = { .minimum = 0, .maximum = 1, .step = 1, - .default_value = 1, +#define AUTOGAIN_DEF 1 + .default_value = AUTOGAIN_DEF, }, .set = sd_setautogain, .get = sd_getautogain, }, -#define SD_FREQ 1 { { .id = V4L2_CID_POWER_LINE_FREQUENCY, .type = V4L2_CTRL_TYPE_MENU, .name = "Light frequency filter", .minimum = 0, - .maximum = 2, /* 0: 0, 1: 50Hz, 2:60Hz */ + .maximum = 2, /* 0: No, 1: 50Hz, 2:60Hz */ .step = 1, +#define FREQ_DEF 1 + .default_value = FREQ_DEF, .default_value = 1, }, .set = sd_setfreq, @@ -89,12 +90,12 @@ static struct ctrl sd_ctrls[] = { }; static struct v4l2_pix_format vc0321_mode[] = { - {320, 240, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, + {320, 240, V4L2_PIX_FMT_YUV420, V4L2_FIELD_NONE, .bytesperline = 320 * 2, .sizeimage = 320 * 240 * 2, .colorspace = V4L2_COLORSPACE_SRGB, .priv = 1}, - {640, 480, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, + {640, 480, V4L2_PIX_FMT_YUV420, V4L2_FIELD_NONE, .bytesperline = 640 * 2, .sizeimage = 640 * 480 * 2, .colorspace = V4L2_COLORSPACE_SRGB, @@ -1406,17 +1407,18 @@ static const struct sensor_info sensor_info_data[] = { {SENSOR_MI1310_SOC, 0x80 | 0x5d, 0x00, 0x143a, 0x24, 0x25, 0x01}, }; -static void reg_r(struct usb_device *dev, - __u16 req, - __u16 index, - __u8 *buffer, __u16 length) +/* read 'len' bytes in gspca_dev->usb_buf */ +static void reg_r(struct gspca_dev *gspca_dev, + __u16 req, + __u16 index, + __u16 len) { - usb_control_msg(dev, - usb_rcvctrlpipe(dev, 0), + usb_control_msg(gspca_dev->dev, + usb_rcvctrlpipe(gspca_dev->dev, 0), req, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 1, /* value */ - index, buffer, length, + index, gspca_dev->usb_buf, len, 500); } @@ -1433,55 +1435,55 @@ static void reg_w(struct usb_device *dev, 500); } -static void vc032x_read_sensor_register(struct usb_device *dev, +static void read_sensor_register(struct gspca_dev *gspca_dev, __u16 address, __u16 *value) { + struct usb_device *dev = gspca_dev->dev; __u8 ldata, mdata, hdata; - __u8 tmpvalue = 0; int retry = 50; - ldata = 0; - mdata = 0; - hdata = 0; + *value = 0; - reg_r(dev, 0xa1, 0xb33f, &tmpvalue, 1); + reg_r(gspca_dev, 0xa1, 0xb33f, 1); /*PDEBUG(D_PROBE, " I2c Bus Busy Wait 0x%02X ", tmpvalue); */ - if (!(tmpvalue & 0x02)) { - PDEBUG(D_ERR, "I2c Bus Busy Wait %d", tmpvalue & 0x02); + if (!(gspca_dev->usb_buf[0] & 0x02)) { + PDEBUG(D_ERR, "I2c Bus Busy Wait %d", + gspca_dev->usb_buf[0] & 0x02); return; } reg_w(dev, 0xa0, address, 0xb33a); reg_w(dev, 0xa0, 0x02, 0xb339); - tmpvalue = 0; - reg_r(dev, 0xa1, 0xb33b, &tmpvalue, 1); - while (retry-- && tmpvalue) { - reg_r(dev, 0xa1, 0xb33b, &tmpvalue, 1); + reg_r(gspca_dev, 0xa1, 0xb33b, 1); + while (retry-- && gspca_dev->usb_buf[0]) { + reg_r(gspca_dev, 0xa1, 0xb33b, 1); /* PDEBUG(D_PROBE, "Read again 0xb33b %d", tmpvalue); */ msleep(1); } - reg_r(dev, 0xa1, 0xb33e, &hdata, 1); - reg_r(dev, 0xa1, 0xb33d, &mdata, 1); - reg_r(dev, 0xa1, 0xb33c, &ldata, 1); + reg_r(gspca_dev, 0xa1, 0xb33e, 1); + hdata = gspca_dev->usb_buf[0]; + reg_r(gspca_dev, 0xa1, 0xb33d, 1); + mdata = gspca_dev->usb_buf[0]; + reg_r(gspca_dev, 0xa1, 0xb33c, 1); + ldata = gspca_dev->usb_buf[0]; PDEBUG(D_PROBE, "Read Sensor h (0x%02X) m (0x%02X) l (0x%02X)", hdata, mdata, ldata); - tmpvalue = 0; - reg_r(dev, 0xa1, 0xb334, &tmpvalue, 1); - if (tmpvalue == 0x02) + reg_r(gspca_dev, 0xa1, 0xb334, 1); + if (gspca_dev->usb_buf[0] == 0x02) *value = (ldata << 8) + mdata; else *value = ldata; } + static int vc032x_probe_sensor(struct gspca_dev *gspca_dev) { struct usb_device *dev = gspca_dev->dev; int i; - __u8 data; __u16 value; const struct sensor_info *ptsensor_info; - reg_r(dev, 0xa1, 0xbfcf, &data, 1); - PDEBUG(D_PROBE, "check sensor header %d", data); + reg_r(gspca_dev, 0xa1, 0xbfcf, 1); + PDEBUG(D_PROBE, "check sensor header %d", gspca_dev->usb_buf[0]); for (i = 0; i < ARRAY_SIZE(sensor_info_data); i++) { ptsensor_info = &sensor_info_data[i]; reg_w(dev, 0xa0, 0x02, 0xb334); @@ -1494,7 +1496,7 @@ static int vc032x_probe_sensor(struct gspca_dev *gspca_dev) "check sensor VC032X -> %d Add -> ox%02X!", i, ptsensor_info->I2cAdd); */ reg_w(dev, 0xa0, ptsensor_info->op, 0xb301); - vc032x_read_sensor_register(dev, ptsensor_info->IdAdd, &value); + read_sensor_register(gspca_dev, ptsensor_info->IdAdd, &value); if (value == ptsensor_info->VpId) { /* PDEBUG(D_PROBE, "find sensor VC032X -> ox%04X!", ptsensor_info->VpId); */ @@ -1504,14 +1506,14 @@ static int vc032x_probe_sensor(struct gspca_dev *gspca_dev) return -1; } -static __u8 i2c_write(struct usb_device *dev, +static __u8 i2c_write(struct gspca_dev *gspca_dev, __u8 reg, const __u8 *val, __u8 size) { - __u8 retbyte; + struct usb_device *dev = gspca_dev->dev; if (size > 3 || size < 1) return -EINVAL; - reg_r(dev, 0xa1, 0xb33f, &retbyte, 1); + reg_r(gspca_dev, 0xa1, 0xb33f, 1); reg_w(dev, 0xa0, size, 0xb334); reg_w(dev, 0xa0, reg, 0xb33a); switch (size) { @@ -1532,8 +1534,8 @@ static __u8 i2c_write(struct usb_device *dev, return -EINVAL; } reg_w(dev, 0xa0, 0x01, 0xb339); - reg_r(dev, 0xa1, 0xb33b, &retbyte, 1); - return retbyte == 0; + reg_r(gspca_dev, 0xa1, 0xb33b, 1); + return gspca_dev->usb_buf[0] == 0; } static void put_tab_to_reg(struct gspca_dev *gspca_dev, @@ -1561,10 +1563,10 @@ static void usb_exchange(struct gspca_dev *gspca_dev, ((data[i][0])<<8) | data[i][1]); break; case 0xaa: /* i2c op */ - i2c_write(dev, data[i][1], &data[i][2], 1); + i2c_write(gspca_dev, data[i][1], &data[i][2], 1); break; case 0xbb: /* i2c op */ - i2c_write(dev, data[i][0], &data[i][1], 2); + i2c_write(gspca_dev, data[i][0], &data[i][1], 2); break; case 0xdd: msleep(data[i][2] + 10); @@ -1596,30 +1598,14 @@ static int sd_config(struct gspca_dev *gspca_dev, struct sd *sd = (struct sd *) gspca_dev; struct usb_device *dev = gspca_dev->dev; struct cam *cam; - __u8 tmp2[4]; int sensor; - __u16 vendor; __u16 product; - vendor = id->idVendor; product = id->idProduct; - switch (vendor) { - case 0x046d: /* Logitech Labtec */ -/* switch (product) { */ -/* case 0x0892: */ -/* case 0x0896: */ - sd->bridge = BRIDGE_VC0321; -/* break; */ -/* } */ - break; + sd->bridge = BRIDGE_VC0321; + switch (id->idVendor) { case 0x0ac8: /* Vimicro z-star */ switch (product) { - case 0x0321: - case 0x0328: - case 0xc001: - case 0xc002: - sd->bridge = BRIDGE_VC0321; - break; case 0x0323: sd->bridge = BRIDGE_VC0323; break; @@ -1639,10 +1625,10 @@ static int sd_config(struct gspca_dev *gspca_dev, cam->epaddr = 0x02; if (sd->bridge == BRIDGE_VC0321) { cam->cam_mode = vc0321_mode; - cam->nmodes = sizeof vc0321_mode / sizeof vc0321_mode[0]; + cam->nmodes = ARRAY_SIZE(vc0321_mode); } else { cam->cam_mode = vc0323_mode; - cam->nmodes = sizeof vc0323_mode / sizeof vc0323_mode[0]; + cam->nmodes = ARRAY_SIZE(vc0323_mode); } vc0321_reset(gspca_dev); @@ -1678,13 +1664,14 @@ static int sd_config(struct gspca_dev *gspca_dev, } sd->qindex = 7; - sd->autogain = sd_ctrls[SD_AUTOGAIN].qctrl.default_value; + sd->autogain = AUTOGAIN_DEF; + sd->lightfreq = FREQ_DEF; if (sd->bridge == BRIDGE_VC0321) { - reg_r(dev, 0x8a, 0, tmp2, 3); + reg_r(gspca_dev, 0x8a, 0, 3); reg_w(dev, 0x87, 0x00, 0x0f0f); - reg_r(dev, 0x8b, 0, tmp2, 3); + reg_r(gspca_dev, 0x8b, 0, 3); reg_w(dev, 0x88, 0x00, 0x0202); } return 0; @@ -1735,7 +1722,6 @@ static void setlightfreq(struct gspca_dev *gspca_dev) static void sd_start(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; -/* __u8 tmp2; */ const __u8 *GammaT = NULL; const __u8 *MatrixT = NULL; int mode; @@ -1837,7 +1823,7 @@ static void sd_start(struct gspca_dev *gspca_dev) reg_w(gspca_dev->dev, 0xa0, 0x40, 0xb824); */ /* Only works for HV7131R ?? - reg_r (gspca_dev->dev, 0xa1, 0xb881, &tmp2, 1); + reg_r (gspca_dev, 0xa1, 0xb881, 1); reg_w(gspca_dev->dev, 0xa0, 0xfe01, 0xb881); reg_w(gspca_dev->dev, 0xa0, 0x79, 0xb801); */ diff --git a/linux/drivers/media/video/gspca/zc3xx-reg.h b/linux/drivers/media/video/gspca/zc3xx-reg.h new file mode 100644 index 000000000..f52e09c2c --- /dev/null +++ b/linux/drivers/media/video/gspca/zc3xx-reg.h @@ -0,0 +1,261 @@ +/* + * zc030x registers + * + * Copyright (c) 2008 Mauro Carvalho Chehab <mchehab@infradead.org> + * + * The register aliases used here came from this driver: + * http://zc0302.sourceforge.net/zc0302.php + * + * This code is placed under the terms of the GNU General Public License v2 + */ + +/* Define the register map */ +#define ZC3XX_R000_SYSTEMCONTROL 0x0000 +#define ZC3XX_R001_SYSTEMOPERATING 0x0001 + +/* Picture size */ +#define ZC3XX_R002_CLOCKSELECT 0x0002 +#define ZC3XX_R003_FRAMEWIDTHHIGH 0x0003 +#define ZC3XX_R004_FRAMEWIDTHLOW 0x0004 +#define ZC3XX_R005_FRAMEHEIGHTHIGH 0x0005 +#define ZC3XX_R006_FRAMEHEIGHTLOW 0x0006 + +/* JPEG control */ +#define ZC3XX_R008_CLOCKSETTING 0x0008 + +/* Test mode */ +#define ZC3XX_R00B_TESTMODECONTROL 0x000b + +/* Frame retreiving */ +#define ZC3XX_R00C_LASTACQTIME 0x000c +#define ZC3XX_R00D_MONITORRES 0x000d +#define ZC3XX_R00E_TIMESTAMPHIGH 0x000e +#define ZC3XX_R00F_TIMESTAMPLOW 0x000f +#define ZC3XX_R018_FRAMELOST 0x0018 +#define ZC3XX_R019_AUTOADJUSTFPS 0x0019 +#define ZC3XX_R01A_LASTFRAMESTATE 0x001a +#define ZC3XX_R025_DATACOUNTER 0x0025 + +/* Stream and sensor specific */ +#define ZC3XX_R010_CMOSSENSORSELECT 0x0010 +#define ZC3XX_R011_VIDEOSTATUS 0x0011 +#define ZC3XX_R012_VIDEOCONTROLFUNC 0x0012 + +/* Horizontal and vertical synchros */ +#define ZC3XX_R01D_HSYNC_0 0x001d +#define ZC3XX_R01E_HSYNC_1 0x001e +#define ZC3XX_R01F_HSYNC_2 0x001f +#define ZC3XX_R020_HSYNC_3 0x0020 + +/* Target picture size in byte */ +#define ZC3XX_R022_TARGETPICTSIZE_0 0x0022 +#define ZC3XX_R023_TARGETPICTSIZE_1 0x0023 +#define ZC3XX_R024_TARGETPICTSIZE_2 0x0024 + +/* Audio registers */ +#define ZC3XX_R030_AUDIOADC 0x0030 +#define ZC3XX_R031_AUDIOSTREAMSTATUS 0x0031 +#define ZC3XX_R032_AUDIOSTATUS 0x0032 + +/* Sensor interface */ +#define ZC3XX_R080_HBLANKHIGH 0x0080 +#define ZC3XX_R081_HBLANKLOW 0x0081 +#define ZC3XX_R082_RESETLEVELADDR 0x0082 +#define ZC3XX_R083_RGAINADDR 0x0083 +#define ZC3XX_R084_GGAINADDR 0x0084 +#define ZC3XX_R085_BGAINADDR 0x0085 +#define ZC3XX_R086_EXPTIMEHIGH 0x0086 +#define ZC3XX_R087_EXPTIMEMID 0x0087 +#define ZC3XX_R088_EXPTIMELOW 0x0088 +#define ZC3XX_R089_RESETBLACKHIGH 0x0089 +#define ZC3XX_R08A_RESETWHITEHIGH 0x008a +#define ZC3XX_R08B_I2CDEVICEADDR 0x008b +#define ZC3XX_R08C_I2CIDLEANDNACK 0x008c +#define ZC3XX_R08D_COMPABILITYMODE 0x008d +#define ZC3XX_R08E_COMPABILITYMODE2 0x008e + +/* I2C control */ +#define ZC3XX_R090_I2CCOMMAND 0x0090 +#define ZC3XX_R091_I2CSTATUS 0x0091 +#define ZC3XX_R092_I2CADDRESSSELECT 0x0092 +#define ZC3XX_R093_I2CSETVALUE 0x0093 +#define ZC3XX_R094_I2CWRITEACK 0x0094 +#define ZC3XX_R095_I2CREAD 0x0095 +#define ZC3XX_R096_I2CREADACK 0x0096 + +/* Window inside the sensor array */ +#define ZC3XX_R097_WINYSTARTHIGH 0x0097 +#define ZC3XX_R098_WINYSTARTLOW 0x0098 +#define ZC3XX_R099_WINXSTARTHIGH 0x0099 +#define ZC3XX_R09A_WINXSTARTLOW 0x009a +#define ZC3XX_R09B_WINHEIGHTHIGH 0x009b +#define ZC3XX_R09C_WINHEIGHTLOW 0x009c +#define ZC3XX_R09D_WINWIDTHHIGH 0x009d +#define ZC3XX_R09E_WINWIDTHLOW 0x009e +#define ZC3XX_R119_FIRSTYHIGH 0x0119 +#define ZC3XX_R11A_FIRSTYLOW 0x011a +#define ZC3XX_R11B_FIRSTXHIGH 0x011b +#define ZC3XX_R11C_FIRSTXLOW 0x011c + +/* Max sensor array size */ +#define ZC3XX_R09F_MAXXHIGH 0x009f +#define ZC3XX_R0A0_MAXXLOW 0x00a0 +#define ZC3XX_R0A1_MAXYHIGH 0x00a1 +#define ZC3XX_R0A2_MAXYLOW 0x00a2 +#define ZC3XX_R0A3_EXPOSURETIMEHIGH 0x00a3 +#define ZC3XX_R0A4_EXPOSURETIMELOW 0x00a4 +#define ZC3XX_R0A5_EXPOSUREGAIN 0x00a5 +#define ZC3XX_R0A6_EXPOSUREBLACKLVL 0x00a6 + +/* Other registers */ +#define ZC3XX_R100_OPERATIONMODE 0x0100 +#define ZC3XX_R101_SENSORCORRECTION 0x0101 + +/* Gains */ +#define ZC3XX_R116_RGAIN 0x0116 +#define ZC3XX_R117_GGAIN 0x0117 +#define ZC3XX_R118_BGAIN 0x0118 +#define ZC3XX_R11D_GLOBALGAIN 0x011d +#define ZC3XX_R1A8_DIGITALGAIN 0x01a8 +#define ZC3XX_R1A9_DIGITALLIMITDIFF 0x01a9 +#define ZC3XX_R1AA_DIGITALGAINSTEP 0x01aa + +/* Auto correction */ +#define ZC3XX_R180_AUTOCORRECTENABLE 0x0180 +#define ZC3XX_R181_WINXSTART 0x0181 +#define ZC3XX_R182_WINXWIDTH 0x0182 +#define ZC3XX_R183_WINXCENTER 0x0183 +#define ZC3XX_R184_WINYSTART 0x0184 +#define ZC3XX_R185_WINYWIDTH 0x0185 +#define ZC3XX_R186_WINYCENTER 0x0186 + +/* Gain range */ +#define ZC3XX_R187_MAXGAIN 0x0187 +#define ZC3XX_R188_MINGAIN 0x0188 + +/* Auto exposure and white balance */ +#define ZC3XX_R189_AWBSTATUS 0x0189 +#define ZC3XX_R18A_AWBFREEZE 0x018a +#define ZC3XX_R18B_AESTATUS 0x018b +#define ZC3XX_R18C_AEFREEZE 0x018c +#define ZC3XX_R18F_AEUNFREEZE 0x018f +#define ZC3XX_R190_EXPOSURELIMITHIGH 0x0190 +#define ZC3XX_R191_EXPOSURELIMITMID 0x0191 +#define ZC3XX_R192_EXPOSURELIMITLOW 0x0192 +#define ZC3XX_R195_ANTIFLICKERHIGH 0x0195 +#define ZC3XX_R196_ANTIFLICKERMID 0x0196 +#define ZC3XX_R197_ANTIFLICKERLOW 0x0197 + +/* What is this ? */ +#define ZC3XX_R18D_YTARGET 0x018d +#define ZC3XX_R18E_RESETLVL 0x018e + +/* Color */ +#define ZC3XX_R1A0_REDMEANAFTERAGC 0x01a0 +#define ZC3XX_R1A1_GREENMEANAFTERAGC 0x01a1 +#define ZC3XX_R1A2_BLUEMEANAFTERAGC 0x01a2 +#define ZC3XX_R1A3_REDMEANAFTERAWB 0x01a3 +#define ZC3XX_R1A4_GREENMEANAFTERAWB 0x01a4 +#define ZC3XX_R1A5_BLUEMEANAFTERAWB 0x01a5 +#define ZC3XX_R1A6_YMEANAFTERAE 0x01a6 +#define ZC3XX_R1A7_CALCGLOBALMEAN 0x01a7 + +#define ZC3XX_R1A2_BLUEMEANAFTERAGC 0x01a2 + +/* Matrixes */ + +/* Color matrix is like : + R' = R * RGB00 + G * RGB01 + B * RGB02 + RGB03 + G' = R * RGB10 + G * RGB11 + B * RGB22 + RGB13 + B' = R * RGB20 + G * RGB21 + B * RGB12 + RGB23 + */ +#define ZC3XX_R10A_RGB00 0x010a +#define ZC3XX_R10B_RGB01 0x010b +#define ZC3XX_R10C_RGB02 0x010c +#define ZC3XX_R113_RGB03 0x0113 +#define ZC3XX_R10D_RGB10 0x010d +#define ZC3XX_R10E_RGB11 0x010e +#define ZC3XX_R10F_RGB12 0x010f +#define ZC3XX_R114_RGB13 0x0114 +#define ZC3XX_R110_RGB20 0x0110 +#define ZC3XX_R111_RGB21 0x0111 +#define ZC3XX_R112_RGB22 0x0112 +#define ZC3XX_R115_RGB23 0x0115 + +/* Gamma matrix */ +#define ZC3XX_R120_GAMMA00 0x0120 +#define ZC3XX_R121_GAMMA01 0x0121 +#define ZC3XX_R122_GAMMA02 0x0122 +#define ZC3XX_R123_GAMMA03 0x0123 +#define ZC3XX_R124_GAMMA04 0x0124 +#define ZC3XX_R125_GAMMA05 0x0125 +#define ZC3XX_R126_GAMMA06 0x0126 +#define ZC3XX_R127_GAMMA07 0x0127 +#define ZC3XX_R128_GAMMA08 0x0128 +#define ZC3XX_R129_GAMMA09 0x0129 +#define ZC3XX_R12A_GAMMA0A 0x012a +#define ZC3XX_R12B_GAMMA0B 0x012b +#define ZC3XX_R12C_GAMMA0C 0x012c +#define ZC3XX_R12D_GAMMA0D 0x012d +#define ZC3XX_R12E_GAMMA0E 0x012e +#define ZC3XX_R12F_GAMMA0F 0x012f +#define ZC3XX_R130_GAMMA10 0x0130 +#define ZC3XX_R131_GAMMA11 0x0131 +#define ZC3XX_R132_GAMMA12 0x0132 +#define ZC3XX_R133_GAMMA13 0x0133 +#define ZC3XX_R134_GAMMA14 0x0134 +#define ZC3XX_R135_GAMMA15 0x0135 +#define ZC3XX_R136_GAMMA16 0x0136 +#define ZC3XX_R137_GAMMA17 0x0137 +#define ZC3XX_R138_GAMMA18 0x0138 +#define ZC3XX_R139_GAMMA19 0x0139 +#define ZC3XX_R13A_GAMMA1A 0x013a +#define ZC3XX_R13B_GAMMA1B 0x013b +#define ZC3XX_R13C_GAMMA1C 0x013c +#define ZC3XX_R13D_GAMMA1D 0x013d +#define ZC3XX_R13E_GAMMA1E 0x013e +#define ZC3XX_R13F_GAMMA1F 0x013f + +/* Luminance gamma */ +#define ZC3XX_R140_YGAMMA00 0x0140 +#define ZC3XX_R141_YGAMMA01 0x0141 +#define ZC3XX_R142_YGAMMA02 0x0142 +#define ZC3XX_R143_YGAMMA03 0x0143 +#define ZC3XX_R144_YGAMMA04 0x0144 +#define ZC3XX_R145_YGAMMA05 0x0145 +#define ZC3XX_R146_YGAMMA06 0x0146 +#define ZC3XX_R147_YGAMMA07 0x0147 +#define ZC3XX_R148_YGAMMA08 0x0148 +#define ZC3XX_R149_YGAMMA09 0x0149 +#define ZC3XX_R14A_YGAMMA0A 0x014a +#define ZC3XX_R14B_YGAMMA0B 0x014b +#define ZC3XX_R14C_YGAMMA0C 0x014c +#define ZC3XX_R14D_YGAMMA0D 0x014d +#define ZC3XX_R14E_YGAMMA0E 0x014e +#define ZC3XX_R14F_YGAMMA0F 0x014f +#define ZC3XX_R150_YGAMMA10 0x0150 +#define ZC3XX_R151_YGAMMA11 0x0151 + +#define ZC3XX_R1C5_SHARPNESSMODE 0x01c5 +#define ZC3XX_R1C6_SHARPNESS00 0x01c6 +#define ZC3XX_R1C7_SHARPNESS01 0x01c7 +#define ZC3XX_R1C8_SHARPNESS02 0x01c8 +#define ZC3XX_R1C9_SHARPNESS03 0x01c9 +#define ZC3XX_R1CA_SHARPNESS04 0x01ca +#define ZC3XX_R1CB_SHARPNESS05 0x01cb + +/* Synchronization */ +#define ZC3XX_R190_SYNC00LOW 0x0190 +#define ZC3XX_R191_SYNC00MID 0x0191 +#define ZC3XX_R192_SYNC00HIGH 0x0192 +#define ZC3XX_R195_SYNC01LOW 0x0195 +#define ZC3XX_R196_SYNC01MID 0x0196 +#define ZC3XX_R197_SYNC01HIGH 0x0197 + +/* Dead pixels */ +#define ZC3XX_R250_DEADPIXELSMODE 0x0250 + +/* EEPROM */ +#define ZC3XX_R300_EEPROMCONFIG 0x0300 +#define ZC3XX_R301_EEPROMACCESS 0x0301 +#define ZC3XX_R302_EEPROMSTATUS 0x0302 diff --git a/linux/drivers/media/video/gspca/zc3xx.c b/linux/drivers/media/video/gspca/zc3xx.c index b0599532f..58cf9752b 100644 --- a/linux/drivers/media/video/gspca/zc3xx.c +++ b/linux/drivers/media/video/gspca/zc3xx.c @@ -24,8 +24,8 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) -static const char version[] = "2.1.5"; +#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7) +static const char version[] = "2.1.7"; MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>, " "Serge A. Suchkov <Serge.A.S@tochka.ru>"); @@ -35,6 +35,7 @@ MODULE_LICENSE("GPL"); static int force_sensor = -1; #include "jpeg.h" +#include "zc3xx-reg.h" /* specific webcam descriptor */ struct sd { @@ -209,30 +210,30 @@ struct usb_action { static const 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}, + {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, + {0xa0, 0x10, ZC3XX_R002_CLOCKSELECT}, + {0xa0, 0x00, ZC3XX_R010_CMOSSENSORSELECT}, + {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, + {0xa0, 0x20, ZC3XX_R080_HBLANKHIGH}, + {0xa0, 0x21, ZC3XX_R081_HBLANKLOW}, + {0xa0, 0x30, ZC3XX_R083_RGAINADDR}, + {0xa0, 0x31, ZC3XX_R084_GGAINADDR}, + {0xa0, 0x32, ZC3XX_R085_BGAINADDR}, + {0xa0, 0x23, ZC3XX_R086_EXPTIMEHIGH}, + {0xa0, 0x24, ZC3XX_R087_EXPTIMEMID}, + {0xa0, 0x25, ZC3XX_R088_EXPTIMELOW}, + {0xa0, 0xb3, ZC3XX_R08B_I2CDEVICEADDR}, + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* 00 */ + {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, + {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, + {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, + {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW}, + {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, + {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW}, + {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, + {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW}, {0xaa, 0x02, 0x0008}, {0xaa, 0x03, 0x0000}, {0xaa, 0x11, 0x0000}, @@ -245,124 +246,124 @@ static const struct usb_action cs2102_Initial[] = { {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, 0x37, ZC3XX_R101_SENSORCORRECTION}, + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, + {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, + {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, + {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, + {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, {0xa0, 0x10, 0x01ae}, - {0xa0, 0x08, 0x0250}, - {0xa0, 0x08, 0x0301}, - {0xa0, 0x68, 0x018d}, + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, + {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, + {0xa0, 0x68, ZC3XX_R18D_YTARGET}, {0xa0, 0x00, 0x01ad}, {0xa1, 0x01, 0x0002}, {0xa1, 0x01, 0x0008}, - {0xa0, 0x03, 0x0008}, /* 00 */ - {0xa0, 0x08, 0x01c6}, /* sharpness+ */ + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* 00 */ + {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */ {0xa1, 0x01, 0x01c8}, {0xa1, 0x01, 0x01c9}, {0xa1, 0x01, 0x01ca}, - {0xa0, 0x0f, 0x01cb}, /* sharpness- */ - {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}, + {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */ + {0xa0, 0x24, ZC3XX_R120_GAMMA00}, /* gamma 5 */ + {0xa0, 0x44, ZC3XX_R121_GAMMA01}, + {0xa0, 0x64, ZC3XX_R122_GAMMA02}, + {0xa0, 0x84, ZC3XX_R123_GAMMA03}, + {0xa0, 0x9d, ZC3XX_R124_GAMMA04}, + {0xa0, 0xb2, ZC3XX_R125_GAMMA05}, + {0xa0, 0xc4, ZC3XX_R126_GAMMA06}, + {0xa0, 0xd3, ZC3XX_R127_GAMMA07}, + {0xa0, 0xe0, ZC3XX_R128_GAMMA08}, + {0xa0, 0xeb, ZC3XX_R129_GAMMA09}, + {0xa0, 0xf4, ZC3XX_R12A_GAMMA0A}, + {0xa0, 0xfb, ZC3XX_R12B_GAMMA0B}, + {0xa0, 0xff, ZC3XX_R12C_GAMMA0C}, + {0xa0, 0xff, ZC3XX_R12D_GAMMA0D}, + {0xa0, 0xff, ZC3XX_R12E_GAMMA0E}, + {0xa0, 0xff, ZC3XX_R12F_GAMMA0F}, + {0xa0, 0x18, ZC3XX_R130_GAMMA10}, + {0xa0, 0x20, ZC3XX_R131_GAMMA11}, + {0xa0, 0x20, ZC3XX_R132_GAMMA12}, + {0xa0, 0x1c, ZC3XX_R133_GAMMA13}, + {0xa0, 0x16, ZC3XX_R134_GAMMA14}, + {0xa0, 0x13, ZC3XX_R135_GAMMA15}, + {0xa0, 0x10, ZC3XX_R136_GAMMA16}, + {0xa0, 0x0e, ZC3XX_R137_GAMMA17}, + {0xa0, 0x0b, ZC3XX_R138_GAMMA18}, + {0xa0, 0x09, ZC3XX_R139_GAMMA19}, + {0xa0, 0x07, ZC3XX_R13A_GAMMA1A}, + {0xa0, 0x06, ZC3XX_R13B_GAMMA1B}, + {0xa0, 0x00, ZC3XX_R13C_GAMMA1C}, + {0xa0, 0x00, ZC3XX_R13D_GAMMA1D}, + {0xa0, 0x00, ZC3XX_R13E_GAMMA1E}, + {0xa0, 0x01, ZC3XX_R13F_GAMMA1F}, + {0xa0, 0x58, ZC3XX_R10A_RGB00}, /* matrix */ + {0xa0, 0xf4, ZC3XX_R10B_RGB01}, + {0xa0, 0xf4, ZC3XX_R10C_RGB02}, + {0xa0, 0xf4, ZC3XX_R10D_RGB10}, + {0xa0, 0x58, ZC3XX_R10E_RGB11}, + {0xa0, 0xf4, ZC3XX_R10F_RGB12}, + {0xa0, 0xf4, ZC3XX_R110_RGB20}, + {0xa0, 0xf4, ZC3XX_R111_RGB21}, + {0xa0, 0x58, ZC3XX_R112_RGB22}, {0xa1, 0x01, 0x0180}, - {0xa0, 0x00, 0x0180}, - {0xa0, 0x00, 0x0019}, + {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, {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}, + {0xa0, 0x02, ZC3XX_R190_EXPOSURELIMITHIGH}, + {0xa0, 0xab, ZC3XX_R191_EXPOSURELIMITMID}, + {0xa0, 0x98, ZC3XX_R192_EXPOSURELIMITLOW}, + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, + {0xa0, 0x30, ZC3XX_R196_ANTIFLICKERMID}, + {0xa0, 0xd4, ZC3XX_R197_ANTIFLICKERLOW}, + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, + {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF}, + {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP}, + {0xa0, 0x39, ZC3XX_R01D_HSYNC_0}, + {0xa0, 0x70, ZC3XX_R01E_HSYNC_1}, + {0xa0, 0xb0, ZC3XX_R01F_HSYNC_2}, + {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, + {0xa0, 0x40, ZC3XX_R180_AUTOCORRECTENABLE}, {0xa1, 0x01, 0x0180}, - {0xa0, 0x42, 0x0180}, - {0xa0, 0x40, 0x0116}, - {0xa0, 0x40, 0x0117}, - {0xa0, 0x40, 0x0118}, + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x40, ZC3XX_R116_RGAIN}, + {0xa0, 0x40, ZC3XX_R117_GGAIN}, + {0xa0, 0x40, ZC3XX_R118_BGAIN}, {} }; static const 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}, + {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, + {0xa0, 0x00, ZC3XX_R002_CLOCKSELECT}, + {0xa0, 0x00, ZC3XX_R010_CMOSSENSORSELECT}, + {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, + {0xa0, 0x20, ZC3XX_R080_HBLANKHIGH}, + {0xa0, 0x21, ZC3XX_R081_HBLANKLOW}, + {0xa0, 0x30, ZC3XX_R083_RGAINADDR}, + {0xa0, 0x31, ZC3XX_R084_GGAINADDR}, + {0xa0, 0x32, ZC3XX_R085_BGAINADDR}, + {0xa0, 0x23, ZC3XX_R086_EXPTIMEHIGH}, + {0xa0, 0x24, ZC3XX_R087_EXPTIMEMID}, + {0xa0, 0x25, ZC3XX_R088_EXPTIMELOW}, + {0xa0, 0xb3, ZC3XX_R08B_I2CDEVICEADDR}, + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* 00 */ + {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, + {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, + {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, + {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW}, + {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, + {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW}, + {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, + {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW}, {0xaa, 0x02, 0x0008}, {0xaa, 0x03, 0x0000}, {0xaa, 0x11, 0x0001}, @@ -375,98 +376,98 @@ static const struct usb_action cs2102_InitialScale[] = { {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, 0x77, ZC3XX_R101_SENSORCORRECTION}, + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, + {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, + {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, + {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, + {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, {0xa0, 0x15, 0x01ae}, - {0xa0, 0x08, 0x0250}, - {0xa0, 0x08, 0x0301}, - {0xa0, 0x68, 0x018d}, + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, + {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, + {0xa0, 0x68, ZC3XX_R18D_YTARGET}, {0xa0, 0x00, 0x01ad}, {0xa1, 0x01, 0x0002}, {0xa1, 0x01, 0x0008}, - {0xa0, 0x03, 0x0008}, /* 00 */ - {0xa0, 0x08, 0x01c6}, /* sharpness+ */ + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* 00 */ + {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */ {0xa1, 0x01, 0x01c8}, {0xa1, 0x01, 0x01c9}, {0xa1, 0x01, 0x01ca}, - {0xa0, 0x0f, 0x01cb}, /* sharpness- */ - {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}, + {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */ + {0xa0, 0x24, ZC3XX_R120_GAMMA00}, /* gamma 5 */ + {0xa0, 0x44, ZC3XX_R121_GAMMA01}, + {0xa0, 0x64, ZC3XX_R122_GAMMA02}, + {0xa0, 0x84, ZC3XX_R123_GAMMA03}, + {0xa0, 0x9d, ZC3XX_R124_GAMMA04}, + {0xa0, 0xb2, ZC3XX_R125_GAMMA05}, + {0xa0, 0xc4, ZC3XX_R126_GAMMA06}, + {0xa0, 0xd3, ZC3XX_R127_GAMMA07}, + {0xa0, 0xe0, ZC3XX_R128_GAMMA08}, + {0xa0, 0xeb, ZC3XX_R129_GAMMA09}, + {0xa0, 0xf4, ZC3XX_R12A_GAMMA0A}, + {0xa0, 0xfb, ZC3XX_R12B_GAMMA0B}, + {0xa0, 0xff, ZC3XX_R12C_GAMMA0C}, + {0xa0, 0xff, ZC3XX_R12D_GAMMA0D}, + {0xa0, 0xff, ZC3XX_R12E_GAMMA0E}, + {0xa0, 0xff, ZC3XX_R12F_GAMMA0F}, + {0xa0, 0x18, ZC3XX_R130_GAMMA10}, + {0xa0, 0x20, ZC3XX_R131_GAMMA11}, + {0xa0, 0x20, ZC3XX_R132_GAMMA12}, + {0xa0, 0x1c, ZC3XX_R133_GAMMA13}, + {0xa0, 0x16, ZC3XX_R134_GAMMA14}, + {0xa0, 0x13, ZC3XX_R135_GAMMA15}, + {0xa0, 0x10, ZC3XX_R136_GAMMA16}, + {0xa0, 0x0e, ZC3XX_R137_GAMMA17}, + {0xa0, 0x0b, ZC3XX_R138_GAMMA18}, + {0xa0, 0x09, ZC3XX_R139_GAMMA19}, + {0xa0, 0x07, ZC3XX_R13A_GAMMA1A}, + {0xa0, 0x06, ZC3XX_R13B_GAMMA1B}, + {0xa0, 0x00, ZC3XX_R13C_GAMMA1C}, + {0xa0, 0x00, ZC3XX_R13D_GAMMA1D}, + {0xa0, 0x00, ZC3XX_R13E_GAMMA1E}, + {0xa0, 0x01, ZC3XX_R13F_GAMMA1F}, + {0xa0, 0x58, ZC3XX_R10A_RGB00}, /* matrix */ + {0xa0, 0xf4, ZC3XX_R10B_RGB01}, + {0xa0, 0xf4, ZC3XX_R10C_RGB02}, + {0xa0, 0xf4, ZC3XX_R10D_RGB10}, + {0xa0, 0x58, ZC3XX_R10E_RGB11}, + {0xa0, 0xf4, ZC3XX_R10F_RGB12}, + {0xa0, 0xf4, ZC3XX_R110_RGB20}, + {0xa0, 0xf4, ZC3XX_R111_RGB21}, + {0xa0, 0x58, ZC3XX_R112_RGB22}, {0xa1, 0x01, 0x0180}, - {0xa0, 0x00, 0x0180}, - {0xa0, 0x00, 0x0019}, + {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, {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}, + {0xa0, 0x01, ZC3XX_R190_EXPOSURELIMITHIGH}, + {0xa0, 0x55, ZC3XX_R191_EXPOSURELIMITMID}, + {0xa0, 0xcc, ZC3XX_R192_EXPOSURELIMITLOW}, + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, + {0xa0, 0x18, ZC3XX_R196_ANTIFLICKERMID}, + {0xa0, 0x6a, ZC3XX_R197_ANTIFLICKERLOW}, + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, + {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF}, + {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP}, + {0xa0, 0x3f, ZC3XX_R01D_HSYNC_0}, + {0xa0, 0xa5, ZC3XX_R01E_HSYNC_1}, + {0xa0, 0xf0, ZC3XX_R01F_HSYNC_2}, + {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, + {0xa0, 0x40, ZC3XX_R180_AUTOCORRECTENABLE}, {0xa1, 0x01, 0x0180}, - {0xa0, 0x42, 0x0180}, - {0xa0, 0x40, 0x0116}, - {0xa0, 0x40, 0x0117}, - {0xa0, 0x40, 0x0118}, + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x40, ZC3XX_R116_RGAIN}, + {0xa0, 0x40, ZC3XX_R117_GGAIN}, + {0xa0, 0x40, ZC3XX_R118_BGAIN}, {} }; static const struct usb_action cs2102_50HZ[] = { - {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 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 */ @@ -475,23 +476,23 @@ static const struct usb_action cs2102_50HZ[] = { {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 */ + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */ + {0xa0, 0x3f, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,3f,cc */ + {0xa0, 0xf0, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,f0,cc */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */ + {0xa0, 0x42, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,42,cc */ + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */ + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,20,cc */ + {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,10,cc */ + {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,24,cc */ + {0xa0, 0x8c, ZC3XX_R01D_HSYNC_0}, /* 00,1d,8c,cc */ + {0xa0, 0xb0, ZC3XX_R01E_HSYNC_1}, /* 00,1e,b0,cc */ + {0xa0, 0xd0, ZC3XX_R01F_HSYNC_2}, /* 00,1f,d0,cc */ {} }; static const struct usb_action cs2102_50HZScale[] = { - {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 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 */ @@ -500,23 +501,23 @@ static const struct usb_action cs2102_50HZScale[] = { {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 */ + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */ + {0xa0, 0x3f, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,3f,cc */ + {0xa0, 0xf7, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,f7,cc */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */ + {0xa0, 0x83, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,83,cc */ + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */ + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,20,cc */ + {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,10,cc */ + {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,24,cc */ + {0xa0, 0x93, ZC3XX_R01D_HSYNC_0}, /* 00,1d,93,cc */ + {0xa0, 0xb0, ZC3XX_R01E_HSYNC_1}, /* 00,1e,b0,cc */ + {0xa0, 0xd0, ZC3XX_R01F_HSYNC_2}, /* 00,1f,d0,cc */ {} }; static const struct usb_action cs2102_60HZ[] = { - {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 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 */ @@ -525,23 +526,23 @@ static const struct usb_action cs2102_60HZ[] = { {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, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */ + {0xa0, 0x3f, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,3f,cc */ + {0xa0, 0xe4, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,e4,cc */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */ + {0xa0, 0x3a, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,3a,cc */ + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */ + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,20,cc */ + {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,10,cc */ + {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,24,cc */ + {0xa0, 0x5d, ZC3XX_R01D_HSYNC_0}, /* 00,1d,5d,cc */ + {0xa0, 0x90, ZC3XX_R01E_HSYNC_1}, /* 00,1e,90,cc */ {0xa0, 0xd0, 0x00c8}, /* 00,c8,d0,cc */ {} }; static const struct usb_action cs2102_60HZScale[] = { - {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 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 */ @@ -550,23 +551,23 @@ static const struct usb_action cs2102_60HZScale[] = { {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 */ + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */ + {0xa0, 0x3f, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,3f,cc */ + {0xa0, 0xfc, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,fc,cc */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */ + {0xa0, 0x69, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,69,cc */ + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */ + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,20,cc */ + {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,10,cc */ + {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,24,cc */ + {0xa0, 0xb7, ZC3XX_R01D_HSYNC_0}, /* 00,1d,b7,cc */ + {0xa0, 0xd0, ZC3XX_R01E_HSYNC_1}, /* 00,1e,d0,cc */ + {0xa0, 0xe8, ZC3XX_R01F_HSYNC_2}, /* 00,1f,e8,cc */ {} }; static const struct usb_action cs2102_NoFliker[] = { - {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 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 */ @@ -575,23 +576,23 @@ static const struct usb_action cs2102_NoFliker[] = { {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 */ + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */ + {0xa0, 0x3f, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,3f,cc */ + {0xa0, 0xf0, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,f0,cc */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */ + {0xa0, 0x10, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,10,cc */ + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */ + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,20,cc */ + {0xa0, 0x00, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,00,cc */ + {0xa0, 0x00, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,00,cc */ + {0xa0, 0x59, ZC3XX_R01D_HSYNC_0}, /* 00,1d,59,cc */ + {0xa0, 0x90, ZC3XX_R01E_HSYNC_1}, /* 00,1e,90,cc */ + {0xa0, 0xc8, ZC3XX_R01F_HSYNC_2}, /* 00,1f,c8,cc */ {} }; static const struct usb_action cs2102_NoFlikerScale[] = { - {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 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 */ @@ -600,878 +601,878 @@ static const struct usb_action cs2102_NoFlikerScale[] = { {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 */ + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */ + {0xa0, 0x3f, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,3f,cc */ + {0xa0, 0xf0, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,f0,cc */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */ + {0xa0, 0x10, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,10,cc */ + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */ + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,20,cc */ + {0xa0, 0x00, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,00,cc */ + {0xa0, 0x00, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,00,cc */ + {0xa0, 0x59, ZC3XX_R01D_HSYNC_0}, /* 00,1d,59,cc */ + {0xa0, 0x90, ZC3XX_R01E_HSYNC_1}, /* 00,1e,90,cc */ + {0xa0, 0xc8, ZC3XX_R01F_HSYNC_2}, /* 00,1f,c8,cc */ {} }; /* CS2102_KOCOM */ static const 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, 0x11, ZC3XX_R002_CLOCKSELECT}, + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, + {0xa0, 0x08, ZC3XX_R010_CMOSSENSORSELECT}, + {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, + {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, + {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, + {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW}, + {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, + {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, + {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW}, + {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, + {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW}, + {0xa0, 0xe8, ZC3XX_R09C_WINHEIGHTLOW}, + {0xa0, 0x88, ZC3XX_R09E_WINWIDTHLOW}, + {0xa0, 0x55, ZC3XX_R08B_I2CDEVICEADDR}, + {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x00, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x0a, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x02, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x0b, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x02, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x0c, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x7c, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x0d, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0xa3, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x03, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0xfb, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x05, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x00, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x06, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x03, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x09, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x08, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x0e, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x04, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x0f, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x18, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x10, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x18, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x11, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x18, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x12, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x18, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x15, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x00, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x16, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x0c, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x17, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x0c, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x04, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0xb7, ZC3XX_R101_SENSORCORRECTION}, + {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x78, ZC3XX_R18D_YTARGET}, + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, + {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, + {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, + {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, + {0xa0, 0x20, ZC3XX_R087_EXPTIMEMID}, + {0xa0, 0x21, ZC3XX_R088_EXPTIMELOW}, + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, + {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, {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}, /* sharpness+ */ - {0xa0, 0x0f, 0x01cb}, /* sharpness- */ - {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, 0x02, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x60, ZC3XX_R116_RGAIN}, + {0xa0, 0x40, ZC3XX_R117_GGAIN}, + {0xa0, 0x4c, ZC3XX_R118_BGAIN}, + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* clock ? */ + {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */ + {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */ + {0xa0, 0x13, ZC3XX_R120_GAMMA00}, /* gamma 4 */ + {0xa0, 0x38, ZC3XX_R121_GAMMA01}, + {0xa0, 0x59, ZC3XX_R122_GAMMA02}, + {0xa0, 0x79, ZC3XX_R123_GAMMA03}, + {0xa0, 0x92, ZC3XX_R124_GAMMA04}, + {0xa0, 0xa7, ZC3XX_R125_GAMMA05}, + {0xa0, 0xb9, ZC3XX_R126_GAMMA06}, + {0xa0, 0xc8, ZC3XX_R127_GAMMA07}, + {0xa0, 0xd4, ZC3XX_R128_GAMMA08}, + {0xa0, 0xdf, ZC3XX_R129_GAMMA09}, + {0xa0, 0xe7, ZC3XX_R12A_GAMMA0A}, + {0xa0, 0xee, ZC3XX_R12B_GAMMA0B}, + {0xa0, 0xf4, ZC3XX_R12C_GAMMA0C}, + {0xa0, 0xf9, ZC3XX_R12D_GAMMA0D}, + {0xa0, 0xfc, ZC3XX_R12E_GAMMA0E}, + {0xa0, 0xff, ZC3XX_R12F_GAMMA0F}, + {0xa0, 0x26, ZC3XX_R130_GAMMA10}, + {0xa0, 0x22, ZC3XX_R131_GAMMA11}, + {0xa0, 0x20, ZC3XX_R132_GAMMA12}, + {0xa0, 0x1c, ZC3XX_R133_GAMMA13}, + {0xa0, 0x16, ZC3XX_R134_GAMMA14}, + {0xa0, 0x13, ZC3XX_R135_GAMMA15}, + {0xa0, 0x10, ZC3XX_R136_GAMMA16}, + {0xa0, 0x0d, ZC3XX_R137_GAMMA17}, + {0xa0, 0x0b, ZC3XX_R138_GAMMA18}, + {0xa0, 0x09, ZC3XX_R139_GAMMA19}, + {0xa0, 0x07, ZC3XX_R13A_GAMMA1A}, + {0xa0, 0x06, ZC3XX_R13B_GAMMA1B}, + {0xa0, 0x05, ZC3XX_R13C_GAMMA1C}, + {0xa0, 0x04, ZC3XX_R13D_GAMMA1D}, + {0xa0, 0x03, ZC3XX_R13E_GAMMA1E}, + {0xa0, 0x02, ZC3XX_R13F_GAMMA1F}, + {0xa0, 0x58, ZC3XX_R10A_RGB00}, /* matrix */ + {0xa0, 0xf4, ZC3XX_R10B_RGB01}, + {0xa0, 0xf4, ZC3XX_R10C_RGB02}, + {0xa0, 0xf4, ZC3XX_R10D_RGB10}, + {0xa0, 0x58, ZC3XX_R10E_RGB11}, + {0xa0, 0xf4, ZC3XX_R10F_RGB12}, + {0xa0, 0xf4, ZC3XX_R110_RGB20}, + {0xa0, 0xf4, ZC3XX_R111_RGB21}, + {0xa0, 0x58, ZC3XX_R112_RGB22}, + {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, + {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x00, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x13, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x22, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x14, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x01, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x20, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x01, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x21, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x22, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x04, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x01, ZC3XX_R0A3_EXPOSURETIMEHIGH}, + {0xa0, 0x22, ZC3XX_R0A4_EXPOSURETIMELOW}, + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, + {0xa0, 0x07, ZC3XX_R191_EXPOSURELIMITMID}, + {0xa0, 0xee, ZC3XX_R192_EXPOSURELIMITLOW}, + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, + {0xa0, 0x3a, ZC3XX_R197_ANTIFLICKERLOW}, + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, + {0xa0, 0x0c, ZC3XX_R1A9_DIGITALLIMITDIFF}, + {0xa0, 0x28, ZC3XX_R1AA_DIGITALGAINSTEP}, + {0xa0, 0x04, ZC3XX_R01D_HSYNC_0}, + {0xa0, 0x0f, ZC3XX_R01E_HSYNC_1}, + {0xa0, 0x19, ZC3XX_R01F_HSYNC_2}, + {0xa0, 0x1f, ZC3XX_R020_HSYNC_3}, + {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN}, + {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN}, + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x60, ZC3XX_R116_RGAIN}, + {0xa0, 0x40, ZC3XX_R117_GGAIN}, + {0xa0, 0x4c, ZC3XX_R118_BGAIN}, + {0xa0, 0x04, ZC3XX_R1A7_CALCGLOBALMEAN}, + {0xa0, 0x20, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x01, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x21, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x5c, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x00, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x13, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x5c, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x14, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x01, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x04, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN}, + {0xa0, 0x04, ZC3XX_R1A7_CALCGLOBALMEAN}, + {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN}, + {0xa0, 0x04, ZC3XX_R1A7_CALCGLOBALMEAN}, + {0xa0, 0x20, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x01, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x21, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x96, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x00, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x13, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x96, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x14, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x01, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x04, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN}, + {0xa0, 0x04, ZC3XX_R1A7_CALCGLOBALMEAN}, + {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN}, {} }; static const 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, 0x11, ZC3XX_R002_CLOCKSELECT}, + {0xa0, 0x00, ZC3XX_R002_CLOCKSELECT}, + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, + {0xa0, 0x08, ZC3XX_R010_CMOSSENSORSELECT}, + {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, + {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, + {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, + {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW}, + {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, + {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, + {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW}, + {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, + {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW}, + {0xa0, 0xe8, ZC3XX_R09C_WINHEIGHTLOW}, + {0xa0, 0x88, ZC3XX_R09E_WINWIDTHLOW}, + {0xa0, 0x55, ZC3XX_R08B_I2CDEVICEADDR}, + {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x00, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x0a, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x02, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x0b, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x02, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x0c, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x7b, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x0d, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0xa3, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x03, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0xfb, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x05, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x00, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x06, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x03, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x09, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x08, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x0e, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x04, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x0f, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x18, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x10, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x18, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x11, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x18, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x12, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x18, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x15, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x00, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x16, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x0c, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x17, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x0c, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x04, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0xf7, ZC3XX_R101_SENSORCORRECTION}, + {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x78, ZC3XX_R18D_YTARGET}, + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, + {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, + {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, + {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, + {0xa0, 0x20, ZC3XX_R087_EXPTIMEMID}, + {0xa0, 0x21, ZC3XX_R088_EXPTIMELOW}, + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, + {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, {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}, /* sharpness+ */ - {0xa0, 0x0f, 0x01cb}, /* sharpness- */ - {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, 0x02, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x60, ZC3XX_R116_RGAIN}, + {0xa0, 0x40, ZC3XX_R117_GGAIN}, + {0xa0, 0x4c, ZC3XX_R118_BGAIN}, + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* clock ? */ + {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */ + {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */ + {0xa0, 0x13, ZC3XX_R120_GAMMA00}, /* gamma 4 */ + {0xa0, 0x38, ZC3XX_R121_GAMMA01}, + {0xa0, 0x59, ZC3XX_R122_GAMMA02}, + {0xa0, 0x79, ZC3XX_R123_GAMMA03}, + {0xa0, 0x92, ZC3XX_R124_GAMMA04}, + {0xa0, 0xa7, ZC3XX_R125_GAMMA05}, + {0xa0, 0xb9, ZC3XX_R126_GAMMA06}, + {0xa0, 0xc8, ZC3XX_R127_GAMMA07}, + {0xa0, 0xd4, ZC3XX_R128_GAMMA08}, + {0xa0, 0xdf, ZC3XX_R129_GAMMA09}, + {0xa0, 0xe7, ZC3XX_R12A_GAMMA0A}, + {0xa0, 0xee, ZC3XX_R12B_GAMMA0B}, + {0xa0, 0xf4, ZC3XX_R12C_GAMMA0C}, + {0xa0, 0xf9, ZC3XX_R12D_GAMMA0D}, + {0xa0, 0xfc, ZC3XX_R12E_GAMMA0E}, + {0xa0, 0xff, ZC3XX_R12F_GAMMA0F}, + {0xa0, 0x26, ZC3XX_R130_GAMMA10}, + {0xa0, 0x22, ZC3XX_R131_GAMMA11}, + {0xa0, 0x20, ZC3XX_R132_GAMMA12}, + {0xa0, 0x1c, ZC3XX_R133_GAMMA13}, + {0xa0, 0x16, ZC3XX_R134_GAMMA14}, + {0xa0, 0x13, ZC3XX_R135_GAMMA15}, + {0xa0, 0x10, ZC3XX_R136_GAMMA16}, + {0xa0, 0x0d, ZC3XX_R137_GAMMA17}, + {0xa0, 0x0b, ZC3XX_R138_GAMMA18}, + {0xa0, 0x09, ZC3XX_R139_GAMMA19}, + {0xa0, 0x07, ZC3XX_R13A_GAMMA1A}, + {0xa0, 0x06, ZC3XX_R13B_GAMMA1B}, + {0xa0, 0x05, ZC3XX_R13C_GAMMA1C}, + {0xa0, 0x04, ZC3XX_R13D_GAMMA1D}, + {0xa0, 0x03, ZC3XX_R13E_GAMMA1E}, + {0xa0, 0x02, ZC3XX_R13F_GAMMA1F}, + {0xa0, 0x58, ZC3XX_R10A_RGB00}, /* matrix */ + {0xa0, 0xf4, ZC3XX_R10B_RGB01}, + {0xa0, 0xf4, ZC3XX_R10C_RGB02}, + {0xa0, 0xf4, ZC3XX_R10D_RGB10}, + {0xa0, 0x58, ZC3XX_R10E_RGB11}, + {0xa0, 0xf4, ZC3XX_R10F_RGB12}, + {0xa0, 0xf4, ZC3XX_R110_RGB20}, + {0xa0, 0xf4, ZC3XX_R111_RGB21}, + {0xa0, 0x58, ZC3XX_R112_RGB22}, + {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, + {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x00, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x13, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x22, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x14, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x01, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x20, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x01, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x21, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x22, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x04, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x01, ZC3XX_R0A3_EXPOSURETIMEHIGH}, + {0xa0, 0x22, ZC3XX_R0A4_EXPOSURETIMELOW}, + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, + {0xa0, 0x07, ZC3XX_R191_EXPOSURELIMITMID}, + {0xa0, 0xee, ZC3XX_R192_EXPOSURELIMITLOW}, + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, + {0xa0, 0x3a, ZC3XX_R197_ANTIFLICKERLOW}, + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, + {0xa0, 0x0c, ZC3XX_R1A9_DIGITALLIMITDIFF}, + {0xa0, 0x28, ZC3XX_R1AA_DIGITALGAINSTEP}, + {0xa0, 0x04, ZC3XX_R01D_HSYNC_0}, + {0xa0, 0x0f, ZC3XX_R01E_HSYNC_1}, + {0xa0, 0x19, ZC3XX_R01F_HSYNC_2}, + {0xa0, 0x1f, ZC3XX_R020_HSYNC_3}, + {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN}, + {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN}, + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x60, ZC3XX_R116_RGAIN}, + {0xa0, 0x40, ZC3XX_R117_GGAIN}, + {0xa0, 0x4c, ZC3XX_R118_BGAIN}, + {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, + {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, + {0xa0, 0x00, ZC3XX_R002_CLOCKSELECT}, + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, + {0xa0, 0x08, ZC3XX_R010_CMOSSENSORSELECT}, + {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, + {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, + {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, + {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW}, + {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, + {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, + {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW}, + {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, + {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW}, + {0xa0, 0xe8, ZC3XX_R09C_WINHEIGHTLOW}, + {0xa0, 0x88, ZC3XX_R09E_WINWIDTHLOW}, + {0xa0, 0x55, ZC3XX_R08B_I2CDEVICEADDR}, + {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x00, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x0A, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x02, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x0B, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x02, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x0C, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x7b, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x0D, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0xA3, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x03, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0xfb, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x05, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x00, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x06, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x03, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x09, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x08, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x0E, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x04, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x0f, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x18, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x10, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x18, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x11, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x18, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x12, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x18, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x15, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x00, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x16, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x0c, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x17, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x0C, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x04, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0xf7, ZC3XX_R101_SENSORCORRECTION}, + {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x78, ZC3XX_R18D_YTARGET}, + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, + {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, + {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, + {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, + {0xa0, 0x20, ZC3XX_R087_EXPTIMEMID}, + {0xa0, 0x21, ZC3XX_R088_EXPTIMELOW}, + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, + {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, {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}, /* sharpness+ */ - {0xa0, 0x0f, 0x01cb}, /* sharpness- */ - {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}, + {0xa0, 0x02, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x60, ZC3XX_R116_RGAIN}, + {0xa0, 0x40, ZC3XX_R117_GGAIN}, + {0xa0, 0x4c, ZC3XX_R118_BGAIN}, + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* clock ? */ + {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */ + {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */ + {0xa0, 0x13, ZC3XX_R120_GAMMA00}, /* gamma 4 */ + {0xa0, 0x38, ZC3XX_R121_GAMMA01}, + {0xa0, 0x59, ZC3XX_R122_GAMMA02}, + {0xa0, 0x79, ZC3XX_R123_GAMMA03}, + {0xa0, 0x92, ZC3XX_R124_GAMMA04}, + {0xa0, 0xa7, ZC3XX_R125_GAMMA05}, + {0xa0, 0xb9, ZC3XX_R126_GAMMA06}, + {0xa0, 0xc8, ZC3XX_R127_GAMMA07}, + {0xa0, 0xd4, ZC3XX_R128_GAMMA08}, + {0xa0, 0xdf, ZC3XX_R129_GAMMA09}, + {0xa0, 0xe7, ZC3XX_R12A_GAMMA0A}, + {0xa0, 0xee, ZC3XX_R12B_GAMMA0B}, + {0xa0, 0xf4, ZC3XX_R12C_GAMMA0C}, + {0xa0, 0xf9, ZC3XX_R12D_GAMMA0D}, + {0xa0, 0xfc, ZC3XX_R12E_GAMMA0E}, + {0xa0, 0xff, ZC3XX_R12F_GAMMA0F}, + {0xa0, 0x26, ZC3XX_R130_GAMMA10}, + {0xa0, 0x22, ZC3XX_R131_GAMMA11}, + {0xa0, 0x20, ZC3XX_R132_GAMMA12}, + {0xa0, 0x1c, ZC3XX_R133_GAMMA13}, + {0xa0, 0x16, ZC3XX_R134_GAMMA14}, + {0xa0, 0x13, ZC3XX_R135_GAMMA15}, + {0xa0, 0x10, ZC3XX_R136_GAMMA16}, + {0xa0, 0x0d, ZC3XX_R137_GAMMA17}, + {0xa0, 0x0b, ZC3XX_R138_GAMMA18}, + {0xa0, 0x09, ZC3XX_R139_GAMMA19}, + {0xa0, 0x07, ZC3XX_R13A_GAMMA1A}, + {0xa0, 0x06, ZC3XX_R13B_GAMMA1B}, + {0xa0, 0x05, ZC3XX_R13C_GAMMA1C}, + {0xa0, 0x04, ZC3XX_R13D_GAMMA1D}, + {0xa0, 0x03, ZC3XX_R13E_GAMMA1E}, + {0xa0, 0x02, ZC3XX_R13F_GAMMA1F}, + {0xa0, 0x58, ZC3XX_R10A_RGB00}, /* matrix */ + {0xa0, 0xf4, ZC3XX_R10B_RGB01}, + {0xa0, 0xf4, ZC3XX_R10C_RGB02}, + {0xa0, 0xf4, ZC3XX_R10D_RGB10}, + {0xa0, 0x58, ZC3XX_R10E_RGB11}, + {0xa0, 0xf4, ZC3XX_R10F_RGB12}, + {0xa0, 0xf4, ZC3XX_R110_RGB20}, + {0xa0, 0xf4, ZC3XX_R111_RGB21}, + {0xa0, 0x58, ZC3XX_R112_RGB22}, + {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, + {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x00, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x13, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x22, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x14, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x01, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x20, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x01, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x21, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x22, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x04, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x01, ZC3XX_R0A3_EXPOSURETIMEHIGH}, + {0xa0, 0x22, ZC3XX_R0A4_EXPOSURETIMELOW}, + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, + {0xa0, 0x07, ZC3XX_R191_EXPOSURELIMITMID}, + {0xa0, 0xee, ZC3XX_R192_EXPOSURELIMITLOW}, + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, + {0xa0, 0x3a, ZC3XX_R197_ANTIFLICKERLOW}, + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, + {0xa0, 0x0c, ZC3XX_R1A9_DIGITALLIMITDIFF}, + {0xa0, 0x28, ZC3XX_R1AA_DIGITALGAINSTEP}, + {0xa0, 0x04, ZC3XX_R01D_HSYNC_0}, + {0xa0, 0x0f, ZC3XX_R01E_HSYNC_1}, + {0xa0, 0x19, ZC3XX_R01F_HSYNC_2}, + {0xa0, 0x1f, ZC3XX_R020_HSYNC_3}, + {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN}, + {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN}, + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x60, ZC3XX_R116_RGAIN}, + {0xa0, 0x40, ZC3XX_R117_GGAIN}, + {0xa0, 0x4c, ZC3XX_R118_BGAIN}, + {0xa0, 0x04, ZC3XX_R1A7_CALCGLOBALMEAN}, + {0xa0, 0x20, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x01, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x21, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x5c, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x00, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x13, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x5c, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x14, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x01, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x04, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN}, + {0xa0, 0x04, ZC3XX_R1A7_CALCGLOBALMEAN}, + {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN}, + {0xa0, 0x04, ZC3XX_R1A7_CALCGLOBALMEAN}, + {0xa0, 0x20, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x01, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x21, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x96, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x00, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x13, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x96, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x14, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x01, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x04, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN}, + {0xa0, 0x04, ZC3XX_R1A7_CALCGLOBALMEAN}, + {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN}, + {0xa0, 0x04, ZC3XX_R1A7_CALCGLOBALMEAN}, + {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN}, + {0xa0, 0x04, ZC3XX_R1A7_CALCGLOBALMEAN}, + {0xa0, 0x20, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x01, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x21, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0xd0, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x00, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x13, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0xd0, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x14, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x01, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x04, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN}, + {0xa0, 0x02, ZC3XX_R008_CLOCKSETTING}, + {0xa0, 0x04, ZC3XX_R1A7_CALCGLOBALMEAN}, + {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN}, + {0xa0, 0x04, ZC3XX_R1A7_CALCGLOBALMEAN}, + {0xa0, 0x20, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x02, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x21, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x0a, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x00, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x13, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x0a, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x14, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x02, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x04, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN}, + {0xa0, 0x04, ZC3XX_R1A7_CALCGLOBALMEAN}, + {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN}, + {0xa0, 0x04, ZC3XX_R1A7_CALCGLOBALMEAN}, + {0xa0, 0x20, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x02, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x21, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x44, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x00, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x13, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x44, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x14, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x02, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x04, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN}, + {0xa0, 0x04, ZC3XX_R1A7_CALCGLOBALMEAN}, + {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN}, + {0xa0, 0x04, ZC3XX_R1A7_CALCGLOBALMEAN}, + {0xa0, 0x20, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x02, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x21, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x7e, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x00, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x13, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x7e, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x14, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x02, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x18, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x04, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN}, + {0xa0, 0x04, ZC3XX_R1A7_CALCGLOBALMEAN}, + {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN}, + {0xa0, 0x04, ZC3XX_R1A7_CALCGLOBALMEAN}, {} }; static const 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 */ + {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, /* 00,00,01,cc */ + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* 00,08,03,cc */ + {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,01,cc */ + {0xa0, 0x04, ZC3XX_R002_CLOCKSELECT}, /* 00,02,04,cc */ + {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, /* 00,03,02,cc */ + {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, /* 00,04,80,cc */ + {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, /* 00,05,01,cc */ + {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW}, /* 00,06,e0,cc */ + {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, /* 00,01,01,cc */ + {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,03,cc */ + {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,01,cc */ + {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, /* 00,98,00,cc */ + {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW}, /* 00,9a,00,cc */ + {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, /* 01,1a,00,cc */ + {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW}, /* 01,1c,00,cc */ + {0xa0, 0xe6, ZC3XX_R09C_WINHEIGHTLOW}, /* 00,9c,e6,cc */ + {0xa0, 0x86, ZC3XX_R09E_WINWIDTHLOW}, /* 00,9e,86,cc */ + {0xa0, 0x98, ZC3XX_R08B_I2CDEVICEADDR}, /* 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 */ @@ -1481,9 +1482,9 @@ static const struct usb_action gc0305_Initial[] = { /* 640x480 */ {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 */ + {0xa0, 0x82, ZC3XX_R086_EXPTIMEHIGH}, /* 00,86,82,cc */ + {0xa0, 0x83, ZC3XX_R087_EXPTIMEMID}, /* 00,87,83,cc */ + {0xa0, 0x84, ZC3XX_R088_EXPTIMELOW}, /* 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 */ @@ -1499,43 +1500,43 @@ static const struct usb_action gc0305_Initial[] = { /* 640x480 */ {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, 0xb7, ZC3XX_R101_SENSORCORRECTION}, /* 01,01,b7,cc */ + {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,05,cc */ + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, /* 01,00,0d,cc */ + {0xa0, 0x76, ZC3XX_R189_AWBSTATUS}, /* 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, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, /* 01,c5,03,cc */ + {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, /* 01,cb,13,cc */ + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, /* 02,50,08,cc */ + {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, /* 03,01,08,cc */ + {0xa0, 0x60, ZC3XX_R1A8_DIGITALGAIN}, /* 01,a8,60,cc */ + {0xa0, 0x85, ZC3XX_R18D_YTARGET}, /* 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 */ + {0xa0, 0x52, ZC3XX_R116_RGAIN}, /* 01,16,52,cc */ + {0xa0, 0x40, ZC3XX_R117_GGAIN}, /* 01,17,40,cc */ + {0xa0, 0x52, ZC3XX_R118_BGAIN}, /* 01,18,52,cc */ + {0xa0, 0x03, ZC3XX_R113_RGB03}, /* 01,13,03,cc */ {} }; static const 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 */ + {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, /* 00,00,01,cc */ + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* 00,08,03,cc */ + {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,01,cc */ + {0xa0, 0x10, ZC3XX_R002_CLOCKSELECT}, /* 00,02,10,cc */ + {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, /* 00,03,02,cc */ + {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, /* 00,04,80,cc */ + {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, /* 00,05,01,cc */ + {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW}, /* 00,06,e0,cc */ + {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, /* 00,01,01,cc */ + {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,03,cc */ + {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,01,cc */ + {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, /* 00,98,00,cc */ + {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW}, /* 00,9a,00,cc */ + {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, /* 01,1a,00,cc */ + {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW}, /* 01,1c,00,cc */ + {0xa0, 0xe8, ZC3XX_R09C_WINHEIGHTLOW}, /* 00,9c,e8,cc */ + {0xa0, 0x88, ZC3XX_R09E_WINWIDTHLOW}, /* 00,9e,88,cc */ + {0xa0, 0x98, ZC3XX_R08B_I2CDEVICEADDR}, /* 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 */ @@ -1545,9 +1546,9 @@ static const struct usb_action gc0305_InitialScale[] = { /* 320x240 */ {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 */ + {0xa0, 0x82, ZC3XX_R086_EXPTIMEHIGH}, /* 00,86,82,cc */ + {0xa0, 0x83, ZC3XX_R087_EXPTIMEMID}, /* 00,87,83,cc */ + {0xa0, 0x84, ZC3XX_R088_EXPTIMELOW}, /* 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 */ @@ -1563,115 +1564,119 @@ static const struct usb_action gc0305_InitialScale[] = { /* 320x240 */ {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, 0xb7, ZC3XX_R101_SENSORCORRECTION}, /* 01,01,b7,cc */ + {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,05,cc */ + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, /* 01,00,0d,cc */ + {0xa0, 0x76, ZC3XX_R189_AWBSTATUS}, /* 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, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, /* 01,c5,03,cc */ + {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, /* 01,cb,13,cc */ + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, /* 02,50,08,cc */ + {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, /* 03,01,08,cc */ + {0xa0, 0x60, ZC3XX_R1A8_DIGITALGAIN}, /* 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 */ + {0xa0, 0x52, ZC3XX_R116_RGAIN}, /* 01,16,52,cc */ + {0xa0, 0x40, ZC3XX_R117_GGAIN}, /* 01,17,40,cc */ + {0xa0, 0x52, ZC3XX_R118_BGAIN}, /* 01,18,52,cc */ + {0xa0, 0x03, ZC3XX_R113_RGB03}, /* 01,13,03,cc */ {} }; static const 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 */ + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */ + {0xa0, 0x0b, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,0b,cc */ + {0xa0, 0x18, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,18,cc */ + /* win: 01,92,10 */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */ + {0xa0, 0x8e, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,8e,cc */ + /* win: 01,97,ec */ + {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE}, /* 01,8c,0e,cc */ + {0xa0, 0x15, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,15,cc */ + {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,10,cc */ + {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,24,cc */ + {0xa0, 0x62, ZC3XX_R01D_HSYNC_0}, /* 00,1d,62,cc */ + {0xa0, 0x90, ZC3XX_R01E_HSYNC_1}, /* 00,1e,90,cc */ + {0xa0, 0xc8, ZC3XX_R01F_HSYNC_2}, /* 00,1f,c8,cc */ + {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc */ + {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN}, /* 01,1d,60,cc */ + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, /* 01,80,42,cc */ +/* {0xa0, 0x85, ZC3XX_R18D_YTARGET}, * 01,8d,85,cc * + * if 640x480 */ {} }; static const 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 */ + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */ + {0xa0, 0x0b, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,0b,cc */ + {0xa0, 0x10, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,10,cc */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */ + {0xa0, 0xec, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,ec,cc */ + {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE}, /* 01,8c,0e,cc */ + {0xa0, 0x15, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,15,cc */ + {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,10,cc */ + {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,24,cc */ + {0xa0, 0x62, ZC3XX_R01D_HSYNC_0}, /* 00,1d,62,cc */ + {0xa0, 0x90, ZC3XX_R01E_HSYNC_1}, /* 00,1e,90,cc */ + {0xa0, 0xc8, ZC3XX_R01F_HSYNC_2}, /* 00,1f,c8,cc */ + {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc */ + {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN}, /* 01,1d,60,cc */ + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, /* 01,80,42,cc */ + {0xa0, 0x80, ZC3XX_R18D_YTARGET}, /* 01,8d,80,cc */ {} }; static const struct usb_action gc0305_NoFliker[] = { - {0xa0, 0x0c, 0x0100}, /* 01,00,0c,cc */ + {0xa0, 0x0c, ZC3XX_R100_OPERATIONMODE}, /* 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 */ + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */ + {0xa0, 0x00, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,00,cc */ + {0xa0, 0x48, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,48,cc */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */ + {0xa0, 0x10, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,10,cc */ + {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE}, /* 01,8c,0e,cc */ + {0xa0, 0x15, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,15,cc */ + {0xa0, 0x62, ZC3XX_R01D_HSYNC_0}, /* 00,1d,62,cc */ + {0xa0, 0x90, ZC3XX_R01E_HSYNC_1}, /* 00,1e,90,cc */ + {0xa0, 0xc8, ZC3XX_R01F_HSYNC_2}, /* 00,1f,c8,cc */ + {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc */ + {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN}, /* 01,1d,60,cc */ + {0xa0, 0x03, ZC3XX_R180_AUTOCORRECTENABLE}, /* 01,80,03,cc */ + {0xa0, 0x80, ZC3XX_R18D_YTARGET}, /* 01,8d,80,cc */ {} }; /* play poker with registers at your own risk !! */ static const 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}, + {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, + {0xa0, 0x0e, ZC3XX_R010_CMOSSENSORSELECT}, + {0xa0, 0x10, ZC3XX_R002_CLOCKSELECT}, + {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, + {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, + {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, + {0xa0, 0xd0, ZC3XX_R006_FRAMEHEIGHTLOW}, + /* D0 ?? E0 did not start */ + {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, + {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x08, ZC3XX_R08D_COMPABILITYMODE}, + {0xa0, 0x08, ZC3XX_R098_WINYSTARTLOW}, + {0xa0, 0x02, ZC3XX_R09A_WINXSTARTLOW}, + {0xa0, 0x08, ZC3XX_R11A_FIRSTYLOW}, + {0xa0, 0x02, ZC3XX_R11C_FIRSTXLOW}, + {0xa0, 0x01, ZC3XX_R09B_WINHEIGHTHIGH}, + {0xa0, 0xd8, ZC3XX_R09C_WINHEIGHTLOW}, + {0xa0, 0x02, ZC3XX_R09D_WINWIDTHHIGH}, + {0xa0, 0x88, ZC3XX_R09E_WINWIDTHLOW}, {0xaa, 0x02, 0x0002}, {0xaa, 0x07, 0x0006}, {0xaa, 0x08, 0x0002}, @@ -1684,71 +1689,71 @@ static const struct usb_action hdcs2020xx_Initial[] = { {0xaa, 0x12, 0x0005}, {0xaa, 0x13, 0x0063}, {0xaa, 0x15, 0x0070}, - {0xa0, 0x37, 0x0101}, - {0xa0, 0x0d, 0x0100}, - {0xa0, 0x06, 0x0189}, + {0xa0, 0x37, ZC3XX_R101_SENSORCORRECTION}, + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, + {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, {0xa0, 0x00, 0x01ad}, - {0xa0, 0x03, 0x01c5}, - {0xa0, 0x13, 0x01cb}, - {0xa0, 0x08, 0x0250}, - {0xa0, 0x08, 0x0301}, - {0xa0, 0x70, 0x018d}, + {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, + {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, + {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, + {0xa0, 0x70, ZC3XX_R18D_YTARGET}, {0xa1, 0x01, 0x0002}, {0xa1, 0x01, 0x0008}, - {0xa0, 0x03, 0x0008}, /* clock ? */ - {0xa0, 0x04, 0x01c6}, /* sharpness+ */ + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* clock ? */ + {0xa0, 0x04, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */ {0xa1, 0x01, 0x01c8}, {0xa1, 0x01, 0x01c9}, {0xa1, 0x01, 0x01ca}, - {0xa0, 0x07, 0x01cb}, /* sharpness- */ - {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}, + {0xa0, 0x07, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */ + {0xa0, 0x11, ZC3XX_R120_GAMMA00}, /* gamma ~4 */ + {0xa0, 0x37, ZC3XX_R121_GAMMA01}, + {0xa0, 0x58, ZC3XX_R122_GAMMA02}, + {0xa0, 0x79, ZC3XX_R123_GAMMA03}, + {0xa0, 0x91, ZC3XX_R124_GAMMA04}, + {0xa0, 0xa6, ZC3XX_R125_GAMMA05}, + {0xa0, 0xb8, ZC3XX_R126_GAMMA06}, + {0xa0, 0xc7, ZC3XX_R127_GAMMA07}, + {0xa0, 0xd3, ZC3XX_R128_GAMMA08}, + {0xa0, 0xde, ZC3XX_R129_GAMMA09}, + {0xa0, 0xe6, ZC3XX_R12A_GAMMA0A}, + {0xa0, 0xed, ZC3XX_R12B_GAMMA0B}, + {0xa0, 0xf3, ZC3XX_R12C_GAMMA0C}, + {0xa0, 0xf8, ZC3XX_R12D_GAMMA0D}, + {0xa0, 0xfb, ZC3XX_R12E_GAMMA0E}, + {0xa0, 0xff, ZC3XX_R12F_GAMMA0F}, + {0xa0, 0x26, ZC3XX_R130_GAMMA10}, + {0xa0, 0x23, ZC3XX_R131_GAMMA11}, + {0xa0, 0x20, ZC3XX_R132_GAMMA12}, + {0xa0, 0x1c, ZC3XX_R133_GAMMA13}, + {0xa0, 0x16, ZC3XX_R134_GAMMA14}, + {0xa0, 0x13, ZC3XX_R135_GAMMA15}, + {0xa0, 0x10, ZC3XX_R136_GAMMA16}, + {0xa0, 0x0d, ZC3XX_R137_GAMMA17}, + {0xa0, 0x0b, ZC3XX_R138_GAMMA18}, + {0xa0, 0x09, ZC3XX_R139_GAMMA19}, + {0xa0, 0x07, ZC3XX_R13A_GAMMA1A}, + {0xa0, 0x06, ZC3XX_R13B_GAMMA1B}, + {0xa0, 0x05, ZC3XX_R13C_GAMMA1C}, + {0xa0, 0x04, ZC3XX_R13D_GAMMA1D}, + {0xa0, 0x03, ZC3XX_R13E_GAMMA1E}, + {0xa0, 0x02, ZC3XX_R13F_GAMMA1F}, + + {0xa0, 0x4c, ZC3XX_R10A_RGB00}, /* matrix */ + {0xa0, 0xf5, ZC3XX_R10B_RGB01}, + {0xa0, 0xff, ZC3XX_R10C_RGB02}, + {0xa0, 0xf9, ZC3XX_R10D_RGB10}, + {0xa0, 0x51, ZC3XX_R10E_RGB11}, + {0xa0, 0xf5, ZC3XX_R10F_RGB12}, + {0xa0, 0xfb, ZC3XX_R110_RGB20}, + {0xa0, 0xed, ZC3XX_R111_RGB21}, + {0xa0, 0x5f, ZC3XX_R112_RGB22}, {0xa1, 0x01, 0x0180}, - {0xa0, 0x00, 0x0180}, - {0xa0, 0x00, 0x0019}, - {0xa0, 0x20, 0x0087}, - {0xa0, 0x21, 0x0088}, + {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, + {0xa0, 0x20, ZC3XX_R087_EXPTIMEMID}, + {0xa0, 0x21, ZC3XX_R088_EXPTIMELOW}, {0xaa, 0x20, 0x0004}, {0xaa, 0x21, 0x003d}, {0xaa, 0x03, 0x0041}, @@ -1756,67 +1761,67 @@ static const struct usb_action hdcs2020xx_Initial[] = { {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}, + {0xa0, 0x14, ZC3XX_R1A9_DIGITALLIMITDIFF}, + {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP}, + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, + {0xa0, 0x04, ZC3XX_R191_EXPOSURELIMITMID}, + {0xa0, 0x3d, ZC3XX_R192_EXPOSURELIMITLOW}, + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, + {0xa0, 0x9b, ZC3XX_R197_ANTIFLICKERLOW}, + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, + {0xa0, 0x41, ZC3XX_R01D_HSYNC_0}, + {0xa0, 0x6f, ZC3XX_R01E_HSYNC_1}, + {0xa0, 0xad, ZC3XX_R01F_HSYNC_2}, + {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, + {0xa0, 0x0f, ZC3XX_R087_EXPTIMEMID}, + {0xa0, 0x0e, ZC3XX_R088_EXPTIMELOW}, + {0xa0, 0x40, ZC3XX_R180_AUTOCORRECTENABLE}, {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}, + {0xa0, 0x3d, ZC3XX_R192_EXPOSURELIMITLOW}, + {0xa0, 0x04, ZC3XX_R191_EXPOSURELIMITMID}, + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, + {0xa0, 0x1d, ZC3XX_R116_RGAIN}, + {0xa0, 0x40, ZC3XX_R117_GGAIN}, + {0xa0, 0x85, ZC3XX_R118_BGAIN}, {0xa1, 0x01, 0x0116}, {0xa1, 0x01, 0x0118}, {0xa1, 0x01, 0x0180}, - {0xa0, 0x42, 0x0180}, - {0xa0, 0x1d, 0x0116}, - {0xa0, 0x40, 0x0117}, - {0xa0, 0x85, 0x0118}, + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x1d, ZC3XX_R116_RGAIN}, + {0xa0, 0x40, ZC3XX_R117_GGAIN}, + {0xa0, 0x85, ZC3XX_R118_BGAIN}, {0xa1, 0x01, 0x0116}, {0xa1, 0x01, 0x0118}, -/* {0xa0, 0x02, 0x0008}, */ +/* {0xa0, 0x02, ZC3XX_R008_CLOCKSETTING}, */ {0xa0, 0x00, 0x0007}, {} }; static const 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}, + {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, + {0xa0, 0x0e, ZC3XX_R010_CMOSSENSORSELECT}, + {0xa0, 0x00, ZC3XX_R002_CLOCKSELECT}, + {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, + {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, + {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, + {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW}, + {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, + {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x08, ZC3XX_R08D_COMPABILITYMODE}, + {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, + {0xa0, 0x03, ZC3XX_R09A_WINXSTARTLOW}, + {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, + {0xa0, 0x03, ZC3XX_R11C_FIRSTXLOW}, + {0xa0, 0x01, ZC3XX_R09B_WINHEIGHTHIGH}, + {0xa0, 0xe6, ZC3XX_R09C_WINHEIGHTLOW}, + {0xa0, 0x02, ZC3XX_R09D_WINWIDTHHIGH}, + {0xa0, 0x86, ZC3XX_R09E_WINWIDTHLOW}, {0xaa, 0x02, 0x0002}, {0xaa, 0x07, 0x0006}, {0xaa, 0x08, 0x0002}, @@ -1829,70 +1834,70 @@ static const struct usb_action hdcs2020xx_InitialScale[] = { {0xaa, 0x12, 0x0005}, {0xaa, 0x13, 0x0063}, {0xaa, 0x15, 0x0070}, - {0xa0, 0xb7, 0x0101}, - {0xa0, 0x0d, 0x0100}, - {0xa0, 0x06, 0x0189}, + {0xa0, 0xb7, ZC3XX_R101_SENSORCORRECTION}, + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, + {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, {0xa0, 0x00, 0x01ad}, - {0xa0, 0x03, 0x01c5}, - {0xa0, 0x13, 0x01cb}, - {0xa0, 0x08, 0x0250}, - {0xa0, 0x08, 0x0301}, - {0xa0, 0x70, 0x018d}, + {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, + {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, + {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, + {0xa0, 0x70, ZC3XX_R18D_YTARGET}, {0xa1, 0x01, 0x0002}, {0xa1, 0x01, 0x0008}, - {0xa0, 0x03, 0x0008}, /* clock ? */ - {0xa0, 0x04, 0x01c6}, /* sharpness+ */ + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* clock ? */ + {0xa0, 0x04, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */ {0xa1, 0x01, 0x01c8}, {0xa1, 0x01, 0x01c9}, {0xa1, 0x01, 0x01ca}, - {0xa0, 0x07, 0x01cb}, /* sharpness- */ - {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}, + {0xa0, 0x07, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */ + {0xa0, 0x11, ZC3XX_R120_GAMMA00}, /* gamma ~4*/ + {0xa0, 0x37, ZC3XX_R121_GAMMA01}, + {0xa0, 0x58, ZC3XX_R122_GAMMA02}, + {0xa0, 0x79, ZC3XX_R123_GAMMA03}, + {0xa0, 0x91, ZC3XX_R124_GAMMA04}, + {0xa0, 0xa6, ZC3XX_R125_GAMMA05}, + {0xa0, 0xb8, ZC3XX_R126_GAMMA06}, + {0xa0, 0xc7, ZC3XX_R127_GAMMA07}, + {0xa0, 0xd3, ZC3XX_R128_GAMMA08}, + {0xa0, 0xde, ZC3XX_R129_GAMMA09}, + {0xa0, 0xe6, ZC3XX_R12A_GAMMA0A}, + {0xa0, 0xed, ZC3XX_R12B_GAMMA0B}, + {0xa0, 0xf3, ZC3XX_R12C_GAMMA0C}, + {0xa0, 0xf8, ZC3XX_R12D_GAMMA0D}, + {0xa0, 0xfb, ZC3XX_R12E_GAMMA0E}, + {0xa0, 0xff, ZC3XX_R12F_GAMMA0F}, + {0xa0, 0x26, ZC3XX_R130_GAMMA10}, + {0xa0, 0x23, ZC3XX_R131_GAMMA11}, + {0xa0, 0x20, ZC3XX_R132_GAMMA12}, + {0xa0, 0x1c, ZC3XX_R133_GAMMA13}, + {0xa0, 0x16, ZC3XX_R134_GAMMA14}, + {0xa0, 0x13, ZC3XX_R135_GAMMA15}, + {0xa0, 0x10, ZC3XX_R136_GAMMA16}, + {0xa0, 0x0d, ZC3XX_R137_GAMMA17}, + {0xa0, 0x0b, ZC3XX_R138_GAMMA18}, + {0xa0, 0x09, ZC3XX_R139_GAMMA19}, + {0xa0, 0x07, ZC3XX_R13A_GAMMA1A}, + {0xa0, 0x06, ZC3XX_R13B_GAMMA1B}, + {0xa0, 0x05, ZC3XX_R13C_GAMMA1C}, + {0xa0, 0x04, ZC3XX_R13D_GAMMA1D}, + {0xa0, 0x03, ZC3XX_R13E_GAMMA1E}, + {0xa0, 0x02, ZC3XX_R13F_GAMMA1F}, + {0xa0, 0x60, ZC3XX_R10A_RGB00}, /* matrix */ + {0xa0, 0xff, ZC3XX_R10B_RGB01}, + {0xa0, 0xff, ZC3XX_R10C_RGB02}, + {0xa0, 0xff, ZC3XX_R10D_RGB10}, + {0xa0, 0x60, ZC3XX_R10E_RGB11}, + {0xa0, 0xff, ZC3XX_R10F_RGB12}, + {0xa0, 0xff, ZC3XX_R110_RGB20}, + {0xa0, 0xff, ZC3XX_R111_RGB21}, + {0xa0, 0x60, ZC3XX_R112_RGB22}, {0xa1, 0x01, 0x0180}, - {0xa0, 0x00, 0x0180}, - {0xa0, 0x00, 0x0019}, - {0xa0, 0x20, 0x0087}, - {0xa0, 0x21, 0x0088}, + {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, + {0xa0, 0x20, ZC3XX_R087_EXPTIMEMID}, + {0xa0, 0x21, ZC3XX_R088_EXPTIMELOW}, {0xaa, 0x20, 0x0002}, {0xaa, 0x21, 0x001b}, {0xaa, 0x03, 0x0044}, @@ -1900,62 +1905,62 @@ static const struct usb_action hdcs2020xx_InitialScale[] = { {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}, + {0xa0, 0x14, ZC3XX_R1A9_DIGITALLIMITDIFF}, + {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP}, + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, + {0xa0, 0x02, ZC3XX_R191_EXPOSURELIMITMID}, + {0xa0, 0x1b, ZC3XX_R192_EXPOSURELIMITLOW}, + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, + {0xa0, 0x4d, ZC3XX_R197_ANTIFLICKERLOW}, + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, + {0xa0, 0x44, ZC3XX_R01D_HSYNC_0}, + {0xa0, 0x6f, ZC3XX_R01E_HSYNC_1}, + {0xa0, 0xad, ZC3XX_R01F_HSYNC_2}, + {0xa0, 0xeb, ZC3XX_R020_HSYNC_3}, + {0xa0, 0x0f, ZC3XX_R087_EXPTIMEMID}, + {0xa0, 0x0e, ZC3XX_R088_EXPTIMELOW}, + {0xa0, 0x40, ZC3XX_R180_AUTOCORRECTENABLE}, {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}, + {0xa0, 0x1b, ZC3XX_R192_EXPOSURELIMITLOW}, + {0xa0, 0x02, ZC3XX_R191_EXPOSURELIMITMID}, + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, + {0xa0, 0x1d, ZC3XX_R116_RGAIN}, + {0xa0, 0x40, ZC3XX_R117_GGAIN}, + {0xa0, 0x99, ZC3XX_R118_BGAIN}, {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, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x1d, ZC3XX_R116_RGAIN}, + {0xa0, 0x40, ZC3XX_R117_GGAIN}, + {0xa0, 0x99, ZC3XX_R118_BGAIN}, +/* {0xa0, 0x02, ZC3XX_R008_CLOCKSETTING}, */ {0xa0, 0x00, 0x0007}, /* {0xa0, 0x18, 0x00fe}, */ {} }; static const 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}, + {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, + {0xa0, 0x11, ZC3XX_R002_CLOCKSELECT}, + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* qtable 0x05 */ + {0xa0, 0x08, ZC3XX_R010_CMOSSENSORSELECT}, + {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, + {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, + {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, + {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW}, + {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, + {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, + {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW}, + {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, + {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW}, + {0xa0, 0xe8, ZC3XX_R09C_WINHEIGHTLOW}, + {0xa0, 0x88, ZC3XX_R09E_WINWIDTHLOW}, {0xaa, 0x1c, 0x0000}, {0xaa, 0x0a, 0x0001}, {0xaa, 0x0b, 0x0006}, @@ -1973,121 +1978,121 @@ static const struct usb_action hdcs2020xb_Initial[] = { {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}, + {0xa0, 0xb7, ZC3XX_R101_SENSORCORRECTION}, + {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x70, ZC3XX_R18D_YTARGET}, + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, + {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, + {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, + {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, + {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, {0xa1, 0x01, 0x0002}, {0xa1, 0x01, 0x0008}, {0xa1, 0x01, 0x0180}, - {0xa0, 0x02, 0x0180}, - {0xa0, 0x40, 0x0116}, - {0xa0, 0x40, 0x0117}, - {0xa0, 0x40, 0x0118}, + {0xa0, 0x02, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x40, ZC3XX_R116_RGAIN}, + {0xa0, 0x40, ZC3XX_R117_GGAIN}, + {0xa0, 0x40, ZC3XX_R118_BGAIN}, {0xa1, 0x01, 0x0008}, - {0xa0, 0x03, 0x0008}, /* clock ? */ - {0xa0, 0x08, 0x01c6}, /* sharpness+ */ + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* clock ? */ + {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */ {0xa1, 0x01, 0x01c8}, {0xa1, 0x01, 0x01c9}, {0xa1, 0x01, 0x01ca}, - {0xa0, 0x0f, 0x01cb}, /* sharpness- */ - {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}, + {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */ + {0xa0, 0x13, ZC3XX_R120_GAMMA00}, /* gamma 4 */ + {0xa0, 0x38, ZC3XX_R121_GAMMA01}, + {0xa0, 0x59, ZC3XX_R122_GAMMA02}, + {0xa0, 0x79, ZC3XX_R123_GAMMA03}, + {0xa0, 0x92, ZC3XX_R124_GAMMA04}, + {0xa0, 0xa7, ZC3XX_R125_GAMMA05}, + {0xa0, 0xb9, ZC3XX_R126_GAMMA06}, + {0xa0, 0xc8, ZC3XX_R127_GAMMA07}, + {0xa0, 0xd4, ZC3XX_R128_GAMMA08}, + {0xa0, 0xdf, ZC3XX_R129_GAMMA09}, + {0xa0, 0xe7, ZC3XX_R12A_GAMMA0A}, + {0xa0, 0xee, ZC3XX_R12B_GAMMA0B}, + {0xa0, 0xf4, ZC3XX_R12C_GAMMA0C}, + {0xa0, 0xf9, ZC3XX_R12D_GAMMA0D}, + {0xa0, 0xfc, ZC3XX_R12E_GAMMA0E}, + {0xa0, 0xff, ZC3XX_R12F_GAMMA0F}, + {0xa0, 0x26, ZC3XX_R130_GAMMA10}, + {0xa0, 0x22, ZC3XX_R131_GAMMA11}, + {0xa0, 0x20, ZC3XX_R132_GAMMA12}, + {0xa0, 0x1c, ZC3XX_R133_GAMMA13}, + {0xa0, 0x16, ZC3XX_R134_GAMMA14}, + {0xa0, 0x13, ZC3XX_R135_GAMMA15}, + {0xa0, 0x10, ZC3XX_R136_GAMMA16}, + {0xa0, 0x0d, ZC3XX_R137_GAMMA17}, + {0xa0, 0x0b, ZC3XX_R138_GAMMA18}, + {0xa0, 0x09, ZC3XX_R139_GAMMA19}, + {0xa0, 0x07, ZC3XX_R13A_GAMMA1A}, + {0xa0, 0x06, ZC3XX_R13B_GAMMA1B}, + {0xa0, 0x05, ZC3XX_R13C_GAMMA1C}, + {0xa0, 0x04, ZC3XX_R13D_GAMMA1D}, + {0xa0, 0x03, ZC3XX_R13E_GAMMA1E}, + {0xa0, 0x02, ZC3XX_R13F_GAMMA1F}, + + {0xa0, 0x66, ZC3XX_R10A_RGB00}, /* matrix */ + {0xa0, 0xed, ZC3XX_R10B_RGB01}, + {0xa0, 0xed, ZC3XX_R10C_RGB02}, + {0xa0, 0xed, ZC3XX_R10D_RGB10}, + {0xa0, 0x66, ZC3XX_R10E_RGB11}, + {0xa0, 0xed, ZC3XX_R10F_RGB12}, + {0xa0, 0xed, ZC3XX_R110_RGB20}, + {0xa0, 0xed, ZC3XX_R111_RGB21}, + {0xa0, 0x66, ZC3XX_R112_RGB22}, {0xa1, 0x01, 0x0180}, - {0xa0, 0x00, 0x0180}, - {0xa0, 0x00, 0x0019}, + {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, {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}, + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, + {0xa0, 0x02, ZC3XX_R191_EXPOSURELIMITMID}, + {0xa0, 0x62, ZC3XX_R192_EXPOSURELIMITLOW}, + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, + {0xa0, 0x3d, ZC3XX_R197_ANTIFLICKERLOW}, + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, + + {0xa0, 0x0c, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 0x14 */ + {0xa0, 0x28, ZC3XX_R1AA_DIGITALGAINSTEP}, + {0xa0, 0x04, ZC3XX_R01D_HSYNC_0}, + {0xa0, 0x18, ZC3XX_R01E_HSYNC_1}, + {0xa0, 0x2c, ZC3XX_R01F_HSYNC_2}, + {0xa0, 0x41, ZC3XX_R020_HSYNC_3}, + {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN}, + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, {0xa1, 0x01, 0x0180}, - {0xa0, 0x42, 0x0180}, - {0xa0, 0x40, 0x0116}, - {0xa0, 0x40, 0x0117}, - {0xa0, 0x40, 0x0118}, + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x40, ZC3XX_R116_RGAIN}, + {0xa0, 0x40, ZC3XX_R117_GGAIN}, + {0xa0, 0x40, ZC3XX_R118_BGAIN}, {} }; static const 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}, + {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, + {0xa0, 0x00, ZC3XX_R002_CLOCKSELECT}, + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, + {0xa0, 0x08, ZC3XX_R010_CMOSSENSORSELECT}, + {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, + {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, + {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, + {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW}, + {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, + {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, + {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW}, + {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, + {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW}, + {0xa0, 0xe8, ZC3XX_R09C_WINHEIGHTLOW}, + {0xa0, 0x88, ZC3XX_R09E_WINWIDTHLOW}, {0xaa, 0x1c, 0x0000}, {0xaa, 0x0a, 0x0001}, {0xaa, 0x0b, 0x0006}, @@ -2103,182 +2108,182 @@ static const struct usb_action hdcs2020xb_InitialScale[] = { {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}, + {0xa0, 0xf7, ZC3XX_R101_SENSORCORRECTION}, + {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x70, ZC3XX_R18D_YTARGET}, + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, + {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, + {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, + {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, + {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, {0xa1, 0x01, 0x0002}, {0xa1, 0x01, 0x0008}, {0xa1, 0x01, 0x0180}, - {0xa0, 0x02, 0x0180}, - {0xa0, 0x40, 0x0116}, - {0xa0, 0x40, 0x0117}, - {0xa0, 0x40, 0x0118}, + {0xa0, 0x02, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x40, ZC3XX_R116_RGAIN}, + {0xa0, 0x40, ZC3XX_R117_GGAIN}, + {0xa0, 0x40, ZC3XX_R118_BGAIN}, {0xa1, 0x01, 0x0008}, - {0xa0, 0x03, 0x0008}, /* clock ? */ - {0xa0, 0x08, 0x01c6}, /* sharpness+ */ + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* clock ? */ + {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */ {0xa1, 0x01, 0x01c8}, {0xa1, 0x01, 0x01c9}, {0xa1, 0x01, 0x01ca}, - {0xa0, 0x0f, 0x01cb}, /* sharpness- */ - {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}, + {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */ + {0xa0, 0x13, ZC3XX_R120_GAMMA00}, /* gamma 4 */ + {0xa0, 0x38, ZC3XX_R121_GAMMA01}, + {0xa0, 0x59, ZC3XX_R122_GAMMA02}, + {0xa0, 0x79, ZC3XX_R123_GAMMA03}, + {0xa0, 0x92, ZC3XX_R124_GAMMA04}, + {0xa0, 0xa7, ZC3XX_R125_GAMMA05}, + {0xa0, 0xb9, ZC3XX_R126_GAMMA06}, + {0xa0, 0xc8, ZC3XX_R127_GAMMA07}, + {0xa0, 0xd4, ZC3XX_R128_GAMMA08}, + {0xa0, 0xdf, ZC3XX_R129_GAMMA09}, + {0xa0, 0xe7, ZC3XX_R12A_GAMMA0A}, + {0xa0, 0xee, ZC3XX_R12B_GAMMA0B}, + {0xa0, 0xf4, ZC3XX_R12C_GAMMA0C}, + {0xa0, 0xf9, ZC3XX_R12D_GAMMA0D}, + {0xa0, 0xfc, ZC3XX_R12E_GAMMA0E}, + {0xa0, 0xff, ZC3XX_R12F_GAMMA0F}, + {0xa0, 0x26, ZC3XX_R130_GAMMA10}, + {0xa0, 0x22, ZC3XX_R131_GAMMA11}, + {0xa0, 0x20, ZC3XX_R132_GAMMA12}, + {0xa0, 0x1c, ZC3XX_R133_GAMMA13}, + {0xa0, 0x16, ZC3XX_R134_GAMMA14}, + {0xa0, 0x13, ZC3XX_R135_GAMMA15}, + {0xa0, 0x10, ZC3XX_R136_GAMMA16}, + {0xa0, 0x0d, ZC3XX_R137_GAMMA17}, + {0xa0, 0x0b, ZC3XX_R138_GAMMA18}, + {0xa0, 0x09, ZC3XX_R139_GAMMA19}, + {0xa0, 0x07, ZC3XX_R13A_GAMMA1A}, + {0xa0, 0x06, ZC3XX_R13B_GAMMA1B}, + {0xa0, 0x05, ZC3XX_R13C_GAMMA1C}, + {0xa0, 0x04, ZC3XX_R13D_GAMMA1D}, + {0xa0, 0x03, ZC3XX_R13E_GAMMA1E}, + {0xa0, 0x02, ZC3XX_R13F_GAMMA1F}, + {0xa0, 0x66, ZC3XX_R10A_RGB00}, /* matrix */ + {0xa0, 0xed, ZC3XX_R10B_RGB01}, + {0xa0, 0xed, ZC3XX_R10C_RGB02}, + {0xa0, 0xed, ZC3XX_R10D_RGB10}, + {0xa0, 0x66, ZC3XX_R10E_RGB11}, + {0xa0, 0xed, ZC3XX_R10F_RGB12}, + {0xa0, 0xed, ZC3XX_R110_RGB20}, + {0xa0, 0xed, ZC3XX_R111_RGB21}, + {0xa0, 0x66, ZC3XX_R112_RGB22}, {0xa1, 0x01, 0x0180}, - {0xa0, 0x00, 0x0180}, - {0xa0, 0x00, 0x0019}, + {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /**** 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}, + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, + {0xa0, 0x02, ZC3XX_R191_EXPOSURELIMITMID}, + {0xa0, 0x62, ZC3XX_R192_EXPOSURELIMITLOW}, + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, + {0xa0, 0x3d, ZC3XX_R197_ANTIFLICKERLOW}, + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, + {0xa0, 0x0c, ZC3XX_R1A9_DIGITALLIMITDIFF}, + {0xa0, 0x28, ZC3XX_R1AA_DIGITALGAINSTEP}, + {0xa0, 0x04, ZC3XX_R01D_HSYNC_0}, + {0xa0, 0x18, ZC3XX_R01E_HSYNC_1}, + {0xa0, 0x2c, ZC3XX_R01F_HSYNC_2}, + {0xa0, 0x41, ZC3XX_R020_HSYNC_3}, + {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN}, + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, {0xa1, 0x01, 0x0180}, - {0xa0, 0x42, 0x0180}, - {0xa0, 0x40, 0x0116}, - {0xa0, 0x40, 0x0117}, - {0xa0, 0x40, 0x0118}, + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x40, ZC3XX_R116_RGAIN}, + {0xa0, 0x40, ZC3XX_R117_GGAIN}, + {0xa0, 0x40, ZC3XX_R118_BGAIN}, {} }; static const struct usb_action hdcs2020b_50HZ[] = { - {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 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 */ + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */ + {0xa0, 0x02, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,02,cc */ + {0xa0, 0x76, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,76,cc */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */ + {0xa0, 0x46, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,46,cc */ + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */ + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,20,cc */ + {0xa0, 0x0c, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,0c,cc */ + {0xa0, 0x28, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,28,cc */ + {0xa0, 0x05, ZC3XX_R01D_HSYNC_0}, /* 00,1d,05,cc */ + {0xa0, 0x1a, ZC3XX_R01E_HSYNC_1}, /* 00,1e,1a,cc */ + {0xa0, 0x2f, ZC3XX_R01F_HSYNC_2}, /* 00,1f,2f,cc */ {} }; static const struct usb_action hdcs2020b_60HZ[] = { - {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 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 */ + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */ + {0xa0, 0x02, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,02,cc */ + {0xa0, 0x62, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,62,cc */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */ + {0xa0, 0x3d, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,3d,cc */ + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */ + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,20,cc */ + {0xa0, 0x0c, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,0c,cc */ + {0xa0, 0x28, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,28,cc */ + {0xa0, 0x04, ZC3XX_R01D_HSYNC_0}, /* 00,1d,04,cc */ + {0xa0, 0x18, ZC3XX_R01E_HSYNC_1}, /* 00,1e,18,cc */ + {0xa0, 0x2c, ZC3XX_R01F_HSYNC_2}, /* 00,1f,2c,cc */ {} }; static const struct usb_action hdcs2020b_NoFliker[] = { - {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 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 */ + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */ + {0xa0, 0x02, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,02,cc */ + {0xa0, 0x70, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,70,cc */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */ + {0xa0, 0x10, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,10,cc */ + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */ + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,20,cc */ + {0xa0, 0x00, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,00,cc */ + {0xa0, 0x00, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,00,cc */ + {0xa0, 0x04, ZC3XX_R01D_HSYNC_0}, /* 00,1d,04,cc */ + {0xa0, 0x17, ZC3XX_R01E_HSYNC_1}, /* 00,1e,17,cc */ + {0xa0, 0x2a, ZC3XX_R01F_HSYNC_2}, /* 00,1f,2a,cc */ {} }; static const 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}, + {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, + {0xa0, 0x10, ZC3XX_R002_CLOCKSELECT}, + {0xa0, 0x00, ZC3XX_R010_CMOSSENSORSELECT}, + {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, + {0xa0, 0x77, ZC3XX_R101_SENSORCORRECTION}, + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* 00 */ + {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, + {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, + {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, + {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW}, + {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, + {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW}, + {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, + {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW}, {0xaa, 0x30, 0x002d}, {0xaa, 0x01, 0x0005}, {0xaa, 0x11, 0x0000}, @@ -2291,48 +2296,48 @@ static const struct usb_action hv7131bxx_Initial[] = { {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, ZC3XX_R019_AUTOADJUSTFPS}, + {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, + {0xa0, 0x68, ZC3XX_R18D_YTARGET}, + {0xa0, 0x60, ZC3XX_R1A8_DIGITALGAIN}, {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}, + {0xa0, 0x02, ZC3XX_R188_MINGAIN}, + {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, + {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, + {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, + {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, {0xaa, 0x02, 0x0080}, /* {0xaa, 0x02, 0x0090}; */ {0xa1, 0x01, 0x0002}, - {0xa0, 0x00, 0x0092}, - {0xa0, 0x02, 0x0090}, + {0xa0, 0x00, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x02, ZC3XX_R090_I2CCOMMAND}, {0xa1, 0x01, 0x0091}, {0xa1, 0x01, 0x0095}, {0xa1, 0x01, 0x0096}, {0xa1, 0x01, 0x0008}, - {0xa0, 0x03, 0x0008}, /* clock ? */ - {0xa0, 0x08, 0x01c6}, /* sharpness+ */ + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* clock ? */ + {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */ {0xa1, 0x01, 0x01c8}, {0xa1, 0x01, 0x01c9}, {0xa1, 0x01, 0x01ca}, - {0xa0, 0x0f, 0x01cb}, /* sharpness- */ - - {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}, + {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */ + + {0xa0, 0x50, ZC3XX_R10A_RGB00}, /* matrix */ + {0xa0, 0xf8, ZC3XX_R10B_RGB01}, + {0xa0, 0xf8, ZC3XX_R10C_RGB02}, + {0xa0, 0xf8, ZC3XX_R10D_RGB10}, + {0xa0, 0x50, ZC3XX_R10E_RGB11}, + {0xa0, 0xf8, ZC3XX_R10F_RGB12}, + {0xa0, 0xf8, ZC3XX_R110_RGB20}, + {0xa0, 0xf8, ZC3XX_R111_RGB21}, + {0xa0, 0x50, ZC3XX_R112_RGB22}, {0xa1, 0x01, 0x0180}, - {0xa0, 0x10, 0x0180}, - {0xa0, 0x00, 0x0019}, + {0xa0, 0x10, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, {0xaa, 0x25, 0x0007}, {0xaa, 0x26, 0x00a1}, {0xaa, 0x27, 0x0020}, @@ -2341,52 +2346,52 @@ static const struct usb_action hv7131bxx_Initial[] = { {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}, + {0xa0, 0x10, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 2F */ + {0xa0, 0x04, ZC3XX_R191_EXPOSURELIMITMID}, /* 4d */ + {0xa0, 0x60, ZC3XX_R192_EXPOSURELIMITLOW}, + {0xa0, 0x01, ZC3XX_R195_ANTIFLICKERHIGH}, + {0xa0, 0x86, ZC3XX_R196_ANTIFLICKERMID}, + {0xa0, 0xa0, ZC3XX_R197_ANTIFLICKERLOW}, + {0xa0, 0x07, ZC3XX_R18C_AEFREEZE}, + {0xa0, 0x0f, ZC3XX_R18F_AEUNFREEZE}, + {0xa0, 0x18, ZC3XX_R1A9_DIGITALLIMITDIFF}, + {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP}, + {0xa0, 0x00, ZC3XX_R01D_HSYNC_0}, + {0xa0, 0xa0, ZC3XX_R01E_HSYNC_1}, + {0xa0, 0x16, ZC3XX_R01F_HSYNC_2}, + {0xa0, 0x40, ZC3XX_R020_HSYNC_3}, + {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN}, {0xa1, 0x01, 0x001d}, {0xa1, 0x01, 0x001e}, {0xa1, 0x01, 0x001f}, {0xa1, 0x01, 0x0020}, - {0xa0, 0x40, 0x0180}, + {0xa0, 0x40, ZC3XX_R180_AUTOCORRECTENABLE}, {0xa1, 0x01, 0x0180}, - {0xa0, 0x42, 0x0180}, - {0xa0, 0x40, 0x0116}, - {0xa0, 0x40, 0x0117}, - {0xa0, 0x40, 0x0118}, -/* {0xa0, 0x02, 0x0008}, */ + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x40, ZC3XX_R116_RGAIN}, + {0xa0, 0x40, ZC3XX_R117_GGAIN}, + {0xa0, 0x40, ZC3XX_R118_BGAIN}, +/* {0xa0, 0x02, ZC3XX_R008_CLOCKSETTING}, */ {} }; static const 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}, + {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, + {0xa0, 0x00, ZC3XX_R002_CLOCKSELECT}, + {0xa0, 0x00, ZC3XX_R010_CMOSSENSORSELECT}, + {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, + {0xa0, 0x37, ZC3XX_R101_SENSORCORRECTION}, + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* 00 */ + {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, + {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, + {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, + {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW}, + {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, + {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW}, + {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, + {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW}, {0xaa, 0x30, 0x002d}, {0xaa, 0x01, 0x0005}, {0xaa, 0x11, 0x0001}, @@ -2399,47 +2404,47 @@ static const struct usb_action hv7131bxx_InitialScale[] = { {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, ZC3XX_R019_AUTOADJUSTFPS}, + {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, + {0xa0, 0x70, ZC3XX_R18D_YTARGET}, + {0xa0, 0x60, ZC3XX_R1A8_DIGITALGAIN}, {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}, + {0xa0, 0x02, ZC3XX_R188_MINGAIN}, + {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, + {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, + {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, + {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, {0xaa, 0x02, 0x0090}, /* {0xaa, 0x02, 0x0080}, */ {0xa1, 0x01, 0x0002}, - {0xa0, 0x00, 0x0092}, - {0xa0, 0x02, 0x0090}, + {0xa0, 0x00, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x02, ZC3XX_R090_I2CCOMMAND}, {0xa1, 0x01, 0x0091}, {0xa1, 0x01, 0x0095}, {0xa1, 0x01, 0x0096}, {0xa1, 0x01, 0x0008}, - {0xa0, 0x03, 0x0008}, /* clock ? */ - {0xa0, 0x08, 0x01c6}, /* sharpness+ */ + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* clock ? */ + {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */ {0xa1, 0x01, 0x01c8}, {0xa1, 0x01, 0x01c9}, {0xa1, 0x01, 0x01ca}, - {0xa0, 0x0f, 0x01cb}, /* sharpness- */ - - {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}, + {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */ + + {0xa0, 0x50, ZC3XX_R10A_RGB00}, /* matrix */ + {0xa0, 0xf8, ZC3XX_R10B_RGB01}, + {0xa0, 0xf8, ZC3XX_R10C_RGB02}, + {0xa0, 0xf8, ZC3XX_R10D_RGB10}, + {0xa0, 0x50, ZC3XX_R10E_RGB11}, + {0xa0, 0xf8, ZC3XX_R10F_RGB12}, + {0xa0, 0xf8, ZC3XX_R110_RGB20}, + {0xa0, 0xf8, ZC3XX_R111_RGB21}, + {0xa0, 0x50, ZC3XX_R112_RGB22}, {0xa1, 0x01, 0x0180}, - {0xa0, 0x10, 0x0180}, - {0xa0, 0x00, 0x0019}, + {0xa0, 0x10, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, {0xaa, 0x25, 0x0007}, {0xaa, 0x26, 0x00a1}, {0xaa, 0x27, 0x0020}, @@ -2447,57 +2452,57 @@ static const struct usb_action hv7131bxx_InitialScale[] = { {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}, + {0xa0, 0x10, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 2f */ + {0xa0, 0x04, ZC3XX_R191_EXPOSURELIMITMID}, /* 4d */ + {0xa0, 0x60, ZC3XX_R192_EXPOSURELIMITLOW}, /* 60 */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, + {0xa0, 0xc3, ZC3XX_R196_ANTIFLICKERMID}, + {0xa0, 0x50, ZC3XX_R197_ANTIFLICKERLOW}, + {0xa0, 0x0c, ZC3XX_R18C_AEFREEZE}, + {0xa0, 0x18, ZC3XX_R18F_AEUNFREEZE}, + {0xa0, 0x18, ZC3XX_R1A9_DIGITALLIMITDIFF}, + {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP}, + {0xa0, 0x00, ZC3XX_R01D_HSYNC_0}, + {0xa0, 0x40, ZC3XX_R01E_HSYNC_1}, + {0xa0, 0x13, ZC3XX_R01F_HSYNC_2}, + {0xa0, 0x4c, ZC3XX_R020_HSYNC_3}, + {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN}, {0xa1, 0x01, 0x001d}, {0xa1, 0x01, 0x001e}, {0xa1, 0x01, 0x001f}, {0xa1, 0x01, 0x0020}, - {0xa0, 0x40, 0x0180}, + {0xa0, 0x40, ZC3XX_R180_AUTOCORRECTENABLE}, {0xa1, 0x01, 0x0180}, - {0xa0, 0x42, 0x0180}, - {0xa0, 0x40, 0x0116}, - {0xa0, 0x40, 0x0117}, - {0xa0, 0x40, 0x0118}, -/* {0xa0, 0x02, 0x0008}, */ + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x40, ZC3XX_R116_RGAIN}, + {0xa0, 0x40, ZC3XX_R117_GGAIN}, + {0xa0, 0x40, ZC3XX_R118_BGAIN}, +/* {0xa0, 0x02, ZC3XX_R008_CLOCKSETTING}, */ {} }; static const 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}, + {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, + {0xa0, 0x10, ZC3XX_R002_CLOCKSELECT}, + {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT}, + {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, + {0xa0, 0x77, ZC3XX_R101_SENSORCORRECTION}, + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, + {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x07, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, + {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, + {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, + {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW}, + {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, + {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW}, + {0xa0, 0x01, ZC3XX_R09B_WINHEIGHTHIGH}, + {0xa0, 0xe8, ZC3XX_R09C_WINHEIGHTLOW}, + {0xa0, 0x02, ZC3XX_R09D_WINWIDTHHIGH}, + {0xa0, 0x88, ZC3XX_R09E_WINWIDTHLOW}, + {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, + {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW}, + {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, {0xaa, 0x01, 0x000c}, {0xaa, 0x11, 0x0000}, {0xaa, 0x13, 0x0000}, @@ -2506,96 +2511,96 @@ static const struct usb_action hv7131cxx_Initial[] = { {0xaa, 0x16, 0x0002}, {0xaa, 0x17, 0x0088}, - {0xa0, 0x00, 0x0019}, - {0xa0, 0x0d, 0x0100}, - {0xa0, 0x89, 0x018d}, - {0xa0, 0x50, 0x01a8}, + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, + {0xa0, 0x89, ZC3XX_R18D_YTARGET}, + {0xa0, 0x50, ZC3XX_R1A8_DIGITALGAIN}, {0xa0, 0x00, 0x01ad}, {0xa0, 0xc0, 0x019b}, {0xa0, 0xa0, 0x019c}, - {0xa0, 0x06, 0x0189}, - {0xa0, 0x03, 0x01c5}, - {0xa0, 0x13, 0x01cb}, - {0xa0, 0x08, 0x0250}, - {0xa0, 0x08, 0x0301}, + {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, + {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, + {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, + {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, {0xa1, 0x01, 0x0002}, - {0xa0, 0x00, 0x0092}, - {0xa0, 0x02, 0x0090}, + {0xa0, 0x00, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x02, ZC3XX_R090_I2CCOMMAND}, {0xa1, 0x01, 0x0091}, {0xa1, 0x01, 0x0095}, {0xa1, 0x01, 0x0096}, {0xa1, 0x01, 0x0008}, - {0xa0, 0x03, 0x0008}, /* clock ? */ - {0xa0, 0x08, 0x01c6}, /* sharpness+ */ + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* clock ? */ + {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */ {0xa1, 0x01, 0x01c8}, {0xa1, 0x01, 0x01c9}, {0xa1, 0x01, 0x01ca}, - {0xa0, 0x0f, 0x01cb}, /* sharpness- */ - - {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}, + {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */ + + {0xa0, 0x60, ZC3XX_R10A_RGB00}, /* matrix */ + {0xa0, 0xf0, ZC3XX_R10B_RGB01}, + {0xa0, 0xf0, ZC3XX_R10C_RGB02}, + {0xa0, 0xf0, ZC3XX_R10D_RGB10}, + {0xa0, 0x60, ZC3XX_R10E_RGB11}, + {0xa0, 0xf0, ZC3XX_R10F_RGB12}, + {0xa0, 0xf0, ZC3XX_R110_RGB20}, + {0xa0, 0xf0, ZC3XX_R111_RGB21}, + {0xa0, 0x60, ZC3XX_R112_RGB22}, {0xa1, 0x01, 0x0180}, - {0xa0, 0x10, 0x0180}, - {0xa0, 0x00, 0x0019}, + {0xa0, 0x10, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, {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}, + {0xa0, 0x10, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 2f */ + {0xa0, 0x04, ZC3XX_R191_EXPOSURELIMITMID}, /* 9b */ + {0xa0, 0x60, ZC3XX_R192_EXPOSURELIMITLOW}, /* 80 */ + {0xa0, 0x01, ZC3XX_R195_ANTIFLICKERHIGH}, + {0xa0, 0xd4, ZC3XX_R196_ANTIFLICKERMID}, + {0xa0, 0xc0, ZC3XX_R197_ANTIFLICKERLOW}, + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, + {0xa0, 0x60, ZC3XX_R1A8_DIGITALGAIN}, + {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF}, + {0xa0, 0x13, ZC3XX_R1AA_DIGITALGAINSTEP}, {0xa1, 0x01, 0x001d}, {0xa1, 0x01, 0x001e}, {0xa1, 0x01, 0x001f}, {0xa1, 0x01, 0x0020}, - {0xa0, 0x40, 0x0180}, + {0xa0, 0x40, ZC3XX_R180_AUTOCORRECTENABLE}, {0xa1, 0x01, 0x0180}, - {0xa0, 0x42, 0x0180}, + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, {} }; static const 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}, + {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, + + {0xa0, 0x00, ZC3XX_R002_CLOCKSELECT}, /* diff */ + {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT}, + {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, + {0xa0, 0x77, ZC3XX_R101_SENSORCORRECTION}, + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, + + {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x07, ZC3XX_R012_VIDEOCONTROLFUNC}, + + {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, + {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, + {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, + {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW}, /* 1e0 */ + + {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, + {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW}, + {0xa0, 0x01, ZC3XX_R09B_WINHEIGHTHIGH}, + {0xa0, 0xe8, ZC3XX_R09C_WINHEIGHTLOW}, + {0xa0, 0x02, ZC3XX_R09D_WINWIDTHHIGH}, + {0xa0, 0x88, ZC3XX_R09E_WINWIDTHLOW}, + {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, + {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW}, + {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, {0xaa, 0x01, 0x000c}, {0xaa, 0x11, 0x0000}, {0xaa, 0x13, 0x0000}, @@ -2604,101 +2609,102 @@ static const struct usb_action hv7131cxx_InitialScale[] = { {0xaa, 0x16, 0x0002}, {0xaa, 0x17, 0x0088}, - {0xa0, 0x00, 0x0019}, /* 00 */ + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00 */ - {0xa0, 0x0d, 0x0100}, - {0xa0, 0x89, 0x018d}, - {0xa0, 0x50, 0x01a8}, + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, + {0xa0, 0x89, ZC3XX_R18D_YTARGET}, + {0xa0, 0x50, ZC3XX_R1A8_DIGITALGAIN}, {0xa0, 0x00, 0x01ad}, {0xa0, 0xc0, 0x019b}, {0xa0, 0xa0, 0x019c}, - {0xa0, 0x06, 0x0189}, - {0xa0, 0x03, 0x01c5}, - {0xa0, 0x13, 0x01cb}, - {0xa0, 0x08, 0x0250}, - {0xa0, 0x08, 0x0301}, + {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, + {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, + {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, + {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, {0xa1, 0x01, 0x0002}, - {0xa0, 0x00, 0x0092}, /* read the i2c chips ident */ - {0xa0, 0x02, 0x0090}, + {0xa0, 0x00, ZC3XX_R092_I2CADDRESSSELECT}, + /* read the i2c chips ident */ + {0xa0, 0x02, ZC3XX_R090_I2CCOMMAND}, {0xa1, 0x01, 0x0091}, {0xa1, 0x01, 0x0095}, {0xa1, 0x01, 0x0096}, {0xa1, 0x01, 0x0008}, - {0xa0, 0x03, 0x0008}, /* clock ? */ - {0xa0, 0x08, 0x01c6}, /* sharpness+ */ + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* clock ? */ + {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */ {0xa1, 0x01, 0x01c8}, {0xa1, 0x01, 0x01c9}, {0xa1, 0x01, 0x01ca}, - {0xa0, 0x0f, 0x01cb}, /* sharpness- */ - - {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}, + {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */ + + {0xa0, 0x60, ZC3XX_R10A_RGB00}, /* matrix */ + {0xa0, 0xf0, ZC3XX_R10B_RGB01}, + {0xa0, 0xf0, ZC3XX_R10C_RGB02}, + {0xa0, 0xf0, ZC3XX_R10D_RGB10}, + {0xa0, 0x60, ZC3XX_R10E_RGB11}, + {0xa0, 0xf0, ZC3XX_R10F_RGB12}, + {0xa0, 0xf0, ZC3XX_R110_RGB20}, + {0xa0, 0xf0, ZC3XX_R111_RGB21}, + {0xa0, 0x60, ZC3XX_R112_RGB22}, {0xa1, 0x01, 0x0180}, - {0xa0, 0x10, 0x0180}, - {0xa0, 0x00, 0x0019}, + {0xa0, 0x10, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, {0xaa, 0x25, 0x0007}, {0xaa, 0x26, 0x0053}, {0xaa, 0x27, 0x0000}, - {0xa0, 0x10, 0x0190}, /* 2f */ - {0xa0, 0x04, 0x0191}, /* 9b */ - {0xa0, 0x60, 0x0192}, /* 80 */ + {0xa0, 0x10, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 2f */ + {0xa0, 0x04, ZC3XX_R191_EXPOSURELIMITMID}, /* 9b */ + {0xa0, 0x60, ZC3XX_R192_EXPOSURELIMITLOW}, /* 80 */ - {0xa0, 0x01, 0x0195}, - {0xa0, 0xd4, 0x0196}, - {0xa0, 0xc0, 0x0197}, + {0xa0, 0x01, ZC3XX_R195_ANTIFLICKERHIGH}, + {0xa0, 0xd4, ZC3XX_R196_ANTIFLICKERMID}, + {0xa0, 0xc0, ZC3XX_R197_ANTIFLICKERLOW}, - {0xa0, 0x10, 0x018c}, - {0xa0, 0x20, 0x018f}, - {0xa0, 0x60, 0x01a8}, - {0xa0, 0x10, 0x01a9}, - {0xa0, 0x13, 0x01aa}, + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, + {0xa0, 0x60, ZC3XX_R1A8_DIGITALGAIN}, + {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF}, + {0xa0, 0x13, ZC3XX_R1AA_DIGITALGAINSTEP}, {0xa1, 0x01, 0x001d}, {0xa1, 0x01, 0x001e}, {0xa1, 0x01, 0x001f}, {0xa1, 0x01, 0x0020}, - {0xa0, 0x40, 0x0180}, + {0xa0, 0x40, ZC3XX_R180_AUTOCORRECTENABLE}, {0xa1, 0x01, 0x0180}, - {0xa0, 0x42, 0x0180}, + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, {} }; static const 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}, + {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, + {0xa0, 0x10, ZC3XX_R002_CLOCKSELECT}, + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, + {0xa0, 0x0c, ZC3XX_R010_CMOSSENSORSELECT}, + {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, + {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, + {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, + {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW}, + {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, + {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0xa1, ZC3XX_R08B_I2CDEVICEADDR}, + {0xa0, 0x00, ZC3XX_R097_WINYSTARTHIGH}, + {0xa0, 0x01, ZC3XX_R098_WINYSTARTLOW}, + {0xa0, 0x00, ZC3XX_R099_WINXSTARTHIGH}, + {0xa0, 0x01, ZC3XX_R09A_WINXSTARTLOW}, + {0xa0, 0x01, ZC3XX_R11A_FIRSTYLOW}, + {0xa0, 0x01, ZC3XX_R11C_FIRSTXLOW}, + {0xa0, 0x01, ZC3XX_R09B_WINHEIGHTHIGH}, + {0xa0, 0xe8, ZC3XX_R09C_WINHEIGHTLOW}, + {0xa0, 0x02, ZC3XX_R09D_WINWIDTHHIGH}, + {0xa0, 0x88, ZC3XX_R09E_WINWIDTHLOW}, + {0xa0, 0x37, ZC3XX_R101_SENSORCORRECTION}, + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, + {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, + {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, + {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, {0xaa, 0x01, 0x0010}, {0xaa, 0x03, 0x0000}, {0xaa, 0x04, 0x0001}, @@ -2779,36 +2785,36 @@ static const struct usb_action icm105axx_Initial[] = { {0xaa, 0x24, 0x0080}, {0xaa, 0x26, 0x0080}, {0xaa, 0x00, 0x0084}, - {0xa0, 0x08, 0x0250}, - {0xa0, 0x08, 0x0301}, + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, + {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, {0xaa, 0xa8, 0x00c0}, {0xa1, 0x01, 0x0002}, {0xa1, 0x01, 0x0008}, {0xa1, 0x01, 0x0180}, - {0xa0, 0x02, 0x0180}, - {0xa0, 0x40, 0x0116}, - {0xa0, 0x40, 0x0117}, - {0xa0, 0x40, 0x0118}, + {0xa0, 0x02, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x40, ZC3XX_R116_RGAIN}, + {0xa0, 0x40, ZC3XX_R117_GGAIN}, + {0xa0, 0x40, ZC3XX_R118_BGAIN}, {0xa1, 0x01, 0x0008}, - {0xa0, 0x03, 0x0008}, /* clock ? */ - {0xa0, 0x08, 0x01c6}, /* sharpness+ */ + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* clock ? */ + {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */ {0xa1, 0x01, 0x01c8}, {0xa1, 0x01, 0x01c9}, {0xa1, 0x01, 0x01ca}, - {0xa0, 0x0f, 0x01cb}, /* sharpness- */ - {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}, + {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */ + {0xa0, 0x52, ZC3XX_R10A_RGB00}, /* matrix */ + {0xa0, 0xf7, ZC3XX_R10B_RGB01}, + {0xa0, 0xf7, ZC3XX_R10C_RGB02}, + {0xa0, 0xf7, ZC3XX_R10D_RGB10}, + {0xa0, 0x52, ZC3XX_R10E_RGB11}, + {0xa0, 0xf7, ZC3XX_R10F_RGB12}, + {0xa0, 0xf7, ZC3XX_R110_RGB20}, + {0xa0, 0xf7, ZC3XX_R111_RGB21}, + {0xa0, 0x52, ZC3XX_R112_RGB22}, {0xa1, 0x01, 0x0180}, - {0xa0, 0x00, 0x0180}, - {0xa0, 0x00, 0x0019}, + {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, {0xaa, 0x0d, 0x0003}, {0xaa, 0x0c, 0x008c}, {0xaa, 0x0e, 0x0095}, @@ -2820,62 +2826,62 @@ static const struct usb_action icm105axx_Initial[] = { {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}, + {0xa0, 0x02, ZC3XX_R0A3_EXPOSURETIMEHIGH}, + {0xa0, 0x94, ZC3XX_R0A4_EXPOSURETIMELOW}, + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, + {0xa0, 0x04, ZC3XX_R191_EXPOSURELIMITMID}, + {0xa0, 0x20, ZC3XX_R192_EXPOSURELIMITLOW}, + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, + {0xa0, 0x84, ZC3XX_R197_ANTIFLICKERLOW}, + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, + {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF}, + {0xa0, 0x12, ZC3XX_R1AA_DIGITALGAINSTEP}, + {0xa0, 0xe3, ZC3XX_R01D_HSYNC_0}, + {0xa0, 0xec, ZC3XX_R01E_HSYNC_1}, + {0xa0, 0xf5, ZC3XX_R01F_HSYNC_2}, + {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, + {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN}, + {0xa0, 0xc0, ZC3XX_R1A8_DIGITALGAIN}, + {0xa0, 0xc0, ZC3XX_R11D_GLOBALGAIN}, + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, {0xa1, 0x01, 0x0180}, - {0xa0, 0x42, 0x0180}, - {0xa0, 0x40, 0x0116}, - {0xa0, 0x40, 0x0117}, - {0xa0, 0x40, 0x0118}, + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x40, ZC3XX_R116_RGAIN}, + {0xa0, 0x40, ZC3XX_R117_GGAIN}, + {0xa0, 0x40, ZC3XX_R118_BGAIN}, {} }; static const 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}, + {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, + {0xa0, 0x00, ZC3XX_R002_CLOCKSELECT}, + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, + {0xa0, 0x0c, ZC3XX_R010_CMOSSENSORSELECT}, + {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, + {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, + {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, + {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW}, + {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, + {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0xa1, ZC3XX_R08B_I2CDEVICEADDR}, + {0xa0, 0x00, ZC3XX_R097_WINYSTARTHIGH}, + {0xa0, 0x02, ZC3XX_R098_WINYSTARTLOW}, + {0xa0, 0x00, ZC3XX_R099_WINXSTARTHIGH}, + {0xa0, 0x02, ZC3XX_R09A_WINXSTARTLOW}, + {0xa0, 0x02, ZC3XX_R11A_FIRSTYLOW}, + {0xa0, 0x02, ZC3XX_R11C_FIRSTXLOW}, + {0xa0, 0x01, ZC3XX_R09B_WINHEIGHTHIGH}, + {0xa0, 0xe6, ZC3XX_R09C_WINHEIGHTLOW}, + {0xa0, 0x02, ZC3XX_R09D_WINWIDTHHIGH}, + {0xa0, 0x86, ZC3XX_R09E_WINWIDTHLOW}, + {0xa0, 0x77, ZC3XX_R101_SENSORCORRECTION}, + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, + {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, + {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, + {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, {0xaa, 0x01, 0x0010}, {0xaa, 0x03, 0x0000}, {0xaa, 0x04, 0x0001}, @@ -2903,9 +2909,9 @@ static const struct usb_action icm105axx_InitialScale[] = { {0xaa, 0x06, 0x000d}, {0xaa, 0x08, 0x0000}, {0xaa, 0x03, 0x0005}, - {0xa0, 0x04, 0x0092}, - {0xa0, 0x19, 0x0093}, - {0xa0, 0x01, 0x0090}, + {0xa0, 0x04, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x19, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, {0xa1, 0x01, 0x0091}, {0xaa, 0x05, 0x0020}, {0xaa, 0x06, 0x0005}, @@ -2959,38 +2965,38 @@ static const struct usb_action icm105axx_InitialScale[] = { {0xaa, 0x24, 0x0080}, {0xaa, 0x26, 0x0080}, {0xaa, 0x00, 0x0084}, - {0xa0, 0x08, 0x0250}, - {0xa0, 0x08, 0x0301}, + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, + {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, {0xaa, 0xa8, 0x0080}, - {0xa0, 0x78, 0x018d}, + {0xa0, 0x78, ZC3XX_R18D_YTARGET}, {0xa1, 0x01, 0x0002}, {0xa1, 0x01, 0x0008}, {0xa1, 0x01, 0x0180}, - {0xa0, 0x02, 0x0180}, - {0xa0, 0x40, 0x0116}, - {0xa0, 0x40, 0x0117}, - {0xa0, 0x40, 0x0118}, + {0xa0, 0x02, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x40, ZC3XX_R116_RGAIN}, + {0xa0, 0x40, ZC3XX_R117_GGAIN}, + {0xa0, 0x40, ZC3XX_R118_BGAIN}, {0xa1, 0x01, 0x0008}, - {0xa0, 0x03, 0x0008}, /* clock ? */ - {0xa0, 0x08, 0x01c6}, /* sharpness+ */ + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* clock ? */ + {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */ {0xa1, 0x01, 0x01c8}, {0xa1, 0x01, 0x01c9}, {0xa1, 0x01, 0x01ca}, - {0xa0, 0x0f, 0x01cb}, /* sharpness- */ - - {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}, + {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */ + + {0xa0, 0x52, ZC3XX_R10A_RGB00}, /* matrix */ + {0xa0, 0xf7, ZC3XX_R10B_RGB01}, + {0xa0, 0xf7, ZC3XX_R10C_RGB02}, + {0xa0, 0xf7, ZC3XX_R10D_RGB10}, + {0xa0, 0x52, ZC3XX_R10E_RGB11}, + {0xa0, 0xf7, ZC3XX_R10F_RGB12}, + {0xa0, 0xf7, ZC3XX_R110_RGB20}, + {0xa0, 0xf7, ZC3XX_R111_RGB21}, + {0xa0, 0x52, ZC3XX_R112_RGB22}, {0xa1, 0x01, 0x0180}, - {0xa0, 0x00, 0x0180}, - {0xa0, 0x00, 0x0019}, + {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, {0xaa, 0x0d, 0x0003}, {0xaa, 0x0c, 0x0020}, {0xaa, 0x0e, 0x000e}, @@ -3002,33 +3008,33 @@ static const struct usb_action icm105axx_InitialScale[] = { {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}, + {0xa0, 0x02, ZC3XX_R0A3_EXPOSURETIMEHIGH}, + {0xa0, 0x0d, ZC3XX_R0A4_EXPOSURETIMELOW}, + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, + {0xa0, 0x04, ZC3XX_R191_EXPOSURELIMITMID}, + {0xa0, 0x1a, ZC3XX_R192_EXPOSURELIMITLOW}, + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, + {0xa0, 0x4b, ZC3XX_R197_ANTIFLICKERLOW}, + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, + {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF}, + {0xa0, 0x12, ZC3XX_R1AA_DIGITALGAINSTEP}, + {0xa0, 0xc8, ZC3XX_R01D_HSYNC_0}, + {0xa0, 0xd8, ZC3XX_R01E_HSYNC_1}, + {0xa0, 0xea, ZC3XX_R01F_HSYNC_2}, + {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, + {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN}, + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, {0xa1, 0x01, 0x0180}, - {0xa0, 0x42, 0x0180}, - {0xa0, 0x40, 0x0116}, - {0xa0, 0x40, 0x0117}, - {0xa0, 0x40, 0x0118}, + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x40, ZC3XX_R116_RGAIN}, + {0xa0, 0x40, ZC3XX_R117_GGAIN}, + {0xa0, 0x40, ZC3XX_R118_BGAIN}, {} }; static const struct usb_action icm105a_50HZ[] = { - {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 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 */ @@ -3040,26 +3046,26 @@ static const struct usb_action icm105a_50HZ[] = { {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 */ + {0xa0, 0x02, ZC3XX_R0A3_EXPOSURETIMEHIGH}, /* 00,a3,02,cc */ + {0xa0, 0x0d, ZC3XX_R0A4_EXPOSURETIMELOW}, /* 00,a4,0d,cc */ + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */ + {0xa0, 0x04, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,04,cc */ + {0xa0, 0x1a, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,1a,cc */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */ + {0xa0, 0x4b, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,4b,cc */ + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */ + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,20,cc */ + {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,10,cc */ + {0xa0, 0x12, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,12,cc */ + {0xa0, 0xc8, ZC3XX_R01D_HSYNC_0}, /* 00,1d,c8,cc */ + {0xa0, 0xd8, ZC3XX_R01E_HSYNC_1}, /* 00,1e,d8,cc */ + {0xa0, 0xea, ZC3XX_R01F_HSYNC_2}, /* 00,1f,ea,cc */ + {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc */ {} }; static const struct usb_action icm105a_50HZScale[] = { - {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 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 */ @@ -3071,28 +3077,28 @@ static const struct usb_action icm105a_50HZScale[] = { {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 */ + {0xa0, 0x02, ZC3XX_R0A3_EXPOSURETIMEHIGH}, /* 00,a3,02,cc */ + {0xa0, 0x94, ZC3XX_R0A4_EXPOSURETIMELOW}, /* 00,a4,94,cc */ + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */ + {0xa0, 0x04, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,04,cc */ + {0xa0, 0x20, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,20,cc */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */ + {0xa0, 0x84, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,84,cc */ + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */ + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,20,cc */ + {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,10,cc */ + {0xa0, 0x12, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,12,cc */ + {0xa0, 0xe3, ZC3XX_R01D_HSYNC_0}, /* 00,1d,e3,cc */ + {0xa0, 0xec, ZC3XX_R01E_HSYNC_1}, /* 00,1e,ec,cc */ + {0xa0, 0xf5, ZC3XX_R01F_HSYNC_2}, /* 00,1f,f5,cc */ + {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc */ + {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN}, /* 01,a7,00,cc */ + {0xa0, 0xc0, ZC3XX_R1A8_DIGITALGAIN}, /* 01,a8,c0,cc */ {} }; static const struct usb_action icm105a_60HZ[] = { - {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 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 */ @@ -3104,26 +3110,26 @@ static const struct usb_action icm105a_60HZ[] = { {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 */ + {0xa0, 0x02, ZC3XX_R0A3_EXPOSURETIMEHIGH}, /* 00,a3,02,cc */ + {0xa0, 0x08, ZC3XX_R0A4_EXPOSURETIMELOW}, /* 00,a4,08,cc */ + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */ + {0xa0, 0x04, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,04,cc */ + {0xa0, 0x10, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,10,cc */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */ + {0xa0, 0x41, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,41,cc */ + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */ + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,20,cc */ + {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,10,cc */ + {0xa0, 0x12, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,12,cc */ + {0xa0, 0xc1, ZC3XX_R01D_HSYNC_0}, /* 00,1d,c1,cc */ + {0xa0, 0xd4, ZC3XX_R01E_HSYNC_1}, /* 00,1e,d4,cc */ + {0xa0, 0xe8, ZC3XX_R01F_HSYNC_2}, /* 00,1f,e8,cc */ + {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc */ {} }; static const struct usb_action icm105a_60HZScale[] = { - {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 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 */ @@ -3135,28 +3141,28 @@ static const struct usb_action icm105a_60HZScale[] = { {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 */ + {0xa0, 0x02, ZC3XX_R0A3_EXPOSURETIMEHIGH}, /* 00,a3,02,cc */ + {0xa0, 0x85, ZC3XX_R0A4_EXPOSURETIMELOW}, /* 00,a4,85,cc */ + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */ + {0xa0, 0x04, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,04,cc */ + {0xa0, 0x08, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,08,cc */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */ + {0xa0, 0x81, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,81,cc */ + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */ + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,20,cc */ + {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,10,cc */ + {0xa0, 0x12, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,12,cc */ + {0xa0, 0xc2, ZC3XX_R01D_HSYNC_0}, /* 00,1d,c2,cc */ + {0xa0, 0xd6, ZC3XX_R01E_HSYNC_1}, /* 00,1e,d6,cc */ + {0xa0, 0xea, ZC3XX_R01F_HSYNC_2}, /* 00,1f,ea,cc */ + {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc */ + {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN}, /* 01,a7,00,cc */ + {0xa0, 0xc0, ZC3XX_R1A8_DIGITALGAIN}, /* 01,a8,c0,cc */ {} }; static const struct usb_action icm105a_NoFliker[] = { - {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 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 */ @@ -3168,26 +3174,26 @@ static const struct usb_action icm105a_NoFliker[] = { {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 */ + {0xa0, 0x02, ZC3XX_R0A3_EXPOSURETIMEHIGH}, /* 00,a3,02,cc */ + {0xa0, 0x00, ZC3XX_R0A4_EXPOSURETIMELOW}, /* 00,a4,00,cc */ + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */ + {0xa0, 0x04, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,04,cc */ + {0xa0, 0x20, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,20,cc */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */ + {0xa0, 0x10, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,10,cc */ + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */ + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,20,cc */ + {0xa0, 0x00, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,00,cc */ + {0xa0, 0x00, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,00,cc */ + {0xa0, 0xc1, ZC3XX_R01D_HSYNC_0}, /* 00,1d,c1,cc */ + {0xa0, 0xd4, ZC3XX_R01E_HSYNC_1}, /* 00,1e,d4,cc */ + {0xa0, 0xe8, ZC3XX_R01F_HSYNC_2}, /* 00,1f,e8,cc */ + {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc */ {} }; static const struct usb_action icm105a_NoFlikerScale[] = { - {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 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 */ @@ -3199,52 +3205,52 @@ static const struct usb_action icm105a_NoFlikerScale[] = { {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 */ + {0xa0, 0x02, ZC3XX_R0A3_EXPOSURETIMEHIGH}, /* 00,a3,02,cc */ + {0xa0, 0x80, ZC3XX_R0A4_EXPOSURETIMELOW}, /* 00,a4,80,cc */ + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */ + {0xa0, 0x04, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,04,cc */ + {0xa0, 0x20, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,20,cc */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */ + {0xa0, 0x10, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,10,cc */ + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */ + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,20,cc */ + {0xa0, 0x00, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,00,cc */ + {0xa0, 0x00, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,00,cc */ + {0xa0, 0xc1, ZC3XX_R01D_HSYNC_0}, /* 00,1d,c1,cc */ + {0xa0, 0xd4, ZC3XX_R01E_HSYNC_1}, /* 00,1e,d4,cc */ + {0xa0, 0xe8, ZC3XX_R01F_HSYNC_2}, /* 00,1f,e8,cc */ + {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc */ + {0xa0, 0x00, ZC3XX_R1A7_CALCGLOBALMEAN}, /* 01,a7,00,cc */ + {0xa0, 0xc0, ZC3XX_R1A8_DIGITALGAIN}, /* 01,a8,c0,cc */ {} }; static const 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 */ + {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, /* 00,00,01,cc */ + {0xa0, 0x00, ZC3XX_R002_CLOCKSELECT}, /* 00,02,00,cc */ + {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,01,cc */ + {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, /* 00,01,01,cc */ + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* 00,08,03,cc */ + {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,01,cc */ + {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,05,cc */ + {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, /* 00,03,02,cc */ + {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, /* 00,04,80,cc */ + {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, /* 00,05,01,cc */ + {0xa0, 0xd8, ZC3XX_R006_FRAMEHEIGHTLOW}, /* 00,06,d8,cc */ + {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, /* 00,98,00,cc */ + {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW}, /* 00,9a,00,cc */ + {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, /* 01,1a,00,cc */ + {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW}, /* 01,1c,00,cc */ + {0xa0, 0x01, ZC3XX_R09B_WINHEIGHTHIGH}, /* 00,9b,01,cc */ + {0xa0, 0xde, ZC3XX_R09C_WINHEIGHTLOW}, /* 00,9c,de,cc */ + {0xa0, 0x02, ZC3XX_R09D_WINWIDTHHIGH}, /* 00,9d,02,cc */ + {0xa0, 0x86, ZC3XX_R09E_WINWIDTHLOW}, /* 00,9e,86,cc */ + {0xa0, 0x33, ZC3XX_R086_EXPTIMEHIGH}, /* 00,86,33,cc */ + {0xa0, 0x34, ZC3XX_R087_EXPTIMEMID}, /* 00,87,34,cc */ + {0xa0, 0x35, ZC3XX_R088_EXPTIMELOW}, /* 00,88,35,cc */ + {0xa0, 0xb0, ZC3XX_R08B_I2CDEVICEADDR}, /* 00,8b,b0,cc */ + {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 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 */ @@ -3280,7 +3286,7 @@ static const struct usb_action MC501CB_InitialScale[] = { {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, 0xa0, ZC3XX_R01A_LASTFRAMESTATE}, /* 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 */ @@ -3312,15 +3318,15 @@ static const struct usb_action MC501CB_InitialScale[] = { {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 */ + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */ + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, /* 01,00,0d,cc */ + {0xa0, 0x37, ZC3XX_R101_SENSORCORRECTION}, /* 01,01,37,cc */ + {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, /* 01,89,06,cc */ + {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, /* 01,c5,03,cc */ + {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, /* 01,cb,13,cc */ + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, /* 02,50,08,cc */ + {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, /* 03,01,08,cc */ + {0xa0, 0x02, ZC3XX_R180_AUTOCORRECTENABLE}, /* 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 */ @@ -3341,30 +3347,30 @@ static const struct usb_action MC501CB_InitialScale[] = { }; static const 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 */ + {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, /* 00,00,01,cc */ + {0xa0, 0x10, ZC3XX_R002_CLOCKSELECT}, /* 00,02,10,cc */ + {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,01,cc */ + {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, /* 00,01,01,cc */ + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* 00,08,03,cc */ + {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,01,cc */ + {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,05,cc */ + {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, /* 00,03,02,cc */ + {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, /* 00,04,80,cc */ + {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, /* 00,05,01,cc */ + {0xa0, 0xd0, ZC3XX_R006_FRAMEHEIGHTLOW}, /* 00,06,d0,cc */ + {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, /* 00,98,00,cc */ + {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW}, /* 00,9a,00,cc */ + {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, /* 01,1a,00,cc */ + {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW}, /* 01,1c,00,cc */ + {0xa0, 0x01, ZC3XX_R09B_WINHEIGHTHIGH}, /* 00,9b,01,cc */ + {0xa0, 0xd8, ZC3XX_R09C_WINHEIGHTLOW}, /* 00,9c,d8,cc */ + {0xa0, 0x02, ZC3XX_R09D_WINWIDTHHIGH}, /* 00,9d,02,cc */ + {0xa0, 0x88, ZC3XX_R09E_WINWIDTHLOW}, /* 00,9e,88,cc */ + {0xa0, 0x33, ZC3XX_R086_EXPTIMEHIGH}, /* 00,86,33,cc */ + {0xa0, 0x34, ZC3XX_R087_EXPTIMEMID}, /* 00,87,34,cc */ + {0xa0, 0x35, ZC3XX_R088_EXPTIMELOW}, /* 00,88,35,cc */ + {0xa0, 0xb0, ZC3XX_R08B_I2CDEVICEADDR}, /* 00,8b,b0,cc */ + {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 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 */ @@ -3400,7 +3406,7 @@ static const struct usb_action MC501CB_Initial[] = { /* 320x240 */ {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, 0xa0, ZC3XX_R01A_LASTFRAMESTATE}, /* 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 */ @@ -3432,15 +3438,15 @@ static const struct usb_action MC501CB_Initial[] = { /* 320x240 */ {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 */ + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */ + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, /* 01,00,0d,cc */ + {0xa0, 0x37, ZC3XX_R101_SENSORCORRECTION}, /* 01,01,37,cc */ + {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, /* 01,89,06,cc */ + {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, /* 01,c5,03,cc */ + {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, /* 01,cb,13,cc */ + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, /* 02,50,08,cc */ + {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, /* 03,01,08,cc */ + {0xa0, 0x02, ZC3XX_R180_AUTOCORRECTENABLE}, /* 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 */ @@ -3558,34 +3564,35 @@ static const struct usb_action MC501CB_NoFlikerScale[] = { /* from zs211.inf - HKR,%OV7620%,Initial - 640x480 */ static const struct usb_action OV7620_mode0[] = { - {0xa0, 0x01, 0x0000}, /* 00,00,01,cc */ - {0xa0, 0x40, 0x0002}, /* 00,02,40,cc */ + {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, /* 00,00,01,cc */ + {0xa0, 0x40, ZC3XX_R002_CLOCKSELECT}, /* 00,02,40,cc */ #if 1 /*jfm*/ - {0xa0, 0x00, 0x0008}, /* 00,08,00,cc */ + {0xa0, 0x00, ZC3XX_R008_CLOCKSETTING}, /* 00,08,00,cc */ #else - {0xa0, 0x03, 0x0008}, /* 00,08,00,cc */ /* mx change? */ + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* 00,08,00,cc */ + /* mx change? */ #endif - {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 */ + {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, /* 00,01,01,cc */ + {0xa0, 0x06, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,06,cc */ + {0xa0, 0x02, ZC3XX_R083_RGAINADDR}, /* 00,83,02,cc */ + {0xa0, 0x01, ZC3XX_R085_BGAINADDR}, /* 00,85,01,cc */ + {0xa0, 0x80, ZC3XX_R086_EXPTIMEHIGH}, /* 00,86,80,cc */ + {0xa0, 0x81, ZC3XX_R087_EXPTIMEMID}, /* 00,87,81,cc */ + {0xa0, 0x10, ZC3XX_R088_EXPTIMELOW}, /* 00,88,10,cc */ + {0xa0, 0xa1, ZC3XX_R08B_I2CDEVICEADDR}, /* 00,8b,a1,cc */ + {0xa0, 0x08, ZC3XX_R08D_COMPABILITYMODE}, /* 00,8d,08,cc */ + {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, /* 00,03,02,cc */ + {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, /* 00,04,80,cc */ + {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, /* 00,05,01,cc */ + {0xa0, 0xd8, ZC3XX_R006_FRAMEHEIGHTLOW}, /* 00,06,d8,cc */ + {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,03,cc */ + {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,01,cc */ + {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, /* 00,98,00,cc */ + {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW}, /* 00,9a,00,cc */ + {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, /* 01,1a,00,cc */ + {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW}, /* 01,1c,00,cc */ + {0xa0, 0xde, ZC3XX_R09C_WINHEIGHTLOW}, /* 00,9c,de,cc */ + {0xa0, 0x86, ZC3XX_R09E_WINWIDTHLOW}, /* 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 */ @@ -3614,49 +3621,51 @@ static const struct usb_action OV7620_mode0[] = { {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, 0x77, ZC3XX_R101_SENSORCORRECTION}, /* 01,01,77,cc */ + {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,05,cc */ + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, /* 01,00,0d,cc */ + {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, /* 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 */ + {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, /* 01,c5,03,cc */ + {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, /* 01,cb,13,cc */ + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, /* 02,50,08,cc */ + {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, /* 03,01,08,cc */ + {0xa0, 0x68, ZC3XX_R116_RGAIN}, /* 01,16,68,cc */ + {0xa0, 0x52, ZC3XX_R118_BGAIN}, /* 01,18,52,cc */ + {0xa0, 0x40, ZC3XX_R11D_GLOBALGAIN}, /* 01,1d,40,cc */ + {0xa0, 0x02, ZC3XX_R180_AUTOCORRECTENABLE}, /* 01,80,02,cc */ + {0xa0, 0x50, ZC3XX_R1A8_DIGITALGAIN}, /* 01,a8,50,cc */ {} }; /* from zs211.inf - HKR,%OV7620%,InitialScale - 320x240 */ static const 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 */ + {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, /* 00,00,01,cc */ + {0xa0, 0x50, ZC3XX_R002_CLOCKSELECT}, /* 00,02,50,cc */ + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* 00,08,00,cc */ + /* mx change? */ + {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, /* 00,01,01,cc */ + {0xa0, 0x06, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,06,cc */ + {0xa0, 0x02, ZC3XX_R083_RGAINADDR}, /* 00,83,02,cc */ + {0xa0, 0x01, ZC3XX_R085_BGAINADDR}, /* 00,85,01,cc */ + {0xa0, 0x80, ZC3XX_R086_EXPTIMEHIGH}, /* 00,86,80,cc */ + {0xa0, 0x81, ZC3XX_R087_EXPTIMEMID}, /* 00,87,81,cc */ + {0xa0, 0x10, ZC3XX_R088_EXPTIMELOW}, /* 00,88,10,cc */ + {0xa0, 0xa1, ZC3XX_R08B_I2CDEVICEADDR}, /* 00,8b,a1,cc */ + {0xa0, 0x08, ZC3XX_R08D_COMPABILITYMODE}, /* 00,8d,08,cc */ + {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, /* 00,03,02,cc */ + {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, /* 00,04,80,cc */ + {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, /* 00,05,01,cc */ + {0xa0, 0xd0, ZC3XX_R006_FRAMEHEIGHTLOW}, /* 00,06,d0,cc */ + {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,03,cc */ + {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,01,cc */ + {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, /* 00,98,00,cc */ + {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW}, /* 00,9a,00,cc */ + {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, /* 01,1a,00,cc */ + {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW}, /* 01,1c,00,cc */ + {0xa0, 0xd6, ZC3XX_R09C_WINHEIGHTLOW}, /* 00,9c,d6,cc */ + /* OV7648 00,9c,d8,cc */ + {0xa0, 0x88, ZC3XX_R09E_WINWIDTHLOW}, /* 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 */ @@ -3685,20 +3694,20 @@ static const struct usb_action OV7620_mode1[] = { {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 */ + {0xa0, 0x77, ZC3XX_R101_SENSORCORRECTION}, /* 01,01,77,cc */ + {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,05,cc */ + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, /* 01,00,0d,cc */ + {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, /* 01,89,06,cc */ + {0xa0, 0x00, 0x01ad}, /* 01,ad,00,cc */ + {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, /* 01,c5,03,cc */ + {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, /* 01,cb,13,cc */ + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, /* 02,50,08,cc */ + {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, /* 03,01,08,cc */ + {0xa0, 0x68, ZC3XX_R116_RGAIN}, /* 01,16,68,cc */ + {0xa0, 0x52, ZC3XX_R118_BGAIN}, /* 01,18,52,cc */ + {0xa0, 0x50, ZC3XX_R11D_GLOBALGAIN}, /* 01,1d,50,cc */ + {0xa0, 0x02, ZC3XX_R180_AUTOCORRECTENABLE}, /* 01,80,02,cc */ + {0xa0, 0x50, ZC3XX_R1A8_DIGITALGAIN}, /* 01,a8,50,cc */ {} }; @@ -3709,34 +3718,37 @@ static const struct usb_action OV7620_50HZ[] = { {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) */ + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */ + {0xa0, 0x04, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,04,cc */ + {0xa0, 0x18, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,18,cc */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */ + {0xa0, 0x83, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,83,cc */ + {0xaa, 0x10, 0x0082}, /* 00,10,82,aa */ + {0xaa, 0x76, 0x0003}, /* 00,76,03,aa */ +/* {0xa0, 0x40, ZC3XX_R002_CLOCKSELECT}, * 00,02,40,cc + if mode0 (640x480) */ {} }; /* from zs211.inf - HKR,%OV7620%\AE,60HZ */ static const 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) */ + {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, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */ + {0xa0, 0x04, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,04,cc */ + {0xa0, 0x18, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,18,cc */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */ + {0xa0, 0x83, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,83,cc */ + {0xaa, 0x10, 0x0020}, /* 00,10,20,aa */ + {0xaa, 0x76, 0x0003}, /* 00,76,03,aa */ +/* {0xa0, 0x40, ZC3XX_R002_CLOCKSELECT}, * 00,02,40,cc + * if mode0 (640x480) */ /* ?? in gspca v1, it was {0xa0, 0x00, 0x0039}, * 00,00,00,dd * {0xa1, 0x01, 0x0037}, */ @@ -3745,18 +3757,20 @@ static const struct usb_action OV7620_60HZ[] = { /* from zs211.inf - HKR,%OV7620%\AE,NoFliker */ static const 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) */ + {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, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */ + {0xa0, 0x04, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,04,cc */ + {0xa0, 0x18, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,18,cc */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */ + {0xa0, 0x01, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,01,cc */ +/* {0xa0, 0x44, ZC3XX_R002_CLOCKSELECT}, * 00,02,44,cc + - if mode1 (320x240) */ /* ?? was {0xa0, 0x00, 0x0039}, * 00,00,00,dd * {0xa1, 0x01, 0x0037}, */ @@ -3764,32 +3778,32 @@ static const struct usb_action OV7620_NoFliker[] = { }; static const 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}, + {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, + {0xa0, 0x10, ZC3XX_R002_CLOCKSELECT}, + {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, + {0xa0, 0x10, ZC3XX_R002_CLOCKSELECT}, + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, + {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, + {0xa0, 0x06, ZC3XX_R010_CMOSSENSORSELECT}, + {0xa0, 0xa1, ZC3XX_R08B_I2CDEVICEADDR}, + {0xa0, 0x08, ZC3XX_R08D_COMPABILITYMODE}, + {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, + {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, + {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, + {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW}, + {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, {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}, + {0xa0, 0x02, ZC3XX_R083_RGAINADDR}, + {0xa0, 0x01, ZC3XX_R085_BGAINADDR}, + {0xa0, 0x90, ZC3XX_R086_EXPTIMEHIGH}, + {0xa0, 0x91, ZC3XX_R087_EXPTIMEMID}, + {0xa0, 0x10, ZC3XX_R088_EXPTIMELOW}, + {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, + {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW}, + {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, + {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW}, + {0xa0, 0xd8, ZC3XX_R09C_WINHEIGHTLOW}, + {0xa0, 0x88, ZC3XX_R09E_WINWIDTHLOW}, {0xaa, 0x12, 0x0069}, {0xaa, 0x04, 0x0020}, {0xaa, 0x06, 0x0050}, @@ -3821,131 +3835,131 @@ static const struct usb_action ov7630c_Initial[] = { {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, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x77, ZC3XX_R101_SENSORCORRECTION}, + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, + {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, + {0xa0, 0x04, ZC3XX_R1A7_CALCGLOBALMEAN}, {0xa0, 0x00, 0x01ad}, - {0xa0, 0x03, 0x01c5}, - {0xa0, 0x13, 0x01cb}, - {0xa0, 0x08, 0x0250}, - {0xa0, 0x08, 0x0301}, - {0xa0, 0x60, 0x0116}, - {0xa0, 0x46, 0x0118}, - {0xa0, 0x04, 0x0113}, + {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, + {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, + {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, + {0xa0, 0x60, ZC3XX_R116_RGAIN}, + {0xa0, 0x46, ZC3XX_R118_BGAIN}, + {0xa0, 0x04, ZC3XX_R113_RGB03}, /* 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}, + {0xa0, 0x50, ZC3XX_R10A_RGB00}, /* matrix */ + {0xa0, 0xf8, ZC3XX_R10B_RGB01}, + {0xa0, 0xf8, ZC3XX_R10C_RGB02}, + {0xa0, 0xf8, ZC3XX_R10D_RGB10}, + {0xa0, 0x50, ZC3XX_R10E_RGB11}, + {0xa0, 0xf8, ZC3XX_R10F_RGB12}, + {0xa0, 0xf8, ZC3XX_R110_RGB20}, + {0xa0, 0xf8, ZC3XX_R111_RGB21}, + {0xa0, 0x50, ZC3XX_R112_RGB22}, /* 0x03, */ {0xa1, 0x01, 0x0008}, - {0xa0, 0x03, 0x0008}, /* clock ? */ - {0xa0, 0x08, 0x01c6}, /* sharpness+ */ + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* clock ? */ + {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */ {0xa1, 0x01, 0x01c8}, {0xa1, 0x01, 0x01c9}, {0xa1, 0x01, 0x01ca}, - {0xa0, 0x0f, 0x01cb}, /* sharpness- */ - {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}, + {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */ + {0xa0, 0x01, ZC3XX_R120_GAMMA00}, /* gamma 2 ?*/ + {0xa0, 0x0c, ZC3XX_R121_GAMMA01}, + {0xa0, 0x1f, ZC3XX_R122_GAMMA02}, + {0xa0, 0x3a, ZC3XX_R123_GAMMA03}, + {0xa0, 0x53, ZC3XX_R124_GAMMA04}, + {0xa0, 0x6d, ZC3XX_R125_GAMMA05}, + {0xa0, 0x85, ZC3XX_R126_GAMMA06}, + {0xa0, 0x9c, ZC3XX_R127_GAMMA07}, + {0xa0, 0xb0, ZC3XX_R128_GAMMA08}, + {0xa0, 0xc2, ZC3XX_R129_GAMMA09}, + {0xa0, 0xd1, ZC3XX_R12A_GAMMA0A}, + {0xa0, 0xde, ZC3XX_R12B_GAMMA0B}, + {0xa0, 0xe9, ZC3XX_R12C_GAMMA0C}, + {0xa0, 0xf2, ZC3XX_R12D_GAMMA0D}, + {0xa0, 0xf9, ZC3XX_R12E_GAMMA0E}, + {0xa0, 0xff, ZC3XX_R12F_GAMMA0F}, + {0xa0, 0x05, ZC3XX_R130_GAMMA10}, + {0xa0, 0x0f, ZC3XX_R131_GAMMA11}, + {0xa0, 0x16, ZC3XX_R132_GAMMA12}, + {0xa0, 0x1a, ZC3XX_R133_GAMMA13}, + {0xa0, 0x19, ZC3XX_R134_GAMMA14}, + {0xa0, 0x19, ZC3XX_R135_GAMMA15}, + {0xa0, 0x17, ZC3XX_R136_GAMMA16}, + {0xa0, 0x15, ZC3XX_R137_GAMMA17}, + {0xa0, 0x12, ZC3XX_R138_GAMMA18}, + {0xa0, 0x10, ZC3XX_R139_GAMMA19}, + {0xa0, 0x0e, ZC3XX_R13A_GAMMA1A}, + {0xa0, 0x0b, ZC3XX_R13B_GAMMA1B}, + {0xa0, 0x09, ZC3XX_R13C_GAMMA1C}, + {0xa0, 0x08, ZC3XX_R13D_GAMMA1D}, + {0xa0, 0x06, ZC3XX_R13E_GAMMA1E}, + {0xa0, 0x03, ZC3XX_R13F_GAMMA1F}, + {0xa0, 0x50, ZC3XX_R10A_RGB00}, /* matrix */ + {0xa0, 0xf8, ZC3XX_R10B_RGB01}, + {0xa0, 0xf8, ZC3XX_R10C_RGB02}, + {0xa0, 0xf8, ZC3XX_R10D_RGB10}, + {0xa0, 0x50, ZC3XX_R10E_RGB11}, + {0xa0, 0xf8, ZC3XX_R10F_RGB12}, + {0xa0, 0xf8, ZC3XX_R110_RGB20}, + {0xa0, 0xf8, ZC3XX_R111_RGB21}, + {0xa0, 0x50, ZC3XX_R112_RGB22}, {0xa1, 0x01, 0x0180}, - {0xa0, 0x00, 0x0180}, + {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE}, {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}, + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, + {0xa0, 0x01, ZC3XX_R191_EXPOSURELIMITMID}, + {0xa0, 0xb8, ZC3XX_R192_EXPOSURELIMITLOW}, + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, + {0xa0, 0x37, ZC3XX_R197_ANTIFLICKERLOW}, + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, + {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF}, + {0xa0, 0x26, ZC3XX_R1AA_DIGITALGAINSTEP}, + {0xa0, 0x50, ZC3XX_R11D_GLOBALGAIN}, + {0xa0, 0x02, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x40, ZC3XX_R180_AUTOCORRECTENABLE}, {0xaa, 0x13, 0x0083}, /* 40 */ {0xa1, 0x01, 0x0180}, - {0xa0, 0x42, 0x0180}, + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, {} }; static const 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}, + {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, + {0xa0, 0x00, ZC3XX_R002_CLOCKSELECT}, + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, + {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, + {0xa0, 0x06, ZC3XX_R010_CMOSSENSORSELECT}, + {0xa0, 0xa1, ZC3XX_R08B_I2CDEVICEADDR}, + {0xa0, 0x08, ZC3XX_R08D_COMPABILITYMODE}, + {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, + {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, + {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, + {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW}, + {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, {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}, + {0xa0, 0x02, ZC3XX_R083_RGAINADDR}, + {0xa0, 0x01, ZC3XX_R085_BGAINADDR}, + {0xa0, 0x90, ZC3XX_R086_EXPTIMEHIGH}, + {0xa0, 0x91, ZC3XX_R087_EXPTIMEMID}, + {0xa0, 0x10, ZC3XX_R088_EXPTIMELOW}, + {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, + {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW}, + {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, + {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW}, + {0xa0, 0xe6, ZC3XX_R09C_WINHEIGHTLOW}, + {0xa0, 0x86, ZC3XX_R09E_WINWIDTHLOW}, {0xaa, 0x12, 0x0069}, /* i2c */ {0xaa, 0x04, 0x0020}, {0xaa, 0x06, 0x0050}, @@ -3977,103 +3991,103 @@ static const struct usb_action ov7630c_InitialScale[] = { {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, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x77, ZC3XX_R101_SENSORCORRECTION}, + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, + {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, + {0xa0, 0x04, ZC3XX_R1A7_CALCGLOBALMEAN}, {0xa0, 0x00, 0x01ad}, - {0xa0, 0x03, 0x01c5}, - {0xa0, 0x13, 0x01cb}, - {0xa0, 0x08, 0x0250}, - {0xa0, 0x08, 0x0301}, - {0xa0, 0x60, 0x0116}, - {0xa0, 0x46, 0x0118}, - {0xa0, 0x04, 0x0113}, + {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, + {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, + {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, + {0xa0, 0x60, ZC3XX_R116_RGAIN}, + {0xa0, 0x46, ZC3XX_R118_BGAIN}, + {0xa0, 0x04, ZC3XX_R113_RGB03}, {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}, + {0xa0, 0x4e, ZC3XX_R10A_RGB00}, /* matrix */ + {0xa0, 0xfe, ZC3XX_R10B_RGB01}, + {0xa0, 0xf4, ZC3XX_R10C_RGB02}, + {0xa0, 0xf7, ZC3XX_R10D_RGB10}, + {0xa0, 0x4d, ZC3XX_R10E_RGB11}, + {0xa0, 0xfc, ZC3XX_R10F_RGB12}, + {0xa0, 0x00, ZC3XX_R110_RGB20}, + {0xa0, 0xf6, ZC3XX_R111_RGB21}, + {0xa0, 0x4a, ZC3XX_R112_RGB22}, {0xa1, 0x01, 0x0008}, - {0xa0, 0x03, 0x0008}, /* clock ? */ - {0xa0, 0x08, 0x01c6}, /* sharpness+ */ + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* clock ? */ + {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */ {0xa1, 0x01, 0x01c8}, {0xa1, 0x01, 0x01c9}, {0xa1, 0x01, 0x01ca}, - {0xa0, 0x0f, 0x01cb}, /* sharpness- */ - {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}, + {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */ + {0xa0, 0x16, ZC3XX_R120_GAMMA00}, /* gamma ~4 */ + {0xa0, 0x3a, ZC3XX_R121_GAMMA01}, + {0xa0, 0x5b, ZC3XX_R122_GAMMA02}, + {0xa0, 0x7c, ZC3XX_R123_GAMMA03}, + {0xa0, 0x94, ZC3XX_R124_GAMMA04}, + {0xa0, 0xa9, ZC3XX_R125_GAMMA05}, + {0xa0, 0xbb, ZC3XX_R126_GAMMA06}, + {0xa0, 0xca, ZC3XX_R127_GAMMA07}, + {0xa0, 0xd7, ZC3XX_R128_GAMMA08}, + {0xa0, 0xe1, ZC3XX_R129_GAMMA09}, + {0xa0, 0xea, ZC3XX_R12A_GAMMA0A}, + {0xa0, 0xf1, ZC3XX_R12B_GAMMA0B}, + {0xa0, 0xf7, ZC3XX_R12C_GAMMA0C}, + {0xa0, 0xfc, ZC3XX_R12D_GAMMA0D}, + {0xa0, 0xff, ZC3XX_R12E_GAMMA0E}, + {0xa0, 0xff, ZC3XX_R12F_GAMMA0F}, + {0xa0, 0x20, ZC3XX_R130_GAMMA10}, + {0xa0, 0x22, ZC3XX_R131_GAMMA11}, + {0xa0, 0x20, ZC3XX_R132_GAMMA12}, + {0xa0, 0x1c, ZC3XX_R133_GAMMA13}, + {0xa0, 0x16, ZC3XX_R134_GAMMA14}, + {0xa0, 0x13, ZC3XX_R135_GAMMA15}, + {0xa0, 0x10, ZC3XX_R136_GAMMA16}, + {0xa0, 0x0d, ZC3XX_R137_GAMMA17}, + {0xa0, 0x0b, ZC3XX_R138_GAMMA18}, + {0xa0, 0x09, ZC3XX_R139_GAMMA19}, + {0xa0, 0x07, ZC3XX_R13A_GAMMA1A}, + {0xa0, 0x06, ZC3XX_R13B_GAMMA1B}, + {0xa0, 0x05, ZC3XX_R13C_GAMMA1C}, + {0xa0, 0x04, ZC3XX_R13D_GAMMA1D}, + {0xa0, 0x00, ZC3XX_R13E_GAMMA1E}, + {0xa0, 0x01, ZC3XX_R13F_GAMMA1F}, + {0xa0, 0x4e, ZC3XX_R10A_RGB00}, /* matrix */ + {0xa0, 0xfe, ZC3XX_R10B_RGB01}, + {0xa0, 0xf4, ZC3XX_R10C_RGB02}, + {0xa0, 0xf7, ZC3XX_R10D_RGB10}, + {0xa0, 0x4d, ZC3XX_R10E_RGB11}, + {0xa0, 0xfc, ZC3XX_R10F_RGB12}, + {0xa0, 0x00, ZC3XX_R110_RGB20}, + {0xa0, 0xf6, ZC3XX_R111_RGB21}, + {0xa0, 0x4a, ZC3XX_R112_RGB22}, {0xa1, 0x01, 0x0180}, - {0xa0, 0x00, 0x0180}, + {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE}, {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}, + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, + {0xa0, 0x00, ZC3XX_R191_EXPOSURELIMITMID}, + {0xa0, 0xd8, ZC3XX_R192_EXPOSURELIMITLOW}, + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, + {0xa0, 0x1b, ZC3XX_R197_ANTIFLICKERLOW}, + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, + {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF}, + {0xa0, 0x26, ZC3XX_R1AA_DIGITALGAINSTEP}, + {0xa0, 0x50, ZC3XX_R11D_GLOBALGAIN}, + {0xa0, 0x02, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x40, ZC3XX_R180_AUTOCORRECTENABLE}, {0xaa, 0x13, 0x00c3}, {0xa1, 0x01, 0x0180}, - {0xa0, 0x42, 0x0180}, + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, {} }; @@ -4081,10 +4095,10 @@ static const struct usb_action pas106b_Initial_com[] = { /* Sream and Sensor specific */ {0xa1, 0x01, 0x0010}, /* CMOSSensorSelect */ /* System */ - {0xa0, 0x01, 0x0000}, /* SystemControl */ - {0xa0, 0x01, 0x0000}, /* SystemControl */ + {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, /* SystemControl */ + {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, /* SystemControl */ /* Picture size */ - {0xa0, 0x00, 0x0002}, /* ClockSelect */ + {0xa0, 0x00, ZC3XX_R002_CLOCKSELECT}, /* ClockSelect */ {0xa0, 0x03, 0x003a}, {0xa0, 0x0c, 0x003b}, {0xa0, 0x04, 0x0038}, @@ -4093,27 +4107,27 @@ static const struct usb_action pas106b_Initial_com[] = { static const struct usb_action pas106b_Initial[] = { /* 176x144 */ /* JPEG control */ - {0xa0, 0x03, 0x0008}, /* ClockSetting */ + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* ClockSetting */ /* Sream and Sensor specific */ - {0xa0, 0x0f, 0x0010}, /* CMOSSensorSelect */ + {0xa0, 0x0f, ZC3XX_R010_CMOSSENSORSELECT}, /* CMOSSensorSelect */ /* Picture size */ - {0xa0, 0x00, 0x0003}, /* FrameWidthHigh 00 */ - {0xa0, 0xb0, 0x0004}, /* FrameWidthLow B0 */ - {0xa0, 0x00, 0x0005}, /* FrameHeightHigh 00 */ - {0xa0, 0x90, 0x0006}, /* FrameHightLow 90 */ + {0xa0, 0x00, ZC3XX_R003_FRAMEWIDTHHIGH}, /* FrameWidthHigh 00 */ + {0xa0, 0xb0, ZC3XX_R004_FRAMEWIDTHLOW}, /* FrameWidthLow B0 */ + {0xa0, 0x00, ZC3XX_R005_FRAMEHEIGHTHIGH}, /* FrameHeightHigh 00 */ + {0xa0, 0x90, ZC3XX_R006_FRAMEHEIGHTLOW}, /* FrameHightLow 90 */ /* System */ - {0xa0, 0x01, 0x0001}, /* SystemOperating */ + {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, /* SystemOperating */ /* Sream and Sensor specific */ - {0xa0, 0x03, 0x0012}, /* VideoControlFunction */ - {0xa0, 0x01, 0x0012}, /* VideoControlFunction */ + {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, /* VideoControlFunction */ + {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, /* VideoControlFunction */ /* Sensor Interface */ - {0xa0, 0x08, 0x008d}, /* Compatibily Mode */ + {0xa0, 0x08, ZC3XX_R08D_COMPABILITYMODE}, /* 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 */ + {0xa0, 0x03, ZC3XX_R09A_WINXSTARTLOW}, /* WinXStartLow */ + {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, /* FirstYLow */ + {0xa0, 0x03, ZC3XX_R11C_FIRSTXLOW}, /* FirstxLow */ + {0xa0, 0x28, ZC3XX_R09C_WINHEIGHTLOW}, /* WinHeightLow */ + {0xa0, 0x68, ZC3XX_R09E_WINWIDTHLOW}, /* WinWidthLow */ /* Init the sensor */ {0xaa, 0x02, 0x0004}, {0xaa, 0x08, 0x0000}, @@ -4126,112 +4140,112 @@ static const struct usb_action pas106b_Initial[] = { /* 176x144 */ {0xaa, 0x14, 0x0081}, /* Other registors */ - {0xa0, 0x37, 0x0101}, /* SensorCorrection */ + {0xa0, 0x37, ZC3XX_R101_SENSORCORRECTION}, /* SensorCorrection */ /* Frame retreiving */ - {0xa0, 0x00, 0x0019}, /* AutoAdjustFPS */ + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* AutoAdjustFPS */ /* Gains */ - {0xa0, 0xa0, 0x01a8}, /* DigitalGain */ + {0xa0, 0xa0, ZC3XX_R1A8_DIGITALGAIN}, /* DigitalGain */ /* Unknown */ {0xa0, 0x00, 0x01ad}, /* Sharpness */ - {0xa0, 0x03, 0x01c5}, /* SharpnessMode */ - {0xa0, 0x13, 0x01cb}, /* Sharpness05 */ + {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, /* SharpnessMode */ + {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, /* Sharpness05 */ /* Other registors */ - {0xa0, 0x0d, 0x0100}, /* OperationMode */ + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, /* OperationMode */ /* Auto exposure and white balance */ - {0xa0, 0x06, 0x0189}, /* AWBStatus */ + {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, /* AWBStatus */ /*Dead pixels */ - {0xa0, 0x08, 0x0250}, /* DeadPixelsMode */ + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, /* DeadPixelsMode */ /* EEPROM */ - {0xa0, 0x08, 0x0301}, /* EEPROMAccess */ + {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, /* EEPROMAccess */ /* JPEG control */ - {0xa0, 0x03, 0x0008}, /* ClockSetting */ - {0xa0, 0x08, 0x01c6}, /* sharpness+ */ - {0xa0, 0x0f, 0x01cb}, /* sharpness- */ + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* ClockSetting */ + {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */ + {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */ /* Other registers */ - {0xa0, 0x0d, 0x0100}, /* OperationMode */ + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, /* OperationMode */ /* Auto exposure and white balance */ - {0xa0, 0x06, 0x0189}, /* AWBStatus */ + {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, /* AWBStatus */ /*Dead pixels */ - {0xa0, 0x08, 0x0250}, /* DeadPixelsMode */ + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, /* DeadPixelsMode */ /* EEPROM */ - {0xa0, 0x08, 0x0301}, /* EEPROMAccess */ + {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, /* EEPROMAccess */ /* JPEG control */ - {0xa0, 0x03, 0x0008}, /* ClockSetting */ - {0xa0, 0x08, 0x01c6}, /* sharpness+ */ - {0xa0, 0x0f, 0x01cb}, /* sharpness- */ - - {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, 0x03, ZC3XX_R008_CLOCKSETTING}, /* ClockSetting */ + {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */ + {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */ + + {0xa0, 0x58, ZC3XX_R10A_RGB00}, /* matrix */ + {0xa0, 0xf4, ZC3XX_R10B_RGB01}, + {0xa0, 0xf4, ZC3XX_R10C_RGB02}, + {0xa0, 0xf4, ZC3XX_R10D_RGB10}, + {0xa0, 0x58, ZC3XX_R10E_RGB11}, + {0xa0, 0xf4, ZC3XX_R10F_RGB12}, + {0xa0, 0xf4, ZC3XX_R110_RGB20}, + {0xa0, 0xf4, ZC3XX_R111_RGB21}, + {0xa0, 0x58, ZC3XX_R112_RGB22}, /* 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 */ + {0xa0, 0x03, ZC3XX_R181_WINXSTART}, /* WinXstart */ + {0xa0, 0x08, ZC3XX_R182_WINXWIDTH}, /* WinXWidth */ + {0xa0, 0x16, ZC3XX_R183_WINXCENTER}, /* WinXCenter */ + {0xa0, 0x03, ZC3XX_R184_WINYSTART}, /* WinYStart */ + {0xa0, 0x05, ZC3XX_R185_WINYWIDTH}, /* WinYWidth */ + {0xa0, 0x14, ZC3XX_R186_WINYCENTER}, /* WinYCenter */ + {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE}, /* 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 */ + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* ExposureLimitHigh */ + {0xa0, 0x03, ZC3XX_R191_EXPOSURELIMITMID}, /* ExposureLimitMid */ + {0xa0, 0xb1, ZC3XX_R192_EXPOSURELIMITLOW}, /* ExposureLimitLow */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* AntiFlickerHigh */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* AntiFlickerLow */ + {0xa0, 0x87, ZC3XX_R197_ANTIFLICKERLOW}, /* AntiFlickerLow */ + {0xa0, 0x0c, ZC3XX_R18C_AEFREEZE}, /* AEBFreeze */ + {0xa0, 0x18, ZC3XX_R18F_AEUNFREEZE}, /* 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 */ + {0xa0, 0x20, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* DigitalLimitDiff */ + {0xa0, 0x26, ZC3XX_R1AA_DIGITALGAINSTEP}, /* DigitalGainStep */ + {0xa0, 0xa0, ZC3XX_R11D_GLOBALGAIN}, /* GlobalGain */ + {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN}, /* GlobalGain */ /* Auto correction */ - {0xa0, 0x40, 0x0180}, /* AutoCorrectEnable */ - {0xa1, 0x01, 0x0180}, /* AutoCorrectEnable */ - {0xa0, 0x42, 0x0180}, /* AutoCorrectEnable */ + {0xa0, 0x40, ZC3XX_R180_AUTOCORRECTENABLE}, /* AutoCorrectEnable */ + {0xa1, 0x01, 0x0180}, /* AutoCorrectEnable */ + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, /* AutoCorrectEnable */ /* Gains */ - {0xa0, 0x40, 0x0116}, /* RGain */ - {0xa0, 0x40, 0x0117}, /* GGain */ - {0xa0, 0x40, 0x0118}, /* BGain */ + {0xa0, 0x40, ZC3XX_R116_RGAIN}, /* RGain */ + {0xa0, 0x40, ZC3XX_R117_GGAIN}, /* GGain */ + {0xa0, 0x40, ZC3XX_R118_BGAIN}, /* BGain */ {} }; static const struct usb_action pas106b_InitialScale[] = { /* 352x288 */ /* JPEG control */ - {0xa0, 0x03, 0x0008}, /* ClockSetting */ + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* ClockSetting */ /* Sream and Sensor specific */ - {0xa0, 0x0f, 0x0010}, /* CMOSSensorSelect */ + {0xa0, 0x0f, ZC3XX_R010_CMOSSENSORSELECT}, /* CMOSSensorSelect */ /* Picture size */ - {0xa0, 0x01, 0x0003}, /* FrameWidthHigh */ - {0xa0, 0x60, 0x0004}, /* FrameWidthLow */ - {0xa0, 0x01, 0x0005}, /* FrameHeightHigh */ - {0xa0, 0x20, 0x0006}, /* FrameHightLow */ + {0xa0, 0x01, ZC3XX_R003_FRAMEWIDTHHIGH}, /* FrameWidthHigh */ + {0xa0, 0x60, ZC3XX_R004_FRAMEWIDTHLOW}, /* FrameWidthLow */ + {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, /* FrameHeightHigh */ + {0xa0, 0x20, ZC3XX_R006_FRAMEHEIGHTLOW}, /* FrameHightLow */ /* System */ - {0xa0, 0x01, 0x0001}, /* SystemOperating */ + {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, /* SystemOperating */ /* Sream and Sensor specific */ - {0xa0, 0x03, 0x0012}, /* VideoControlFunction */ - {0xa0, 0x01, 0x0012}, /* VideoControlFunction */ + {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, /* VideoControlFunction */ + {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, /* VideoControlFunction */ /* Sensor Interface */ - {0xa0, 0x08, 0x008d}, /* Compatibily Mode */ + {0xa0, 0x08, ZC3XX_R08D_COMPABILITYMODE}, /* 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 */ + {0xa0, 0x03, ZC3XX_R09A_WINXSTARTLOW}, /* WinXStartLow */ + {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, /* FirstYLow */ + {0xa0, 0x03, ZC3XX_R11C_FIRSTXLOW}, /* FirstxLow */ + {0xa0, 0x28, ZC3XX_R09C_WINHEIGHTLOW}, /* WinHeightLow */ + {0xa0, 0x68, ZC3XX_R09E_WINWIDTHLOW}, /* WinWidthLow */ /* Init the sensor */ {0xaa, 0x02, 0x0004}, {0xaa, 0x08, 0x0000}, @@ -4244,161 +4258,161 @@ static const struct usb_action pas106b_InitialScale[] = { /* 352x288 */ {0xaa, 0x14, 0x0081}, /* Other registors */ - {0xa0, 0x37, 0x0101}, /* SensorCorrection */ + {0xa0, 0x37, ZC3XX_R101_SENSORCORRECTION}, /* SensorCorrection */ /* Frame retreiving */ - {0xa0, 0x00, 0x0019}, /* AutoAdjustFPS */ + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* AutoAdjustFPS */ /* Gains */ - {0xa0, 0xa0, 0x01a8}, /* DigitalGain */ + {0xa0, 0xa0, ZC3XX_R1A8_DIGITALGAIN}, /* DigitalGain */ /* Unknown */ {0xa0, 0x00, 0x01ad}, /* Sharpness */ - {0xa0, 0x03, 0x01c5}, /* SharpnessMode */ - {0xa0, 0x13, 0x01cb}, /* Sharpness05 */ + {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, /* SharpnessMode */ + {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, /* Sharpness05 */ /* Other registors */ - {0xa0, 0x0d, 0x0100}, /* OperationMode */ + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, /* OperationMode */ /* Auto exposure and white balance */ - {0xa0, 0x06, 0x0189}, /* AWBStatus */ - {0xa0, 0x80, 0x018d}, /* ????????? */ + {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, /* AWBStatus */ + {0xa0, 0x80, ZC3XX_R18D_YTARGET}, /* ????????? */ /*Dead pixels */ - {0xa0, 0x08, 0x0250}, /* DeadPixelsMode */ + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, /* DeadPixelsMode */ /* EEPROM */ - {0xa0, 0x08, 0x0301}, /* EEPROMAccess */ + {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, /* EEPROMAccess */ /* JPEG control */ - {0xa0, 0x03, 0x0008}, /* ClockSetting */ - {0xa0, 0x08, 0x01c6}, /* sharpness+ */ - {0xa0, 0x0f, 0x01cb}, /* sharpness- */ + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* ClockSetting */ + {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */ + {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */ /* Other registers */ - {0xa0, 0x0d, 0x0100}, /* OperationMode */ + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, /* OperationMode */ /* Auto exposure and white balance */ - {0xa0, 0x06, 0x0189}, /* AWBStatus */ + {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, /* AWBStatus */ /*Dead pixels */ - {0xa0, 0x08, 0x0250}, /* DeadPixelsMode */ + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, /* DeadPixelsMode */ /* EEPROM */ - {0xa0, 0x08, 0x0301}, /* EEPROMAccess */ + {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, /* EEPROMAccess */ /* JPEG control */ - {0xa0, 0x03, 0x0008}, /* ClockSetting */ - {0xa0, 0x08, 0x01c6}, /* sharpness+ */ - {0xa0, 0x0f, 0x01cb}, /* sharpness- */ - - {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, 0x03, ZC3XX_R008_CLOCKSETTING}, /* ClockSetting */ + {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */ + {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */ + + {0xa0, 0x58, ZC3XX_R10A_RGB00}, /* matrix */ + {0xa0, 0xf4, ZC3XX_R10B_RGB01}, + {0xa0, 0xf4, ZC3XX_R10C_RGB02}, + {0xa0, 0xf4, ZC3XX_R10D_RGB10}, + {0xa0, 0x58, ZC3XX_R10E_RGB11}, + {0xa0, 0xf4, ZC3XX_R10F_RGB12}, + {0xa0, 0xf4, ZC3XX_R110_RGB20}, + {0xa0, 0xf4, ZC3XX_R111_RGB21}, + {0xa0, 0x58, ZC3XX_R112_RGB22}, /* 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 */ + {0xa0, 0x03, ZC3XX_R181_WINXSTART}, /* WinXstart */ + {0xa0, 0x08, ZC3XX_R182_WINXWIDTH}, /* WinXWidth */ + {0xa0, 0x16, ZC3XX_R183_WINXCENTER}, /* WinXCenter */ + {0xa0, 0x03, ZC3XX_R184_WINYSTART}, /* WinYStart */ + {0xa0, 0x05, ZC3XX_R185_WINYWIDTH}, /* WinYWidth */ + {0xa0, 0x14, ZC3XX_R186_WINYCENTER}, /* WinYCenter */ + {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE}, /* AutoCorrectEnable */ /* Auto exposure and white balance */ - {0xa0, 0x00, 0x0190}, /* ExposureLimitHigh 0 */ - {0xa0, 0x03, 0x0191}, /* ExposureLimitMid */ - {0xa0, 0xb1, 0x0192}, /* ExposureLimitLow 0xb1 */ + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* ExposureLimitHigh 0 */ + {0xa0, 0x03, ZC3XX_R191_EXPOSURELIMITMID}, /* ExposureLimitMid */ + {0xa0, 0xb1, ZC3XX_R192_EXPOSURELIMITLOW}, /* ExposureLimitLow 0xb1 */ - {0xa0, 0x00, 0x0195}, /* AntiFlickerHigh 0x00 */ - {0xa0, 0x00, 0x0196}, /* AntiFlickerLow 0x00 */ - {0xa0, 0x87, 0x0197}, /* AntiFlickerLow 0x87 */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* AntiFlickerHigh 0x00 */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* AntiFlickerLow 0x00 */ + {0xa0, 0x87, ZC3XX_R197_ANTIFLICKERLOW}, /* AntiFlickerLow 0x87 */ - {0xa0, 0x10, 0x018c}, /* AEBFreeze 0x10 0x0c */ - {0xa0, 0x20, 0x018f}, /* AEBUnfreeze 0x30 0x18 */ + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* AEBFreeze 0x10 0x0c */ + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 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 */ + {0xa0, 0x20, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* DigitalLimitDiff */ + {0xa0, 0x26, ZC3XX_R1AA_DIGITALGAINSTEP}, /* DigitalGainStep */ + {0xa0, 0xa0, ZC3XX_R11D_GLOBALGAIN}, /* GlobalGain */ + {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN}, /* GlobalGain */ /* Auto correction */ - {0xa0, 0x40, 0x0180}, /* AutoCorrectEnable */ - {0xa1, 0x01, 0x0180}, /* AutoCorrectEnable */ - {0xa0, 0x42, 0x0180}, /* AutoCorrectEnable */ + {0xa0, 0x40, ZC3XX_R180_AUTOCORRECTENABLE}, /* AutoCorrectEnable */ + {0xa1, 0x01, 0x0180}, /* AutoCorrectEnable */ + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, /* AutoCorrectEnable */ /* Gains */ - {0xa0, 0x40, 0x0116}, /* RGain */ - {0xa0, 0x40, 0x0117}, /* GGain */ - {0xa0, 0x40, 0x0118}, /* BGain */ + {0xa0, 0x40, ZC3XX_R116_RGAIN}, /* RGain */ + {0xa0, 0x40, ZC3XX_R117_GGAIN}, /* GGain */ + {0xa0, 0x40, ZC3XX_R118_BGAIN}, /* BGain */ - {0xa0, 0x00, 0x0007}, /* AutoCorrectEnable */ - {0xa0, 0xff, 0x0018}, /* Frame adjust */ + {0xa0, 0x00, 0x0007}, /* AutoCorrectEnable */ + {0xa0, 0xff, ZC3XX_R018_FRAMELOST}, /* Frame adjust */ {} }; static const 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 */ + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */ + {0xa0, 0x06, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,06,cc */ + {0xa0, 0x54, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,54,cc */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */ + {0xa0, 0x87, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,87,cc */ + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */ + {0xa0, 0x30, ZC3XX_R18F_AEUNFREEZE}, /* 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, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,04,cc */ {} }; static const 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 */ + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */ + {0xa0, 0x06, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,06,cc */ + {0xa0, 0x2e, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,2e,cc */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */ + {0xa0, 0x71, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,71,cc */ + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */ + {0xa0, 0x30, ZC3XX_R18F_AEUNFREEZE}, /* 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, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,04,cc */ {} }; static const 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 */ + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */ + {0xa0, 0x06, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,06,cc */ + {0xa0, 0x50, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,50,cc */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */ + {0xa0, 0x10, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,10,cc */ + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */ + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 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, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,00,cc */ {} }; static const 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}, + {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, + {0xa0, 0x0a, ZC3XX_R010_CMOSSENSORSELECT}, + {0xa0, 0x10, ZC3XX_R002_CLOCKSELECT}, + {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, + {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, + {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, + {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW}, + {0xa0, 0xdc, ZC3XX_R08B_I2CDEVICEADDR}, /* 8b -> dc */ + {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, + {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, + {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW}, + {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, + {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW}, + {0xa0, 0xdc, ZC3XX_R08B_I2CDEVICEADDR}, {0xaa, 0x01, 0x0001}, {0xaa, 0x06, 0x0000}, {0xaa, 0x08, 0x0483}, @@ -4418,20 +4432,20 @@ static const struct usb_action pb03303x_Initial[] = { {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, 0x10, ZC3XX_R087_EXPTIMEMID}, + {0xa0, 0x37, ZC3XX_R101_SENSORCORRECTION}, + {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, + {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, {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}, + {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, + {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, + {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, + {0xa0, 0x60, ZC3XX_R1A8_DIGITALGAIN}, + {0xa0, 0x78, ZC3XX_R18D_YTARGET}, + {0xa0, 0x61, ZC3XX_R116_RGAIN}, + {0xa0, 0x65, ZC3XX_R118_BGAIN}, {0xa1, 0x01, 0x0002}, {0xa0, 0x09, 0x01ad}, @@ -4439,112 +4453,112 @@ static const struct usb_action pb03303x_Initial[] = { {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}, + {0xa0, 0x50, ZC3XX_R10A_RGB00}, /* matrix */ + {0xa0, 0xf8, ZC3XX_R10B_RGB01}, + {0xa0, 0xf8, ZC3XX_R10C_RGB02}, + {0xa0, 0xf8, ZC3XX_R10D_RGB10}, + {0xa0, 0x50, ZC3XX_R10E_RGB11}, + {0xa0, 0xf8, ZC3XX_R10F_RGB12}, + {0xa0, 0xf8, ZC3XX_R110_RGB20}, + {0xa0, 0xf8, ZC3XX_R111_RGB21}, + {0xa0, 0x50, ZC3XX_R112_RGB22}, {0xa1, 0x01, 0x0008}, - {0xa0, 0x03, 0x0008}, /* clock ? */ - {0xa0, 0x08, 0x01c6}, /* sharpness+ */ + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* clock ? */ + {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */ {0xa1, 0x01, 0x01c8}, {0xa1, 0x01, 0x01c9}, {0xa1, 0x01, 0x01ca}, - {0xa0, 0x0f, 0x01cb}, /* sharpness- */ - {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}, + {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */ + {0xa0, 0x13, ZC3XX_R120_GAMMA00}, /* gamma 4 */ + {0xa0, 0x38, ZC3XX_R121_GAMMA01}, + {0xa0, 0x59, ZC3XX_R122_GAMMA02}, + {0xa0, 0x79, ZC3XX_R123_GAMMA03}, + {0xa0, 0x92, ZC3XX_R124_GAMMA04}, + {0xa0, 0xa7, ZC3XX_R125_GAMMA05}, + {0xa0, 0xb9, ZC3XX_R126_GAMMA06}, + {0xa0, 0xc8, ZC3XX_R127_GAMMA07}, + {0xa0, 0xd4, ZC3XX_R128_GAMMA08}, + {0xa0, 0xdf, ZC3XX_R129_GAMMA09}, + {0xa0, 0xe7, ZC3XX_R12A_GAMMA0A}, + {0xa0, 0xee, ZC3XX_R12B_GAMMA0B}, + {0xa0, 0xf4, ZC3XX_R12C_GAMMA0C}, + {0xa0, 0xf9, ZC3XX_R12D_GAMMA0D}, + {0xa0, 0xfc, ZC3XX_R12E_GAMMA0E}, + {0xa0, 0xff, ZC3XX_R12F_GAMMA0F}, + {0xa0, 0x26, ZC3XX_R130_GAMMA10}, + {0xa0, 0x22, ZC3XX_R131_GAMMA11}, + {0xa0, 0x20, ZC3XX_R132_GAMMA12}, + {0xa0, 0x1c, ZC3XX_R133_GAMMA13}, + {0xa0, 0x16, ZC3XX_R134_GAMMA14}, + {0xa0, 0x13, ZC3XX_R135_GAMMA15}, + {0xa0, 0x10, ZC3XX_R136_GAMMA16}, + {0xa0, 0x0d, ZC3XX_R137_GAMMA17}, + {0xa0, 0x0b, ZC3XX_R138_GAMMA18}, + {0xa0, 0x09, ZC3XX_R139_GAMMA19}, + {0xa0, 0x07, ZC3XX_R13A_GAMMA1A}, + {0xa0, 0x06, ZC3XX_R13B_GAMMA1B}, + {0xa0, 0x05, ZC3XX_R13C_GAMMA1C}, + {0xa0, 0x04, ZC3XX_R13D_GAMMA1D}, + {0xa0, 0x03, ZC3XX_R13E_GAMMA1E}, + {0xa0, 0x02, ZC3XX_R13F_GAMMA1F}, + {0xa0, 0x50, ZC3XX_R10A_RGB00}, /* matrix */ + {0xa0, 0xf8, ZC3XX_R10B_RGB01}, + {0xa0, 0xf8, ZC3XX_R10C_RGB02}, + {0xa0, 0xf8, ZC3XX_R10D_RGB10}, + {0xa0, 0x50, ZC3XX_R10E_RGB11}, + {0xa0, 0xf8, ZC3XX_R10F_RGB12}, + {0xa0, 0xf8, ZC3XX_R110_RGB20}, + {0xa0, 0xf8, ZC3XX_R111_RGB21}, + {0xa0, 0x50, ZC3XX_R112_RGB22}, {0xa1, 0x01, 0x0180}, - {0xa0, 0x00, 0x0180}, - {0xa0, 0x00, 0x0180}, - {0xa0, 0x00, 0x0019}, + {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, {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, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, + {0xa0, 0x07, ZC3XX_R191_EXPOSURELIMITMID}, + {0xa0, 0xec, ZC3XX_R192_EXPOSURELIMITLOW}, + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, + {0xa0, 0x9c, ZC3XX_R197_ANTIFLICKERLOW}, + {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE}, + {0xa0, 0x1c, ZC3XX_R18F_AEUNFREEZE}, + {0xa0, 0x14, ZC3XX_R1A9_DIGITALLIMITDIFF}, + {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP}, + {0xa0, 0xd7, ZC3XX_R01D_HSYNC_0}, + {0xa0, 0xf4, ZC3XX_R01E_HSYNC_1}, + {0xa0, 0xf9, ZC3XX_R01F_HSYNC_2}, + {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, {0xa0, 0x09, 0x01ad}, {0xa0, 0x15, 0x01ae}, - {0xa0, 0x40, 0x0180}, + {0xa0, 0x40, ZC3XX_R180_AUTOCORRECTENABLE}, {0xa1, 0x01, 0x0180}, - {0xa0, 0x42, 0x0180}, + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, {} }; static const 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}, + {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, + {0xa0, 0x0a, ZC3XX_R010_CMOSSENSORSELECT}, + {0xa0, 0x00, ZC3XX_R002_CLOCKSELECT}, + {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, + {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, + {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, + {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW}, + {0xa0, 0xdc, ZC3XX_R08B_I2CDEVICEADDR}, /* 8b -> dc */ + {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, + {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, + {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW}, + {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, + {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW}, + {0xa0, 0xdc, ZC3XX_R08B_I2CDEVICEADDR}, {0xaa, 0x01, 0x0001}, {0xaa, 0x06, 0x0000}, {0xaa, 0x08, 0x0483}, @@ -4564,20 +4578,20 @@ static const struct usb_action pb03303x_InitialScale[] = { {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, 0x10, ZC3XX_R087_EXPTIMEMID}, + {0xa0, 0x37, ZC3XX_R101_SENSORCORRECTION}, + {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, + {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, {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}, + {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, + {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, + {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, + {0xa0, 0x60, ZC3XX_R1A8_DIGITALGAIN}, + {0xa0, 0x78, ZC3XX_R18D_YTARGET}, + {0xa0, 0x61, ZC3XX_R116_RGAIN}, + {0xa0, 0x65, ZC3XX_R118_BGAIN}, {0xa1, 0x01, 0x0002}, @@ -4587,113 +4601,113 @@ static const struct usb_action pb03303x_InitialScale[] = { {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}, + {0xa0, 0x50, ZC3XX_R10A_RGB00}, /* matrix */ + {0xa0, 0xf8, ZC3XX_R10B_RGB01}, + {0xa0, 0xf8, ZC3XX_R10C_RGB02}, + {0xa0, 0xf8, ZC3XX_R10D_RGB10}, + {0xa0, 0x50, ZC3XX_R10E_RGB11}, + {0xa0, 0xf8, ZC3XX_R10F_RGB12}, + {0xa0, 0xf8, ZC3XX_R110_RGB20}, + {0xa0, 0xf8, ZC3XX_R111_RGB21}, + {0xa0, 0x50, ZC3XX_R112_RGB22}, {0xa1, 0x01, 0x0008}, - {0xa0, 0x03, 0x0008}, /* clock ? */ - {0xa0, 0x08, 0x01c6}, /* sharpness+ */ + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* clock ? */ + {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */ {0xa1, 0x01, 0x01c8}, {0xa1, 0x01, 0x01c9}, {0xa1, 0x01, 0x01ca}, - {0xa0, 0x0f, 0x01cb}, /* sharpness- */ - - {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}, + {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */ + + {0xa0, 0x13, ZC3XX_R120_GAMMA00}, /* gamma 4 */ + {0xa0, 0x38, ZC3XX_R121_GAMMA01}, + {0xa0, 0x59, ZC3XX_R122_GAMMA02}, + {0xa0, 0x79, ZC3XX_R123_GAMMA03}, + {0xa0, 0x92, ZC3XX_R124_GAMMA04}, + {0xa0, 0xa7, ZC3XX_R125_GAMMA05}, + {0xa0, 0xb9, ZC3XX_R126_GAMMA06}, + {0xa0, 0xc8, ZC3XX_R127_GAMMA07}, + {0xa0, 0xd4, ZC3XX_R128_GAMMA08}, + {0xa0, 0xdf, ZC3XX_R129_GAMMA09}, + {0xa0, 0xe7, ZC3XX_R12A_GAMMA0A}, + {0xa0, 0xee, ZC3XX_R12B_GAMMA0B}, + {0xa0, 0xf4, ZC3XX_R12C_GAMMA0C}, + {0xa0, 0xf9, ZC3XX_R12D_GAMMA0D}, + {0xa0, 0xfc, ZC3XX_R12E_GAMMA0E}, + {0xa0, 0xff, ZC3XX_R12F_GAMMA0F}, + {0xa0, 0x26, ZC3XX_R130_GAMMA10}, + {0xa0, 0x22, ZC3XX_R131_GAMMA11}, + {0xa0, 0x20, ZC3XX_R132_GAMMA12}, + {0xa0, 0x1c, ZC3XX_R133_GAMMA13}, + {0xa0, 0x16, ZC3XX_R134_GAMMA14}, + {0xa0, 0x13, ZC3XX_R135_GAMMA15}, + {0xa0, 0x10, ZC3XX_R136_GAMMA16}, + {0xa0, 0x0d, ZC3XX_R137_GAMMA17}, + {0xa0, 0x0b, ZC3XX_R138_GAMMA18}, + {0xa0, 0x09, ZC3XX_R139_GAMMA19}, + {0xa0, 0x07, ZC3XX_R13A_GAMMA1A}, + {0xa0, 0x06, ZC3XX_R13B_GAMMA1B}, + {0xa0, 0x05, ZC3XX_R13C_GAMMA1C}, + {0xa0, 0x04, ZC3XX_R13D_GAMMA1D}, + {0xa0, 0x03, ZC3XX_R13E_GAMMA1E}, + {0xa0, 0x02, ZC3XX_R13F_GAMMA1F}, + {0xa0, 0x50, ZC3XX_R10A_RGB00}, /* matrix */ + {0xa0, 0xf8, ZC3XX_R10B_RGB01}, + {0xa0, 0xf8, ZC3XX_R10C_RGB02}, + {0xa0, 0xf8, ZC3XX_R10D_RGB10}, + {0xa0, 0x50, ZC3XX_R10E_RGB11}, + {0xa0, 0xf8, ZC3XX_R10F_RGB12}, + {0xa0, 0xf8, ZC3XX_R110_RGB20}, + {0xa0, 0xf8, ZC3XX_R111_RGB21}, + {0xa0, 0x50, ZC3XX_R112_RGB22}, {0xa1, 0x01, 0x0180}, - {0xa0, 0x00, 0x0180}, - {0xa0, 0x00, 0x0180}, - {0xa0, 0x00, 0x0019}, + {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, {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, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, + {0xa0, 0x07, ZC3XX_R191_EXPOSURELIMITMID}, + {0xa0, 0xec, ZC3XX_R192_EXPOSURELIMITLOW}, + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, + {0xa0, 0x9c, ZC3XX_R197_ANTIFLICKERLOW}, + {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE}, + {0xa0, 0x1c, ZC3XX_R18F_AEUNFREEZE}, + {0xa0, 0x14, ZC3XX_R1A9_DIGITALLIMITDIFF}, + {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP}, + {0xa0, 0xd7, ZC3XX_R01D_HSYNC_0}, + {0xa0, 0xf4, ZC3XX_R01E_HSYNC_1}, + {0xa0, 0xf9, ZC3XX_R01F_HSYNC_2}, + {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, {0xa0, 0x09, 0x01ad}, {0xa0, 0x15, 0x01ae}, - {0xa0, 0x40, 0x0180}, + {0xa0, 0x40, ZC3XX_R180_AUTOCORRECTENABLE}, {0xa1, 0x01, 0x0180}, - {0xa0, 0x42, 0x0180}, + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, {} }; static const 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}, + {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* 00 */ + {0xa0, 0x0a, ZC3XX_R010_CMOSSENSORSELECT}, + {0xa0, 0x10, ZC3XX_R002_CLOCKSELECT}, + {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, + {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, + {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, + {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW}, + {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, + {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x07, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, + {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW}, + {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, + {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW}, + {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, {0xaa, 0x01, 0x0006}, {0xaa, 0x02, 0x0011}, {0xaa, 0x03, 0x01e7}, @@ -4710,79 +4724,79 @@ static const struct usb_action pb0330xx_Initial[] = { {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, 0x10, ZC3XX_R087_EXPTIMEMID}, + {0xa0, 0x37, ZC3XX_R101_SENSORCORRECTION}, + {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, + {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, {0xa0, 0x00, 0x01ad}, - {0xa0, 0x03, 0x01c5}, - {0xa0, 0x13, 0x01cb}, - {0xa0, 0x08, 0x0250}, - {0xa0, 0x08, 0x0301}, - {0xa0, 0x60, 0x01a8}, - {0xa0, 0x6c, 0x018d}, + {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, + {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, + {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, + {0xa0, 0x60, ZC3XX_R1A8_DIGITALGAIN}, + {0xa0, 0x6c, ZC3XX_R18D_YTARGET}, {0xa1, 0x01, 0x0002}, {0xa0, 0x09, 0x01ad}, {0xa0, 0x15, 0x01ae}, - {0xa0, 0x00, 0x0092}, - {0xa0, 0x02, 0x0090}, + {0xa0, 0x00, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x02, ZC3XX_R090_I2CCOMMAND}, {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}, + {0xa0, 0x50, ZC3XX_R10A_RGB00}, /* matrix */ + {0xa0, 0xf8, ZC3XX_R10B_RGB01}, + {0xa0, 0xf8, ZC3XX_R10C_RGB02}, + {0xa0, 0xf8, ZC3XX_R10D_RGB10}, + {0xa0, 0x50, ZC3XX_R10E_RGB11}, + {0xa0, 0xf8, ZC3XX_R10F_RGB12}, + {0xa0, 0xf8, ZC3XX_R110_RGB20}, + {0xa0, 0xf8, ZC3XX_R111_RGB21}, + {0xa0, 0x50, ZC3XX_R112_RGB22}, {0xa1, 0x01, 0x0008}, - {0xa0, 0x03, 0x0008}, /* clock ? */ - {0xa0, 0x08, 0x01c6}, /* sharpness+ */ + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* clock ? */ + {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */ {0xa1, 0x01, 0x01c8}, {0xa1, 0x01, 0x01c9}, {0xa1, 0x01, 0x01ca}, - {0xa0, 0x0f, 0x01cb}, /* sharpness- */ - - {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}, + {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */ + + {0xa0, 0x50, ZC3XX_R10A_RGB00}, /* matrix */ + {0xa0, 0xf8, ZC3XX_R10B_RGB01}, + {0xa0, 0xf8, ZC3XX_R10C_RGB02}, + {0xa0, 0xf8, ZC3XX_R10D_RGB10}, + {0xa0, 0x50, ZC3XX_R10E_RGB11}, + {0xa0, 0xf8, ZC3XX_R10F_RGB12}, + {0xa0, 0xf8, ZC3XX_R110_RGB20}, + {0xa0, 0xf8, ZC3XX_R111_RGB21}, + {0xa0, 0x50, ZC3XX_R112_RGB22}, {0xa1, 0x01, 0x0180}, - {0xa0, 0x00, 0x0180}, - {0xa0, 0x00, 0x0019}, + {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, {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, 0x60, ZC3XX_R11D_GLOBALGAIN}, + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, + {0xa0, 0x07, ZC3XX_R191_EXPOSURELIMITMID}, + {0xa0, 0x8c, ZC3XX_R192_EXPOSURELIMITLOW}, + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, + {0xa0, 0x8a, ZC3XX_R197_ANTIFLICKERLOW}, + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, + {0xa0, 0x14, ZC3XX_R1A9_DIGITALLIMITDIFF}, + {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP}, + {0xa0, 0xd7, ZC3XX_R01D_HSYNC_0}, + {0xa0, 0xf0, ZC3XX_R01E_HSYNC_1}, + {0xa0, 0xf8, ZC3XX_R01F_HSYNC_2}, + {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, {0xa0, 0x09, 0x01ad}, {0xa0, 0x15, 0x01ae}, - {0xa0, 0x40, 0x0180}, + {0xa0, 0x40, ZC3XX_R180_AUTOCORRECTENABLE}, {0xa1, 0x01, 0x0180}, - {0xa0, 0x42, 0x0180}, + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, {0xa1, 0x01, 0x0008}, {0xa1, 0x01, 0x0007}, /* {0xa0, 0x30, 0x0007}, */ @@ -4793,22 +4807,22 @@ static const struct usb_action pb0330xx_Initial[] = { static const 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}, + {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* 00 */ + {0xa0, 0x0a, ZC3XX_R010_CMOSSENSORSELECT}, + {0xa0, 0x00, ZC3XX_R002_CLOCKSELECT}, /* 10 */ + {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, + {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, + {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, + {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW}, + {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, + {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x07, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, + {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW}, + {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, + {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW}, + {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, {0xaa, 0x01, 0x0006}, {0xaa, 0x02, 0x0011}, {0xaa, 0x03, 0x01e7}, @@ -4825,78 +4839,78 @@ static const struct usb_action pb0330xx_InitialScale[] = { {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, 0x10, ZC3XX_R087_EXPTIMEMID}, + {0xa0, 0x37, ZC3XX_R101_SENSORCORRECTION}, + {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, + {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, {0xa0, 0x00, 0x01ad}, - {0xa0, 0x03, 0x01c5}, - {0xa0, 0x13, 0x01cb}, - {0xa0, 0x08, 0x0250}, - {0xa0, 0x08, 0x0301}, - {0xa0, 0x60, 0x01a8}, - {0xa0, 0x6c, 0x018d}, + {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, + {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, + {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, + {0xa0, 0x60, ZC3XX_R1A8_DIGITALGAIN}, + {0xa0, 0x6c, ZC3XX_R18D_YTARGET}, {0xa1, 0x01, 0x0002}, {0xa0, 0x09, 0x01ad}, {0xa0, 0x15, 0x01ae}, - {0xa0, 0x00, 0x0092}, - {0xa0, 0x02, 0x0090}, + {0xa0, 0x00, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x02, ZC3XX_R090_I2CCOMMAND}, {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}, + {0xa0, 0x50, ZC3XX_R10A_RGB00}, /* matrix */ + {0xa0, 0xf8, ZC3XX_R10B_RGB01}, + {0xa0, 0xf8, ZC3XX_R10C_RGB02}, + {0xa0, 0xf8, ZC3XX_R10D_RGB10}, + {0xa0, 0x50, ZC3XX_R10E_RGB11}, + {0xa0, 0xf8, ZC3XX_R10F_RGB12}, + {0xa0, 0xf8, ZC3XX_R110_RGB20}, + {0xa0, 0xf8, ZC3XX_R111_RGB21}, + {0xa0, 0x50, ZC3XX_R112_RGB22}, {0xa1, 0x01, 0x0008}, - {0xa0, 0x03, 0x0008}, /* clock ? */ - {0xa0, 0x08, 0x01c6}, /* sharpness+ */ + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* clock ? */ + {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */ {0xa1, 0x01, 0x01c8}, {0xa1, 0x01, 0x01c9}, {0xa1, 0x01, 0x01ca}, - {0xa0, 0x0f, 0x01cb}, /* sharpness- */ - - {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}, + {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */ + + {0xa0, 0x50, ZC3XX_R10A_RGB00}, /* matrix */ + {0xa0, 0xf8, ZC3XX_R10B_RGB01}, + {0xa0, 0xf8, ZC3XX_R10C_RGB02}, + {0xa0, 0xf8, ZC3XX_R10D_RGB10}, + {0xa0, 0x50, ZC3XX_R10E_RGB11}, + {0xa0, 0xf8, ZC3XX_R10F_RGB12}, + {0xa0, 0xf8, ZC3XX_R110_RGB20}, + {0xa0, 0xf8, ZC3XX_R111_RGB21}, + {0xa0, 0x50, ZC3XX_R112_RGB22}, {0xa1, 0x01, 0x0180}, - {0xa0, 0x00, 0x0180}, - {0xa0, 0x00, 0x0019}, + {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, {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, 0x60, ZC3XX_R11D_GLOBALGAIN}, + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, + {0xa0, 0x07, ZC3XX_R191_EXPOSURELIMITMID}, + {0xa0, 0x8c, ZC3XX_R192_EXPOSURELIMITLOW}, + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, + {0xa0, 0x8a, ZC3XX_R197_ANTIFLICKERLOW}, + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, + {0xa0, 0x14, ZC3XX_R1A9_DIGITALLIMITDIFF}, + {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP}, + {0xa0, 0xd7, ZC3XX_R01D_HSYNC_0}, + {0xa0, 0xf0, ZC3XX_R01E_HSYNC_1}, + {0xa0, 0xf8, ZC3XX_R01F_HSYNC_2}, + {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, {0xa0, 0x09, 0x01ad}, {0xa0, 0x15, 0x01ae}, - {0xa0, 0x40, 0x0180}, + {0xa0, 0x40, ZC3XX_R180_AUTOCORRECTENABLE}, {0xa1, 0x01, 0x0180}, - {0xa0, 0x42, 0x0180}, + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, {0xa1, 0x01, 0x0008}, {0xa1, 0x01, 0x0007}, /* {0xa0, 0x30, 0x0007}, */ @@ -4904,136 +4918,136 @@ static const struct usb_action pb0330xx_InitialScale[] = { {} }; static const 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 */ + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */ + {0xa0, 0x07, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,07,cc */ + {0xa0, 0xee, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,ee,cc */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */ + {0xa0, 0x46, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,46,cc */ + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */ + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,20,cc */ + {0xa0, 0x0c, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,0c,cc */ + {0xa0, 0x26, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,26,cc */ + {0xa0, 0x68, ZC3XX_R01D_HSYNC_0}, /* 00,1d,68,cc */ + {0xa0, 0x90, ZC3XX_R01E_HSYNC_1}, /* 00,1e,90,cc */ + {0xa0, 0xc8, ZC3XX_R01F_HSYNC_2}, /* 00,1f,c8,cc */ {} }; static const 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 */ + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */ + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */ + {0xa0, 0x07, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,07,cc */ + {0xa0, 0xa0, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,a0,cc */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */ + {0xa0, 0x7a, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,7a,cc */ + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */ + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,20,cc */ + {0xa0, 0x0c, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,0c,cc */ + {0xa0, 0x26, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,26,cc */ + {0xa0, 0xe5, ZC3XX_R01D_HSYNC_0}, /* 00,1d,e5,cc */ + {0xa0, 0xf0, ZC3XX_R01E_HSYNC_1}, /* 00,1e,f0,cc */ + {0xa0, 0xf8, ZC3XX_R01F_HSYNC_2}, /* 00,1f,f8,cc */ {} }; static const 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 */ + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */ + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */ + {0xa0, 0x07, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,07,cc */ + {0xa0, 0xdd, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,dd,cc */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */ + {0xa0, 0x3d, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,3d,cc */ + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */ + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,20,cc */ + {0xa0, 0x0c, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,0c,cc */ + {0xa0, 0x26, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,26,cc */ + {0xa0, 0x43, ZC3XX_R01D_HSYNC_0}, /* 00,1d,43,cc */ + {0xa0, 0x50, ZC3XX_R01E_HSYNC_1}, /* 00,1e,50,cc */ + {0xa0, 0x90, ZC3XX_R01F_HSYNC_2}, /* 00,1f,90,cc */ {} }; static const 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 */ + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */ + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */ + {0xa0, 0x07, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,07,cc */ + {0xa0, 0xa0, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,a0,cc */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */ + {0xa0, 0x7a, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,7a,cc */ + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */ + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,20,cc */ + {0xa0, 0x0c, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,0c,cc */ + {0xa0, 0x26, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,26,cc */ + {0xa0, 0x41, ZC3XX_R01D_HSYNC_0}, /* 00,1d,41,cc */ + {0xa0, 0x50, ZC3XX_R01E_HSYNC_1}, /* 00,1e,50,cc */ + {0xa0, 0x90, ZC3XX_R01F_HSYNC_2}, /* 00,1f,90,cc */ {} }; static const 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 */ + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */ + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */ + {0xa0, 0x07, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,07,cc */ + {0xa0, 0xf0, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,f0,cc */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */ + {0xa0, 0x10, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,10,cc */ + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */ + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,20,cc */ + {0xa0, 0x00, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,00,cc */ + {0xa0, 0x00, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,00,cc */ + {0xa0, 0x09, ZC3XX_R01D_HSYNC_0}, /* 00,1d,09,cc */ + {0xa0, 0x40, ZC3XX_R01E_HSYNC_1}, /* 00,1e,40,cc */ + {0xa0, 0x90, ZC3XX_R01F_HSYNC_2}, /* 00,1f,90,cc */ {} }; static const 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 */ + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 00,19,00,cc */ + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */ + {0xa0, 0x07, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,07,cc */ + {0xa0, 0xf0, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,f0,cc */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */ + {0xa0, 0x10, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,10,cc */ + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */ + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,20,cc */ + {0xa0, 0x00, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,00,cc */ + {0xa0, 0x00, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,00,cc */ + {0xa0, 0x09, ZC3XX_R01D_HSYNC_0}, /* 00,1d,09,cc */ + {0xa0, 0x40, ZC3XX_R01E_HSYNC_1}, /* 00,1e,40,cc */ + {0xa0, 0x90, ZC3XX_R01F_HSYNC_2}, /* 00,1f,90,cc */ {} }; /* from oem9.inf - HKR,%PO2030%,Initial - 640x480 - (close to CS2102) */ static const 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 */ + {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, /* 00,00,01,cc */ + {0xa0, 0x04, ZC3XX_R002_CLOCKSELECT}, /* 00,02,04,cc */ + {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,01,cc */ + {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, /* 00,01,01,cc */ + {0xa0, 0x04, ZC3XX_R080_HBLANKHIGH}, /* 00,80,04,cc */ + {0xa0, 0x05, ZC3XX_R081_HBLANKLOW}, /* 00,81,05,cc */ + {0xa0, 0x16, ZC3XX_R083_RGAINADDR}, /* 00,83,16,cc */ + {0xa0, 0x18, ZC3XX_R085_BGAINADDR}, /* 00,85,18,cc */ + {0xa0, 0x1a, ZC3XX_R086_EXPTIMEHIGH}, /* 00,86,1a,cc */ + {0xa0, 0x1b, ZC3XX_R087_EXPTIMEMID}, /* 00,87,1b,cc */ + {0xa0, 0x1c, ZC3XX_R088_EXPTIMELOW}, /* 00,88,1c,cc */ + {0xa0, 0xee, ZC3XX_R08B_I2CDEVICEADDR}, /* 00,8b,ee,cc */ + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* 00,08,03,cc */ + {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,03,cc */ + {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,01,cc */ + {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, /* 00,03,02,cc */ + {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, /* 00,04,80,cc */ + {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, /* 00,05,01,cc */ + {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW}, /* 00,06,e0,cc */ + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, /* 01,80,42,cc */ + {0xaa, 0x8d, 0x0008}, /* 00,8d,08,aa */ + {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, /* 00,98,00,cc */ + {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW}, /* 00,9a,00,cc */ + {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, /* 01,1a,00,cc */ + {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW}, /* 01,1c,00,cc */ + {0xa0, 0xe6, ZC3XX_R09C_WINHEIGHTLOW}, /* 00,9c,e6,cc */ + {0xa0, 0x86, ZC3XX_R09E_WINWIDTHLOW}, /* 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 */ @@ -5068,49 +5082,49 @@ static const struct usb_action PO2030_mode0[] = { {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, 0xf7, ZC3XX_R101_SENSORCORRECTION}, /* 01,01,f7,cc */ + {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,05,cc */ + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, /* 01,00,0d,cc */ + {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, /* 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 */ + {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, /* 01,c5,03,cc */ + {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, /* 01,cb,13,cc */ + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, /* 02,50,08,cc */ + {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, /* 03,01,08,cc */ + {0xa0, 0x7a, ZC3XX_R116_RGAIN}, /* 01,16,7a,cc */ + {0xa0, 0x4a, ZC3XX_R118_BGAIN}, /* 01,18,4a,cc */ {} }; /* from oem9.inf - HKR,%PO2030%,InitialScale - 320x240 */ static const 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 */ + {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, /* 00,00,01,cc */ + {0xa0, 0x10, ZC3XX_R002_CLOCKSELECT}, /* 00,02,10,cc */ + {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,01,cc */ + {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, /* 00,01,01,cc */ + {0xa0, 0x04, ZC3XX_R080_HBLANKHIGH}, /* 00,80,04,cc */ + {0xa0, 0x05, ZC3XX_R081_HBLANKLOW}, /* 00,81,05,cc */ + {0xa0, 0x16, ZC3XX_R083_RGAINADDR}, /* 00,83,16,cc */ + {0xa0, 0x18, ZC3XX_R085_BGAINADDR}, /* 00,85,18,cc */ + {0xa0, 0x1a, ZC3XX_R086_EXPTIMEHIGH}, /* 00,86,1a,cc */ + {0xa0, 0x1b, ZC3XX_R087_EXPTIMEMID}, /* 00,87,1b,cc */ + {0xa0, 0x1c, ZC3XX_R088_EXPTIMELOW}, /* 00,88,1c,cc */ + {0xa0, 0xee, ZC3XX_R08B_I2CDEVICEADDR}, /* 00,8b,ee,cc */ + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* 00,08,03,cc */ + {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,03,cc */ + {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,01,cc */ + {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, /* 00,03,02,cc */ + {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, /* 00,04,80,cc */ + {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, /* 00,05,01,cc */ + {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW}, /* 00,06,e0,cc */ + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, /* 01,80,42,cc */ + {0xaa, 0x8d, 0x0008}, /* 00,8d,08,aa */ + {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, /* 00,98,00,cc */ + {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW}, /* 00,9a,00,cc */ + {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, /* 01,1a,00,cc */ + {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW}, /* 01,1c,00,cc */ + {0xa0, 0xe8, ZC3XX_R09C_WINHEIGHTLOW}, /* 00,9c,e8,cc */ + {0xa0, 0x88, ZC3XX_R09E_WINWIDTHLOW}, /* 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 */ @@ -5145,17 +5159,17 @@ static const struct usb_action PO2030_mode1[] = { {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, 0xf7, ZC3XX_R101_SENSORCORRECTION}, /* 01,01,f7,cc */ + {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,05,cc */ + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, /* 01,00,0d,cc */ + {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, /* 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 */ + {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, /* 01,c5,03,cc */ + {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, /* 01,cb,13,cc */ + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, /* 02,50,08,cc */ + {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, /* 03,01,08,cc */ + {0xa0, 0x7a, ZC3XX_R116_RGAIN}, /* 01,16,7a,cc */ + {0xa0, 0x4a, ZC3XX_R118_BGAIN}, /* 01,18,4a,cc */ {} }; @@ -5164,20 +5178,20 @@ static const struct usb_action PO2030_50HZ[] = { {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 */ + {0xa0, 0x05, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,05,cc */ + {0xa0, 0x35, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,35,cc */ + {0xa0, 0x70, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,70,cc */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */ + {0xa0, 0x85, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,85,cc */ + {0xa0, 0x58, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,58,cc */ + {0xa0, 0x0c, ZC3XX_R18C_AEFREEZE}, /* 01,8c,0c,cc */ + {0xa0, 0x18, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,18,cc */ + {0xa0, 0x60, ZC3XX_R1A8_DIGITALGAIN}, /* 01,a8,60,cc */ + {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,10,cc */ + {0xa0, 0x22, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,22,cc */ + {0xa0, 0x88, ZC3XX_R18D_YTARGET}, /* 01,8d,88,cc */ + {0xa0, 0x58, ZC3XX_R11D_GLOBALGAIN}, /* 01,1d,58,cc */ + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, /* 01,80,42,cc */ {} }; @@ -5186,25 +5200,26 @@ static const struct usb_action PO2030_60HZ[] = { {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 */ + {0xa0, 0x08, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,08,cc */ + {0xa0, 0xae, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,ae,cc */ + {0xa0, 0x80, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,80,cc */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */ + {0xa0, 0x6f, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,6f,cc */ + {0xa0, 0x20, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,20,cc */ + {0xa0, 0x0c, ZC3XX_R18C_AEFREEZE}, /* 01,8c,0c,cc */ + {0xa0, 0x18, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,18,cc */ + {0xa0, 0x60, ZC3XX_R1A8_DIGITALGAIN}, /* 01,a8,60,cc */ + {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,10,cc */ + {0xa0, 0x22, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,22,cc */ + {0xa0, 0x88, ZC3XX_R18D_YTARGET}, /* 01,8d,88,cc */ + /* win: 01,8d,80 */ + {0xa0, 0x58, ZC3XX_R11D_GLOBALGAIN}, /* 01,1d,58,cc */ + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, /* 01,80,42,cc */ {} }; static const struct usb_action PO2030_NoFliker[] = { - {0xa0, 0x02, 0x0180}, /* 01,80,02,cc */ + {0xa0, 0x02, ZC3XX_R180_AUTOCORRECTENABLE}, /* 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 */ @@ -5216,756 +5231,759 @@ static const struct usb_action PO2030_NoFliker[] = { /* TEST */ static const struct usb_action tas5130CK_Initial[] = { - {0xa0, 0x01, 0x0000}, + {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, {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, 0x01, ZC3XX_R000_SYSTEMCONTROL}, + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, + {0xa0, 0x0a, ZC3XX_R010_CMOSSENSORSELECT}, + {0xa0, 0x10, ZC3XX_R002_CLOCKSELECT}, + {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, + {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, + {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, + {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW}, + {0xa0, 0xdc, ZC3XX_R08B_I2CDEVICEADDR}, + {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, + {0xa0, 0x07, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, + {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW}, + {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, + {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW}, + {0xa0, 0xdc, ZC3XX_R08B_I2CDEVICEADDR}, + {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x01, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x01, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x06, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x00, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x08, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x83, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x04, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x01, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x04, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x08, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x06, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x02, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x11, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x03, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0xE7, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x01, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x04, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x87, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x02, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x07, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x02, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x30, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x20, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x00, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x51, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x35, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x7F, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x30, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x05, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x31, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x00, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x58, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x78, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x62, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x11, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x04, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x2B, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x7f, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x2c, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x7f, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x2D, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x7f, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x2e, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x7f, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x10, ZC3XX_R087_EXPTIMEMID}, + {0xa0, 0xb7, ZC3XX_R101_SENSORCORRECTION}, + {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, + {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, {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, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, + {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, + {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, + {0xa0, 0x60, ZC3XX_R1A8_DIGITALGAIN}, + {0xa0, 0x6c, ZC3XX_R18D_YTARGET}, + {0xa0, 0x61, ZC3XX_R116_RGAIN}, + {0xa0, 0x65, ZC3XX_R118_BGAIN}, {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}, /* sharpness+ */ - {0xa0, 0x0f, 0x01cb}, /* sharpness- */ - {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, 0x4c, ZC3XX_R10A_RGB00}, /* matrix */ + {0xa0, 0xf1, ZC3XX_R10B_RGB01}, + {0xa0, 0x03, ZC3XX_R10C_RGB02}, + {0xa0, 0xfe, ZC3XX_R10D_RGB10}, + {0xa0, 0x51, ZC3XX_R10E_RGB11}, + {0xa0, 0xf1, ZC3XX_R10F_RGB12}, + {0xa0, 0xec, ZC3XX_R110_RGB20}, + {0xa0, 0x03, ZC3XX_R111_RGB21}, + {0xa0, 0x51, ZC3XX_R112_RGB22}, + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, + {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */ + {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */ + {0xa0, 0x38, ZC3XX_R120_GAMMA00}, /* gamma > 5 */ + {0xa0, 0x51, ZC3XX_R121_GAMMA01}, + {0xa0, 0x6e, ZC3XX_R122_GAMMA02}, + {0xa0, 0x8c, ZC3XX_R123_GAMMA03}, + {0xa0, 0xa2, ZC3XX_R124_GAMMA04}, + {0xa0, 0xb6, ZC3XX_R125_GAMMA05}, + {0xa0, 0xc8, ZC3XX_R126_GAMMA06}, + {0xa0, 0xd6, ZC3XX_R127_GAMMA07}, + {0xa0, 0xe2, ZC3XX_R128_GAMMA08}, + {0xa0, 0xed, ZC3XX_R129_GAMMA09}, + {0xa0, 0xf5, ZC3XX_R12A_GAMMA0A}, + {0xa0, 0xfc, ZC3XX_R12B_GAMMA0B}, + {0xa0, 0xff, ZC3XX_R12C_GAMMA0C}, + {0xa0, 0xff, ZC3XX_R12D_GAMMA0D}, + {0xa0, 0xff, ZC3XX_R12E_GAMMA0E}, + {0xa0, 0xff, ZC3XX_R12F_GAMMA0F}, + {0xa0, 0x12, ZC3XX_R130_GAMMA10}, + {0xa0, 0x1b, ZC3XX_R131_GAMMA11}, + {0xa0, 0x1d, ZC3XX_R132_GAMMA12}, + {0xa0, 0x1a, ZC3XX_R133_GAMMA13}, + {0xa0, 0x15, ZC3XX_R134_GAMMA14}, + {0xa0, 0x12, ZC3XX_R135_GAMMA15}, + {0xa0, 0x0f, ZC3XX_R136_GAMMA16}, + {0xa0, 0x0d, ZC3XX_R137_GAMMA17}, + {0xa0, 0x0b, ZC3XX_R138_GAMMA18}, + {0xa0, 0x09, ZC3XX_R139_GAMMA19}, + {0xa0, 0x07, ZC3XX_R13A_GAMMA1A}, + {0xa0, 0x05, ZC3XX_R13B_GAMMA1B}, + {0xa0, 0x00, ZC3XX_R13C_GAMMA1C}, + {0xa0, 0x00, ZC3XX_R13D_GAMMA1D}, + {0xa0, 0x00, ZC3XX_R13E_GAMMA1E}, + {0xa0, 0x01, ZC3XX_R13F_GAMMA1F}, + {0xa0, 0x4c, ZC3XX_R10A_RGB00}, /* matrix */ + {0xa0, 0xf1, ZC3XX_R10B_RGB01}, + {0xa0, 0x03, ZC3XX_R10C_RGB02}, + {0xa0, 0xfe, ZC3XX_R10D_RGB10}, + {0xa0, 0x51, ZC3XX_R10E_RGB11}, + {0xa0, 0xf1, ZC3XX_R10F_RGB12}, + {0xa0, 0xec, ZC3XX_R110_RGB20}, + {0xa0, 0x03, ZC3XX_R111_RGB21}, + {0xa0, 0x51, ZC3XX_R112_RGB22}, + {0xa0, 0x10, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, + {0xa0, 0x05, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x09, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x09, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x34, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x01, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, + {0xa0, 0x07, ZC3XX_R191_EXPOSURELIMITMID}, + {0xa0, 0xd2, ZC3XX_R192_EXPOSURELIMITLOW}, + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, + {0xa0, 0x9a, ZC3XX_R197_ANTIFLICKERLOW}, + {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE}, + {0xa0, 0x1c, ZC3XX_R18F_AEUNFREEZE}, + {0xa0, 0x14, ZC3XX_R1A9_DIGITALLIMITDIFF}, + {0xa0, 0x66, ZC3XX_R1AA_DIGITALGAINSTEP}, + {0xa0, 0xd7, ZC3XX_R01D_HSYNC_0}, + {0xa0, 0xf4, ZC3XX_R01E_HSYNC_1}, + {0xa0, 0xf9, ZC3XX_R01F_HSYNC_2}, + {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, {0xa0, 0x09, 0x01ad}, {0xa0, 0x15, 0x01ae}, - {0xa0, 0x40, 0x0180}, - {0xa0, 0x42, 0x0180}, + {0xa0, 0x40, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, {} }; static const struct usb_action tas5130CK_InitialScale[] = { - {0xa0, 0x01, 0x0000}, + {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, {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, 0x01, ZC3XX_R000_SYSTEMCONTROL}, + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, + {0xa0, 0x0a, ZC3XX_R010_CMOSSENSORSELECT}, + {0xa0, 0x00, ZC3XX_R002_CLOCKSELECT}, + {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, + {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, + {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, + {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW}, + {0xa0, 0xdc, ZC3XX_R08B_I2CDEVICEADDR}, + {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, + {0xa0, 0x07, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, + {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW}, + {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, + {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW}, + {0xa0, 0xdc, ZC3XX_R08B_I2CDEVICEADDR}, + {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x01, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x01, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x06, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x00, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x08, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x83, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x04, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x01, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x04, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x08, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x06, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x02, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x11, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x03, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0xe5, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x01, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x04, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x85, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x02, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x07, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x02, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x30, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x20, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x00, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x51, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x35, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x7F, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x50, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x30, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x05, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x31, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x00, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x58, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x78, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x62, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x11, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x04, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x2B, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x7f, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x2C, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x7F, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x2D, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x7f, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x2e, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x7f, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x10, ZC3XX_R087_EXPTIMEMID}, + {0xa0, 0xb7, ZC3XX_R101_SENSORCORRECTION}, + {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, + {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, {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, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, + {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, + {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, + {0xa0, 0x60, ZC3XX_R1A8_DIGITALGAIN}, + {0xa0, 0x6c, ZC3XX_R18D_YTARGET}, + {0xa0, 0x61, ZC3XX_R116_RGAIN}, + {0xa0, 0x65, ZC3XX_R118_BGAIN}, {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}, /* sharpness+ */ - {0xa0, 0x0f, 0x01cb}, /* sharpness- */ - {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, 0x4c, ZC3XX_R10A_RGB00}, /* matrix */ + {0xa0, 0xf1, ZC3XX_R10B_RGB01}, + {0xa0, 0x03, ZC3XX_R10C_RGB02}, + {0xa0, 0xfe, ZC3XX_R10D_RGB10}, + {0xa0, 0x51, ZC3XX_R10E_RGB11}, + {0xa0, 0xf1, ZC3XX_R10F_RGB12}, + {0xa0, 0xec, ZC3XX_R110_RGB20}, + {0xa0, 0x03, ZC3XX_R111_RGB21}, + {0xa0, 0x51, ZC3XX_R112_RGB22}, + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, + {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */ + {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */ + {0xa0, 0x38, ZC3XX_R120_GAMMA00}, /* gamma > 5 */ + {0xa0, 0x51, ZC3XX_R121_GAMMA01}, + {0xa0, 0x6e, ZC3XX_R122_GAMMA02}, + {0xa0, 0x8c, ZC3XX_R123_GAMMA03}, + {0xa0, 0xa2, ZC3XX_R124_GAMMA04}, + {0xa0, 0xb6, ZC3XX_R125_GAMMA05}, + {0xa0, 0xc8, ZC3XX_R126_GAMMA06}, + {0xa0, 0xd6, ZC3XX_R127_GAMMA07}, + {0xa0, 0xe2, ZC3XX_R128_GAMMA08}, + {0xa0, 0xed, ZC3XX_R129_GAMMA09}, + {0xa0, 0xf5, ZC3XX_R12A_GAMMA0A}, + {0xa0, 0xfc, ZC3XX_R12B_GAMMA0B}, + {0xa0, 0xff, ZC3XX_R12C_GAMMA0C}, + {0xa0, 0xff, ZC3XX_R12D_GAMMA0D}, + {0xa0, 0xff, ZC3XX_R12E_GAMMA0E}, + {0xa0, 0xff, ZC3XX_R12F_GAMMA0F}, + {0xa0, 0x12, ZC3XX_R130_GAMMA10}, + {0xa0, 0x1b, ZC3XX_R131_GAMMA11}, + {0xa0, 0x1d, ZC3XX_R132_GAMMA12}, + {0xa0, 0x1a, ZC3XX_R133_GAMMA13}, + {0xa0, 0x15, ZC3XX_R134_GAMMA14}, + {0xa0, 0x12, ZC3XX_R135_GAMMA15}, + {0xa0, 0x0f, ZC3XX_R136_GAMMA16}, + {0xa0, 0x0d, ZC3XX_R137_GAMMA17}, + {0xa0, 0x0b, ZC3XX_R138_GAMMA18}, + {0xa0, 0x09, ZC3XX_R139_GAMMA19}, + {0xa0, 0x07, ZC3XX_R13A_GAMMA1A}, + {0xa0, 0x05, ZC3XX_R13B_GAMMA1B}, + {0xa0, 0x00, ZC3XX_R13C_GAMMA1C}, + {0xa0, 0x00, ZC3XX_R13D_GAMMA1D}, + {0xa0, 0x00, ZC3XX_R13E_GAMMA1E}, + {0xa0, 0x01, ZC3XX_R13F_GAMMA1F}, + {0xa0, 0x4c, ZC3XX_R10A_RGB00}, /* matrix */ + {0xa0, 0xf1, ZC3XX_R10B_RGB01}, + {0xa0, 0x03, ZC3XX_R10C_RGB02}, + {0xa0, 0xfe, ZC3XX_R10D_RGB10}, + {0xa0, 0x51, ZC3XX_R10E_RGB11}, + {0xa0, 0xf1, ZC3XX_R10F_RGB12}, + {0xa0, 0xec, ZC3XX_R110_RGB20}, + {0xa0, 0x03, ZC3XX_R111_RGB21}, + {0xa0, 0x51, ZC3XX_R112_RGB22}, + {0xa0, 0x10, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, + {0xa0, 0x05, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0x62, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x00, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x09, ZC3XX_R092_I2CADDRESSSELECT}, + {0xa0, 0xaa, ZC3XX_R093_I2CSETVALUE}, + {0xa0, 0x01, ZC3XX_R094_I2CWRITEACK}, + {0xa0, 0x01, ZC3XX_R090_I2CCOMMAND}, + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, + {0xa0, 0x03, ZC3XX_R191_EXPOSURELIMITMID}, + {0xa0, 0x9b, ZC3XX_R192_EXPOSURELIMITLOW}, + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, + {0xa0, 0x47, ZC3XX_R197_ANTIFLICKERLOW}, + {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE}, + {0xa0, 0x1c, ZC3XX_R18F_AEUNFREEZE}, + {0xa0, 0x14, ZC3XX_R1A9_DIGITALLIMITDIFF}, + {0xa0, 0x66, ZC3XX_R1AA_DIGITALGAINSTEP}, + {0xa0, 0x62, ZC3XX_R01D_HSYNC_0}, + {0xa0, 0x90, ZC3XX_R01E_HSYNC_1}, + {0xa0, 0xc8, ZC3XX_R01F_HSYNC_2}, + {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, + {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN}, + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, {0xa0, 0x09, 0x01ad}, {0xa0, 0x15, 0x01ae}, - {0xa0, 0x40, 0x0180}, - {0xa0, 0x42, 0x0180}, + {0xa0, 0x40, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, {0xa0, 0x30, 0x0007}, - {0xa0, 0x02, 0x0008}, + {0xa0, 0x02, ZC3XX_R008_CLOCKSETTING}, {0xa0, 0x00, 0x0007}, - {0xa0, 0x03, 0x0008}, + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, {} }; static const 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, 0x01, ZC3XX_R000_SYSTEMCONTROL}, + {0xa0, 0x50, ZC3XX_R002_CLOCKSELECT}, + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, + {0xa0, 0x02, ZC3XX_R010_CMOSSENSORSELECT}, + {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, + {0xa0, 0x00, ZC3XX_R001_SYSTEMOPERATING}, + {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, + {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x07, ZC3XX_R0A5_EXPOSUREGAIN}, + {0xa0, 0x02, ZC3XX_R0A6_EXPOSUREBLACKLVL}, + + {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, + {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, + {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, + {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW}, + + {0xa0, 0x04, ZC3XX_R098_WINYSTARTLOW}, + {0xa0, 0x0f, ZC3XX_R09A_WINXSTARTLOW}, + {0xa0, 0x04, ZC3XX_R11A_FIRSTYLOW}, + {0xa0, 0x0f, ZC3XX_R11C_FIRSTXLOW}, + {0xa0, 0xe8, ZC3XX_R09C_WINHEIGHTLOW}, + {0xa0, 0x02, ZC3XX_R09D_WINWIDTHHIGH}, + {0xa0, 0x88, ZC3XX_R09E_WINWIDTHLOW}, + {0xa0, 0x06, ZC3XX_R08D_COMPABILITYMODE}, + {0xa0, 0xf7, ZC3XX_R101_SENSORCORRECTION}, + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, + {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, + {0xa0, 0x68, ZC3XX_R18D_YTARGET}, + {0xa0, 0x60, ZC3XX_R1A8_DIGITALGAIN}, {0xa0, 0x00, 0x01ad}, - {0xa0, 0x03, 0x01c5}, - {0xa0, 0x13, 0x01cb}, - {0xa0, 0x08, 0x0250}, - {0xa0, 0x08, 0x0301}, + {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, + {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, + {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, {0xa1, 0x01, 0x0002}, {0xa1, 0x01, 0x0008}, - {0xa0, 0x03, 0x0008}, /* clock ? */ - {0xa0, 0x08, 0x01c6}, /* sharpness+ */ + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* clock ? */ + {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */ {0xa1, 0x01, 0x01c8}, {0xa1, 0x01, 0x01c9}, {0xa1, 0x01, 0x01ca}, - {0xa0, 0x0f, 0x01cb}, /* sharpness- */ - - {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}, + {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */ + + {0xa0, 0x68, ZC3XX_R10A_RGB00}, /* matrix */ + {0xa0, 0xec, ZC3XX_R10B_RGB01}, + {0xa0, 0xec, ZC3XX_R10C_RGB02}, + {0xa0, 0xec, ZC3XX_R10D_RGB10}, + {0xa0, 0x68, ZC3XX_R10E_RGB11}, + {0xa0, 0xec, ZC3XX_R10F_RGB12}, + {0xa0, 0xec, ZC3XX_R110_RGB20}, + {0xa0, 0xec, ZC3XX_R111_RGB21}, + {0xa0, 0x68, ZC3XX_R112_RGB22}, {0xa1, 0x01, 0x018d}, - {0xa0, 0x90, 0x018d}, /* 90 */ + {0xa0, 0x90, ZC3XX_R18D_YTARGET}, /* 90 */ {0xa1, 0x01, 0x0180}, - {0xa0, 0x00, 0x0180}, - {0xa0, 0x00, 0x0019}, + {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, {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}, + {0xa0, 0x01, ZC3XX_R0A3_EXPOSURETIMEHIGH}, + {0xa0, 0x77, ZC3XX_R0A4_EXPOSURETIMELOW}, + + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 00 */ + {0xa0, 0x03, ZC3XX_R191_EXPOSURELIMITMID}, /* 03 */ + {0xa0, 0xe8, ZC3XX_R192_EXPOSURELIMITLOW}, /* e8 */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 0 */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 0 */ + {0xa0, 0x7d, ZC3XX_R197_ANTIFLICKERLOW}, /* 7d */ + + {0xa0, 0x0c, ZC3XX_R18C_AEFREEZE}, + {0xa0, 0x18, ZC3XX_R18F_AEUNFREEZE}, + {0xa0, 0x08, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 08 */ + {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 24 */ + {0xa0, 0xf0, ZC3XX_R01D_HSYNC_0}, + {0xa0, 0xf4, ZC3XX_R01E_HSYNC_1}, + {0xa0, 0xf8, ZC3XX_R01F_HSYNC_2}, + {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, + {0xa0, 0x03, ZC3XX_R09F_MAXXHIGH}, + {0xa0, 0xc0, ZC3XX_R0A0_MAXXLOW}, + {0xa0, 0x50, ZC3XX_R11D_GLOBALGAIN}, /* 50 */ + {0xa0, 0x40, ZC3XX_R180_AUTOCORRECTENABLE}, {0xa1, 0x01, 0x0180}, - {0xa0, 0x42, 0x0180}, + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, {} }; static const struct usb_action tas5130cxx_InitialScale[] = { - {0xa0, 0x01, 0x0000}, - {0xa0, 0x01, 0x0000}, - {0xa0, 0x40, 0x0002}, + {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, + {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, + {0xa0, 0x40, ZC3XX_R002_CLOCKSELECT}, - {0xa0, 0x03, 0x0008}, + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, {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, 0x02, ZC3XX_R010_CMOSSENSORSELECT}, + {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, + {0xa0, 0x00, ZC3XX_R001_SYSTEMOPERATING}, + {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, + {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x07, ZC3XX_R0A5_EXPOSUREGAIN}, + {0xa0, 0x02, ZC3XX_R0A6_EXPOSUREBLACKLVL}, + {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, + {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, + {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, + {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW}, + {0xa0, 0x05, ZC3XX_R098_WINYSTARTLOW}, + {0xa0, 0x0f, ZC3XX_R09A_WINXSTARTLOW}, + {0xa0, 0x05, ZC3XX_R11A_FIRSTYLOW}, + {0xa0, 0x0f, ZC3XX_R11C_FIRSTXLOW}, + {0xa0, 0xe6, ZC3XX_R09C_WINHEIGHTLOW}, + {0xa0, 0x02, ZC3XX_R09D_WINWIDTHHIGH}, + {0xa0, 0x86, ZC3XX_R09E_WINWIDTHLOW}, + {0xa0, 0x06, ZC3XX_R08D_COMPABILITYMODE}, + {0xa0, 0x37, ZC3XX_R101_SENSORCORRECTION}, + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, + {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, + {0xa0, 0x68, ZC3XX_R18D_YTARGET}, + {0xa0, 0x60, ZC3XX_R1A8_DIGITALGAIN}, {0xa0, 0x00, 0x01ad}, - {0xa0, 0x03, 0x01c5}, - {0xa0, 0x13, 0x01cb}, - {0xa0, 0x08, 0x0250}, - {0xa0, 0x08, 0x0301}, + {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, + {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, + {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, {0xa1, 0x01, 0x0002}, {0xa1, 0x01, 0x0008}, - {0xa0, 0x03, 0x0008}, + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, {0xa1, 0x01, 0x0008}, /* clock ? */ - {0xa0, 0x08, 0x01c6}, /* sharpness+ */ + {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, /* sharpness+ */ {0xa1, 0x01, 0x01c8}, {0xa1, 0x01, 0x01c9}, {0xa1, 0x01, 0x01ca}, - {0xa0, 0x0f, 0x01cb}, /* sharpness- */ - - {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}, + {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* sharpness- */ + + {0xa0, 0x68, ZC3XX_R10A_RGB00}, /* matrix */ + {0xa0, 0xec, ZC3XX_R10B_RGB01}, + {0xa0, 0xec, ZC3XX_R10C_RGB02}, + {0xa0, 0xec, ZC3XX_R10D_RGB10}, + {0xa0, 0x68, ZC3XX_R10E_RGB11}, + {0xa0, 0xec, ZC3XX_R10F_RGB12}, + {0xa0, 0xec, ZC3XX_R110_RGB20}, + {0xa0, 0xec, ZC3XX_R111_RGB21}, + {0xa0, 0x68, ZC3XX_R112_RGB22}, {0xa1, 0x01, 0x018d}, - {0xa0, 0x90, 0x018d}, + {0xa0, 0x90, ZC3XX_R18D_YTARGET}, {0xa1, 0x01, 0x0180}, - {0xa0, 0x00, 0x0180}, - {0xa0, 0x00, 0x0019}, + {0xa0, 0x00, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, {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}, + {0xa0, 0x01, ZC3XX_R0A3_EXPOSURETIMEHIGH}, + {0xa0, 0x63, ZC3XX_R0A4_EXPOSURETIMELOW}, + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, + {0xa0, 0x02, ZC3XX_R191_EXPOSURELIMITMID}, + {0xa0, 0x38, ZC3XX_R192_EXPOSURELIMITLOW}, + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, + {0xa0, 0x47, ZC3XX_R197_ANTIFLICKERLOW}, + {0xa0, 0x0c, ZC3XX_R18C_AEFREEZE}, + {0xa0, 0x18, ZC3XX_R18F_AEUNFREEZE}, + {0xa0, 0x08, ZC3XX_R1A9_DIGITALLIMITDIFF}, + {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP}, + {0xa0, 0xd3, ZC3XX_R01D_HSYNC_0}, + {0xa0, 0xda, ZC3XX_R01E_HSYNC_1}, + {0xa0, 0xea, ZC3XX_R01F_HSYNC_2}, + {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, + {0xa0, 0x03, ZC3XX_R09F_MAXXHIGH}, + {0xa0, 0x4c, ZC3XX_R0A0_MAXXLOW}, + {0xa0, 0x50, ZC3XX_R11D_GLOBALGAIN}, + {0xa0, 0x40, ZC3XX_R180_AUTOCORRECTENABLE}, {0xa1, 0x01, 0x0180}, - {0xa0, 0x42, 0x0180}, + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, {} }; static const struct usb_action tas5130cxx_50HZ[] = { - {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 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 */ + {0xa0, 0x01, ZC3XX_R0A3_EXPOSURETIMEHIGH}, /* 00,a3,01,cc */ + {0xa0, 0x63, ZC3XX_R0A4_EXPOSURETIMELOW}, /* 00,a4,63,cc */ + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */ + {0xa0, 0x02, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,02,cc */ + {0xa0, 0x38, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,38,cc */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */ + {0xa0, 0x47, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,47,cc */ + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */ + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,20,cc */ + {0xa0, 0x0c, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,0c,cc */ + {0xa0, 0x26, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,26,cc */ + {0xa0, 0xd3, ZC3XX_R01D_HSYNC_0}, /* 00,1d,d3,cc */ + {0xa0, 0xda, ZC3XX_R01E_HSYNC_1}, /* 00,1e,da,cc */ + {0xa0, 0xea, ZC3XX_R01F_HSYNC_2}, /* 00,1f,ea,cc */ + {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc */ + {0xa0, 0x03, ZC3XX_R09F_MAXXHIGH}, /* 00,9f,03,cc */ {} }; static const struct usb_action tas5130cxx_50HZScale[] = { - {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 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 */ + {0xa0, 0x01, ZC3XX_R0A3_EXPOSURETIMEHIGH}, /* 00,a3,01,cc */ + {0xa0, 0x77, ZC3XX_R0A4_EXPOSURETIMELOW}, /* 00,a4,77,cc */ + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */ + {0xa0, 0x03, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,03,cc */ + {0xa0, 0xe8, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,e8,cc */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */ + {0xa0, 0x7d, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,7d,cc */ + {0xa0, 0x14, ZC3XX_R18C_AEFREEZE}, /* 01,8c,14,cc */ + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,20,cc */ + {0xa0, 0x0c, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,0c,cc */ + {0xa0, 0x26, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,26,cc */ + {0xa0, 0xf0, ZC3XX_R01D_HSYNC_0}, /* 00,1d,f0,cc */ + {0xa0, 0xf4, ZC3XX_R01E_HSYNC_1}, /* 00,1e,f4,cc */ + {0xa0, 0xf8, ZC3XX_R01F_HSYNC_2}, /* 00,1f,f8,cc */ + {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc */ + {0xa0, 0x03, ZC3XX_R09F_MAXXHIGH}, /* 00,9f,03,cc */ {} }; static const struct usb_action tas5130cxx_60HZ[] = { - {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 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 */ + {0xa0, 0x01, ZC3XX_R0A3_EXPOSURETIMEHIGH}, /* 00,a3,01,cc */ + {0xa0, 0x36, ZC3XX_R0A4_EXPOSURETIMELOW}, /* 00,a4,36,cc */ + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */ + {0xa0, 0x01, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,01,cc */ + {0xa0, 0xf0, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,f0,cc */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */ + {0xa0, 0x3e, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,3e,cc */ + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */ + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,20,cc */ + {0xa0, 0x0c, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,0c,cc */ + {0xa0, 0x26, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,26,cc */ + {0xa0, 0xca, ZC3XX_R01D_HSYNC_0}, /* 00,1d,ca,cc */ + {0xa0, 0xd0, ZC3XX_R01E_HSYNC_1}, /* 00,1e,d0,cc */ + {0xa0, 0xe0, ZC3XX_R01F_HSYNC_2}, /* 00,1f,e0,cc */ + {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc */ + {0xa0, 0x03, ZC3XX_R09F_MAXXHIGH}, /* 00,9f,03,cc */ {} }; static const struct usb_action tas5130cxx_60HZScale[] = { - {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 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 */ + {0xa0, 0x01, ZC3XX_R0A3_EXPOSURETIMEHIGH}, /* 00,a3,01,cc */ + {0xa0, 0x77, ZC3XX_R0A4_EXPOSURETIMELOW}, /* 00,a4,77,cc */ + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */ + {0xa0, 0x03, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,03,cc */ + {0xa0, 0xe8, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,e8,cc */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */ + {0xa0, 0x7d, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,7d,cc */ + {0xa0, 0x14, ZC3XX_R18C_AEFREEZE}, /* 01,8c,14,cc */ + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,20,cc */ + {0xa0, 0x0c, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,0c,cc */ + {0xa0, 0x26, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,26,cc */ + {0xa0, 0xc8, ZC3XX_R01D_HSYNC_0}, /* 00,1d,c8,cc */ + {0xa0, 0xd0, ZC3XX_R01E_HSYNC_1}, /* 00,1e,d0,cc */ + {0xa0, 0xe0, ZC3XX_R01F_HSYNC_2}, /* 00,1f,e0,cc */ + {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc */ + {0xa0, 0x03, ZC3XX_R09F_MAXXHIGH}, /* 00,9f,03,cc */ {} }; static const struct usb_action tas5130cxx_NoFliker[] = { - {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 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 */ + {0xa0, 0x01, ZC3XX_R0A3_EXPOSURETIMEHIGH}, /* 00,a3,01,cc */ + {0xa0, 0x40, ZC3XX_R0A4_EXPOSURETIMELOW}, /* 00,a4,40,cc */ + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */ + {0xa0, 0x01, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,01,cc */ + {0xa0, 0xf0, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,f0,cc */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */ + {0xa0, 0x10, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,10,cc */ + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */ + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,20,cc */ + {0xa0, 0x00, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,00,cc */ + {0xa0, 0x00, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,00,cc */ + {0xa0, 0xbc, ZC3XX_R01D_HSYNC_0}, /* 00,1d,bc,cc */ + {0xa0, 0xd0, ZC3XX_R01E_HSYNC_1}, /* 00,1e,d0,cc */ + {0xa0, 0xe0, ZC3XX_R01F_HSYNC_2}, /* 00,1f,e0,cc */ + {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc */ + {0xa0, 0x02, ZC3XX_R09F_MAXXHIGH}, /* 00,9f,02,cc */ {} }; static const struct usb_action tas5130cxx_NoFlikerScale[] = { - {0xa0, 0x00, 0x0019}, /* 00,19,00,cc */ + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* 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 */ + {0xa0, 0x01, ZC3XX_R0A3_EXPOSURETIMEHIGH}, /* 00,a3,01,cc */ + {0xa0, 0x90, ZC3XX_R0A4_EXPOSURETIMELOW}, /* 00,a4,90,cc */ + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc */ + {0xa0, 0x03, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,03,cc */ + {0xa0, 0xf0, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,f0,cc */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc */ + {0xa0, 0x10, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,10,cc */ + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, /* 01,8c,10,cc */ + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,20,cc */ + {0xa0, 0x00, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,00,cc */ + {0xa0, 0x00, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,00,cc */ + {0xa0, 0xbc, ZC3XX_R01D_HSYNC_0}, /* 00,1d,bc,cc */ + {0xa0, 0xd0, ZC3XX_R01E_HSYNC_1}, /* 00,1e,d0,cc */ + {0xa0, 0xe0, ZC3XX_R01F_HSYNC_2}, /* 00,1f,e0,cc */ + {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc */ + {0xa0, 0x02, ZC3XX_R09F_MAXXHIGH}, /* 00,9f,02,cc */ {} }; static const 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, */ + {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, /* 00,00,01,cc, */ + {0xa0, 0x02, ZC3XX_R008_CLOCKSETTING}, /* 00,08,02,cc, */ + {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,01,cc, */ + {0xa0, 0x10, ZC3XX_R002_CLOCKSELECT}, /* 00,02,00,cc, + * 0<->10 */ + {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, /* 00,03,02,cc, */ + {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, /* 00,04,80,cc, */ + {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, /* 00,05,01,cc, */ + {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW}, /* 00,06,e0,cc, */ + {0xa0, 0x98, ZC3XX_R08B_I2CDEVICEADDR}, /* 00,8b,98,cc, */ + {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, /* 00,01,01,cc, */ + {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,03,cc, */ + {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,01,cc, */ + {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, /* 00,98,00,cc, */ + {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW}, /* 00,9a,00,cc, */ + {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, /* 01,1a,00,cc, */ + {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW}, /* 01,1c,00,cc, */ + {0xa0, 0xe8, ZC3XX_R09C_WINHEIGHTLOW}, /* 00,9c,e6,cc, + * 6<->8 */ + {0xa0, 0x88, ZC3XX_R09E_WINWIDTHLOW}, /* 00,9e,86,cc, + * 6<->8 */ + {0xa0, 0x10, ZC3XX_R087_EXPTIMEMID}, /* 00,87,10,cc, */ + {0xa0, 0x98, ZC3XX_R08B_I2CDEVICEADDR}, /* 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, */ @@ -5975,9 +5993,9 @@ static const struct usb_action tas5130c_vf0250_Initial[] = { {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, */ + {0xa0, 0x82, ZC3XX_R086_EXPTIMEHIGH}, /* 00,86,82,cc, */ + {0xa0, 0x83, ZC3XX_R087_EXPTIMEMID}, /* 00,87,83,cc, */ + {0xa0, 0x84, ZC3XX_R088_EXPTIMELOW}, /* 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, */ @@ -5994,42 +6012,44 @@ static const struct usb_action tas5130c_vf0250_Initial[] = { {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 */ + {0xa0, 0xb7, ZC3XX_R101_SENSORCORRECTION}, /* 01,01,b7,cc, */ + {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,05,cc, */ + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, /* 01,00,0d,cc, */ + {0xa0, 0x76, ZC3XX_R189_AWBSTATUS}, /* 01,89,76,cc, */ + {0xa0, 0x09, 0x01ad}, /* 01,ad,09,cc, */ + {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, /* 01,c5,03,cc, */ + {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, /* 01,cb,13,cc, */ + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, /* 02,50,08,cc, */ + {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, /* 03,01,08,cc, */ + {0xa0, 0x60, ZC3XX_R1A8_DIGITALGAIN}, /* 01,a8,60,cc, */ + {0xa0, 0x61, ZC3XX_R116_RGAIN}, /* 01,16,61,cc, */ + {0xa0, 0x65, ZC3XX_R118_BGAIN}, /* 01,18,65,cc */ {} }; static const 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, */ + {0xa0, 0x01, ZC3XX_R000_SYSTEMCONTROL}, /* 00,00,01,cc, */ + {0xa0, 0x02, ZC3XX_R008_CLOCKSETTING}, /* 00,08,02,cc, */ + {0xa0, 0x01, ZC3XX_R010_CMOSSENSORSELECT}, /* 00,10,01,cc, */ + {0xa0, 0x00, ZC3XX_R002_CLOCKSELECT}, /* 00,02,10,cc, */ + {0xa0, 0x02, ZC3XX_R003_FRAMEWIDTHHIGH}, /* 00,03,02,cc, */ + {0xa0, 0x80, ZC3XX_R004_FRAMEWIDTHLOW}, /* 00,04,80,cc, */ + {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, /* 00,05,01,cc, */ + {0xa0, 0xe0, ZC3XX_R006_FRAMEHEIGHTLOW}, /* 00,06,e0,cc, */ + {0xa0, 0x98, ZC3XX_R08B_I2CDEVICEADDR}, /* 00,8b,98,cc, */ + {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, /* 00,01,01,cc, */ + {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,03,cc, */ + {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,01,cc, */ + {0xa0, 0x00, ZC3XX_R098_WINYSTARTLOW}, /* 00,98,00,cc, */ + {0xa0, 0x00, ZC3XX_R09A_WINXSTARTLOW}, /* 00,9a,00,cc, */ + {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, /* 01,1a,00,cc, */ + {0xa0, 0x00, ZC3XX_R11C_FIRSTXLOW}, /* 01,1c,00,cc, */ + {0xa0, 0xe8, ZC3XX_R09C_WINHEIGHTLOW}, /* 00,9c,e8,cc, + * 8<->6 */ + {0xa0, 0x88, ZC3XX_R09E_WINWIDTHLOW}, /* 00,9e,88,cc, + * 8<->6 */ + {0xa0, 0x10, ZC3XX_R087_EXPTIMEMID}, /* 00,87,10,cc, */ + {0xa0, 0x98, ZC3XX_R08B_I2CDEVICEADDR}, /* 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, */ @@ -6039,9 +6059,9 @@ static const struct usb_action tas5130c_vf0250_InitialScale[] = { {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, */ + {0xa0, 0x82, ZC3XX_R086_EXPTIMEHIGH}, /* 00,86,82,cc, */ + {0xa0, 0x83, ZC3XX_R087_EXPTIMEMID}, /* 00,87,83,cc, */ + {0xa0, 0x84, ZC3XX_R088_EXPTIMELOW}, /* 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, */ @@ -6058,18 +6078,18 @@ static const struct usb_action tas5130c_vf0250_InitialScale[] = { {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 */ + {0xa0, 0xb7, ZC3XX_R101_SENSORCORRECTION}, /* 01,01,b7,cc, */ + {0xa0, 0x05, ZC3XX_R012_VIDEOCONTROLFUNC}, /* 00,12,05,cc, */ + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, /* 01,00,0d,cc, */ + {0xa0, 0x76, ZC3XX_R189_AWBSTATUS}, /* 01,89,76,cc, */ + {0xa0, 0x09, 0x01ad}, /* 01,ad,09,cc, */ + {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, /* 01,c5,03,cc, */ + {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, /* 01,cb,13,cc, */ + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, /* 02,50,08,cc, */ + {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, /* 03,01,08,cc, */ + {0xa0, 0x60, ZC3XX_R1A8_DIGITALGAIN}, /* 01,a8,60,cc, */ + {0xa0, 0x61, ZC3XX_R116_RGAIN}, /* 01,16,61,cc, */ + {0xa0, 0x65, ZC3XX_R118_BGAIN}, /* 01,18,65,cc */ {} }; /* "50HZ" light frequency banding filter */ @@ -6077,23 +6097,23 @@ static const 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 */ + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc, */ + {0xa0, 0x06, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,0d,cc, */ + {0xa0, 0xa8, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,50,cc, */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc, */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc, */ + {0xa0, 0x8e, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,47,cc, */ + {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE}, /* 01,8c,0e,cc, */ + {0xa0, 0x15, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,15,cc, */ + {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,10,cc, */ + {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,24,cc, */ + {0xa0, 0x62, ZC3XX_R01D_HSYNC_0}, /* 00,1d,62,cc, */ + {0xa0, 0x90, ZC3XX_R01E_HSYNC_1}, /* 00,1e,90,cc, */ + {0xa0, 0xc8, ZC3XX_R01F_HSYNC_2}, /* 00,1f,c8,cc, */ + {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc, */ + {0xa0, 0x58, ZC3XX_R11D_GLOBALGAIN}, /* 01,1d,58,cc, */ + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, /* 01,80,42,cc, */ + {0xa0, 0x78, ZC3XX_R18D_YTARGET}, /* 01,8d,78,cc */ {} }; @@ -6102,23 +6122,23 @@ static const 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 */ + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc, */ + {0xa0, 0x0d, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,0d,cc, */ + {0xa0, 0x50, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,50,cc, */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc, */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc, */ + {0xa0, 0x8e, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,8e,cc, */ + {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE}, /* 01,8c,0e,cc, */ + {0xa0, 0x15, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,15,cc, */ + {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,10,cc, */ + {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,24,cc, */ + {0xa0, 0x62, ZC3XX_R01D_HSYNC_0}, /* 00,1d,62,cc, */ + {0xa0, 0x90, ZC3XX_R01E_HSYNC_1}, /* 00,1e,90,cc, */ + {0xa0, 0xc8, ZC3XX_R01F_HSYNC_2}, /* 00,1f,c8,cc, */ + {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc, */ + {0xa0, 0x58, ZC3XX_R11D_GLOBALGAIN}, /* 01,1d,58,cc, */ + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, /* 01,80,42,cc, */ + {0xa0, 0x78, ZC3XX_R18D_YTARGET}, /* 01,8d,78,cc */ {} }; @@ -6127,23 +6147,23 @@ static const 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 */ + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc, */ + {0xa0, 0x05, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,05,cc, */ + {0xa0, 0x88, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,88,cc, */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc, */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc, */ + {0xa0, 0x3b, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,3b,cc, */ + {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE}, /* 01,8c,0e,cc, */ + {0xa0, 0x15, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,15,cc, */ + {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,a9,10,cc, */ + {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,aa,24,cc, */ + {0xa0, 0x62, ZC3XX_R01D_HSYNC_0}, /* 00,1d,62,cc, */ + {0xa0, 0x90, ZC3XX_R01E_HSYNC_1}, /* 00,1e,90,cc, */ + {0xa0, 0xc8, ZC3XX_R01F_HSYNC_2}, /* 00,1f,c8,cc, */ + {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc, */ + {0xa0, 0x58, ZC3XX_R11D_GLOBALGAIN}, /* 01,1d,58,cc, */ + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, /* 01,80,42,cc, */ + {0xa0, 0x78, ZC3XX_R18D_YTARGET}, /* 01,8d,78,cc */ {} }; @@ -6152,89 +6172,93 @@ static const 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 */ + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc, */ + {0xa0, 0x0b, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,1,0b,cc, */ + {0xa0, 0x10, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,2,10,cc, */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,5,00,cc, */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,6,00,cc, */ + {0xa0, 0x76, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,7,76,cc, */ + {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE}, /* 01,c,0e,cc, */ + {0xa0, 0x15, ZC3XX_R18F_AEUNFREEZE}, /* 01,f,15,cc, */ + {0xa0, 0x10, ZC3XX_R1A9_DIGITALLIMITDIFF}, /* 01,9,10,cc, */ + {0xa0, 0x24, ZC3XX_R1AA_DIGITALGAINSTEP}, /* 01,a,24,cc, */ + {0xa0, 0x62, ZC3XX_R01D_HSYNC_0}, /* 00,d,62,cc, */ + {0xa0, 0x90, ZC3XX_R01E_HSYNC_1}, /* 00,e,90,cc, */ + {0xa0, 0xc8, ZC3XX_R01F_HSYNC_2}, /* 00,f,c8,cc, */ + {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,0,ff,cc, */ + {0xa0, 0x58, ZC3XX_R11D_GLOBALGAIN}, /* 01,d,58,cc, */ + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, /* 01,80,42,cc, */ + {0xa0, 0x78, ZC3XX_R18D_YTARGET}, /* 01,d,78,cc */ {} }; /* "NoFliker" light frequency banding flter */ static const struct usb_action tas5130c_vf0250_NoFliker[] = { - {0xa0, 0x0c, 0x0100}, /* 01,00,0c,cc, */ + {0xa0, 0x0c, ZC3XX_R100_OPERATIONMODE}, /* 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 */ + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,0,00,cc, */ + {0xa0, 0x05, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,05,cc, */ + {0xa0, 0x88, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,88,cc, */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc, */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc, */ + {0xa0, 0x10, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,10,cc, */ + {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE}, /* 01,8c,0e,cc, */ + {0xa0, 0x15, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,15,cc, */ + {0xa0, 0x62, ZC3XX_R01D_HSYNC_0}, /* 00,1d,62,cc, */ + {0xa0, 0x90, ZC3XX_R01E_HSYNC_1}, /* 00,1e,90,cc, */ + {0xa0, 0xc8, ZC3XX_R01F_HSYNC_2}, /* 00,1f,c8,cc, */ + {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc, */ + {0xa0, 0x58, ZC3XX_R11D_GLOBALGAIN}, /* 01,1d,58,cc, */ + {0xa0, 0x03, ZC3XX_R180_AUTOCORRECTENABLE}, /* 01,80,03,cc */ {} }; /* "NoFlikerScale" light frequency banding filter */ static const struct usb_action tas5130c_vf0250_NoFlikerScale[] = { - {0xa0, 0x0c, 0x0100}, /* 01,00,0c,cc, */ + {0xa0, 0x0c, ZC3XX_R100_OPERATIONMODE}, /* 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 */ + {0xa0, 0x00, ZC3XX_R190_EXPOSURELIMITHIGH}, /* 01,90,00,cc, */ + {0xa0, 0x0b, ZC3XX_R191_EXPOSURELIMITMID}, /* 01,91,0b,cc, */ + {0xa0, 0x10, ZC3XX_R192_EXPOSURELIMITLOW}, /* 01,92,10,cc, */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, /* 01,95,00,cc, */ + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, /* 01,96,00,cc, */ + {0xa0, 0x10, ZC3XX_R197_ANTIFLICKERLOW}, /* 01,97,10,cc, */ + {0xa0, 0x0e, ZC3XX_R18C_AEFREEZE}, /* 01,8c,0e,cc, */ + {0xa0, 0x15, ZC3XX_R18F_AEUNFREEZE}, /* 01,8f,15,cc, */ + {0xa0, 0x62, ZC3XX_R01D_HSYNC_0}, /* 00,1d,62,cc, */ + {0xa0, 0x90, ZC3XX_R01E_HSYNC_1}, /* 00,1e,90,cc, */ + {0xa0, 0xc8, ZC3XX_R01F_HSYNC_2}, /* 00,1f,c8,cc, */ + {0xa0, 0xff, ZC3XX_R020_HSYNC_3}, /* 00,20,ff,cc, */ + {0xa0, 0x58, ZC3XX_R11D_GLOBALGAIN}, /* 01,1d,58,cc, */ + {0xa0, 0x03, ZC3XX_R180_AUTOCORRECTENABLE}, /* 01,80,03,cc */ {} }; -static void reg_r_i(struct usb_device *dev, - __u16 index, __u8 *buffer) +static int reg_r_i(struct gspca_dev *gspca_dev, + __u16 index) { - usb_control_msg(dev, - usb_rcvctrlpipe(dev, 0), + usb_control_msg(gspca_dev->dev, + usb_rcvctrlpipe(gspca_dev->dev, 0), 0xa1, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0x01, /* value */ - index, buffer, 1, + index, gspca_dev->usb_buf, 1, 500); + return gspca_dev->usb_buf[0]; } -static void reg_r(struct usb_device *dev, - __u16 index, __u8 *buffer) +static int reg_r(struct gspca_dev *gspca_dev, + __u16 index) { - reg_r_i(dev, index, buffer); - PDEBUG(D_USBI, "reg r [%04x] -> %02x", index, *buffer); + int ret; + + ret = reg_r_i(gspca_dev, index); + PDEBUG(D_USBI, "reg r [%04x] -> %02x", index, ret); + return ret; } static void reg_w_i(struct usb_device *dev, @@ -6257,55 +6281,54 @@ static void reg_w(struct usb_device *dev, reg_w_i(dev, value, index); } -static __u16 i2c_read(struct usb_device *dev, __u8 reg) +static __u16 i2c_read(struct gspca_dev *gspca_dev, + __u8 reg) { __u8 retbyte; __u8 retval[2]; - reg_w_i(dev, reg, 0x92); - reg_w_i(dev, 0x02, 0x90); /* <- read command */ + reg_w_i(gspca_dev->dev, reg, 0x92); + reg_w_i(gspca_dev->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 */ + retbyte = reg_r_i(gspca_dev, 0x0091); /* read status */ + retval[0] = reg_r_i(gspca_dev, 0x0095); /* read Lowbyte */ + retval[1] = reg_r_i(gspca_dev, 0x0096); /* 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, +static __u8 i2c_write(struct gspca_dev *gspca_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 */ + reg_w_i(gspca_dev->dev, reg, 0x92); + reg_w_i(gspca_dev->dev, valL, 0x93); + reg_w_i(gspca_dev->dev, valH, 0x94); + reg_w_i(gspca_dev->dev, 0x01, 0x90); /* <- write command */ msleep(5); - reg_r_i(dev, 0x0091, &retbyte); /* read status */ + retbyte = reg_r_i(gspca_dev, 0x0091); /* 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, +static void usb_exchange(struct gspca_dev *gspca_dev, const struct usb_action *action) { - __u8 buffread; - while (action->req) { switch (action->req) { case 0xa0: /* write register */ - reg_w(dev, action->val, action->idx); + reg_w(gspca_dev->dev, action->val, action->idx); break; case 0xa1: /* read status */ - reg_r(dev, action->idx, &buffread); + reg_r(gspca_dev, action->idx); break; case 0xaa: - i2c_write(dev, + i2c_write(gspca_dev, action->val, /* reg */ action->idx & 0xff, /* valL */ action->idx >> 8); /* valH */ @@ -6380,7 +6403,6 @@ 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 const __u8 sharpness_tb[][2] = { {0x02, 0x03}, {0x04, 0x07}, @@ -6390,9 +6412,9 @@ static void setsharpness(struct gspca_dev *gspca_dev) sharpness = sd->sharpness; reg_w(dev, sharpness_tb[sharpness][0], 0x01c6); - reg_r(dev, 0x01c8, &retbyte); - reg_r(dev, 0x01c9, &retbyte); - reg_r(dev, 0x01ca, &retbyte); + reg_r(gspca_dev, 0x01c8); + reg_r(gspca_dev, 0x01c9); + reg_r(gspca_dev, 0x01ca); reg_w(dev, sharpness_tb[sharpness][1], 0x01cb); } @@ -6402,7 +6424,7 @@ static void setcontrast(struct gspca_dev *gspca_dev) struct usb_device *dev = gspca_dev->dev; const __u8 *Tgamma, *Tgradient; int g, i, k; - static const __u8 kgamma_tb[16] = /* delta for contrast */ + static const __u8 kgamma_tb[16] = /* delta for contrast */ {0x15, 0x0d, 0x0a, 0x09, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08}; static const __u8 kgrad_tb[16] = @@ -6627,7 +6649,7 @@ static int setlightfreq(struct gspca_dev *gspca_dev) i++; /* 640x480 */ zc3_freq = freq_tb[(int) sd->sensor][i]; if (zc3_freq != NULL) { - usb_exchange(gspca_dev->dev, zc3_freq); + usb_exchange(gspca_dev, zc3_freq); switch (sd->sensor) { case SENSOR_GC0305: if (mode /* if 320x240 */ @@ -6691,44 +6713,45 @@ static void start_2wr_probe(struct usb_device *dev, int sensor) /* msleep(2); */ } -static int sif_probe(struct usb_device *dev) +static int sif_probe(struct gspca_dev *gspca_dev) { __u16 checkword; - start_2wr_probe(dev, 0x0f); /* PAS106 */ - reg_w(dev, 0x08, 0x008d); + start_2wr_probe(gspca_dev->dev, 0x0f); /* PAS106 */ + reg_w(gspca_dev->dev, 0x08, 0x008d); msleep(150); - checkword = ((i2c_read(dev, 0x00) & 0x0f) << 4) - | ((i2c_read(dev, 0x01) & 0xf0) >> 4); + checkword = ((i2c_read(gspca_dev, 0x00) & 0x0f) << 4) + | ((i2c_read(gspca_dev, 0x01) & 0xf0) >> 4); PDEBUG(D_PROBE, "probe sif 0x%04x", checkword); if (checkword == 0x0007) { - send_unknown(dev, SENSOR_PAS106); + send_unknown(gspca_dev->dev, SENSOR_PAS106); return 0x0f; /* PAS106 */ } return -1; } -static int vga_2wr_probe(struct usb_device *dev) +static int vga_2wr_probe(struct gspca_dev *gspca_dev) { + struct usb_device *dev = gspca_dev->dev; __u8 retbyte; __u16 checkword; start_2wr_probe(dev, 0x00); /* HV7131B */ - i2c_write(dev, 0x01, 0xaa, 0x00); - retbyte = i2c_read(dev, 0x01); + i2c_write(gspca_dev, 0x01, 0xaa, 0x00); + retbyte = i2c_read(gspca_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); + i2c_write(gspca_dev, 0x01, 0xaa, 0x00); + retbyte = i2c_read(gspca_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); + i2c_write(gspca_dev, 0x11, 0xaa, 0x00); + retbyte = i2c_read(gspca_dev, 0x11); if (retbyte != 0) { /* (should have returned 0xaa) --> Omnivision? */ /* reg_r 0x10 -> 0x06 --> */ @@ -6736,45 +6759,45 @@ static int vga_2wr_probe(struct usb_device *dev) } start_2wr_probe(dev, 0x08); /* HDCS2020 */ - i2c_write(dev, 0x15, 0xaa, 0x00); - retbyte = i2c_read(dev, 0x15); + i2c_write(gspca_dev, 0x15, 0xaa, 0x00); + retbyte = i2c_read(gspca_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); + i2c_write(gspca_dev, 0x07, 0xaa, 0xaa); + retbyte = i2c_read(gspca_dev, 0x07); if (retbyte != 0) return 0x0a; /* PB0330 */ - retbyte = i2c_read(dev, 0x03); + retbyte = i2c_read(gspca_dev, 0x03); if (retbyte != 0) return 0x0a; /* PB0330 ?? */ - retbyte = i2c_read(dev, 0x04); + retbyte = i2c_read(gspca_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); + i2c_write(gspca_dev, 0x01, 0x11, 0x00); + retbyte = i2c_read(gspca_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); + i2c_write(gspca_dev, 0x03, 0xaa, 0x00); msleep(500); - retbyte = i2c_read(dev, 0x03); + retbyte = i2c_read(gspca_dev, 0x03); if (retbyte != 0) return 0x0e; /* PAS202BCB */ start_2wr_probe(dev, 0x02); /* ?? */ - i2c_write(dev, 0x01, 0xaa, 0x00); - retbyte = i2c_read(dev, 0x01); + i2c_write(gspca_dev, 0x01, 0xaa, 0x00); + retbyte = i2c_read(gspca_dev, 0x01); if (retbyte != 0) return 0x02; /* ?? */ ov_check: - reg_r(dev, 0x0010, &retbyte); /* ?? */ - reg_r(dev, 0x0010, &retbyte); + reg_r(gspca_dev, 0x0010); /* ?? */ + reg_r(gspca_dev, 0x0010); reg_w(dev, 0x01, 0x0000); reg_w(dev, 0x01, 0x0001); @@ -6783,10 +6806,10 @@ ov_check: 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); + i2c_write(gspca_dev, 0x12, 0x80, 0x00); /* sensor reset */ + retbyte = i2c_read(gspca_dev, 0x0a); checkword = retbyte << 8; - retbyte = i2c_read(dev, 0x0b); + retbyte = i2c_read(gspca_dev, 0x0b); checkword |= retbyte; PDEBUG(D_PROBE, "probe 2wr ov vga 0x%04x", checkword); switch (checkword) { @@ -6825,7 +6848,7 @@ static int vga_3wr_probe(struct gspca_dev *gspca_dev) /*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, 0x10, &retbyte); + reg_r(gspca_dev, 0x10); reg_w(dev, 0x01, 0x0000); reg_w(dev, 0x00, 0x0010); reg_w(dev, 0x01, 0x0001); @@ -6833,23 +6856,23 @@ static int vga_3wr_probe(struct gspca_dev *gspca_dev) reg_w(dev, 0x03, 0x0012); reg_w(dev, 0x01, 0x0012); reg_w(dev, 0x05, 0x0012); - retbyte = i2c_read(dev, 0x14); + retbyte = i2c_read(gspca_dev, 0x14); if (retbyte != 0) return 0x11; /* HV7131R */ - retbyte = i2c_read(dev, 0x15); + retbyte = i2c_read(gspca_dev, 0x15); if (retbyte != 0) return 0x11; /* HV7131R */ - retbyte = i2c_read(dev, 0x16); + retbyte = i2c_read(gspca_dev, 0x16); if (retbyte != 0) return 0x11; /* HV7131R */ reg_w(dev, 0x02, 0x0010); - reg_r(dev, 0x000b, &retbyte); + retbyte = reg_r(gspca_dev, 0x000b); checkword = retbyte << 8; - reg_r(dev, 0x000a, &retbyte); + retbyte = reg_r(gspca_dev, 0x000a); checkword |= retbyte; PDEBUG(D_PROBE, "probe 3wr vga 1 0x%04x", checkword); - reg_r(dev, 0x0010, &retbyte); + reg_r(gspca_dev, 0x0010); /* this is tested only once anyway */ i = 0; while (chipset_revision_sensor[i].revision) { @@ -6867,7 +6890,7 @@ static int vga_3wr_probe(struct gspca_dev *gspca_dev) reg_w(dev, 0x0a, 0x0010); reg_w(dev, 0x03, 0x0012); reg_w(dev, 0x01, 0x0012); - retbyte = i2c_read(dev, 0x00); + retbyte = i2c_read(gspca_dev, 0x00); if (retbyte != 0) { PDEBUG(D_PROBE, "probe 3wr vga type 0a ?"); return 0x0a; /* ?? */ @@ -6880,7 +6903,7 @@ static int vga_3wr_probe(struct gspca_dev *gspca_dev) reg_w(dev, 0x03, 0x0012); msleep(2); reg_w(dev, 0x01, 0x0012); - retbyte = i2c_read(dev, 0x00); + retbyte = i2c_read(gspca_dev, 0x00); if (retbyte != 0) { PDEBUG(D_PROBE, "probe 3wr vga type %02x", retbyte); send_unknown(dev, SENSOR_GC0305); @@ -6894,8 +6917,8 @@ static int vga_3wr_probe(struct gspca_dev *gspca_dev) 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) { + if (i2c_read(gspca_dev, 0x1c) == 0x7f /* OV7610 - manufacturer ID */ + && i2c_read(gspca_dev, 0x1d) == 0xa2) { send_unknown(dev, SENSOR_OV7620); return 0x06; /* OmniVision confirm ? */ } @@ -6909,13 +6932,13 @@ static int vga_3wr_probe(struct gspca_dev *gspca_dev) /* msleep(150); */ reg_w(dev, 0x01, 0x12); reg_w(dev, 0x05, 0x12); - retbyte = i2c_read(dev, 0x00); /* ID 0 */ + retbyte = i2c_read(gspca_dev, 0x00); /* ID 0 */ checkword = retbyte << 8; - retbyte = i2c_read(dev, 0x01); /* ID 1 */ + retbyte = i2c_read(gspca_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 */ + retbyte = i2c_read(gspca_dev, 0x02); /* revision number */ PDEBUG(D_PROBE, "sensor PO2030 rev 0x%02x", retbyte); send_unknown(dev, SENSOR_PO2030); return checkword; @@ -6929,7 +6952,7 @@ static int vga_3wr_probe(struct gspca_dev *gspca_dev) reg_w(dev, 0x01, 0x12); reg_w(dev, 0x05, 0x01); reg_w(dev, 0xd3, 0x8b); - retbyte = i2c_read(dev, 0x01); + retbyte = i2c_read(gspca_dev, 0x01); if (retbyte != 0) { PDEBUG(D_PROBE, "probe 3wr vga type 0a ?"); return 0x0a; /* ?? */ @@ -6940,7 +6963,6 @@ static int vga_3wr_probe(struct gspca_dev *gspca_dev) 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) { @@ -6948,7 +6970,7 @@ static int zcxx_probeSensor(struct gspca_dev *gspca_dev) case SENSOR_TAS5130C_VF0250: return -1; /* don't probe */ } - sensor = vga_2wr_probe(dev); + sensor = vga_2wr_probe(gspca_dev); if (sensor >= 0) { if (sensor < 0x7600) return sensor; @@ -6960,7 +6982,7 @@ static int zcxx_probeSensor(struct gspca_dev *gspca_dev) return sensor; return sensor2; } - return sif_probe(dev); + return sif_probe(gspca_dev); } /* this function is called at probe time */ @@ -6970,7 +6992,6 @@ static int sd_config(struct gspca_dev *gspca_dev, struct sd *sd = (struct sd *) gspca_dev; struct cam *cam; int sensor; - __u8 bsensor; int vga = 1; /* 1: vga, 0: sif */ static const __u8 gamma[SENSOR_MAX] = { 5, /* SENSOR_CS2102 0 */ @@ -7126,7 +7147,7 @@ static int sd_config(struct gspca_dev *gspca_dev, reg_w(gspca_dev->dev, 0x02, 0x0010); else reg_w(gspca_dev->dev, sensor & 0x0f, 0x0010); - reg_r(gspca_dev->dev, 0x0010, &bsensor); + reg_r(gspca_dev, 0x0010); } cam = &gspca_dev->cam; @@ -7167,7 +7188,6 @@ static void sd_start(struct gspca_dev *gspca_dev) struct usb_device *dev = gspca_dev->dev; const struct usb_action *zc3_init; int mode; - __u8 retbyte; static const struct usb_action *init_tb[SENSOR_MAX][2] = { {cs2102_InitialScale, cs2102_Initial}, /* 0 */ {cs2102K_InitialScale, cs2102K_Initial}, /* 1 */ @@ -7198,7 +7218,7 @@ static void sd_start(struct gspca_dev *gspca_dev) zcxx_probeSensor(gspca_dev); break; case SENSOR_PAS106: - usb_exchange(dev, pas106b_Initial_com); + usb_exchange(gspca_dev, pas106b_Initial_com); break; case SENSOR_PB0330: if (mode) { @@ -7214,14 +7234,14 @@ static void sd_start(struct gspca_dev *gspca_dev) } break; } - usb_exchange(dev, zc3_init); + usb_exchange(gspca_dev, zc3_init); switch (sd->sensor) { case SENSOR_GC0305: case SENSOR_OV7620: case SENSOR_PO2030: msleep(100); /* ?? */ - reg_r(dev, 0x0002, &retbyte); /* --> 0x40 */ + reg_r(gspca_dev, 0x0002); /* --> 0x40 */ reg_w(dev, 0x09, 0x01ad); /* (from win traces) */ reg_w(dev, 0x15, 0x01ae); reg_w(dev, 0x0d, 0x003a); @@ -7234,11 +7254,11 @@ static void sd_start(struct gspca_dev *gspca_dev) setbrightness(gspca_dev); switch (sd->sensor) { case SENSOR_OV7620: - reg_r(dev, 0x0008, &retbyte); + reg_r(gspca_dev, 0x0008); reg_w(dev, 0x00, 0x0008); break; case SENSOR_GC0305: - reg_r(dev, 0x0008, &retbyte); + reg_r(gspca_dev, 0x0008); /* fall thru */ case SENSOR_PO2030: reg_w(dev, 0x03, 0x0008); @@ -7263,7 +7283,7 @@ static void sd_start(struct gspca_dev *gspca_dev) setmatrix(gspca_dev); /* one more time? */ switch (sd->sensor) { case SENSOR_OV7620: - reg_r(dev, 0x0180, &retbyte); /* from win */ + reg_r(gspca_dev, 0x0180); /* from win */ reg_w(dev, 0x00, 0x0180); break; default: @@ -7281,7 +7301,7 @@ static void sd_start(struct gspca_dev *gspca_dev) break; case SENSOR_PO2030: reg_w(dev, 0x40, 0x0117); /* (from win traces) */ - reg_r(dev, 0x0180, &retbyte); + reg_r(gspca_dev, 0x0180); break; } @@ -7293,22 +7313,23 @@ static void sd_start(struct gspca_dev *gspca_dev) reg_w(dev, 0x15, 0x01ae); reg_w(dev, 0x40, 0x0180); reg_w(dev, 0x40, 0x0117); - reg_r(dev, 0x0180, &retbyte); + reg_r(gspca_dev, 0x0180); 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? */ + i2c_read(gspca_dev, 0x13); /*fixme: returns 0xa3 */ + i2c_write(gspca_dev, 0x13, 0xa3, 0x00); + /*fixme: returned value to send? */ reg_w(dev, 0x40, 0x0117); /* (from win traces) */ - reg_r(dev, 0x0180, &retbyte); + reg_r(gspca_dev, 0x0180); setautogain(gspca_dev); msleep(500); break; case SENSOR_PO2030: msleep(500); - reg_r(dev, 0x0008, &retbyte); - reg_r(dev, 0x0007, &retbyte); + reg_r(gspca_dev, 0x0008); + reg_r(gspca_dev, 0x0007); reg_w(dev, 0x00, 0x0007); /* (from win traces) */ reg_w(dev, 0x02, 0x0008); break; @@ -7331,9 +7352,8 @@ static void sd_close(struct gspca_dev *gspca_dev) { #if 0 /* test */ struct usb_device *dev = gspca_dev->dev; - __u8 buffread; - reg_r(dev, 0x0180, &buffread); + reg_r(gspca_dev, 0x0180); reg_w(dev, 0x00, 0x0180); reg_w(dev, 0x01, 0x0000); #endif |