diff options
Diffstat (limited to 'linux/drivers/media')
169 files changed, 10898 insertions, 7860 deletions
diff --git a/linux/drivers/media/Kconfig b/linux/drivers/media/Kconfig index 7a7803b5d..93ea201f4 100644 --- a/linux/drivers/media/Kconfig +++ b/linux/drivers/media/Kconfig @@ -38,7 +38,6 @@ config VIDEO_ALLOW_V4L1 bool "Enable Video For Linux API 1 (DEPRECATED)" depends on VIDEO_DEV && VIDEO_V4L2_COMMON default VIDEO_DEV && VIDEO_V4L2_COMMON - select VIDEO_V4L1_COMPAT ---help--- Enables drivers based on the legacy V4L1 API. @@ -49,9 +48,9 @@ config VIDEO_ALLOW_V4L1 If you are unsure as to whether this is required, answer Y. config VIDEO_V4L1_COMPAT - bool "Enable Video For Linux API 1 compatible Layer" + bool "Enable Video For Linux API 1 compatible Layer" if !VIDEO_ALLOW_V4L1 depends on VIDEO_DEV - default VIDEO_DEV + default y ---help--- Enables a compatibility API used by most V4L2 devices to allow its usage with legacy applications that supports only V4L1 api. diff --git a/linux/drivers/media/common/ir-functions.c b/linux/drivers/media/common/ir-functions.c index 3653b6d37..ddbd4be99 100644 --- a/linux/drivers/media/common/ir-functions.c +++ b/linux/drivers/media/common/ir-functions.c @@ -78,6 +78,7 @@ void ir_input_init(struct input_dev *dev, struct ir_input_state *ir, if (repeat) set_bit(EV_REP, dev->evbit); } +EXPORT_SYMBOL_GPL(ir_input_init); void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir) { @@ -86,6 +87,7 @@ void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir) ir_input_key_event(dev,ir); } } +EXPORT_SYMBOL_GPL(ir_input_nokey); void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir, u32 ir_key, u32 ir_raw) @@ -108,6 +110,7 @@ void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir, input_event(a, EV_IR, ir->ir_type, ir->ir_raw); #endif } +EXPORT_SYMBOL_GPL(ir_input_keydown); /* -------------------------------------------------------------------------- */ /* extract mask bits out of data and pack them into the result */ @@ -126,6 +129,7 @@ u32 ir_extract_bits(u32 data, u32 mask) return value; } +EXPORT_SYMBOL_GPL(ir_extract_bits); static int inline getbit(u32 *samples, int bit) { @@ -150,6 +154,7 @@ int ir_dump_samples(u32 *samples, int count) printk("\n"); return 0; } +EXPORT_SYMBOL_GPL(ir_dump_samples); /* decode raw samples, pulse distance coding used by NEC remotes */ int ir_decode_pulsedistance(u32 *samples, int count, int low, int high) @@ -216,6 +221,7 @@ int ir_decode_pulsedistance(u32 *samples, int count, int low, int high) return value; } +EXPORT_SYMBOL_GPL(ir_decode_pulsedistance); /* decode raw samples, biphase coding, used by rc5 for example */ int ir_decode_biphase(u32 *samples, int count, int low, int high) @@ -257,6 +263,7 @@ int ir_decode_biphase(u32 *samples, int count, int low, int high) } return value; } +EXPORT_SYMBOL_GPL(ir_decode_biphase); /* RC5 decoding stuff, moved from bttv-input.c to share it with * saa7134 */ @@ -357,6 +364,7 @@ void ir_rc5_timer_end(unsigned long data) } } } +EXPORT_SYMBOL_GPL(ir_rc5_timer_end); void ir_rc5_timer_keyup(unsigned long data) { @@ -365,21 +373,4 @@ void ir_rc5_timer_keyup(unsigned long data) dprintk(1, "ir-common: key released\n"); ir_input_nokey(ir->dev, &ir->ir); } - -EXPORT_SYMBOL_GPL(ir_input_init); -EXPORT_SYMBOL_GPL(ir_input_nokey); -EXPORT_SYMBOL_GPL(ir_input_keydown); - -EXPORT_SYMBOL_GPL(ir_extract_bits); -EXPORT_SYMBOL_GPL(ir_dump_samples); -EXPORT_SYMBOL_GPL(ir_decode_biphase); -EXPORT_SYMBOL_GPL(ir_decode_pulsedistance); - -EXPORT_SYMBOL_GPL(ir_rc5_timer_end); EXPORT_SYMBOL_GPL(ir_rc5_timer_keyup); - -/* - * Local variables: - * c-basic-offset: 8 - * End: - */ diff --git a/linux/drivers/media/common/tuners/tuner-xc2028.c b/linux/drivers/media/common/tuners/tuner-xc2028.c index 88fd2c91c..a3272e81e 100644 --- a/linux/drivers/media/common/tuners/tuner-xc2028.c +++ b/linux/drivers/media/common/tuners/tuner-xc2028.c @@ -259,7 +259,7 @@ static int load_all_firmwares(struct dvb_frontend *fe) { struct xc2028_data *priv = fe->tuner_priv; const struct firmware *fw = NULL; - unsigned char *p, *endp; + const unsigned char *p, *endp; int rc = 0; int n, n_array; char name[33]; diff --git a/linux/drivers/media/common/tuners/xc5000.c b/linux/drivers/media/common/tuners/xc5000.c index 63b4dba44..e0f045e1b 100644 --- a/linux/drivers/media/common/tuners/xc5000.c +++ b/linux/drivers/media/common/tuners/xc5000.c @@ -282,7 +282,7 @@ static int xc_read_reg(struct xc5000_priv *priv, u16 regAddr, u16 *i2cData) return result; } -static int xc_load_i2c_sequence(struct dvb_frontend *fe, u8 i2c_sequence[]) +static int xc_load_i2c_sequence(struct dvb_frontend *fe, const u8 *i2c_sequence) { struct xc5000_priv *priv = fe->tuner_priv; diff --git a/linux/drivers/media/dvb/dvb-core/dvb_net.c b/linux/drivers/media/dvb/dvb-core/dvb_net.c index 3c0106f65..e0d60cdc4 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_net.c +++ b/linux/drivers/media/dvb/dvb-core/dvb_net.c @@ -1165,7 +1165,11 @@ static void wq_set_multicast_list (struct work_struct *work) #ifdef OLD_XMIT_LOCK /* Kernels equal or lower than 2.6.17 */ spin_lock_bh(&dev->xmit_lock); #else +#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 26) netif_tx_lock_bh(dev); +#else + netif_addr_lock_bh(dev); +#endif #endif if (dev->flags & IFF_PROMISC) { @@ -1194,7 +1198,11 @@ static void wq_set_multicast_list (struct work_struct *work) #ifdef OLD_XMIT_LOCK /* Kernels equal or lower than 2.6.17 */ spin_unlock_bh(&dev->xmit_lock); #else +#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 26) netif_tx_unlock_bh(dev); +#else + netif_addr_unlock_bh(dev); +#endif #endif dvb_net_feed_start(dev); } diff --git a/linux/drivers/media/dvb/dvb-core/dvbdev.c b/linux/drivers/media/dvb/dvb-core/dvbdev.c index 0ae0e5852..0820da504 100644 --- a/linux/drivers/media/dvb/dvb-core/dvbdev.c +++ b/linux/drivers/media/dvb/dvb-core/dvbdev.c @@ -33,6 +33,7 @@ #include <linux/cdev.h> #include "compat.h" #include <linux/mutex.h> +#include <linux/smp_lock.h> #include "dvbdev.h" static int dvbdev_debug; @@ -75,6 +76,7 @@ static int dvb_device_open(struct inode *inode, struct file *file) { struct dvb_device *dvbdev; + lock_kernel(); dvbdev = dvbdev_find_device (iminor(inode)); if (dvbdev && dvbdev->fops) { @@ -95,8 +97,10 @@ static int dvb_device_open(struct inode *inode, struct file *file) file->f_op = fops_get(old_fops); } fops_put(old_fops); + unlock_kernel(); return err; } + unlock_kernel(); return -ENODEV; } @@ -238,9 +242,15 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, mutex_unlock(&dvbdev_register_lock); +#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 26) + clsdev = device_create_drvdata(dvb_class, adap->device, + MKDEV(DVB_MAJOR, nums2minor(adap->num, type, id)), + NULL, "dvb%d.%s%d", adap->num, dnames[type], id); +#else clsdev = device_create(dvb_class, adap->device, MKDEV(DVB_MAJOR, nums2minor(adap->num, type, id)), "dvb%d.%s%d", adap->num, dnames[type], id); +#endif if (IS_ERR(clsdev)) { printk(KERN_ERR "%s: failed to create device dvb%d.%s%d (%ld)\n", __func__, adap->num, dnames[type], id, PTR_ERR(clsdev)); @@ -425,7 +435,12 @@ static int __init init_dvbdev(void) return retval; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 17) cdev_init(&dvb_device_cdev, &dvb_device_fops); +#else + cdev_init(&dvb_device_cdev, + (struct file_operations *)&dvb_device_fops); +#endif if ((retval = cdev_add(&dvb_device_cdev, dev, MAX_DVB_MINORS)) != 0) { printk(KERN_ERR "dvb-core: unable register character device\n"); goto error; diff --git a/linux/drivers/media/dvb/dvb-usb/Kconfig b/linux/drivers/media/dvb/dvb-usb/Kconfig index a577c0f89..3c663c65e 100644 --- a/linux/drivers/media/dvb/dvb-usb/Kconfig +++ b/linux/drivers/media/dvb/dvb-usb/Kconfig @@ -246,6 +246,14 @@ config DVB_USB_AF9005_REMOTE Say Y here to support the default remote control decoding for the Afatech AF9005 based receiver. +config DVB_USB_DW2102 + tristate "DvbWorld 2102 DVB-S USB2.0 receiver" + depends on DVB_USB + select DVB_STV0299 if !DVB_FE_CUSTOMISE + select DVB_PLL if !DVB_FE_CUSTOMISE + help + Say Y here to support the DvbWorld 2102 DVB-S USB2.0 receiver. + config DVB_USB_ANYSEE tristate "Anysee DVB-T/C USB2.0 support" depends on DVB_USB diff --git a/linux/drivers/media/dvb/dvb-usb/Makefile b/linux/drivers/media/dvb/dvb-usb/Makefile index 44c11e45e..e206f1ea0 100644 --- a/linux/drivers/media/dvb/dvb-usb/Makefile +++ b/linux/drivers/media/dvb/dvb-usb/Makefile @@ -64,6 +64,9 @@ obj-$(CONFIG_DVB_USB_AF9005_REMOTE) += dvb-usb-af9005-remote.o dvb-usb-anysee-objs = anysee.o obj-$(CONFIG_DVB_USB_ANYSEE) += dvb-usb-anysee.o +dvb-usb-dw2102-objs = dw2102.o +obj-$(CONFIG_DVB_USB_DW2102) += dvb-usb-dw2102.o + EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/ # due to tuner-xc3028 EXTRA_CFLAGS += -Idrivers/media/common/tuners diff --git a/linux/drivers/media/dvb/dvb-usb/cxusb.c b/linux/drivers/media/dvb/dvb-usb/cxusb.c index 9a3e97247..578afce68 100644 --- a/linux/drivers/media/dvb/dvb-usb/cxusb.c +++ b/linux/drivers/media/dvb/dvb-usb/cxusb.c @@ -24,6 +24,7 @@ * see Documentation/dvb/README.dvb-usb for more information */ #include <media/tuner.h> +#include <linux/vmalloc.h> #include "cxusb.h" @@ -791,12 +792,26 @@ static int bluebird_patch_dvico_firmware_download(struct usb_device *udev, if (fw->data[idoff] == (USB_VID_DVICO & 0xff) && fw->data[idoff + 1] == USB_VID_DVICO >> 8) { - fw->data[idoff + 2] = + struct firmware new_fw; + u8 *new_fw_data = vmalloc(fw->size); + int ret; + + if (!new_fw_data) + return -ENOMEM; + + memcpy(new_fw_data, fw->data, fw->size); + new_fw.size = fw->size; + new_fw.data = new_fw_data; + + new_fw_data[idoff + 2] = le16_to_cpu(udev->descriptor.idProduct) + 1; - fw->data[idoff + 3] = + new_fw_data[idoff + 3] = le16_to_cpu(udev->descriptor.idProduct) >> 8; - return usb_cypress_load_firmware(udev, fw, CYPRESS_FX2); + ret = usb_cypress_load_firmware(udev, &new_fw, + CYPRESS_FX2); + vfree(new_fw_data); + return ret; } } diff --git a/linux/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/linux/drivers/media/dvb/dvb-usb/dvb-usb-ids.h index e5238b31e..029b437ca 100644 --- a/linux/drivers/media/dvb/dvb-usb/dvb-usb-ids.h +++ b/linux/drivers/media/dvb/dvb-usb/dvb-usb-ids.h @@ -204,5 +204,6 @@ #define USB_PID_ASUS_U3000 0x171f #define USB_PID_ASUS_U3100 0x173f #define USB_PID_YUAN_EC372S 0x1edc +#define USB_PID_DW2102 0x2102 #endif diff --git a/linux/drivers/media/dvb/dvb-usb/dw2102.c b/linux/drivers/media/dvb/dvb-usb/dw2102.c new file mode 100644 index 000000000..a4d898b44 --- /dev/null +++ b/linux/drivers/media/dvb/dvb-usb/dw2102.c @@ -0,0 +1,425 @@ +/* DVB USB framework compliant Linux driver for the DVBWorld DVB-S 2102 Card +* +* Copyright (C) 2008 Igor M. Liplianin (liplianin@me.by) +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation, version 2. +* +* see Documentation/dvb/README.dvb-usb for more information +*/ +#include <linux/version.h> +#include "dw2102.h" +#include "stv0299.h" +#include "z0194a.h" + +#ifndef USB_PID_DW2102 +#define USB_PID_DW2102 0x2102 +#endif + +#define DW2102_READ_MSG 0 +#define DW2102_WRITE_MSG 1 + +#define REG_1F_SYMBOLRATE_BYTE0 0x1f +#define REG_20_SYMBOLRATE_BYTE1 0x20 +#define REG_21_SYMBOLRATE_BYTE2 0x21 + +#define DW2102_VOLTAGE_CTRL (0x1800) +#define DW2102_RC_QUERY (0x1a00) + +struct dw2102_state { + u32 last_key_pressed; +}; +struct dw2102_rc_keys { + u32 keycode; + u32 event; +}; + +DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); + +static int dw2102_op_rw(struct usb_device *dev, u8 request, u16 value, + u8 *data, u16 len, int flags) +{ + int ret; + u8 u8buf[len]; + + unsigned int pipe = (flags == DW2102_READ_MSG) ? + usb_rcvctrlpipe(dev, 0) : usb_sndctrlpipe(dev, 0); + u8 request_type = (flags == DW2102_READ_MSG) ? USB_DIR_IN : USB_DIR_OUT; + + if (flags == DW2102_WRITE_MSG) + memcpy(u8buf, data, len); + ret = usb_control_msg(dev, pipe, request, + request_type | USB_TYPE_VENDOR, value, 0 , u8buf, len, 2000); + + if (flags == DW2102_READ_MSG) + memcpy(data, u8buf, len); + return ret; +} + +/* I2C */ + +static int dw2102_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], + int num) +{ +struct dvb_usb_device *d = i2c_get_adapdata(adap); + int i = 0, ret = 0; + u8 buf6[] = {0x2c, 0x05, 0xc0, 0, 0, 0, 0}; + u8 request; + u16 value; + + if (!d) + return -ENODEV; + if (mutex_lock_interruptible(&d->i2c_mutex) < 0) + return -EAGAIN; + + switch (num) { + case 2: + /* read stv0299 register */ + request = 0xb5; + value = msg[0].buf[0];/* register */ + for (i = 0; i < msg[1].len; i++) { + value = value + i; + ret = dw2102_op_rw(d->udev, 0xb5, + value, buf6, 2, DW2102_READ_MSG); + msg[1].buf[i] = buf6[0]; + + } + break; + case 1: + switch (msg[0].addr) { + case 0x68: + /* write to stv0299 register */ + buf6[0] = 0x2a; + buf6[1] = msg[0].buf[0]; + buf6[2] = msg[0].buf[1]; + ret = dw2102_op_rw(d->udev, 0xb2, + 0, buf6, 3, DW2102_WRITE_MSG); + break; + case 0x60: + if (msg[0].flags == 0) { + /* write to tuner pll */ + buf6[0] = 0x2c; + buf6[1] = 5; + buf6[2] = 0xc0; + buf6[3] = msg[0].buf[0]; + buf6[4] = msg[0].buf[1]; + buf6[5] = msg[0].buf[2]; + buf6[6] = msg[0].buf[3]; + ret = dw2102_op_rw(d->udev, 0xb2, + 0, buf6, 7, DW2102_WRITE_MSG); + } else { + /* write to tuner pll */ + ret = dw2102_op_rw(d->udev, 0xb5, + 0, buf6, 1, DW2102_READ_MSG); + msg[0].buf[0] = buf6[0]; + } + break; + case (DW2102_RC_QUERY): + ret = dw2102_op_rw(d->udev, 0xb8, + 0, buf6, 2, DW2102_READ_MSG); + msg[0].buf[0] = buf6[0]; + msg[0].buf[1] = buf6[1]; + break; + case (DW2102_VOLTAGE_CTRL): + buf6[0] = 0x30; + buf6[1] = msg[0].buf[0]; + ret = dw2102_op_rw(d->udev, 0xb2, + 0, buf6, 2, DW2102_WRITE_MSG); + break; + } + + break; + } + + mutex_unlock(&d->i2c_mutex); + return num; +} + +static u32 dw2102_i2c_func(struct i2c_adapter *adapter) +{ + return I2C_FUNC_I2C; +} + +static struct i2c_algorithm dw2102_i2c_algo = { + .master_xfer = dw2102_i2c_transfer, + .functionality = dw2102_i2c_func, +}; + +static int dw2102_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) +{ + static u8 command_13v[1] = {0x00}; + static u8 command_18v[1] = {0x01}; + struct i2c_msg msg[] = { + {.addr = DW2102_VOLTAGE_CTRL, .flags = 0, + .buf = command_13v, .len = 1}, + }; + + struct dvb_usb_adapter *udev_adap = + (struct dvb_usb_adapter *)(fe->dvb->priv); + if (voltage == SEC_VOLTAGE_18) + msg[0].buf = command_18v; + i2c_transfer(&udev_adap->dev->i2c_adap, msg, 1); + return 0; +} + +static int dw2102_frontend_attach(struct dvb_usb_adapter *d) +{ + d->fe = dvb_attach(stv0299_attach, &sharp_z0194a_config, + &d->dev->i2c_adap); + if (d->fe != NULL) { + d->fe->ops.set_voltage = dw2102_set_voltage; + info("Attached stv0299!\n"); + return 0; + } + return -EIO; +} + +static int dw2102_tuner_attach(struct dvb_usb_adapter *adap) +{ + dvb_attach(dvb_pll_attach, adap->fe, 0x60, + &adap->dev->i2c_adap, DVB_PLL_OPERA1); + return 0; +} + +static struct dvb_usb_rc_key dw2102_rc_keys[] = { + { 0xf8, 0x0a, KEY_Q }, /*power*/ + { 0xf8, 0x0c, KEY_M }, /*mute*/ + { 0xf8, 0x11, KEY_1 }, + { 0xf8, 0x12, KEY_2 }, + { 0xf8, 0x13, KEY_3 }, + { 0xf8, 0x14, KEY_4 }, + { 0xf8, 0x15, KEY_5 }, + { 0xf8, 0x16, KEY_6 }, + { 0xf8, 0x17, KEY_7 }, + { 0xf8, 0x18, KEY_8 }, + { 0xf8, 0x19, KEY_9 }, + { 0xf8, 0x10, KEY_0 }, + { 0xf8, 0x1c, KEY_PAGEUP }, /*ch+*/ + { 0xf8, 0x0f, KEY_PAGEDOWN }, /*ch-*/ + { 0xf8, 0x1a, KEY_O }, /*vol+*/ + { 0xf8, 0x0e, KEY_Z }, /*vol-*/ + { 0xf8, 0x04, KEY_R }, /*rec*/ + { 0xf8, 0x09, KEY_D }, /*fav*/ + { 0xf8, 0x08, KEY_BACKSPACE }, /*rewind*/ + { 0xf8, 0x07, KEY_A }, /*fast*/ + { 0xf8, 0x0b, KEY_P }, /*pause*/ + { 0xf8, 0x02, KEY_ESC }, /*cancel*/ + { 0xf8, 0x03, KEY_G }, /*tab*/ + { 0xf8, 0x00, KEY_UP }, /*up*/ + { 0xf8, 0x1f, KEY_ENTER }, /*ok*/ + { 0xf8, 0x01, KEY_DOWN }, /*down*/ + { 0xf8, 0x05, KEY_C }, /*cap*/ + { 0xf8, 0x06, KEY_S }, /*stop*/ + { 0xf8, 0x40, KEY_F }, /*full*/ + { 0xf8, 0x1e, KEY_W }, /*tvmode*/ + { 0xf8, 0x1b, KEY_B }, /*recall*/ + +}; + + + +static int dw2102_rc_query(struct dvb_usb_device *d, u32 *event, int *state) +{ + struct dw2102_state *st = d->priv; + u8 key[2]; + struct i2c_msg msg[] = { + {.addr = DW2102_RC_QUERY, .flags = I2C_M_RD, .buf = key, + .len = 2}, + }; + int i; + + *state = REMOTE_NO_KEY_PRESSED; + if (dw2102_i2c_transfer(&d->i2c_adap, msg, 1) == 1) { + for (i = 0; i < ARRAY_SIZE(dw2102_rc_keys); i++) { + if (dw2102_rc_keys[i].data == msg[0].buf[0]) { + *state = REMOTE_KEY_PRESSED; + *event = dw2102_rc_keys[i].event; + st->last_key_pressed = + dw2102_rc_keys[i].event; + break; + } + st->last_key_pressed = 0; + } + } + /* info("key: %x %x\n",key[0],key[1]); */ + return 0; +} + +static struct usb_device_id dw2102_table[] = { + {USB_DEVICE(USB_VID_CYPRESS, USB_PID_DW2102)}, + {USB_DEVICE(USB_VID_CYPRESS, 0x2101)}, + { } +}; + +MODULE_DEVICE_TABLE(usb, dw2102_table); + +static int dw2102_load_firmware(struct usb_device *dev, + const struct firmware *frmwr) +{ + u8 *b, *p; + int ret = 0, i; + u8 reset; + u8 reset16 [] = {0, 0, 0, 0, 0, 0, 0}; + const struct firmware *fw; + const char *filename = "dvb-usb-dw2101.fw"; + switch (dev->descriptor.idProduct) { + case 0x2101: + ret = request_firmware(&fw, filename, &dev->dev); + if (ret != 0) { + err("did not find the firmware file. (%s) " + "Please see linux/Documentation/dvb/ for more details " + "on firmware-problems.", filename); + return ret; + } + break; + case USB_PID_DW2102: + fw = frmwr; + break; + } + info("start downloading DW2102 firmware"); + p = kmalloc(fw->size, GFP_KERNEL); + reset = 1; + /*stop the CPU*/ + dw2102_op_rw(dev, 0xa0, 0x7f92, &reset, 1, DW2102_WRITE_MSG); + dw2102_op_rw(dev, 0xa0, 0xe600, &reset, 1, DW2102_WRITE_MSG); + + if (p != NULL) { + memcpy(p, fw->data, fw->size); + for (i = 0; i < fw->size; i += 0x40) { + b = (u8 *) p + i; + if (dw2102_op_rw + (dev, 0xa0, i, b , 0x40, + DW2102_WRITE_MSG) != 0x40 + ) { + err("error while transferring firmware"); + ret = -EINVAL; + break; + } + } + /* restart the CPU */ + reset = 0; + if (ret || dw2102_op_rw + (dev, 0xa0, 0x7f92, &reset, 1, + DW2102_WRITE_MSG) != 1) { + err("could not restart the USB controller CPU."); + ret = -EINVAL; + } + if (ret || dw2102_op_rw + (dev, 0xa0, 0xe600, &reset, 1, + DW2102_WRITE_MSG) != 1) { + err("could not restart the USB controller CPU."); + ret = -EINVAL; + } + /* init registers */ + switch (dev->descriptor.idProduct) { + case USB_PID_DW2102: + dw2102_op_rw + (dev, 0xbf, 0x0040, &reset, 0, + DW2102_WRITE_MSG); + dw2102_op_rw + (dev, 0xb9, 0x0000, &reset16[0], 2, + DW2102_READ_MSG); + break; + case 0x2101: + dw2102_op_rw + (dev, 0xbc, 0x0030, &reset16[0], 2, + DW2102_READ_MSG); + dw2102_op_rw + (dev, 0xba, 0x0000, &reset16[0], 7, + DW2102_READ_MSG); + dw2102_op_rw + (dev, 0xba, 0x0000, &reset16[0], 7, + DW2102_READ_MSG); + dw2102_op_rw + (dev, 0xb9, 0x0000, &reset16[0], 2, + DW2102_READ_MSG); + break; + } + kfree(p); + } + return ret; +} + +static struct dvb_usb_device_properties dw2102_properties = { + .caps = DVB_USB_IS_AN_I2C_ADAPTER, + .usb_ctrl = DEVICE_SPECIFIC, + .firmware = "dvb-usb-dw2102.fw", + .size_of_priv = sizeof(struct dw2102_state), + .no_reconnect = 1, + + .i2c_algo = &dw2102_i2c_algo, + .rc_key_map = dw2102_rc_keys, + .rc_key_map_size = ARRAY_SIZE(dw2102_rc_keys), + .rc_interval = 150, + .rc_query = dw2102_rc_query, + + .generic_bulk_ctrl_endpoint = 0x81, + /* parameter for the MPEG2-data transfer */ + .num_adapters = 1, + .download_firmware = dw2102_load_firmware, + .adapter = { + { + .frontend_attach = dw2102_frontend_attach, + .streaming_ctrl = NULL, + .tuner_attach = dw2102_tuner_attach, + .stream = { + .type = USB_BULK, + .count = 8, + .endpoint = 0x82, + .u = { + .bulk = { + .buffersize = 4096, + } + } + }, + } + }, + .num_device_descs = 2, + .devices = { + {"DVBWorld DVB-S 2102 USB2.0", + {&dw2102_table[0], NULL}, + {NULL}, + }, + {"DVBWorld DVB-S 2101 USB2.0", + {&dw2102_table[1], NULL}, + {NULL}, + }, + } +}; + +static int dw2102_probe(struct usb_interface *intf, + const struct usb_device_id *id) +{ + return dvb_usb_device_init(intf, &dw2102_properties, + THIS_MODULE, NULL, adapter_nr); +} + +static struct usb_driver dw2102_driver = { + .name = "dw2102", + .probe = dw2102_probe, + .disconnect = dvb_usb_device_exit, + .id_table = dw2102_table, +}; + +static int __init dw2102_module_init(void) +{ + int ret = usb_register(&dw2102_driver); + if (ret) + err("usb_register failed. Error number %d", ret); + + return ret; +} + +static void __exit dw2102_module_exit(void) +{ + usb_deregister(&dw2102_driver); +} + +module_init(dw2102_module_init); +module_exit(dw2102_module_exit); + +MODULE_AUTHOR("Igor M. Liplianin (c) liplianin@me.by"); +MODULE_DESCRIPTION("Driver for DVBWorld DVB-S 2101 2102 USB2.0 device"); +MODULE_VERSION("0.1"); +MODULE_LICENSE("GPL"); diff --git a/linux/drivers/media/dvb/dvb-usb/dw2102.h b/linux/drivers/media/dvb/dvb-usb/dw2102.h new file mode 100644 index 000000000..7a310f906 --- /dev/null +++ b/linux/drivers/media/dvb/dvb-usb/dw2102.h @@ -0,0 +1,9 @@ +#ifndef _DW2102_H_ +#define _DW2102_H_ + +#define DVB_USB_LOG_PREFIX "dw2102" +#include "dvb-usb.h" + +extern int dvb_usb_dw2102_debug; +#define deb_xfer(args...) dprintk(dvb_usb_dw2102_debug, 0x02, args) +#endif diff --git a/linux/drivers/media/dvb/dvb-usb/gp8psk.c b/linux/drivers/media/dvb/dvb-usb/gp8psk.c index 6eb8cc37f..1b002909b 100644 --- a/linux/drivers/media/dvb/dvb-usb/gp8psk.c +++ b/linux/drivers/media/dvb/dvb-usb/gp8psk.c @@ -86,7 +86,8 @@ static int gp8psk_load_bcm4500fw(struct dvb_usb_device *d) { int ret; const struct firmware *fw = NULL; - u8 *ptr, *buf; + const u8 *ptr; + u8 *buf; if ((ret = request_firmware(&fw, bcm4500_firmware, &d->udev->dev)) != 0) { err("did not find the bcm4500 firmware file. (%s) " diff --git a/linux/drivers/media/dvb/frontends/bcm3510.c b/linux/drivers/media/dvb/frontends/bcm3510.c index 1cd63a4df..ba85a5618 100644 --- a/linux/drivers/media/dvb/frontends/bcm3510.c +++ b/linux/drivers/media/dvb/frontends/bcm3510.c @@ -591,7 +591,8 @@ static void bcm3510_release(struct dvb_frontend* fe) */ #define BCM3510_DEFAULT_FIRMWARE "dvb-fe-bcm3510-01.fw" -static int bcm3510_write_ram(struct bcm3510_state *st, u16 addr, u8 *b, u16 len) +static int bcm3510_write_ram(struct bcm3510_state *st, u16 addr, const u8 *b, + u16 len) { int ret = 0,i; bcm3510_register_value vH, vL,vD; @@ -615,7 +616,7 @@ static int bcm3510_download_firmware(struct dvb_frontend* fe) struct bcm3510_state* st = fe->demodulator_priv; const struct firmware *fw; u16 addr,len; - u8 *b; + const u8 *b; int ret,i; deb_info("requesting firmware\n"); diff --git a/linux/drivers/media/dvb/frontends/nxt200x.c b/linux/drivers/media/dvb/frontends/nxt200x.c index 9172843dd..a079fa824 100644 --- a/linux/drivers/media/dvb/frontends/nxt200x.c +++ b/linux/drivers/media/dvb/frontends/nxt200x.c @@ -94,7 +94,8 @@ static u8 i2c_readbytes (struct nxt200x_state* state, u8 addr, u8* buf, u8 len) return 0; } -static int nxt200x_writebytes (struct nxt200x_state* state, u8 reg, u8 *buf, u8 len) +static int nxt200x_writebytes (struct nxt200x_state* state, u8 reg, + const u8 *buf, u8 len) { u8 buf2 [len+1]; int err; diff --git a/linux/drivers/media/dvb/frontends/or51211.c b/linux/drivers/media/dvb/frontends/or51211.c index 7eaa47655..6afe12aac 100644 --- a/linux/drivers/media/dvb/frontends/or51211.c +++ b/linux/drivers/media/dvb/frontends/or51211.c @@ -69,7 +69,7 @@ struct or51211_state { u32 current_frequency; }; -static int i2c_writebytes (struct or51211_state* state, u8 reg, u8 *buf, +static int i2c_writebytes (struct or51211_state* state, u8 reg, const u8 *buf, int len) { int err; @@ -77,7 +77,7 @@ static int i2c_writebytes (struct or51211_state* state, u8 reg, u8 *buf, msg.addr = reg; msg.flags = 0; msg.len = len; - msg.buf = buf; + msg.buf = (u8 *)buf; if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) { printk(KERN_WARNING "or51211: i2c_writebytes error " diff --git a/linux/drivers/media/dvb/frontends/sp8870.c b/linux/drivers/media/dvb/frontends/sp8870.c index aa78aa14a..1c9a9b405 100644 --- a/linux/drivers/media/dvb/frontends/sp8870.c +++ b/linux/drivers/media/dvb/frontends/sp8870.c @@ -98,7 +98,7 @@ static int sp8870_readreg (struct sp8870_state* state, u16 reg) static int sp8870_firmware_upload (struct sp8870_state* state, const struct firmware *fw) { struct i2c_msg msg; - char *fw_buf = fw->data; + const char *fw_buf = fw->data; int fw_pos; u8 tx_buf[255]; int tx_len; diff --git a/linux/drivers/media/dvb/frontends/sp887x.c b/linux/drivers/media/dvb/frontends/sp887x.c index 49f55877f..4543609e1 100644 --- a/linux/drivers/media/dvb/frontends/sp887x.c +++ b/linux/drivers/media/dvb/frontends/sp887x.c @@ -140,7 +140,7 @@ static int sp887x_initial_setup (struct dvb_frontend* fe, const struct firmware u8 buf [BLOCKSIZE+2]; int i; int fw_size = fw->size; - unsigned char *mem = fw->data; + const unsigned char *mem = fw->data; dprintk("%s\n", __func__); diff --git a/linux/drivers/media/dvb/frontends/tda1002x.h b/linux/drivers/media/dvb/frontends/tda1002x.h index afc0a32ea..04d19418b 100644 --- a/linux/drivers/media/dvb/frontends/tda1002x.h +++ b/linux/drivers/media/dvb/frontends/tda1002x.h @@ -76,7 +76,7 @@ extern struct dvb_frontend *tda10023_attach( struct i2c_adapter *i2c, u8 pwm); #else static inline struct dvb_frontend *tda10023_attach( - const struct tda1002x_config *config, + const struct tda10023_config *config, struct i2c_adapter *i2c, u8 pwm) { printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); diff --git a/linux/drivers/media/dvb/frontends/tda10048.c b/linux/drivers/media/dvb/frontends/tda10048.c index f2d66234a..7c718e247 100644 --- a/linux/drivers/media/dvb/frontends/tda10048.c +++ b/linux/drivers/media/dvb/frontends/tda10048.c @@ -233,7 +233,7 @@ static u8 tda10048_readreg(struct tda10048_state *state, u8 reg) } static int tda10048_writeregbulk(struct tda10048_state *state, u8 reg, - u8 *data, u16 len) + const u8 *data, u16 len) { int ret = -EREMOTEIO; struct i2c_msg msg; diff --git a/linux/drivers/media/dvb/frontends/tda1004x.c b/linux/drivers/media/dvb/frontends/tda1004x.c index a0d638653..1465ff77b 100644 --- a/linux/drivers/media/dvb/frontends/tda1004x.c +++ b/linux/drivers/media/dvb/frontends/tda1004x.c @@ -317,7 +317,7 @@ static int tda10046h_set_bandwidth(struct tda1004x_state *state, } static int tda1004x_do_upload(struct tda1004x_state *state, - unsigned char *mem, unsigned int len, + const unsigned char *mem, unsigned int len, u8 dspCodeCounterReg, u8 dspCodeInReg) { u8 buf[65]; diff --git a/linux/drivers/media/dvb/frontends/z0194a.h b/linux/drivers/media/dvb/frontends/z0194a.h new file mode 100644 index 000000000..d2876d2e1 --- /dev/null +++ b/linux/drivers/media/dvb/frontends/z0194a.h @@ -0,0 +1,97 @@ +/* z0194a.h Sharp z0194a tuner support +* +* Copyright (C) 2008 Igor M. Liplianin (liplianin@me.by) +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation, version 2. +* +* see Documentation/dvb/README.dvb-usb for more information +*/ + +#ifndef Z0194A +#define Z0194A + +static int sharp_z0194a__set_symbol_rate(struct dvb_frontend *fe, + u32 srate, u32 ratio) +{ + u8 aclk = 0; + u8 bclk = 0; + + if (srate < 1500000) { + aclk = 0xb7; bclk = 0x47; } + else if (srate < 3000000) { + aclk = 0xb7; bclk = 0x4b; } + else if (srate < 7000000) { + aclk = 0xb7; bclk = 0x4f; } + else if (srate < 14000000) { + aclk = 0xb7; bclk = 0x53; } + else if (srate < 30000000) { + aclk = 0xb6; bclk = 0x53; } + else if (srate < 45000000) { + aclk = 0xb4; bclk = 0x51; } + + stv0299_writereg(fe, 0x13, aclk); + stv0299_writereg(fe, 0x14, bclk); + stv0299_writereg(fe, 0x1f, (ratio >> 16) & 0xff); + stv0299_writereg(fe, 0x20, (ratio >> 8) & 0xff); + stv0299_writereg(fe, 0x21, (ratio) & 0xf0); + + return 0; +} + +static u8 sharp_z0194a__inittab[] = { + 0x01, 0x15, + 0x02, 0x00, + 0x03, 0x00, + 0x04, 0x7d, /* F22FR = 0x7d, F22 = f_VCO / 128 / 0x7d = 22 kHz */ + 0x05, 0x35, /* I2CT = 0, SCLT = 1, SDAT = 1 */ + 0x06, 0x40, /* DAC not used, set to high impendance mode */ + 0x07, 0x00, /* DAC LSB */ + 0x08, 0x40, /* DiSEqC off, LNB power on OP2/LOCK pin on */ + 0x09, 0x00, /* FIFO */ + 0x0c, 0x51, /* OP1 ctl = Normal, OP1 val = 1 (LNB Power ON) */ + 0x0d, 0x82, /* DC offset compensation = ON, beta_agc1 = 2 */ + 0x0e, 0x23, /* alpha_tmg = 2, beta_tmg = 3 */ + 0x10, 0x3f, /* AGC2 0x3d */ + 0x11, 0x84, + 0x12, 0xb9, + 0x15, 0xc9, /* lock detector threshold */ + 0x16, 0x00, + 0x17, 0x00, + 0x18, 0x00, + 0x19, 0x00, + 0x1a, 0x00, + 0x1f, 0x50, + 0x20, 0x00, + 0x21, 0x00, + 0x22, 0x00, + 0x23, 0x00, + 0x28, 0x00, /* out imp: normal out type: parallel FEC mode:0 */ + 0x29, 0x1e, /* 1/2 threshold */ + 0x2a, 0x14, /* 2/3 threshold */ + 0x2b, 0x0f, /* 3/4 threshold */ + 0x2c, 0x09, /* 5/6 threshold */ + 0x2d, 0x05, /* 7/8 threshold */ + 0x2e, 0x01, + 0x31, 0x1f, /* test all FECs */ + 0x32, 0x19, /* viterbi and synchro search */ + 0x33, 0xfc, /* rs control */ + 0x34, 0x93, /* error control */ + 0x0f, 0x52, + 0xff, 0xff +}; + +static struct stv0299_config sharp_z0194a_config = { + .demod_address = 0x68, + .inittab = sharp_z0194a__inittab, + .mclk = 88000000UL, + .invert = 1, + .skip_reinit = 0, + .lock_output = STV0299_LOCKOUTPUT_1, + .volt13_op0_op1 = STV0299_VOLT13_OP1, + .min_delay_ms = 100, + .set_symbol_rate = sharp_z0194a__set_symbol_rate, +}; + +#endif diff --git a/linux/drivers/media/dvb/siano/smscoreapi.h b/linux/drivers/media/dvb/siano/smscoreapi.h index 482ef0676..dbedc315f 100644 --- a/linux/drivers/media/dvb/siano/smscoreapi.h +++ b/linux/drivers/media/dvb/siano/smscoreapi.h @@ -29,6 +29,7 @@ #include <linux/scatterlist.h> #include <linux/types.h> #include <asm/page.h> + #include "compat.h" #include "dmxdev.h" #include "dvbdev.h" diff --git a/linux/drivers/media/dvb/siano/smsusb.c b/linux/drivers/media/dvb/siano/smsusb.c index 079deb2a1..40582bf70 100644 --- a/linux/drivers/media/dvb/siano/smsusb.c +++ b/linux/drivers/media/dvb/siano/smsusb.c @@ -55,7 +55,7 @@ struct smsusb_device_t { static int smsusb_submit_urb(struct smsusb_device_t *dev, struct smsusb_urb_t *surb); -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19) static void smsusb_onresponse(struct urb *urb) #else static void smsusb_onresponse(struct urb *urb, struct pt_regs *regs) diff --git a/linux/drivers/media/dvb/ttpci/Makefile b/linux/drivers/media/dvb/ttpci/Makefile index 3819390b1..714512372 100644 --- a/linux/drivers/media/dvb/ttpci/Makefile +++ b/linux/drivers/media/dvb/ttpci/Makefile @@ -3,7 +3,11 @@ # and the AV7110 DVB device driver # -dvb-ttpci-objs := av7110_hw.o av7110_v4l.o av7110_av.o av7110_ca.o av7110.o av7110_ipack.o av7110_ir.o +dvb-ttpci-objs := av7110_hw.o av7110_v4l.o av7110_av.o av7110_ca.o av7110.o av7110_ipack.o + +ifdef CONFIG_INPUT_EVDEV +dvb-ttpci-objs += av7110_ir.o +endif obj-$(CONFIG_TTPCI_EEPROM) += ttpci-eeprom.o obj-$(CONFIG_DVB_BUDGET_CORE) += budget-core.o diff --git a/linux/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c b/linux/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c index 133648277..ceae085cb 100644 --- a/linux/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c +++ b/linux/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c @@ -21,6 +21,9 @@ #include <linux/jiffies.h> #include "compat.h" #include <linux/mutex.h> +#ifdef TTUSB_KERNEL +#include <linux/firmware.h> +#endif #include "dvb_frontend.h" #include "dmxdev.h" @@ -287,13 +290,27 @@ static int master_xfer(struct i2c_adapter* adapter, struct i2c_msg *msg, int num return i; } +#ifndef TTUSB_KERNEL #include "dvb-ttusb-dspbootcode.h" +#endif static int ttusb_boot_dsp(struct ttusb *ttusb) { +#ifdef TTUSB_KERNEL + const struct firmware *fw; +#endif int i, err; u8 b[40]; +#ifdef TTUSB_KERNEL + err = request_firmware(&fw, "ttusb-budget/dspbootcode.bin", + &ttusb->dev->dev); + if (err) { + printk(KERN_ERR "ttusb-budget: failed to request firmware\n"); + return err; + } + +#endif /* BootBlock */ b[0] = 0xaa; b[2] = 0x13; @@ -301,8 +318,13 @@ static int ttusb_boot_dsp(struct ttusb *ttusb) /* upload dsp code in 32 byte steps (36 didn't work for me ...) */ /* 32 is max packet size, no messages should be splitted. */ +#ifndef TTUSB_KERNEL for (i = 0; i < sizeof(dsp_bootcode); i += 28) { memcpy(&b[4], &dsp_bootcode[i], 28); +#else + for (i = 0; i < fw->size; i += 28) { + memcpy(&b[4], &fw->data[i], 28); +#endif b[1] = ++ttusb->c; @@ -1809,3 +1831,6 @@ module_exit(ttusb_exit); MODULE_AUTHOR("Holger Waechtler <holger@convergence.de>"); MODULE_DESCRIPTION("TTUSB DVB Driver"); MODULE_LICENSE("GPL"); +#ifdef TTUSB_KERNEL +MODULE_FIRMWARE("ttusb-budget/dspbootcode.bin"); +#endif diff --git a/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c b/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c index 8491913aa..0fdcb19cb 100644 --- a/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c +++ b/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c @@ -1284,7 +1284,11 @@ static int ttusb_dec_boot_dsp(struct ttusb_dec *dec) u8 b1[] = { 0x61 }; u8 *b; char idstring[21]; +#ifndef TTUSB_KERNEL u8 *firmware = NULL; +#else + const u8 *firmware = NULL; +#endif size_t firmware_size = 0; u16 firmware_csum = 0; __be16 firmware_csum_ns; diff --git a/linux/drivers/media/radio/dsbr100.c b/linux/drivers/media/radio/dsbr100.c index 587099b3a..92089e705 100644 --- a/linux/drivers/media/radio/dsbr100.c +++ b/linux/drivers/media/radio/dsbr100.c @@ -85,6 +85,7 @@ #include <linux/input.h> #include <linux/videodev2.h> #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <linux/usb.h> #include "compat.h" diff --git a/linux/drivers/media/radio/miropcm20-radio.c b/linux/drivers/media/radio/miropcm20-radio.c index de971937e..8dacd5522 100644 --- a/linux/drivers/media/radio/miropcm20-radio.c +++ b/linux/drivers/media/radio/miropcm20-radio.c @@ -24,6 +24,7 @@ #include "compat.h" #include <linux/videodev.h> #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include "oss/aci.h" #include "miropcm20-rds-core.h" diff --git a/linux/drivers/media/radio/miropcm20-rds.c b/linux/drivers/media/radio/miropcm20-rds.c index 06dfed9ef..af90cdcf2 100644 --- a/linux/drivers/media/radio/miropcm20-rds.c +++ b/linux/drivers/media/radio/miropcm20-rds.c @@ -12,6 +12,7 @@ #include <linux/module.h> #include <linux/init.h> #include <linux/slab.h> +#include <linux/smp_lock.h> #include <linux/fs.h> #include <linux/miscdevice.h> #include <linux/delay.h> @@ -27,13 +28,16 @@ static int rds_f_open(struct inode *in, struct file *fi) if (rds_users) return -EBUSY; + lock_kernel(); rds_users++; if ((text_buffer=kmalloc(66, GFP_KERNEL)) == 0) { rds_users--; printk(KERN_NOTICE "aci-rds: Out of memory by open()...\n"); + unlock_kernel(); return -ENOMEM; } + unlock_kernel(); return 0; } @@ -104,7 +108,11 @@ static ssize_t rds_f_read(struct file *file, char __user *buffer, size_t length, } } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 17) static const struct file_operations rds_fops = { +#else +static struct file_operations rds_fops = { +#endif .owner = THIS_MODULE, .read = rds_f_read, .open = rds_f_open, diff --git a/linux/drivers/media/radio/radio-aimslab.c b/linux/drivers/media/radio/radio-aimslab.c index 06313a334..4b133820e 100644 --- a/linux/drivers/media/radio/radio-aimslab.c +++ b/linux/drivers/media/radio/radio-aimslab.c @@ -37,6 +37,7 @@ #include "compat.h" #include <linux/videodev2.h> /* kernel radio structs */ #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <linux/version.h> /* for KERNEL_VERSION MACRO */ #define RADIO_VERSION KERNEL_VERSION(0,0,2) diff --git a/linux/drivers/media/radio/radio-aztech.c b/linux/drivers/media/radio/radio-aztech.c index 1fbf32d15..124df79a0 100644 --- a/linux/drivers/media/radio/radio-aztech.c +++ b/linux/drivers/media/radio/radio-aztech.c @@ -34,6 +34,7 @@ #include "compat.h" #include <linux/videodev2.h> /* kernel radio structs */ #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <linux/version.h> /* for KERNEL_VERSION MACRO */ #define RADIO_VERSION KERNEL_VERSION(0,0,2) diff --git a/linux/drivers/media/radio/radio-cadet.c b/linux/drivers/media/radio/radio-cadet.c index 007821aea..88e6502af 100644 --- a/linux/drivers/media/radio/radio-cadet.c +++ b/linux/drivers/media/radio/radio-cadet.c @@ -40,6 +40,7 @@ #include "compat.h" #include <linux/videodev2.h> /* V4L2 API defs */ #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <linux/param.h> #include <linux/pnp.h> diff --git a/linux/drivers/media/radio/radio-gemtek-pci.c b/linux/drivers/media/radio/radio-gemtek-pci.c index d367ea883..bf2704841 100644 --- a/linux/drivers/media/radio/radio-gemtek-pci.c +++ b/linux/drivers/media/radio/radio-gemtek-pci.c @@ -47,6 +47,7 @@ #include "compat.h" #include <linux/videodev2.h> #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <linux/errno.h> #include <linux/version.h> /* for KERNEL_VERSION MACRO */ diff --git a/linux/drivers/media/radio/radio-gemtek.c b/linux/drivers/media/radio/radio-gemtek.c index 43a611d69..3f77c0b57 100644 --- a/linux/drivers/media/radio/radio-gemtek.c +++ b/linux/drivers/media/radio/radio-gemtek.c @@ -24,6 +24,7 @@ #include <asm/uaccess.h> /* copy to/from user */ #include "compat.h" #include <linux/videodev2.h> /* kernel radio structs */ +#include <media/v4l2-ioctl.h> #include <media/v4l2-common.h> #include <linux/spinlock.h> diff --git a/linux/drivers/media/radio/radio-maestro.c b/linux/drivers/media/radio/radio-maestro.c index a9c8d3476..00b6cc174 100644 --- a/linux/drivers/media/radio/radio-maestro.c +++ b/linux/drivers/media/radio/radio-maestro.c @@ -27,6 +27,7 @@ #include <linux/pci.h> #include <linux/videodev2.h> #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include "compat.h" #include <linux/version.h> /* for KERNEL_VERSION MACRO */ diff --git a/linux/drivers/media/radio/radio-maxiradio.c b/linux/drivers/media/radio/radio-maxiradio.c index ae3fe626e..612c71fed 100644 --- a/linux/drivers/media/radio/radio-maxiradio.c +++ b/linux/drivers/media/radio/radio-maxiradio.c @@ -44,6 +44,7 @@ #include <linux/pci.h> #include <linux/videodev2.h> #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include "compat.h" #define DRIVER_VERSION "0.77" diff --git a/linux/drivers/media/radio/radio-rtrack2.c b/linux/drivers/media/radio/radio-rtrack2.c index 4725c5146..3936b15e8 100644 --- a/linux/drivers/media/radio/radio-rtrack2.c +++ b/linux/drivers/media/radio/radio-rtrack2.c @@ -18,6 +18,7 @@ #include "compat.h" #include <linux/videodev2.h> /* kernel radio structs */ #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <linux/spinlock.h> #include <linux/version.h> /* for KERNEL_VERSION MACRO */ diff --git a/linux/drivers/media/radio/radio-sf16fmi.c b/linux/drivers/media/radio/radio-sf16fmi.c index adc140f7b..5a1c231df 100644 --- a/linux/drivers/media/radio/radio-sf16fmi.c +++ b/linux/drivers/media/radio/radio-sf16fmi.c @@ -25,6 +25,7 @@ #include "compat.h" #include <linux/videodev2.h> /* kernel radio structs */ #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <linux/isapnp.h> #include <asm/io.h> /* outb, outb_p */ #include <asm/uaccess.h> /* copy to/from user */ diff --git a/linux/drivers/media/radio/radio-sf16fmr2.c b/linux/drivers/media/radio/radio-sf16fmr2.c index 2cb47a0c8..555b97a6c 100644 --- a/linux/drivers/media/radio/radio-sf16fmr2.c +++ b/linux/drivers/media/radio/radio-sf16fmr2.c @@ -23,6 +23,7 @@ #include "compat.h" #include <linux/videodev2.h> /* kernel radio structs */ #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <linux/mutex.h> static struct mutex lock; diff --git a/linux/drivers/media/radio/radio-si470x.c b/linux/drivers/media/radio/radio-si470x.c index 55c1a9b7b..110989cac 100644 --- a/linux/drivers/media/radio/radio-si470x.c +++ b/linux/drivers/media/radio/radio-si470x.c @@ -134,6 +134,7 @@ #include <linux/videodev2.h> #include <linux/mutex.h> #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <media/rds.h> #include <asm/unaligned.h> diff --git a/linux/drivers/media/radio/radio-terratec.c b/linux/drivers/media/radio/radio-terratec.c index 64d821902..f88ab2816 100644 --- a/linux/drivers/media/radio/radio-terratec.c +++ b/linux/drivers/media/radio/radio-terratec.c @@ -33,6 +33,7 @@ #include "compat.h" #include <linux/videodev2.h> /* kernel radio structs */ #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <linux/spinlock.h> #include <linux/version.h> /* for KERNEL_VERSION MACRO */ diff --git a/linux/drivers/media/radio/radio-trust.c b/linux/drivers/media/radio/radio-trust.c index 680e0c90f..3e72b1c6c 100644 --- a/linux/drivers/media/radio/radio-trust.c +++ b/linux/drivers/media/radio/radio-trust.c @@ -24,6 +24,7 @@ #include "compat.h" #include <linux/videodev2.h> #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <linux/version.h> /* for KERNEL_VERSION MACRO */ #define RADIO_VERSION KERNEL_VERSION(0,0,2) diff --git a/linux/drivers/media/radio/radio-typhoon.c b/linux/drivers/media/radio/radio-typhoon.c index 9b69eaf5a..b076936dd 100644 --- a/linux/drivers/media/radio/radio-typhoon.c +++ b/linux/drivers/media/radio/radio-typhoon.c @@ -41,6 +41,7 @@ #include "compat.h" #include <linux/videodev2.h> /* kernel radio structs */ #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <linux/version.h> /* for KERNEL_VERSION MACRO */ #define RADIO_VERSION KERNEL_VERSION(0,1,1) diff --git a/linux/drivers/media/radio/radio-zoltrix.c b/linux/drivers/media/radio/radio-zoltrix.c index 197379ae6..0bcc38b46 100644 --- a/linux/drivers/media/radio/radio-zoltrix.c +++ b/linux/drivers/media/radio/radio-zoltrix.c @@ -38,6 +38,7 @@ #include "compat.h" #include <linux/videodev2.h> /* kernel radio structs */ #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <linux/version.h> /* for KERNEL_VERSION MACRO */ #define RADIO_VERSION KERNEL_VERSION(0,0,2) diff --git a/linux/drivers/media/video/Kconfig b/linux/drivers/media/video/Kconfig index 45c90b8bc..2a747db6d 100644 --- a/linux/drivers/media/video/Kconfig +++ b/linux/drivers/media/video/Kconfig @@ -24,21 +24,21 @@ config VIDEOBUF_VMALLOC select VIDEOBUF_GEN tristate +config VIDEOBUF_DMA_CONTIG + depends on HAS_DMA + select VIDEOBUF_GEN + tristate + config VIDEOBUF_DVB tristate select VIDEOBUF_GEN - select VIDEOBUF_DMA_SG config VIDEO_BTCX tristate -config VIDEO_IR_I2C - tristate - config VIDEO_IR tristate depends on INPUT - select VIDEO_IR_I2C if I2C config VIDEO_TVEEPROM tristate @@ -84,6 +84,19 @@ config VIDEO_HELPER_CHIPS_AUTO In doubt, say Y. +config VIDEO_IR_I2C + tristate "I2C module for IR" if !VIDEO_HELPER_CHIPS_AUTO + depends on I2C && VIDEO_IR + default y + ---help--- + Most boards have an IR chip directly connected via GPIO. However, + some video boards have the IR connected via I2C bus. + + If your board doesn't have an I2C IR chip, you may disable this + option. + + In doubt, say Y. + # # Encoder / Decoder module configuration # @@ -600,9 +613,6 @@ config VIDEO_STRADIS driver for PCI. There is a product page at <http://www.stradis.com/>. -config VIDEO_ZORAN_ZR36060 - tristate - config VIDEO_ZORAN tristate "Zoran ZR36057/36067 Video For Linux" depends on PCI && I2C_ALGOBIT && VIDEO_V4L1 && VIRT_TO_BUS @@ -616,61 +626,64 @@ config VIDEO_ZORAN To compile this driver as a module, choose M here: the module will be called zr36067. +config VIDEO_ZORAN_DC30 + tristate "Pinnacle/Miro DC30(+) support" + depends on VIDEO_ZORAN + select VIDEO_ADV7175 if VIDEO_HELPER_CHIPS_AUTO + select VIDEO_VPX3220 if VIDEO_HELPER_CHIPS_AUTO + help + Support for the Pinnacle/Miro DC30(+) MJPEG capture/playback + card. This also supports really old DC10 cards based on the + zr36050 MJPEG codec and zr36016 VFE. + +config VIDEO_ZORAN_ZR36060 + tristate "Zoran ZR36060" + depends on VIDEO_ZORAN + help + Say Y to support Zoran boards based on 36060 chips. + This includes Iomega Bus, Pinnacle DC10, Linux media Labs 33 + and 33 R10 and AverMedia 6 boards. + config VIDEO_ZORAN_BUZ tristate "Iomega Buz support" - depends on VIDEO_ZORAN + depends on VIDEO_ZORAN_ZR36060 select VIDEO_SAA7111 if VIDEO_HELPER_CHIPS_AUTO select VIDEO_SAA7185 if VIDEO_HELPER_CHIPS_AUTO - select VIDEO_ZORAN_ZR36060 help Support for the Iomega Buz MJPEG capture/playback card. config VIDEO_ZORAN_DC10 tristate "Pinnacle/Miro DC10(+) support" - depends on VIDEO_ZORAN - select VIDEO_SAA7110 + depends on VIDEO_ZORAN_ZR36060 + select VIDEO_SAA7110 if VIDEO_HELPER_CHIPS_AUTO select VIDEO_ADV7175 if VIDEO_HELPER_CHIPS_AUTO - select VIDEO_ZORAN_ZR36060 help Support for the Pinnacle/Miro DC10(+) MJPEG capture/playback card. -config VIDEO_ZORAN_DC30 - tristate "Pinnacle/Miro DC30(+) support" - depends on VIDEO_ZORAN - select VIDEO_ADV7175 if VIDEO_HELPER_CHIPS_AUTO - select VIDEO_VPX3220 if VIDEO_HELPER_CHIPS_AUTO - help - Support for the Pinnacle/Miro DC30(+) MJPEG capture/playback - card. This also supports really old DC10 cards based on the - zr36050 MJPEG codec and zr36016 VFE. - config VIDEO_ZORAN_LML33 tristate "Linux Media Labs LML33 support" - depends on VIDEO_ZORAN + depends on VIDEO_ZORAN_ZR36060 select VIDEO_BT819 if VIDEO_HELPER_CHIPS_AUTO select VIDEO_BT856 if VIDEO_HELPER_CHIPS_AUTO - select VIDEO_ZORAN_ZR36060 help Support for the Linux Media Labs LML33 MJPEG capture/playback card. config VIDEO_ZORAN_LML33R10 tristate "Linux Media Labs LML33R10 support" - depends on VIDEO_ZORAN + depends on VIDEO_ZORAN_ZR36060 select VIDEO_SAA7114 if VIDEO_HELPER_CHIPS_AUTO select VIDEO_ADV7170 if VIDEO_HELPER_CHIPS_AUTO - select VIDEO_ZORAN_ZR36060 help support for the Linux Media Labs LML33R10 MJPEG capture/playback card. config VIDEO_ZORAN_AVS6EYES tristate "AverMedia 6 Eyes support (EXPERIMENTAL)" - depends on VIDEO_ZORAN && EXPERIMENTAL && VIDEO_V4L1 + depends on VIDEO_ZORAN_ZR36060 && EXPERIMENTAL && VIDEO_V4L1 select VIDEO_BT856 if VIDEO_HELPER_CHIPS_AUTO select VIDEO_KS0127 if VIDEO_HELPER_CHIPS_AUTO - select VIDEO_ZORAN_ZR36060 help Support for the AverMedia 6 Eyes video surveillance card. @@ -915,7 +928,7 @@ endif # V4L_USB_DRIVERS config SOC_CAMERA tristate "SoC camera support" depends on VIDEO_V4L2 && HAS_DMA - select VIDEOBUF_DMA_SG + select VIDEOBUF_GEN help SoC Camera is a common API to several cameras, not connecting over a bus like PCI or USB. For example some i2c camera connected @@ -950,11 +963,26 @@ config MT9V022_PCA9536_SWITCH Select this if your MT9V022 camera uses a PCA9536 I2C GPIO extender to switch between 8 and 10 bit datawidth modes +config SOC_CAMERA_PLATFORM + tristate "platform camera support" + depends on SOC_CAMERA + help + This is a generic SoC camera platform driver, useful for testing + config VIDEO_PXA27x tristate "PXA27x Quick Capture Interface driver" depends on VIDEO_DEV && PXA27x select SOC_CAMERA + select VIDEOBUF_DMA_SG ---help--- This is a v4l2 driver for the PXA27x Quick Capture Interface +config VIDEO_SH_MOBILE_CEU + tristate "SuperH Mobile CEU Interface driver" + depends on VIDEO_DEV + select SOC_CAMERA + select VIDEOBUF_DMA_CONTIG + ---help--- + This is a v4l2 driver for the SuperH Mobile CEU Interface + endif # VIDEO_CAPTURE_DRIVERS diff --git a/linux/drivers/media/video/Makefile b/linux/drivers/media/video/Makefile index 0a1837c99..a0240a105 100644 --- a/linux/drivers/media/video/Makefile +++ b/linux/drivers/media/video/Makefile @@ -10,6 +10,8 @@ msp3400-objs := msp3400-driver.o msp3400-kthreads.o stkwebcam-objs := stk-webcam.o stk-sensor.o +videodev-objs := v4l2-dev.o v4l2-ioctl.o + obj-$(CONFIG_VIDEO_DEV) += videodev.o compat_ioctl32.o v4l2-int-device.o obj-$(CONFIG_VIDEO_V4L2_COMMON) += v4l2-common.o @@ -89,6 +91,7 @@ obj-$(CONFIG_VIDEO_TUNER) += tuner.o obj-$(CONFIG_VIDEOBUF_GEN) += videobuf-core.o obj-$(CONFIG_VIDEOBUF_DMA_SG) += videobuf-dma-sg.o +obj-$(CONFIG_VIDEOBUF_DMA_CONTIG) += videobuf-dma-contig.o obj-$(CONFIG_VIDEOBUF_VMALLOC) += videobuf-vmalloc.o obj-$(CONFIG_VIDEOBUF_DVB) += videobuf-dvb.o obj-$(CONFIG_VIDEO_BTCX) += btcx-risc.o @@ -133,9 +136,11 @@ obj-$(CONFIG_VIDEO_VIVI) += vivi.o obj-$(CONFIG_VIDEO_CX23885) += cx23885/ obj-$(CONFIG_VIDEO_PXA27x) += pxa_camera.o +obj-$(CONFIG_VIDEO_SH_MOBILE_CEU) += sh_mobile_ceu_camera.o obj-$(CONFIG_SOC_CAMERA) += soc_camera.o obj-$(CONFIG_SOC_CAMERA_MT9M001) += mt9m001.o obj-$(CONFIG_SOC_CAMERA_MT9V022) += mt9v022.o +obj-$(CONFIG_SOC_CAMERA_PLATFORM) += soc_camera_platform.o obj-$(CONFIG_VIDEO_AU0828) += au0828/ diff --git a/linux/drivers/media/video/bt819.c b/linux/drivers/media/video/bt819.c index 402bccaf7..90be239cc 100644 --- a/linux/drivers/media/video/bt819.c +++ b/linux/drivers/media/video/bt819.c @@ -517,7 +517,7 @@ bt819_detect_client (struct i2c_adapter *adapter, dprintk(1, KERN_INFO - "saa7111.c: detecting bt819 client on address 0x%x\n", + "bt819: detecting bt819 client on address 0x%x\n", address << 1); /* Check if the adapter supports the needed features */ diff --git a/linux/drivers/media/video/bt8xx/bttv-cards.c b/linux/drivers/media/video/bt8xx/bttv-cards.c index df2dfd2ba..ff9d09f09 100644 --- a/linux/drivers/media/video/bt8xx/bttv-cards.c +++ b/linux/drivers/media/video/bt8xx/bttv-cards.c @@ -3809,7 +3809,8 @@ static int terratec_active_radio_upgrade(struct bttv *btv) #define BTTV_ALT_DCLK 0x100000 #define BTTV_ALT_NCONFIG 0x800000 -static int __devinit pvr_altera_load(struct bttv *btv, u8 *micro, u32 microlen) +static int __devinit pvr_altera_load(struct bttv *btv, const u8 *micro, + u32 microlen) { u32 n; u8 bits; diff --git a/linux/drivers/media/video/bt8xx/bttv-driver.c b/linux/drivers/media/video/bt8xx/bttv-driver.c index 9877a7124..17fa68233 100644 --- a/linux/drivers/media/video/bt8xx/bttv-driver.c +++ b/linux/drivers/media/video/bt8xx/bttv-driver.c @@ -45,6 +45,7 @@ #include <linux/kdev_t.h> #include "bttvp.h" #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <media/tvaudio.h> #include <media/msp3400.h> @@ -163,8 +164,8 @@ MODULE_LICENSE("GPL"); static ssize_t show_card(struct device *cd, struct device_attribute *attr, char *buf) { - struct video_device *vfd = container_of(cd, struct video_device, class_dev); - struct bttv *btv = dev_get_drvdata(vfd->dev); + struct video_device *vfd = container_of(cd, struct video_device, dev); + struct bttv *btv = dev_get_drvdata(vfd->parent); return sprintf(buf, "%d\n", btv ? btv->c.type : UNSET); } static DEVICE_ATTR(card, S_IRUGO, show_card, NULL); @@ -4209,7 +4210,7 @@ static struct video_device *vdev_init(struct bttv *btv, return NULL; *vfd = *template; vfd->minor = -1; - vfd->dev = &btv->c.pci->dev; + vfd->parent = &btv->c.pci->dev; vfd->release = video_device_release; vfd->type = type; vfd->debug = bttv_debug; @@ -4268,7 +4269,7 @@ static int __devinit bttv_register_video(struct bttv *btv) goto err; printk(KERN_INFO "bttv%d: registered device video%d\n", btv->c.nr,btv->video_dev->minor & 0x1f); - if (device_create_file(&btv->video_dev->class_dev, + if (device_create_file(&btv->video_dev->dev, &dev_attr_card)<0) { printk(KERN_ERR "bttv%d: device_create_file 'card' " "failed\n", btv->c.nr); diff --git a/linux/drivers/media/video/bt8xx/bttv-risc.c b/linux/drivers/media/video/bt8xx/bttv-risc.c index a8c98e52c..0cffd3a72 100644 --- a/linux/drivers/media/video/bt8xx/bttv-risc.c +++ b/linux/drivers/media/video/bt8xx/bttv-risc.c @@ -31,6 +31,7 @@ #include <linux/interrupt.h> #include <asm/page.h> #include <asm/pgtable.h> +#include <media/v4l2-ioctl.h> #include "bttvp.h" diff --git a/linux/drivers/media/video/bt8xx/bttv-vbi.c b/linux/drivers/media/video/bt8xx/bttv-vbi.c index 68f28e5fa..6819e21a3 100644 --- a/linux/drivers/media/video/bt8xx/bttv-vbi.c +++ b/linux/drivers/media/video/bt8xx/bttv-vbi.c @@ -29,6 +29,7 @@ #include <linux/kernel.h> #include <linux/interrupt.h> #include <linux/kdev_t.h> +#include <media/v4l2-ioctl.h> #include <asm/io.h> #include "bttvp.h" diff --git a/linux/drivers/media/video/bw-qcam.c b/linux/drivers/media/video/bw-qcam.c index e587fb332..cc247d6bb 100644 --- a/linux/drivers/media/video/bw-qcam.c +++ b/linux/drivers/media/video/bw-qcam.c @@ -75,6 +75,7 @@ OTHER DEALINGS IN THE SOFTWARE. #include "compat.h" #include <linux/videodev.h> #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <linux/mutex.h> #include <asm/uaccess.h> diff --git a/linux/drivers/media/video/c-qcam.c b/linux/drivers/media/video/c-qcam.c index 0755931e7..3824c8601 100644 --- a/linux/drivers/media/video/c-qcam.c +++ b/linux/drivers/media/video/c-qcam.c @@ -36,6 +36,7 @@ #include "compat.h" #include <linux/videodev.h> #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <linux/mutex.h> #include <linux/jiffies.h> diff --git a/linux/drivers/media/video/cafe_ccic.c b/linux/drivers/media/video/cafe_ccic.c index b75c151cc..075d57031 100644 --- a/linux/drivers/media/video/cafe_ccic.c +++ b/linux/drivers/media/video/cafe_ccic.c @@ -26,6 +26,7 @@ #include <linux/videodev2.h> #include "compat.h" #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <media/v4l2-chip-ident.h> #include <linux/device.h> #include <linux/wait.h> @@ -2164,7 +2165,7 @@ static int cafe_pci_probe(struct pci_dev *pdev, cam->v4ldev = cafe_v4l_template; cam->v4ldev.debug = 0; // cam->v4ldev.debug = V4L2_DEBUG_IOCTL_ARG; - cam->v4ldev.dev = &pdev->dev; + cam->v4ldev.parent = &pdev->dev; ret = video_register_device(&cam->v4ldev, VFL_TYPE_GRABBER, -1); if (ret) goto out_smbus; diff --git a/linux/drivers/media/video/compat_ioctl32.c b/linux/drivers/media/video/compat_ioctl32.c index 017c2a8d4..a37f3a64e 100644 --- a/linux/drivers/media/video/compat_ioctl32.c +++ b/linux/drivers/media/video/compat_ioctl32.c @@ -17,7 +17,7 @@ #include <linux/videodev2.h> #include <linux/module.h> #include <linux/smp_lock.h> -#include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include "compat.h" #ifdef CONFIG_COMPAT diff --git a/linux/drivers/media/video/cpia.h b/linux/drivers/media/video/cpia.h index f90857a39..3a6f79420 100644 --- a/linux/drivers/media/video/cpia.h +++ b/linux/drivers/media/video/cpia.h @@ -46,6 +46,7 @@ #include <asm/uaccess.h> #include <linux/videodev.h> #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <linux/list.h> #include <linux/mutex.h> #include "compat.h" diff --git a/linux/drivers/media/video/cpia2/cpia2_core.c b/linux/drivers/media/video/cpia2/cpia2_core.c index c8b9fdb70..eab48dfd0 100644 --- a/linux/drivers/media/video/cpia2/cpia2_core.c +++ b/linux/drivers/media/video/cpia2/cpia2_core.c @@ -33,11 +33,16 @@ #include <linux/slab.h> #include <linux/vmalloc.h> +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) +#include <linux/firmware.h> +#endif /* #define _CPIA2_DEBUG_ */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) #include "cpia2patch.h" +#endif #ifdef _CPIA2_DEBUG_ static const char *block_name[] = { @@ -893,14 +898,42 @@ int cpia2_set_low_power(struct camera_data *cam) * apply_vp_patch * *****************************************************************************/ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) +static int cpia2_send_onebyte_command(struct camera_data *cam, + struct cpia2_command *cmd, + u8 start, u8 datum) +{ + cmd->buffer.block_data[0] = datum; + cmd->start = start; + cmd->reg_count = 1; + return cpia2_send_command(cam, cmd); +} + +#endif static int apply_vp_patch(struct camera_data *cam) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) int i, j; +#else + const struct firmware *fw; + const char fw_name[] = "cpia2/stv0672_vp4.bin"; + int i, ret; +#endif struct cpia2_command cmd; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) + ret = request_firmware(&fw, fw_name, &cam->dev->dev); + if (ret) { + printk(KERN_ERR "cpia2: failed to load VP patch \"%s\"\n", + fw_name); + return ret; + } + +#endif cmd.req_mode = CAMERAACCESS_TYPE_REPEAT | CAMERAACCESS_VP; cmd.direction = TRANSFER_WRITE; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) for (i = 0; i < PATCH_DATA_SIZE; i++) { for (j = 0; j < patch_data[i].count; j++) { cmd.buffer.block_data[j] = patch_data[i].data[j]; @@ -908,9 +941,30 @@ static int apply_vp_patch(struct camera_data *cam) cmd.start = patch_data[i].reg; cmd.reg_count = patch_data[i].count; +#else + /* First send the start address... */ + cpia2_send_onebyte_command(cam, &cmd, 0x0A, fw->data[0]); /* hi */ + cpia2_send_onebyte_command(cam, &cmd, 0x0B, fw->data[1]); /* lo */ + + /* ... followed by the data payload */ + for (i = 2; i < fw->size; i += 64) { + cmd.start = 0x0C; /* Data */ + cmd.reg_count = min_t(int, 64, fw->size - i); + memcpy(cmd.buffer.block_data, &fw->data[i], cmd.reg_count); +#endif cpia2_send_command(cam, &cmd); } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) + /* Next send the start address... */ + cpia2_send_onebyte_command(cam, &cmd, 0x0A, fw->data[0]); /* hi */ + cpia2_send_onebyte_command(cam, &cmd, 0x0B, fw->data[1]); /* lo */ + + /* ... followed by the 'goto' command */ + cpia2_send_onebyte_command(cam, &cmd, 0x0D, 1); + + release_firmware(fw); +#endif return 0; } diff --git a/linux/drivers/media/video/cpia2/cpia2_v4l.c b/linux/drivers/media/video/cpia2/cpia2_v4l.c index 7ce2789fa..8817c3841 100644 --- a/linux/drivers/media/video/cpia2/cpia2_v4l.c +++ b/linux/drivers/media/video/cpia2/cpia2_v4l.c @@ -37,6 +37,7 @@ #include <linux/sched.h> #include <linux/slab.h> #include <linux/init.h> +#include <media/v4l2-ioctl.h> #include "cpia2.h" #include "cpia2dev.h" diff --git a/linux/drivers/media/video/cs5345.c b/linux/drivers/media/video/cs5345.c index e2f0b0278..e4c505d2f 100644 --- a/linux/drivers/media/video/cs5345.c +++ b/linux/drivers/media/video/cs5345.c @@ -117,7 +117,7 @@ static int cs5345_command(struct i2c_client *client, unsigned cmd, void *arg) if (cmd == VIDIOC_DBG_G_REGISTER) reg->val = cs5345_read(client, reg->reg & 0x1f); else - cs5345_write(client, reg->reg & 0x1f, reg->val & 0x1f); + cs5345_write(client, reg->reg & 0x1f, reg->val & 0xff); break; } #endif diff --git a/linux/drivers/media/video/cx18/cx18-av-core.c b/linux/drivers/media/video/cx18/cx18-av-core.c index 3ccdf613b..3b0a2c450 100644 --- a/linux/drivers/media/video/cx18/cx18-av-core.c +++ b/linux/drivers/media/video/cx18/cx18-av-core.c @@ -80,6 +80,7 @@ static void log_video_status(struct cx18 *cx); static void cx18_av_initialize(struct cx18 *cx) { + struct cx18_av_state *state = &cx->av_state; u32 v; cx18_av_loadfw(cx); @@ -159,6 +160,149 @@ static void cx18_av_initialize(struct cx18 *cx) /* CxDevWrReg(CXADEC_SRC_COMB_CFG, 0x6628021F); */ /* } */ cx18_av_write4(cx, CXADEC_SRC_COMB_CFG, 0x6628021F); + state->default_volume = 228 - cx18_av_read(cx, 0x8d4); + state->default_volume = ((state->default_volume / 2) + 23) << 9; +} + +/* ----------------------------------------------------------------------- */ + +void cx18_av_std_setup(struct cx18 *cx) +{ + struct cx18_av_state *state = &cx->av_state; + v4l2_std_id std = state->std; + int hblank, hactive, burst, vblank, vactive, sc; + int vblank656, src_decimation; + int luma_lpf, uv_lpf, comb; + u32 pll_int, pll_frac, pll_post; + + /* datasheet startup, step 8d */ + if (std & ~V4L2_STD_NTSC) + cx18_av_write(cx, 0x49f, 0x11); + else + cx18_av_write(cx, 0x49f, 0x14); + + if (std & V4L2_STD_625_50) { + hblank = 132; + hactive = 720; + burst = 93; + vblank = 36; + vactive = 580; + vblank656 = 40; + src_decimation = 0x21f; + + luma_lpf = 2; + if (std & V4L2_STD_PAL) { + uv_lpf = 1; + comb = 0x20; + sc = 688739; + } else if (std == V4L2_STD_PAL_Nc) { + uv_lpf = 1; + comb = 0x20; + sc = 556453; + } else { /* SECAM */ + uv_lpf = 0; + comb = 0; + sc = 672351; + } + } else { + hactive = 720; + hblank = 122; + vactive = 487; + luma_lpf = 1; + uv_lpf = 1; + vblank = 26; + vblank656 = 26; + + src_decimation = 0x21f; + if (std == V4L2_STD_PAL_60) { + burst = 0x5b; + luma_lpf = 2; + comb = 0x20; + sc = 688739; + } else if (std == V4L2_STD_PAL_M) { + burst = 0x61; + comb = 0x20; + sc = 555452; + } else { + burst = 0x5b; + comb = 0x66; + sc = 556063; + } + } + + /* DEBUG: Displays configured PLL frequency */ + pll_int = cx18_av_read(cx, 0x108); + pll_frac = cx18_av_read4(cx, 0x10c) & 0x1ffffff; + pll_post = cx18_av_read(cx, 0x109); + CX18_DEBUG_INFO("PLL regs = int: %u, frac: %u, post: %u\n", + pll_int, pll_frac, pll_post); + + if (pll_post) { + int fin, fsc; + int pll = 28636363L * ((((u64)pll_int) << 25) + pll_frac); + + pll >>= 25; + pll /= pll_post; + CX18_DEBUG_INFO("PLL = %d.%06d MHz\n", + pll / 1000000, pll % 1000000); + CX18_DEBUG_INFO("PLL/8 = %d.%06d MHz\n", + pll / 8000000, (pll / 8) % 1000000); + + fin = ((u64)src_decimation * pll) >> 12; + CX18_DEBUG_INFO("ADC Sampling freq = %d.%06d MHz\n", + fin / 1000000, fin % 1000000); + + fsc = (((u64)sc) * pll) >> 24L; + CX18_DEBUG_INFO("Chroma sub-carrier freq = %d.%06d MHz\n", + fsc / 1000000, fsc % 1000000); + + CX18_DEBUG_INFO("hblank %i, hactive %i, " + "vblank %i , vactive %i, vblank656 %i, src_dec %i," + "burst 0x%02x, luma_lpf %i, uv_lpf %i, comb 0x%02x," + " sc 0x%06x\n", + hblank, hactive, vblank, vactive, vblank656, + src_decimation, burst, luma_lpf, uv_lpf, comb, sc); + } + + /* Sets horizontal blanking delay and active lines */ + cx18_av_write(cx, 0x470, hblank); + cx18_av_write(cx, 0x471, 0xff & (((hblank >> 8) & 0x3) | + (hactive << 4))); + cx18_av_write(cx, 0x472, hactive >> 4); + + /* Sets burst gate delay */ + cx18_av_write(cx, 0x473, burst); + + /* Sets vertical blanking delay and active duration */ + cx18_av_write(cx, 0x474, vblank); + cx18_av_write(cx, 0x475, 0xff & (((vblank >> 8) & 0x3) | + (vactive << 4))); + cx18_av_write(cx, 0x476, vactive >> 4); + cx18_av_write(cx, 0x477, vblank656); + + /* Sets src decimation rate */ + cx18_av_write(cx, 0x478, 0xff & src_decimation); + cx18_av_write(cx, 0x479, 0xff & (src_decimation >> 8)); + + /* Sets Luma and UV Low pass filters */ + cx18_av_write(cx, 0x47a, luma_lpf << 6 | ((uv_lpf << 4) & 0x30)); + + /* Enables comb filters */ + cx18_av_write(cx, 0x47b, comb); + + /* Sets SC Step*/ + cx18_av_write(cx, 0x47c, sc); + cx18_av_write(cx, 0x47d, 0xff & sc >> 8); + cx18_av_write(cx, 0x47e, 0xff & sc >> 16); + + /* Sets VBI parameters */ + if (std & V4L2_STD_625_50) { + cx18_av_write(cx, 0x47f, 0x01); + state->vbi_line_offset = 5; + } else { + cx18_av_write(cx, 0x47f, 0x00); + state->vbi_line_offset = 8; + } } /* ----------------------------------------------------------------------- */ @@ -320,7 +464,7 @@ static int set_v4lstd(struct cx18 *cx) } cx18_av_and_or(cx, 0x400, ~0x2f, fmt | 0x20); cx18_av_and_or(cx, 0x403, ~0x3, pal_m); - cx18_av_vbi_setup(cx); + cx18_av_std_setup(cx); input_change(cx); return 0; } @@ -559,6 +703,8 @@ int cx18_av_cmd(struct cx18 *cx, unsigned int cmd, void *arg) switch (qc->id) { case V4L2_CID_AUDIO_VOLUME: + return v4l2_ctrl_query_fill(qc, 0, 65535, + 65535 / 100, state->default_volume); case V4L2_CID_AUDIO_MUTE: case V4L2_CID_AUDIO_BALANCE: case V4L2_CID_AUDIO_BASS: diff --git a/linux/drivers/media/video/cx18/cx18-av-core.h b/linux/drivers/media/video/cx18/cx18-av-core.h index b54239959..eb61fa1e0 100644 --- a/linux/drivers/media/video/cx18/cx18-av-core.h +++ b/linux/drivers/media/video/cx18/cx18-av-core.h @@ -79,6 +79,7 @@ struct cx18_av_state { u32 audclk_freq; int audmode; int vbi_line_offset; + int default_volume; u32 id; u32 rev; int is_initialized; @@ -305,6 +306,7 @@ u32 cx18_av_read4(struct cx18 *cx, u16 addr); int cx18_av_and_or(struct cx18 *cx, u16 addr, unsigned mask, u8 value); int cx18_av_and_or4(struct cx18 *cx, u16 addr, u32 mask, u32 value); int cx18_av_cmd(struct cx18 *cx, unsigned int cmd, void *arg); +void cx18_av_std_setup(struct cx18 *cx); /* ----------------------------------------------------------------------- */ /* cx18_av-firmware.c */ @@ -317,7 +319,6 @@ void cx18_av_audio_set_path(struct cx18 *cx); /* ----------------------------------------------------------------------- */ /* cx18_av-vbi.c */ -void cx18_av_vbi_setup(struct cx18 *cx); int cx18_av_vbi(struct cx18 *cx, unsigned int cmd, void *arg); #endif diff --git a/linux/drivers/media/video/cx18/cx18-av-vbi.c b/linux/drivers/media/video/cx18/cx18-av-vbi.c index 0c92f1236..02fdf57bb 100644 --- a/linux/drivers/media/video/cx18/cx18-av-vbi.c +++ b/linux/drivers/media/video/cx18/cx18-av-vbi.c @@ -83,145 +83,6 @@ static int decode_vps(u8 *dst, u8 *p) return err & 0xf0; } -void cx18_av_vbi_setup(struct cx18 *cx) -{ - struct cx18_av_state *state = &cx->av_state; - v4l2_std_id std = state->std; - int hblank, hactive, burst, vblank, vactive, sc; - int vblank656, src_decimation; - int luma_lpf, uv_lpf, comb; - u32 pll_int, pll_frac, pll_post; - - /* datasheet startup, step 8d */ - if (std & ~V4L2_STD_NTSC) - cx18_av_write(cx, 0x49f, 0x11); - else - cx18_av_write(cx, 0x49f, 0x14); - - if (std & V4L2_STD_625_50) { - hblank = 0x084; - hactive = 0x2d0; - burst = 0x5d; - vblank = 0x024; - vactive = 0x244; - vblank656 = 0x28; - src_decimation = 0x21f; - - luma_lpf = 2; - if (std & V4L2_STD_PAL) { - uv_lpf = 1; - comb = 0x20; - sc = 0x0a8263; - } else if (std == V4L2_STD_PAL_Nc) { - uv_lpf = 1; - comb = 0x20; - sc = 0x087da5; - } else { /* SECAM */ - uv_lpf = 0; - comb = 0; - sc = 0x0a425f; - } - } else { - hactive = 720; - hblank = 122; - vactive = 487; - luma_lpf = 1; - uv_lpf = 1; - vblank = 26; - vblank656 = 26; - - src_decimation = 0x21f; - if (std == V4L2_STD_PAL_60) { - burst = 0x5b; - luma_lpf = 2; - comb = 0x20; - sc = 0x0a8263; - } else if (std == V4L2_STD_PAL_M) { - burst = 0x61; - comb = 0x20; - sc = 555452; - } else { - burst = 0x5b; - comb = 0x66; - sc = 556063; - } - } - - /* DEBUG: Displays configured PLL frequency */ - pll_int = cx18_av_read(cx, 0x108); - pll_frac = cx18_av_read4(cx, 0x10c) & 0x1ffffff; - pll_post = cx18_av_read(cx, 0x109); - CX18_DEBUG_INFO("PLL regs = int: %u, frac: %u, post: %u\n", - pll_int, pll_frac, pll_post); - - if (pll_post) { - int fin, fsc; - int pll = 28636363L * ((((u64)pll_int) << 25) + pll_frac); - - pll >>= 25; - pll /= pll_post; - CX18_DEBUG_INFO("PLL = %d.%06d MHz\n", - pll / 1000000, pll % 1000000); - CX18_DEBUG_INFO("PLL/8 = %d.%06d MHz\n", - pll / 8000000, (pll / 8) % 1000000); - - fin = ((u64)src_decimation * pll) >> 12; - CX18_DEBUG_INFO("ADC Sampling freq = %d.%06d MHz\n", - fin / 1000000, fin % 1000000); - - fsc = (((u64)sc) * pll) >> 24L; - CX18_DEBUG_INFO("Chroma sub-carrier freq = %d.%06d MHz\n", - fsc / 1000000, fsc % 1000000); - - CX18_DEBUG_INFO("hblank %i, hactive %i, " - "vblank %i , vactive %i, vblank656 %i, src_dec %i," - "burst 0x%02x, luma_lpf %i, uv_lpf %i, comb 0x%02x," - " sc 0x%06x\n", - hblank, hactive, vblank, vactive, vblank656, - src_decimation, burst, luma_lpf, uv_lpf, comb, sc); - } - - /* Sets horizontal blanking delay and active lines */ - cx18_av_write(cx, 0x470, hblank); - cx18_av_write(cx, 0x471, 0xff & (((hblank >> 8) & 0x3) | - (hactive << 4))); - cx18_av_write(cx, 0x472, hactive >> 4); - - /* Sets burst gate delay */ - cx18_av_write(cx, 0x473, burst); - - /* Sets vertical blanking delay and active duration */ - cx18_av_write(cx, 0x474, vblank); - cx18_av_write(cx, 0x475, 0xff & (((vblank >> 8) & 0x3) | - (vactive << 4))); - cx18_av_write(cx, 0x476, vactive >> 4); - cx18_av_write(cx, 0x477, vblank656); - - /* Sets src decimation rate */ - cx18_av_write(cx, 0x478, 0xff & src_decimation); - cx18_av_write(cx, 0x479, 0xff & (src_decimation >> 8)); - - /* Sets Luma and UV Low pass filters */ - cx18_av_write(cx, 0x47a, luma_lpf << 6 | ((uv_lpf << 4) & 0x30)); - - /* Enables comb filters */ - cx18_av_write(cx, 0x47b, comb); - - /* Sets SC Step*/ - cx18_av_write(cx, 0x47c, sc); - cx18_av_write(cx, 0x47d, 0xff & sc >> 8); - cx18_av_write(cx, 0x47e, 0xff & sc >> 16); - - /* Sets VBI parameters */ - if (std & V4L2_STD_625_50) { - cx18_av_write(cx, 0x47f, 0x01); - state->vbi_line_offset = 5; - } else { - cx18_av_write(cx, 0x47f, 0x00); - state->vbi_line_offset = 8; - } -} - int cx18_av_vbi(struct cx18 *cx, unsigned int cmd, void *arg) { struct cx18_av_state *state = &cx->av_state; @@ -287,8 +148,8 @@ int cx18_av_vbi(struct cx18 *cx, unsigned int cmd, void *arg) /* raw VBI */ memset(svbi, 0, sizeof(*svbi)); - /* Setup VBI */ - cx18_av_vbi_setup(cx); + /* Setup standard */ + cx18_av_std_setup(cx); /* VBI Offset */ cx18_av_write(cx, 0x47f, vbi_offset); @@ -299,8 +160,8 @@ int cx18_av_vbi(struct cx18 *cx, unsigned int cmd, void *arg) for (x = 0; x <= 23; x++) lcr[x] = 0x00; - /* Setup VBI */ - cx18_av_vbi_setup(cx); + /* Setup standard */ + cx18_av_std_setup(cx); /* Sliced VBI */ cx18_av_write(cx, 0x404, 0x32); /* Ancillary data */ diff --git a/linux/drivers/media/video/cx18/cx18-cards.c b/linux/drivers/media/video/cx18/cx18-cards.c index 0caae1a5e..8fe5f38c4 100644 --- a/linux/drivers/media/video/cx18/cx18-cards.c +++ b/linux/drivers/media/video/cx18/cx18-cards.c @@ -88,6 +88,7 @@ static const struct cx18_card cx18_card_hvr1600_esmt = { .active_lo_mask = 0x3001, .msecs_asserted = 10, .msecs_recovery = 40, + .ir_reset_mask = 0x0001, }, .i2c = &cx18_i2c_std, }; @@ -133,6 +134,7 @@ static const struct cx18_card cx18_card_hvr1600_samsung = { .active_lo_mask = 0x3001, .msecs_asserted = 10, .msecs_recovery = 40, + .ir_reset_mask = 0x0001, }, .i2c = &cx18_i2c_std, }; diff --git a/linux/drivers/media/video/cx18/cx18-cards.h b/linux/drivers/media/video/cx18/cx18-cards.h index dc283d756..32155f6e6 100644 --- a/linux/drivers/media/video/cx18/cx18-cards.h +++ b/linux/drivers/media/video/cx18/cx18-cards.h @@ -83,6 +83,7 @@ struct cx18_gpio_i2c_slave_reset { u32 active_hi_mask; /* GPIO outputs that reset i2c chips when high */ int msecs_asserted; /* time period reset must remain asserted */ int msecs_recovery; /* time after deassert for chips to be ready */ + u32 ir_reset_mask; /* GPIO to reset the Zilog Z8F0811 IR contoller */ }; struct cx18_gpio_audio_input { /* select tuner/line in input */ diff --git a/linux/drivers/media/video/cx18/cx18-driver.c b/linux/drivers/media/video/cx18/cx18-driver.c index e73de6252..22434aadd 100644 --- a/linux/drivers/media/video/cx18/cx18-driver.c +++ b/linux/drivers/media/video/cx18/cx18-driver.c @@ -421,6 +421,7 @@ static int __devinit cx18_init_struct1(struct cx18 *cx) mutex_init(&cx->serialize_lock); mutex_init(&cx->i2c_bus_lock[0]); mutex_init(&cx->i2c_bus_lock[1]); + mutex_init(&cx->gpio_lock); spin_lock_init(&cx->lock); spin_lock_init(&cx->dma_reg_lock); diff --git a/linux/drivers/media/video/cx18/cx18-driver.h b/linux/drivers/media/video/cx18/cx18-driver.h index b78d0e38d..4801bc7fb 100644 --- a/linux/drivers/media/video/cx18/cx18-driver.h +++ b/linux/drivers/media/video/cx18/cx18-driver.h @@ -46,6 +46,7 @@ #include <linux/dvb/video.h> #include <linux/dvb/audio.h> #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <media/tuner.h> #include "cx18-mailbox.h" #include "cx18-av-core.h" @@ -427,6 +428,7 @@ struct cx18 { /* gpio */ u32 gpio_dir; u32 gpio_val; + struct mutex gpio_lock; /* v4l2 and User settings */ diff --git a/linux/drivers/media/video/cx18/cx18-firmware.c b/linux/drivers/media/video/cx18/cx18-firmware.c index 2d630d9f7..78fadd2ad 100644 --- a/linux/drivers/media/video/cx18/cx18-firmware.c +++ b/linux/drivers/media/video/cx18/cx18-firmware.c @@ -86,10 +86,6 @@ #define CX18_DSP0_INTERRUPT_MASK 0xd0004C -/* Encoder/decoder firmware sizes */ -#define CX18_FW_CPU_SIZE (158332) -#define CX18_FW_APU_SIZE (141200) - #define APU_ROM_SYNC1 0x6D676553 /* "mgeS" */ #define APU_ROM_SYNC2 0x72646548 /* "rdeH" */ @@ -100,35 +96,22 @@ struct cx18_apu_rom_seghdr { u32 size; }; -static int load_cpu_fw_direct(const char *fn, u8 __iomem *mem, struct cx18 *cx, long size) +static int load_cpu_fw_direct(const char *fn, u8 __iomem *mem, struct cx18 *cx) { const struct firmware *fw = NULL; - int retries = 3; int i, j; + unsigned size; u32 __iomem *dst = (u32 __iomem *)mem; const u32 *src; -retry: - if (!retries || request_firmware(&fw, fn, &cx->dev->dev)) { - CX18_ERR("Unable to open firmware %s (must be %ld bytes)\n", - fn, size); + if (request_firmware(&fw, fn, &cx->dev->dev)) { + CX18_ERR("Unable to open firmware %s\n", fn); CX18_ERR("Did you put the firmware in the hotplug firmware directory?\n"); return -ENOMEM; } src = (const u32 *)fw->data; - if (fw->size != size) { - /* Due to race conditions in firmware loading (esp. with - udev <0.95) the wrong file was sometimes loaded. So we check - filesizes to see if at least the right-sized file was - loaded. If not, then we retry. */ - CX18_INFO("retry: file loaded was not %s (expected size %ld, got %zd)\n", - fn, size, fw->size); - release_firmware(fw); - retries--; - goto retry; - } for (i = 0; i < fw->size; i += 4096) { setup_page(i); for (j = i; j < fw->size && j < i + 4096; j += 4) { @@ -145,15 +128,16 @@ retry: } if (!test_bit(CX18_F_I_LOADED_FW, &cx->i_flags)) CX18_INFO("loaded %s firmware (%zd bytes)\n", fn, fw->size); + size = fw->size; release_firmware(fw); return size; } -static int load_apu_fw_direct(const char *fn, u8 __iomem *dst, struct cx18 *cx, long size) +static int load_apu_fw_direct(const char *fn, u8 __iomem *dst, struct cx18 *cx) { const struct firmware *fw = NULL; - int retries = 3; int i, j; + unsigned size; const u32 *src; struct cx18_apu_rom_seghdr seghdr; const u8 *vers; @@ -161,10 +145,8 @@ static int load_apu_fw_direct(const char *fn, u8 __iomem *dst, struct cx18 *cx, u32 apu_version = 0; int sz; -retry: - if (!retries || request_firmware(&fw, fn, &cx->dev->dev)) { - CX18_ERR("unable to open firmware %s (must be %ld bytes)\n", - fn, size); + if (request_firmware(&fw, fn, &cx->dev->dev)) { + CX18_ERR("unable to open firmware %s\n", fn); CX18_ERR("did you put the firmware in the hotplug firmware directory?\n"); return -ENOMEM; } @@ -173,19 +155,8 @@ retry: vers = fw->data + sizeof(seghdr); sz = fw->size; - if (fw->size != size) { - /* Due to race conditions in firmware loading (esp. with - udev <0.95) the wrong file was sometimes loaded. So we check - filesizes to see if at least the right-sized file was - loaded. If not, then we retry. */ - CX18_INFO("retry: file loaded was not %s (expected size %ld, got %zd)\n", - fn, size, fw->size); - release_firmware(fw); - retries--; - goto retry; - } apu_version = (vers[0] << 24) | (vers[4] << 16) | vers[32]; - while (offset + sizeof(seghdr) < size) { + while (offset + sizeof(seghdr) < fw->size) { /* TODO: byteswapping */ memcpy(&seghdr, src + offset / 4, sizeof(seghdr)); offset += sizeof(seghdr); @@ -215,6 +186,7 @@ retry: if (!test_bit(CX18_F_I_LOADED_FW, &cx->i_flags)) CX18_INFO("loaded %s firmware V%08x (%zd bytes)\n", fn, apu_version, fw->size); + size = fw->size; release_firmware(fw); /* Clear bit0 for APU to start from 0 */ write_reg(read_reg(0xc72030) & ~1, 0xc72030); @@ -340,7 +312,7 @@ int cx18_firmware_init(struct cx18 *cx) /* Only if the processor is not running */ if (read_reg(CX18_PROC_SOFT_RESET) & 8) { int sz = load_apu_fw_direct("v4l-cx23418-apu.fw", - cx->enc_mem, cx, CX18_FW_APU_SIZE); + cx->enc_mem, cx); write_enc(0xE51FF004, 0); write_enc(0xa00000, 4); /* todo: not hardcoded */ @@ -348,7 +320,7 @@ int cx18_firmware_init(struct cx18 *cx) cx18_msleep_timeout(500, 0); sz = sz <= 0 ? sz : load_cpu_fw_direct("v4l-cx23418-cpu.fw", - cx->enc_mem, cx, CX18_FW_CPU_SIZE); + cx->enc_mem, cx); if (sz > 0) { int retries = 0; diff --git a/linux/drivers/media/video/cx18/cx18-gpio.c b/linux/drivers/media/video/cx18/cx18-gpio.c index 089bad6d8..3d495dba4 100644 --- a/linux/drivers/media/video/cx18/cx18-gpio.c +++ b/linux/drivers/media/video/cx18/cx18-gpio.c @@ -69,6 +69,7 @@ void cx18_reset_i2c_slaves_gpio(struct cx18 *cx) /* Assuming that the masks are a subset of the bits in gpio_dir */ /* Assert */ + mutex_lock(&cx->gpio_lock); cx->gpio_val = (cx->gpio_val | p->active_hi_mask) & ~(p->active_lo_mask); gpio_write(cx); @@ -79,10 +80,53 @@ void cx18_reset_i2c_slaves_gpio(struct cx18 *cx) (cx->gpio_val | p->active_lo_mask) & ~(p->active_hi_mask); gpio_write(cx); schedule_timeout_uninterruptible(msecs_to_jiffies(p->msecs_recovery)); + mutex_unlock(&cx->gpio_lock); } +void cx18_reset_ir_gpio(void *data) +{ + struct cx18 *cx = ((struct cx18_i2c_algo_callback_data *)data)->cx; + const struct cx18_gpio_i2c_slave_reset *p; + + p = &cx->card->gpio_i2c_slave_reset; + + if (p->ir_reset_mask == 0) + return; + + CX18_DEBUG_INFO("Resetting IR microcontroller\n"); + + /* + Assert timing for the Z8F0811 on HVR-1600 boards: + 1. Assert RESET for min of 4 clock cycles at 18.432 MHz to initiate + 2. Reset then takes 66 WDT cycles at 10 kHz + 16 xtal clock cycles + (6,601,085 nanoseconds ~= 7 milliseconds) + 3. DBG pin must be high before chip exits reset for normal operation. + DBG is open drain and hopefully pulled high since we don't + normally drive it (GPIO 1?) for the HVR-1600 + 4. Z8F0811 won't exit reset until RESET is deasserted + */ + mutex_lock(&cx->gpio_lock); + cx->gpio_val = cx->gpio_val & ~p->ir_reset_mask; + gpio_write(cx); + mutex_unlock(&cx->gpio_lock); + schedule_timeout_uninterruptible(msecs_to_jiffies(p->msecs_asserted)); + + /* + Zilog comes out of reset, loads reset vector address and executes + from there. Required recovery delay unknown. + */ + mutex_lock(&cx->gpio_lock); + cx->gpio_val = cx->gpio_val | p->ir_reset_mask; + gpio_write(cx); + mutex_unlock(&cx->gpio_lock); + schedule_timeout_uninterruptible(msecs_to_jiffies(p->msecs_recovery)); +} +EXPORT_SYMBOL(cx18_reset_ir_gpio); +/* This symbol is exported for use by an infrared module for the IR-blaster */ + void cx18_gpio_init(struct cx18 *cx) { + mutex_lock(&cx->gpio_lock); cx->gpio_dir = cx->card->gpio_init.direction; cx->gpio_val = cx->card->gpio_init.initial_value; @@ -91,14 +135,17 @@ void cx18_gpio_init(struct cx18 *cx) cx->gpio_val |= 1 << cx->card->xceive_pin; } - if (cx->gpio_dir == 0) + if (cx->gpio_dir == 0) { + mutex_unlock(&cx->gpio_lock); return; + } CX18_DEBUG_INFO("GPIO initial dir: %08x/%08x out: %08x/%08x\n", read_reg(CX18_REG_GPIO_DIR1), read_reg(CX18_REG_GPIO_DIR2), read_reg(CX18_REG_GPIO_OUT1), read_reg(CX18_REG_GPIO_OUT2)); gpio_write(cx); + mutex_unlock(&cx->gpio_lock); } /* Xceive tuner reset function */ @@ -112,13 +159,16 @@ int cx18_reset_tuner_gpio(void *dev, int cmd, int value) return 0; CX18_DEBUG_INFO("Resetting tuner\n"); + mutex_lock(&cx->gpio_lock); cx->gpio_val &= ~(1 << cx->card->xceive_pin); - gpio_write(cx); + mutex_unlock(&cx->gpio_lock); schedule_timeout_interruptible(msecs_to_jiffies(1)); + mutex_lock(&cx->gpio_lock); cx->gpio_val |= 1 << cx->card->xceive_pin; gpio_write(cx); + mutex_unlock(&cx->gpio_lock); schedule_timeout_interruptible(msecs_to_jiffies(1)); return 0; } @@ -151,8 +201,10 @@ int cx18_gpio(struct cx18 *cx, unsigned int command, void *arg) return -EINVAL; } if (mask) { + mutex_lock(&cx->gpio_lock); cx->gpio_val = (cx->gpio_val & ~mask) | (data & mask); gpio_write(cx); + mutex_unlock(&cx->gpio_lock); } return 0; } diff --git a/linux/drivers/media/video/cx18/cx18-gpio.h b/linux/drivers/media/video/cx18/cx18-gpio.h index 7447fed35..22cd7ddf8 100644 --- a/linux/drivers/media/video/cx18/cx18-gpio.h +++ b/linux/drivers/media/video/cx18/cx18-gpio.h @@ -22,5 +22,6 @@ void cx18_gpio_init(struct cx18 *cx); void cx18_reset_i2c_slaves_gpio(struct cx18 *cx); +void cx18_reset_ir_gpio(void *data); int cx18_reset_tuner_gpio(void *dev, int cmd, int value); int cx18_gpio(struct cx18 *cx, unsigned int command, void *arg); diff --git a/linux/drivers/media/video/cx18/cx18-ioctl.c b/linux/drivers/media/video/cx18/cx18-ioctl.c index b3d72d4a4..0221a67aa 100644 --- a/linux/drivers/media/video/cx18/cx18-ioctl.c +++ b/linux/drivers/media/video/cx18/cx18-ioctl.c @@ -821,8 +821,10 @@ static int cx18_log_status(struct file *file, void *fh) cx18_get_audio_input(cx, cx->audio_input, &audin); CX18_INFO("Video Input: %s\n", vidin.name); CX18_INFO("Audio Input: %s\n", audin.name); + mutex_lock(&cx->gpio_lock); CX18_INFO("GPIO: direction 0x%08x, value 0x%08x\n", cx->gpio_dir, cx->gpio_val); + mutex_unlock(&cx->gpio_lock); CX18_INFO("Tuner: %s\n", test_bit(CX18_F_I_RADIO_USER, &cx->i_flags) ? "Radio" : "TV"); cx2341x_log_status(&cx->params, cx->name); @@ -857,6 +859,15 @@ static int cx18_default(struct file *file, void *fh, int cmd, void *arg) cx18_audio_set_route(cx, route); break; } + + case VIDIOC_INT_RESET: { + u32 val = *(u32 *)arg; + + if ((val == 0) || (val & 0x01)) + cx18_reset_ir_gpio(&cx->i2c_algo_cb_data[0]); + break; + } + default: return -EINVAL; } diff --git a/linux/drivers/media/video/cx18/cx18-irq.c b/linux/drivers/media/video/cx18/cx18-irq.c index 25114a5cb..654664783 100644 --- a/linux/drivers/media/video/cx18/cx18-irq.c +++ b/linux/drivers/media/video/cx18/cx18-irq.c @@ -132,7 +132,11 @@ static void hpu_cmd(struct cx18 *cx, u32 sw1) CX18_WARN("Unexpected interrupt %08x\n", sw1); } +#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18) +irqreturn_t cx18_irq_handler(int irq, void *dev_id, struct pt_regs *regs) +#else irqreturn_t cx18_irq_handler(int irq, void *dev_id) +#endif { struct cx18 *cx = (struct cx18 *)dev_id; u32 sw1, sw1_mask; diff --git a/linux/drivers/media/video/cx18/cx18-irq.h b/linux/drivers/media/video/cx18/cx18-irq.h index 379f704f5..cbcd2022f 100644 --- a/linux/drivers/media/video/cx18/cx18-irq.h +++ b/linux/drivers/media/video/cx18/cx18-irq.h @@ -30,7 +30,11 @@ #define SW2_INT_STATUS 0xc73144 #define SW2_INT_ENABLE_PCI 0xc7315c +#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18) +irqreturn_t cx18_irq_handler(int irq, void *dev_id, struct pt_regs *regs); +#else irqreturn_t cx18_irq_handler(int irq, void *dev_id); +#endif void cx18_irq_work_handler(struct work_struct *work); void cx18_dma_stream_dec_prepare(struct cx18_stream *s, u32 offset, int lock); diff --git a/linux/drivers/media/video/cx18/cx18-streams.c b/linux/drivers/media/video/cx18/cx18-streams.c index df99070e6..3eedae726 100644 --- a/linux/drivers/media/video/cx18/cx18-streams.c +++ b/linux/drivers/media/video/cx18/cx18-streams.c @@ -194,7 +194,7 @@ static int cx18_prep_dev(struct cx18 *cx, int type) cx->num); s->v4l2dev->minor = minor; - s->v4l2dev->dev = &cx->dev->dev; + s->v4l2dev->parent = &cx->dev->dev; s->v4l2dev->fops = cx18_stream_info[type].fops; s->v4l2dev->release = video_device_release; s->v4l2dev->tvnorms = V4L2_STD_ALL; @@ -311,8 +311,10 @@ void cx18_streams_cleanup(struct cx18 *cx, int unregister) /* Teardown all streams */ for (type = 0; type < CX18_MAX_STREAMS; type++) { - if (cx->streams[type].dvb.enabled) + if (cx->streams[type].dvb.enabled) { cx18_dvb_unregister(&cx->streams[type]); + cx->streams[type].dvb.enabled = false; + } vdev = cx->streams[type].v4l2dev; diff --git a/linux/drivers/media/video/cx2341x.c b/linux/drivers/media/video/cx2341x.c index 3f2191162..835062f5b 100644 --- a/linux/drivers/media/video/cx2341x.c +++ b/linux/drivers/media/video/cx2341x.c @@ -78,6 +78,61 @@ const u32 cx2341x_mpeg_ctrls[] = { }; EXPORT_SYMBOL(cx2341x_mpeg_ctrls); +static const struct cx2341x_mpeg_params default_params = { + /* misc */ + .capabilities = 0, + .port = CX2341X_PORT_MEMORY, + .width = 720, + .height = 480, + .is_50hz = 0, + + /* stream */ + .stream_type = V4L2_MPEG_STREAM_TYPE_MPEG2_PS, + .stream_vbi_fmt = V4L2_MPEG_STREAM_VBI_FMT_NONE, + .stream_insert_nav_packets = 0, + + /* audio */ + .audio_sampling_freq = V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000, + .audio_encoding = V4L2_MPEG_AUDIO_ENCODING_LAYER_2, + .audio_l2_bitrate = V4L2_MPEG_AUDIO_L2_BITRATE_224K, + .audio_mode = V4L2_MPEG_AUDIO_MODE_STEREO, + .audio_mode_extension = V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4, + .audio_emphasis = V4L2_MPEG_AUDIO_EMPHASIS_NONE, + .audio_crc = V4L2_MPEG_AUDIO_CRC_NONE, + .audio_mute = 0, + + /* video */ + .video_encoding = V4L2_MPEG_VIDEO_ENCODING_MPEG_2, + .video_aspect = V4L2_MPEG_VIDEO_ASPECT_4x3, + .video_b_frames = 2, + .video_gop_size = 12, + .video_gop_closure = 1, + .video_bitrate_mode = V4L2_MPEG_VIDEO_BITRATE_MODE_VBR, + .video_bitrate = 6000000, + .video_bitrate_peak = 8000000, + .video_temporal_decimation = 0, + .video_mute = 0, + .video_mute_yuv = 0x008080, /* YCbCr value for black */ + + /* encoding filters */ + .video_spatial_filter_mode = + V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL, + .video_spatial_filter = 0, + .video_luma_spatial_filter_type = + V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR, + .video_chroma_spatial_filter_type = + V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR, + .video_temporal_filter_mode = + V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL, + .video_temporal_filter = 8, + .video_median_filter_type = + V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF, + .video_luma_median_filter_top = 255, + .video_luma_median_filter_bottom = 0, + .video_chroma_median_filter_top = 255, + .video_chroma_median_filter_bottom = 0, +}; + /* Map the control ID to the correct field in the cx2341x_mpeg_params struct. Return -EINVAL if the ID is unknown, else return 0. */ @@ -431,13 +486,13 @@ int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params, return v4l2_ctrl_query_fill(qctrl, V4L2_MPEG_AUDIO_ENCODING_LAYER_2, V4L2_MPEG_AUDIO_ENCODING_LAYER_2, 1, - V4L2_MPEG_AUDIO_ENCODING_LAYER_2); + default_params.audio_encoding); case V4L2_CID_MPEG_AUDIO_L2_BITRATE: return v4l2_ctrl_query_fill(qctrl, V4L2_MPEG_AUDIO_L2_BITRATE_192K, V4L2_MPEG_AUDIO_L2_BITRATE_384K, 1, - V4L2_MPEG_AUDIO_L2_BITRATE_224K); + default_params.audio_l2_bitrate); case V4L2_CID_MPEG_AUDIO_L1_BITRATE: case V4L2_CID_MPEG_AUDIO_L3_BITRATE: @@ -480,17 +535,22 @@ int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params, return cx2341x_ctrl_query_fill(qctrl, V4L2_MPEG_STREAM_VBI_FMT_NONE, V4L2_MPEG_STREAM_VBI_FMT_NONE, 1, - V4L2_MPEG_STREAM_VBI_FMT_NONE); + default_params.stream_vbi_fmt); + + case V4L2_CID_MPEG_VIDEO_GOP_SIZE: + return v4l2_ctrl_query_fill(qctrl, 1, 34, 1, + params->is_50hz ? 12 : 15); /* CX23415/6 specific */ case V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE: return cx2341x_ctrl_query_fill(qctrl, V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL, V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO, 1, - V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL); + default_params.video_spatial_filter_mode); case V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER: - cx2341x_ctrl_query_fill(qctrl, 0, 15, 1, 0); + cx2341x_ctrl_query_fill(qctrl, 0, 15, 1, + default_params.video_spatial_filter); qctrl->flags |= V4L2_CTRL_FLAG_SLIDER; if (params->video_spatial_filter_mode == V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO) @@ -502,7 +562,7 @@ int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params, V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_OFF, V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_SYM_NON_SEPARABLE, 1, - V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_OFF); + default_params.video_luma_spatial_filter_type); if (params->video_spatial_filter_mode == V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO) qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE; @@ -513,7 +573,7 @@ int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params, V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_OFF, V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR, 1, - V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_OFF); + default_params.video_chroma_spatial_filter_type); if (params->video_spatial_filter_mode == V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO) qctrl->flags |= V4L2_CTRL_FLAG_INACTIVE; @@ -523,10 +583,11 @@ int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params, return cx2341x_ctrl_query_fill(qctrl, V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL, V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_AUTO, 1, - V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL); + default_params.video_temporal_filter_mode); case V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER: - cx2341x_ctrl_query_fill(qctrl, 0, 31, 1, 0); + cx2341x_ctrl_query_fill(qctrl, 0, 31, 1, + default_params.video_temporal_filter); qctrl->flags |= V4L2_CTRL_FLAG_SLIDER; if (params->video_temporal_filter_mode == V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_AUTO) @@ -537,10 +598,11 @@ int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params, return cx2341x_ctrl_query_fill(qctrl, V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF, V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_DIAG, 1, - V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF); + default_params.video_median_filter_type); case V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP: - cx2341x_ctrl_query_fill(qctrl, 0, 255, 1, 255); + cx2341x_ctrl_query_fill(qctrl, 0, 255, 1, + default_params.video_luma_median_filter_top); qctrl->flags |= V4L2_CTRL_FLAG_SLIDER; if (params->video_median_filter_type == V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF) @@ -548,7 +610,8 @@ int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params, return 0; case V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_BOTTOM: - cx2341x_ctrl_query_fill(qctrl, 0, 255, 1, 0); + cx2341x_ctrl_query_fill(qctrl, 0, 255, 1, + default_params.video_luma_median_filter_bottom); qctrl->flags |= V4L2_CTRL_FLAG_SLIDER; if (params->video_median_filter_type == V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF) @@ -556,7 +619,8 @@ int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params, return 0; case V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP: - cx2341x_ctrl_query_fill(qctrl, 0, 255, 1, 255); + cx2341x_ctrl_query_fill(qctrl, 0, 255, 1, + default_params.video_chroma_median_filter_top); qctrl->flags |= V4L2_CTRL_FLAG_SLIDER; if (params->video_median_filter_type == V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF) @@ -564,7 +628,8 @@ int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params, return 0; case V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM: - cx2341x_ctrl_query_fill(qctrl, 0, 255, 1, 0); + cx2341x_ctrl_query_fill(qctrl, 0, 255, 1, + default_params.video_chroma_median_filter_bottom); qctrl->flags |= V4L2_CTRL_FLAG_SLIDER; if (params->video_median_filter_type == V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF) @@ -572,7 +637,8 @@ int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params, return 0; case V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS: - return cx2341x_ctrl_query_fill(qctrl, 0, 1, 1, 0); + return cx2341x_ctrl_query_fill(qctrl, 0, 1, 1, + default_params.stream_insert_nav_packets); default: return v4l2_ctrl_query_fill_std(qctrl); @@ -726,61 +792,6 @@ EXPORT_SYMBOL(cx2341x_ext_ctrls); void cx2341x_fill_defaults(struct cx2341x_mpeg_params *p) { - static struct cx2341x_mpeg_params default_params = { - /* misc */ - .capabilities = 0, - .port = CX2341X_PORT_MEMORY, - .width = 720, - .height = 480, - .is_50hz = 0, - - /* stream */ - .stream_type = V4L2_MPEG_STREAM_TYPE_MPEG2_PS, - .stream_vbi_fmt = V4L2_MPEG_STREAM_VBI_FMT_NONE, - .stream_insert_nav_packets = 0, - - /* audio */ - .audio_sampling_freq = V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000, - .audio_encoding = V4L2_MPEG_AUDIO_ENCODING_LAYER_2, - .audio_l2_bitrate = V4L2_MPEG_AUDIO_L2_BITRATE_224K, - .audio_mode = V4L2_MPEG_AUDIO_MODE_STEREO, - .audio_mode_extension = V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4, - .audio_emphasis = V4L2_MPEG_AUDIO_EMPHASIS_NONE, - .audio_crc = V4L2_MPEG_AUDIO_CRC_NONE, - .audio_mute = 0, - - /* video */ - .video_encoding = V4L2_MPEG_VIDEO_ENCODING_MPEG_2, - .video_aspect = V4L2_MPEG_VIDEO_ASPECT_4x3, - .video_b_frames = 2, - .video_gop_size = 12, - .video_gop_closure = 1, - .video_bitrate_mode = V4L2_MPEG_VIDEO_BITRATE_MODE_VBR, - .video_bitrate = 6000000, - .video_bitrate_peak = 8000000, - .video_temporal_decimation = 0, - .video_mute = 0, - .video_mute_yuv = 0x008080, /* YCbCr value for black */ - - /* encoding filters */ - .video_spatial_filter_mode = - V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL, - .video_spatial_filter = 0, - .video_luma_spatial_filter_type = - V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR, - .video_chroma_spatial_filter_type = - V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR, - .video_temporal_filter_mode = - V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL, - .video_temporal_filter = 8, - .video_median_filter_type = - V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF, - .video_luma_median_filter_top = 255, - .video_luma_median_filter_bottom = 0, - .video_chroma_median_filter_top = 255, - .video_chroma_median_filter_bottom = 0, - }; - *p = default_params; cx2341x_calc_audio_properties(p); } diff --git a/linux/drivers/media/video/cx23885/Kconfig b/linux/drivers/media/video/cx23885/Kconfig index 04e9640c2..5cfb46bbd 100644 --- a/linux/drivers/media/video/cx23885/Kconfig +++ b/linux/drivers/media/video/cx23885/Kconfig @@ -9,6 +9,7 @@ config VIDEO_CX23885 select VIDEO_TVEEPROM select VIDEO_IR select VIDEOBUF_DVB + select VIDEOBUF_DMA_SG select VIDEO_CX25840 select VIDEO_CX2341X select DVB_DIB7000P if !DVB_FE_CUSTOMISE diff --git a/linux/drivers/media/video/cx23885/cx23885-417.c b/linux/drivers/media/video/cx23885/cx23885-417.c index ff1abdb0f..3c3563f73 100644 --- a/linux/drivers/media/video/cx23885/cx23885-417.c +++ b/linux/drivers/media/video/cx23885/cx23885-417.c @@ -32,6 +32,7 @@ #include <linux/device.h> #include <linux/firmware.h> #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <media/cx2341x.h> #include "cx23885.h" @@ -1774,7 +1775,7 @@ static struct video_device *cx23885_video_dev_alloc( vfd->minor = -1; snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)", dev->name, type, cx23885_boards[tsport->dev->board].name); - vfd->dev = &pci->dev; + vfd->parent = &pci->dev; vfd->release = video_device_release; return vfd; } diff --git a/linux/drivers/media/video/cx23885/cx23885-video.c b/linux/drivers/media/video/cx23885/cx23885-video.c index 6d0345935..b3d0902e1 100644 --- a/linux/drivers/media/video/cx23885/cx23885-video.c +++ b/linux/drivers/media/video/cx23885/cx23885-video.c @@ -34,6 +34,7 @@ #include "cx23885.h" #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #ifdef CONFIG_VIDEO_V4L1_COMPAT /* Include V4L1 specific functions. Should be removed soon */ @@ -361,7 +362,7 @@ struct video_device *cx23885_vdev_init(struct cx23885_dev *dev, return NULL; *vfd = *template; vfd->minor = -1; - vfd->dev = &pci->dev; + vfd->parent = &pci->dev; vfd->release = video_device_release; snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)", dev->name, type, cx23885_boards[dev->board].name); diff --git a/linux/drivers/media/video/cx25840/cx25840-core.c b/linux/drivers/media/video/cx25840/cx25840-core.c index a43ed390a..ecd498c70 100644 --- a/linux/drivers/media/video/cx25840/cx25840-core.c +++ b/linux/drivers/media/video/cx25840/cx25840-core.c @@ -248,7 +248,7 @@ static void cx25840_initialize(struct i2c_client *client) cx25840_write(client, 0x8d3, 0x1f); cx25840_write(client, 0x8e3, 0x03); - cx25840_vbi_setup(client); + cx25840_std_setup(client); /* trial and error says these are needed to get audio */ cx25840_write(client, 0x914, 0xa0); @@ -356,7 +356,7 @@ static void cx23885_initialize(struct i2c_client *client) finish_wait(&state->fw_wait, &wait); destroy_workqueue(q); - cx25840_vbi_setup(client); + cx25840_std_setup(client); /* (re)set input */ set_input(client, state->vid_input, state->aud_input); @@ -367,6 +367,153 @@ static void cx23885_initialize(struct i2c_client *client) /* ----------------------------------------------------------------------- */ +void cx25840_std_setup(struct i2c_client *client) +{ + struct cx25840_state *state = i2c_get_clientdata(client); + v4l2_std_id std = state->std; + int hblank, hactive, burst, vblank, vactive, sc; + int vblank656, src_decimation; + int luma_lpf, uv_lpf, comb; + u32 pll_int, pll_frac, pll_post; + + /* datasheet startup, step 8d */ + if (std & ~V4L2_STD_NTSC) + cx25840_write(client, 0x49f, 0x11); + else + cx25840_write(client, 0x49f, 0x14); + + if (std & V4L2_STD_625_50) { + hblank = 132; + hactive = 720; + burst = 93; + vblank = 36; + vactive = 580; + vblank656 = 40; + src_decimation = 0x21f; + luma_lpf = 2; + + if (std & V4L2_STD_SECAM) { + uv_lpf = 0; + comb = 0; + sc = 0x0a425f; + } else if (std == V4L2_STD_PAL_Nc) { + uv_lpf = 1; + comb = 0x20; + sc = 556453; + } else { + uv_lpf = 1; + comb = 0x20; + sc = 688739; + } + } else { + hactive = 720; + hblank = 122; + vactive = 487; + luma_lpf = 1; + uv_lpf = 1; + + src_decimation = 0x21f; + if (std == V4L2_STD_PAL_60) { + vblank = 26; + vblank656 = 26; + burst = 0x5b; + luma_lpf = 2; + comb = 0x20; + sc = 688739; + } else if (std == V4L2_STD_PAL_M) { + vblank = 20; + vblank656 = 24; + burst = 0x61; + comb = 0x20; + sc = 555452; + } else { + vblank = 26; + vblank656 = 26; + burst = 0x5b; + comb = 0x66; + sc = 556063; + } + } + + /* DEBUG: Displays configured PLL frequency */ + pll_int = cx25840_read(client, 0x108); + pll_frac = cx25840_read4(client, 0x10c) & 0x1ffffff; + pll_post = cx25840_read(client, 0x109); + v4l_dbg(1, cx25840_debug, client, + "PLL regs = int: %u, frac: %u, post: %u\n", + pll_int, pll_frac, pll_post); + + if (pll_post) { + int fin, fsc; + int pll = (28636363L * ((((u64)pll_int) << 25L) + pll_frac)) >> 25L; + + pll /= pll_post; + v4l_dbg(1, cx25840_debug, client, "PLL = %d.%06d MHz\n", + pll / 1000000, pll % 1000000); + v4l_dbg(1, cx25840_debug, client, "PLL/8 = %d.%06d MHz\n", + pll / 8000000, (pll / 8) % 1000000); + + fin = ((u64)src_decimation * pll) >> 12; + v4l_dbg(1, cx25840_debug, client, + "ADC Sampling freq = %d.%06d MHz\n", + fin / 1000000, fin % 1000000); + + fsc = (((u64)sc) * pll) >> 24L; + v4l_dbg(1, cx25840_debug, client, + "Chroma sub-carrier freq = %d.%06d MHz\n", + fsc / 1000000, fsc % 1000000); + + v4l_dbg(1, cx25840_debug, client, "hblank %i, hactive %i, " + "vblank %i, vactive %i, vblank656 %i, src_dec %i, " + "burst 0x%02x, luma_lpf %i, uv_lpf %i, comb 0x%02x, " + "sc 0x%06x\n", + hblank, hactive, vblank, vactive, vblank656, + src_decimation, burst, luma_lpf, uv_lpf, comb, sc); + } + + /* Sets horizontal blanking delay and active lines */ + cx25840_write(client, 0x470, hblank); + cx25840_write(client, 0x471, + 0xff & (((hblank >> 8) & 0x3) | (hactive << 4))); + cx25840_write(client, 0x472, hactive >> 4); + + /* Sets burst gate delay */ + cx25840_write(client, 0x473, burst); + + /* Sets vertical blanking delay and active duration */ + cx25840_write(client, 0x474, vblank); + cx25840_write(client, 0x475, + 0xff & (((vblank >> 8) & 0x3) | (vactive << 4))); + cx25840_write(client, 0x476, vactive >> 4); + cx25840_write(client, 0x477, vblank656); + + /* Sets src decimation rate */ + cx25840_write(client, 0x478, 0xff & src_decimation); + cx25840_write(client, 0x479, 0xff & (src_decimation >> 8)); + + /* Sets Luma and UV Low pass filters */ + cx25840_write(client, 0x47a, luma_lpf << 6 | ((uv_lpf << 4) & 0x30)); + + /* Enables comb filters */ + cx25840_write(client, 0x47b, comb); + + /* Sets SC Step*/ + cx25840_write(client, 0x47c, sc); + cx25840_write(client, 0x47d, 0xff & sc >> 8); + cx25840_write(client, 0x47e, 0xff & sc >> 16); + + /* Sets VBI parameters */ + if (std & V4L2_STD_625_50) { + cx25840_write(client, 0x47f, 0x01); + state->vbi_line_offset = 5; + } else { + cx25840_write(client, 0x47f, 0x00); + state->vbi_line_offset = 8; + } +} + +/* ----------------------------------------------------------------------- */ + static void input_change(struct i2c_client *client) { struct cx25840_state *state = i2c_get_clientdata(client); @@ -584,7 +731,7 @@ static int set_v4lstd(struct i2c_client *client) } cx25840_and_or(client, 0x400, ~0xf, fmt); cx25840_and_or(client, 0x403, ~0x3, pal_m); - cx25840_vbi_setup(client); + cx25840_std_setup(client); if (!state->is_cx25836) input_change(client); return 0; @@ -1076,6 +1223,8 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd, switch (qc->id) { case V4L2_CID_AUDIO_VOLUME: + return v4l2_ctrl_query_fill(qc, 0, 65535, + 65535 / 100, state->default_volume); case V4L2_CID_AUDIO_MUTE: case V4L2_CID_AUDIO_BALANCE: case V4L2_CID_AUDIO_BASS: @@ -1283,6 +1432,8 @@ static int cx25840_probe(struct i2c_client *client, state->pvr150_workaround = 0; state->audmode = V4L2_TUNER_MODE_LANG1; state->unmute_volume = -1; + state->default_volume = 228 - cx25840_read(client, 0x8d4); + state->default_volume = ((state->default_volume / 2) + 23) << 9; state->vbi_line_offset = 8; state->id = id; state->rev = device_id; diff --git a/linux/drivers/media/video/cx25840/cx25840-core.h b/linux/drivers/media/video/cx25840/cx25840-core.h index df6d8bcc1..f81a9a959 100644 --- a/linux/drivers/media/video/cx25840/cx25840-core.h +++ b/linux/drivers/media/video/cx25840/cx25840-core.h @@ -45,6 +45,7 @@ struct cx25840_state { u32 audclk_freq; int audmode; int unmute_volume; /* -1 if not muted */ + int default_volume; int vbi_line_offset; u32 id; u32 rev; @@ -62,6 +63,7 @@ int cx25840_write4(struct i2c_client *client, u16 addr, u32 value); u8 cx25840_read(struct i2c_client *client, u16 addr); u32 cx25840_read4(struct i2c_client *client, u16 addr); int cx25840_and_or(struct i2c_client *client, u16 addr, unsigned mask, u8 value); +void cx25840_std_setup(struct i2c_client *client); /* ----------------------------------------------------------------------- */ /* cx25850-firmware.c */ @@ -74,7 +76,6 @@ void cx25840_audio_set_path(struct i2c_client *client); /* ----------------------------------------------------------------------- */ /* cx25850-vbi.c */ -void cx25840_vbi_setup(struct i2c_client *client); int cx25840_vbi(struct i2c_client *client, unsigned int cmd, void *arg); #endif diff --git a/linux/drivers/media/video/cx25840/cx25840-firmware.c b/linux/drivers/media/video/cx25840/cx25840-firmware.c index 95b84ce21..04a5dbb65 100644 --- a/linux/drivers/media/video/cx25840/cx25840-firmware.c +++ b/linux/drivers/media/video/cx25840/cx25840-firmware.c @@ -80,7 +80,7 @@ static int check_fw_load(struct i2c_client *client, int size) return 0; } -static int fw_write(struct i2c_client *client, u8 *data, int size) +static int fw_write(struct i2c_client *client, const u8 *data, int size) { if (i2c_master_send(client, data, size) < size) { v4l_err(client, "firmware load i2c failure\n"); @@ -94,7 +94,8 @@ int cx25840_loadfw(struct i2c_client *client) { struct cx25840_state *state = i2c_get_clientdata(client); const struct firmware *fw = NULL; - u8 buffer[4], *ptr; + u8 buffer[FWSEND]; + const u8 *ptr; int size, retval; if (state->is_cx23885) @@ -109,29 +110,23 @@ int cx25840_loadfw(struct i2c_client *client) buffer[0] = 0x08; buffer[1] = 0x02; - buffer[2] = fw->data[0]; - buffer[3] = fw->data[1]; - retval = fw_write(client, buffer, 4); - if (retval < 0) { - release_firmware(fw); - return retval; - } - - size = fw->size - 2; + size = fw->size; ptr = fw->data; while (size > 0) { - ptr[0] = 0x08; - ptr[1] = 0x02; - retval = fw_write(client, ptr, min(FWSEND, size + 2)); + int len = min(FWSEND - 2, size); + + memcpy(buffer + 2, ptr, len); + + retval = fw_write(client, buffer, len + 2); if (retval < 0) { release_firmware(fw); return retval; } - size -= FWSEND - 2; - ptr += FWSEND - 2; + size -= len; + ptr += len; } end_fw_load(client); diff --git a/linux/drivers/media/video/cx25840/cx25840-vbi.c b/linux/drivers/media/video/cx25840/cx25840-vbi.c index 2d8364e65..08e293ee3 100644 --- a/linux/drivers/media/video/cx25840/cx25840-vbi.c +++ b/linux/drivers/media/video/cx25840/cx25840-vbi.c @@ -83,150 +83,6 @@ static int decode_vps(u8 * dst, u8 * p) return err & 0xf0; } -void cx25840_vbi_setup(struct i2c_client *client) -{ - struct cx25840_state *state = i2c_get_clientdata(client); - v4l2_std_id std = state->std; - int hblank,hactive,burst,vblank,vactive,sc,vblank656,src_decimation; - int luma_lpf,uv_lpf, comb; - u32 pll_int,pll_frac,pll_post; - - /* datasheet startup, step 8d */ - if (std & ~V4L2_STD_NTSC) { - cx25840_write(client, 0x49f, 0x11); - } else { - cx25840_write(client, 0x49f, 0x14); - } - - if (std & V4L2_STD_625_50) { - hblank=0x084; - hactive=0x2d0; - burst=0x5d; - vblank=0x024; - vactive=0x244; - vblank656=0x28; - src_decimation=0x21f; - - luma_lpf=2; - if (std & V4L2_STD_SECAM) { - uv_lpf=0; - comb=0; - sc=0x0a425f; - } else if (std == V4L2_STD_PAL_Nc) { - uv_lpf=1; - comb=0x20; - sc=556453; - } else { - uv_lpf=1; - comb=0x20; - sc=0x0a8263; - } - } else { - hactive=720; - hblank=122; - vactive=487; - luma_lpf=1; - uv_lpf=1; - - src_decimation=0x21f; - if (std == V4L2_STD_PAL_60) { - vblank=26; - vblank656=26; - burst=0x5b; - luma_lpf=2; - comb=0x20; - sc=0x0a8263; - } else if (std == V4L2_STD_PAL_M) { - vblank=20; - vblank656=24; - burst=0x61; - comb=0x20; - - sc=555452; - } else { - vblank=26; - vblank656=26; - burst=0x5b; - comb=0x66; - sc=556063; - } - } - - /* DEBUG: Displays configured PLL frequency */ - pll_int=cx25840_read(client, 0x108); - pll_frac=cx25840_read4(client, 0x10c)&0x1ffffff; - pll_post=cx25840_read(client, 0x109); - v4l_dbg(1, cx25840_debug, client, - "PLL regs = int: %u, frac: %u, post: %u\n", - pll_int,pll_frac,pll_post); - - if (pll_post) { - int fin, fsc; - int pll= (28636363L*((((u64)pll_int)<<25L)+pll_frac)) >>25L; - - pll/=pll_post; - v4l_dbg(1, cx25840_debug, client, "PLL = %d.%06d MHz\n", - pll/1000000, pll%1000000); - v4l_dbg(1, cx25840_debug, client, "PLL/8 = %d.%06d MHz\n", - pll/8000000, (pll/8)%1000000); - - fin=((u64)src_decimation*pll)>>12; - v4l_dbg(1, cx25840_debug, client, "ADC Sampling freq = " - "%d.%06d MHz\n", - fin/1000000,fin%1000000); - - fsc= (((u64)sc)*pll) >> 24L; - v4l_dbg(1, cx25840_debug, client, "Chroma sub-carrier freq = " - "%d.%06d MHz\n", - fsc/1000000,fsc%1000000); - - v4l_dbg(1, cx25840_debug, client, "hblank %i, hactive %i, " - "vblank %i, vactive %i, vblank656 %i, src_dec %i, " - "burst 0x%02x, luma_lpf %i, uv_lpf %i, comb 0x%02x," - " sc 0x%06x\n", - hblank, hactive, vblank, vactive, vblank656, - src_decimation, burst, luma_lpf, uv_lpf, comb, sc); - } - - /* Sets horizontal blanking delay and active lines */ - cx25840_write(client, 0x470, hblank); - cx25840_write(client, 0x471, 0xff&(((hblank>>8)&0x3)|(hactive <<4))); - cx25840_write(client, 0x472, hactive>>4); - - /* Sets burst gate delay */ - cx25840_write(client, 0x473, burst); - - /* Sets vertical blanking delay and active duration */ - cx25840_write(client, 0x474, vblank); - cx25840_write(client, 0x475, 0xff&(((vblank>>8)&0x3)|(vactive <<4))); - cx25840_write(client, 0x476, vactive>>4); - cx25840_write(client, 0x477, vblank656); - - /* Sets src decimation rate */ - cx25840_write(client, 0x478, 0xff&src_decimation); - cx25840_write(client, 0x479, 0xff&(src_decimation>>8)); - - /* Sets Luma and UV Low pass filters */ - cx25840_write(client, 0x47a, luma_lpf<<6|((uv_lpf<<4)&0x30)); - - /* Enables comb filters */ - cx25840_write(client, 0x47b, comb); - - /* Sets SC Step*/ - cx25840_write(client, 0x47c, sc); - cx25840_write(client, 0x47d, 0xff&sc>>8); - cx25840_write(client, 0x47e, 0xff&sc>>16); - - /* Sets VBI parameters */ - if (std & V4L2_STD_625_50) { - cx25840_write(client, 0x47f, 0x01); - state->vbi_line_offset = 5; - } else { - cx25840_write(client, 0x47f, 0x00); - state->vbi_line_offset = 8; - } -} - int cx25840_vbi(struct i2c_client *client, unsigned int cmd, void *arg) { struct cx25840_state *state = i2c_get_clientdata(client); @@ -293,8 +149,8 @@ int cx25840_vbi(struct i2c_client *client, unsigned int cmd, void *arg) /* raw VBI */ memset(svbi, 0, sizeof(*svbi)); - /* Setup VBI */ - cx25840_vbi_setup(client); + /* Setup standard */ + cx25840_std_setup(client); /* VBI Offset */ cx25840_write(client, 0x47f, vbi_offset); @@ -305,8 +161,8 @@ int cx25840_vbi(struct i2c_client *client, unsigned int cmd, void *arg) for (x = 0; x <= 23; x++) lcr[x] = 0x00; - /* Setup VBI */ - cx25840_vbi_setup(client); + /* Setup standard */ + cx25840_std_setup(client); /* Sliced VBI */ cx25840_write(client, 0x404, 0x32); /* Ancillary data */ diff --git a/linux/drivers/media/video/cx88/cx88-blackbird.c b/linux/drivers/media/video/cx88/cx88-blackbird.c index 83638557d..4b780c237 100644 --- a/linux/drivers/media/video/cx88/cx88-blackbird.c +++ b/linux/drivers/media/video/cx88/cx88-blackbird.c @@ -33,6 +33,7 @@ #include <linux/device.h> #include <linux/firmware.h> #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <media/cx2341x.h> #include "cx88.h" diff --git a/linux/drivers/media/video/cx88/cx88-core.c b/linux/drivers/media/video/cx88/cx88-core.c index a63915bdf..4ce5f7589 100644 --- a/linux/drivers/media/video/cx88/cx88-core.c +++ b/linux/drivers/media/video/cx88/cx88-core.c @@ -41,6 +41,7 @@ #include "cx88.h" #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> MODULE_DESCRIPTION("v4l2 driver module for cx2388x based TV cards"); MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); @@ -1035,7 +1036,7 @@ struct video_device *cx88_vdev_init(struct cx88_core *core, return NULL; *vfd = *template; vfd->minor = -1; - vfd->dev = &pci->dev; + vfd->parent = &pci->dev; vfd->release = video_device_release; snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)", core->name, type, core->board.name); diff --git a/linux/drivers/media/video/cx88/cx88-video.c b/linux/drivers/media/video/cx88/cx88-video.c index 63521066d..f26232345 100644 --- a/linux/drivers/media/video/cx88/cx88-video.c +++ b/linux/drivers/media/video/cx88/cx88-video.c @@ -40,6 +40,7 @@ #include "cx88.h" #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #ifdef CONFIG_VIDEO_V4L1_COMPAT /* Include V4L1 specific functions. Should be removed soon */ diff --git a/linux/drivers/media/video/dabusb.c b/linux/drivers/media/video/dabusb.c index 4efe3f839..f23e6b84d 100644 --- a/linux/drivers/media/video/dabusb.c +++ b/linux/drivers/media/video/dabusb.c @@ -39,9 +39,15 @@ #include <linux/usb.h> #include "compat.h" #include <linux/mutex.h> +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) +#include <linux/firmware.h> +#include <linux/ihex.h> +#endif #include "dabusb.h" +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) #include "dabfirmware.h" +#endif /* * Version Information @@ -302,7 +308,12 @@ static int dabusb_bulk (pdabusb_t s, pbulk_transfer_t pb) return ret; } /* --------------------------------------------------------------------- */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) static int dabusb_writemem (pdabusb_t s, int pos, unsigned char *data, int len) +#else +static int dabusb_writemem (pdabusb_t s, int pos, const unsigned char *data, + int len) +#endif { int ret; unsigned char *transfer_buffer = kmalloc (len, GFP_KERNEL); @@ -329,24 +340,63 @@ static int dabusb_8051_reset (pdabusb_t s, unsigned char reset_bit) static int dabusb_loadmem (pdabusb_t s, const char *fname) { int ret; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) PINTEL_HEX_RECORD ptr = firmware; +#else + const struct ihex_binrec *rec; + const struct firmware *fw; +#endif dbg("Enter dabusb_loadmem (internal)"); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) + ret = request_ihex_firmware(&fw, "dabusb/firmware.fw", &s->usbdev->dev); + if (ret) { + err("Failed to load \"dabusb/firmware.fw\": %d\n", ret); + goto out; + } +#endif ret = dabusb_8051_reset (s, 1); +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) while (ptr->Type == 0) { +#endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) dbg("dabusb_writemem: %04X %p %d)", ptr->Address, ptr->Data, ptr->Length); +#else + for (rec = (const struct ihex_binrec *)fw->data; rec; + rec = ihex_next_binrec(rec)) { + dbg("dabusb_writemem: %04X %p %d)", be32_to_cpu(rec->addr), + rec->data, be16_to_cpu(rec->len)); +#endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) ret = dabusb_writemem (s, ptr->Address, ptr->Data, ptr->Length); +#else + ret = dabusb_writemem(s, be32_to_cpu(rec->addr), rec->data, + be16_to_cpu(rec->len)); +#endif if (ret < 0) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) err("dabusb_writemem failed (%d %04X %p %d)", ret, ptr->Address, ptr->Data, ptr->Length); +#else + err("dabusb_writemem failed (%d %04X %p %d)", ret, + be32_to_cpu(rec->addr), rec->data, + be16_to_cpu(rec->len)); +#endif break; } +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) ptr++; +#endif } ret = dabusb_8051_reset (s, 0); +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) +#else + release_firmware(fw); + out: +#endif dbg("dabusb_loadmem: exit"); return ret; @@ -381,9 +431,14 @@ static int dabusb_fpga_init (pdabusb_t s, pbulk_transfer_t b) static int dabusb_fpga_download (pdabusb_t s, const char *fname) { pbulk_transfer_t b = kmalloc (sizeof (bulk_transfer_t), GFP_KERNEL); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) + const struct firmware *fw; +#endif unsigned int blen, n; int ret; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) unsigned char *buf = bitstream; +#endif dbg("Enter dabusb_fpga_download (internal)"); @@ -392,10 +447,22 @@ static int dabusb_fpga_download (pdabusb_t s, const char *fname) return -ENOMEM; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) + ret = request_firmware(&fw, "dabusb/bitstream.bin", &s->usbdev->dev); + if (ret) { + err("Failed to load \"dabusb/bitstream.bin\": %d\n", ret); + return ret; + } + +#endif b->pipe = 1; ret = dabusb_fpga_clear (s, b); mdelay (10); +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) blen = buf[73] + (buf[72] << 8); +#else + blen = fw->data[73] + (fw->data[72] << 8); +#endif dbg("Bitstream len: %i", blen); @@ -407,7 +474,11 @@ static int dabusb_fpga_download (pdabusb_t s, const char *fname) for (n = 0; n <= blen + 60; n += 60) { // some cclks for startup b->size = 64; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) memcpy (b->data + 4, buf + 74 + n, 60); +#else + memcpy (b->data + 4, fw->data + 74 + n, 60); +#endif ret = dabusb_bulk (s, b); if (ret < 0) { err("dabusb_bulk failed."); @@ -418,6 +489,9 @@ static int dabusb_fpga_download (pdabusb_t s, const char *fname) ret = dabusb_fpga_init (s, b); kfree (b); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) + release_firmware(fw); +#endif dbg("exit dabusb_fpga_download"); @@ -700,7 +774,11 @@ static int dabusb_ioctl (struct inode *inode, struct file *file, unsigned int cm return ret; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 17) static const struct file_operations dabusb_fops = +#else +static struct file_operations dabusb_fops = +#endif { .owner = THIS_MODULE, .llseek = no_llseek, diff --git a/linux/drivers/media/video/em28xx/em28xx-video.c b/linux/drivers/media/video/em28xx/em28xx-video.c index 4f7a51e66..c456f9945 100644 --- a/linux/drivers/media/video/em28xx/em28xx-video.c +++ b/linux/drivers/media/video/em28xx/em28xx-video.c @@ -38,6 +38,7 @@ #include "em28xx.h" #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <media/msp3400.h> #include <media/tuner.h> @@ -1954,7 +1955,7 @@ static struct video_device *em28xx_vdev_init(struct em28xx *dev, return NULL; *vfd = *template; vfd->minor = -1; - vfd->dev = &dev->udev->dev; + vfd->parent = &dev->udev->dev; vfd->release = video_device_release; vfd->type = type; vfd->debug = video_debug; diff --git a/linux/drivers/media/video/et61x251/et61x251_core.c b/linux/drivers/media/video/et61x251/et61x251_core.c index 4d08f0225..0711a34fb 100644 --- a/linux/drivers/media/video/et61x251/et61x251_core.c +++ b/linux/drivers/media/video/et61x251/et61x251_core.c @@ -34,6 +34,7 @@ #include <linux/mm.h> #include <linux/vmalloc.h> #include <linux/page-flags.h> +#include <media/v4l2-ioctl.h> #include <asm/byteorder.h> #include <asm/page.h> #include <asm/uaccess.h> @@ -989,7 +990,7 @@ static DEVICE_ATTR(i2c_val, S_IRUGO | S_IWUSR, static int et61x251_create_sysfs(struct et61x251_device* cam) { - struct device *classdev = &(cam->v4ldev->class_dev); + struct device *classdev = &(cam->v4ldev->dev); int err = 0; if ((err = device_create_file(classdev, &dev_attr_reg))) diff --git a/linux/drivers/media/video/gspca/conex.c b/linux/drivers/media/video/gspca/conex.c index b5481017d..18c1dec2f 100644 --- a/linux/drivers/media/video/gspca/conex.c +++ b/linux/drivers/media/video/gspca/conex.c @@ -25,9 +25,6 @@ #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"; - MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_DESCRIPTION("GSPCA USB Conexant Camera Driver"); MODULE_LICENSE("GPL"); @@ -119,40 +116,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]); } -static void reg_w(struct usb_device *dev, +/* 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 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 +256,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 +294,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 +374,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 +396,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 +645,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 +669,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 +696,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 +705,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 +713,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 +853,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 +904,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 +926,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) @@ -1071,7 +1035,7 @@ static int __init sd_mod_init(void) { if (usb_register(&sd_driver) < 0) return -1; - PDEBUG(D_PROBE, "v%s registered", version); + PDEBUG(D_PROBE, "registered"); return 0; } static void __exit sd_mod_exit(void) diff --git a/linux/drivers/media/video/gspca/etoms.c b/linux/drivers/media/video/gspca/etoms.c index 25d59ae1f..3d420ea65 100644 --- a/linux/drivers/media/video/gspca/etoms.c +++ b/linux/drivers/media/video/gspca/etoms.c @@ -22,9 +22,6 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) -static const char version[] = "2.1.5"; - MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_DESCRIPTION("Etoms USB Camera Driver"); MODULE_LICENSE("GPL"); @@ -229,201 +226,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, + int 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 +446,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 +474,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 +484,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 +502,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 +516,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 +637,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 +651,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 +681,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 +689,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 +703,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 +712,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 +723,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 +735,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 +757,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 +765,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; @@ -947,7 +945,7 @@ static int __init sd_mod_init(void) { if (usb_register(&sd_driver) < 0) return -1; - PDEBUG(D_PROBE, "v%s registered", version); + PDEBUG(D_PROBE, "registered"); return 0; } diff --git a/linux/drivers/media/video/gspca/gspca.c b/linux/drivers/media/video/gspca/gspca.c index 943c5981f..729e0b4ed 100644 --- a/linux/drivers/media/video/gspca/gspca.c +++ b/linux/drivers/media/video/gspca/gspca.c @@ -30,8 +30,13 @@ #include <linux/pagemap.h> #include <linux/io.h> #include <asm/page.h> +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19) +#include <asm/uaccess.h> +#else #include <linux/uaccess.h> +#endif #include <linux/jiffies.h> +#include <media/v4l2-ioctl.h> #include "gspca.h" @@ -42,8 +47,7 @@ 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, 2, 0) static int video_nr = -1; @@ -171,7 +175,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); @@ -212,6 +216,8 @@ struct gspca_frame *gspca_frame_add(struct gspca_dev *gspca_dev, &frame->v4l2_buf.timestamp); frame->v4l2_buf.sequence = ++gspca_dev->sequence; } else if (gspca_dev->last_packet_type == DISCARD_PACKET) { + if (packet_type == LAST_PACKET) + gspca_dev->last_packet_type = packet_type; return frame; } @@ -402,7 +408,7 @@ static struct usb_host_endpoint *alt_isoc(struct usb_host_interface *alt, * This routine may be called many times when the bandwidth is too small * (the bandwidth is checked on urb submit). */ -struct usb_host_endpoint *get_isoc_ep(struct gspca_dev *gspca_dev) +static struct usb_host_endpoint *get_isoc_ep(struct gspca_dev *gspca_dev) { struct usb_interface *intf; struct usb_host_endpoint *ep; @@ -561,11 +567,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 +684,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 +817,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 +982,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 +992,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 +1073,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 +1096,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 +1104,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 +1356,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 +1381,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 +1436,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 +1511,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 +1538,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 +1554,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) @@ -1739,7 +1749,7 @@ int gspca_dev_probe(struct usb_interface *intf, /* init video stuff */ memcpy(&gspca_dev->vdev, &gspca_template, sizeof gspca_template); - gspca_dev->vdev.dev = &dev->dev; + gspca_dev->vdev.parent = &dev->dev; memcpy(&gspca_dev->fops, &dev_fops, sizeof gspca_dev->fops); gspca_dev->vdev.fops = &gspca_dev->fops; gspca_dev->fops.owner = module; /* module protection */ @@ -1793,10 +1803,101 @@ 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) { - info("main v%s registered", version); + info("main v%d.%d.%d registered", + (DRIVER_VERSION_NUMBER >> 16) & 0xff, + (DRIVER_VERSION_NUMBER >> 8) & 0xff, + DRIVER_VERSION_NUMBER & 0xff); return 0; } static void __exit gspca_exit(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..a4706162f 100644 --- a/linux/drivers/media/video/gspca/mars.c +++ b/linux/drivers/media/video/gspca/mars.c @@ -24,9 +24,6 @@ #include "gspca.h" #include "jpeg.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) -static const char version[] = "2.1.5"; - MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_DESCRIPTION("GSPCA/Mars USB Camera Driver"); MODULE_LICENSE("GPL"); @@ -83,39 +80,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; - data[0] = 0x1f; - data[1] = 0; /* control byte */ - data[2] = Address; - data[3] = *pch >> 8; /* high byte */ - data[4] = *pch; /* low byte */ + 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; +} + +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 +153,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 +189,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 +258,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 +313,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"); } @@ -439,7 +448,7 @@ static int __init sd_mod_init(void) { if (usb_register(&sd_driver) < 0) return -1; - PDEBUG(D_PROBE, "v%s registered", version); + PDEBUG(D_PROBE, "registered"); return 0; } static void __exit sd_mod_exit(void) diff --git a/linux/drivers/media/video/gspca/ov519.c b/linux/drivers/media/video/gspca/ov519.c index 402b3ed12..1fb3a3eee 100644 --- a/linux/drivers/media/video/gspca/ov519.c +++ b/linux/drivers/media/video/gspca/ov519.c @@ -24,9 +24,6 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) -static const char version[] = "2.1.5"; - MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>"); MODULE_DESCRIPTION("OV519 USB Camera Driver"); MODULE_LICENSE("GPL"); @@ -282,15 +279,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 +297,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 +316,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; @@ -2225,7 +2219,7 @@ static int __init sd_mod_init(void) { if (usb_register(&sd_driver) < 0) return -1; - PDEBUG(D_PROBE, "v%s registered", version); + PDEBUG(D_PROBE, "registered"); return 0; } static void __exit sd_mod_exit(void) diff --git a/linux/drivers/media/video/gspca/pac207.c b/linux/drivers/media/video/gspca/pac207.c index 4f197c1f4..f79074637 100644 --- a/linux/drivers/media/video/gspca/pac207.c +++ b/linux/drivers/media/video/gspca/pac207.c @@ -27,9 +27,6 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) -static const char version[] = "2.1.5"; - MODULE_AUTHOR("Hans de Goede <j.w.r.degoede@hhs.nl>"); MODULE_DESCRIPTION("Pixart PAC207"); MODULE_LICENSE("GPL"); @@ -187,18 +184,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)", @@ -208,7 +205,7 @@ int pac207_write_regs(struct gspca_dev *gspca_dev, u16 index, } -int pac207_write_reg(struct gspca_dev *gspca_dev, u16 index, u16 value) +static int pac207_write_reg(struct gspca_dev *gspca_dev, u16 index, u16 value) { struct usb_device *udev = gspca_dev->dev; int err; @@ -223,16 +220,15 @@ int pac207_write_reg(struct gspca_dev *gspca_dev, u16 index, u16 value) return err; } - -int pac207_read_reg(struct gspca_dev *gspca_dev, u16 index) +static 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 +236,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 +352,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 +491,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 +509,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); @@ -668,7 +605,7 @@ static int __init sd_mod_init(void) { if (usb_register(&sd_driver) < 0) return -1; - PDEBUG(D_PROBE, "v%s registered", version); + PDEBUG(D_PROBE, "registered"); return 0; } static void __exit sd_mod_exit(void) diff --git a/linux/drivers/media/video/gspca/pac7311.c b/linux/drivers/media/video/gspca/pac7311.c index 5519c2f70..c2d4984cf 100644 --- a/linux/drivers/media/video/gspca/pac7311.c +++ b/linux/drivers/media/video/gspca/pac7311.c @@ -23,9 +23,6 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) -static const char version[] = "2.1.5"; - MODULE_AUTHOR("Thomas Kaiser thomas@kaiser-linux.li"); MODULE_DESCRIPTION("Pixart PAC7311"); MODULE_LICENSE("GPL"); @@ -206,46 +203,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 +248,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 +282,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 +294,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 +305,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 +399,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 +443,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 +462,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 +479,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 +491,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 +609,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 @@ -777,7 +757,7 @@ static int __init sd_mod_init(void) { if (usb_register(&sd_driver) < 0) return -1; - PDEBUG(D_PROBE, "v%s registered", version); + PDEBUG(D_PROBE, "registered"); return 0; } static void __exit sd_mod_exit(void) diff --git a/linux/drivers/media/video/gspca/sonixb.c b/linux/drivers/media/video/gspca/sonixb.c index a4594dc0e..bfe0ae346 100644 --- a/linux/drivers/media/video/gspca/sonixb.c +++ b/linux/drivers/media/video/gspca/sonixb.c @@ -24,9 +24,6 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) -static const char version[] = "2.1.5"; - MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_DESCRIPTION("GSPCA/SN9C102 USB Camera Driver"); MODULE_LICENSE("GPL"); @@ -35,7 +32,18 @@ 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 autogain; + unsigned char autogain_ignore_frames; + unsigned char freq; /* light freq filter setting */ + unsigned char saturation; + unsigned char hue; unsigned char contrast; unsigned char fr_h_sz; /* size of frame header */ @@ -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,34 @@ 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_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 int sd_setsaturation(struct gspca_dev *gspca_dev, __s32 val); +static int sd_getsaturation(struct gspca_dev *gspca_dev, __s32 *val); +static int sd_sethue(struct gspca_dev *gspca_dev, __s32 val); +static int sd_gethue(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 struct ctrl sd_ctrls[] = { -#define SD_BRIGHTNESS 0 { { .id = V4L2_CID_BRIGHTNESS, @@ -75,24 +105,113 @@ 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, + }, + { + { + .id = V4L2_CID_SATURATION, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Saturation", + .minimum = 0, + .maximum = 255, + .step = 1, +#define SATURATION_DEF 127 + .default_value = SATURATION_DEF, + }, + .set = sd_setsaturation, + .get = sd_getsaturation, + }, + { + { + .id = V4L2_CID_HUE, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Hue", + .minimum = 0, + .maximum = 255, + .step = 1, +#define HUE_DEF 127 + .default_value = HUE_DEF, + }, + .set = sd_sethue, + .get = sd_gethue, + }, + { + { + .id = V4L2_CID_CONTRAST, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Contrast", + .minimum = 0, + .maximum = 255, + .step = 1, +#define CONTRAST_DEF 127 + .default_value = CONTRAST_DEF, + }, + .set = sd_setcontrast, + .get = sd_getcontrast, }, }; @@ -161,8 +280,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,52 +294,68 @@ 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}, - {0xb0, 0x60, 0x60, 0x66, 0x68, 0xd8, 0xa4, 0x10}, + /* Enable rgb brightness control */ + {0xa0, 0x60, 0x61, 0x08, 0x00, 0x00, 0x00, 0x10}, + /* HDG: Note windows uses the line below, which sets both register 0x60 + and 0x61 I believe these registers of the ov6650 are identical as + those of the ov7630, because if this is true the windows settings + add a bit additional red gain and a lot additional blue gain, which + matches my findings that the windows settings make blue much too + blue and red a little too red. + {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 */ +#if 1 0x00, 0x02, 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 */ +#else /* jfm from win */ + 0x00, 0x01, 0x01, 0x0a, /* r11 .. r14 */ + 0x16, 0x12, /* H & V sizes r15 .. r16 */ + 0x68, COMP2, MCK_INIT1, /* r17 .. r19 */ + 0x1d, 0x10, 0x06, 0x01, 0x00, 0x03 /* r1a .. r1f */ +#endif }; 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 +363,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 +380,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 +479,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 +571,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 +590,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 +610,292 @@ 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 setsaturation(struct gspca_dev *gspca_dev) +{ + struct sd *sd = (struct sd *) gspca_dev; + + switch (sd->sensor) { +/* case SENSOR_OV6650: */ + case SENSOR_OV7630_3: + case SENSOR_OV7630: { + __u8 i2c[] = {0xa0, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x10}; + i2c[1] = sd->sensor_addr; + i2c[3] = sd->saturation & 0xf0; + if (i2c_w(gspca_dev, i2c) < 0) + PDEBUG(D_ERR, "i2c error setsaturation"); + else + PDEBUG(D_CONF, "saturation set to: %d", + (int)sd->saturation); + break; + } + } +} + +static void sethue(struct gspca_dev *gspca_dev) +{ + struct sd *sd = (struct sd *) gspca_dev; + + switch (sd->sensor) { +/* case SENSOR_OV6650: */ + case SENSOR_OV7630_3: + case SENSOR_OV7630: { + __u8 i2c[] = {0xa0, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x10}; + i2c[1] = sd->sensor_addr; + i2c[3] = 0x20 | (sd->hue >> 3); + if (i2c_w(gspca_dev, i2c) < 0) + PDEBUG(D_ERR, "i2c error setsaturation"); + else + PDEBUG(D_CONF, "hue set to: %d", (int)sd->hue); + break; + } + } +} + +static void setcontrast(struct gspca_dev *gspca_dev) +{ + struct sd *sd = (struct sd *) gspca_dev; + + switch (sd->sensor) { +/* case SENSOR_OV6650: */ + case SENSOR_OV7630_3: + case SENSOR_OV7630: { + __u8 i2c[] = {0xa0, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x10}; + i2c[1] = sd->sensor_addr; + i2c[3] = 0x20 | (sd->contrast >> 3); + if (i2c_w(gspca_dev, i2c) < 0) + PDEBUG(D_ERR, "i2c error setcontrast"); + else + PDEBUG(D_CONF, "contrast set to: %d", + (int)sd->contrast); + 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 +904,28 @@ 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 */ + 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 +936,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 = 5; + 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 = 8; + sd->sd_desc.dq_callback = do_autogain; + sd->autogain = 0; break; case 0x6024: /* SN9C102 */ case 0x6025: /* SN9C102 */ @@ -573,30 +980,38 @@ 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; + sd->freq = FREQ_DEF; + sd->contrast = CONTRAST_DEF; + sd->saturation = SATURATION_DEF; + sd->hue = HUE_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 +1022,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 +1032,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; @@ -679,12 +1093,12 @@ static void sd_start(struct gspca_dev *gspca_dev) case SENSOR_OV7630: reg01 = 0x06; reg17 = 0x29; - l = 0x10; + l = sizeof initOv7630; break; case SENSOR_OV7630_3: reg01 = 0x44; reg17 = 0x68; - l = 0x10; + l = sizeof initOv7630_3; break; default: reg01 = sn9c10x[0]; @@ -694,84 +1108,91 @@ 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); + setsaturation(gspca_dev); + sethue(gspca_dev); + setcontrast(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 +1208,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 +1230,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,6 +1273,126 @@ static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val) return 0; } +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->exposure = val; + if (gspca_dev->streaming) + setexposure(gspca_dev); + return 0; +} + +static int sd_getexposure(struct gspca_dev *gspca_dev, __s32 *val) +{ + struct sd *sd = (struct sd *) gspca_dev; + + *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_setsaturation(struct gspca_dev *gspca_dev, __s32 val) +{ + struct sd *sd = (struct sd *) gspca_dev; + + sd->saturation = val; + if (gspca_dev->streaming) + setsaturation(gspca_dev); + return 0; +} + +static int sd_getsaturation(struct gspca_dev *gspca_dev, __s32 *val) +{ + struct sd *sd = (struct sd *) gspca_dev; + + *val = sd->saturation; + return 0; +} + +static int sd_sethue(struct gspca_dev *gspca_dev, __s32 val) +{ + struct sd *sd = (struct sd *) gspca_dev; + + sd->hue = val; + if (gspca_dev->streaming) + sethue(gspca_dev); + return 0; +} + +static int sd_gethue(struct gspca_dev *gspca_dev, __s32 *val) +{ + struct sd *sd = (struct sd *) gspca_dev; + + *val = sd->hue; + return 0; +} + static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val) { struct sd *sd = (struct sd *) gspca_dev; @@ -849,8 +1411,29 @@ static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val) 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 +1444,7 @@ static struct sd_desc sd_desc = { .stop0 = sd_stop0, .close = sd_close, .pkt_scan = sd_pkt_scan, + .querymenu = sd_querymenu, }; /* -- module initialisation -- */ @@ -872,7 +1456,9 @@ static __devinitdata struct usb_device_id device_table[] = { {USB_DEVICE(0x0c45, 0x6007), DVNM("Sonix sn9c101 + Tas5110D")}, {USB_DEVICE(0x0c45, 0x6009), DVNM("spcaCam@120")}, {USB_DEVICE(0x0c45, 0x600d), DVNM("spcaCam@120")}, +#endif {USB_DEVICE(0x0c45, 0x6011), DVNM("MAX Webcam Microdia")}, +#ifndef CONFIG_USB_SN9C102 {USB_DEVICE(0x0c45, 0x6019), DVNM("Generic Sonix OV7630")}, {USB_DEVICE(0x0c45, 0x6024), DVNM("Generic Sonix Tas5130c")}, {USB_DEVICE(0x0c45, 0x6025), DVNM("Xcam Shanga")}, @@ -908,7 +1494,7 @@ static int __init sd_mod_init(void) { if (usb_register(&sd_driver) < 0) return -1; - PDEBUG(D_PROBE, "v%s registered", version); + PDEBUG(D_PROBE, "registered"); return 0; } static void __exit sd_mod_exit(void) diff --git a/linux/drivers/media/video/gspca/sonixj.c b/linux/drivers/media/video/gspca/sonixj.c index 785ca2e50..5d16f16f0 100644 --- a/linux/drivers/media/video/gspca/sonixj.c +++ b/linux/drivers/media/video/gspca/sonixj.c @@ -24,9 +24,6 @@ #include "gspca.h" #include "jpeg.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) -static const char version[] = "2.1.5"; - MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_DESCRIPTION("GSPCA/SONIX JPEG USB Camera Driver"); MODULE_LICENSE("GPL"); @@ -47,20 +44,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 +148,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 +195,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 +223,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 +238,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, @@ -354,20 +369,19 @@ static const __u8 mo4000_sensor_init[][8] = { }; static const __u8 ov7660_sensor_init[][8] = { {0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10}, /* reset SCCB */ +/* (delay 20ms) */ {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 +390,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 +441,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 +537,58 @@ 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); + PDEBUG(D_USBI, "reg_r [%02x] -> %02x", value, gspca_dev->usb_buf[0]); } -static void reg_w(struct usb_device *dev, +static void reg_w1(struct gspca_dev *gspca_dev, + __u16 value, + __u8 data) +{ + PDEBUG(D_USBO, "reg_w1 [%02x] = %02x", value, data); + gspca_dev->usb_buf[0] = data; + usb_control_msg(gspca_dev->dev, + usb_sndctrlpipe(gspca_dev->dev, 0), + 0x08, + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, + value, + 0, + gspca_dev->usb_buf, 1, + 500); +} +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), + PDEBUG(D_USBO, "reg_w [%02x] = %02x %02x ..", + value, buffer[0], buffer[1]); + 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,42 +598,51 @@ static void reg_w(struct usb_device *dev, } } -/* write 2 bytes */ -static void i2c_w2(struct gspca_dev *gspca_dev, - const __u8 *buffer) +/* I2C write 1 byte */ +static void i2c_w1(struct gspca_dev *gspca_dev, __u8 reg, __u8 val) { 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[1] = sd->i2c_base; - mode[2] = buffer[0]; - mode[3] = buffer[1]; - mode[4] = 0; - mode[5] = 0; - mode[6] = 0; - mode[7] = 0x10; - reg_w(dev, 0x08, mode, 8); + PDEBUG(D_USBO, "i2c_w2 [%02x] = %02x", reg, val); + gspca_dev->usb_buf[0] = 0x81 | (2 << 4); /* = a1 */ + gspca_dev->usb_buf[1] = sd->i2c_base; + gspca_dev->usb_buf[2] = reg; + gspca_dev->usb_buf[3] = val; + gspca_dev->usb_buf[4] = 0; + gspca_dev->usb_buf[5] = 0; + gspca_dev->usb_buf[6] = 0; + gspca_dev->usb_buf[7] = 0x10; + usb_control_msg(gspca_dev->dev, + usb_sndctrlpipe(gspca_dev->dev, 0), + 0x08, + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, + 0x08, /* value = i2c */ + 0, + gspca_dev->usb_buf, 8, + 500); } -/* 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); - msleep(1); + memcpy(gspca_dev->usb_buf, buffer, 8); + usb_control_msg(gspca_dev->dev, + usb_sndctrlpipe(gspca_dev->dev, 0), + 0x08, + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, + 0x08, 0, /* value, index */ + gspca_dev->usb_buf, 8, + 500); } -/* 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 +650,36 @@ 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); + msleep(2); + mode[0] = 0x81 | (5 << 4) | 0x02; mode[2] = 0; - i2c_w8(dev, mode); - reg_r(dev, 0x0a, buffer, 5); + i2c_w8(gspca_dev, mode); + msleep(2); + 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 */ + + i2c_w1(gspca_dev, 0x02, 0); /* sensor wakeup */ msleep(10); - reg02 = 0x66; - reg_w(dev, 0x02, ®02, 1); /* Gpio on */ + reg_w1(gspca_dev, 0x02, 0x66); /* 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]); + PDEBUG(D_PROBE, "Find Sensor 0x%02x 0x%02x 0x%02x", + 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,9 +688,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; static const __u8 reg9a_def[] = {0x08, 0x40, 0x20, 0x10, 0x00, 0x04}; @@ -664,58 +696,45 @@ static int configure_gpio(struct gspca_dev *gspca_dev, static const __u8 reg9a_sn9c325[] = {0x0a, 0x40, 0x38, 0x30, 0x00, 0x20}; - - regF1 = 0x00; - reg_w(dev, 0xf1, ®F1, 1); - - reg_w(dev, 0x01, &sn9c1xx[0], 1); /*fixme:jfm was [1] en v1*/ + reg_w1(gspca_dev, 0xf1, 0x00); + reg_w1(gspca_dev, 0x01, sn9c1xx[0]); /*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 len 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_w1(gspca_dev, 0xd4, 0x60); /*fixme:jfm 60 00 00 (3) ? */ - reg_w(dev, 0x03, &sn9c1xx[3], 0x0f); + reg_w(gspca_dev, 0x03, &sn9c1xx[3], 0x0f); - switch (sd->customid) { - case SN9C120: /* from win trace */ - data = 0x61; - reg_w(dev, 0x01, &data, 1); - data = 0x20; - reg_w(dev, 0x17, &data, 1); - data = 0x60; - reg_w(dev, 0x01, &data, 1); + switch (sd->bridge) { + case BRIDGE_SN9C120: /* from win trace */ + reg_w1(gspca_dev, 0x01, 0x61); + reg_w1(gspca_dev, 0x17, 0x20); + reg_w1(gspca_dev, 0x01, 0x60); break; - case SN9C325: - data = 0x43; - reg_w(dev, 0x01, &data, 1); - data = 0xae; - reg_w(dev, 0x17, &data, 1); - data = 0x42; - reg_w(dev, 0x01, &data, 1); + case BRIDGE_SN9C325: + reg_w1(gspca_dev, 0x01, 0x43); + reg_w1(gspca_dev, 0x17, 0xae); + reg_w1(gspca_dev, 0x01, 0x42); break; default: - data = 0x43; - reg_w(dev, 0x01, &data, 1); - data = 0x61; - reg_w(dev, 0x17, &data, 1); - data = 0x42; - reg_w(dev, 0x01, &data, 1); + reg_w1(gspca_dev, 0x01, 0x43); + reg_w1(gspca_dev, 0x17, 0x61); + reg_w1(gspca_dev, 0x01, 0x42); } if (sd->sensor == SENSOR_HV7131R) { @@ -728,24 +747,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 +770,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 +790,12 @@ 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; + i2c_w8(gspca_dev, ov7660_sensor_init[i]); /* reset SCCB */ + i++; + msleep(20); while (ov7660_sensor_init[i][0]) { - i2c_w8(dev, ov7660_sensor_init[i]); + i2c_w8(gspca_dev, ov7660_sensor_init[i]); i++; } } @@ -789,19 +806,16 @@ static int sd_config(struct gspca_dev *gspca_dev, { struct sd *sd = (struct sd *) gspca_dev; struct cam *cam; - __u16 vendor; __u16 product; - vendor = id->idVendor; product = id->idProduct; sd->sensor = -1; - switch (vendor) { + switch (id->idVendor) { 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 +824,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 +835,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 +844,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; */ } @@ -994,7 +982,7 @@ static int sd_config(struct gspca_dev *gspca_dev, } if (sd->sensor < 0) { PDEBUG(D_ERR, "Invalid vendor/product %04x:%04x", - vendor, product); + id->idVendor, product); return -EINVAL; } @@ -1016,51 +1004,43 @@ 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 }; + __u8 regF1; - /* setup a selector by customid */ - 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: + /* setup a selector by bridge */ + reg_w1(gspca_dev, 0xf1, 0x01); + reg_r(gspca_dev, 0x00, 1); /* -> regF1 = 0x00 */ + reg_w1(gspca_dev, 0xf1, gspca_dev->usb_buf[0]); + 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_w1(gspca_dev, 0x02, regGpio[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: - if (regF1 != 0x12) - return -ENODEV; - regGpio[1] = 0x62; - reg_w(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_SN9C110: */ +/* case BRIDGE_SN9C325: */ if (regF1 != 0x12) return -ENODEV; - regGpio[1] = 0x62; - reg_w(dev, 0x02, ®Gpio[1], 1); + reg_w1(gspca_dev, 0x02, 0x62); break; } - regF1 = 0x01; - reg_w(dev, 0xf1, ®F1, 1); + reg_w1(gspca_dev, 0xf1, 0x01); #if 1 /*jfm: from win trace*/ return 0; @@ -1089,7 +1069,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 +1082,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 +1098,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 +1141,7 @@ static void setbrightness(struct gspca_dev *gspca_dev) } k2 = sd->brightness >> 10; - reg_w(gspca_dev->dev, 0x96, &k2, 1); + reg_w1(gspca_dev, 0x96, k2); } static void setcontrast(struct gspca_dev *gspca_dev) @@ -1176,7 +1156,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,21 +1170,19 @@ 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_w1(gspca_dev, 0x05, data); } /* -- 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; __u8 reg17; const __u8 *sn9c1xx; int mode; - static const __u8 DC29[] = { 0x6a, 0x50, 0x00, 0x00, 0x50, 0x3c }; static const __u8 C0[] = { 0x2d, 0x2d, 0x3a, 0x05, 0x04, 0x3f }; static const __u8 CA[] = { 0x28, 0xd8, 0x14, 0xec }; static const __u8 CA_sn9c120[] = @@ -1218,65 +1196,81 @@ 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_w1(gspca_dev, 0x01, 0x44); */ + reg_w1(gspca_dev, 0x15, sn9c1xx[0x15]); + reg_w1(gspca_dev, 0x16, sn9c1xx[0x16]); + reg_w1(gspca_dev, 0x12, sn9c1xx[0x12]); + reg_w1(gspca_dev, 0x13, sn9c1xx[0x13]); + reg_w1(gspca_dev, 0x18, sn9c1xx[0x18]); + reg_w1(gspca_dev, 0xd2, 0x6a); /* DC29 */ + reg_w1(gspca_dev, 0xd3, 0x50); + reg_w1(gspca_dev, 0xc6, 0x00); + reg_w1(gspca_dev, 0xc7, 0x00); + reg_w1(gspca_dev, 0xc8, 0x50); + reg_w1(gspca_dev, 0xc9, 0x3c); /*fixme:jfm end of ending sequence */ - reg_w(dev, 0x18, &sn9c1xx[0x18], 1); - if (sd->customid == SN9C325) + reg_w1(gspca_dev, 0x18, sn9c1xx[0x18]); + 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_w1(gspca_dev, 0x17, data); + reg_w1(gspca_dev, 0x05, sn9c1xx[5]); + reg_w1(gspca_dev, 0x07, sn9c1xx[7]); + reg_w1(gspca_dev, 0x06, sn9c1xx[6]); + reg_w1(gspca_dev, 0x14, sn9c1xx[0x14]); + 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); - data = 0x0a; - reg_w(dev, 0x9a, &data, 1); - data = 0x60; - reg_w(dev, 0x99, &data, 1); - } else { - reg_w(dev, 0x20, regsn20, 0x11); + reg_w(gspca_dev, 0x84, reg84_sn9c325, + sizeof reg84_sn9c325); + reg_w1(gspca_dev, 0x9a, 0x0a); + reg_w1(gspca_dev, 0x99, 0x60); + 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); + reg_w1(gspca_dev, 0x9a, 0x05); + reg_w1(gspca_dev, 0x99, 0x5b); + break; + default: + reg_w(gspca_dev, 0x20, regsn20, sizeof regsn20); for (i = 0; i < 8; i++) - reg_w(dev, 0x84, reg84, 0x15); - data = 0x08; - reg_w(dev, 0x9a, &data, 1); - data = 0x59; - reg_w(dev, 0x99, &data, 1); + reg_w(gspca_dev, 0x84, reg84, sizeof reg84); + reg_w1(gspca_dev, 0x9a, 0x08); + reg_w1(gspca_dev, 0x99, 0x59); + break; } mode = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv; - reg1 = 0x02; + if (mode) + reg1 = 0x46; /* 320 clk 48Mhz */ + else + reg1 = 0x06; /* 640 clk 24Mz */ reg17 = 0x61; switch (sd->sensor) { case SENSOR_HV7131R: hv7131R_InitSensor(gspca_dev); - if (mode) - reg1 = 0x46; /* 320 clk 48Mhz */ - else - reg1 = 0x06; /* 640 clk 24Mz */ break; case SENSOR_MI0360: mi0360_InitSensor(gspca_dev); - if (mode) - reg1 = 0x46; /* 320 clk 48Mhz */ - else - reg1 = 0x06; /* 640 clk 24Mz */ break; case SENSOR_MO4000: mo4000_InitSensor(gspca_dev); @@ -1285,13 +1279,13 @@ static void sd_start(struct gspca_dev *gspca_dev) reg1 = 0x06; /* clk 24Mz */ } else { reg17 = 0x22; /* 640 MCKSIZE */ - reg1 = 0x06; /* 640 clk 24Mz */ +/* reg1 = 0x06; * 640 clk 24Mz (done) */ } break; case SENSOR_OV7648: + ov7648_InitSensor(gspca_dev); reg17 = 0xa2; reg1 = 0x44; - ov7648_InitSensor(gspca_dev); /* if (mode) ; * 320x2... else @@ -1303,7 +1297,7 @@ static void sd_start(struct gspca_dev *gspca_dev) if (mode) { /* reg17 = 0x21; * 320 */ /* reg1 = 0x44; */ - reg1 = 0x46; +/* reg1 = 0x46; (done) */ } else { #if 1 reg17 = 0xa2; /* 640 */ @@ -1315,38 +1309,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_w1(gspca_dev, 0x18, data); - 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_w1(gspca_dev, 0x18, data); - reg_w(dev, 0x17, ®17, 1); - reg_w(dev, 0x01, ®1, 1); + reg_w1(gspca_dev, 0x17, reg17); + reg_w1(gspca_dev, 0x01, reg1); setbrightness(gspca_dev); setcontrast(gspca_dev); } @@ -1354,23 +1348,21 @@ 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[] = { 0xb1, 0x5d, 0x07, 0x00, 0x00, 0x00, 0x00, 0x10 }; - __u8 regF1; __u8 data; const __u8 *sn9c1xx; 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 +1375,11 @@ 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); - regF1 = 0x01; - reg_w(dev, 0xf1, ®F1, 1); + reg_w1(gspca_dev, 0x01, sn9c1xx[1]); + reg_w1(gspca_dev, 0x17, sn9c1xx[0x17]); + reg_w1(gspca_dev, 0x01, sn9c1xx[1]); + reg_w1(gspca_dev, 0x01, data); + reg_w1(gspca_dev, 0xf1, 0x01); } static void sd_stop0(struct gspca_dev *gspca_dev) @@ -1484,33 +1475,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; } } @@ -1673,7 +1666,7 @@ static int __init sd_mod_init(void) { if (usb_register(&sd_driver) < 0) return -1; - info("v%s registered", version); + info("registered"); return 0; } static void __exit sd_mod_exit(void) diff --git a/linux/drivers/media/video/gspca/spca500.c b/linux/drivers/media/video/gspca/spca500.c index 1860fc7f5..81c5e091d 100644 --- a/linux/drivers/media/video/gspca/spca500.c +++ b/linux/drivers/media/video/gspca/spca500.c @@ -24,9 +24,6 @@ #include "gspca.h" #include "jpeg.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) -static const char version[] = "2.1.5"; - MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_DESCRIPTION("GSPCA/SPCA500 USB Camera Driver"); MODULE_LICENSE("GPL"); @@ -389,26 +386,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 +416,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 +444,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 +461,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 +478,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 +498,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 +533,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 +548,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 +576,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 +606,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 +619,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 +792,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 +804,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 +839,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 +862,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 +873,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 +894,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 +903,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 +928,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 +987,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 +1056,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 +1065,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 +1074,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 +1082,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 +1091,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 +1099,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; } @@ -1221,7 +1217,7 @@ static int __init sd_mod_init(void) { if (usb_register(&sd_driver) < 0) return -1; - PDEBUG(D_PROBE, "v%s registered", version); + PDEBUG(D_PROBE, "registered"); return 0; } static void __exit sd_mod_exit(void) diff --git a/linux/drivers/media/video/gspca/spca501.c b/linux/drivers/media/video/gspca/spca501.c index 762e8ae97..10e90646d 100644 --- a/linux/drivers/media/video/gspca/spca501.c +++ b/linux/drivers/media/video/gspca/spca501.c @@ -23,9 +23,6 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) -static const char version[] = "2.1.5"; - MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_DESCRIPTION("GSPCA/SPCA501 USB Camera Driver"); MODULE_LICENSE("GPL"); @@ -104,17 +101,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 +1823,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 +1879,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 +1897,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 +1920,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; */ } @@ -2228,7 +2224,7 @@ static int __init sd_mod_init(void) { if (usb_register(&sd_driver) < 0) return -1; - PDEBUG(D_PROBE, "v%s registered", version); + PDEBUG(D_PROBE, "registered"); return 0; } static void __exit sd_mod_exit(void) diff --git a/linux/drivers/media/video/gspca/spca505.c b/linux/drivers/media/video/gspca/spca505.c index cecbc4362..fc392b6d1 100644 --- a/linux/drivers/media/video/gspca/spca505.c +++ b/linux/drivers/media/video/gspca/spca505.c @@ -23,9 +23,6 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) -static const char version[] = "2.1.5"; - MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_DESCRIPTION("GSPCA/SPCA505 USB Camera Driver"); MODULE_LICENSE("GPL"); @@ -662,29 +659,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 +761,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 +938,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) @@ -1009,7 +1004,7 @@ static int __init sd_mod_init(void) { if (usb_register(&sd_driver) < 0) return -1; - PDEBUG(D_PROBE, "v%s registered", version); + PDEBUG(D_PROBE, "registered"); return 0; } static void __exit sd_mod_exit(void) diff --git a/linux/drivers/media/video/gspca/spca506.c b/linux/drivers/media/video/gspca/spca506.c index 2d249b00b..40e8541b2 100644 --- a/linux/drivers/media/video/gspca/spca506.c +++ b/linux/drivers/media/video/gspca/spca506.c @@ -25,9 +25,6 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) -static const char version[] = "2.1.5"; - MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_DESCRIPTION("GSPCA/SPCA506 USB Camera Driver"); MODULE_LICENSE("GPL"); @@ -153,17 +150,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 +187,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 +200,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 +432,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 +549,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); @@ -837,7 +831,7 @@ static int __init sd_mod_init(void) { if (usb_register(&sd_driver) < 0) return -1; - PDEBUG(D_PROBE, "v%s registered", version); + PDEBUG(D_PROBE, "registered"); return 0; } static void __exit sd_mod_exit(void) diff --git a/linux/drivers/media/video/gspca/spca508.c b/linux/drivers/media/video/gspca/spca508.c index a70d51117..a8d611eba 100644 --- a/linux/drivers/media/video/gspca/spca508.c +++ b/linux/drivers/media/video/gspca/spca508.c @@ -22,9 +22,6 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) -static const char version[] = "2.1.5"; - MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_DESCRIPTION("GSPCA/SPCA508 USB Camera Driver"); MODULE_LICENSE("GPL"); @@ -1471,26 +1468,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 +1510,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 +1567,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 +1743,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) @@ -1819,7 +1813,7 @@ static int __init sd_mod_init(void) { if (usb_register(&sd_driver) < 0) return -1; - PDEBUG(D_PROBE, "v%s registered", version); + PDEBUG(D_PROBE, "registered"); return 0; } static void __exit sd_mod_exit(void) diff --git a/linux/drivers/media/video/gspca/spca561.c b/linux/drivers/media/video/gspca/spca561.c index f0770ee59..85c37f396 100644 --- a/linux/drivers/media/video/gspca/spca561.c +++ b/linux/drivers/media/video/gspca/spca561.c @@ -24,9 +24,6 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) -static const char version[] = "2.1.5"; - MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_DESCRIPTION("GSPCA/SPCA561 USB Camera Driver"); MODULE_LICENSE("GPL"); @@ -177,27 +174,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 +209,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 +216,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 +227,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 +539,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 +557,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 +565,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 +657,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 +715,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 +754,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 +873,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 +898,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: @@ -1032,7 +1036,7 @@ static int __init sd_mod_init(void) { if (usb_register(&sd_driver) < 0) return -1; - PDEBUG(D_PROBE, "v%s registered", version); + PDEBUG(D_PROBE, "registered"); return 0; } static void __exit sd_mod_exit(void) diff --git a/linux/drivers/media/video/gspca/stk014.c b/linux/drivers/media/video/gspca/stk014.c index d676cd16a..90efde17b 100644 --- a/linux/drivers/media/video/gspca/stk014.c +++ b/linux/drivers/media/video/gspca/stk014.c @@ -23,9 +23,6 @@ #include "gspca.h" #include "jpeg.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) -static const char version[] = "2.1.5"; - MODULE_AUTHOR("Jean-Francois Moine <http://moinejf.free.fr>"); MODULE_DESCRIPTION("Syntek DV4000 (STK014) USB Camera Driver"); MODULE_LICENSE("GPL"); @@ -127,7 +124,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 +134,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 +163,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 +220,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 +299,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 +310,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 +327,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 +349,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 +383,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 +531,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 +547,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")}, {} }; @@ -580,7 +573,7 @@ static int __init sd_mod_init(void) { if (usb_register(&sd_driver) < 0) return -1; - info("v%s registered", version); + info("registered"); return 0; } static void __exit sd_mod_exit(void) diff --git a/linux/drivers/media/video/gspca/sunplus.c b/linux/drivers/media/video/gspca/sunplus.c index 6e02726ee..2ebf859fb 100644 --- a/linux/drivers/media/video/gspca/sunplus.c +++ b/linux/drivers/media/video/gspca/sunplus.c @@ -24,9 +24,6 @@ #include "gspca.h" #include "jpeg.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) -static const char version[] = "2.1.5"; - MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_DESCRIPTION("GSPCA/SPCA5xx USB Camera Driver"); MODULE_LICENSE("GPL"); @@ -483,7 +480,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 +494,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 +508,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 +519,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 +578,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 +601,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 +621,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 +640,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 +650,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 +660,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 +694,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 +717,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 +762,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 +784,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 +805,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 */ @@ -858,6 +855,13 @@ static int sd_config(struct gspca_dev *gspca_dev, /* break; */ /* } */ break; + case 0x0461: /* MicroInnovation */ +/* switch (product) { */ +/* case 0x0821: */ + sd->bridge = BRIDGE_SPCA533; +/* break; */ +/* } */ + break; case 0x046d: /* Logitech Labtec */ switch (product) { case 0x0905: @@ -903,7 +907,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; @@ -1031,6 +1036,7 @@ static int sd_config(struct gspca_dev *gspca_dev, break; case 0x2040: case 0x2042: + case 0x2050: case 0x2060: sd->bridge = BRIDGE_SPCA536; break; @@ -1079,38 +1085,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 +1136,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 +1162,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 +1202,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 +1233,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 +1243,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 +1253,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 +1276,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 +1294,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 +1419,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 +1430,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 +1438,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 +1458,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 +1469,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 +1476,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 +1495,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 +1506,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 +1513,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; } } @@ -1613,6 +1615,7 @@ static const __devinitdata struct usb_device_id device_table[] = { {USB_DEVICE(0x041e, 0x4012), DVNM("PC-Cam350")}, {USB_DEVICE(0x041e, 0x4013), DVNM("Creative Pccam750")}, {USB_DEVICE(0x0458, 0x7006), DVNM("Genius Dsc 1.3 Smart")}, + {USB_DEVICE(0x0461, 0x0821), DVNM("Fujifilm MV-1")}, {USB_DEVICE(0x046d, 0x0905), DVNM("Logitech ClickSmart 820")}, {USB_DEVICE(0x046d, 0x0960), DVNM("Logitech ClickSmart 420")}, {USB_DEVICE(0x0471, 0x0322), DVNM("Philips DMVC1300K")}, @@ -1662,6 +1665,7 @@ static const __devinitdata struct usb_device_id device_table[] = { {USB_DEVICE(0x08ca, 0x2028), DVNM("Aiptek PocketCam4M")}, {USB_DEVICE(0x08ca, 0x2040), DVNM("Aiptek PocketDV4100M")}, {USB_DEVICE(0x08ca, 0x2042), DVNM("Aiptek PocketDV5100")}, + {USB_DEVICE(0x08ca, 0x2050), DVNM("Medion MD 41437")}, {USB_DEVICE(0x08ca, 0x2060), DVNM("Aiptek PocketDV5300")}, {USB_DEVICE(0x0d64, 0x0303), DVNM("Sunplus FashionCam DXG")}, {} @@ -1688,7 +1692,7 @@ static int __init sd_mod_init(void) { if (usb_register(&sd_driver) < 0) return -1; - PDEBUG(D_PROBE, "v%s registered", version); + PDEBUG(D_PROBE, "registered"); return 0; } static void __exit sd_mod_exit(void) diff --git a/linux/drivers/media/video/gspca/t613.c b/linux/drivers/media/video/gspca/t613.c index 78ee480e2..5188ec486 100644 --- a/linux/drivers/media/video/gspca/t613.c +++ b/linux/drivers/media/video/gspca/t613.c @@ -1,12 +1,4 @@ /* - *Notes: * t613 + tas5130A - * * Focus to light do not balance well as in win. - * Quality in win is not good, but its kinda better. - * * Fix some "extraneous bytes", most of apps will show the image anyway - * * Gamma table, is there, but its really doing something? - * * 7~8 Fps, its ok, max on win its 10. - * Costantino Leandro - * * V4L2 by Jean-Francois Moine <http://moinejf.free.fr> * * This program is free software; you can redistribute it and/or modify @@ -22,16 +14,22 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + *Notes: * t613 + tas5130A + * * Focus to light do not balance well as in win. + * Quality in win is not good, but its kinda better. + * * Fix some "extraneous bytes", most of apps will show the image anyway + * * Gamma table, is there, but its really doing something? + * * 7~8 Fps, its ok, max on win its 10. + * Costantino Leandro */ #define MODULE_NAME "t613" + #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) -static const char version[] = "2.1.5"; #define MAX_GAMMA 0x10 /* 0 to 15 */ -/* From LUVCVIEW */ #define V4L2_CID_EFFECTS (V4L2_CID_PRIVATE_BASE + 3) MODULE_AUTHOR("Leandro Costantino <le_costantino@pixartargentina.com.ar>"); @@ -365,48 +363,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 +455,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 +530,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 +580,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 +591,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 +604,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 +619,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 +634,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 +659,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 +679,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 +858,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 +877,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 +904,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); @@ -1073,7 +1059,7 @@ static int __init sd_mod_init(void) { if (usb_register(&sd_driver) < 0) return -1; - PDEBUG(D_PROBE, "v%s registered", version); + PDEBUG(D_PROBE, "registered"); return 0; } static void __exit sd_mod_exit(void) diff --git a/linux/drivers/media/video/gspca/tv8532.c b/linux/drivers/media/video/gspca/tv8532.c index b9837841c..7de866036 100644 --- a/linux/drivers/media/video/gspca/tv8532.c +++ b/linux/drivers/media/video/gspca/tv8532.c @@ -22,9 +22,6 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) -static const char version[] = "2.1.5"; - MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_DESCRIPTION("TV8532 USB Camera Driver"); MODULE_LICENSE("GPL"); @@ -168,63 +165,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]; +} + +/* write 1 byte */ +static void reg_w_1(struct gspca_dev *gspca_dev, + __u16 index, __u8 value) +{ + 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, gspca_dev->usb_buf, 1, 500); } -static void reg_w(struct usb_device *dev, - __u16 index, __u8 *buffer, __u16 length) +/* write 2 bytes */ +static void reg_w_2(struct gspca_dev *gspca_dev, + __u16 index, __u8 val1, __u8 val2) { - usb_control_msg(dev, - usb_sndctrlpipe(dev, 0), + 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, buffer, length, 500); + 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 +258,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 +383,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 +569,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 } @@ -713,7 +662,7 @@ static int __init sd_mod_init(void) { if (usb_register(&sd_driver) < 0) return -1; - PDEBUG(D_PROBE, "v%s registered", version); + PDEBUG(D_PROBE, "registered"); return 0; } diff --git a/linux/drivers/media/video/gspca/vc032x.c b/linux/drivers/media/video/gspca/vc032x.c index 1129cbeb8..c811379c7 100644 --- a/linux/drivers/media/video/gspca/vc032x.c +++ b/linux/drivers/media/video/gspca/vc032x.c @@ -24,9 +24,6 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) -static const char version[] = "2.1.5"; - MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); MODULE_DESCRIPTION("GSPCA/VC032X USB Camera Driver"); MODULE_LICENSE("GPL"); @@ -58,7 +55,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 +63,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 +87,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, @@ -933,14 +931,14 @@ static const __u8 ov7660_initQVGA_data[][4] = { {0xb8, 0x8f, 0xff, 0xcc}, /* ff */ {0x00, 0x29, 0x3c, 0xaa}, {0xb3, 0x01, 0x45, 0xcc}, /* 45 */ - {0x00, 0x00, 0x00, 0x00} + {} }; static const __u8 ov7660_50HZ[][4] = { {0x00, 0x3b, 0x08, 0xaa}, {0x00, 0x9d, 0x40, 0xaa}, {0x00, 0x13, 0xa7, 0xaa}, - {0x00, 0x00, 0x00, 0x00} + {} }; static const __u8 ov7660_60HZ[][4] = { @@ -1406,17 +1404,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 +1432,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 +1493,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 +1503,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 +1531,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 +1560,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 +1595,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 +1622,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 +1661,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 +1719,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 +1820,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); */ @@ -2016,7 +1999,7 @@ static int __init sd_mod_init(void) { if (usb_register(&sd_driver) < 0) return -1; - PDEBUG(D_PROBE, "v%s registered", version); + PDEBUG(D_PROBE, "registered"); return 0; } static void __exit sd_mod_exit(void) 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..f7f8c61b3 100644 --- a/linux/drivers/media/video/gspca/zc3xx.c +++ b/linux/drivers/media/video/gspca/zc3xx.c @@ -24,9 +24,6 @@ #include "gspca.h" -#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) -static const char version[] = "2.1.5"; - MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>, " "Serge A. Suchkov <Serge.A.S@tochka.ru>"); MODULE_DESCRIPTION("GSPCA ZC03xx/VC3xx USB Camera Driver"); @@ -35,6 +32,7 @@ MODULE_LICENSE("GPL"); static int force_sensor = -1; #include "jpeg.h" +#include "zc3xx-reg.h" /* specific webcam descriptor */ struct sd { @@ -48,7 +46,7 @@ struct sd { __u8 sharpness; char qindex; - char sensor; /* Type of image sensor chip */ + signed char sensor; /* Type of image sensor chip */ /* !! values used in different tables */ #define SENSOR_CS2102 0 #define SENSOR_CS2102K 1 @@ -209,30 +207,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 +243,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 +373,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 +473,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 +498,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 +523,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 +548,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 +573,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 +598,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 +1479,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 +1497,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 +1543,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 +1561,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 +1686,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 +1758,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 +1831,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 +1902,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 +1975,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 +2105,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 */ - {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_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, 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 */ - {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_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, 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 */ - {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_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, 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 +2293,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 +2343,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 +2401,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 +2449,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 +2508,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 +2606,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 +2782,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 +2823,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 +2906,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 +2962,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 +3005,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 +3043,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 +3074,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 +3107,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 +3138,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 +3171,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 +3202,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 +3283,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 +3315,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 +3344,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 +3403,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 +3435,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 +3561,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 +3618,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 +3691,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 +3715,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 +3754,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 +3775,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 +3832,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 +3988,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 +4092,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 +4104,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}, /* Sream and Sensor specific */ - {0xa0, 0x0f, 0x0010}, /* CMOSSensorSelect */ + {0xa0, 0x0f, ZC3XX_R010_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}, + {0xa0, 0xb0, ZC3XX_R004_FRAMEWIDTHLOW}, + {0xa0, 0x00, ZC3XX_R005_FRAMEHEIGHTHIGH}, + {0xa0, 0x90, ZC3XX_R006_FRAMEHEIGHTLOW}, /* System */ - {0xa0, 0x01, 0x0001}, /* SystemOperating */ + {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, /* Sream and Sensor specific */ - {0xa0, 0x03, 0x0012}, /* VideoControlFunction */ - {0xa0, 0x01, 0x0012}, /* VideoControlFunction */ + {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, /* Sensor Interface */ - {0xa0, 0x08, 0x008d}, /* Compatibily Mode */ + {0xa0, 0x08, ZC3XX_R08D_COMPABILITYMODE}, /* 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}, + {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, + {0xa0, 0x03, ZC3XX_R11C_FIRSTXLOW}, + {0xa0, 0x28, ZC3XX_R09C_WINHEIGHTLOW}, + {0xa0, 0x68, ZC3XX_R09E_WINWIDTHLOW}, /* Init the sensor */ {0xaa, 0x02, 0x0004}, {0xaa, 0x08, 0x0000}, @@ -4126,112 +4137,112 @@ static const struct usb_action pas106b_Initial[] = { /* 176x144 */ {0xaa, 0x14, 0x0081}, /* Other registors */ - {0xa0, 0x37, 0x0101}, /* SensorCorrection */ + {0xa0, 0x37, ZC3XX_R101_SENSORCORRECTION}, /* Frame retreiving */ - {0xa0, 0x00, 0x0019}, /* AutoAdjustFPS */ + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* Gains */ - {0xa0, 0xa0, 0x01a8}, /* DigitalGain */ + {0xa0, 0xa0, ZC3XX_R1A8_DIGITALGAIN}, /* Unknown */ {0xa0, 0x00, 0x01ad}, /* Sharpness */ - {0xa0, 0x03, 0x01c5}, /* SharpnessMode */ - {0xa0, 0x13, 0x01cb}, /* Sharpness05 */ + {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, + {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, /* Other registors */ - {0xa0, 0x0d, 0x0100}, /* OperationMode */ + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, /* Auto exposure and white balance */ - {0xa0, 0x06, 0x0189}, /* AWBStatus */ + {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, /*Dead pixels */ - {0xa0, 0x08, 0x0250}, /* DeadPixelsMode */ + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, /* EEPROM */ - {0xa0, 0x08, 0x0301}, /* EEPROMAccess */ + {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, /* JPEG control */ - {0xa0, 0x03, 0x0008}, /* ClockSetting */ - {0xa0, 0x08, 0x01c6}, /* sharpness+ */ - {0xa0, 0x0f, 0x01cb}, /* sharpness- */ + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, + {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, + {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* Other registers */ - {0xa0, 0x0d, 0x0100}, /* OperationMode */ + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, /* Auto exposure and white balance */ - {0xa0, 0x06, 0x0189}, /* AWBStatus */ + {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, /*Dead pixels */ - {0xa0, 0x08, 0x0250}, /* DeadPixelsMode */ + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, /* EEPROM */ - {0xa0, 0x08, 0x0301}, /* EEPROMAccess */ + {0xa0, 0x08, ZC3XX_R301_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}, + {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, + {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, + + {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}, + {0xa0, 0x08, ZC3XX_R182_WINXWIDTH}, + {0xa0, 0x16, ZC3XX_R183_WINXCENTER}, + {0xa0, 0x03, ZC3XX_R184_WINYSTART}, + {0xa0, 0x05, ZC3XX_R185_WINYWIDTH}, + {0xa0, 0x14, ZC3XX_R186_WINYCENTER}, + {0xa0, 0x00, ZC3XX_R180_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}, + {0xa0, 0x03, ZC3XX_R191_EXPOSURELIMITMID}, + {0xa0, 0xb1, ZC3XX_R192_EXPOSURELIMITLOW}, + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, + {0xa0, 0x87, ZC3XX_R197_ANTIFLICKERLOW}, + {0xa0, 0x0c, ZC3XX_R18C_AEFREEZE}, + {0xa0, 0x18, ZC3XX_R18F_AEUNFREEZE}, /* 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}, + {0xa0, 0x26, ZC3XX_R1AA_DIGITALGAINSTEP}, + {0xa0, 0xa0, ZC3XX_R11D_GLOBALGAIN}, + {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN}, /* Auto correction */ - {0xa0, 0x40, 0x0180}, /* AutoCorrectEnable */ - {0xa1, 0x01, 0x0180}, /* AutoCorrectEnable */ - {0xa0, 0x42, 0x0180}, /* AutoCorrectEnable */ + {0xa0, 0x40, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa1, 0x01, 0x0180}, /* AutoCorrectEnable */ + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, /* Gains */ - {0xa0, 0x40, 0x0116}, /* RGain */ - {0xa0, 0x40, 0x0117}, /* GGain */ - {0xa0, 0x40, 0x0118}, /* BGain */ + {0xa0, 0x40, ZC3XX_R116_RGAIN}, + {0xa0, 0x40, ZC3XX_R117_GGAIN}, + {0xa0, 0x40, ZC3XX_R118_BGAIN}, {} }; static const struct usb_action pas106b_InitialScale[] = { /* 352x288 */ /* JPEG control */ - {0xa0, 0x03, 0x0008}, /* ClockSetting */ + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, /* Sream and Sensor specific */ - {0xa0, 0x0f, 0x0010}, /* CMOSSensorSelect */ + {0xa0, 0x0f, ZC3XX_R010_CMOSSENSORSELECT}, /* Picture size */ - {0xa0, 0x01, 0x0003}, /* FrameWidthHigh */ - {0xa0, 0x60, 0x0004}, /* FrameWidthLow */ - {0xa0, 0x01, 0x0005}, /* FrameHeightHigh */ - {0xa0, 0x20, 0x0006}, /* FrameHightLow */ + {0xa0, 0x01, ZC3XX_R003_FRAMEWIDTHHIGH}, + {0xa0, 0x60, ZC3XX_R004_FRAMEWIDTHLOW}, + {0xa0, 0x01, ZC3XX_R005_FRAMEHEIGHTHIGH}, + {0xa0, 0x20, ZC3XX_R006_FRAMEHEIGHTLOW}, /* System */ - {0xa0, 0x01, 0x0001}, /* SystemOperating */ + {0xa0, 0x01, ZC3XX_R001_SYSTEMOPERATING}, /* Sream and Sensor specific */ - {0xa0, 0x03, 0x0012}, /* VideoControlFunction */ - {0xa0, 0x01, 0x0012}, /* VideoControlFunction */ + {0xa0, 0x03, ZC3XX_R012_VIDEOCONTROLFUNC}, + {0xa0, 0x01, ZC3XX_R012_VIDEOCONTROLFUNC}, /* Sensor Interface */ - {0xa0, 0x08, 0x008d}, /* Compatibily Mode */ + {0xa0, 0x08, ZC3XX_R08D_COMPABILITYMODE}, /* 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}, + {0xa0, 0x00, ZC3XX_R11A_FIRSTYLOW}, + {0xa0, 0x03, ZC3XX_R11C_FIRSTXLOW}, + {0xa0, 0x28, ZC3XX_R09C_WINHEIGHTLOW}, + {0xa0, 0x68, ZC3XX_R09E_WINWIDTHLOW}, /* Init the sensor */ {0xaa, 0x02, 0x0004}, {0xaa, 0x08, 0x0000}, @@ -4244,161 +4255,161 @@ static const struct usb_action pas106b_InitialScale[] = { /* 352x288 */ {0xaa, 0x14, 0x0081}, /* Other registors */ - {0xa0, 0x37, 0x0101}, /* SensorCorrection */ + {0xa0, 0x37, ZC3XX_R101_SENSORCORRECTION}, /* Frame retreiving */ - {0xa0, 0x00, 0x0019}, /* AutoAdjustFPS */ + {0xa0, 0x00, ZC3XX_R019_AUTOADJUSTFPS}, /* Gains */ - {0xa0, 0xa0, 0x01a8}, /* DigitalGain */ + {0xa0, 0xa0, ZC3XX_R1A8_DIGITALGAIN}, /* Unknown */ {0xa0, 0x00, 0x01ad}, /* Sharpness */ - {0xa0, 0x03, 0x01c5}, /* SharpnessMode */ - {0xa0, 0x13, 0x01cb}, /* Sharpness05 */ + {0xa0, 0x03, ZC3XX_R1C5_SHARPNESSMODE}, + {0xa0, 0x13, ZC3XX_R1CB_SHARPNESS05}, /* Other registors */ - {0xa0, 0x0d, 0x0100}, /* OperationMode */ + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, /* Auto exposure and white balance */ - {0xa0, 0x06, 0x0189}, /* AWBStatus */ - {0xa0, 0x80, 0x018d}, /* ????????? */ + {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, + {0xa0, 0x80, ZC3XX_R18D_YTARGET}, /*Dead pixels */ - {0xa0, 0x08, 0x0250}, /* DeadPixelsMode */ + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, /* EEPROM */ - {0xa0, 0x08, 0x0301}, /* EEPROMAccess */ + {0xa0, 0x08, ZC3XX_R301_EEPROMACCESS}, /* JPEG control */ - {0xa0, 0x03, 0x0008}, /* ClockSetting */ - {0xa0, 0x08, 0x01c6}, /* sharpness+ */ - {0xa0, 0x0f, 0x01cb}, /* sharpness- */ + {0xa0, 0x03, ZC3XX_R008_CLOCKSETTING}, + {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, + {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, /* Other registers */ - {0xa0, 0x0d, 0x0100}, /* OperationMode */ + {0xa0, 0x0d, ZC3XX_R100_OPERATIONMODE}, /* Auto exposure and white balance */ - {0xa0, 0x06, 0x0189}, /* AWBStatus */ + {0xa0, 0x06, ZC3XX_R189_AWBSTATUS}, /*Dead pixels */ - {0xa0, 0x08, 0x0250}, /* DeadPixelsMode */ + {0xa0, 0x08, ZC3XX_R250_DEADPIXELSMODE}, /* EEPROM */ - {0xa0, 0x08, 0x0301}, /* EEPROMAccess */ + {0xa0, 0x08, ZC3XX_R301_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}, + {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, + {0xa0, 0x0f, ZC3XX_R1CB_SHARPNESS05}, + + {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}, + {0xa0, 0x08, ZC3XX_R182_WINXWIDTH}, + {0xa0, 0x16, ZC3XX_R183_WINXCENTER}, + {0xa0, 0x03, ZC3XX_R184_WINYSTART}, + {0xa0, 0x05, ZC3XX_R185_WINYWIDTH}, + {0xa0, 0x14, ZC3XX_R186_WINYCENTER}, + {0xa0, 0x00, ZC3XX_R180_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}, + {0xa0, 0x03, ZC3XX_R191_EXPOSURELIMITMID}, + {0xa0, 0xb1, ZC3XX_R192_EXPOSURELIMITLOW}, - {0xa0, 0x00, 0x0195}, /* AntiFlickerHigh 0x00 */ - {0xa0, 0x00, 0x0196}, /* AntiFlickerLow 0x00 */ - {0xa0, 0x87, 0x0197}, /* AntiFlickerLow 0x87 */ + {0xa0, 0x00, ZC3XX_R195_ANTIFLICKERHIGH}, + {0xa0, 0x00, ZC3XX_R196_ANTIFLICKERMID}, + {0xa0, 0x87, ZC3XX_R197_ANTIFLICKERLOW}, - {0xa0, 0x10, 0x018c}, /* AEBFreeze 0x10 0x0c */ - {0xa0, 0x20, 0x018f}, /* AEBUnfreeze 0x30 0x18 */ + {0xa0, 0x10, ZC3XX_R18C_AEFREEZE}, + {0xa0, 0x20, ZC3XX_R18F_AEUNFREEZE}, /* 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}, + {0xa0, 0x26, ZC3XX_R1AA_DIGITALGAINSTEP}, + {0xa0, 0xa0, ZC3XX_R11D_GLOBALGAIN}, + {0xa0, 0x60, ZC3XX_R11D_GLOBALGAIN}, /* Auto correction */ - {0xa0, 0x40, 0x0180}, /* AutoCorrectEnable */ - {0xa1, 0x01, 0x0180}, /* AutoCorrectEnable */ - {0xa0, 0x42, 0x0180}, /* AutoCorrectEnable */ + {0xa0, 0x40, ZC3XX_R180_AUTOCORRECTENABLE}, + {0xa1, 0x01, 0x0180}, /* AutoCorrectEnable */ + {0xa0, 0x42, ZC3XX_R180_AUTOCORRECTENABLE}, /* Gains */ - {0xa0, 0x40, 0x0116}, /* RGain */ - {0xa0, 0x40, 0x0117}, /* GGain */ - {0xa0, 0x40, 0x0118}, /* BGain */ + {0xa0, 0x40, ZC3XX_R116_RGAIN}, + {0xa0, 0x40, ZC3XX_R117_GGAIN}, + {0xa0, 0x40, ZC3XX_R118_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 +4429,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 +4450,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}, + {0xa0, 0x08, ZC3XX_R1C6_SHARPNESS00}, {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 +4575,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 +4598,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 +4721,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 +4804,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 +4836,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 +4915,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 +5079,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 +5156,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 +5175,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 +5197,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,768 +5228,771 @@ 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, */ {0xaa, 0x13, 0x0002}, /* 00,13,02,aa, */ {0xaa, 0x15, 0x0004}, /* 00,15,04,aa */ - {0xaa, 0x01, 0x0000}, +/*?? {0xaa, 0x01, 0x0000}, */ {0xaa, 0x01, 0x0000}, {0xaa, 0x1a, 0x0000}, /* 00,1a,00,aa, */ {0xaa, 0x1c, 0x0017}, /* 00,1c,17,aa, */ - {0xa0, 0x82, 0x0086}, /* 00,86,82,cc, */ - {0xa0, 0x83, 0x0087}, /* 00,87,83,cc, */ - {0xa0, 0x84, 0x0088}, /* 00,88,84,cc, */ + {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, */ @@ -5987,49 +6002,51 @@ static const struct usb_action tas5130c_vf0250_Initial[] = { {0xaa, 0x0f, 0x00a0}, /* 00,0f,a0,aa, */ {0xaa, 0x10, 0x0000}, /* 00,10,00,aa, */ {0xaa, 0x11, 0x00a0}, /* 00,11,a0,aa, */ - {0xa0, 0x00, 0x0039}, - {0xa1, 0x01, 0x0037}, +/*?? {0xa0, 0x00, 0x0039}, + {0xa1, 0x01, 0x0037}, */ {0xaa, 0x16, 0x0001}, /* 00,16,01,aa, */ {0xaa, 0x17, 0x00e8}, /* 00,17,e6,aa, (e6 -> e8) */ {0xaa, 0x18, 0x0002}, /* 00,18,02,aa, */ {0xaa, 0x19, 0x0088}, /* 00,19,86,aa, */ {0xaa, 0x20, 0x0020}, /* 00,20,20,aa, */ - {0xa0, 0xb7, 0x0101}, /* 01,01,b7,cc, */ - {0xa0, 0x05, 0x0012}, /* 00,12,05,cc, */ - {0xa0, 0x0d, 0x0100}, /* 01,00,0d,cc, */ - {0xa0, 0x76, 0x0189}, /* 01,89,76,cc, */ - {0xa0, 0x09, 0x01ad}, /* 01,ad,09,cc, */ - {0xa0, 0x03, 0x01c5}, /* 01,c5,03,cc, */ - {0xa0, 0x13, 0x01cb}, /* 01,cb,13,cc, */ - {0xa0, 0x08, 0x0250}, /* 02,50,08,cc, */ - {0xa0, 0x08, 0x0301}, /* 03,01,08,cc, */ - {0xa0, 0x60, 0x01a8}, /* 01,a8,60,cc, */ - {0xa0, 0x61, 0x0116}, /* 01,16,61,cc, */ - {0xa0, 0x65, 0x0118}, /* 01,18,65,cc */ + {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 +6056,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 +6075,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 +6094,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 +6119,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 +6144,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 +6169,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, @@ -6253,59 +6274,58 @@ static void reg_w(struct usb_device *dev, __u8 value, __u16 index) { - PDEBUG(D_USBO, "reg w %02x -> [%04x]", value, index); + PDEBUG(D_USBO, "reg w [%04x] = %02x", index, value); 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]; + __u16 retval; - 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 */ - PDEBUG(D_USBO, "i2c r [%02x] -> (%02x) %02x%02x", - reg, retbyte, retval[1], retval[0]); - return (retval[1] << 8) | retval[0]; + retbyte = reg_r_i(gspca_dev, 0x0091); /* read status */ + retval = reg_r_i(gspca_dev, 0x0095); /* read Lowbyte */ + retval |= reg_r_i(gspca_dev, 0x0096) << 8; /* read Hightbyte */ + PDEBUG(D_USBO, "i2c r [%02x] -> %04x (%02x)", + reg, retval, retbyte); + return retval; } -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 */ - PDEBUG(D_USBO, "i2c w [%02x] %02x%02x (%02x)", + 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 */ @@ -6331,6 +6351,8 @@ static void setmatrix(struct gspca_dev *gspca_dev) {0x58, 0xf4, 0xf4, 0xf4, 0x58, 0xf4, 0xf4, 0xf4, 0x58}; static const __u8 po2030_matrix[9] = {0x60, 0xf0, 0xf0, 0xf0, 0x60, 0xf0, 0xf0, 0xf0, 0x60}; + static const __u8 vf0250_matrix[9] = + {0x7b, 0xea, 0xea, 0xea, 0x7b, 0xea, 0xea, 0xea, 0x7b}; switch (sd->sensor) { case SENSOR_GC0305: @@ -6345,8 +6367,9 @@ static void setmatrix(struct gspca_dev *gspca_dev) case SENSOR_PO2030: matrix = po2030_matrix; break; - case SENSOR_TAS5130C_VF0250: /* no matrix? */ - return; + case SENSOR_TAS5130C_VF0250: + matrix = vf0250_matrix; + break; default: /* matrix already loaded */ return; } @@ -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); + reg_w(dev, 0x08, 0x008d); + 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); + reg_w(dev, 0x08, 0x008d); + 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) { @@ -6812,7 +6835,6 @@ static const struct sensor_by_chipset_revision chipset_revision_sensor[] = { {0x8001, 0x13}, {0x8000, 0x14}, /* CS2102K */ {0x8400, 0x15}, /* TAS5130K */ - {0, 0} }; static int vga_3wr_probe(struct gspca_dev *gspca_dev) @@ -6825,7 +6847,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, 0x0010); reg_w(dev, 0x01, 0x0000); reg_w(dev, 0x00, 0x0010); reg_w(dev, 0x01, 0x0001); @@ -6833,41 +6855,39 @@ 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) { + for (i = 0; i < ARRAY_SIZE(chipset_revision_sensor); i++) { if (chipset_revision_sensor[i].revision == checkword) { sd->chip_revision = checkword; send_unknown(dev, SENSOR_PB0330); return chipset_revision_sensor[i].internal_sensor_id; } - i++; } - reg_w(dev, 0x01, 0x0000); + reg_w(dev, 0x01, 0x0000); /* check ?? */ reg_w(dev, 0x01, 0x0001); reg_w(dev, 0xdd, 0x008b); reg_w(dev, 0x0a, 0x0010); reg_w(dev, 0x03, 0x0012); reg_w(dev, 0x01, 0x0012); - retbyte = i2c_read(dev, 0x00); + retbyte = i2c_read(gspca_dev, 0x00); if (retbyte != 0) { PDEBUG(D_PROBE, "probe 3wr vga type 0a ?"); return 0x0a; /* ?? */ @@ -6880,11 +6900,14 @@ 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); - return retbyte; /* 0x29 = gc0305 - should continue? */ + if (retbyte == 0x11) /* VF0250 */ + return 0x0250; + if (retbyte == 0x29) /* gc0305 */ + send_unknown(dev, SENSOR_GC0305); + return retbyte; } reg_w(dev, 0x01, 0x0000); /* check OmniVision */ @@ -6894,42 +6917,42 @@ 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 ? */ } - reg_w(dev, 0x01, 0x00); - reg_w(dev, 0x00, 0x02); - reg_w(dev, 0x01, 0x10); - reg_w(dev, 0x01, 0x01); - reg_w(dev, 0xee, 0x8b); - reg_w(dev, 0x03, 0x12); + reg_w(dev, 0x01, 0x0000); + reg_w(dev, 0x00, 0x0002); + reg_w(dev, 0x01, 0x0010); + reg_w(dev, 0x01, 0x0001); + reg_w(dev, 0xee, 0x008b); + reg_w(dev, 0x03, 0x0012); /* msleep(150); */ - reg_w(dev, 0x01, 0x12); - reg_w(dev, 0x05, 0x12); - retbyte = i2c_read(dev, 0x00); /* ID 0 */ + reg_w(dev, 0x01, 0x0012); + reg_w(dev, 0x05, 0x0012); + retbyte = i2c_read(gspca_dev, 0x0000); /* ID 0 */ checkword = retbyte << 8; - retbyte = i2c_read(dev, 0x01); /* ID 1 */ + retbyte = i2c_read(gspca_dev, 0x0001); /* 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; } - reg_w(dev, 0x01, 0x00); - reg_w(dev, 0x0a, 0x10); - reg_w(dev, 0xd3, 0x8b); - reg_w(dev, 0x01, 0x01); - reg_w(dev, 0x03, 0x12); - reg_w(dev, 0x01, 0x12); - reg_w(dev, 0x05, 0x01); - reg_w(dev, 0xd3, 0x8b); - retbyte = i2c_read(dev, 0x01); + reg_w(dev, 0x01, 0x0000); + reg_w(dev, 0x0a, 0x0010); + reg_w(dev, 0xd3, 0x008b); + reg_w(dev, 0x01, 0x0001); + reg_w(dev, 0x03, 0x0012); + reg_w(dev, 0x01, 0x0012); + reg_w(dev, 0x05, 0x0001); + reg_w(dev, 0xd3, 0x008b); + retbyte = i2c_read(gspca_dev, 0x01); if (retbyte != 0) { PDEBUG(D_PROBE, "probe 3wr vga type 0a ?"); return 0x0a; /* ?? */ @@ -6940,15 +6963,16 @@ 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) { case SENSOR_MC501CB: + return -1; /* don't probe */ case SENSOR_TAS5130C_VF0250: + /* may probe but with write in reg 0x0010 */ 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 +6984,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 +6994,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 */ @@ -6994,6 +7017,7 @@ static int sd_config(struct gspca_dev *gspca_dev, /* define some sensors from the vendor/product */ sd->sharpness = 2; + sd->sensor = -1; switch (id->idVendor) { case 0x041e: /* Creative */ switch (id->idProduct) { @@ -7103,6 +7127,10 @@ static int sd_config(struct gspca_dev *gspca_dev, PDEBUG(D_PROBE, "Find Sensor GC0305"); sd->sensor = SENSOR_GC0305; break; + case 0x0250: + PDEBUG(D_PROBE, "Sensor Tas5130 (VF0250)"); + sd->sensor = SENSOR_TAS5130C_VF0250; + break; case 0x2030: PDEBUG(D_PROBE, "Find Sensor PO2030"); sd->sensor = SENSOR_PO2030; @@ -7126,7 +7154,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 +7195,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 +7225,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 +7241,15 @@ 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: + case SENSOR_TAS5130C_VF0250: 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 +7262,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 +7291,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 +7309,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 +7321,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 +7360,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 @@ -7597,7 +7625,7 @@ static int __init sd_mod_init(void) { if (usb_register(&sd_driver) < 0) return -1; - PDEBUG(D_PROBE, "v%s registered", version); + PDEBUG(D_PROBE, "registered"); return 0; } diff --git a/linux/drivers/media/video/ir-kbd-i2c.c b/linux/drivers/media/video/ir-kbd-i2c.c index fc668f5b5..73fcfddce 100644 --- a/linux/drivers/media/video/ir-kbd-i2c.c +++ b/linux/drivers/media/video/ir-kbd-i2c.c @@ -195,88 +195,6 @@ static int get_key_knc1(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) return 1; } -/* Common (grey or coloured) pinnacle PCTV remote handling - * - */ -static int get_key_pinnacle(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw, - int parity_offset, int marker, int code_modulo) -{ - unsigned char b[4]; - unsigned int start = 0,parity = 0,code = 0; - - /* poll IR chip */ - if (4 != i2c_master_recv(&ir->c,b,4)) { - dprintk(2,"read error\n"); - return -EIO; - } - - for (start = 0; start < ARRAY_SIZE(b); start++) { - if (b[start] == marker) { - code=b[(start+parity_offset+1)%4]; - parity=b[(start+parity_offset)%4]; - } - } - - /* Empty Request */ - if (parity==0) - return 0; - - /* Repeating... */ - if (ir->old == parity) - return 0; - - ir->old = parity; - - /* drop special codes when a key is held down a long time for the grey controller - In this case, the second bit of the code is asserted */ - if (marker == 0xfe && (code & 0x40)) - return 0; - - code %= code_modulo; - - *ir_raw = code; - *ir_key = code; - - dprintk(1,"Pinnacle PCTV key %02x\n", code); - - return 1; -} - -/* The grey pinnacle PCTV remote - * - * There are one issue with this remote: - * - I2c packet does not change when the same key is pressed quickly. The workaround - * is to hold down each key for about half a second, so that another code is generated - * in the i2c packet, and the function can distinguish key presses. - * - * Sylvain Pasche <sylvain.pasche@gmail.com> - */ -int get_key_pinnacle_grey(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) -{ - - return get_key_pinnacle(ir, ir_key, ir_raw, 1, 0xfe, 0xff); -} - -EXPORT_SYMBOL_GPL(get_key_pinnacle_grey); - - -/* The new pinnacle PCTV remote (with the colored buttons) - * - * Ricardo Cerqueira <v4l@cerqueira.org> - */ -int get_key_pinnacle_color(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) -{ - /* code_modulo parameter (0x88) is used to reduce code value to fit inside IR_KEYTAB_SIZE - * - * this is the only value that results in 42 unique - * codes < 128 - */ - - return get_key_pinnacle(ir, ir_key, ir_raw, 2, 0x80, 0x88); -} - -EXPORT_SYMBOL_GPL(get_key_pinnacle_color); - /* ----------------------------------------------------------------------- */ static void ir_key_poll(struct IR_i2c *ir) diff --git a/linux/drivers/media/video/ivtv/ivtv-driver.h b/linux/drivers/media/video/ivtv/ivtv-driver.h index 7bae21e5b..d66ee14b6 100644 --- a/linux/drivers/media/video/ivtv/ivtv-driver.h +++ b/linux/drivers/media/video/ivtv/ivtv-driver.h @@ -61,6 +61,7 @@ #include <linux/dvb/video.h> #include <linux/dvb/audio.h> #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <media/tuner.h> #include <media/cx2341x.h> diff --git a/linux/drivers/media/video/ivtv/ivtv-i2c.c b/linux/drivers/media/video/ivtv/ivtv-i2c.c index 3446ab458..1488bc7ce 100644 --- a/linux/drivers/media/video/ivtv/ivtv-i2c.c +++ b/linux/drivers/media/video/ivtv/ivtv-i2c.c @@ -135,7 +135,7 @@ static const u8 hw_addrs[] = { static const char * const hw_devicenames[] = { "cx25840", "saa7115", - "saa7127", + "saa7127_auto", /* saa7127 or saa7129 */ "msp3400", "tuner", "wm8775", diff --git a/linux/drivers/media/video/ivtv/ivtv-streams.c b/linux/drivers/media/video/ivtv/ivtv-streams.c index f8883b487..b883c4e08 100644 --- a/linux/drivers/media/video/ivtv/ivtv-streams.c +++ b/linux/drivers/media/video/ivtv/ivtv-streams.c @@ -217,7 +217,7 @@ static int ivtv_prep_dev(struct ivtv *itv, int type) itv->num, s->name); s->v4l2dev->minor = minor; - s->v4l2dev->dev = &itv->dev->dev; + s->v4l2dev->parent = &itv->dev->dev; s->v4l2dev->fops = ivtv_stream_info[type].fops; s->v4l2dev->release = video_device_release; s->v4l2dev->tvnorms = V4L2_STD_ALL; diff --git a/linux/drivers/media/video/ivtv/ivtvfb.c b/linux/drivers/media/video/ivtv/ivtvfb.c index bdfda48e5..bdedff281 100644 --- a/linux/drivers/media/video/ivtv/ivtvfb.c +++ b/linux/drivers/media/video/ivtv/ivtvfb.c @@ -367,6 +367,7 @@ static int ivtvfb_prep_frame(struct ivtv *itv, int cmd, void __user *source, return ivtvfb_prep_dec_dma_to_device(itv, dest_offset, source, count); } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22) static ssize_t ivtvfb_write(struct fb_info *info, const char __user *buf, size_t count, loff_t *ppos) { @@ -448,6 +449,7 @@ static ssize_t ivtvfb_write(struct fb_info *info, const char __user *buf, return (err) ? err : count; } +#endif static int ivtvfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) { @@ -909,7 +911,9 @@ static int ivtvfb_blank(int blank_mode, struct fb_info *info) static struct fb_ops ivtvfb_ops = { .owner = THIS_MODULE, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22) .fb_write = ivtvfb_write, +#endif .fb_check_var = ivtvfb_check_var, .fb_set_par = ivtvfb_set_par, .fb_setcolreg = ivtvfb_setcolreg, diff --git a/linux/drivers/media/video/meye.c b/linux/drivers/media/video/meye.c index 07295afff..4ae76d0b0 100644 --- a/linux/drivers/media/video/meye.c +++ b/linux/drivers/media/video/meye.c @@ -32,6 +32,7 @@ #include "compat.h" #include <linux/videodev.h> #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <asm/uaccess.h> #include <asm/io.h> #include <linux/delay.h> @@ -1806,7 +1807,7 @@ static int __devinit meye_probe(struct pci_dev *pcidev, } memcpy(meye.video_dev, &meye_template, sizeof(meye_template)); - meye.video_dev->dev = &meye.mchip_dev->dev; + meye.video_dev->parent = &meye.mchip_dev->dev; if ((ret = sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERA, 1))) { printk(KERN_ERR "meye: unable to power on the camera\n"); diff --git a/linux/drivers/media/video/msp3400-driver.c b/linux/drivers/media/video/msp3400-driver.c index cd92f1f68..d67af9753 100644 --- a/linux/drivers/media/video/msp3400-driver.c +++ b/linux/drivers/media/video/msp3400-driver.c @@ -54,6 +54,7 @@ #include <linux/videodev.h> #include <linux/videodev2.h> #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <media/v4l2-i2c-drv-legacy.h> #include <media/tvaudio.h> #include <media/msp3400.h> diff --git a/linux/drivers/media/video/mt9m001.c b/linux/drivers/media/video/mt9m001.c index 089ce311f..f4742936c 100644 --- a/linux/drivers/media/video/mt9m001.c +++ b/linux/drivers/media/video/mt9m001.c @@ -120,7 +120,7 @@ static int mt9m001_init(struct soc_camera_device *icd) int ret; /* Disable chip, synchronous option update */ - dev_dbg(icd->vdev->dev, "%s\n", __func__); + dev_dbg(icd->vdev->parent, "%s\n", __func__); ret = reg_write(icd, MT9M001_RESET, 1); if (ret >= 0) @@ -617,8 +617,12 @@ static void mt9m001_video_remove(struct soc_camera_device *icd) soc_camera_video_stop(&mt9m001->icd); } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) static int mt9m001_probe(struct i2c_client *client, const struct i2c_device_id *did) +#else +static int mt9m001_probe(struct i2c_client *client) +#endif { struct mt9m001 *mt9m001; struct soc_camera_device *icd; diff --git a/linux/drivers/media/video/ov511.c b/linux/drivers/media/video/ov511.c index 9676c1d6f..ebfe94076 100644 --- a/linux/drivers/media/video/ov511.c +++ b/linux/drivers/media/video/ov511.c @@ -5837,7 +5837,7 @@ ov51x_probe(struct usb_interface *intf, const struct usb_device_id *id) goto error; memcpy(ov->vdev, &vdev_template, sizeof(*ov->vdev)); - ov->vdev->dev = &intf->dev; + ov->vdev->parent = &intf->dev; video_set_drvdata(ov->vdev, ov); for (i = 0; i < OV511_MAX_UNIT_VIDEO; i++) { diff --git a/linux/drivers/media/video/ov511.h b/linux/drivers/media/video/ov511.h index 62f0cb4d7..eba9f2e64 100644 --- a/linux/drivers/media/video/ov511.h +++ b/linux/drivers/media/video/ov511.h @@ -5,6 +5,7 @@ #include "compat.h" #include <linux/videodev.h> #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <linux/usb.h> #include <linux/mutex.h> diff --git a/linux/drivers/media/video/ov7670.c b/linux/drivers/media/video/ov7670.c index f226161bc..9cf1aa2bc 100644 --- a/linux/drivers/media/video/ov7670.c +++ b/linux/drivers/media/video/ov7670.c @@ -704,17 +704,17 @@ static int ov7670_try_fmt(struct i2c_client *c, struct v4l2_format *fmt, for (index = 0; index < N_OV7670_FMTS; index++) if (ov7670_formats[index].pixelformat == pix->pixelformat) break; - if (index >= N_OV7670_FMTS) - return -EINVAL; + if (index >= N_OV7670_FMTS) { + /* default to first format */ + index = 0; + pix->pixelformat = ov7670_formats[0].pixelformat; + } if (ret_fmt != NULL) *ret_fmt = ov7670_formats + index; /* * Fields: the OV devices claim to be progressive. */ - if (pix->field == V4L2_FIELD_ANY) - pix->field = V4L2_FIELD_NONE; - else if (pix->field != V4L2_FIELD_NONE) - return -EINVAL; + pix->field = V4L2_FIELD_NONE; /* * Round requested image size down to the nearest * we support, but not below the smallest. @@ -877,7 +877,7 @@ static int ov7670_store_cmatrix(struct i2c_client *client, int matrix[CMATRIX_LEN]) { int i, ret; - unsigned char signbits; + unsigned char signbits = 0; /* * Weird crap seems to exist in the upper part of @@ -1053,7 +1053,7 @@ static unsigned char ov7670_abs_to_sm(unsigned char v) static int ov7670_t_brightness(struct i2c_client *client, int value) { - unsigned char com8, v; + unsigned char com8 = 0, v; int ret; ov7670_read(client, REG_COM8, &com8); @@ -1066,7 +1066,7 @@ static int ov7670_t_brightness(struct i2c_client *client, int value) static int ov7670_q_brightness(struct i2c_client *client, __s32 *value) { - unsigned char v; + unsigned char v = 0; int ret = ov7670_read(client, REG_BRIGHT, &v); *value = ov7670_sm_to_abs(v); @@ -1080,7 +1080,7 @@ static int ov7670_t_contrast(struct i2c_client *client, int value) static int ov7670_q_contrast(struct i2c_client *client, __s32 *value) { - unsigned char v; + unsigned char v = 0; int ret = ov7670_read(client, REG_CONTRAS, &v); *value = v; @@ -1090,7 +1090,7 @@ static int ov7670_q_contrast(struct i2c_client *client, __s32 *value) static int ov7670_q_hflip(struct i2c_client *client, __s32 *value) { int ret; - unsigned char v; + unsigned char v = 0; ret = ov7670_read(client, REG_MVFP, &v); *value = (v & MVFP_MIRROR) == MVFP_MIRROR; @@ -1100,7 +1100,7 @@ static int ov7670_q_hflip(struct i2c_client *client, __s32 *value) static int ov7670_t_hflip(struct i2c_client *client, int value) { - unsigned char v; + unsigned char v = 0; int ret; ret = ov7670_read(client, REG_MVFP, &v); @@ -1118,7 +1118,7 @@ static int ov7670_t_hflip(struct i2c_client *client, int value) static int ov7670_q_vflip(struct i2c_client *client, __s32 *value) { int ret; - unsigned char v; + unsigned char v = 0; ret = ov7670_read(client, REG_MVFP, &v); *value = (v & MVFP_FLIP) == MVFP_FLIP; @@ -1128,7 +1128,7 @@ static int ov7670_q_vflip(struct i2c_client *client, __s32 *value) static int ov7670_t_vflip(struct i2c_client *client, int value) { - unsigned char v; + unsigned char v = 0; int ret; ret = ov7670_read(client, REG_MVFP, &v); diff --git a/linux/drivers/media/video/pms.c b/linux/drivers/media/video/pms.c index bf9858257..31d8a929f 100644 --- a/linux/drivers/media/video/pms.c +++ b/linux/drivers/media/video/pms.c @@ -31,6 +31,7 @@ #include "compat.h" #include <linux/videodev.h> #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <linux/mutex.h> #include <asm/uaccess.h> diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c index 55cb4021a..f097d6aaf 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c @@ -30,6 +30,7 @@ #include <linux/videodev2.h> #include <media/v4l2-dev.h> #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include "compat.h" struct pvr2_v4l2_dev; diff --git a/linux/drivers/media/video/pwc/pwc-if.c b/linux/drivers/media/video/pwc/pwc-if.c index c28490ae5..e51ee878b 100644 --- a/linux/drivers/media/video/pwc/pwc-if.c +++ b/linux/drivers/media/video/pwc/pwc-if.c @@ -1771,7 +1771,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id return -ENOMEM; } memcpy(pdev->vdev, &pwc_template, sizeof(pwc_template)); - pdev->vdev->dev = &(udev->dev); + pdev->vdev->parent = &(udev->dev); strcpy(pdev->vdev->name, name); pdev->vdev->owner = THIS_MODULE; video_set_drvdata(pdev->vdev, pdev); diff --git a/linux/drivers/media/video/pwc/pwc.h b/linux/drivers/media/video/pwc/pwc.h index d01548d2c..977700416 100644 --- a/linux/drivers/media/video/pwc/pwc.h +++ b/linux/drivers/media/video/pwc/pwc.h @@ -36,6 +36,7 @@ #include "compat.h" #include <linux/videodev.h> #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include "pwc-uncompress.h" #include <media/pwc-ioctl.h> diff --git a/linux/drivers/media/video/pxa_camera.c b/linux/drivers/media/video/pxa_camera.c index 5ec5bb9a9..b15f82c49 100644 --- a/linux/drivers/media/video/pxa_camera.c +++ b/linux/drivers/media/video/pxa_camera.c @@ -30,6 +30,7 @@ #include <media/v4l2-common.h> #include <media/v4l2-dev.h> +#include <media/videobuf-dma-sg.h> #include <media/soc_camera.h> #include <linux/videodev2.h> @@ -582,6 +583,19 @@ static struct videobuf_queue_ops pxa_videobuf_ops = { .buf_release = pxa_videobuf_release, }; +static void pxa_camera_init_videobuf(struct videobuf_queue *q, + struct soc_camera_device *icd) +{ + struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); + struct pxa_camera_dev *pcdev = ici->priv; + + /* We must pass NULL as dev pointer, then all pci_* dma operations + * transform to normal dma_* ones. */ + videobuf_queue_sg_init(q, &pxa_videobuf_ops, NULL, &pcdev->lock, + V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_NONE, + sizeof(struct pxa_buffer), icd); +} + static int mclk_get_divisor(struct pxa_camera_dev *pcdev) { unsigned int mclk_10khz = pcdev->platform_mclk_10khz; @@ -983,34 +997,23 @@ static int pxa_camera_querycap(struct soc_camera_host *ici, return 0; } -static spinlock_t *pxa_camera_spinlock_alloc(struct soc_camera_file *icf) -{ - struct soc_camera_host *ici = - to_soc_camera_host(icf->icd->dev.parent); - struct pxa_camera_dev *pcdev = ici->priv; - - return &pcdev->lock; -} - static struct soc_camera_host_ops pxa_soc_camera_host_ops = { .owner = THIS_MODULE, .add = pxa_camera_add_device, .remove = pxa_camera_remove_device, .set_fmt_cap = pxa_camera_set_fmt_cap, .try_fmt_cap = pxa_camera_try_fmt_cap, + .init_videobuf = pxa_camera_init_videobuf, .reqbufs = pxa_camera_reqbufs, .poll = pxa_camera_poll, .querycap = pxa_camera_querycap, .try_bus_param = pxa_camera_try_bus_param, .set_bus_param = pxa_camera_set_bus_param, - .spinlock_alloc = pxa_camera_spinlock_alloc, }; /* Should be allocated dynamically too, but we have only one. */ static struct soc_camera_host pxa_soc_camera_host = { .drv_name = PXA_CAM_DRV_NAME, - .vbq_ops = &pxa_videobuf_ops, - .msize = sizeof(struct pxa_buffer), .ops = &pxa_soc_camera_host_ops, }; diff --git a/linux/drivers/media/video/s2255drv.c b/linux/drivers/media/video/s2255drv.c index aca8c3d90..f6516a4e4 100644 --- a/linux/drivers/media/video/s2255drv.c +++ b/linux/drivers/media/video/s2255drv.c @@ -49,6 +49,7 @@ #include <linux/version.h> #include <media/videobuf-vmalloc.h> #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <linux/vmalloc.h> #include <linux/usb.h> #include "compat.h" @@ -68,17 +69,17 @@ /* maximum time for DSP to start responding after last FW word loaded(ms) */ #define S2255_DSP_BOOTTIME 400 /* maximum time to wait for firmware to load (ms) */ -#define S2255_LOAD_TIMEOUT (5000+S2255_DSP_BOOTTIME) +#define S2255_LOAD_TIMEOUT (5000 + S2255_DSP_BOOTTIME) #define S2255_DEF_BUFS 16 #define MAX_CHANNELS 4 #define FRAME_MARKER 0x2255DA4AL -#define MAX_PIPE_USBBLOCK (40*1024) -#define DEFAULT_PIPE_USBBLOCK (16*1024) +#define MAX_PIPE_USBBLOCK (40 * 1024) +#define DEFAULT_PIPE_USBBLOCK (16 * 1024) #define MAX_CHANNELS 4 #define MAX_PIPE_BUFFERS 1 #define SYS_FRAMES 4 /* maximum size is PAL full size plus room for the marker header(s) */ -#define SYS_FRAMES_MAXSIZE (720*288*2*2 + 4096) +#define SYS_FRAMES_MAXSIZE (720 * 288 * 2 * 2 + 4096) #define DEF_USB_BLOCK (4096) #define LINE_SZ_4CIFS_NTSC 640 #define LINE_SZ_2CIFS_NTSC 640 @@ -169,7 +170,7 @@ struct s2255_bufferi { #define DEF_MODEI_NTSC_CONT {FORMAT_NTSC, DEF_SCALE, DEF_COLOR, \ DEF_FDEC, DEF_BRIGHT, DEF_CONTRAST, DEF_SATURATION, \ - DEF_HUE, 0, DEF_USB_BLOCK, 0 } + DEF_HUE, 0, DEF_USB_BLOCK, 0} struct s2255_dmaqueue { struct list_head active; @@ -276,6 +277,10 @@ struct s2255_fh { struct s2255_mode mode; }; +/* + * TODO: fixme S2255_MAX_USERS. Do not limit open driver handles. + * Limit V4L to one stream at a time. + */ #define S2255_MAX_USERS 1 #define CUR_USB_FWVER 774 /* current cypress EEPROM firmware version */ @@ -294,7 +299,7 @@ struct s2255_fh { #define PREFIX_SIZE 512 /* Channels on box are in reverse order */ -static unsigned long G_chnmap[MAX_CHANNELS] = { 3, 2, 1, 0 }; +static unsigned long G_chnmap[MAX_CHANNELS] = {3, 2, 1, 0}; static LIST_HEAD(s2255_devlist); @@ -330,11 +335,11 @@ static unsigned int vid_limit = 16; /* Video memory limit, in Mb */ /* start video number */ static int video_nr = -1; /* /dev/videoN, -1 for autodetect */ -module_param(debug, int, 0); +module_param(debug, int, 0644); MODULE_PARM_DESC(debug, "Debug level(0-100) default 0"); -module_param(vid_limit, int, 0); +module_param(vid_limit, int, 0644); MODULE_PARM_DESC(vid_limit, "video memory limit(Mb)"); -module_param(video_nr, int, 0); +module_param(video_nr, int, 0644); MODULE_PARM_DESC(video_nr, "start video minor(-1 default autodetect)"); /* USB device table */ @@ -438,7 +443,10 @@ static int norm_minh(struct video_device *vdev) } -/* converts 2255 planar format to yuyv or uyvy */ +/* + * TODO: fixme: move YUV reordering to hardware + * converts 2255 planar format to yuyv or uyvy + */ static void planar422p_to_yuv_packed(const unsigned char *in, unsigned char *out, int width, int height, @@ -503,7 +511,7 @@ static void s2255_fwchunk_complete(struct urb *urb) struct usb_device *udev = urb->dev; int len; dprintk(100, "udev %p urb %p", udev, urb); - + /* TODO: fixme. reflect change in status */ if (urb->status) { dev_err(&udev->dev, "URB failed with status %d", urb->status); return; @@ -683,7 +691,7 @@ static int buffer_setup(struct videobuf_queue *vq, unsigned int *count, if (0 == *count) *count = S2255_DEF_BUFS; - while (*size * *count > vid_limit * 1024 * 1024) + while (*size * (*count) > vid_limit * 1024 * 1024) (*count)--; return 0; @@ -790,7 +798,7 @@ static int res_get(struct s2255_dev *dev, struct s2255_fh *fh) static int res_locked(struct s2255_dev *dev, struct s2255_fh *fh) { - return (dev->resources[fh->channel]); + return dev->resources[fh->channel]; } static void res_free(struct s2255_dev *dev, struct s2255_fh *fh) @@ -807,7 +815,8 @@ static int vidioc_querycap(struct file *file, void *priv, struct s2255_dev *dev = fh->dev; strlcpy(cap->driver, "s2255", sizeof(cap->driver)); strlcpy(cap->card, "s2255", sizeof(cap->card)); - strlcpy(cap->bus_info, dev_name(&dev->udev->dev), sizeof(cap->bus_info)); + strlcpy(cap->bus_info, dev_name(&dev->udev->dev), + sizeof(cap->bus_info)); cap->version = S2255_VERSION; cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; return 0; @@ -840,8 +849,7 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *priv, f->fmt.pix.pixelformat = fh->fmt->fourcc; f->fmt.pix.bytesperline = f->fmt.pix.width * (fh->fmt->depth >> 3); f->fmt.pix.sizeimage = f->fmt.pix.height * f->fmt.pix.bytesperline; - - return (0); + return 0; } static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, @@ -962,7 +970,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, ret = vidioc_try_fmt_vid_cap(file, fh, f); if (ret < 0) - return (ret); + return ret; fmt = format_by_fourcc(f->fmt.pix.pixelformat); @@ -1337,7 +1345,7 @@ static int vidioc_enum_input(struct file *file, void *priv, inp->type = V4L2_INPUT_TYPE_CAMERA; inp->std = S2255_NORMS; strlcpy(inp->name, "Camera", sizeof(inp->name)); - return (0); + return 0; } static int vidioc_g_input(struct file *file, void *priv, unsigned int *i) @@ -1361,7 +1369,7 @@ static int vidioc_queryctrl(struct file *file, void *priv, for (i = 0; i < ARRAY_SIZE(s2255_qctrl); i++) if (qc->id && qc->id == s2255_qctrl[i].id) { memcpy(qc, &(s2255_qctrl[i]), sizeof(*qc)); - return (0); + return 0; } dprintk(4, "query_ctrl -EINVAL %d\n", qc->id); @@ -1376,7 +1384,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv, for (i = 0; i < ARRAY_SIZE(s2255_qctrl); i++) if (ctrl->id == s2255_qctrl[i].id) { ctrl->value = qctl_regs[i]; - return (0); + return 0; } dprintk(4, "g_ctrl -EINVAL\n"); @@ -1396,7 +1404,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv, if (ctrl->id == s2255_qctrl[i].id) { if (ctrl->value < s2255_qctrl[i].minimum || ctrl->value > s2255_qctrl[i].maximum) - return (-ERANGE); + return -ERANGE; qctl_regs[i] = ctrl->value; /* update the mode to the corresponding value */ @@ -1572,6 +1580,11 @@ static void s2255_destroy(struct kref *kref) usb_free_urb(dev->fw_data->fw_urb); dev->fw_data->fw_urb = NULL; } + /* + * TODO: fixme(above, below): potentially leaving timers alive. + * do not ignore timeout below if + * it occurs. + */ /* make sure we aren't waiting for the DSP */ if (atomic_read(&dev->fw_data->fw_state) == S2255_FW_LOADED_DSPWAIT) { @@ -1583,15 +1596,12 @@ static void s2255_destroy(struct kref *kref) } if (dev->fw_data) { + if (dev->fw_data->fw) + release_firmware(dev->fw_data->fw); kfree(dev->fw_data->pfw_data); kfree(dev->fw_data); } - if (dev->fw_data->fw) { - release_firmware(dev->fw_data->fw); - dev->fw_data->fw = NULL; - } - usb_put_dev(dev->udev); dprintk(1, "%s", __func__); kfree(dev); @@ -1698,7 +1708,7 @@ static int s2255_probe_v4l(struct s2255_dev *dev) /* register 4 video devices */ dev->vdev[i] = video_device_alloc(); memcpy(dev->vdev[i], &template, sizeof(struct video_device)); - dev->vdev[i]->dev = &dev->interface->dev; + dev->vdev[i]->parent = &dev->interface->dev; if (video_nr == -1) ret = video_register_device(dev->vdev[i], VFL_TYPE_GRABBER, diff --git a/linux/drivers/media/video/saa5246a.c b/linux/drivers/media/video/saa5246a.c index 59b95caef..49b4a046c 100644 --- a/linux/drivers/media/video/saa5246a.c +++ b/linux/drivers/media/video/saa5246a.c @@ -47,6 +47,7 @@ #include "compat.h" #include <linux/videodev.h> #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <linux/mutex.h> #include "saa5246a.h" diff --git a/linux/drivers/media/video/saa5249.c b/linux/drivers/media/video/saa5249.c index 3bc0f0604..6423a6762 100644 --- a/linux/drivers/media/video/saa5249.c +++ b/linux/drivers/media/video/saa5249.c @@ -58,6 +58,7 @@ #include "compat.h" #include <linux/videodev.h> #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <linux/mutex.h> diff --git a/linux/drivers/media/video/saa7115.c b/linux/drivers/media/video/saa7115.c index 5d99f8455..5488679ed 100644 --- a/linux/drivers/media/video/saa7115.c +++ b/linux/drivers/media/video/saa7115.c @@ -1567,7 +1567,7 @@ static int saa7115_remove(struct i2c_client *client) #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) static const struct i2c_device_id saa7115_id[] = { - { "saa711x", 1 }, /* autodetect */ + { "saa7115_auto", 1 }, /* autodetect */ { "saa7111", 0 }, { "saa7113", 0 }, { "saa7114", 0 }, diff --git a/linux/drivers/media/video/saa7127.c b/linux/drivers/media/video/saa7127.c index 28905adfb..0b126a849 100644 --- a/linux/drivers/media/video/saa7127.c +++ b/linux/drivers/media/video/saa7127.c @@ -672,7 +672,6 @@ static int saa7127_probe(struct i2c_client *client, { struct saa7127_state *state; struct v4l2_sliced_vbi_data vbi = { 0, 0, 0, 0 }; /* set to disabled */ - int read_result = 0; /* Check if the adapter supports the needed features */ if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) @@ -720,20 +719,33 @@ static int saa7127_probe(struct i2c_client *client, saa7127_set_input_type(client, SAA7127_INPUT_TYPE_NORMAL); saa7127_set_video_enable(client, 1); - /* Detect if it's an saa7129 */ - read_result = saa7127_read(client, SAA7129_REG_FADE_KEY_COL2); - saa7127_write(client, SAA7129_REG_FADE_KEY_COL2, 0xaa); - if (saa7127_read(client, SAA7129_REG_FADE_KEY_COL2) == 0xaa) { - v4l_info(client, "saa7129 found @ 0x%x (%s)\n", - client->addr << 1, client->adapter->name); - saa7127_write(client, SAA7129_REG_FADE_KEY_COL2, read_result); - saa7127_write_inittab(client, saa7129_init_config_extra); - state->ident = V4L2_IDENT_SAA7129; - } else { - v4l_info(client, "saa7127 found @ 0x%x (%s)\n", - client->addr << 1, client->adapter->name); - state->ident = V4L2_IDENT_SAA7127; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) + if (id->driver_data) { /* Chip type is already known */ + state->ident = id->driver_data; + } else { /* Needs detection */ +#else + { +#endif + int read_result; + + /* Detect if it's an saa7129 */ + read_result = saa7127_read(client, SAA7129_REG_FADE_KEY_COL2); + saa7127_write(client, SAA7129_REG_FADE_KEY_COL2, 0xaa); + if (saa7127_read(client, SAA7129_REG_FADE_KEY_COL2) == 0xaa) { + saa7127_write(client, SAA7129_REG_FADE_KEY_COL2, + read_result); + state->ident = V4L2_IDENT_SAA7129; + strlcpy(client->name, "saa7129", I2C_NAME_SIZE); + } else { + state->ident = V4L2_IDENT_SAA7127; + strlcpy(client->name, "saa7127", I2C_NAME_SIZE); + } } + + v4l_info(client, "%s found @ 0x%x (%s)\n", client->name, + client->addr << 1, client->adapter->name); + if (state->ident == V4L2_IDENT_SAA7129) + saa7127_write_inittab(client, saa7129_init_config_extra); return 0; } @@ -751,7 +763,11 @@ static int saa7127_remove(struct i2c_client *client) #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26) static struct i2c_device_id saa7127_id[] = { - { "saa7127", 0 }, + { "saa7127_auto", 0 }, /* auto-detection */ + { "saa7126", V4L2_IDENT_SAA7127 }, + { "saa7127", V4L2_IDENT_SAA7127 }, + { "saa7128", V4L2_IDENT_SAA7129 }, + { "saa7129", V4L2_IDENT_SAA7129 }, { } }; MODULE_DEVICE_TABLE(i2c, saa7127_id); diff --git a/linux/drivers/media/video/saa7134/saa7134-cards.c b/linux/drivers/media/video/saa7134/saa7134-cards.c index a2a4ca6f8..8ec09c97e 100644 --- a/linux/drivers/media/video/saa7134/saa7134-cards.c +++ b/linux/drivers/media/video/saa7134/saa7134-cards.c @@ -3558,6 +3558,39 @@ struct saa7134_board saa7134_boards[] = { .amux = TV, .gpio = 0x0200000, }, + }, + [SAA7134_BOARD_ASUSTeK_P7131_ANALOG] = { + .name = "ASUSTeK P7131 Analog", + .audio_clock = 0x00187de7, + .tuner_type = TUNER_PHILIPS_TDA8290, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .gpiomask = 1 << 21, + .inputs = {{ + .name = name_tv, + .vmux = 1, + .amux = TV, + .tv = 1, + .gpio = 0x0000000, + }, { + .name = name_comp1, + .vmux = 3, + .amux = LINE2, + }, { + .name = name_comp2, + .vmux = 0, + .amux = LINE2, + }, { + .name = name_svideo, + .vmux = 8, + .amux = LINE2, + } }, + .radio = { + .name = name_radio, + .amux = TV, + .gpio = 0x0200000, + }, }, [SAA7134_BOARD_SABRENT_TV_PCB05] = { .name = "Sabrent PCMCIA TV-PCB05", @@ -5704,6 +5737,7 @@ int saa7134_board_init1(struct saa7134_dev *dev) case SAA7134_BOARD_FLYDVBT_LR301: case SAA7134_BOARD_ASUSTeK_P7131_DUAL: case SAA7134_BOARD_ASUSTeK_P7131_HYBRID_LNA: + case SAA7134_BOARD_ASUSTeK_P7131_ANALOG: case SAA7134_BOARD_FLYDVBTDUO: case SAA7134_BOARD_PROTEUS_2309: case SAA7134_BOARD_AVERMEDIA_A16AR: @@ -6044,6 +6078,15 @@ int saa7134_board_init2(struct saa7134_dev *dev) i2c_transfer(&dev->i2c_adap, &msg, 1); break; } + case SAA7134_BOARD_ASUSTeK_TVFM7135: + /* The card below is detected as card=53, but is different */ + if (dev->autodetected && (dev->eedata[0x27] == 0x03)) { + dev->board = SAA7134_BOARD_ASUSTeK_P7131_ANALOG; + printk(KERN_INFO "%s: P7131 analog only, using " + "entry of %s\n", + dev->name, saa7134_boards[dev->board].name); + } + break; case SAA7134_BOARD_HAUPPAUGE_HVR1110: hauppauge_eeprom(dev, dev->eedata+0x80); /* break intentionally omitted */ diff --git a/linux/drivers/media/video/saa7134/saa7134-core.c b/linux/drivers/media/video/saa7134/saa7134-core.c index 8f3d280af..254a04717 100644 --- a/linux/drivers/media/video/saa7134/saa7134-core.c +++ b/linux/drivers/media/video/saa7134/saa7134-core.c @@ -859,7 +859,7 @@ static struct video_device *vdev_init(struct saa7134_dev *dev, return NULL; *vfd = *template; vfd->minor = -1; - vfd->dev = &dev->pci->dev; + vfd->parent = &dev->pci->dev; vfd->release = video_device_release; vfd->debug = video_debug; snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)", diff --git a/linux/drivers/media/video/saa7134/saa7134-empress.c b/linux/drivers/media/video/saa7134/saa7134-empress.c index d4afbce9d..dc3c2a6cb 100644 --- a/linux/drivers/media/video/saa7134/saa7134-empress.c +++ b/linux/drivers/media/video/saa7134/saa7134-empress.c @@ -473,7 +473,7 @@ static int empress_init(struct saa7134_dev *dev) if (NULL == dev->empress_dev) return -ENOMEM; *(dev->empress_dev) = saa7134_empress_template; - dev->empress_dev->dev = &dev->pci->dev; + dev->empress_dev->parent = &dev->pci->dev; dev->empress_dev->release = video_device_release; snprintf(dev->empress_dev->name, sizeof(dev->empress_dev->name), "%s empress (%s)", dev->name, diff --git a/linux/drivers/media/video/saa7134/saa7134-input.c b/linux/drivers/media/video/saa7134/saa7134-input.c index 0ad81e690..f26fd7061 100644 --- a/linux/drivers/media/video/saa7134/saa7134-input.c +++ b/linux/drivers/media/video/saa7134/saa7134-input.c @@ -198,6 +198,84 @@ static int get_key_beholdm6xx(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) return 1; } +/* Common (grey or coloured) pinnacle PCTV remote handling + * + */ +static int get_key_pinnacle(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw, + int parity_offset, int marker, int code_modulo) +{ + unsigned char b[4]; + unsigned int start = 0,parity = 0,code = 0; + + /* poll IR chip */ + if (4 != i2c_master_recv(&ir->c, b, 4)) { + i2cdprintk("read error\n"); + return -EIO; + } + + for (start = 0; start < ARRAY_SIZE(b); start++) { + if (b[start] == marker) { + code=b[(start+parity_offset + 1) % 4]; + parity=b[(start+parity_offset) % 4]; + } + } + + /* Empty Request */ + if (parity == 0) + return 0; + + /* Repeating... */ + if (ir->old == parity) + return 0; + + ir->old = parity; + + /* drop special codes when a key is held down a long time for the grey controller + In this case, the second bit of the code is asserted */ + if (marker == 0xfe && (code & 0x40)) + return 0; + + code %= code_modulo; + + *ir_raw = code; + *ir_key = code; + + i2cdprintk("Pinnacle PCTV key %02x\n", code); + + return 1; +} + +/* The grey pinnacle PCTV remote + * + * There are one issue with this remote: + * - I2c packet does not change when the same key is pressed quickly. The workaround + * is to hold down each key for about half a second, so that another code is generated + * in the i2c packet, and the function can distinguish key presses. + * + * Sylvain Pasche <sylvain.pasche@gmail.com> + */ +static int get_key_pinnacle_grey(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) +{ + + return get_key_pinnacle(ir, ir_key, ir_raw, 1, 0xfe, 0xff); +} + + +/* The new pinnacle PCTV remote (with the colored buttons) + * + * Ricardo Cerqueira <v4l@cerqueira.org> + */ +static int get_key_pinnacle_color(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) +{ + /* code_modulo parameter (0x88) is used to reduce code value to fit inside IR_KEYTAB_SIZE + * + * this is the only value that results in 42 unique + * codes < 128 + */ + + return get_key_pinnacle(ir, ir_key, ir_raw, 2, 0x80, 0x88); +} + void saa7134_input_irq(struct saa7134_dev *dev) { struct card_ir *ir = dev->remote; @@ -409,6 +487,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) break; case SAA7134_BOARD_ASUSTeK_P7131_DUAL: case SAA7134_BOARD_ASUSTeK_P7131_HYBRID_LNA: + case SAA7134_BOARD_ASUSTeK_P7131_ANALOG: ir_codes = ir_codes_asus_pc39; mask_keydown = 0x0040000; rc5_gpio = 1; diff --git a/linux/drivers/media/video/saa7134/saa7134.h b/linux/drivers/media/video/saa7134/saa7134.h index 4a9bebb2d..053c358ff 100644 --- a/linux/drivers/media/video/saa7134/saa7134.h +++ b/linux/drivers/media/video/saa7134/saa7134.h @@ -35,6 +35,7 @@ #include "compat.h" #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <media/tuner.h> #include <media/ir-common.h> #include <media/ir-kbd-i2c.h> @@ -268,6 +269,7 @@ struct saa7134_format { #define SAA7134_BOARD_BEHOLD_M63 143 #define SAA7134_BOARD_BEHOLD_M6_EXTRA 144 #define SAA7134_BOARD_AVERMEDIA_M103 145 +#define SAA7134_BOARD_ASUSTeK_P7131_ANALOG 146 #define SAA7134_MAXBOARDS 8 #define SAA7134_INPUT_MAX 8 diff --git a/linux/drivers/media/video/se401.h b/linux/drivers/media/video/se401.h index 81f2c2c74..0be02c48b 100644 --- a/linux/drivers/media/video/se401.h +++ b/linux/drivers/media/video/se401.h @@ -6,6 +6,7 @@ #include "compat.h" #include <linux/videodev.h> #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <linux/mutex.h> #define se401_DEBUG /* Turn on debug messages */ diff --git a/linux/drivers/media/video/sh_mobile_ceu_camera.c b/linux/drivers/media/video/sh_mobile_ceu_camera.c new file mode 100644 index 000000000..f7ca3cb93 --- /dev/null +++ b/linux/drivers/media/video/sh_mobile_ceu_camera.c @@ -0,0 +1,658 @@ +/* + * V4L2 Driver for SuperH Mobile CEU interface + * + * Copyright (C) 2008 Magnus Damm + * + * Based on V4L2 Driver for PXA camera host - "pxa_camera.c", + * + * Copyright (C) 2006, Sascha Hauer, Pengutronix + * Copyright (C) 2008, Guennadi Liakhovetski <kernel@pengutronix.de> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include <linux/init.h> +#include <linux/module.h> +#include <linux/io.h> +#include <linux/delay.h> +#include <linux/dma-mapping.h> +#include <linux/errno.h> +#include <linux/fs.h> +#include <linux/interrupt.h> +#include <linux/kernel.h> +#include <linux/mm.h> +#include <linux/moduleparam.h> +#include <linux/time.h> +#include <linux/version.h> +#include <linux/device.h> +#include <linux/platform_device.h> +#include <linux/mutex.h> +#include <linux/videodev2.h> + +#include <media/v4l2-common.h> +#include <media/v4l2-dev.h> +#include <media/soc_camera.h> +#include <media/sh_mobile_ceu.h> +#include <media/videobuf-dma-contig.h> + +/* register offsets for sh7722 / sh7723 */ + +#define CAPSR 0x00 +#define CAPCR 0x04 +#define CAMCR 0x08 +#define CMCYR 0x0c +#define CAMOR 0x10 +#define CAPWR 0x14 +#define CAIFR 0x18 +#define CSTCR 0x20 /* not on sh7723 */ +#define CSECR 0x24 /* not on sh7723 */ +#define CRCNTR 0x28 +#define CRCMPR 0x2c +#define CFLCR 0x30 +#define CFSZR 0x34 +#define CDWDR 0x38 +#define CDAYR 0x3c +#define CDACR 0x40 +#define CDBYR 0x44 +#define CDBCR 0x48 +#define CBDSR 0x4c +#define CFWCR 0x5c +#define CLFCR 0x60 +#define CDOCR 0x64 +#define CDDCR 0x68 +#define CDDAR 0x6c +#define CEIER 0x70 +#define CETCR 0x74 +#define CSTSR 0x7c +#define CSRTR 0x80 +#define CDSSR 0x84 +#define CDAYR2 0x90 +#define CDACR2 0x94 +#define CDBYR2 0x98 +#define CDBCR2 0x9c + +static DEFINE_MUTEX(camera_lock); + +/* per video frame buffer */ +struct sh_mobile_ceu_buffer { + struct videobuf_buffer vb; /* v4l buffer must be first */ + const struct soc_camera_data_format *fmt; +}; + +struct sh_mobile_ceu_dev { + struct device *dev; + struct soc_camera_host ici; + struct soc_camera_device *icd; + + unsigned int irq; + void __iomem *base; + unsigned long video_limit; + + /* lock used to protect videobuf */ + spinlock_t lock; + struct list_head capture; + struct videobuf_buffer *active; + + struct sh_mobile_ceu_info *pdata; +}; + +static void ceu_write(struct sh_mobile_ceu_dev *priv, + unsigned long reg_offs, unsigned long data) +{ + iowrite32(data, priv->base + reg_offs); +} + +static unsigned long ceu_read(struct sh_mobile_ceu_dev *priv, + unsigned long reg_offs) +{ + return ioread32(priv->base + reg_offs); +} + +/* + * Videobuf operations + */ +static int sh_mobile_ceu_videobuf_setup(struct videobuf_queue *vq, + unsigned int *count, + unsigned int *size) +{ + struct soc_camera_device *icd = vq->priv_data; + struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); + struct sh_mobile_ceu_dev *pcdev = ici->priv; + int bytes_per_pixel = (icd->current_fmt->depth + 7) >> 3; + + *size = PAGE_ALIGN(icd->width * icd->height * bytes_per_pixel); + + if (0 == *count) + *count = 2; + + if (pcdev->video_limit) { + while (*size * *count > pcdev->video_limit) + (*count)--; + } + + dev_dbg(&icd->dev, "count=%d, size=%d\n", *count, *size); + + return 0; +} + +static void free_buffer(struct videobuf_queue *vq, + struct sh_mobile_ceu_buffer *buf) +{ + struct soc_camera_device *icd = vq->priv_data; + + dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %zd\n", __func__, + &buf->vb, buf->vb.baddr, buf->vb.bsize); + + if (in_interrupt()) + BUG(); + + videobuf_dma_contig_free(vq, &buf->vb); + dev_dbg(&icd->dev, "%s freed\n", __func__); + buf->vb.state = VIDEOBUF_NEEDS_INIT; +} + +static void sh_mobile_ceu_capture(struct sh_mobile_ceu_dev *pcdev) +{ + ceu_write(pcdev, CEIER, ceu_read(pcdev, CEIER) & ~1); + ceu_write(pcdev, CETCR, ~ceu_read(pcdev, CETCR) & 0x0317f313); + ceu_write(pcdev, CEIER, ceu_read(pcdev, CEIER) | 1); + + ceu_write(pcdev, CAPCR, ceu_read(pcdev, CAPCR) & ~0x10000); + + ceu_write(pcdev, CETCR, 0x0317f313 ^ 0x10); + + if (pcdev->active) { + ceu_write(pcdev, CDAYR, videobuf_to_dma_contig(pcdev->active)); + ceu_write(pcdev, CAPSR, 0x1); /* start capture */ + } +} + +static int sh_mobile_ceu_videobuf_prepare(struct videobuf_queue *vq, + struct videobuf_buffer *vb, + enum v4l2_field field) +{ + struct soc_camera_device *icd = vq->priv_data; + struct sh_mobile_ceu_buffer *buf; + int ret; + + buf = container_of(vb, struct sh_mobile_ceu_buffer, vb); + + dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %zd\n", __func__, + vb, vb->baddr, vb->bsize); + + /* Added list head initialization on alloc */ + WARN_ON(!list_empty(&vb->queue)); + +#ifdef DEBUG + /* This can be useful if you want to see if we actually fill + * the buffer with something */ + memset((void *)vb->baddr, 0xaa, vb->bsize); +#endif + + BUG_ON(NULL == icd->current_fmt); + + if (buf->fmt != icd->current_fmt || + vb->width != icd->width || + vb->height != icd->height || + vb->field != field) { + buf->fmt = icd->current_fmt; + vb->width = icd->width; + vb->height = icd->height; + vb->field = field; + vb->state = VIDEOBUF_NEEDS_INIT; + } + + vb->size = vb->width * vb->height * ((buf->fmt->depth + 7) >> 3); + if (0 != vb->baddr && vb->bsize < vb->size) { + ret = -EINVAL; + goto out; + } + + if (vb->state == VIDEOBUF_NEEDS_INIT) { + ret = videobuf_iolock(vq, vb, NULL); + if (ret) + goto fail; + vb->state = VIDEOBUF_PREPARED; + } + + return 0; +fail: + free_buffer(vq, buf); +out: + return ret; +} + +static void sh_mobile_ceu_videobuf_queue(struct videobuf_queue *vq, + struct videobuf_buffer *vb) +{ + struct soc_camera_device *icd = vq->priv_data; + struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); + struct sh_mobile_ceu_dev *pcdev = ici->priv; + unsigned long flags; + + dev_dbg(&icd->dev, "%s (vb=0x%p) 0x%08lx %zd\n", __func__, + vb, vb->baddr, vb->bsize); + + vb->state = VIDEOBUF_ACTIVE; + spin_lock_irqsave(&pcdev->lock, flags); + list_add_tail(&vb->queue, &pcdev->capture); + + if (!pcdev->active) { + pcdev->active = vb; + sh_mobile_ceu_capture(pcdev); + } + + spin_unlock_irqrestore(&pcdev->lock, flags); +} + +static void sh_mobile_ceu_videobuf_release(struct videobuf_queue *vq, + struct videobuf_buffer *vb) +{ + free_buffer(vq, container_of(vb, struct sh_mobile_ceu_buffer, vb)); +} + +static struct videobuf_queue_ops sh_mobile_ceu_videobuf_ops = { + .buf_setup = sh_mobile_ceu_videobuf_setup, + .buf_prepare = sh_mobile_ceu_videobuf_prepare, + .buf_queue = sh_mobile_ceu_videobuf_queue, + .buf_release = sh_mobile_ceu_videobuf_release, +}; + +static irqreturn_t sh_mobile_ceu_irq(int irq, void *data) +{ + struct sh_mobile_ceu_dev *pcdev = data; + struct videobuf_buffer *vb; + unsigned long flags; + + spin_lock_irqsave(&pcdev->lock, flags); + + vb = pcdev->active; + list_del_init(&vb->queue); + + if (!list_empty(&pcdev->capture)) + pcdev->active = list_entry(pcdev->capture.next, + struct videobuf_buffer, queue); + else + pcdev->active = NULL; + + sh_mobile_ceu_capture(pcdev); + + vb->state = VIDEOBUF_DONE; + do_gettimeofday(&vb->ts); + vb->field_count++; + wake_up(&vb->done); + spin_unlock_irqrestore(&pcdev->lock, flags); + + return IRQ_HANDLED; +} + +static int sh_mobile_ceu_add_device(struct soc_camera_device *icd) +{ + struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); + struct sh_mobile_ceu_dev *pcdev = ici->priv; + int ret = -EBUSY; + + mutex_lock(&camera_lock); + + if (pcdev->icd) + goto err; + + dev_info(&icd->dev, + "SuperH Mobile CEU driver attached to camera %d\n", + icd->devnum); + + if (pcdev->pdata->enable_camera) + pcdev->pdata->enable_camera(); + + ret = icd->ops->init(icd); + if (ret) + goto err; + + ceu_write(pcdev, CAPSR, 1 << 16); /* reset */ + while (ceu_read(pcdev, CSTSR) & 1) + msleep(1); + + pcdev->icd = icd; +err: + mutex_unlock(&camera_lock); + + return ret; +} + +static void sh_mobile_ceu_remove_device(struct soc_camera_device *icd) +{ + struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); + struct sh_mobile_ceu_dev *pcdev = ici->priv; + + BUG_ON(icd != pcdev->icd); + + /* disable capture, disable interrupts */ + ceu_write(pcdev, CEIER, 0); + ceu_write(pcdev, CAPSR, 1 << 16); /* reset */ + icd->ops->release(icd); + if (pcdev->pdata->disable_camera) + pcdev->pdata->disable_camera(); + + dev_info(&icd->dev, + "SuperH Mobile CEU driver detached from camera %d\n", + icd->devnum); + + pcdev->icd = NULL; +} + +static int sh_mobile_ceu_set_bus_param(struct soc_camera_device *icd, + __u32 pixfmt) +{ + struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); + struct sh_mobile_ceu_dev *pcdev = ici->priv; + int ret, buswidth, width, cfszr_width, cdwdr_width; + unsigned long camera_flags, common_flags, value; + + camera_flags = icd->ops->query_bus_param(icd); + common_flags = soc_camera_bus_param_compatible(camera_flags, + pcdev->pdata->flags); + if (!common_flags) + return -EINVAL; + + ret = icd->ops->set_bus_param(icd, common_flags); + if (ret < 0) + return ret; + + switch (common_flags & SOCAM_DATAWIDTH_MASK) { + case SOCAM_DATAWIDTH_8: + buswidth = 8; + break; + case SOCAM_DATAWIDTH_16: + buswidth = 16; + break; + default: + return -EINVAL; + } + + ceu_write(pcdev, CRCNTR, 0); + ceu_write(pcdev, CRCMPR, 0); + + value = 0x00000010; + value |= (common_flags & SOCAM_VSYNC_ACTIVE_LOW) ? (1 << 1) : 0; + value |= (common_flags & SOCAM_HSYNC_ACTIVE_LOW) ? (1 << 0) : 0; + value |= (buswidth == 16) ? (1 << 12) : 0; + ceu_write(pcdev, CAMCR, value); + + ceu_write(pcdev, CAPCR, 0x00300000); + ceu_write(pcdev, CAIFR, 0); + + mdelay(1); + + width = icd->width * (icd->current_fmt->depth / 8); + width = (buswidth == 16) ? width / 2 : width; + cfszr_width = (buswidth == 8) ? width / 2 : width; + cdwdr_width = (buswidth == 16) ? width * 2 : width; + + ceu_write(pcdev, CAMOR, 0); + ceu_write(pcdev, CAPWR, (icd->height << 16) | width); + ceu_write(pcdev, CFLCR, 0); /* data fetch mode - no scaling */ + ceu_write(pcdev, CFSZR, (icd->height << 16) | cfszr_width); + ceu_write(pcdev, CLFCR, 0); /* data fetch mode - no lowpass filter */ + ceu_write(pcdev, CDOCR, 0x00000016); + + ceu_write(pcdev, CDWDR, cdwdr_width); + ceu_write(pcdev, CFWCR, 0); /* keep "datafetch firewall" disabled */ + + /* not in bundle mode: skip CBDSR, CDAYR2, CDACR2, CDBYR2, CDBCR2 */ + /* in data fetch mode: no need for CDACR, CDBYR, CDBCR */ + + return 0; +} + +static int sh_mobile_ceu_try_bus_param(struct soc_camera_device *icd, + __u32 pixfmt) +{ + struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); + struct sh_mobile_ceu_dev *pcdev = ici->priv; + unsigned long camera_flags, common_flags; + + camera_flags = icd->ops->query_bus_param(icd); + common_flags = soc_camera_bus_param_compatible(camera_flags, + pcdev->pdata->flags); + if (!common_flags) + return -EINVAL; + + return 0; +} + +static int sh_mobile_ceu_set_fmt_cap(struct soc_camera_device *icd, + __u32 pixfmt, struct v4l2_rect *rect) +{ + return icd->ops->set_fmt_cap(icd, pixfmt, rect); +} + +static int sh_mobile_ceu_try_fmt_cap(struct soc_camera_device *icd, + struct v4l2_format *f) +{ + /* FIXME: calculate using depth and bus width */ + + if (f->fmt.pix.height < 4) + f->fmt.pix.height = 4; + if (f->fmt.pix.height > 1920) + f->fmt.pix.height = 1920; + if (f->fmt.pix.width < 2) + f->fmt.pix.width = 2; + if (f->fmt.pix.width > 2560) + f->fmt.pix.width = 2560; + f->fmt.pix.width &= ~0x01; + f->fmt.pix.height &= ~0x03; + + /* limit to sensor capabilities */ + return icd->ops->try_fmt_cap(icd, f); +} + +static int sh_mobile_ceu_reqbufs(struct soc_camera_file *icf, + struct v4l2_requestbuffers *p) +{ + int i; + + /* This is for locking debugging only. I removed spinlocks and now I + * check whether .prepare is ever called on a linked buffer, or whether + * a dma IRQ can occur for an in-work or unlinked buffer. Until now + * it hadn't triggered */ + for (i = 0; i < p->count; i++) { + struct sh_mobile_ceu_buffer *buf; + + buf = container_of(icf->vb_vidq.bufs[i], + struct sh_mobile_ceu_buffer, vb); + INIT_LIST_HEAD(&buf->vb.queue); + } + + return 0; +} + +static unsigned int sh_mobile_ceu_poll(struct file *file, poll_table *pt) +{ + struct soc_camera_file *icf = file->private_data; + struct sh_mobile_ceu_buffer *buf; + + buf = list_entry(icf->vb_vidq.stream.next, + struct sh_mobile_ceu_buffer, vb.stream); + + poll_wait(file, &buf->vb.done, pt); + + if (buf->vb.state == VIDEOBUF_DONE || + buf->vb.state == VIDEOBUF_ERROR) + return POLLIN|POLLRDNORM; + + return 0; +} + +static int sh_mobile_ceu_querycap(struct soc_camera_host *ici, + struct v4l2_capability *cap) +{ + strlcpy(cap->card, "SuperH_Mobile_CEU", sizeof(cap->card)); + cap->version = KERNEL_VERSION(0, 0, 5); + cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; + return 0; +} + +static void sh_mobile_ceu_init_videobuf(struct videobuf_queue *q, + struct soc_camera_device *icd) +{ + struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); + struct sh_mobile_ceu_dev *pcdev = ici->priv; + + videobuf_queue_dma_contig_init(q, + &sh_mobile_ceu_videobuf_ops, + &ici->dev, &pcdev->lock, + V4L2_BUF_TYPE_VIDEO_CAPTURE, + V4L2_FIELD_NONE, + sizeof(struct sh_mobile_ceu_buffer), + icd); +} + +static struct soc_camera_host_ops sh_mobile_ceu_host_ops = { + .owner = THIS_MODULE, + .add = sh_mobile_ceu_add_device, + .remove = sh_mobile_ceu_remove_device, + .set_fmt_cap = sh_mobile_ceu_set_fmt_cap, + .try_fmt_cap = sh_mobile_ceu_try_fmt_cap, + .reqbufs = sh_mobile_ceu_reqbufs, + .poll = sh_mobile_ceu_poll, + .querycap = sh_mobile_ceu_querycap, + .try_bus_param = sh_mobile_ceu_try_bus_param, + .set_bus_param = sh_mobile_ceu_set_bus_param, + .init_videobuf = sh_mobile_ceu_init_videobuf, +}; + +static int sh_mobile_ceu_probe(struct platform_device *pdev) +{ + struct sh_mobile_ceu_dev *pcdev; + struct resource *res; + void __iomem *base; + unsigned int irq; + int err = 0; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + irq = platform_get_irq(pdev, 0); + if (!res || !irq) { + dev_err(&pdev->dev, "Not enough CEU platform resources.\n"); + err = -ENODEV; + goto exit; + } + + pcdev = kzalloc(sizeof(*pcdev), GFP_KERNEL); + if (!pcdev) { + dev_err(&pdev->dev, "Could not allocate pcdev\n"); + err = -ENOMEM; + goto exit; + } + + platform_set_drvdata(pdev, pcdev); + INIT_LIST_HEAD(&pcdev->capture); + spin_lock_init(&pcdev->lock); + + pcdev->pdata = pdev->dev.platform_data; + if (!pcdev->pdata) { + err = -EINVAL; + dev_err(&pdev->dev, "CEU platform data not set.\n"); + goto exit_kfree; + } + + base = ioremap_nocache(res->start, res->end - res->start + 1); + if (!base) { + err = -ENXIO; + dev_err(&pdev->dev, "Unable to ioremap CEU registers.\n"); + goto exit_kfree; + } + + pcdev->irq = irq; + pcdev->base = base; + pcdev->video_limit = 0; /* only enabled if second resource exists */ + pcdev->dev = &pdev->dev; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 1); + if (res) { + err = dma_declare_coherent_memory(&pdev->dev, res->start, + res->start, + (res->end - res->start) + 1, + DMA_MEMORY_MAP | + DMA_MEMORY_EXCLUSIVE); + if (!err) { + dev_err(&pdev->dev, "Unable to declare CEU memory.\n"); + err = -ENXIO; + goto exit_iounmap; + } + + pcdev->video_limit = (res->end - res->start) + 1; + } + + /* request irq */ + err = request_irq(pcdev->irq, sh_mobile_ceu_irq, IRQF_DISABLED, + pdev->dev.bus_id, pcdev); + if (err) { + dev_err(&pdev->dev, "Unable to register CEU interrupt.\n"); + goto exit_release_mem; + } + + pcdev->ici.priv = pcdev; + pcdev->ici.dev.parent = &pdev->dev; + pcdev->ici.nr = pdev->id; + pcdev->ici.drv_name = pdev->dev.bus_id, + pcdev->ici.ops = &sh_mobile_ceu_host_ops, + + err = soc_camera_host_register(&pcdev->ici); + if (err) + goto exit_free_irq; + + return 0; + +exit_free_irq: + free_irq(pcdev->irq, pcdev); +exit_release_mem: + if (platform_get_resource(pdev, IORESOURCE_MEM, 1)) + dma_release_declared_memory(&pdev->dev); +exit_iounmap: + iounmap(base); +exit_kfree: + kfree(pcdev); +exit: + return err; +} + +static int sh_mobile_ceu_remove(struct platform_device *pdev) +{ + struct sh_mobile_ceu_dev *pcdev = platform_get_drvdata(pdev); + + soc_camera_host_unregister(&pcdev->ici); + free_irq(pcdev->irq, pcdev); + if (platform_get_resource(pdev, IORESOURCE_MEM, 1)) + dma_release_declared_memory(&pdev->dev); + iounmap(pcdev->base); + kfree(pcdev); + return 0; +} + +static struct platform_driver sh_mobile_ceu_driver = { + .driver = { + .name = "sh_mobile_ceu", + }, + .probe = sh_mobile_ceu_probe, + .remove = sh_mobile_ceu_remove, +}; + +static int __init sh_mobile_ceu_init(void) +{ + return platform_driver_register(&sh_mobile_ceu_driver); +} + +static void __exit sh_mobile_ceu_exit(void) +{ + return platform_driver_unregister(&sh_mobile_ceu_driver); +} + +module_init(sh_mobile_ceu_init); +module_exit(sh_mobile_ceu_exit); + +MODULE_DESCRIPTION("SuperH Mobile CEU driver"); +MODULE_AUTHOR("Magnus Damm"); +MODULE_LICENSE("GPL"); diff --git a/linux/drivers/media/video/sn9c102/sn9c102.h b/linux/drivers/media/video/sn9c102/sn9c102.h index 491a803e5..bcb7ed001 100644 --- a/linux/drivers/media/video/sn9c102/sn9c102.h +++ b/linux/drivers/media/video/sn9c102/sn9c102.h @@ -25,6 +25,7 @@ #include <linux/usb.h> #include <linux/videodev2.h> #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <linux/device.h> #include <linux/list.h> #include <linux/spinlock.h> diff --git a/linux/drivers/media/video/sn9c102/sn9c102_core.c b/linux/drivers/media/video/sn9c102/sn9c102_core.c index 6747c4d7c..ea062da55 100644 --- a/linux/drivers/media/video/sn9c102/sn9c102_core.c +++ b/linux/drivers/media/video/sn9c102/sn9c102_core.c @@ -1042,8 +1042,7 @@ static ssize_t sn9c102_show_reg(struct device* cd, if (mutex_lock_interruptible(&sn9c102_sysfs_lock)) return -ERESTARTSYS; - cam = video_get_drvdata(container_of(cd, struct video_device, - class_dev)); + cam = video_get_drvdata(container_of(cd, struct video_device, dev)); if (!cam) { mutex_unlock(&sn9c102_sysfs_lock); return -ENODEV; @@ -1068,8 +1067,7 @@ sn9c102_store_reg(struct device* cd, struct device_attribute *attr, if (mutex_lock_interruptible(&sn9c102_sysfs_lock)) return -ERESTARTSYS; - cam = video_get_drvdata(container_of(cd, struct video_device, - class_dev)); + cam = video_get_drvdata(container_of(cd, struct video_device, dev)); if (!cam) { mutex_unlock(&sn9c102_sysfs_lock); return -ENODEV; @@ -1102,8 +1100,7 @@ static ssize_t sn9c102_show_val(struct device* cd, if (mutex_lock_interruptible(&sn9c102_sysfs_lock)) return -ERESTARTSYS; - cam = video_get_drvdata(container_of(cd, struct video_device, - class_dev)); + cam = video_get_drvdata(container_of(cd, struct video_device, dev)); if (!cam) { mutex_unlock(&sn9c102_sysfs_lock); return -ENODEV; @@ -1136,8 +1133,7 @@ sn9c102_store_val(struct device* cd, struct device_attribute *attr, if (mutex_lock_interruptible(&sn9c102_sysfs_lock)) return -ERESTARTSYS; - cam = video_get_drvdata(container_of(cd, struct video_device, - class_dev)); + cam = video_get_drvdata(container_of(cd, struct video_device, dev)); if (!cam) { mutex_unlock(&sn9c102_sysfs_lock); return -ENODEV; @@ -1174,8 +1170,7 @@ static ssize_t sn9c102_show_i2c_reg(struct device* cd, if (mutex_lock_interruptible(&sn9c102_sysfs_lock)) return -ERESTARTSYS; - cam = video_get_drvdata(container_of(cd, struct video_device, - class_dev)); + cam = video_get_drvdata(container_of(cd, struct video_device, dev)); if (!cam) { mutex_unlock(&sn9c102_sysfs_lock); return -ENODEV; @@ -1202,8 +1197,7 @@ sn9c102_store_i2c_reg(struct device* cd, struct device_attribute *attr, if (mutex_lock_interruptible(&sn9c102_sysfs_lock)) return -ERESTARTSYS; - cam = video_get_drvdata(container_of(cd, struct video_device, - class_dev)); + cam = video_get_drvdata(container_of(cd, struct video_device, dev)); if (!cam) { mutex_unlock(&sn9c102_sysfs_lock); return -ENODEV; @@ -1236,8 +1230,7 @@ static ssize_t sn9c102_show_i2c_val(struct device* cd, if (mutex_lock_interruptible(&sn9c102_sysfs_lock)) return -ERESTARTSYS; - cam = video_get_drvdata(container_of(cd, struct video_device, - class_dev)); + cam = video_get_drvdata(container_of(cd, struct video_device, dev)); if (!cam) { mutex_unlock(&sn9c102_sysfs_lock); return -ENODEV; @@ -1275,8 +1268,7 @@ sn9c102_store_i2c_val(struct device* cd, struct device_attribute *attr, if (mutex_lock_interruptible(&sn9c102_sysfs_lock)) return -ERESTARTSYS; - cam = video_get_drvdata(container_of(cd, struct video_device, - class_dev)); + cam = video_get_drvdata(container_of(cd, struct video_device, dev)); if (!cam) { mutex_unlock(&sn9c102_sysfs_lock); return -ENODEV; @@ -1322,8 +1314,7 @@ sn9c102_store_green(struct device* cd, struct device_attribute *attr, if (mutex_lock_interruptible(&sn9c102_sysfs_lock)) return -ERESTARTSYS; - cam = video_get_drvdata(container_of(cd, struct video_device, - class_dev)); + cam = video_get_drvdata(container_of(cd, struct video_device, dev)); if (!cam) { mutex_unlock(&sn9c102_sysfs_lock); return -ENODEV; @@ -1404,8 +1395,7 @@ static ssize_t sn9c102_show_frame_header(struct device* cd, struct sn9c102_device* cam; ssize_t count; - cam = video_get_drvdata(container_of(cd, struct video_device, - class_dev)); + cam = video_get_drvdata(container_of(cd, struct video_device, dev)); if (!cam) return -ENODEV; @@ -1432,49 +1422,49 @@ static DEVICE_ATTR(frame_header, S_IRUGO, sn9c102_show_frame_header, NULL); static int sn9c102_create_sysfs(struct sn9c102_device* cam) { - struct device *classdev = &(cam->v4ldev->class_dev); + struct device *dev = &(cam->v4ldev->dev); int err = 0; - if ((err = device_create_file(classdev, &dev_attr_reg))) + if ((err = device_create_file(dev, &dev_attr_reg))) goto err_out; - if ((err = device_create_file(classdev, &dev_attr_val))) + if ((err = device_create_file(dev, &dev_attr_val))) goto err_reg; - if ((err = device_create_file(classdev, &dev_attr_frame_header))) + if ((err = device_create_file(dev, &dev_attr_frame_header))) goto err_val; if (cam->sensor.sysfs_ops) { - if ((err = device_create_file(classdev, &dev_attr_i2c_reg))) + if ((err = device_create_file(dev, &dev_attr_i2c_reg))) goto err_frame_header; - if ((err = device_create_file(classdev, &dev_attr_i2c_val))) + if ((err = device_create_file(dev, &dev_attr_i2c_val))) goto err_i2c_reg; } if (cam->bridge == BRIDGE_SN9C101 || cam->bridge == BRIDGE_SN9C102) { - if ((err = device_create_file(classdev, &dev_attr_green))) + if ((err = device_create_file(dev, &dev_attr_green))) goto err_i2c_val; } else { - if ((err = device_create_file(classdev, &dev_attr_blue))) + if ((err = device_create_file(dev, &dev_attr_blue))) goto err_i2c_val; - if ((err = device_create_file(classdev, &dev_attr_red))) + if ((err = device_create_file(dev, &dev_attr_red))) goto err_blue; } return 0; err_blue: - device_remove_file(classdev, &dev_attr_blue); + device_remove_file(dev, &dev_attr_blue); err_i2c_val: if (cam->sensor.sysfs_ops) - device_remove_file(classdev, &dev_attr_i2c_val); + device_remove_file(dev, &dev_attr_i2c_val); err_i2c_reg: if (cam->sensor.sysfs_ops) - device_remove_file(classdev, &dev_attr_i2c_reg); + device_remove_file(dev, &dev_attr_i2c_reg); err_frame_header: - device_remove_file(classdev, &dev_attr_frame_header); + device_remove_file(dev, &dev_attr_frame_header); err_val: - device_remove_file(classdev, &dev_attr_val); + device_remove_file(dev, &dev_attr_val); err_reg: - device_remove_file(classdev, &dev_attr_reg); + device_remove_file(dev, &dev_attr_reg); err_out: return err; } diff --git a/linux/drivers/media/video/sn9c102/sn9c102_devtable.h b/linux/drivers/media/video/sn9c102/sn9c102_devtable.h index 35223e0d7..6ff489baa 100644 --- a/linux/drivers/media/video/sn9c102/sn9c102_devtable.h +++ b/linux/drivers/media/video/sn9c102/sn9c102_devtable.h @@ -44,7 +44,6 @@ static const struct usb_device_id sn9c102_id_table[] = { { SN9C102_USB_DEVICE(0x0c45, 0x6005, BRIDGE_SN9C102), }, { SN9C102_USB_DEVICE(0x0c45, 0x6007, BRIDGE_SN9C102), }, { SN9C102_USB_DEVICE(0x0c45, 0x6009, BRIDGE_SN9C102), }, - { SN9C102_USB_DEVICE(0x0c45, 0x6011, BRIDGE_SN9C102), }, { SN9C102_USB_DEVICE(0x0c45, 0x600d, BRIDGE_SN9C102), }, { SN9C102_USB_DEVICE(0x0c45, 0x6019, BRIDGE_SN9C102), }, { SN9C102_USB_DEVICE(0x0c45, 0x6024, BRIDGE_SN9C102), }, @@ -57,7 +56,6 @@ static const struct usb_device_id sn9c102_id_table[] = { { SN9C102_USB_DEVICE(0x0c45, 0x602d, BRIDGE_SN9C102), }, { SN9C102_USB_DEVICE(0x0c45, 0x602e, BRIDGE_SN9C102), }, { SN9C102_USB_DEVICE(0x0c45, 0x6030, BRIDGE_SN9C102), }, - { SN9C102_USB_DEVICE(0x0c45, 0x603f, BRIDGE_SN9C102), }, /* SN9C103 */ { SN9C102_USB_DEVICE(0x0c45, 0x6080, BRIDGE_SN9C103), }, { SN9C102_USB_DEVICE(0x0c45, 0x6082, BRIDGE_SN9C103), }, diff --git a/linux/drivers/media/video/soc_camera.c b/linux/drivers/media/video/soc_camera.c index 8ae2d9916..b01749088 100644 --- a/linux/drivers/media/video/soc_camera.c +++ b/linux/drivers/media/video/soc_camera.c @@ -25,7 +25,9 @@ #include <linux/vmalloc.h> #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <media/v4l2-dev.h> +#include <media/videobuf-core.h> #include <media/soc_camera.h> static LIST_HEAD(hosts); @@ -182,7 +184,6 @@ static int soc_camera_open(struct inode *inode, struct file *file) struct soc_camera_device *icd; struct soc_camera_host *ici; struct soc_camera_file *icf; - spinlock_t *lock; int ret; icf = vmalloc(sizeof(*icf)); @@ -193,7 +194,7 @@ static int soc_camera_open(struct inode *inode, struct file *file) mutex_lock(&video_lock); vdev = video_devdata(file); - icd = container_of(vdev->dev, struct soc_camera_device, dev); + icd = container_of(vdev->parent, struct soc_camera_device, dev); ici = to_soc_camera_host(icd->dev.parent); if (!try_module_get(icd->ops->owner)) { @@ -209,13 +210,6 @@ static int soc_camera_open(struct inode *inode, struct file *file) } icf->icd = icd; - - icf->lock = ici->ops->spinlock_alloc(icf); - if (!icf->lock) { - ret = -ENOMEM; - goto esla; - } - icd->use_count++; /* Now we really have to activate the camera */ @@ -233,21 +227,12 @@ static int soc_camera_open(struct inode *inode, struct file *file) file->private_data = icf; dev_dbg(&icd->dev, "camera device open\n"); - /* We must pass NULL as dev pointer, then all pci_* dma operations - * transform to normal dma_* ones. */ - videobuf_queue_sg_init(&icf->vb_vidq, ici->vbq_ops, NULL, icf->lock, - V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_NONE, - ici->msize, icd); + ici->ops->init_videobuf(&icf->vb_vidq, icd); return 0; /* All errors are entered with the video_lock held */ eiciadd: - lock = icf->lock; - icf->lock = NULL; - if (ici->ops->spinlock_free) - ici->ops->spinlock_free(lock); -esla: module_put(ici->ops->owner); emgi: module_put(icd->ops->owner); @@ -263,22 +248,18 @@ static int soc_camera_close(struct inode *inode, struct file *file) struct soc_camera_device *icd = icf->icd; struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); struct video_device *vdev = icd->vdev; - spinlock_t *lock = icf->lock; mutex_lock(&video_lock); icd->use_count--; if (!icd->use_count) ici->ops->remove(icd); - icf->lock = NULL; - if (ici->ops->spinlock_free) - ici->ops->spinlock_free(lock); module_put(icd->ops->owner); module_put(ici->ops->owner); mutex_unlock(&video_lock); vfree(icf); - dev_dbg(vdev->dev, "camera device close\n"); + dev_dbg(vdev->parent, "camera device close\n"); return 0; } @@ -291,7 +272,7 @@ static ssize_t soc_camera_read(struct file *file, char __user *buf, struct video_device *vdev = icd->vdev; int err = -EINVAL; - dev_err(vdev->dev, "camera device read not implemented\n"); + dev_err(vdev->parent, "camera device read not implemented\n"); return err; } @@ -767,27 +748,12 @@ static void dummy_release(struct device *dev) { } -static spinlock_t *spinlock_alloc(struct soc_camera_file *icf) -{ - spinlock_t *lock = kmalloc(sizeof(spinlock_t), GFP_KERNEL); - - if (lock) - spin_lock_init(lock); - - return lock; -} - -static void spinlock_free(spinlock_t *lock) -{ - kfree(lock); -} - int soc_camera_host_register(struct soc_camera_host *ici) { int ret; struct soc_camera_host *ix; - if (!ici->vbq_ops || !ici->ops->add || !ici->ops->remove) + if (!ici->ops->init_videobuf || !ici->ops->add || !ici->ops->remove) return -EINVAL; /* Number might be equal to the platform device ID */ @@ -811,11 +777,6 @@ int soc_camera_host_register(struct soc_camera_host *ici) if (ret) goto edevr; - if (!ici->ops->spinlock_alloc) { - ici->ops->spinlock_alloc = spinlock_alloc; - ici->ops->spinlock_free = spinlock_free; - } - scan_add_host(ici); return 0; @@ -917,7 +878,7 @@ int soc_camera_video_start(struct soc_camera_device *icd) strlcpy(vdev->name, ici->drv_name, sizeof(vdev->name)); /* Maybe better &ici->dev */ - vdev->dev = &icd->dev; + vdev->parent = &icd->dev; vdev->type = VID_TYPE_CAPTURE; vdev->current_norm = V4L2_STD_UNKNOWN; vdev->fops = &soc_camera_fops; @@ -955,7 +916,7 @@ int soc_camera_video_start(struct soc_camera_device *icd) err = video_register_device(vdev, VFL_TYPE_GRABBER, vdev->minor); if (err < 0) { - dev_err(vdev->dev, "video_register_device failed\n"); + dev_err(vdev->parent, "video_register_device failed\n"); goto evidregd; } icd->vdev = vdev; diff --git a/linux/drivers/media/video/soc_camera_platform.c b/linux/drivers/media/video/soc_camera_platform.c new file mode 100644 index 000000000..eefb0327e --- /dev/null +++ b/linux/drivers/media/video/soc_camera_platform.c @@ -0,0 +1,198 @@ +/* + * Generic Platform Camera Driver + * + * Copyright (C) 2008 Magnus Damm + * Based on mt9m001 driver, + * Copyright (C) 2008, Guennadi Liakhovetski <kernel@pengutronix.de> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include <linux/init.h> +#include <linux/module.h> +#include <linux/slab.h> +#include <linux/delay.h> +#include <linux/platform_device.h> +#include <linux/videodev2.h> +#include <media/v4l2-common.h> +#include <media/soc_camera.h> + +struct soc_camera_platform_info { + int iface; + char *format_name; + unsigned long format_depth; + struct v4l2_pix_format format; + unsigned long bus_param; + int (*set_capture)(struct soc_camera_platform_info *info, int enable); +}; + +struct soc_camera_platform_priv { + struct soc_camera_platform_info *info; + struct soc_camera_device icd; + struct soc_camera_data_format format; +}; + +static struct soc_camera_platform_info * +soc_camera_platform_get_info(struct soc_camera_device *icd) +{ + struct soc_camera_platform_priv *priv; + priv = container_of(icd, struct soc_camera_platform_priv, icd); + return priv->info; +} + +static int soc_camera_platform_init(struct soc_camera_device *icd) +{ + return 0; +} + +static int soc_camera_platform_release(struct soc_camera_device *icd) +{ + return 0; +} + +static int soc_camera_platform_start_capture(struct soc_camera_device *icd) +{ + struct soc_camera_platform_info *p = soc_camera_platform_get_info(icd); + return p->set_capture(p, 1); +} + +static int soc_camera_platform_stop_capture(struct soc_camera_device *icd) +{ + struct soc_camera_platform_info *p = soc_camera_platform_get_info(icd); + return p->set_capture(p, 0); +} + +static int soc_camera_platform_set_bus_param(struct soc_camera_device *icd, + unsigned long flags) +{ + return 0; +} + +static unsigned long +soc_camera_platform_query_bus_param(struct soc_camera_device *icd) +{ + struct soc_camera_platform_info *p = soc_camera_platform_get_info(icd); + return p->bus_param; +} + +static int soc_camera_platform_set_fmt_cap(struct soc_camera_device *icd, + __u32 pixfmt, struct v4l2_rect *rect) +{ + return 0; +} + +static int soc_camera_platform_try_fmt_cap(struct soc_camera_device *icd, + struct v4l2_format *f) +{ + struct soc_camera_platform_info *p = soc_camera_platform_get_info(icd); + + f->fmt.pix.width = p->format.width; + f->fmt.pix.height = p->format.height; + return 0; +} + +static int soc_camera_platform_video_probe(struct soc_camera_device *icd) +{ + struct soc_camera_platform_priv *priv; + priv = container_of(icd, struct soc_camera_platform_priv, icd); + + priv->format.name = priv->info->format_name; + priv->format.depth = priv->info->format_depth; + priv->format.fourcc = priv->info->format.pixelformat; + priv->format.colorspace = priv->info->format.colorspace; + + icd->formats = &priv->format; + icd->num_formats = 1; + + return soc_camera_video_start(icd); +} + +static void soc_camera_platform_video_remove(struct soc_camera_device *icd) +{ + soc_camera_video_stop(icd); +} + +static struct soc_camera_ops soc_camera_platform_ops = { + .owner = THIS_MODULE, + .probe = soc_camera_platform_video_probe, + .remove = soc_camera_platform_video_remove, + .init = soc_camera_platform_init, + .release = soc_camera_platform_release, + .start_capture = soc_camera_platform_start_capture, + .stop_capture = soc_camera_platform_stop_capture, + .set_fmt_cap = soc_camera_platform_set_fmt_cap, + .try_fmt_cap = soc_camera_platform_try_fmt_cap, + .set_bus_param = soc_camera_platform_set_bus_param, + .query_bus_param = soc_camera_platform_query_bus_param, +}; + +static int soc_camera_platform_probe(struct platform_device *pdev) +{ + struct soc_camera_platform_priv *priv; + struct soc_camera_platform_info *p; + struct soc_camera_device *icd; + int ret; + + p = pdev->dev.platform_data; + if (!p) + return -EINVAL; + + priv = kzalloc(sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + priv->info = p; + platform_set_drvdata(pdev, priv); + + icd = &priv->icd; + icd->ops = &soc_camera_platform_ops; + icd->control = &pdev->dev; + icd->width_min = 0; + icd->width_max = priv->info->format.width; + icd->height_min = 0; + icd->height_max = priv->info->format.height; + icd->y_skip_top = 0; + icd->iface = priv->info->iface; + + ret = soc_camera_device_register(icd); + if (ret) + kfree(priv); + + return ret; +} + +static int soc_camera_platform_remove(struct platform_device *pdev) +{ + struct soc_camera_platform_priv *priv = platform_get_drvdata(pdev); + + soc_camera_device_unregister(&priv->icd); + kfree(priv); + return 0; +} + +static struct platform_driver soc_camera_platform_driver = { + .driver = { + .name = "soc_camera_platform", + }, + .probe = soc_camera_platform_probe, + .remove = soc_camera_platform_remove, +}; + +static int __init soc_camera_platform_module_init(void) +{ + return platform_driver_register(&soc_camera_platform_driver); +} + +static void __exit soc_camera_platform_module_exit(void) +{ + return platform_driver_unregister(&soc_camera_platform_driver); +} + +module_init(soc_camera_platform_module_init); +module_exit(soc_camera_platform_module_exit); + +MODULE_DESCRIPTION("SoC Camera Platform driver"); +MODULE_AUTHOR("Magnus Damm"); +MODULE_LICENSE("GPL v2"); diff --git a/linux/drivers/media/video/stk-webcam.c b/linux/drivers/media/video/stk-webcam.c index 28abeec05..0c605632b 100644 --- a/linux/drivers/media/video/stk-webcam.c +++ b/linux/drivers/media/video/stk-webcam.c @@ -35,6 +35,7 @@ #include "compat.h" #include <linux/videodev2.h> #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include "stk-webcam.h" @@ -1370,7 +1371,7 @@ static int stk_register_video_device(struct stk_camera *dev) dev->vdev = stk_v4l_data; dev->vdev.debug = debug; - dev->vdev.dev = &dev->interface->dev; + dev->vdev.parent = &dev->interface->dev; dev->vdev.priv = dev; err = video_register_device(&dev->vdev, VFL_TYPE_GRABBER, -1); if (err) diff --git a/linux/drivers/media/video/stradis.c b/linux/drivers/media/video/stradis.c index 67702588c..7f46a1d64 100644 --- a/linux/drivers/media/video/stradis.c +++ b/linux/drivers/media/video/stradis.c @@ -43,6 +43,7 @@ #include <linux/vmalloc.h> #include <linux/videodev.h> #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include "saa7146.h" #include "saa7146reg.h" diff --git a/linux/drivers/media/video/stv680.c b/linux/drivers/media/video/stv680.c index 7aa94abfd..29c62e534 100644 --- a/linux/drivers/media/video/stv680.c +++ b/linux/drivers/media/video/stv680.c @@ -66,6 +66,7 @@ #include <linux/errno.h> #include <linux/videodev.h> #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <linux/usb.h> #include <linux/mutex.h> #include "compat.h" @@ -1459,7 +1460,7 @@ static int stv680_probe (struct usb_interface *intf, const struct usb_device_id goto error; } memcpy(stv680->vdev, &stv680_template, sizeof(stv680_template)); - stv680->vdev->dev = &intf->dev; + stv680->vdev->parent = &intf->dev; video_set_drvdata(stv680->vdev, stv680); memcpy (stv680->vdev->name, stv680->camera_name, strlen (stv680->camera_name)); diff --git a/linux/drivers/media/video/tda7432.c b/linux/drivers/media/video/tda7432.c index 29bcbd0f7..1e70a7710 100644 --- a/linux/drivers/media/video/tda7432.c +++ b/linux/drivers/media/video/tda7432.c @@ -48,6 +48,7 @@ #include <linux/i2c.h> #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <media/i2c-addr.h> #include "compat.h" diff --git a/linux/drivers/media/video/tuner-core.c b/linux/drivers/media/video/tuner-core.c index 60d26aa03..9649281a9 100644 --- a/linux/drivers/media/video/tuner-core.c +++ b/linux/drivers/media/video/tuner-core.c @@ -20,6 +20,7 @@ #include <media/tuner.h> #include <media/tuner-types.h> #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <media/v4l2-i2c-drv-legacy.h> #include "mt20xx.h" #include "tda8290.h" diff --git a/linux/drivers/media/video/tvmixer.c b/linux/drivers/media/video/tvmixer.c index b50e0942e..d7b931fd3 100644 --- a/linux/drivers/media/video/tvmixer.c +++ b/linux/drivers/media/video/tvmixer.c @@ -286,7 +286,11 @@ static int tvmixer_clients(struct i2c_client *client) return -1; /* everything is fine, register */ - if ((minor = register_sound_mixer(&tvmixer_fops,devnr)) < 0) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 17) + if ((minor = register_sound_mixer(&tvmixer_fops, devnr)) < 0) { +#else + if ((minor = register_sound_mixer((struct file_operations *)&tvmixer_fops, devnr)) < 0) { +#endif printk(KERN_ERR "tvmixer: cannot allocate mixer device\n"); return -1; } diff --git a/linux/drivers/media/video/usbvideo/usbvideo.c b/linux/drivers/media/video/usbvideo/usbvideo.c index f1aafd97d..f399db543 100644 --- a/linux/drivers/media/video/usbvideo/usbvideo.c +++ b/linux/drivers/media/video/usbvideo/usbvideo.c @@ -1040,7 +1040,7 @@ int usbvideo_RegisterVideoDevice(struct uvd *uvd) err("%s: uvd->dev == NULL", __func__); return -EINVAL; } - uvd->vdev.dev = &uvd->dev->dev; + uvd->vdev.parent = &uvd->dev->dev; if (video_register_device(&uvd->vdev, VFL_TYPE_GRABBER, video_nr) == -1) { err("%s: video_register_device failed", __func__); return -EPIPE; diff --git a/linux/drivers/media/video/usbvideo/usbvideo.h b/linux/drivers/media/video/usbvideo/usbvideo.h index 03b3add3d..b5f5f53bf 100644 --- a/linux/drivers/media/video/usbvideo/usbvideo.h +++ b/linux/drivers/media/video/usbvideo/usbvideo.h @@ -18,6 +18,7 @@ #include <linux/videodev.h> #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <linux/usb.h> #include <linux/mutex.h> #include "compat.h" diff --git a/linux/drivers/media/video/usbvideo/vicam.c b/linux/drivers/media/video/usbvideo/vicam.c index 17f542dfb..2aa05f7ca 100644 --- a/linux/drivers/media/video/usbvideo/vicam.c +++ b/linux/drivers/media/video/usbvideo/vicam.c @@ -43,6 +43,10 @@ #include <linux/vmalloc.h> #include <linux/slab.h> #include <linux/mutex.h> +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) +#include <linux/firmware.h> +#include <linux/ihex.h> +#endif #include "usbvideo.h" // #define VICAM_DEBUG @@ -70,6 +74,7 @@ #define VICAM_HEADER_SIZE 64 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) /* Not sure what all the bytes in these char * arrays do, but they're necessary to make * the camera work. @@ -348,6 +353,7 @@ static unsigned char setup5[] = { 0x46, 0x05, 0x6C, 0x05, 0x00, 0x00 }; +#endif /* rvmalloc / rvfree copied from usbvideo.c * * Not sure why these are not yet non-statics which I can reference through @@ -464,6 +470,7 @@ static int send_control_msg(struct vicam_camera *cam, static int initialize_camera(struct vicam_camera *cam) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) const struct { u8 *data; u32 size; @@ -478,14 +485,41 @@ initialize_camera(struct vicam_camera *cam) }; int err, i; +#else + int err; + const struct ihex_binrec *rec; + const struct firmware *fw; + + err = request_ihex_firmware(&fw, "vicam/firmware.fw", &cam->udev->dev); + if (err) { + printk(KERN_ERR "Failed to load \"vicam/firmware.fw\": %d\n", + err); + return err; + } +#endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) for (i = 0, err = 0; firmware[i].data && !err; i++) { memcpy(cam->cntrlbuf, firmware[i].data, firmware[i].size); +#else + for (rec = (void *)fw->data; rec; rec = ihex_next_binrec(rec)) { + memcpy(cam->cntrlbuf, rec->data, be16_to_cpu(rec->len)); +#endif err = send_control_msg(cam, 0xff, 0, 0, +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) cam->cntrlbuf, firmware[i].size); +#else + cam->cntrlbuf, be16_to_cpu(rec->len)); + if (err) + break; +#endif } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) + release_firmware(fw); + +#endif return err; } @@ -1226,3 +1260,6 @@ module_exit(usb_vicam_exit); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27) +MODULE_FIRMWARE("vicam/firmware.fw"); +#endif diff --git a/linux/drivers/media/video/usbvision/usbvision-video.c b/linux/drivers/media/video/usbvision/usbvision-video.c index cd6c41d67..56cd685d3 100644 --- a/linux/drivers/media/video/usbvision/usbvision-video.c +++ b/linux/drivers/media/video/usbvision/usbvision-video.c @@ -65,6 +65,7 @@ #include <media/saa7115.h> #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <media/tuner.h> #include <media/audiochip.h> @@ -184,7 +185,7 @@ MODULE_ALIAS(DRIVER_ALIAS); static inline struct usb_usbvision *cd_to_usbvision(struct device *cd) { struct video_device *vdev = - container_of(cd, struct video_device, class_dev); + container_of(cd, struct video_device, dev); return video_get_drvdata(vdev); } @@ -199,7 +200,7 @@ static ssize_t show_model(struct device *cd, struct device_attribute *attr, char *buf) { struct video_device *vdev = - container_of(cd, struct video_device, class_dev); + container_of(cd, struct video_device, dev); struct usb_usbvision *usbvision = video_get_drvdata(vdev); return sprintf(buf, "%s\n", usbvision_device_data[usbvision->DevModel].ModelString); @@ -210,7 +211,7 @@ static ssize_t show_hue(struct device *cd, struct device_attribute *attr, char *buf) { struct video_device *vdev = - container_of(cd, struct video_device, class_dev); + container_of(cd, struct video_device, dev); struct usb_usbvision *usbvision = video_get_drvdata(vdev); struct v4l2_control ctrl; ctrl.id = V4L2_CID_HUE; @@ -225,7 +226,7 @@ static ssize_t show_contrast(struct device *cd, struct device_attribute *attr, char *buf) { struct video_device *vdev = - container_of(cd, struct video_device, class_dev); + container_of(cd, struct video_device, dev); struct usb_usbvision *usbvision = video_get_drvdata(vdev); struct v4l2_control ctrl; ctrl.id = V4L2_CID_CONTRAST; @@ -240,7 +241,7 @@ static ssize_t show_brightness(struct device *cd, struct device_attribute *attr, char *buf) { struct video_device *vdev = - container_of(cd, struct video_device, class_dev); + container_of(cd, struct video_device, dev); struct usb_usbvision *usbvision = video_get_drvdata(vdev); struct v4l2_control ctrl; ctrl.id = V4L2_CID_BRIGHTNESS; @@ -255,7 +256,7 @@ static ssize_t show_saturation(struct device *cd, struct device_attribute *attr, char *buf) { struct video_device *vdev = - container_of(cd, struct video_device, class_dev); + container_of(cd, struct video_device, dev); struct usb_usbvision *usbvision = video_get_drvdata(vdev); struct v4l2_control ctrl; ctrl.id = V4L2_CID_SATURATION; @@ -270,7 +271,7 @@ static ssize_t show_streaming(struct device *cd, struct device_attribute *attr, char *buf) { struct video_device *vdev = - container_of(cd, struct video_device, class_dev); + container_of(cd, struct video_device, dev); struct usb_usbvision *usbvision = video_get_drvdata(vdev); return sprintf(buf, "%s\n", YES_NO(usbvision->streaming==Stream_On?1:0)); @@ -281,7 +282,7 @@ static ssize_t show_compression(struct device *cd, struct device_attribute *attr, char *buf) { struct video_device *vdev = - container_of(cd, struct video_device, class_dev); + container_of(cd, struct video_device, dev); struct usb_usbvision *usbvision = video_get_drvdata(vdev); return sprintf(buf, "%s\n", YES_NO(usbvision->isocMode==ISOC_MODE_COMPRESS)); @@ -292,7 +293,7 @@ static ssize_t show_device_bridge(struct device *cd, struct device_attribute *attr, char *buf) { struct video_device *vdev = - container_of(cd, struct video_device, class_dev); + container_of(cd, struct video_device, dev); struct usb_usbvision *usbvision = video_get_drvdata(vdev); return sprintf(buf, "%d\n", usbvision->bridgeType); } @@ -304,40 +305,31 @@ static void usbvision_create_sysfs(struct video_device *vdev) if (!vdev) return; do { - res = device_create_file(&vdev->class_dev, - &dev_attr_version); + res = device_create_file(&vdev->dev, &dev_attr_version); if (res<0) break; - res = device_create_file(&vdev->class_dev, - &dev_attr_model); + res = device_create_file(&vdev->dev, &dev_attr_model); if (res<0) break; - res = device_create_file(&vdev->class_dev, - &dev_attr_hue); + res = device_create_file(&vdev->dev, &dev_attr_hue); if (res<0) break; - res = device_create_file(&vdev->class_dev, - &dev_attr_contrast); + res = device_create_file(&vdev->dev, &dev_attr_contrast); if (res<0) break; - res = device_create_file(&vdev->class_dev, - &dev_attr_brightness); + res = device_create_file(&vdev->dev, &dev_attr_brightness); if (res<0) break; - res = device_create_file(&vdev->class_dev, - &dev_attr_saturation); + res = device_create_file(&vdev->dev, &dev_attr_saturation); if (res<0) break; - res = device_create_file(&vdev->class_dev, - &dev_attr_streaming); + res = device_create_file(&vdev->dev, &dev_attr_streaming); if (res<0) break; - res = device_create_file(&vdev->class_dev, - &dev_attr_compression); + res = device_create_file(&vdev->dev, &dev_attr_compression); if (res<0) break; - res = device_create_file(&vdev->class_dev, - &dev_attr_bridge); + res = device_create_file(&vdev->dev, &dev_attr_bridge); if (res>=0) return; } while (0); @@ -348,24 +340,15 @@ static void usbvision_create_sysfs(struct video_device *vdev) static void usbvision_remove_sysfs(struct video_device *vdev) { if (vdev) { - device_remove_file(&vdev->class_dev, - &dev_attr_version); - device_remove_file(&vdev->class_dev, - &dev_attr_model); - device_remove_file(&vdev->class_dev, - &dev_attr_hue); - device_remove_file(&vdev->class_dev, - &dev_attr_contrast); - device_remove_file(&vdev->class_dev, - &dev_attr_brightness); - device_remove_file(&vdev->class_dev, - &dev_attr_saturation); - device_remove_file(&vdev->class_dev, - &dev_attr_streaming); - device_remove_file(&vdev->class_dev, - &dev_attr_compression); - device_remove_file(&vdev->class_dev, - &dev_attr_bridge); + device_remove_file(&vdev->dev, &dev_attr_version); + device_remove_file(&vdev->dev, &dev_attr_model); + device_remove_file(&vdev->dev, &dev_attr_hue); + device_remove_file(&vdev->dev, &dev_attr_contrast); + device_remove_file(&vdev->dev, &dev_attr_brightness); + device_remove_file(&vdev->dev, &dev_attr_saturation); + device_remove_file(&vdev->dev, &dev_attr_streaming); + device_remove_file(&vdev->dev, &dev_attr_compression); + device_remove_file(&vdev->dev, &dev_attr_bridge); } } @@ -1506,7 +1489,7 @@ static struct video_device *usbvision_vdev_init(struct usb_usbvision *usbvision, } *vdev = *vdev_template; // vdev->minor = -1; - vdev->dev = &usb_dev->dev; + vdev->parent = &usb_dev->dev; snprintf(vdev->name, sizeof(vdev->name), "%s", name); video_set_drvdata(vdev, usbvision); return vdev; diff --git a/linux/drivers/media/video/uvc/uvc_driver.c b/linux/drivers/media/video/uvc/uvc_driver.c index f2b2983fe..79d6821c4 100644 --- a/linux/drivers/media/video/uvc/uvc_driver.c +++ b/linux/drivers/media/video/uvc/uvc_driver.c @@ -1458,7 +1458,7 @@ static int uvc_register_video(struct uvc_device *dev) * unregistered before the reference is released, so we don't need to * get another one. */ - vdev->dev = &dev->intf->dev; + vdev->parent = &dev->intf->dev; vdev->type = 0; vdev->type2 = 0; vdev->minor = -1; diff --git a/linux/drivers/media/video/uvc/uvc_v4l2.c b/linux/drivers/media/video/uvc/uvc_v4l2.c index b5a11eb8f..d7bd71be4 100644 --- a/linux/drivers/media/video/uvc/uvc_v4l2.c +++ b/linux/drivers/media/video/uvc/uvc_v4l2.c @@ -23,6 +23,7 @@ #include <asm/atomic.h> #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include "uvcvideo.h" diff --git a/linux/drivers/media/video/v4l1-compat.c b/linux/drivers/media/video/v4l1-compat.c index 9fe2f491d..5d8a65aa5 100644 --- a/linux/drivers/media/video/v4l1-compat.c +++ b/linux/drivers/media/video/v4l1-compat.c @@ -30,6 +30,7 @@ #include <linux/slab.h> #include <linux/videodev.h> #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <asm/uaccess.h> #include <asm/system.h> diff --git a/linux/drivers/media/video/v4l2-dev.c b/linux/drivers/media/video/v4l2-dev.c new file mode 100644 index 000000000..279f436fe --- /dev/null +++ b/linux/drivers/media/video/v4l2-dev.c @@ -0,0 +1,495 @@ +/* + * Video capture interface for Linux version 2 + * + * A generic video device interface for the LINUX operating system + * using a set of device structures/vectors for low level operations. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + * Authors: Alan Cox, <alan@redhat.com> (version 1) + * Mauro Carvalho Chehab <mchehab@infradead.org> (version 2) + * + * Fixes: 20000516 Claudio Matsuoka <claudio@conectiva.com> + * - Added procfs support + */ + +#include <linux/module.h> +#include <linux/types.h> +#include <linux/kernel.h> +#include <linux/mm.h> +#include <linux/string.h> +#include <linux/errno.h> +#include <linux/init.h> +#include <linux/kmod.h> +#include <linux/slab.h> +#include <linux/smp_lock.h> +#include <asm/uaccess.h> +#include <asm/system.h> + +#include <media/v4l2-common.h> +#include "compat.h" + +#define VIDEO_NUM_DEVICES 256 +#define VIDEO_NAME "video4linux" + +/* + * sysfs stuff + */ + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19) +static ssize_t show_index(struct device *cd, + struct device_attribute *attr, char *buf) +{ + struct video_device *vfd = container_of(cd, struct video_device, dev); + return sprintf(buf, "%i\n", vfd->index); +} + +static ssize_t show_name(struct device *cd, + struct device_attribute *attr, char *buf) +{ + struct video_device *vfd = container_of(cd, struct video_device, dev); + return sprintf(buf, "%.*s\n", (int)sizeof(vfd->name), vfd->name); +} + +static struct device_attribute video_device_attrs[] = { + __ATTR(name, S_IRUGO, show_name, NULL), + __ATTR(index, S_IRUGO, show_index, NULL), + __ATTR_NULL +}; +#else +static ssize_t show_index(struct class_device *cd, char *buf) +{ + struct video_device *vfd = container_of(cd, struct video_device, dev); + return sprintf(buf, "%i\n", vfd->index); +} + +static ssize_t show_name(struct class_device *cd, char *buf) +{ + struct video_device *vfd = container_of(cd, struct video_device, dev); + return sprintf(buf, "%.*s\n", (int)sizeof(vfd->name), vfd->name); +} + +static CLASS_DEVICE_ATTR(index, S_IRUGO, show_index, NULL); +static CLASS_DEVICE_ATTR(name, S_IRUGO, show_name, NULL); +#endif + +struct video_device *video_device_alloc(void) +{ + struct video_device *vfd; + + vfd = kzalloc(sizeof(*vfd), GFP_KERNEL); + return vfd; +} +EXPORT_SYMBOL(video_device_alloc); + +void video_device_release(struct video_device *vfd) +{ + kfree(vfd); +} +EXPORT_SYMBOL(video_device_release); + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19) +static void video_release(struct class_device *cd) +#else +static void video_release(struct device *cd) +#endif +{ + struct video_device *vfd = container_of(cd, struct video_device, dev); + +#if 1 /* keep */ + /* needed until all drivers are fixed */ + if (!vfd->release) + return; +#endif + vfd->release(vfd); +} + +static struct class video_class = { + .name = VIDEO_NAME, +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19) + .release = video_release, +#else + .dev_attrs = video_device_attrs, + .dev_release = video_release, +#endif +}; + +/* + * Active devices + */ + +static struct video_device *video_device[VIDEO_NUM_DEVICES]; +static DEFINE_MUTEX(videodev_lock); + +struct video_device *video_devdata(struct file *file) +{ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20) + return video_device[iminor(file->f_dentry->d_inode)]; +#else + return video_device[iminor(file->f_path.dentry->d_inode)]; +#endif +} +EXPORT_SYMBOL(video_devdata); + +/* + * Open a video device - FIXME: Obsoleted + */ +static int video_open(struct inode *inode, struct file *file) +{ + unsigned int minor = iminor(inode); + int err = 0; + struct video_device *vfl; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 17) + const struct file_operations *old_fops; +#else + struct file_operations *old_fops; +#endif + + if (minor >= VIDEO_NUM_DEVICES) + return -ENODEV; + lock_kernel(); + mutex_lock(&videodev_lock); + vfl = video_device[minor]; + if (vfl == NULL) { + mutex_unlock(&videodev_lock); + request_module("char-major-%d-%d", VIDEO_MAJOR, minor); + mutex_lock(&videodev_lock); + vfl = video_device[minor]; + if (vfl == NULL) { + mutex_unlock(&videodev_lock); + unlock_kernel(); + return -ENODEV; + } + } + old_fops = file->f_op; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 17) + file->f_op = fops_get(vfl->fops); +#else + file->f_op = (struct file_operations *)fops_get(vfl->fops); +#endif + if (file->f_op->open) + err = file->f_op->open(inode, file); + if (err) { + fops_put(file->f_op); + file->f_op = fops_get(old_fops); + } + fops_put(old_fops); + mutex_unlock(&videodev_lock); + unlock_kernel(); + return err; +} + +/* + * open/release helper functions -- handle exclusive opens + * Should be removed soon + */ +int video_exclusive_open(struct inode *inode, struct file *file) +{ + struct video_device *vfl = video_devdata(file); + int retval = 0; + + mutex_lock(&vfl->lock); + if (vfl->users) + retval = -EBUSY; + else + vfl->users++; + mutex_unlock(&vfl->lock); + return retval; +} +EXPORT_SYMBOL(video_exclusive_open); + +int video_exclusive_release(struct inode *inode, struct file *file) +{ + struct video_device *vfl = video_devdata(file); + + vfl->users--; + return 0; +} +EXPORT_SYMBOL(video_exclusive_release); + +/** + * get_index - assign stream number based on parent device + * @vdev: video_device to assign index number to, vdev->dev should be assigned + * @num: -1 if auto assign, requested number otherwise + * + * + * returns -ENFILE if num is already in use, a free index number if + * successful. + */ +static int get_index(struct video_device *vdev, int num) +{ + u32 used = 0; + const int max_index = sizeof(used) * 8 - 1; + int i; + + /* Currently a single v4l driver instance cannot create more than + 32 devices. + Increase to u64 or an array of u32 if more are needed. */ + if (num > max_index) { + printk(KERN_ERR "videodev: %s num is too large\n", __func__); + return -EINVAL; + } + + for (i = 0; i < VIDEO_NUM_DEVICES; i++) { + if (video_device[i] != NULL && + video_device[i] != vdev && + video_device[i]->parent == vdev->parent) { + used |= 1 << video_device[i]->index; + } + } + + if (num >= 0) { + if (used & (1 << num)) + return -ENFILE; + return num; + } + + i = ffz(used); + return i > max_index ? -ENFILE : i; +} + +static const struct file_operations video_fops; + +int video_register_device(struct video_device *vfd, int type, int nr) +{ + return video_register_device_index(vfd, type, nr, -1); +} +EXPORT_SYMBOL(video_register_device); + +/** + * video_register_device - register video4linux devices + * @vfd: video device structure we want to register + * @type: type of device to register + * @nr: which device number (0 == /dev/video0, 1 == /dev/video1, ... + * -1 == first free) + * + * The registration code assigns minor numbers based on the type + * requested. -ENFILE is returned in all the device slots for this + * category are full. If not then the minor field is set and the + * driver initialize function is called (if non %NULL). + * + * Zero is returned on success. + * + * Valid types are + * + * %VFL_TYPE_GRABBER - A frame grabber + * + * %VFL_TYPE_VTX - A teletext device + * + * %VFL_TYPE_VBI - Vertical blank data (undecoded) + * + * %VFL_TYPE_RADIO - A radio card + */ + +int video_register_device_index(struct video_device *vfd, int type, int nr, + int index) +{ + int i = 0; + int base; + int end; + int ret; + char *name_base; + + switch (type) { + case VFL_TYPE_GRABBER: + base = MINOR_VFL_TYPE_GRABBER_MIN; + end = MINOR_VFL_TYPE_GRABBER_MAX+1; + name_base = "video"; + break; + case VFL_TYPE_VTX: + base = MINOR_VFL_TYPE_VTX_MIN; + end = MINOR_VFL_TYPE_VTX_MAX+1; + name_base = "vtx"; + break; + case VFL_TYPE_VBI: + base = MINOR_VFL_TYPE_VBI_MIN; + end = MINOR_VFL_TYPE_VBI_MAX+1; + name_base = "vbi"; + break; + case VFL_TYPE_RADIO: + base = MINOR_VFL_TYPE_RADIO_MIN; + end = MINOR_VFL_TYPE_RADIO_MAX+1; + name_base = "radio"; + break; + default: + printk(KERN_ERR "%s called with unknown type: %d\n", + __func__, type); + return -1; + } + + /* pick a minor number */ + mutex_lock(&videodev_lock); + if (nr >= 0 && nr < end-base) { + /* use the one the driver asked for */ + i = base + nr; + if (NULL != video_device[i]) { + mutex_unlock(&videodev_lock); + return -ENFILE; + } + } else { + /* use first free */ + for (i = base; i < end; i++) + if (NULL == video_device[i]) + break; + if (i == end) { + mutex_unlock(&videodev_lock); + return -ENFILE; + } + } + video_device[i] = vfd; + vfd->minor = i; + + ret = get_index(vfd, index); + vfd->index = ret; + + mutex_unlock(&videodev_lock); + + if (ret < 0) { + printk(KERN_ERR "%s: get_index failed\n", __func__); + goto fail_minor; + } + + mutex_init(&vfd->lock); + + /* sysfs class */ + memset(&vfd->dev, 0x00, sizeof(vfd->dev)); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 18) + vfd->dev.class = &video_class; + vfd->dev.devt = MKDEV(VIDEO_MAJOR, vfd->minor); +#endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19) + if (vfd->parent) + vfd->dev.dev = vfd->parent; + sprintf(vfd->dev.class_id, "%s%d", name_base, i - base); + ret = class_device_register(&vfd->dev); +#else + if (vfd->parent) + vfd->dev.parent = vfd->parent; + sprintf(vfd->dev.bus_id, "%s%d", name_base, i - base); + ret = device_register(&vfd->dev); +#endif + if (ret < 0) { + printk(KERN_ERR "%s: device_register failed\n", __func__); + goto fail_minor; + } +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19) + ret = class_device_create_file(&vfd->dev, + &class_device_attr_name); + if (ret < 0) { + printk(KERN_ERR "%s: class_device_create_file 'name' failed\n", + __func__); + class_device_unregister(&vfd->dev); + goto fail_minor; + } + ret = class_device_create_file(&vfd->dev, + &class_device_attr_index); + if (ret < 0) { + printk(KERN_ERR "%s: class_device_create_file 'index' failed\n", + __func__); + class_device_unregister(&vfd->dev); + goto fail_minor; + } +#endif + +#if 1 /* keep */ + /* needed until all drivers are fixed */ + if (!vfd->release) + printk(KERN_WARNING "videodev: \"%s\" has no release callback. " + "Please fix your driver for proper sysfs support, see " + "http://lwn.net/Articles/36850/\n", vfd->name); +#endif + return 0; + +fail_minor: + mutex_lock(&videodev_lock); + video_device[vfd->minor] = NULL; + vfd->minor = -1; + mutex_unlock(&videodev_lock); + return ret; +} +EXPORT_SYMBOL(video_register_device_index); + +/** + * video_unregister_device - unregister a video4linux device + * @vfd: the device to unregister + * + * This unregisters the passed device and deassigns the minor + * number. Future open calls will be met with errors. + */ + +void video_unregister_device(struct video_device *vfd) +{ + mutex_lock(&videodev_lock); + if (video_device[vfd->minor] != vfd) + panic("videodev: bad unregister"); + + video_device[vfd->minor] = NULL; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19) + class_device_unregister(&vfd->dev); +#else + device_unregister(&vfd->dev); +#endif + mutex_unlock(&videodev_lock); +} +EXPORT_SYMBOL(video_unregister_device); + +/* + * Video fs operations + */ +static const struct file_operations video_fops = { + .owner = THIS_MODULE, + .llseek = no_llseek, + .open = video_open, +}; + +/* + * Initialise video for linux + */ + +static int __init videodev_init(void) +{ + int ret; + + printk(KERN_INFO "Linux video capture interface: v2.00\n"); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 17) + if (register_chrdev(VIDEO_MAJOR, VIDEO_NAME, &video_fops)) { +#else + if (register_chrdev(VIDEO_MAJOR, VIDEO_NAME, + (struct file_operations *)&video_fops)) { +#endif + printk(KERN_WARNING "video_dev: unable to get major %d\n", VIDEO_MAJOR); + return -EIO; + } + + ret = class_register(&video_class); + if (ret < 0) { + unregister_chrdev(VIDEO_MAJOR, VIDEO_NAME); + printk(KERN_WARNING "video_dev: class_register failed\n"); + return -EIO; + } + + return 0; +} + +static void __exit videodev_exit(void) +{ + class_unregister(&video_class); + unregister_chrdev(VIDEO_MAJOR, VIDEO_NAME); +} + +module_init(videodev_init) +module_exit(videodev_exit) + +MODULE_AUTHOR("Alan Cox, Mauro Carvalho Chehab <mchehab@infradead.org>"); +MODULE_DESCRIPTION("Device registrar for Video4Linux drivers v2"); +MODULE_LICENSE("GPL"); + + +/* + * Local variables: + * c-basic-offset: 8 + * End: + */ diff --git a/linux/drivers/media/video/videodev.c b/linux/drivers/media/video/v4l2-ioctl.c index 7ac11d5fb..61c244d87 100644 --- a/linux/drivers/media/video/videodev.c +++ b/linux/drivers/media/video/v4l2-ioctl.c @@ -1,21 +1,32 @@ /* * Video capture interface for Linux version 2 * - * A generic video device interface for the LINUX operating system - * using a set of device structures/vectors for low level operations. + * A generic framework to process V4L2 ioctl commands. * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. * * Authors: Alan Cox, <alan@redhat.com> (version 1) * Mauro Carvalho Chehab <mchehab@infradead.org> (version 2) - * - * Fixes: 20000516 Claudio Matsuoka <claudio@conectiva.com> - * - Added procfs support */ +#include <linux/module.h> +#include <linux/types.h> +#include <linux/kernel.h> + +#define __OLD_VIDIOC_ /* To allow fixing old calls */ +#include <linux/videodev2.h> + +#ifdef CONFIG_VIDEO_V4L1 +#include <linux/videodev.h> +#endif +#include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> +#include <linux/video_decoder.h> +#include "compat.h" + #define dbgarg(cmd, fmt, arg...) \ do { \ if (vfd->debug & V4L2_DEBUG_IOCTL_ARG) { \ @@ -31,31 +42,6 @@ printk(KERN_DEBUG "%s: " fmt, vfd->name, ## arg);\ } while (0) -#include <linux/module.h> -#include <linux/types.h> -#include <linux/kernel.h> -#include <linux/mm.h> -#include <linux/string.h> -#include <linux/errno.h> -#include <linux/init.h> -#include <linux/kmod.h> -#include <linux/slab.h> -#include <asm/uaccess.h> -#include <asm/system.h> - -#define __OLD_VIDIOC_ /* To allow fixing old calls*/ -#include <linux/videodev2.h> - -#ifdef CONFIG_VIDEO_V4L1 -#include <linux/videodev.h> -#endif -#include <media/v4l2-common.h> -#include <linux/video_decoder.h> -#include "compat.h" - -#define VIDEO_NUM_DEVICES 256 -#define VIDEO_NAME "video4linux" - struct std_descr { v4l2_std_id std; const char *descr; @@ -373,124 +359,6 @@ void v4l_printk_ioctl(unsigned int cmd) EXPORT_SYMBOL(v4l_printk_ioctl); /* - * sysfs stuff - */ - -static ssize_t show_index(struct device *cd, - struct device_attribute *attr, char *buf) -{ - struct video_device *vfd = container_of(cd, struct video_device, - class_dev); - return sprintf(buf, "%i\n", vfd->index); -} - -static ssize_t show_name(struct device *cd, - struct device_attribute *attr, char *buf) -{ - struct video_device *vfd = container_of(cd, struct video_device, - class_dev); - return sprintf(buf, "%.*s\n", (int)sizeof(vfd->name), vfd->name); -} - -struct video_device *video_device_alloc(void) -{ - struct video_device *vfd; - - vfd = kzalloc(sizeof(*vfd),GFP_KERNEL); - return vfd; -} -EXPORT_SYMBOL(video_device_alloc); - -void video_device_release(struct video_device *vfd) -{ - kfree(vfd); -} -EXPORT_SYMBOL(video_device_release); - -static void video_release(struct device *cd) -{ - struct video_device *vfd = container_of(cd, struct video_device, - class_dev); - -#if 1 /* keep */ - /* needed until all drivers are fixed */ - if (!vfd->release) - return; -#endif - vfd->release(vfd); -} - -static struct device_attribute video_device_attrs[] = { - __ATTR(name, S_IRUGO, show_name, NULL), - __ATTR(index, S_IRUGO, show_index, NULL), - __ATTR_NULL -}; - -static struct class video_class = { - .name = VIDEO_NAME, - .dev_attrs = video_device_attrs, - .dev_release = video_release, -}; - -/* - * Active devices - */ - -static struct video_device *video_device[VIDEO_NUM_DEVICES]; -static DEFINE_MUTEX(videodev_lock); - -struct video_device* video_devdata(struct file *file) -{ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) - return video_device[iminor(file->f_dentry->d_inode)]; -#else - return video_device[iminor(file->f_path.dentry->d_inode)]; -#endif -} -EXPORT_SYMBOL(video_devdata); - -/* - * Open a video device - FIXME: Obsoleted - */ -static int video_open(struct inode *inode, struct file *file) -{ - unsigned int minor = iminor(inode); - int err = 0; - struct video_device *vfl; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17) - const struct file_operations *old_fops; -#else - struct file_operations *old_fops; -#endif - - if(minor>=VIDEO_NUM_DEVICES) - return -ENODEV; - mutex_lock(&videodev_lock); - vfl=video_device[minor]; - if(vfl==NULL) { - mutex_unlock(&videodev_lock); - request_module("char-major-%d-%d", VIDEO_MAJOR, minor); - mutex_lock(&videodev_lock); - vfl=video_device[minor]; - if (vfl==NULL) { - mutex_unlock(&videodev_lock); - return -ENODEV; - } - } - old_fops = file->f_op; - file->f_op = fops_get(vfl->fops); - if(file->f_op->open) - err = file->f_op->open(inode,file); - if (err) { - fops_put(file->f_op); - file->f_op = fops_get(old_fops); - } - fops_put(old_fops); - mutex_unlock(&videodev_lock); - return err; -} - -/* * helper function -- handles userspace copying for ioctl arguments */ @@ -557,7 +425,7 @@ video_usercopy(struct inode *inode, struct file *file, parg = sbuf; } else { /* too big to allocate from stack */ - mbuf = kmalloc(_IOC_SIZE(cmd),GFP_KERNEL); + mbuf = kmalloc(_IOC_SIZE(cmd), GFP_KERNEL); if (NULL == mbuf) return -ENOMEM; parg = mbuf; @@ -607,8 +475,7 @@ video_usercopy(struct inode *inode, struct file *file, out_ext_ctrl: /* Copy results into user buffer */ - switch (_IOC_DIR(cmd)) - { + switch (_IOC_DIR(cmd)) { case _IOC_READ: case (_IOC_WRITE | _IOC_READ): if (copy_to_user((void __user *)arg, parg, _IOC_SIZE(cmd))) @@ -622,46 +489,17 @@ out: } EXPORT_SYMBOL(video_usercopy); -/* - * open/release helper functions -- handle exclusive opens - * Should be removed soon - */ -int video_exclusive_open(struct inode *inode, struct file *file) -{ - struct video_device *vfl = video_devdata(file); - int retval = 0; - - mutex_lock(&vfl->lock); - if (vfl->users) { - retval = -EBUSY; - } else { - vfl->users++; - } - mutex_unlock(&vfl->lock); - return retval; -} -EXPORT_SYMBOL(video_exclusive_open); - -int video_exclusive_release(struct inode *inode, struct file *file) -{ - struct video_device *vfl = video_devdata(file); - - vfl->users--; - return 0; -} -EXPORT_SYMBOL(video_exclusive_release); - static void dbgbuf(unsigned int cmd, struct video_device *vfd, struct v4l2_buffer *p) { - struct v4l2_timecode *tc=&p->timecode; + struct v4l2_timecode *tc = &p->timecode; - dbgarg (cmd, "%02ld:%02d:%02d.%08ld index=%d, type=%s, " + dbgarg(cmd, "%02ld:%02d:%02d.%08ld index=%d, type=%s, " "bytesused=%d, flags=0x%08d, " "field=%0d, sequence=%d, memory=%s, offset/userptr=0x%08lx, length=%d\n", - (p->timestamp.tv_sec/3600), - (int)(p->timestamp.tv_sec/60)%60, - (int)(p->timestamp.tv_sec%60), + p->timestamp.tv_sec / 3600, + (int)(p->timestamp.tv_sec / 60) % 60, + (int)(p->timestamp.tv_sec % 60), p->timestamp.tv_usec, p->index, prt_names(p->type, v4l2_type_names), @@ -671,8 +509,8 @@ static void dbgbuf(unsigned int cmd, struct video_device *vfd, p->m.userptr, p->length); dbgarg2("timecode=%02d:%02d:%02d type=%d, " "flags=0x%08d, frames=%d, userbits=0x%08x\n", - tc->hours,tc->minutes,tc->seconds, - tc->type, tc->flags, tc->frames, *(__u32 *) tc->userbits); + tc->hours, tc->minutes, tc->seconds, + tc->type, tc->flags, tc->frames, *(__u32 *)tc->userbits); } static inline void dbgrect(struct video_device *vfd, char *s, @@ -682,12 +520,12 @@ static inline void dbgrect(struct video_device *vfd, char *s, r->width, r->height); }; -static inline void v4l_print_pix_fmt (struct video_device *vfd, +static inline void v4l_print_pix_fmt(struct video_device *vfd, struct v4l2_pix_format *fmt) { - dbgarg2 ("width=%d, height=%d, format=%c%c%c%c, field=%s, " + dbgarg2("width=%d, height=%d, format=%c%c%c%c, field=%s, " "bytesperline=%d sizeimage=%d, colorspace=%d\n", - fmt->width,fmt->height, + fmt->width, fmt->height, (fmt->pixelformat & 0xff), (fmt->pixelformat >> 8) & 0xff, (fmt->pixelformat >> 16) & 0xff, @@ -742,47 +580,47 @@ static inline int check_ext_ctrls(struct v4l2_ext_controls *c, int allow_priv) return 1; } -static int check_fmt (struct video_device *vfd, enum v4l2_buf_type type) +static int check_fmt(struct video_device *vfd, enum v4l2_buf_type type) { switch (type) { case V4L2_BUF_TYPE_VIDEO_CAPTURE: if (vfd->vidioc_try_fmt_vid_cap) - return (0); + return 0; break; case V4L2_BUF_TYPE_VIDEO_OVERLAY: if (vfd->vidioc_try_fmt_vid_overlay) - return (0); + return 0; break; case V4L2_BUF_TYPE_VIDEO_OUTPUT: if (vfd->vidioc_try_fmt_vid_out) - return (0); + return 0; break; case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: if (vfd->vidioc_try_fmt_vid_out_overlay) - return (0); + return 0; break; case V4L2_BUF_TYPE_VBI_CAPTURE: if (vfd->vidioc_try_fmt_vbi_cap) - return (0); + return 0; break; case V4L2_BUF_TYPE_VBI_OUTPUT: if (vfd->vidioc_try_fmt_vbi_out) - return (0); + return 0; break; case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE: if (vfd->vidioc_try_fmt_sliced_vbi_cap) - return (0); + return 0; break; case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT: if (vfd->vidioc_try_fmt_sliced_vbi_out) - return (0); + return 0; break; case V4L2_BUF_TYPE_PRIVATE: if (vfd->vidioc_try_fmt_type_private) - return (0); + return 0; break; } - return (-EINVAL); + return -EINVAL; } static int __video_do_ioctl(struct inode *inode, struct file *file, @@ -792,10 +630,10 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, void *fh = file->private_data; int ret = -EINVAL; - if ( (vfd->debug & V4L2_DEBUG_IOCTL) && + if ((vfd->debug & V4L2_DEBUG_IOCTL) && !(vfd->debug & V4L2_DEBUG_IOCTL_ARG)) { v4l_print_ioctl(vfd->name, cmd); - printk("\n"); + printk(KERN_CONT "\n"); } #ifdef CONFIG_VIDEO_V4L1_COMPAT @@ -807,15 +645,15 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, /* --- streaming capture ------------------------------------- */ if (cmd == VIDIOCGMBUF) { - struct video_mbuf *p=arg; + struct video_mbuf *p = arg; memset(p, 0, sizeof(*p)); if (!vfd->vidiocgmbuf) return ret; - ret=vfd->vidiocgmbuf(file, fh, p); + ret = vfd->vidiocgmbuf(file, fh, p); if (!ret) - dbgarg (cmd, "size=%d, frames=%d, offsets=0x%08lx\n", + dbgarg(cmd, "size=%d, frames=%d, offsets=0x%08lx\n", p->size, p->frames, (unsigned long)p->offsets); return ret; @@ -827,27 +665,27 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, __video_do_ioctl will be called again, with one or more V4L2 ioctls. ********************************************************/ - if (_IOC_TYPE(cmd)=='v') - return v4l_compat_translate_ioctl(inode,file,cmd,arg, + if (_IOC_TYPE(cmd) == 'v') + return v4l_compat_translate_ioctl(inode, file, cmd, arg, __video_do_ioctl); #endif - switch(cmd) { + switch (cmd) { /* --- capabilities ------------------------------------------ */ case VIDIOC_QUERYCAP: { - struct v4l2_capability *cap = (struct v4l2_capability*)arg; + struct v4l2_capability *cap = (struct v4l2_capability *)arg; memset(cap, 0, sizeof(*cap)); if (!vfd->vidioc_querycap) break; - ret=vfd->vidioc_querycap(file, fh, cap); + ret = vfd->vidioc_querycap(file, fh, cap); if (!ret) - dbgarg (cmd, "driver=%s, card=%s, bus=%s, " + dbgarg(cmd, "driver=%s, card=%s, bus=%s, " "version=0x%08x, " "capabilities=0x%08x\n", - cap->driver,cap->card,cap->bus_info, + cap->driver, cap->card, cap->bus_info, cap->version, cap->capabilities); break; @@ -856,23 +694,23 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, /* --- priority ------------------------------------------ */ case VIDIOC_G_PRIORITY: { - enum v4l2_priority *p=arg; + enum v4l2_priority *p = arg; if (!vfd->vidioc_g_priority) break; - ret=vfd->vidioc_g_priority(file, fh, p); + ret = vfd->vidioc_g_priority(file, fh, p); if (!ret) dbgarg(cmd, "priority is %d\n", *p); break; } case VIDIOC_S_PRIORITY: { - enum v4l2_priority *p=arg; + enum v4l2_priority *p = arg; if (!vfd->vidioc_s_priority) break; dbgarg(cmd, "setting priority to %d\n", *p); - ret=vfd->vidioc_s_priority(file, fh, *p); + ret = vfd->vidioc_s_priority(file, fh, *p); break; } @@ -885,7 +723,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, index = f->index; type = f->type; - memset(f,0,sizeof(*f)); + memset(f, 0, sizeof(*f)); f->index = index; f->type = type; @@ -924,14 +762,14 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, break; } if (!ret) - dbgarg (cmd, "index=%d, type=%d, flags=%d, " - "pixelformat=%c%c%c%c, description='%s'\n", - f->index, f->type, f->flags, - (f->pixelformat & 0xff), - (f->pixelformat >> 8) & 0xff, - (f->pixelformat >> 16) & 0xff, - (f->pixelformat >> 24) & 0xff, - f->description); + dbgarg(cmd, "index=%d, type=%d, flags=%d, " + "pixelformat=%c%c%c%c, description='%s'\n", + f->index, f->type, f->flags, + (f->pixelformat & 0xff), + (f->pixelformat >> 8) & 0xff, + (f->pixelformat >> 16) & 0xff, + (f->pixelformat >> 24) & 0xff, + f->description); break; } case VIDIOC_G_FMT: @@ -1052,7 +890,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, struct v4l2_format *f = (struct v4l2_format *)arg; /* FIXME: Should be one dump per type */ - dbgarg (cmd, "type=%s\n", prt_names(f->type, + dbgarg(cmd, "type=%s\n", prt_names(f->type, v4l2_type_names)); switch (f->type) { case V4L2_BUF_TYPE_VIDEO_CAPTURE: @@ -1110,16 +948,16 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, */ case VIDIOC_REQBUFS: { - struct v4l2_requestbuffers *p=arg; + struct v4l2_requestbuffers *p = arg; if (!vfd->vidioc_reqbufs) break; - ret = check_fmt (vfd, p->type); + ret = check_fmt(vfd, p->type); if (ret) break; - ret=vfd->vidioc_reqbufs(file, fh, p); - dbgarg (cmd, "count=%d, type=%s, memory=%s\n", + ret = vfd->vidioc_reqbufs(file, fh, p); + dbgarg(cmd, "count=%d, type=%s, memory=%s\n", p->count, prt_names(p->type, v4l2_type_names), prt_names(p->memory, v4l2_memory_names)); @@ -1127,46 +965,47 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, } case VIDIOC_QUERYBUF: { - struct v4l2_buffer *p=arg; + struct v4l2_buffer *p = arg; if (!vfd->vidioc_querybuf) break; - ret = check_fmt (vfd, p->type); + ret = check_fmt(vfd, p->type); if (ret) break; - ret=vfd->vidioc_querybuf(file, fh, p); + ret = vfd->vidioc_querybuf(file, fh, p); if (!ret) - dbgbuf(cmd,vfd,p); + dbgbuf(cmd, vfd, p); break; } case VIDIOC_QBUF: { - struct v4l2_buffer *p=arg; + struct v4l2_buffer *p = arg; if (!vfd->vidioc_qbuf) break; - ret = check_fmt (vfd, p->type); + ret = check_fmt(vfd, p->type); if (ret) break; - ret=vfd->vidioc_qbuf(file, fh, p); + ret = vfd->vidioc_qbuf(file, fh, p); if (!ret) - dbgbuf(cmd,vfd,p); + dbgbuf(cmd, vfd, p); break; } case VIDIOC_DQBUF: { - struct v4l2_buffer *p=arg; + struct v4l2_buffer *p = arg; + if (!vfd->vidioc_dqbuf) break; - ret = check_fmt (vfd, p->type); + ret = check_fmt(vfd, p->type); if (ret) break; - ret=vfd->vidioc_dqbuf(file, fh, p); + ret = vfd->vidioc_dqbuf(file, fh, p); if (!ret) - dbgbuf(cmd,vfd,p); + dbgbuf(cmd, vfd, p); break; } case VIDIOC_OVERLAY: @@ -1175,8 +1014,8 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, if (!vfd->vidioc_overlay) break; - dbgarg (cmd, "value=%d\n",*i); - ret=vfd->vidioc_overlay(file, fh, *i); + dbgarg(cmd, "value=%d\n", *i); + ret = vfd->vidioc_overlay(file, fh, *i); break; } case VIDIOC_G_FBUF: @@ -1209,10 +1048,11 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, case VIDIOC_STREAMON: { enum v4l2_buf_type i = *(int *)arg; + if (!vfd->vidioc_streamon) break; dbgarg(cmd, "type=%s\n", prt_names(i, v4l2_type_names)); - ret=vfd->vidioc_streamon(file, fh,i); + ret = vfd->vidioc_streamon(file, fh, i); break; } case VIDIOC_STREAMOFF: @@ -1222,7 +1062,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, if (!vfd->vidioc_streamoff) break; dbgarg(cmd, "type=%s\n", prt_names(i, v4l2_type_names)); - ret=vfd->vidioc_streamoff(file, fh, i); + ret = vfd->vidioc_streamoff(file, fh, i); break; } /* ---------- tv norms ---------- */ @@ -1282,35 +1122,34 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, } case VIDIOC_S_STD: { - v4l2_std_id *id = arg,norm; + v4l2_std_id *id = arg, norm; dbgarg(cmd, "std=%08Lx\n", (long long unsigned)*id); norm = (*id) & vfd->tvnorms; - if ( vfd->tvnorms && !norm) /* Check if std is supported */ + if (vfd->tvnorms && !norm) /* Check if std is supported */ break; /* Calls the specific handler */ if (vfd->vidioc_s_std) - ret=vfd->vidioc_s_std(file, fh, &norm); + ret = vfd->vidioc_s_std(file, fh, &norm); else - ret=-EINVAL; + ret = -EINVAL; /* Updates standard information */ - if (ret>=0) - vfd->current_norm=norm; - + if (ret >= 0) + vfd->current_norm = norm; break; } case VIDIOC_QUERYSTD: { - v4l2_std_id *p=arg; + v4l2_std_id *p = arg; if (!vfd->vidioc_querystd) break; - ret=vfd->vidioc_querystd(file, fh, arg); + ret = vfd->vidioc_querystd(file, fh, arg); if (!ret) - dbgarg (cmd, "detected std=%08Lx\n", + dbgarg(cmd, "detected std=%08Lx\n", (unsigned long long)*p); break; } @@ -1318,23 +1157,23 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, /* FIXME: Inputs can be handled inside videodev2 */ case VIDIOC_ENUMINPUT: { - struct v4l2_input *p=arg; - int i=p->index; + struct v4l2_input *p = arg; + int i = p->index; if (!vfd->vidioc_enum_input) break; memset(p, 0, sizeof(*p)); - p->index=i; + p->index = i; - ret=vfd->vidioc_enum_input(file, fh, p); + ret = vfd->vidioc_enum_input(file, fh, p); if (!ret) - dbgarg (cmd, "index=%d, name=%s, type=%d, " - "audioset=%d, " - "tuner=%d, std=%08Lx, status=%d\n", - p->index,p->name,p->type,p->audioset, - p->tuner, - (unsigned long long)p->std, - p->status); + dbgarg(cmd, "index=%d, name=%s, type=%d, " + "audioset=%d, " + "tuner=%d, std=%08Lx, status=%d\n", + p->index, p->name, p->type, p->audioset, + p->tuner, + (unsigned long long)p->std, + p->status); break; } case VIDIOC_G_INPUT: @@ -1343,9 +1182,9 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, if (!vfd->vidioc_g_input) break; - ret=vfd->vidioc_g_input(file, fh, i); + ret = vfd->vidioc_g_input(file, fh, i); if (!ret) - dbgarg (cmd, "value=%d\n",*i); + dbgarg(cmd, "value=%d\n", *i); break; } case VIDIOC_S_INPUT: @@ -1354,8 +1193,8 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, if (!vfd->vidioc_s_input) break; - dbgarg (cmd, "value=%d\n",*i); - ret=vfd->vidioc_s_input(file, fh, *i); + dbgarg(cmd, "value=%d\n", *i); + ret = vfd->vidioc_s_input(file, fh, *i); break; } @@ -1385,9 +1224,9 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, if (!vfd->vidioc_g_output) break; - ret=vfd->vidioc_g_output(file, fh, i); + ret = vfd->vidioc_g_output(file, fh, i); if (!ret) - dbgarg (cmd, "value=%d\n",*i); + dbgarg(cmd, "value=%d\n", *i); break; } case VIDIOC_S_OUTPUT: @@ -1396,8 +1235,8 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, if (!vfd->vidioc_s_output) break; - dbgarg (cmd, "value=%d\n",*i); - ret=vfd->vidioc_s_output(file, fh, *i); + dbgarg(cmd, "value=%d\n", *i); + ret = vfd->vidioc_s_output(file, fh, *i); break; } @@ -1574,92 +1413,95 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, } case VIDIOC_ENUMAUDOUT: { - struct v4l2_audioout *p=arg; + struct v4l2_audioout *p = arg; if (!vfd->vidioc_enumaudout) break; dbgarg(cmd, "Enum for index=%d\n", p->index); - ret=vfd->vidioc_enumaudout(file, fh, p); + ret = vfd->vidioc_enumaudout(file, fh, p); if (!ret) dbgarg2("index=%d, name=%s, capability=%d, " "mode=%d\n", p->index, p->name, - p->capability,p->mode); + p->capability, p->mode); break; } case VIDIOC_G_AUDOUT: { - struct v4l2_audioout *p=arg; + struct v4l2_audioout *p = arg; if (!vfd->vidioc_g_audout) break; dbgarg(cmd, "Enum for index=%d\n", p->index); - ret=vfd->vidioc_g_audout(file, fh, p); + ret = vfd->vidioc_g_audout(file, fh, p); if (!ret) dbgarg2("index=%d, name=%s, capability=%d, " "mode=%d\n", p->index, p->name, - p->capability,p->mode); + p->capability, p->mode); break; } case VIDIOC_S_AUDOUT: { - struct v4l2_audioout *p=arg; + struct v4l2_audioout *p = arg; if (!vfd->vidioc_s_audout) break; dbgarg(cmd, "index=%d, name=%s, capability=%d, " "mode=%d\n", p->index, p->name, - p->capability,p->mode); + p->capability, p->mode); - ret=vfd->vidioc_s_audout(file, fh, p); + ret = vfd->vidioc_s_audout(file, fh, p); break; } case VIDIOC_G_MODULATOR: { - struct v4l2_modulator *p=arg; + struct v4l2_modulator *p = arg; + if (!vfd->vidioc_g_modulator) break; - ret=vfd->vidioc_g_modulator(file, fh, p); + ret = vfd->vidioc_g_modulator(file, fh, p); if (!ret) dbgarg(cmd, "index=%d, name=%s, " "capability=%d, rangelow=%d," " rangehigh=%d, txsubchans=%d\n", - p->index, p->name,p->capability, + p->index, p->name, p->capability, p->rangelow, p->rangehigh, p->txsubchans); break; } case VIDIOC_S_MODULATOR: { - struct v4l2_modulator *p=arg; + struct v4l2_modulator *p = arg; + if (!vfd->vidioc_s_modulator) break; dbgarg(cmd, "index=%d, name=%s, capability=%d, " "rangelow=%d, rangehigh=%d, txsubchans=%d\n", - p->index, p->name,p->capability,p->rangelow, - p->rangehigh,p->txsubchans); - ret=vfd->vidioc_s_modulator(file, fh, p); + p->index, p->name, p->capability, p->rangelow, + p->rangehigh, p->txsubchans); + ret = vfd->vidioc_s_modulator(file, fh, p); break; } case VIDIOC_G_CROP: { - struct v4l2_crop *p=arg; + struct v4l2_crop *p = arg; + if (!vfd->vidioc_g_crop) break; dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names)); - ret=vfd->vidioc_g_crop(file, fh, p); - if (!ret) { + ret = vfd->vidioc_g_crop(file, fh, p); + if (!ret) dbgrect(vfd, "", &p->c); - } break; } case VIDIOC_S_CROP: { - struct v4l2_crop *p=arg; + struct v4l2_crop *p = arg; + if (!vfd->vidioc_s_crop) break; dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names)); dbgrect(vfd, "", &p->c); - ret=vfd->vidioc_s_crop(file, fh, p); + ret = vfd->vidioc_s_crop(file, fh, p); break; } case VIDIOC_CROPCAP: @@ -1679,40 +1521,42 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, } case VIDIOC_G_JPEGCOMP: { - struct v4l2_jpegcompression *p=arg; + struct v4l2_jpegcompression *p = arg; + if (!vfd->vidioc_g_jpegcomp) break; - ret=vfd->vidioc_g_jpegcomp(file, fh, p); + ret = vfd->vidioc_g_jpegcomp(file, fh, p); if (!ret) - dbgarg (cmd, "quality=%d, APPn=%d, " - "APP_len=%d, COM_len=%d, " - "jpeg_markers=%d\n", - p->quality,p->APPn,p->APP_len, - p->COM_len,p->jpeg_markers); + dbgarg(cmd, "quality=%d, APPn=%d, " + "APP_len=%d, COM_len=%d, " + "jpeg_markers=%d\n", + p->quality, p->APPn, p->APP_len, + p->COM_len, p->jpeg_markers); break; } case VIDIOC_S_JPEGCOMP: { - struct v4l2_jpegcompression *p=arg; + struct v4l2_jpegcompression *p = arg; + if (!vfd->vidioc_g_jpegcomp) break; - dbgarg (cmd, "quality=%d, APPn=%d, APP_len=%d, " + dbgarg(cmd, "quality=%d, APPn=%d, APP_len=%d, " "COM_len=%d, jpeg_markers=%d\n", - p->quality,p->APPn,p->APP_len, - p->COM_len,p->jpeg_markers); - ret=vfd->vidioc_s_jpegcomp(file, fh, p); + p->quality, p->APPn, p->APP_len, + p->COM_len, p->jpeg_markers); + ret = vfd->vidioc_s_jpegcomp(file, fh, p); break; } case VIDIOC_G_ENC_INDEX: { - struct v4l2_enc_idx *p=arg; + struct v4l2_enc_idx *p = arg; if (!vfd->vidioc_g_enc_index) break; - ret=vfd->vidioc_g_enc_index(file, fh, p); + ret = vfd->vidioc_g_enc_index(file, fh, p); if (!ret) - dbgarg (cmd, "entries=%d, entries_cap=%d\n", - p->entries,p->entries_cap); + dbgarg(cmd, "entries=%d, entries_cap=%d\n", + p->entries, p->entries_cap); break; } case VIDIOC_ENCODER_CMD: @@ -1741,14 +1585,14 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, } case VIDIOC_G_PARM: { - struct v4l2_streamparm *p=arg; - __u32 type=p->type; + struct v4l2_streamparm *p = arg; + __u32 type = p->type; - memset(p,0,sizeof(*p)); - p->type=type; + memset(p, 0, sizeof(*p)); + p->type = type; if (vfd->vidioc_g_parm) { - ret=vfd->vidioc_g_parm(file, fh, p); + ret = vfd->vidioc_g_parm(file, fh, p); } else { struct v4l2_standard s; @@ -1759,19 +1603,20 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, v4l2_norm_to_name(vfd->current_norm)); p->parm.capture.timeperframe = s.frameperiod; - ret=0; + ret = 0; } - dbgarg (cmd, "type=%d\n", p->type); + dbgarg(cmd, "type=%d\n", p->type); break; } case VIDIOC_S_PARM: { - struct v4l2_streamparm *p=arg; + struct v4l2_streamparm *p = arg; + if (!vfd->vidioc_s_parm) break; - dbgarg (cmd, "type=%d\n", p->type); - ret=vfd->vidioc_s_parm(file, fh, p); + dbgarg(cmd, "type=%d\n", p->type); + ret = vfd->vidioc_s_parm(file, fh, p); break; } case VIDIOC_G_TUNER: @@ -1831,12 +1676,13 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, } case VIDIOC_S_FREQUENCY: { - struct v4l2_frequency *p=arg; + struct v4l2_frequency *p = arg; + if (!vfd->vidioc_s_frequency) break; - dbgarg (cmd, "tuner=%d, type=%d, frequency=%d\n", - p->tuner,p->type,p->frequency); - ret=vfd->vidioc_s_frequency(file, fh, p); + dbgarg(cmd, "tuner=%d, type=%d, frequency=%d\n", + p->tuner, p->type, p->frequency); + ret = vfd->vidioc_s_frequency(file, fh, p); break; } case VIDIOC_G_SLICED_VBI_CAP: @@ -1858,37 +1704,40 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, { if (!vfd->vidioc_log_status) break; - ret=vfd->vidioc_log_status(file, fh); + ret = vfd->vidioc_log_status(file, fh); break; } #ifdef CONFIG_VIDEO_ADV_DEBUG case VIDIOC_DBG_G_REGISTER: { - struct v4l2_register *p=arg; + struct v4l2_register *p = arg; + if (!capable(CAP_SYS_ADMIN)) - ret=-EPERM; + ret = -EPERM; else if (vfd->vidioc_g_register) - ret=vfd->vidioc_g_register(file, fh, p); + ret = vfd->vidioc_g_register(file, fh, p); break; } case VIDIOC_DBG_S_REGISTER: { - struct v4l2_register *p=arg; + struct v4l2_register *p = arg; + if (!capable(CAP_SYS_ADMIN)) - ret=-EPERM; + ret = -EPERM; else if (vfd->vidioc_s_register) - ret=vfd->vidioc_s_register(file, fh, p); + ret = vfd->vidioc_s_register(file, fh, p); break; } #endif case VIDIOC_G_CHIP_IDENT: { - struct v4l2_chip_ident *p=arg; + struct v4l2_chip_ident *p = arg; + if (!vfd->vidioc_g_chip_ident) break; - ret=vfd->vidioc_g_chip_ident(file, fh, p); + ret = vfd->vidioc_g_chip_ident(file, fh, p); if (!ret) - dbgarg (cmd, "chip_ident=%u, revision=0x%x\n", p->ident, p->revision); + dbgarg(cmd, "chip_ident=%u, revision=0x%x\n", p->ident, p->revision); break; } default: @@ -1901,6 +1750,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, case VIDIOC_S_HW_FREQ_SEEK: { struct v4l2_hw_freq_seek *p = arg; + if (!vfd->vidioc_s_hw_freq_seek) break; dbgarg(cmd, @@ -1921,7 +1771,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, return ret; } -int video_ioctl2 (struct inode *inode, struct file *file, +int video_ioctl2(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { char sbuf[128]; @@ -1950,7 +1800,7 @@ int video_ioctl2 (struct inode *inode, struct file *file, parg = sbuf; } else { /* too big to allocate from stack */ - mbuf = kmalloc(_IOC_SIZE(cmd),GFP_KERNEL); + mbuf = kmalloc(_IOC_SIZE(cmd), GFP_KERNEL); if (NULL == mbuf) return -ENOMEM; parg = mbuf; @@ -2001,8 +1851,7 @@ int video_ioctl2 (struct inode *inode, struct file *file, out_ext_ctrl: /* Copy results into user buffer */ - switch (_IOC_DIR(cmd)) - { + switch (_IOC_DIR(cmd)) { case _IOC_READ: case (_IOC_WRITE | _IOC_READ): if (copy_to_user((void __user *)arg, parg, _IOC_SIZE(cmd))) @@ -2015,287 +1864,3 @@ out: return err; } EXPORT_SYMBOL(video_ioctl2); - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25) -struct index_info { - struct device *dev; - unsigned int used[VIDEO_NUM_DEVICES]; -}; - -static int __fill_index_info(struct device *cd, void *data) -{ - struct index_info *info = data; - struct video_device *vfd = container_of(cd, struct video_device, - class_dev); - - if (info->dev == vfd->dev) - info->used[vfd->index] = 1; - - return 0; -} - -/** - * assign_index - assign stream number based on parent device - * @vdev: video_device to assign index number to, vdev->dev should be assigned - * @num: -1 if auto assign, requested number otherwise - * - * - * returns -ENFILE if num is already in use, a free index number if - * successful. - */ -static int get_index(struct video_device *vdev, int num) -{ - struct index_info *info; - int i; - int ret = 0; - - if (num >= VIDEO_NUM_DEVICES) - return -EINVAL; - - info = kzalloc(sizeof(*info), GFP_KERNEL); - if (!info) - return -ENOMEM; - - info->dev = vdev->dev; - - ret = class_for_each_device(&video_class, info, - __fill_index_info); - - if (ret < 0) - goto out; - - if (num >= 0) { - if (!info->used[num]) - ret = num; - else - ret = -ENFILE; - - goto out; - } - - for (i = 0; i < VIDEO_NUM_DEVICES; i++) { - if (info->used[i]) - continue; - ret = i; - goto out; - } - -out: - kfree(info); - return ret; -} -#endif - -static const struct file_operations video_fops; - -int video_register_device(struct video_device *vfd, int type, int nr) -{ - return video_register_device_index(vfd, type, nr, -1); -} -EXPORT_SYMBOL(video_register_device); - -/** - * video_register_device - register video4linux devices - * @vfd: video device structure we want to register - * @type: type of device to register - * @nr: which device number (0 == /dev/video0, 1 == /dev/video1, ... - * -1 == first free) - * - * The registration code assigns minor numbers based on the type - * requested. -ENFILE is returned in all the device slots for this - * category are full. If not then the minor field is set and the - * driver initialize function is called (if non %NULL). - * - * Zero is returned on success. - * - * Valid types are - * - * %VFL_TYPE_GRABBER - A frame grabber - * - * %VFL_TYPE_VTX - A teletext device - * - * %VFL_TYPE_VBI - Vertical blank data (undecoded) - * - * %VFL_TYPE_RADIO - A radio card - */ - -int video_register_device_index(struct video_device *vfd, int type, int nr, - int index) -{ - int i=0; - int base; - int end; - int ret; - char *name_base; - - switch(type) - { - case VFL_TYPE_GRABBER: - base=MINOR_VFL_TYPE_GRABBER_MIN; - end=MINOR_VFL_TYPE_GRABBER_MAX+1; - name_base = "video"; - break; - case VFL_TYPE_VTX: - base=MINOR_VFL_TYPE_VTX_MIN; - end=MINOR_VFL_TYPE_VTX_MAX+1; - name_base = "vtx"; - break; - case VFL_TYPE_VBI: - base=MINOR_VFL_TYPE_VBI_MIN; - end=MINOR_VFL_TYPE_VBI_MAX+1; - name_base = "vbi"; - break; - case VFL_TYPE_RADIO: - base=MINOR_VFL_TYPE_RADIO_MIN; - end=MINOR_VFL_TYPE_RADIO_MAX+1; - name_base = "radio"; - break; - default: - printk(KERN_ERR "%s called with unknown type: %d\n", - __func__, type); - return -1; - } - - /* pick a minor number */ - mutex_lock(&videodev_lock); - if (nr >= 0 && nr < end-base) { - /* use the one the driver asked for */ - i = base+nr; - if (NULL != video_device[i]) { - mutex_unlock(&videodev_lock); - return -ENFILE; - } - } else { - /* use first free */ - for(i=base;i<end;i++) - if (NULL == video_device[i]) - break; - if (i == end) { - mutex_unlock(&videodev_lock); - return -ENFILE; - } - } - video_device[i]=vfd; - vfd->minor=i; - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25) - ret = get_index(vfd, index); -#else - ret = 0; -#endif - if (ret < 0) { - printk(KERN_ERR "%s: get_index failed\n", - __func__); - goto fail_minor; - } - - vfd->index = ret; - - mutex_unlock(&videodev_lock); - mutex_init(&vfd->lock); - - /* sysfs class */ - memset(&vfd->class_dev, 0x00, sizeof(vfd->class_dev)); - if (vfd->dev) - vfd->class_dev.parent = vfd->dev; - vfd->class_dev.class = &video_class; - vfd->class_dev.devt = MKDEV(VIDEO_MAJOR, vfd->minor); - sprintf(vfd->class_dev.bus_id, "%s%d", name_base, i - base); - ret = device_register(&vfd->class_dev); - if (ret < 0) { - printk(KERN_ERR "%s: device_register failed\n", - __func__); - goto fail_minor; - } - -#if 1 /* keep */ - /* needed until all drivers are fixed */ - if (!vfd->release) - printk(KERN_WARNING "videodev: \"%s\" has no release callback. " - "Please fix your driver for proper sysfs support, see " - "http://lwn.net/Articles/36850/\n", vfd->name); -#endif - return 0; - -fail_minor: - mutex_lock(&videodev_lock); - video_device[vfd->minor] = NULL; - vfd->minor = -1; - mutex_unlock(&videodev_lock); - return ret; -} -EXPORT_SYMBOL(video_register_device_index); - -/** - * video_unregister_device - unregister a video4linux device - * @vfd: the device to unregister - * - * This unregisters the passed device and deassigns the minor - * number. Future open calls will be met with errors. - */ - -void video_unregister_device(struct video_device *vfd) -{ - mutex_lock(&videodev_lock); - if(video_device[vfd->minor]!=vfd) - panic("videodev: bad unregister"); - - video_device[vfd->minor]=NULL; - device_unregister(&vfd->class_dev); - mutex_unlock(&videodev_lock); -} -EXPORT_SYMBOL(video_unregister_device); - -/* - * Video fs operations - */ -static const struct file_operations video_fops= -{ - .owner = THIS_MODULE, - .llseek = no_llseek, - .open = video_open, -}; - -/* - * Initialise video for linux - */ - -static int __init videodev_init(void) -{ - int ret; - - printk(KERN_INFO "Linux video capture interface: v2.00\n"); - if (register_chrdev(VIDEO_MAJOR, VIDEO_NAME, &video_fops)) { - printk(KERN_WARNING "video_dev: unable to get major %d\n", VIDEO_MAJOR); - return -EIO; - } - - ret = class_register(&video_class); - if (ret < 0) { - unregister_chrdev(VIDEO_MAJOR, VIDEO_NAME); - printk(KERN_WARNING "video_dev: class_register failed\n"); - return -EIO; - } - - return 0; -} - -static void __exit videodev_exit(void) -{ - class_unregister(&video_class); - unregister_chrdev(VIDEO_MAJOR, VIDEO_NAME); -} - -module_init(videodev_init) -module_exit(videodev_exit) - -MODULE_AUTHOR("Alan Cox, Mauro Carvalho Chehab <mchehab@infradead.org>"); -MODULE_DESCRIPTION("Device registrar for Video4Linux drivers v2"); -MODULE_LICENSE("GPL"); - - -/* - * Local variables: - * c-basic-offset: 8 - * End: - */ diff --git a/linux/drivers/media/video/videobuf-dma-contig.c b/linux/drivers/media/video/videobuf-dma-contig.c new file mode 100644 index 000000000..a3bf4c151 --- /dev/null +++ b/linux/drivers/media/video/videobuf-dma-contig.c @@ -0,0 +1,419 @@ +/* + * helper functions for physically contiguous capture buffers + * + * The functions support hardware lacking scatter gather support + * (i.e. the buffers must be linear in physical memory) + * + * Copyright (c) 2008 Magnus Damm + * + * Based on videobuf-vmalloc.c, + * (c) 2007 Mauro Carvalho Chehab, <mchehab@infradead.org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 + */ + +#include <linux/init.h> +#include <linux/module.h> +#include <linux/mm.h> +#include <linux/dma-mapping.h> +#include <media/videobuf-dma-contig.h> +#include "compat.h" + +struct videobuf_dma_contig_memory { + u32 magic; + void *vaddr; + dma_addr_t dma_handle; + unsigned long size; +}; + +#define MAGIC_DC_MEM 0x0733ac61 +#define MAGIC_CHECK(is, should) \ + if (unlikely((is) != (should))) { \ + pr_err("magic mismatch: %x expected %x\n", (is), (should)); \ + BUG(); \ + } + +static void +videobuf_vm_open(struct vm_area_struct *vma) +{ + struct videobuf_mapping *map = vma->vm_private_data; + + dev_dbg(map->q->dev, "vm_open %p [count=%u,vma=%08lx-%08lx]\n", + map, map->count, vma->vm_start, vma->vm_end); + + map->count++; +} + +static void videobuf_vm_close(struct vm_area_struct *vma) +{ + struct videobuf_mapping *map = vma->vm_private_data; + struct videobuf_queue *q = map->q; + int i; + + dev_dbg(map->q->dev, "vm_close %p [count=%u,vma=%08lx-%08lx]\n", + map, map->count, vma->vm_start, vma->vm_end); + + map->count--; + if (0 == map->count) { + struct videobuf_dma_contig_memory *mem; + + dev_dbg(map->q->dev, "munmap %p q=%p\n", map, q); + mutex_lock(&q->vb_lock); + + /* We need first to cancel streams, before unmapping */ + if (q->streaming) + videobuf_queue_cancel(q); + + for (i = 0; i < VIDEO_MAX_FRAME; i++) { + if (NULL == q->bufs[i]) + continue; + + if (q->bufs[i]->map != map) + continue; + + mem = q->bufs[i]->priv; + if (mem) { + /* This callback is called only if kernel has + allocated memory and this memory is mmapped. + In this case, memory should be freed, + in order to do memory unmap. + */ + + MAGIC_CHECK(mem->magic, MAGIC_DC_MEM); + + /* vfree is not atomic - can't be + called with IRQ's disabled + */ + dev_dbg(map->q->dev, "buf[%d] freeing %p\n", + i, mem->vaddr); + + dma_free_coherent(q->dev, mem->size, + mem->vaddr, mem->dma_handle); + mem->vaddr = NULL; + } + + q->bufs[i]->map = NULL; + q->bufs[i]->baddr = 0; + } + + kfree(map); + + mutex_unlock(&q->vb_lock); + } +} + +static struct vm_operations_struct videobuf_vm_ops = { + .open = videobuf_vm_open, + .close = videobuf_vm_close, +}; + +static void *__videobuf_alloc(size_t size) +{ + struct videobuf_dma_contig_memory *mem; + struct videobuf_buffer *vb; + + vb = kzalloc(size + sizeof(*mem), GFP_KERNEL); + if (vb) { + mem = vb->priv = ((char *)vb) + size; + mem->magic = MAGIC_DC_MEM; + } + + return vb; +} + +static void *__videobuf_to_vmalloc(struct videobuf_buffer *buf) +{ + struct videobuf_dma_contig_memory *mem = buf->priv; + + BUG_ON(!mem); + MAGIC_CHECK(mem->magic, MAGIC_DC_MEM); + + return mem->vaddr; +} + +static int __videobuf_iolock(struct videobuf_queue *q, + struct videobuf_buffer *vb, + struct v4l2_framebuffer *fbuf) +{ + struct videobuf_dma_contig_memory *mem = vb->priv; + + BUG_ON(!mem); + MAGIC_CHECK(mem->magic, MAGIC_DC_MEM); + + switch (vb->memory) { + case V4L2_MEMORY_MMAP: + dev_dbg(q->dev, "%s memory method MMAP\n", __func__); + + /* All handling should be done by __videobuf_mmap_mapper() */ + if (!mem->vaddr) { + dev_err(q->dev, "memory is not alloced/mmapped.\n"); + return -EINVAL; + } + break; + case V4L2_MEMORY_USERPTR: + dev_dbg(q->dev, "%s memory method USERPTR\n", __func__); + + /* The only USERPTR currently supported is the one needed for + read() method. + */ + if (vb->baddr) + return -EINVAL; + + mem->size = PAGE_ALIGN(vb->size); + mem->vaddr = dma_alloc_coherent(q->dev, mem->size, + &mem->dma_handle, GFP_KERNEL); + if (!mem->vaddr) { + dev_err(q->dev, "dma_alloc_coherent %ld failed\n", + mem->size); + return -ENOMEM; + } + + dev_dbg(q->dev, "dma_alloc_coherent data is at %p (%ld)\n", + mem->vaddr, mem->size); + break; + case V4L2_MEMORY_OVERLAY: + default: + dev_dbg(q->dev, "%s memory method OVERLAY/unknown\n", + __func__); + return -EINVAL; + } + + return 0; +} + +static int __videobuf_sync(struct videobuf_queue *q, + struct videobuf_buffer *buf) +{ + struct videobuf_dma_contig_memory *mem = buf->priv; + + BUG_ON(!mem); + MAGIC_CHECK(mem->magic, MAGIC_DC_MEM); + + dma_sync_single_for_cpu(q->dev, mem->dma_handle, mem->size, + DMA_FROM_DEVICE); + return 0; +} + +static int __videobuf_mmap_free(struct videobuf_queue *q) +{ + unsigned int i; + + dev_dbg(q->dev, "%s\n", __func__); + for (i = 0; i < VIDEO_MAX_FRAME; i++) { + if (q->bufs[i] && q->bufs[i]->map) + return -EBUSY; + } + + return 0; +} + +static int __videobuf_mmap_mapper(struct videobuf_queue *q, + struct vm_area_struct *vma) +{ + struct videobuf_dma_contig_memory *mem; + struct videobuf_mapping *map; + unsigned int first; + int retval; + unsigned long size, offset = vma->vm_pgoff << PAGE_SHIFT; + + dev_dbg(q->dev, "%s\n", __func__); + if (!(vma->vm_flags & VM_WRITE) || !(vma->vm_flags & VM_SHARED)) + return -EINVAL; + + /* look for first buffer to map */ + for (first = 0; first < VIDEO_MAX_FRAME; first++) { + if (!q->bufs[first]) + continue; + + if (V4L2_MEMORY_MMAP != q->bufs[first]->memory) + continue; + if (q->bufs[first]->boff == offset) + break; + } + if (VIDEO_MAX_FRAME == first) { + dev_dbg(q->dev, "invalid user space offset [offset=0x%lx]\n", + offset); + return -EINVAL; + } + + /* create mapping + update buffer list */ + map = kzalloc(sizeof(struct videobuf_mapping), GFP_KERNEL); + if (!map) + return -ENOMEM; + + q->bufs[first]->map = map; + map->start = vma->vm_start; + map->end = vma->vm_end; + map->q = q; + + q->bufs[first]->baddr = vma->vm_start; + + mem = q->bufs[first]->priv; + BUG_ON(!mem); + MAGIC_CHECK(mem->magic, MAGIC_DC_MEM); + + mem->size = PAGE_ALIGN(q->bufs[first]->bsize); + mem->vaddr = dma_alloc_coherent(q->dev, mem->size, + &mem->dma_handle, GFP_KERNEL); + if (!mem->vaddr) { + dev_err(q->dev, "dma_alloc_coherent size %ld failed\n", + mem->size); + goto error; + } + dev_dbg(q->dev, "dma_alloc_coherent data is at addr %p (size %ld)\n", + mem->vaddr, mem->size); + + /* Try to remap memory */ + + size = vma->vm_end - vma->vm_start; + size = (size < mem->size) ? size : mem->size; + + vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); + retval = remap_pfn_range(vma, vma->vm_start, + mem->dma_handle >> PAGE_SHIFT, + size, vma->vm_page_prot); + if (retval) { + dev_err(q->dev, "mmap: remap failed with error %d. ", retval); + dma_free_coherent(q->dev, mem->size, + mem->vaddr, mem->dma_handle); + goto error; + } + + vma->vm_ops = &videobuf_vm_ops; + vma->vm_flags |= VM_DONTEXPAND; + vma->vm_private_data = map; + + dev_dbg(q->dev, "mmap %p: q=%p %08lx-%08lx (%lx) pgoff %08lx buf %d\n", + map, q, vma->vm_start, vma->vm_end, + (long int) q->bufs[first]->bsize, + vma->vm_pgoff, first); + + videobuf_vm_open(vma); + + return 0; + +error: + kfree(map); + return -ENOMEM; +} + +static int __videobuf_copy_to_user(struct videobuf_queue *q, + char __user *data, size_t count, + int nonblocking) +{ + struct videobuf_dma_contig_memory *mem = q->read_buf->priv; + void *vaddr; + + BUG_ON(!mem); + MAGIC_CHECK(mem->magic, MAGIC_DC_MEM); + BUG_ON(!mem->vaddr); + + /* copy to userspace */ + if (count > q->read_buf->size - q->read_off) + count = q->read_buf->size - q->read_off; + + vaddr = mem->vaddr; + + if (copy_to_user(data, vaddr + q->read_off, count)) + return -EFAULT; + + return count; +} + +static int __videobuf_copy_stream(struct videobuf_queue *q, + char __user *data, size_t count, size_t pos, + int vbihack, int nonblocking) +{ + unsigned int *fc; + struct videobuf_dma_contig_memory *mem = q->read_buf->priv; + + BUG_ON(!mem); + MAGIC_CHECK(mem->magic, MAGIC_DC_MEM); + + if (vbihack) { + /* dirty, undocumented hack -- pass the frame counter + * within the last four bytes of each vbi data block. + * We need that one to maintain backward compatibility + * to all vbi decoding software out there ... */ + fc = (unsigned int *)mem->vaddr; + fc += (q->read_buf->size >> 2) - 1; + *fc = q->read_buf->field_count >> 1; + dev_dbg(q->dev, "vbihack: %d\n", *fc); + } + + /* copy stuff using the common method */ + count = __videobuf_copy_to_user(q, data, count, nonblocking); + + if ((count == -EFAULT) && (pos == 0)) + return -EFAULT; + + return count; +} + +static struct videobuf_qtype_ops qops = { + .magic = MAGIC_QTYPE_OPS, + + .alloc = __videobuf_alloc, + .iolock = __videobuf_iolock, + .sync = __videobuf_sync, + .mmap_free = __videobuf_mmap_free, + .mmap_mapper = __videobuf_mmap_mapper, + .video_copy_to_user = __videobuf_copy_to_user, + .copy_stream = __videobuf_copy_stream, + .vmalloc = __videobuf_to_vmalloc, +}; + +void videobuf_queue_dma_contig_init(struct videobuf_queue *q, + struct videobuf_queue_ops *ops, + struct device *dev, + spinlock_t *irqlock, + enum v4l2_buf_type type, + enum v4l2_field field, + unsigned int msize, + void *priv) +{ + videobuf_queue_core_init(q, ops, dev, irqlock, type, field, msize, + priv, &qops); +} +EXPORT_SYMBOL_GPL(videobuf_queue_dma_contig_init); + +dma_addr_t videobuf_to_dma_contig(struct videobuf_buffer *buf) +{ + struct videobuf_dma_contig_memory *mem = buf->priv; + + BUG_ON(!mem); + MAGIC_CHECK(mem->magic, MAGIC_DC_MEM); + + return mem->dma_handle; +} +EXPORT_SYMBOL_GPL(videobuf_to_dma_contig); + +void videobuf_dma_contig_free(struct videobuf_queue *q, + struct videobuf_buffer *buf) +{ + struct videobuf_dma_contig_memory *mem = buf->priv; + + /* mmapped memory can't be freed here, otherwise mmapped region + would be released, while still needed. In this case, the memory + release should happen inside videobuf_vm_close(). + So, it should free memory only if the memory were allocated for + read() operation. + */ + if ((buf->memory != V4L2_MEMORY_USERPTR) || !buf->baddr) + return; + + if (!mem) + return; + + MAGIC_CHECK(mem->magic, MAGIC_DC_MEM); + + dma_free_coherent(q->dev, mem->size, mem->vaddr, mem->dma_handle); + mem->vaddr = NULL; +} +EXPORT_SYMBOL_GPL(videobuf_dma_contig_free); + +MODULE_DESCRIPTION("helper module to manage video4linux dma contig buffers"); +MODULE_AUTHOR("Magnus Damm"); +MODULE_LICENSE("GPL"); diff --git a/linux/drivers/media/video/videobuf-dma-sg.c b/linux/drivers/media/video/videobuf-dma-sg.c index 21194d6fe..e64350e1f 100644 --- a/linux/drivers/media/video/videobuf-dma-sg.c +++ b/linux/drivers/media/video/videobuf-dma-sg.c @@ -1,7 +1,7 @@ /* * helper functions for SG DMA video4linux capture buffers * - * The functions expect the hardware being able to scatter gatter + * The functions expect the hardware being able to scatter gather * (i.e. the buffers are not linear in physical memory, but fragmented * into PAGE_SIZE chunks). They also assume the driver does not need * to touch the video data. diff --git a/linux/drivers/media/video/videobuf-vmalloc.c b/linux/drivers/media/video/videobuf-vmalloc.c index 6f487b348..eb25cc257 100644 --- a/linux/drivers/media/video/videobuf-vmalloc.c +++ b/linux/drivers/media/video/videobuf-vmalloc.c @@ -1,7 +1,7 @@ /* * helper functions for vmalloc video4linux capture buffers * - * The functions expect the hardware being able to scatter gatter + * The functions expect the hardware being able to scatter gather * (i.e. the buffers are not linear in physical memory, but fragmented * into PAGE_SIZE chunks). They also assume the driver does not need * to touch the video data. diff --git a/linux/drivers/media/video/vivi.c b/linux/drivers/media/video/vivi.c index 78108a4e0..7f4a53077 100644 --- a/linux/drivers/media/video/vivi.c +++ b/linux/drivers/media/video/vivi.c @@ -36,6 +36,7 @@ #include <linux/interrupt.h> #include <media/videobuf-vmalloc.h> #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <linux/kthread.h> #include <linux/highmem.h> #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20) diff --git a/linux/drivers/media/video/w9966.c b/linux/drivers/media/video/w9966.c index 9b77f268c..66c730b8b 100644 --- a/linux/drivers/media/video/w9966.c +++ b/linux/drivers/media/video/w9966.c @@ -60,6 +60,7 @@ #include "compat.h" #include <linux/videodev.h> #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <linux/parport.h> /*#define DEBUG*/ /* Undef me for production */ diff --git a/linux/drivers/media/video/w9968cf.c b/linux/drivers/media/video/w9968cf.c index 712c8c066..8e0f6bcfd 100644 --- a/linux/drivers/media/video/w9968cf.c +++ b/linux/drivers/media/video/w9968cf.c @@ -42,6 +42,7 @@ #include <asm/page.h> #include <asm/uaccess.h> #include <linux/page-flags.h> +#include <media/v4l2-ioctl.h> #include "w9968cf.h" #include "w9968cf_decoder.h" @@ -3563,7 +3564,7 @@ w9968cf_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) cam->v4ldev->minor = video_nr[dev_nr]; cam->v4ldev->release = video_device_release; video_set_drvdata(cam->v4ldev, cam); - cam->v4ldev->dev = &cam->dev; + cam->v4ldev->parent = &cam->dev; err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER, video_nr[dev_nr]); diff --git a/linux/drivers/media/video/zc0301/zc0301.h b/linux/drivers/media/video/zc0301/zc0301.h index a7c7b1116..7bd0d02b3 100644 --- a/linux/drivers/media/video/zc0301/zc0301.h +++ b/linux/drivers/media/video/zc0301/zc0301.h @@ -26,6 +26,7 @@ #include "compat.h" #include <linux/videodev2.h> #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include <linux/device.h> #include <linux/list.h> #include <linux/spinlock.h> diff --git a/linux/drivers/media/video/zoran_card.c b/linux/drivers/media/video/zoran_card.c index 56d8edecc..cc45ae5cd 100644 --- a/linux/drivers/media/video/zoran_card.c +++ b/linux/drivers/media/video/zoran_card.c @@ -359,14 +359,6 @@ i2cid_to_modulename (u16 i2c_id) case I2C_DRIVERID_VPX3220: name = "vpx3220"; break; -/* case I2C_DRIVERID_VPX3224: - name = "vpx3224"; - break; - case I2C_DRIVERID_MSE3000: - name = "mse3000"; - break;*/ - default: - break; } return name; @@ -387,8 +379,6 @@ codecid_to_modulename (u16 codecid) case CODEC_TYPE_ZR36016: name = "zr36016"; break; - default: - break; } return name; @@ -429,7 +419,6 @@ static struct card_info zoran_cards[NUM_CARDS] __devinitdata = { .type = DC10_old, .name = "DC10(old)", .i2c_decoder = I2C_DRIVERID_VPX3220, - /*.i2c_encoder = I2C_DRIVERID_MSE3000,*/ .video_codec = CODEC_TYPE_ZR36050, .video_vfe = CODEC_TYPE_ZR36016, diff --git a/linux/drivers/media/video/zoran_driver.c b/linux/drivers/media/video/zoran_driver.c index 844c688e8..989a6f7e0 100644 --- a/linux/drivers/media/video/zoran_driver.c +++ b/linux/drivers/media/video/zoran_driver.c @@ -71,6 +71,7 @@ #include <linux/videodev.h> #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include "videocodec.h" #include <asm/byteorder.h> diff --git a/linux/drivers/media/video/zr364xx.c b/linux/drivers/media/video/zr364xx.c index b1a65e3f5..0967cdb3f 100644 --- a/linux/drivers/media/video/zr364xx.c +++ b/linux/drivers/media/video/zr364xx.c @@ -35,6 +35,7 @@ #include <linux/proc_fs.h> #include <linux/highmem.h> #include <media/v4l2-common.h> +#include <media/v4l2-ioctl.h> #include "compat.h" |