diff options
Diffstat (limited to 'drivers')
280 files changed, 9103 insertions, 5523 deletions
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 29f3d7504da1..dd712b24ec91 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c @@ -19,11 +19,6 @@ EXPORT_SYMBOL(cpu_sysdev_class); static struct sys_device *cpu_sys_devices[NR_CPUS]; #ifdef CONFIG_HOTPLUG_CPU -int __attribute__((weak)) smp_prepare_cpu (int cpu) -{ - return 0; -} - static ssize_t show_online(struct sys_device *dev, char *buf) { struct cpu *cpu = container_of(dev, struct cpu, sysdev); @@ -44,9 +39,7 @@ static ssize_t store_online(struct sys_device *dev, const char *buf, kobject_uevent(&dev->kobj, KOBJ_OFFLINE); break; case '1': - ret = smp_prepare_cpu(cpu->sysdev.id); - if (!ret) - ret = cpu_up(cpu->sysdev.id); + ret = cpu_up(cpu->sysdev.id); if (!ret) kobject_uevent(&dev->kobj, KOBJ_ONLINE); break; diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig index 8b1331677407..e57ac5a43246 100644 --- a/drivers/block/Kconfig +++ b/drivers/block/Kconfig @@ -401,7 +401,6 @@ config BLK_DEV_RAM_SIZE config BLK_DEV_INITRD bool "Initial RAM disk (initrd) support" - depends on BLK_DEV_RAM=y help The initial RAM disk is a RAM disk that is loaded by the boot loader (loadlin or lilo) and that is mounted as root before the normal boot diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c index f8ce235ccfc3..c39650920bdf 100644 --- a/drivers/block/ataflop.c +++ b/drivers/block/ataflop.c @@ -271,7 +271,7 @@ unsigned char *DMABuffer; /* buffer for writes */ static unsigned long PhysDMABuffer; /* physical address */ static int UseTrackbuffer = -1; /* Do track buffering? */ -MODULE_PARM(UseTrackbuffer, "i"); +module_param(UseTrackbuffer, int, 0); unsigned char *TrackBuffer; /* buffer for reads */ static unsigned long PhysTrackBuffer; /* physical address */ @@ -296,7 +296,7 @@ static int MotorOn = 0, MotorOffTrys; static int IsFormatting = 0, FormatError; static int UserSteprate[FD_MAX_UNITS] = { -1, -1 }; -MODULE_PARM(UserSteprate, "1-" __MODULE_STRING(FD_MAX_UNITS) "i"); +module_param_array(UserSteprate, int, NULL, 0); /* Synchronization of FDC access. */ static volatile int fdc_busy = 0; diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index fb2d0be7cdeb..840919bba76c 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -4594,7 +4594,7 @@ static void __init parse_floppy_cfg_string(char *cfg) } } -int init_module(void) +int __init init_module(void) { if (floppy) parse_floppy_cfg_string(floppy); diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index a9bde30dadad..8bca4905d7f7 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -639,10 +639,7 @@ static int __init nbd_init(void) int err = -ENOMEM; int i; - if (sizeof(struct nbd_request) != 28) { - printk(KERN_CRIT "nbd: sizeof nbd_request needs to be 28 in order to work!\n" ); - return -EIO; - } + BUILD_BUG_ON(sizeof(struct nbd_request) != 28); if (nbds_max > MAX_NBD) { printk(KERN_CRIT "nbd: cannot allocate more than %u nbds; %u requested.\n", MAX_NBD, diff --git a/drivers/cdrom/cm206.c b/drivers/cdrom/cm206.c index fad27a87ce35..f43a988dd413 100644 --- a/drivers/cdrom/cm206.c +++ b/drivers/cdrom/cm206.c @@ -218,12 +218,12 @@ static int cm206_base = CM206_BASE; static int cm206_irq = CM206_IRQ; #ifdef MODULE static int cm206[2] = { 0, 0 }; /* for compatible `insmod' parameter passing */ +module_param_array(cm206, int, NULL, 0); /* base,irq or irq,base */ #endif -MODULE_PARM(cm206_base, "i"); /* base */ -MODULE_PARM(cm206_irq, "i"); /* irq */ -MODULE_PARM(cm206, "1-2i"); /* base,irq or irq,base */ -MODULE_PARM(auto_probe, "i"); /* auto probe base and irq */ +module_param(cm206_base, int, 0); /* base */ +module_param(cm206_irq, int, 0); /* irq */ +module_param(auto_probe, bool, 0); /* auto probe base and irq */ MODULE_LICENSE("GPL"); #define POLLOOP 100 /* milliseconds */ diff --git a/drivers/cdrom/sbpcd.c b/drivers/cdrom/sbpcd.c index 4760f515f591..05c9e865ecaf 100644 --- a/drivers/cdrom/sbpcd.c +++ b/drivers/cdrom/sbpcd.c @@ -464,8 +464,13 @@ static int sbpcd[] = static __cacheline_aligned DEFINE_SPINLOCK(sbpcd_lock); static struct request_queue *sbpcd_queue; -MODULE_PARM(sbpcd, "2i"); -MODULE_PARM(max_drives, "i"); +/* You can only set the first pair, from old MODULE_PARM code. */ +static int sbpcd_set(const char *val, struct kernel_param *kp) +{ + get_options((char *)val, 2, (int *)sbpcd); + return 0; +} +module_param_call(sbpcd, sbpcd_set, NULL, NULL, 0); #define NUM_PROBE (sizeof(sbpcd) / sizeof(int)) @@ -553,6 +558,7 @@ static unsigned char msgnum; static char msgbuf[80]; static int max_drives = MAX_DRIVES; +module_param(max_drives, int, 0); #ifndef MODULE static unsigned char setup_done; static const char *str_sb_l = "soundblaster"; diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index d745004281d0..abd4c5118a1b 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c @@ -736,7 +736,8 @@ int ipmi_create_user(unsigned int if_num, intf = ipmi_interfaces[if_num]; if ((if_num >= MAX_IPMI_INTERFACES) || IPMI_INVALID_INTERFACE(intf)) { spin_unlock_irqrestore(&interfaces_lock, flags); - return -EINVAL; + rv = -EINVAL; + goto out_kfree; } /* Note that each existing user holds a refcount to the interface. */ @@ -751,14 +752,14 @@ int ipmi_create_user(unsigned int if_num, if (!try_module_get(intf->handlers->owner)) { rv = -ENODEV; - goto out_err; + goto out_kref; } if (intf->handlers->inc_usecount) { rv = intf->handlers->inc_usecount(intf->send_info); if (rv) { module_put(intf->handlers->owner); - goto out_err; + goto out_kref; } } @@ -769,9 +770,10 @@ int ipmi_create_user(unsigned int if_num, *user = new_user; return 0; - out_err: - kfree(new_user); +out_kref: kref_put(&intf->refcount, intf_free); +out_kfree: + kfree(new_user); return rv; } diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c index ede128356af2..e5247f85a446 100644 --- a/drivers/char/istallion.c +++ b/drivers/char/istallion.c @@ -378,13 +378,13 @@ MODULE_DESCRIPTION("Stallion Intelligent Multiport Serial Driver"); MODULE_LICENSE("GPL"); -MODULE_PARM(board0, "1-3s"); +module_param_array(board0, charp, NULL, 0); MODULE_PARM_DESC(board0, "Board 0 config -> name[,ioaddr[,memaddr]"); -MODULE_PARM(board1, "1-3s"); +module_param_array(board1, charp, NULL, 0); MODULE_PARM_DESC(board1, "Board 1 config -> name[,ioaddr[,memaddr]"); -MODULE_PARM(board2, "1-3s"); +module_param_array(board2, charp, NULL, 0); MODULE_PARM_DESC(board2, "Board 2 config -> name[,ioaddr[,memaddr]"); -MODULE_PARM(board3, "1-3s"); +module_param_array(board3, charp, NULL, 0); MODULE_PARM_DESC(board3, "Board 3 config -> name[,ioaddr[,memaddr]"); #endif diff --git a/drivers/char/mem.c b/drivers/char/mem.c index 29c41f4418c0..26d0116b48d4 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c @@ -216,11 +216,9 @@ static ssize_t write_mem(struct file * file, const char __user * buf, copied = copy_from_user(ptr, buf, sz); if (copied) { - ssize_t ret; - - ret = written + (sz - copied); - if (ret) - return ret; + written += sz - copied; + if (written) + break; return -EFAULT; } buf += sz; @@ -456,11 +454,9 @@ do_write_kmem(void *p, unsigned long realp, const char __user * buf, copied = copy_from_user(ptr, buf, sz); if (copied) { - ssize_t ret; - - ret = written + (sz - copied); - if (ret) - return ret; + written += sz - copied; + if (written) + break; return -EFAULT; } buf += sz; @@ -514,11 +510,10 @@ static ssize_t write_kmem(struct file * file, const char __user * buf, if (len) { written = copy_from_user(kbuf, buf, len); if (written) { - ssize_t ret; - + if (wrote + virtr) + break; free_page((unsigned long)kbuf); - ret = wrote + virtr + (len - written); - return ret ? ret : -EFAULT; + return -EFAULT; } } len = vwrite(kbuf, (char *)p, len); @@ -563,8 +558,11 @@ static ssize_t write_port(struct file * file, const char __user * buf, return -EFAULT; while (count-- > 0 && i < 65536) { char c; - if (__get_user(c, tmp)) + if (__get_user(c, tmp)) { + if (tmp > buf) + break; return -EFAULT; + } outb(c,i); i++; tmp++; diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c index ea725a9964e2..0fb2fb9fb024 100644 --- a/drivers/char/mxser.c +++ b/drivers/char/mxser.c @@ -243,10 +243,10 @@ static int verbose = 0; MODULE_AUTHOR("Casper Yang"); MODULE_DESCRIPTION("MOXA Smartio/Industio Family Multiport Board Device Driver"); -MODULE_PARM(ioaddr, "1-4i"); -MODULE_PARM(ttymajor, "i"); -MODULE_PARM(calloutmajor, "i"); -MODULE_PARM(verbose, "i"); +module_param_array(ioaddr, int, NULL, 0); +module_param(ttymajor, int, 0); +module_param(calloutmajor, int, 0); +module_param(verbose, bool, 0); MODULE_LICENSE("GPL"); struct mxser_log { diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c index 306ee0f091a4..bee6c47b45bd 100644 --- a/drivers/char/ppdev.c +++ b/drivers/char/ppdev.c @@ -65,10 +65,11 @@ #include <linux/parport.h> #include <linux/ctype.h> #include <linux/poll.h> -#include <asm/uaccess.h> +#include <linux/major.h> #include <linux/ppdev.h> #include <linux/smp_lock.h> #include <linux/device.h> +#include <asm/uaccess.h> #define PP_VERSION "ppdev: user-space parallel port driver" #define CHRDEV "ppdev" diff --git a/drivers/char/riscom8.c b/drivers/char/riscom8.c index 119e629656b7..657c0d88f48c 100644 --- a/drivers/char/riscom8.c +++ b/drivers/char/riscom8.c @@ -1743,10 +1743,10 @@ static int iobase; static int iobase1; static int iobase2; static int iobase3; -MODULE_PARM(iobase, "i"); -MODULE_PARM(iobase1, "i"); -MODULE_PARM(iobase2, "i"); -MODULE_PARM(iobase3, "i"); +module_param(iobase, int, 0); +module_param(iobase1, int, 0); +module_param(iobase2, int, 0); +module_param(iobase3, int, 0); MODULE_LICENSE("GPL"); #endif /* MODULE */ diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c index d58f82318853..35082dc12eae 100644 --- a/drivers/char/sysrq.c +++ b/drivers/char/sysrq.c @@ -42,16 +42,15 @@ /* Whether we react on sysrq keys or just ignore them */ int sysrq_enabled = 1; -/* Loglevel sysrq handler */ static void sysrq_handle_loglevel(int key, struct pt_regs *pt_regs, - struct tty_struct *tty) + struct tty_struct *tty) { int i; i = key - '0'; console_loglevel = 7; printk("Loglevel set to %d\n", i); console_loglevel = i; -} +} static struct sysrq_key_op sysrq_loglevel_op = { .handler = sysrq_handle_loglevel, .help_msg = "loglevel0-8", @@ -59,11 +58,9 @@ static struct sysrq_key_op sysrq_loglevel_op = { .enable_mask = SYSRQ_ENABLE_LOG, }; - -/* SAK sysrq handler */ #ifdef CONFIG_VT static void sysrq_handle_SAK(int key, struct pt_regs *pt_regs, - struct tty_struct *tty) + struct tty_struct *tty) { if (tty) do_SAK(tty); @@ -75,12 +72,13 @@ static struct sysrq_key_op sysrq_SAK_op = { .action_msg = "SAK", .enable_mask = SYSRQ_ENABLE_KEYBOARD, }; +#else +#define sysrq_SAK_op (*(struct sysrq_key_op *)0) #endif #ifdef CONFIG_VT -/* unraw sysrq handler */ static void sysrq_handle_unraw(int key, struct pt_regs *pt_regs, - struct tty_struct *tty) + struct tty_struct *tty) { struct kbd_struct *kbd = &kbd_table[fg_console]; @@ -93,10 +91,11 @@ static struct sysrq_key_op sysrq_unraw_op = { .action_msg = "Keyboard mode set to XLATE", .enable_mask = SYSRQ_ENABLE_KEYBOARD, }; +#else +#define sysrq_unraw_op (*(struct sysrq_key_op *)0) #endif /* CONFIG_VT */ #ifdef CONFIG_KEXEC -/* crashdump sysrq handler */ static void sysrq_handle_crashdump(int key, struct pt_regs *pt_regs, struct tty_struct *tty) { @@ -108,16 +107,16 @@ static struct sysrq_key_op sysrq_crashdump_op = { .action_msg = "Trigger a crashdump", .enable_mask = SYSRQ_ENABLE_DUMP, }; +#else +#define sysrq_crashdump_op (*(struct sysrq_key_op *)0) #endif -/* reboot sysrq handler */ static void sysrq_handle_reboot(int key, struct pt_regs *pt_regs, - struct tty_struct *tty) + struct tty_struct *tty) { local_irq_enable(); emergency_restart(); } - static struct sysrq_key_op sysrq_reboot_op = { .handler = sysrq_handle_reboot, .help_msg = "reBoot", @@ -126,11 +125,10 @@ static struct sysrq_key_op sysrq_reboot_op = { }; static void sysrq_handle_sync(int key, struct pt_regs *pt_regs, - struct tty_struct *tty) + struct tty_struct *tty) { emergency_sync(); } - static struct sysrq_key_op sysrq_sync_op = { .handler = sysrq_handle_sync, .help_msg = "Sync", @@ -139,11 +137,10 @@ static struct sysrq_key_op sysrq_sync_op = { }; static void sysrq_handle_mountro(int key, struct pt_regs *pt_regs, - struct tty_struct *tty) + struct tty_struct *tty) { emergency_remount(); } - static struct sysrq_key_op sysrq_mountro_op = { .handler = sysrq_handle_mountro, .help_msg = "Unmount", @@ -151,28 +148,23 @@ static struct sysrq_key_op sysrq_mountro_op = { .enable_mask = SYSRQ_ENABLE_REMOUNT, }; -/* END SYNC SYSRQ HANDLERS BLOCK */ - #ifdef CONFIG_DEBUG_MUTEXES - -static void -sysrq_handle_showlocks(int key, struct pt_regs *pt_regs, struct tty_struct *tty) +static void sysrq_handle_showlocks(int key, struct pt_regs *pt_regs, + struct tty_struct *tty) { mutex_debug_show_all_locks(); } - static struct sysrq_key_op sysrq_showlocks_op = { .handler = sysrq_handle_showlocks, .help_msg = "show-all-locks(D)", .action_msg = "Show Locks Held", }; - +#else +#define sysrq_showlocks_op (*(struct sysrq_key_op *)0) #endif -/* SHOW SYSRQ HANDLERS BLOCK */ - static void sysrq_handle_showregs(int key, struct pt_regs *pt_regs, - struct tty_struct *tty) + struct tty_struct *tty) { if (pt_regs) show_regs(pt_regs); @@ -184,9 +176,8 @@ static struct sysrq_key_op sysrq_showregs_op = { .enable_mask = SYSRQ_ENABLE_DUMP, }; - static void sysrq_handle_showstate(int key, struct pt_regs *pt_regs, - struct tty_struct *tty) + struct tty_struct *tty) { show_state(); } @@ -197,9 +188,8 @@ static struct sysrq_key_op sysrq_showstate_op = { .enable_mask = SYSRQ_ENABLE_DUMP, }; - static void sysrq_handle_showmem(int key, struct pt_regs *pt_regs, - struct tty_struct *tty) + struct tty_struct *tty) { show_mem(); } @@ -210,13 +200,9 @@ static struct sysrq_key_op sysrq_showmem_op = { .enable_mask = SYSRQ_ENABLE_DUMP, }; -/* SHOW SYSRQ HANDLERS BLOCK */ - - -/* SIGNAL SYSRQ HANDLERS BLOCK */ - -/* signal sysrq helper function - * Sends a signal to all user processes */ +/* + * Signal sysrq helper function. Sends a signal to all user processes. + */ static void send_sig_all(int sig) { struct task_struct *p; @@ -229,7 +215,7 @@ static void send_sig_all(int sig) } static void sysrq_handle_term(int key, struct pt_regs *pt_regs, - struct tty_struct *tty) + struct tty_struct *tty) { send_sig_all(SIGTERM); console_loglevel = 8; @@ -243,7 +229,8 @@ static struct sysrq_key_op sysrq_term_op = { static void moom_callback(void *ignored) { - out_of_memory(&NODE_DATA(0)->node_zonelists[ZONE_NORMAL], GFP_KERNEL, 0); + out_of_memory(&NODE_DATA(0)->node_zonelists[ZONE_NORMAL], + GFP_KERNEL, 0); } static DECLARE_WORK(moom_work, moom_callback, NULL); @@ -260,7 +247,7 @@ static struct sysrq_key_op sysrq_moom_op = { }; static void sysrq_handle_kill(int key, struct pt_regs *pt_regs, - struct tty_struct *tty) + struct tty_struct *tty) { send_sig_all(SIGKILL); console_loglevel = 8; @@ -272,8 +259,6 @@ static struct sysrq_key_op sysrq_kill_op = { .enable_mask = SYSRQ_ENABLE_SIGNAL, }; -/* END SIGNAL SYSRQ HANDLERS BLOCK */ - static void sysrq_handle_unrt(int key, struct pt_regs *pt_regs, struct tty_struct *tty) { @@ -288,110 +273,99 @@ static struct sysrq_key_op sysrq_unrt_op = { /* Key Operations table and lock */ static DEFINE_SPINLOCK(sysrq_key_table_lock); -#define SYSRQ_KEY_TABLE_LENGTH 36 -static struct sysrq_key_op *sysrq_key_table[SYSRQ_KEY_TABLE_LENGTH] = { -/* 0 */ &sysrq_loglevel_op, -/* 1 */ &sysrq_loglevel_op, -/* 2 */ &sysrq_loglevel_op, -/* 3 */ &sysrq_loglevel_op, -/* 4 */ &sysrq_loglevel_op, -/* 5 */ &sysrq_loglevel_op, -/* 6 */ &sysrq_loglevel_op, -/* 7 */ &sysrq_loglevel_op, -/* 8 */ &sysrq_loglevel_op, -/* 9 */ &sysrq_loglevel_op, -/* a */ NULL, /* Don't use for system provided sysrqs, - it is handled specially on the sparc - and will never arrive */ -/* b */ &sysrq_reboot_op, -#ifdef CONFIG_KEXEC -/* c */ &sysrq_crashdump_op, -#else -/* c */ NULL, -#endif -#ifdef CONFIG_DEBUG_MUTEXES -/* d */ &sysrq_showlocks_op, -#else -/* d */ NULL, -#endif -/* e */ &sysrq_term_op, -/* f */ &sysrq_moom_op, -/* g */ NULL, -/* h */ NULL, -/* i */ &sysrq_kill_op, -/* j */ NULL, -#ifdef CONFIG_VT -/* k */ &sysrq_SAK_op, -#else -/* k */ NULL, -#endif -/* l */ NULL, -/* m */ &sysrq_showmem_op, -/* n */ &sysrq_unrt_op, -/* o */ NULL, /* This will often be registered - as 'Off' at init time */ -/* p */ &sysrq_showregs_op, -/* q */ NULL, -#ifdef CONFIG_VT -/* r */ &sysrq_unraw_op, -#else -/* r */ NULL, -#endif -/* s */ &sysrq_sync_op, -/* t */ &sysrq_showstate_op, -/* u */ &sysrq_mountro_op, -/* v */ NULL, /* May be assigned at init time by SMP VOYAGER */ -/* w */ NULL, -/* x */ NULL, -/* y */ NULL, -/* z */ NULL + +static struct sysrq_key_op *sysrq_key_table[36] = { + &sysrq_loglevel_op, /* 0 */ + &sysrq_loglevel_op, /* 1 */ + &sysrq_loglevel_op, /* 2 */ + &sysrq_loglevel_op, /* 3 */ + &sysrq_loglevel_op, /* 4 */ + &sysrq_loglevel_op, /* 5 */ + &sysrq_loglevel_op, /* 6 */ + &sysrq_loglevel_op, /* 7 */ + &sysrq_loglevel_op, /* 8 */ + &sysrq_loglevel_op, /* 9 */ + + /* + * Don't use for system provided sysrqs, it is handled specially on + * sparc and will never arrive + */ + NULL, /* a */ + &sysrq_reboot_op, /* b */ + &sysrq_crashdump_op, /* c */ + &sysrq_showlocks_op, /* d */ + &sysrq_term_op, /* e */ + &sysrq_moom_op, /* f */ + NULL, /* g */ + NULL, /* h */ + &sysrq_kill_op, /* i */ + NULL, /* j */ + &sysrq_SAK_op, /* k */ + NULL, /* l */ + &sysrq_showmem_op, /* m */ + &sysrq_unrt_op, /* n */ + /* This will often be registered as 'Off' at init time */ + NULL, /* o */ + &sysrq_showregs_op, /* p */ + NULL, /* q */ + &sysrq_unraw_op, /* r */ + &sysrq_sync_op, /* s */ + &sysrq_showstate_op, /* t */ + &sysrq_mountro_op, /* u */ + /* May be assigned at init time by SMP VOYAGER */ + NULL, /* v */ + NULL, /* w */ + NULL, /* x */ + NULL, /* y */ + NULL /* z */ }; /* key2index calculation, -1 on invalid index */ -static int sysrq_key_table_key2index(int key) { +static int sysrq_key_table_key2index(int key) +{ int retval; - if ((key >= '0') && (key <= '9')) { + + if ((key >= '0') && (key <= '9')) retval = key - '0'; - } else if ((key >= 'a') && (key <= 'z')) { + else if ((key >= 'a') && (key <= 'z')) retval = key + 10 - 'a'; - } else { + else retval = -1; - } return retval; } /* * get and put functions for the table, exposed to modules. */ - -struct sysrq_key_op *__sysrq_get_key_op (int key) { - struct sysrq_key_op *op_p; +struct sysrq_key_op *__sysrq_get_key_op(int key) +{ + struct sysrq_key_op *op_p = NULL; int i; - + i = sysrq_key_table_key2index(key); - op_p = (i == -1) ? NULL : sysrq_key_table[i]; + if (i != -1) + op_p = sysrq_key_table[i]; return op_p; } -static void __sysrq_put_key_op (int key, struct sysrq_key_op *op_p) { - int i; +static void __sysrq_put_key_op(int key, struct sysrq_key_op *op_p) +{ + int i = sysrq_key_table_key2index(key); - i = sysrq_key_table_key2index(key); if (i != -1) sysrq_key_table[i] = op_p; } /* - * This is the non-locking version of handle_sysrq - * It must/can only be called by sysrq key handlers, - * as they are inside of the lock + * This is the non-locking version of handle_sysrq. It must/can only be called + * by sysrq key handlers, as they are inside of the lock */ - -void __handle_sysrq(int key, struct pt_regs *pt_regs, struct tty_struct *tty, int check_mask) +void __handle_sysrq(int key, struct pt_regs *pt_regs, struct tty_struct *tty, + int check_mask) { struct sysrq_key_op *op_p; int orig_log_level; - int i, j; + int i; unsigned long flags; spin_lock_irqsave(&sysrq_key_table_lock, flags); @@ -401,26 +375,34 @@ void __handle_sysrq(int key, struct pt_regs *pt_regs, struct tty_struct *tty, in op_p = __sysrq_get_key_op(key); if (op_p) { - /* Should we check for enabled operations (/proc/sysrq-trigger should not) - * and is the invoked operation enabled? */ + /* + * Should we check for enabled operations (/proc/sysrq-trigger + * should not) and is the invoked operation enabled? + */ if (!check_mask || sysrq_enabled == 1 || (sysrq_enabled & op_p->enable_mask)) { - printk ("%s\n", op_p->action_msg); + printk("%s\n", op_p->action_msg); console_loglevel = orig_log_level; op_p->handler(key, pt_regs, tty); - } - else + } else { printk("This sysrq operation is disabled.\n"); + } } else { printk("HELP : "); /* Only print the help msg once per handler */ - for (i=0; i<SYSRQ_KEY_TABLE_LENGTH; i++) - if (sysrq_key_table[i]) { - for (j=0; sysrq_key_table[i] != sysrq_key_table[j]; j++); - if (j == i) - printk ("%s ", sysrq_key_table[i]->help_msg); + for (i = 0; i < ARRAY_SIZE(sysrq_key_table); i++) { + if (sysrq_key_table[i]) { + int j; + + for (j = 0; sysrq_key_table[i] != + sysrq_key_table[j]; j++) + ; + if (j != i) + continue; + printk("%s ", sysrq_key_table[i]->help_msg); + } } - printk ("\n"); + printk("\n"); console_loglevel = orig_log_level; } spin_unlock_irqrestore(&sysrq_key_table_lock, flags); @@ -430,16 +412,17 @@ void __handle_sysrq(int key, struct pt_regs *pt_regs, struct tty_struct *tty, in * This function is called by the keyboard handler when SysRq is pressed * and any other keycode arrives. */ - void handle_sysrq(int key, struct pt_regs *pt_regs, struct tty_struct *tty) { if (!sysrq_enabled) return; __handle_sysrq(key, pt_regs, tty, 1); } +EXPORT_SYMBOL(handle_sysrq); static int __sysrq_swap_key_ops(int key, struct sysrq_key_op *insert_op_p, - struct sysrq_key_op *remove_op_p) { + struct sysrq_key_op *remove_op_p) +{ int retval; unsigned long flags; @@ -452,7 +435,6 @@ static int __sysrq_swap_key_ops(int key, struct sysrq_key_op *insert_op_p, retval = -1; } spin_unlock_irqrestore(&sysrq_key_table_lock, flags); - return retval; } @@ -460,12 +442,10 @@ int register_sysrq_key(int key, struct sysrq_key_op *op_p) { return __sysrq_swap_key_ops(key, op_p, NULL); } +EXPORT_SYMBOL(register_sysrq_key); int unregister_sysrq_key(int key, struct sysrq_key_op *op_p) { return __sysrq_swap_key_ops(key, NULL, op_p); } - -EXPORT_SYMBOL(handle_sysrq); -EXPORT_SYMBOL(register_sysrq_key); EXPORT_SYMBOL(unregister_sysrq_key); diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h index fd3a4beaa53d..dec0224b4478 100644 --- a/drivers/char/tpm/tpm.h +++ b/drivers/char/tpm/tpm.h @@ -24,6 +24,7 @@ #include <linux/fs.h> #include <linux/miscdevice.h> #include <linux/platform_device.h> +#include <linux/io.h> enum tpm_timeout { TPM_TIMEOUT = 5, /* msecs */ diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 76592ee1fb38..48d795bb8c4b 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c @@ -354,7 +354,7 @@ int tty_buffer_request_room(struct tty_struct *tty, size_t size) EXPORT_SYMBOL_GPL(tty_buffer_request_room); -int tty_insert_flip_string(struct tty_struct *tty, unsigned char *chars, size_t size) +int tty_insert_flip_string(struct tty_struct *tty, const unsigned char *chars, size_t size) { int copied = 0; do { @@ -378,7 +378,7 @@ int tty_insert_flip_string(struct tty_struct *tty, unsigned char *chars, size_t EXPORT_SYMBOL_GPL(tty_insert_flip_string); -int tty_insert_flip_string_flags(struct tty_struct *tty, unsigned char *chars, char *flags, size_t size) +int tty_insert_flip_string_flags(struct tty_struct *tty, const unsigned char *chars, const char *flags, size_t size) { int copied = 0; do { diff --git a/drivers/char/watchdog/Kconfig b/drivers/char/watchdog/Kconfig index c0dfcf273f0a..16e99db2e12d 100644 --- a/drivers/char/watchdog/Kconfig +++ b/drivers/char/watchdog/Kconfig @@ -148,6 +148,16 @@ config MPCORE_WATCHDOG To compile this driver as a module, choose M here: the module will be called mpcore_wdt. +config EP93XX_WATCHDOG + tristate "EP93xx Watchdog" + depends on WATCHDOG && ARCH_EP93XX + help + Say Y here if to include support for the watchdog timer + embedded in the Cirrus Logic EP93xx family of devices. + + To compile this driver as a module, choose M here: the + module will be called ep93xx_wdt. + # X86 (i386 + ia64 + x86_64) Architecture config ACQUIRE_WDT diff --git a/drivers/char/watchdog/Makefile b/drivers/char/watchdog/Makefile index 36c0b282b8ba..d6f27fde9905 100644 --- a/drivers/char/watchdog/Makefile +++ b/drivers/char/watchdog/Makefile @@ -30,6 +30,7 @@ obj-$(CONFIG_IXP4XX_WATCHDOG) += ixp4xx_wdt.o obj-$(CONFIG_S3C2410_WATCHDOG) += s3c2410_wdt.o obj-$(CONFIG_SA1100_WATCHDOG) += sa1100_wdt.o obj-$(CONFIG_MPCORE_WATCHDOG) += mpcore_wdt.o +obj-$(CONFIG_EP93XX_WATCHDOG) += ep93xx_wdt.o # X86 (i386 + ia64 + x86_64) Architecture obj-$(CONFIG_ACQUIRE_WDT) += acquirewdt.o diff --git a/drivers/char/watchdog/ep93xx_wdt.c b/drivers/char/watchdog/ep93xx_wdt.c new file mode 100644 index 000000000000..9021dbb78299 --- /dev/null +++ b/drivers/char/watchdog/ep93xx_wdt.c @@ -0,0 +1,257 @@ +/* + * Watchdog driver for Cirrus Logic EP93xx family of devices. + * + * Copyright (c) 2004 Ray Lehtiniemi + * Copyright (c) 2006 Tower Technologies + * Based on ep93xx driver, bits from alim7101_wdt.c + * + * Authors: Ray Lehtiniemi <rayl@mail.com>, + * Alessandro Zummo <a.zummo@towertech.it> + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + * + * This watchdog fires after 250msec, which is a too short interval + * for us to rely on the user space daemon alone. So we ping the + * wdt each ~200msec and eventually stop doing it if the user space + * daemon dies. + * + * TODO: + * + * - Test last reset from watchdog status + * - Add a few missing ioctls + */ + +#include <linux/module.h> +#include <linux/fs.h> +#include <linux/miscdevice.h> +#include <linux/watchdog.h> +#include <linux/timer.h> + +#include <asm/hardware.h> +#include <asm/uaccess.h> + +#define WDT_VERSION "0.3" +#define PFX "ep93xx_wdt: " + +/* default timeout (secs) */ +#define WDT_TIMEOUT 30 + +static int nowayout = WATCHDOG_NOWAYOUT; +static int timeout = WDT_TIMEOUT; + +static struct timer_list timer; +static unsigned long next_heartbeat; +static unsigned long wdt_status; +static unsigned long boot_status; + +#define WDT_IN_USE 0 +#define WDT_OK_TO_CLOSE 1 + +#define EP93XX_WDT_REG(x) (EP93XX_WATCHDOG_BASE + (x)) +#define EP93XX_WDT_WATCHDOG EP93XX_WDT_REG(0x00) +#define EP93XX_WDT_WDSTATUS EP93XX_WDT_REG(0x04) + +/* reset the wdt every ~200ms */ +#define WDT_INTERVAL (HZ/5) + +static void wdt_enable(void) +{ + __raw_writew(0xaaaa, EP93XX_WDT_WATCHDOG); +} + +static void wdt_disable(void) +{ + __raw_writew(0xaa55, EP93XX_WDT_WATCHDOG); +} + +static inline void wdt_ping(void) +{ + __raw_writew(0x5555, EP93XX_WDT_WATCHDOG); +} + +static void wdt_startup(void) +{ + next_heartbeat = jiffies + (timeout * HZ); + + wdt_enable(); + mod_timer(&timer, jiffies + WDT_INTERVAL); +} + +static void wdt_shutdown(void) +{ + del_timer_sync(&timer); + wdt_disable(); +} + +static void wdt_keepalive(void) +{ + /* user land ping */ + next_heartbeat = jiffies + (timeout * HZ); +} + +static int ep93xx_wdt_open(struct inode *inode, struct file *file) +{ + if (test_and_set_bit(WDT_IN_USE, &wdt_status)) + return -EBUSY; + + clear_bit(WDT_OK_TO_CLOSE, &wdt_status); + + wdt_startup(); + + return nonseekable_open(inode, file); +} + +static ssize_t +ep93xx_wdt_write(struct file *file, const char __user *data, size_t len, + loff_t *ppos) +{ + /* Can't seek (pwrite) on this device */ + if (*ppos != file->f_pos) + return -ESPIPE; + + if (len) { + if (!nowayout) { + size_t i; + + clear_bit(WDT_OK_TO_CLOSE, &wdt_status); + + for (i = 0; i != len; i++) { + char c; + + if (get_user(c, data + i)) + return -EFAULT; + + if (c == 'V') + set_bit(WDT_OK_TO_CLOSE, &wdt_status); + else + clear_bit(WDT_OK_TO_CLOSE, &wdt_status); + } + } + wdt_keepalive(); + } + + return len; +} + +static struct watchdog_info ident = { + .options = WDIOF_CARDRESET | WDIOF_MAGICCLOSE, + .identity = "EP93xx Watchdog", +}; + +static int +ep93xx_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, + unsigned long arg) +{ + int ret = -ENOIOCTLCMD; + + switch (cmd) { + case WDIOC_GETSUPPORT: + ret = copy_to_user((struct watchdog_info __user *)arg, &ident, + sizeof(ident)) ? -EFAULT : 0; + break; + + case WDIOC_GETSTATUS: + ret = put_user(0, (int __user *)arg); + break; + + case WDIOC_GETBOOTSTATUS: + ret = put_user(boot_status, (int __user *)arg); + break; + + case WDIOC_GETTIMEOUT: + /* actually, it is 0.250 seconds.... */ + ret = put_user(1, (int __user *)arg); + break; + + case WDIOC_KEEPALIVE: + wdt_keepalive(); + ret = 0; + break; + } + return ret; +} + +static int ep93xx_wdt_release(struct inode *inode, struct file *file) +{ + if (test_bit(WDT_OK_TO_CLOSE, &wdt_status)) + wdt_shutdown(); + else + printk(KERN_CRIT PFX "Device closed unexpectedly - " + "timer will not stop\n"); + + clear_bit(WDT_IN_USE, &wdt_status); + clear_bit(WDT_OK_TO_CLOSE, &wdt_status); + + return 0; +} + +static struct file_operations ep93xx_wdt_fops = { + .owner = THIS_MODULE, + .write = ep93xx_wdt_write, + .ioctl = ep93xx_wdt_ioctl, + .open = ep93xx_wdt_open, + .release = ep93xx_wdt_release, +}; + +static struct miscdevice ep93xx_wdt_miscdev = { + .minor = WATCHDOG_MINOR, + .name = "watchdog", + .fops = &ep93xx_wdt_fops, +}; + +static void ep93xx_timer_ping(unsigned long data) +{ + if (time_before(jiffies, next_heartbeat)) + wdt_ping(); + + /* Re-set the timer interval */ + mod_timer(&timer, jiffies + WDT_INTERVAL); +} + +static int __init ep93xx_wdt_init(void) +{ + int err; + + err = misc_register(&ep93xx_wdt_miscdev); + + boot_status = __raw_readl(EP93XX_WDT_WATCHDOG) & 0x01 ? 1 : 0; + + printk(KERN_INFO PFX "EP93XX watchdog, driver version " + WDT_VERSION "%s\n", + (__raw_readl(EP93XX_WDT_WATCHDOG) & 0x08) + ? " (nCS1 disable detected)" : ""); + + if (timeout < 1 || timeout > 3600) { + timeout = WDT_TIMEOUT; + printk(KERN_INFO PFX + "timeout value must be 1<=x<=3600, using %d\n", + timeout); + } + + setup_timer(&timer, ep93xx_timer_ping, 1); + return err; +} + +static void __exit ep93xx_wdt_exit(void) +{ + wdt_shutdown(); + misc_deregister(&ep93xx_wdt_miscdev); +} + +module_init(ep93xx_wdt_init); +module_exit(ep93xx_wdt_exit); + +module_param(nowayout, int, 0); +MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started"); + +module_param(timeout, int, 0); +MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. (1<=timeout<=3600, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ")"); + +MODULE_AUTHOR("Ray Lehtiniemi <rayl@mail.com>," + "Alessandro Zummo <a.zummo@towertech.it>"); +MODULE_DESCRIPTION("EP93xx Watchdog"); +MODULE_LICENSE("GPL"); +MODULE_VERSION(WDT_VERSION); +MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); diff --git a/drivers/dio/dio-driver.c b/drivers/dio/dio-driver.c index ca8e69d2f64d..e4c48e329367 100644 --- a/drivers/dio/dio-driver.c +++ b/drivers/dio/dio-driver.c @@ -71,22 +71,17 @@ static int dio_device_probe(struct device *dev) * @drv: the driver structure to register * * Adds the driver structure to the list of registered drivers - * Returns the number of DIO devices which were claimed by the driver - * during registration. The driver remains registered even if the - * return value is zero. + * Returns zero or a negative error value. */ int dio_register_driver(struct dio_driver *drv) { - int count = 0; - /* initialize common driver fields */ drv->driver.name = drv->name; drv->driver.bus = &dio_bus_type; /* register with core */ - count = driver_register(&drv->driver); - return count ? count : 1; + return driver_register(&drv->driver); } diff --git a/drivers/eisa/.gitignore b/drivers/eisa/.gitignore new file mode 100644 index 000000000000..4b335c0aedb0 --- /dev/null +++ b/drivers/eisa/.gitignore @@ -0,0 +1 @@ +devlist.h diff --git a/drivers/eisa/eisa-bus.c b/drivers/eisa/eisa-bus.c index 4196137e66de..6078e2f58817 100644 --- a/drivers/eisa/eisa-bus.c +++ b/drivers/eisa/eisa-bus.c @@ -135,13 +135,8 @@ struct bus_type eisa_bus_type = { int eisa_driver_register (struct eisa_driver *edrv) { - int r; - edrv->driver.bus = &eisa_bus_type; - if ((r = driver_register (&edrv->driver)) < 0) - return r; - - return 0; + return driver_register (&edrv->driver); } void eisa_driver_unregister (struct eisa_driver *edrv) diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index b2cc43702f65..3fdab563fec2 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c @@ -2058,7 +2058,7 @@ static void __init parse_options (char *line) } } -int init_module (void) +int __init init_module (void) { parse_options(options); return ide_init(); diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index 8c12a974b411..a81f987978c8 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c @@ -23,6 +23,7 @@ #include <linux/slab.h> #include <linux/spi/spi.h> #include <linux/spi/ads7846.h> +#include <linux/interrupt.h> #ifdef CONFIG_ARM #include <asm/mach-types.h> diff --git a/drivers/isdn/hardware/avm/b1dma.c b/drivers/isdn/hardware/avm/b1dma.c index 91dd0551fc7c..4d64e5cbcdbf 100644 --- a/drivers/isdn/hardware/avm/b1dma.c +++ b/drivers/isdn/hardware/avm/b1dma.c @@ -39,7 +39,7 @@ MODULE_AUTHOR("Carsten Paeth"); MODULE_LICENSE("GPL"); static int suppress_pollack = 0; -MODULE_PARM(suppress_pollack, "0-1i"); +module_param(suppress_pollack, bool, 0); /* ------------------------------------------------------------- */ diff --git a/drivers/isdn/hardware/avm/b1isa.c b/drivers/isdn/hardware/avm/b1isa.c index 38bd4dfecbd1..80fb488848b8 100644 --- a/drivers/isdn/hardware/avm/b1isa.c +++ b/drivers/isdn/hardware/avm/b1isa.c @@ -169,8 +169,8 @@ static struct pci_dev isa_dev[MAX_CARDS]; static int io[MAX_CARDS]; static int irq[MAX_CARDS]; -MODULE_PARM(io, "1-" __MODULE_STRING(MAX_CARDS) "i"); -MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_CARDS) "i"); +module_param_array(io, int, NULL, 0); +module_param_array(irq, int, NULL, 0); MODULE_PARM_DESC(io, "I/O base address(es)"); MODULE_PARM_DESC(irq, "IRQ number(s) (assigned)"); diff --git a/drivers/isdn/hardware/avm/c4.c b/drivers/isdn/hardware/avm/c4.c index 724aac2c1cca..f7253b2136ea 100644 --- a/drivers/isdn/hardware/avm/c4.c +++ b/drivers/isdn/hardware/avm/c4.c @@ -50,7 +50,7 @@ MODULE_DEVICE_TABLE(pci, c4_pci_tbl); MODULE_DESCRIPTION("CAPI4Linux: Driver for AVM C2/C4 cards"); MODULE_AUTHOR("Carsten Paeth"); MODULE_LICENSE("GPL"); -MODULE_PARM(suppress_pollack, "0-1i"); +module_param(suppress_pollack, bool, 0); /* ------------------------------------------------------------- */ diff --git a/drivers/isdn/hardware/avm/t1isa.c b/drivers/isdn/hardware/avm/t1isa.c index 3b701d97bdf1..5a2f854d55b5 100644 --- a/drivers/isdn/hardware/avm/t1isa.c +++ b/drivers/isdn/hardware/avm/t1isa.c @@ -519,9 +519,9 @@ static int io[MAX_CARDS]; static int irq[MAX_CARDS]; static int cardnr[MAX_CARDS]; -MODULE_PARM(io, "1-" __MODULE_STRING(MAX_CARDS) "i"); -MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_CARDS) "i"); -MODULE_PARM(cardnr, "1-" __MODULE_STRING(MAX_CARDS) "i"); +module_param_array(io, int, NULL, 0); +module_param_array(irq, int, NULL, 0); +module_param_array(cardnr, int, NULL, 0); MODULE_PARM_DESC(io, "I/O base address(es)"); MODULE_PARM_DESC(irq, "IRQ number(s) (assigned)"); MODULE_PARM_DESC(cardnr, "Card number(s) (as jumpered)"); diff --git a/drivers/isdn/hysdn/boardergo.c b/drivers/isdn/hysdn/boardergo.c index e19a01a305a9..48d134be9908 100644 --- a/drivers/isdn/hysdn/boardergo.c +++ b/drivers/isdn/hysdn/boardergo.c @@ -38,8 +38,8 @@ ergo_interrupt(int intno, void *dev_id, struct pt_regs *regs) { hysdn_card *card = dev_id; /* parameter from irq */ tErgDpram *dpr; - ulong flags; - uchar volatile b; + unsigned long flags; + unsigned char volatile b; if (!card) return IRQ_NONE; /* error -> spurious interrupt */ @@ -77,7 +77,7 @@ ergo_irq_bh(hysdn_card * card) { tErgDpram *dpr; int again; - ulong flags; + unsigned long flags; if (card->state != CARD_STATE_RUN) return; /* invalid call */ @@ -131,8 +131,8 @@ ergo_irq_bh(hysdn_card * card) static void ergo_stopcard(hysdn_card * card) { - ulong flags; - uchar val; + unsigned long flags; + unsigned char val; hysdn_net_release(card); /* first release the net device if existing */ #ifdef CONFIG_HYSDN_CAPI @@ -157,7 +157,7 @@ ergo_stopcard(hysdn_card * card) static void ergo_set_errlog_state(hysdn_card * card, int on) { - ulong flags; + unsigned long flags; if (card->state != CARD_STATE_RUN) { card->err_log_state = ERRLOG_STATE_OFF; /* must be off */ @@ -217,9 +217,10 @@ ergo_testram(hysdn_card * card) /* Negative return values are interpreted as errors. */ /*****************************************************************************/ static int -ergo_writebootimg(struct HYSDN_CARD *card, uchar * buf, ulong offs) +ergo_writebootimg(struct HYSDN_CARD *card, unsigned char *buf, + unsigned long offs) { - uchar *dst; + unsigned char *dst; tErgDpram *dpram; int cnt = (BOOT_IMG_SIZE >> 2); /* number of words to move and swap (byte order!) */ @@ -264,14 +265,14 @@ ergo_writebootimg(struct HYSDN_CARD *card, uchar * buf, ulong offs) /* case of errors a negative error value is returned. */ /********************************************************************************/ static int -ergo_writebootseq(struct HYSDN_CARD *card, uchar * buf, int len) +ergo_writebootseq(struct HYSDN_CARD *card, unsigned char *buf, int len) { tDpramBootSpooler *sp = (tDpramBootSpooler *) card->dpram; - uchar *dst; - uchar buflen; + unsigned char *dst; + unsigned char buflen; int nr_write; - uchar tmp_rdptr; - uchar wr_mirror; + unsigned char tmp_rdptr; + unsigned char wr_mirror; int i; if (card->debug_flags & LOG_POF_CARD) @@ -330,7 +331,7 @@ ergo_waitpofready(struct HYSDN_CARD *card) { tErgDpram *dpr = card->dpram; /* pointer to DPRAM structure */ int timecnt = 10000 / 50; /* timeout is 10 secs max. */ - ulong flags; + unsigned long flags; int msg_size; int i; @@ -345,7 +346,7 @@ ergo_waitpofready(struct HYSDN_CARD *card) if ((dpr->ToPcChannel != CHAN_SYSTEM) || (dpr->ToPcSize < MIN_RDY_MSG_SIZE) || (dpr->ToPcSize > MAX_RDY_MSG_SIZE) || - ((*(ulong *) dpr->ToPcBuf) != RDY_MAGIC)) + ((*(unsigned long *) dpr->ToPcBuf) != RDY_MAGIC)) break; /* an error occurred */ /* Check for additional data delivered during SysReady */ diff --git a/drivers/isdn/hysdn/boardergo.h b/drivers/isdn/hysdn/boardergo.h index b56ff0889ead..c59422aa8c3f 100644 --- a/drivers/isdn/hysdn/boardergo.h +++ b/drivers/isdn/hysdn/boardergo.h @@ -23,36 +23,36 @@ /* following DPRAM layout copied from OS2-driver boarderg.h */ typedef struct ErgDpram_tag { -/*0000 */ uchar ToHyBuf[ERG_TO_HY_BUF_SIZE]; -/*0E00 */ uchar ToPcBuf[ERG_TO_PC_BUF_SIZE]; +/*0000 */ unsigned char ToHyBuf[ERG_TO_HY_BUF_SIZE]; +/*0E00 */ unsigned char ToPcBuf[ERG_TO_PC_BUF_SIZE]; - /*1C00 */ uchar bSoftUart[SIZE_RSV_SOFT_UART]; + /*1C00 */ unsigned char bSoftUart[SIZE_RSV_SOFT_UART]; /* size 0x1B0 */ - /*1DB0 *//* tErrLogEntry */ uchar volatile ErrLogMsg[64]; + /*1DB0 *//* tErrLogEntry */ unsigned char volatile ErrLogMsg[64]; /* size 64 bytes */ - /*1DB0 ulong ulErrType; */ - /*1DB4 ulong ulErrSubtype; */ - /*1DB8 ulong ucTextSize; */ - /*1DB9 ulong ucText[ERRLOG_TEXT_SIZE]; *//* ASCIIZ of len ucTextSize-1 */ + /*1DB0 unsigned long ulErrType; */ + /*1DB4 unsigned long ulErrSubtype; */ + /*1DB8 unsigned long ucTextSize; */ + /*1DB9 unsigned long ucText[ERRLOG_TEXT_SIZE]; *//* ASCIIZ of len ucTextSize-1 */ /*1DF0 */ -/*1DF0 */ word volatile ToHyChannel; -/*1DF2 */ word volatile ToHySize; - /*1DF4 */ uchar volatile ToHyFlag; +/*1DF0 */ unsigned short volatile ToHyChannel; +/*1DF2 */ unsigned short volatile ToHySize; + /*1DF4 */ unsigned char volatile ToHyFlag; /* !=0: msg for Hy waiting */ - /*1DF5 */ uchar volatile ToPcFlag; + /*1DF5 */ unsigned char volatile ToPcFlag; /* !=0: msg for PC waiting */ -/*1DF6 */ word volatile ToPcChannel; -/*1DF8 */ word volatile ToPcSize; - /*1DFA */ uchar bRes1DBA[0x1E00 - 0x1DFA]; +/*1DF6 */ unsigned short volatile ToPcChannel; +/*1DF8 */ unsigned short volatile ToPcSize; + /*1DFA */ unsigned char bRes1DBA[0x1E00 - 0x1DFA]; /* 6 bytes */ -/*1E00 */ uchar bRestOfEntryTbl[0x1F00 - 0x1E00]; -/*1F00 */ ulong TrapTable[62]; - /*1FF8 */ uchar bRes1FF8[0x1FFB - 0x1FF8]; +/*1E00 */ unsigned char bRestOfEntryTbl[0x1F00 - 0x1E00]; +/*1F00 */ unsigned long TrapTable[62]; + /*1FF8 */ unsigned char bRes1FF8[0x1FFB - 0x1FF8]; /* low part of reset vetor */ -/*1FFB */ uchar ToPcIntMetro; +/*1FFB */ unsigned char ToPcIntMetro; /* notes: * - metro has 32-bit boot ram - accessing * ToPcInt and ToHyInt would be the same; @@ -65,16 +65,16 @@ typedef struct ErgDpram_tag { * so E1 side should NOT change this byte * when writing! */ -/*1FFC */ uchar volatile ToHyNoDpramErrLog; +/*1FFC */ unsigned char volatile ToHyNoDpramErrLog; /* note: ToHyNoDpramErrLog is used to inform * boot loader, not to use DPRAM based * ErrLog; when DOS driver is rewritten * this becomes obsolete */ -/*1FFD */ uchar bRes1FFD; - /*1FFE */ uchar ToPcInt; +/*1FFD */ unsigned char bRes1FFD; + /*1FFE */ unsigned char ToPcInt; /* E1_intclear; on CHAMP2: E1_intset */ - /*1FFF */ uchar ToHyInt; + /*1FFF */ unsigned char ToHyInt; /* E1_intset; on CHAMP2: E1_intclear */ } tErgDpram; diff --git a/drivers/isdn/hysdn/hycapi.c b/drivers/isdn/hysdn/hycapi.c index acc1d3cceebb..6bac43cc91bd 100644 --- a/drivers/isdn/hysdn/hycapi.c +++ b/drivers/isdn/hysdn/hycapi.c @@ -31,7 +31,7 @@ static char hycapi_revision[]="$Revision: 1.8.6.4 $"; unsigned int hycapi_enable = 0xffffffff; -MODULE_PARM(hycapi_enable, "i"); +module_param(hycapi_enable, uint, 0); typedef struct _hycapi_appl { unsigned int ctrl_mask; @@ -523,7 +523,7 @@ New nccis are created if necessary. *******************************************************************/ void -hycapi_rx_capipkt(hysdn_card * card, uchar * buf, word len) +hycapi_rx_capipkt(hysdn_card * card, unsigned char *buf, unsigned short len) { struct sk_buff *skb; hycapictrl_info *cinfo = card->hyctrlinfo; diff --git a/drivers/isdn/hysdn/hysdn_boot.c b/drivers/isdn/hysdn/hysdn_boot.c index 7bfba196f315..6d0eb0f42fca 100644 --- a/drivers/isdn/hysdn/hysdn_boot.c +++ b/drivers/isdn/hysdn/hysdn_boot.c @@ -30,17 +30,17 @@ /* needed during boot and so allocated dynamically. */ /************************************************************/ struct boot_data { - word Cryptor; /* for use with Decrypt function */ - word Nrecs; /* records remaining in file */ - uchar pof_state; /* actual state of read handler */ - uchar is_crypted; /* card data is crypted */ + unsigned short Cryptor; /* for use with Decrypt function */ + unsigned short Nrecs; /* records remaining in file */ + unsigned char pof_state;/* actual state of read handler */ + unsigned char is_crypted;/* card data is crypted */ int BufSize; /* actual number of bytes bufferd */ int last_error; /* last occurred error */ - word pof_recid; /* actual pof recid */ - ulong pof_reclen; /* total length of pof record data */ - ulong pof_recoffset; /* actual offset inside pof record */ + unsigned short pof_recid;/* actual pof recid */ + unsigned long pof_reclen;/* total length of pof record data */ + unsigned long pof_recoffset;/* actual offset inside pof record */ union { - uchar BootBuf[BOOT_BUF_SIZE]; /* buffer as byte count */ + unsigned char BootBuf[BOOT_BUF_SIZE];/* buffer as byte count */ tPofRecHdr PofRecHdr; /* header for actual record/chunk */ tPofFileHdr PofFileHdr; /* header from POF file */ tPofTimeStamp PofTime; /* time information */ @@ -69,11 +69,11 @@ StartDecryption(struct boot_data *boot) static void DecryptBuf(struct boot_data *boot, int cnt) { - uchar *bufp = boot->buf.BootBuf; + unsigned char *bufp = boot->buf.BootBuf; while (cnt--) { boot->Cryptor = (boot->Cryptor >> 1) ^ ((boot->Cryptor & 1U) ? CRYPT_FEEDTERM : 0); - *bufp++ ^= (uchar) boot->Cryptor; + *bufp++ ^= (unsigned char)boot->Cryptor; } } /* DecryptBuf */ @@ -86,7 +86,7 @@ pof_handle_data(hysdn_card * card, int datlen) { struct boot_data *boot = card->boot; /* pointer to boot specific data */ long l; - uchar *imgp; + unsigned char *imgp; int img_len; /* handle the different record types */ @@ -197,7 +197,7 @@ pof_write_buffer(hysdn_card * card, int datlen) break; } /* Setup the new state and vars */ - boot->Nrecs = (word) (boot->buf.PofFileHdr.N_PofRecs); /* limited to 65535 */ + boot->Nrecs = (unsigned short)(boot->buf.PofFileHdr.N_PofRecs); /* limited to 65535 */ boot->pof_state = POF_READ_TAG_HEAD; /* now start with single tags */ boot->last_error = sizeof(tPofRecHdr); /* new length */ break; @@ -268,7 +268,7 @@ pof_write_buffer(hysdn_card * card, int datlen) /* occurred. Additionally the pointer to the buffer data area is set on success */ /*******************************************************************************/ int -pof_write_open(hysdn_card * card, uchar ** bufp) +pof_write_open(hysdn_card * card, unsigned char **bufp) { struct boot_data *boot; /* pointer to boot specific data */ @@ -335,7 +335,7 @@ pof_write_close(hysdn_card * card) /* when POF has been booted. A return value of 0 is used if no error occurred. */ /*********************************************************************************/ int -EvalSysrTokData(hysdn_card * card, uchar * cp, int len) +EvalSysrTokData(hysdn_card *card, unsigned char *cp, int len) { u_char *p; u_char crc; diff --git a/drivers/isdn/hysdn/hysdn_defs.h b/drivers/isdn/hysdn/hysdn_defs.h index 432f6f99089e..3a9b29b38bc4 100644 --- a/drivers/isdn/hysdn/hysdn_defs.h +++ b/drivers/isdn/hysdn/hysdn_defs.h @@ -20,14 +20,6 @@ #include <linux/workqueue.h> #include <linux/skbuff.h> -/****************************/ -/* storage type definitions */ -/****************************/ -#define uchar unsigned char -#define uint unsigned int -#define ulong unsigned long -#define word unsigned short - #include "ince1pc.h" #ifdef CONFIG_HYSDN_CAPI @@ -147,18 +139,18 @@ typedef struct HYSDN_CARD { /* general variables for the cards */ int myid; /* own driver card id */ - uchar bus; /* pci bus the card is connected to */ - uchar devfn; /* slot+function bit encoded */ - word subsysid; /* PCI subsystem id */ - uchar brdtype; /* type of card */ - uint bchans; /* number of available B-channels */ - uint faxchans; /* number of available fax-channels */ - uchar mac_addr[6]; /* MAC Address read from card */ - uint irq; /* interrupt number */ - uint iobase; /* IO-port base address */ - ulong plxbase; /* PLX memory base */ - ulong membase; /* DPRAM memory base */ - ulong memend; /* DPRAM memory end */ + unsigned char bus; /* pci bus the card is connected to */ + unsigned char devfn; /* slot+function bit encoded */ + unsigned short subsysid;/* PCI subsystem id */ + unsigned char brdtype; /* type of card */ + unsigned int bchans; /* number of available B-channels */ + unsigned int faxchans; /* number of available fax-channels */ + unsigned char mac_addr[6];/* MAC Address read from card */ + unsigned int irq; /* interrupt number */ + unsigned int iobase; /* IO-port base address */ + unsigned long plxbase; /* PLX memory base */ + unsigned long membase; /* DPRAM memory base */ + unsigned long memend; /* DPRAM memory end */ void *dpram; /* mapped dpram */ int state; /* actual state of card -> CARD_STATE_** */ struct HYSDN_CARD *next; /* pointer to next card */ @@ -168,26 +160,26 @@ typedef struct HYSDN_CARD { void *procconf; /* pointer to procconf filesystem specific data */ /* debugging and logging */ - uchar err_log_state; /* actual error log state of the card */ - ulong debug_flags; /* tells what should be debugged and where */ + unsigned char err_log_state;/* actual error log state of the card */ + unsigned long debug_flags;/* tells what should be debugged and where */ void (*set_errlog_state) (struct HYSDN_CARD *, int); /* interrupt handler + interrupt synchronisation */ struct work_struct irq_queue; /* interrupt task queue */ - uchar volatile irq_enabled; /* interrupt enabled if != 0 */ - uchar volatile hw_lock; /* hardware is currently locked -> no access */ + unsigned char volatile irq_enabled;/* interrupt enabled if != 0 */ + unsigned char volatile hw_lock;/* hardware is currently locked -> no access */ /* boot process */ void *boot; /* pointer to boot private data */ - int (*writebootimg) (struct HYSDN_CARD *, uchar *, ulong); - int (*writebootseq) (struct HYSDN_CARD *, uchar *, int); + int (*writebootimg) (struct HYSDN_CARD *, unsigned char *, unsigned long); + int (*writebootseq) (struct HYSDN_CARD *, unsigned char *, int); int (*waitpofready) (struct HYSDN_CARD *); int (*testram) (struct HYSDN_CARD *); /* scheduler for data transfer (only async parts) */ - uchar async_data[256]; /* async data to be sent (normally for config) */ - word volatile async_len; /* length of data to sent */ - word volatile async_channel; /* channel number for async transfer */ + unsigned char async_data[256];/* async data to be sent (normally for config) */ + unsigned short volatile async_len;/* length of data to sent */ + unsigned short volatile async_channel;/* channel number for async transfer */ int volatile async_busy; /* flag != 0 sending in progress */ int volatile net_tx_busy; /* a network packet tx is in progress */ @@ -251,15 +243,18 @@ extern int ergo_inithardware(hysdn_card * card); /* get hardware -> module init /* hysdn_boot.c */ extern int pof_write_close(hysdn_card *); /* close proc file after writing pof */ -extern int pof_write_open(hysdn_card *, uchar **); /* open proc file for writing pof */ +extern int pof_write_open(hysdn_card *, unsigned char **); /* open proc file for writing pof */ extern int pof_write_buffer(hysdn_card *, int); /* write boot data to card */ -extern int EvalSysrTokData(hysdn_card *, uchar *, int); /* Check Sysready Token Data */ +extern int EvalSysrTokData(hysdn_card *, unsigned char *, int); /* Check Sysready Token Data */ /* hysdn_sched.c */ -extern int hysdn_sched_tx(hysdn_card *, uchar *, word volatile *, word volatile *, - word); -extern int hysdn_sched_rx(hysdn_card *, uchar *, word, word); -extern int hysdn_tx_cfgline(hysdn_card *, uchar *, word); /* send one cfg line */ +extern int hysdn_sched_tx(hysdn_card *, unsigned char *, + unsigned short volatile *, unsigned short volatile *, + unsigned short); +extern int hysdn_sched_rx(hysdn_card *, unsigned char *, unsigned short, + unsigned short); +extern int hysdn_tx_cfgline(hysdn_card *, unsigned char *, + unsigned short); /* send one cfg line */ /* hysdn_net.c */ extern unsigned int hynet_enable; @@ -269,14 +264,16 @@ extern int hysdn_net_release(hysdn_card *); /* delete the device */ extern char *hysdn_net_getname(hysdn_card *); /* get name of net interface */ extern void hysdn_tx_netack(hysdn_card *); /* acknowledge a packet tx */ extern struct sk_buff *hysdn_tx_netget(hysdn_card *); /* get next network packet */ -extern void hysdn_rx_netpkt(hysdn_card *, uchar *, word); /* rxed packet from network */ +extern void hysdn_rx_netpkt(hysdn_card *, unsigned char *, + unsigned short); /* rxed packet from network */ #ifdef CONFIG_HYSDN_CAPI extern unsigned int hycapi_enable; extern int hycapi_capi_create(hysdn_card *); /* create a new capi device */ extern int hycapi_capi_release(hysdn_card *); /* delete the device */ extern int hycapi_capi_stop(hysdn_card *card); /* suspend */ -extern void hycapi_rx_capipkt(hysdn_card * card, uchar * buf, word len); +extern void hycapi_rx_capipkt(hysdn_card * card, unsigned char * buf, + unsigned short len); extern void hycapi_tx_capiack(hysdn_card * card); extern struct sk_buff *hycapi_tx_capiget(hysdn_card *card); extern int hycapi_init(void); diff --git a/drivers/isdn/hysdn/hysdn_init.c b/drivers/isdn/hysdn/hysdn_init.c index cb791f8e793a..b75ac5af236a 100644 --- a/drivers/isdn/hysdn/hysdn_init.c +++ b/drivers/isdn/hysdn/hysdn_init.c @@ -41,8 +41,8 @@ hysdn_card *card_root = NULL; /* pointer to first card */ /* the last entry contains all 0 */ /**********************************************/ static struct { - word subid; /* PCI sub id */ - uchar cardtyp; /* card type assigned */ + unsigned short subid; /* PCI sub id */ + unsigned char cardtyp; /* card type assigned */ } pci_subid_map[] = { { diff --git a/drivers/isdn/hysdn/hysdn_net.c b/drivers/isdn/hysdn/hysdn_net.c index aa01628d74c6..d205249a1242 100644 --- a/drivers/isdn/hysdn/hysdn_net.c +++ b/drivers/isdn/hysdn/hysdn_net.c @@ -24,7 +24,7 @@ #include "hysdn_defs.h" unsigned int hynet_enable = 0xffffffff; -MODULE_PARM(hynet_enable, "i"); +module_param(hynet_enable, uint, 0); /* store the actual version for log reporting */ char *hysdn_net_revision = "$Revision: 1.8.6.4 $"; @@ -83,12 +83,12 @@ net_open(struct net_device *dev) /* Fill in the MAC-level header (if not already set) */ if (!card->mac_addr[0]) { - for (i = 0; i < ETH_ALEN - sizeof(ulong); i++) + for (i = 0; i < ETH_ALEN - sizeof(unsigned long); i++) dev->dev_addr[i] = 0xfc; if ((in_dev = dev->ip_ptr) != NULL) { struct in_ifaddr *ifa = in_dev->ifa_list; if (ifa != NULL) - memcpy(dev->dev_addr + (ETH_ALEN - sizeof(ulong)), &ifa->ifa_local, sizeof(ulong)); + memcpy(dev->dev_addr + (ETH_ALEN - sizeof(unsigned long)), &ifa->ifa_local, sizeof(unsigned long)); } } else memcpy(dev->dev_addr, card->mac_addr, ETH_ALEN); @@ -197,7 +197,7 @@ hysdn_tx_netack(hysdn_card * card) /* we got a packet from the network, go and queue it */ /*****************************************************/ void -hysdn_rx_netpkt(hysdn_card * card, uchar * buf, word len) +hysdn_rx_netpkt(hysdn_card * card, unsigned char *buf, unsigned short len) { struct net_local *lp = card->netif; struct sk_buff *skb; diff --git a/drivers/isdn/hysdn/hysdn_pof.h b/drivers/isdn/hysdn/hysdn_pof.h index 6cd81b9b08bc..a368d6caca0e 100644 --- a/drivers/isdn/hysdn/hysdn_pof.h +++ b/drivers/isdn/hysdn/hysdn_pof.h @@ -47,20 +47,20 @@ /*--------------------------------------POF file record structs------------*/ typedef struct PofFileHdr_tag { /* Pof file header */ -/*00 */ ulong Magic __attribute__((packed)); -/*04 */ ulong N_PofRecs __attribute__((packed)); +/*00 */ unsigned long Magic __attribute__((packed)); +/*04 */ unsigned long N_PofRecs __attribute__((packed)); /*08 */ } tPofFileHdr; typedef struct PofRecHdr_tag { /* Pof record header */ -/*00 */ word PofRecId __attribute__((packed)); -/*02 */ ulong PofRecDataLen __attribute__((packed)); +/*00 */ unsigned short PofRecId __attribute__((packed)); +/*02 */ unsigned long PofRecDataLen __attribute__((packed)); /*06 */ } tPofRecHdr; typedef struct PofTimeStamp_tag { -/*00 */ ulong UnixTime __attribute__((packed)); - /*04 */ uchar DateTimeText[0x28] __attribute__((packed)); +/*00 */ unsigned long UnixTime __attribute__((packed)); + /*04 */ unsigned char DateTimeText[0x28] __attribute__((packed)); /* =40 */ /*2C */ } tPofTimeStamp; diff --git a/drivers/isdn/hysdn/hysdn_procconf.c b/drivers/isdn/hysdn/hysdn_procconf.c index 40e56143c768..8e2b03889f3c 100644 --- a/drivers/isdn/hysdn/hysdn_procconf.c +++ b/drivers/isdn/hysdn/hysdn_procconf.c @@ -36,9 +36,9 @@ struct conf_writedata { int buf_size; /* actual number of bytes in the buffer */ int needed_size; /* needed size when reading pof */ int state; /* actual interface states from above constants */ - uchar conf_line[CONF_LINE_LEN]; /* buffered conf line */ - word channel; /* active channel number */ - uchar *pof_buffer; /* buffer when writing pof */ + unsigned char conf_line[CONF_LINE_LEN]; /* buffered conf line */ + unsigned short channel; /* active channel number */ + unsigned char *pof_buffer; /* buffer when writing pof */ }; /***********************************************************************/ @@ -49,7 +49,7 @@ struct conf_writedata { static int process_line(struct conf_writedata *cnf) { - uchar *cp = cnf->conf_line; + unsigned char *cp = cnf->conf_line; int i; if (cnf->card->debug_flags & LOG_CNF_LINE) @@ -92,7 +92,7 @@ hysdn_conf_write(struct file *file, const char __user *buf, size_t count, loff_t { struct conf_writedata *cnf; int i; - uchar ch, *cp; + unsigned char ch, *cp; if (!count) return (0); /* nothing to handle */ @@ -390,7 +390,7 @@ int hysdn_procconf_init(void) { hysdn_card *card; - uchar conf_name[20]; + unsigned char conf_name[20]; hysdn_proc_entry = proc_mkdir(PROC_SUBDIR_NAME, proc_net); if (!hysdn_proc_entry) { @@ -423,7 +423,7 @@ void hysdn_procconf_release(void) { hysdn_card *card; - uchar conf_name[20]; + unsigned char conf_name[20]; card = card_root; /* start with first card */ while (card) { diff --git a/drivers/isdn/hysdn/hysdn_proclog.c b/drivers/isdn/hysdn/hysdn_proclog.c index 6c26f1efabd5..c4301e8338ef 100644 --- a/drivers/isdn/hysdn/hysdn_proclog.c +++ b/drivers/isdn/hysdn/hysdn_proclog.c @@ -28,7 +28,7 @@ static void put_log_buffer(hysdn_card * card, char *cp); /*************************************************/ struct log_data { struct log_data *next; - ulong usage_cnt; /* number of files still to work */ + unsigned long usage_cnt;/* number of files still to work */ void *proc_ctrl; /* pointer to own control procdata structure */ char log_start[2]; /* log string start (final len aligned by size) */ }; @@ -42,7 +42,7 @@ struct procdata { struct log_data *log_head, *log_tail; /* head and tail for queue */ int if_used; /* open count for interface */ int volatile del_lock; /* lock for delete operations */ - uchar logtmp[LOG_MAX_LINELEN]; + unsigned char logtmp[LOG_MAX_LINELEN]; wait_queue_head_t rd_queue; }; @@ -153,9 +153,9 @@ put_log_buffer(hysdn_card * card, char *cp) static ssize_t hysdn_log_write(struct file *file, const char __user *buf, size_t count, loff_t * off) { - ulong u = 0; + unsigned long u = 0; int found = 0; - uchar *cp, valbuf[128]; + unsigned char *cp, valbuf[128]; long base = 10; hysdn_card *card = (hysdn_card *) file->private_data; @@ -249,7 +249,7 @@ hysdn_log_open(struct inode *ino, struct file *filep) { hysdn_card *card; struct procdata *pd = NULL; - ulong flags; + unsigned long flags; lock_kernel(); card = card_root; diff --git a/drivers/isdn/hysdn/hysdn_sched.c b/drivers/isdn/hysdn/hysdn_sched.c index 4fa3b01707cd..133032920ff8 100644 --- a/drivers/isdn/hysdn/hysdn_sched.c +++ b/drivers/isdn/hysdn/hysdn_sched.c @@ -30,7 +30,8 @@ /* to keep the data until later. */ /*****************************************************************************/ int -hysdn_sched_rx(hysdn_card * card, uchar * buf, word len, word chan) +hysdn_sched_rx(hysdn_card *card, unsigned char *buf, unsigned short len, + unsigned short chan) { switch (chan) { @@ -72,7 +73,9 @@ hysdn_sched_rx(hysdn_card * card, uchar * buf, word len, word chan) /* sending. */ /*****************************************************************************/ int -hysdn_sched_tx(hysdn_card * card, uchar * buf, word volatile *len, word volatile *chan, word maxlen) +hysdn_sched_tx(hysdn_card *card, unsigned char *buf, + unsigned short volatile *len, unsigned short volatile *chan, + unsigned short maxlen) { struct sk_buff *skb; @@ -145,10 +148,10 @@ hysdn_sched_tx(hysdn_card * card, uchar * buf, word volatile *len, word volatile /* are to be sent and this happens very seldom. */ /*****************************************************************************/ int -hysdn_tx_cfgline(hysdn_card * card, uchar * line, word chan) +hysdn_tx_cfgline(hysdn_card *card, unsigned char *line, unsigned short chan) { int cnt = 50; /* timeout intervalls */ - ulong flags; + unsigned long flags; if (card->debug_flags & LOG_SCHED_ASYN) hysdn_addlog(card, "async tx-cfg chan=%d len=%d", chan, strlen(line) + 1); diff --git a/drivers/isdn/hysdn/ince1pc.h b/drivers/isdn/hysdn/ince1pc.h index 4a115a87c782..7a36694df6d7 100644 --- a/drivers/isdn/hysdn/ince1pc.h +++ b/drivers/isdn/hysdn/ince1pc.h @@ -62,7 +62,7 @@ * s. RotlCRC algorithm * * RotlCRC algorithm: - * ucSum= 0 1 uchar + * ucSum= 0 1 unsigned char * for all NonEndTokenChunk bytes: * ROTL(ucSum,1) rotate left by 1 * ucSum += Char; add current byte with swap around @@ -85,13 +85,13 @@ typedef struct ErrLogEntry_tag { -/*00 */ ulong ulErrType; +/*00 */ unsigned long ulErrType; -/*04 */ ulong ulErrSubtype; +/*04 */ unsigned long ulErrSubtype; -/*08 */ uchar ucTextSize; +/*08 */ unsigned char ucTextSize; - /*09 */ uchar ucText[ERRLOG_TEXT_SIZE]; + /*09 */ unsigned char ucText[ERRLOG_TEXT_SIZE]; /* ASCIIZ of len ucTextSize-1 */ /*40 */ @@ -111,13 +111,13 @@ typedef struct ErrLogEntry_tag { #define DPRAM_SPOOLER_DATA_SIZE 0x20 typedef struct DpramBootSpooler_tag { -/*00 */ uchar Len; +/*00 */ unsigned char Len; -/*01 */ volatile uchar RdPtr; +/*01 */ volatile unsigned char RdPtr; -/*02 */ uchar WrPtr; +/*02 */ unsigned char WrPtr; -/*03 */ uchar Data[DPRAM_SPOOLER_DATA_SIZE]; +/*03 */ unsigned char Data[DPRAM_SPOOLER_DATA_SIZE]; /*23 */ } tDpramBootSpooler; diff --git a/drivers/isdn/i4l/isdn_ppp.c b/drivers/isdn/i4l/isdn_ppp.c index 1a19a0f89428..b9fed8a3bcc6 100644 --- a/drivers/isdn/i4l/isdn_ppp.c +++ b/drivers/isdn/i4l/isdn_ppp.c @@ -782,7 +782,8 @@ isdn_ppp_read(int min, struct file *file, char __user *buf, int count) is->first = b; spin_unlock_irqrestore(&is->buflock, flags); - copy_to_user(buf, save_buf, count); + if (copy_to_user(buf, save_buf, count)) + count = -EFAULT; kfree(save_buf); return count; diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c index aeaa1db74bd8..3585fb1f3344 100644 --- a/drivers/isdn/i4l/isdn_tty.c +++ b/drivers/isdn/i4l/isdn_tty.c @@ -2345,12 +2345,15 @@ isdn_tty_at_cout(char *msg, modem_info * info) u_long flags; struct sk_buff *skb = NULL; char *sp = NULL; - int l = strlen(msg); + int l; if (!msg) { printk(KERN_WARNING "isdn_tty: Null-Message in isdn_tty_at_cout\n"); return; } + + l = strlen(msg); + spin_lock_irqsave(&info->readlock, flags); tty = info->tty; if ((info->flags & ISDN_ASYNC_CLOSING) || (!tty)) { diff --git a/drivers/isdn/isdnloop/isdnloop.c b/drivers/isdn/isdnloop/isdnloop.c index 33d339700411..a67d31af797a 100644 --- a/drivers/isdn/isdnloop/isdnloop.c +++ b/drivers/isdn/isdnloop/isdnloop.c @@ -22,7 +22,7 @@ static char *isdnloop_id = "loop0"; MODULE_DESCRIPTION("ISDN4Linux: Pseudo Driver that simulates an ISDN card"); MODULE_AUTHOR("Fritz Elfert"); MODULE_LICENSE("GPL"); -MODULE_PARM(isdnloop_id, "s"); +module_param(isdnloop_id, charp, 0); MODULE_PARM_DESC(isdnloop_id, "ID-String of first card"); static int isdnloop_addcard(char *); diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 979e8cae5d83..e1c18aa1d712 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c @@ -556,7 +556,7 @@ static void bitmap_mask_state(struct bitmap *bitmap, enum bitmap_state bits, unsigned long flags; spin_lock_irqsave(&bitmap->lock, flags); - if (!bitmap || !bitmap->sb_page) { /* can't set the state */ + if (!bitmap->sb_page) { /* can't set the state */ spin_unlock_irqrestore(&bitmap->lock, flags); return; } diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig index c2602b340491..baa9f58beffc 100644 --- a/drivers/media/Kconfig +++ b/drivers/media/Kconfig @@ -50,5 +50,19 @@ config VIDEO_IR config VIDEO_TVEEPROM tristate +config USB_DABUSB + tristate "DABUSB driver" + depends on USB + ---help--- + A Digital Audio Broadcasting (DAB) Receiver for USB and Linux + brought to you by the DAB-Team + <http://wwwbode.cs.tum.edu/Par/arch/dab/>. This driver can be taken + as an example for URB-based bulk, control, and isochronous + transactions. URB's are explained in + <Documentation/usb/URB.txt>. + + To compile this driver as a module, choose M here: the + module will be called dabusb. + endmenu diff --git a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146_fops.c index 3870fa948cc0..523ab3851c7b 100644 --- a/drivers/media/common/saa7146_fops.c +++ b/drivers/media/common/saa7146_fops.c @@ -50,14 +50,15 @@ void saa7146_res_free(struct saa7146_fh *fh, unsigned int bits) /********************************************************************************/ /* common dma functions */ -void saa7146_dma_free(struct saa7146_dev *dev,struct saa7146_buf *buf) +void saa7146_dma_free(struct saa7146_dev *dev,struct videobuf_queue *q, + struct saa7146_buf *buf) { DEB_EE(("dev:%p, buf:%p\n",dev,buf)); BUG_ON(in_interrupt()); videobuf_waiton(&buf->vb,0,0); - videobuf_dma_pci_unmap(dev->pci, &buf->vb.dma); + videobuf_dma_unmap(q, &buf->vb.dma); videobuf_dma_free(&buf->vb.dma); buf->vb.state = STATE_NEEDS_INIT; } diff --git a/drivers/media/common/saa7146_vbi.c b/drivers/media/common/saa7146_vbi.c index 500bd3f05e16..063608462ebe 100644 --- a/drivers/media/common/saa7146_vbi.c +++ b/drivers/media/common/saa7146_vbi.c @@ -236,7 +236,7 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,e } if (buf->vb.size != size) - saa7146_dma_free(dev,buf); + saa7146_dma_free(dev,q,buf); if (STATE_NEEDS_INIT == buf->vb.state) { buf->vb.width = llength; @@ -247,7 +247,7 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,e saa7146_pgtable_free(dev->pci, &buf->pt[2]); saa7146_pgtable_alloc(dev->pci, &buf->pt[2]); - err = videobuf_iolock(dev->pci,&buf->vb, NULL); + err = videobuf_iolock(q,&buf->vb, NULL); if (err) goto oops; err = saa7146_pgtable_build_single(dev->pci, &buf->pt[2], buf->vb.dma.sglist, buf->vb.dma.sglen); @@ -261,7 +261,7 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,e oops: DEB_VBI(("error out.\n")); - saa7146_dma_free(dev,buf); + saa7146_dma_free(dev,q,buf); return err; } @@ -301,7 +301,7 @@ static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) struct saa7146_buf *buf = (struct saa7146_buf *)vb; DEB_VBI(("vb:%p\n",vb)); - saa7146_dma_free(dev,buf); + saa7146_dma_free(dev,q,buf); } static struct videobuf_queue_ops vbi_qops = { diff --git a/drivers/media/common/saa7146_video.c b/drivers/media/common/saa7146_video.c index 6b42713d97f4..e7079d1bd537 100644 --- a/drivers/media/common/saa7146_video.c +++ b/drivers/media/common/saa7146_video.c @@ -1275,7 +1275,7 @@ static int buffer_prepare(struct videobuf_queue *q, buf->vb.field != field || buf->vb.field != fh->video_fmt.field || buf->fmt != &fh->video_fmt) { - saa7146_dma_free(dev,buf); + saa7146_dma_free(dev,q,buf); } if (STATE_NEEDS_INIT == buf->vb.state) { @@ -1304,7 +1304,7 @@ static int buffer_prepare(struct videobuf_queue *q, saa7146_pgtable_alloc(dev->pci, &buf->pt[0]); } - err = videobuf_iolock(dev->pci,&buf->vb, &vv->ov_fb); + err = videobuf_iolock(q,&buf->vb, &vv->ov_fb); if (err) goto oops; err = saa7146_pgtable_build(dev,buf); @@ -1318,7 +1318,7 @@ static int buffer_prepare(struct videobuf_queue *q, oops: DEB_D(("error out.\n")); - saa7146_dma_free(dev,buf); + saa7146_dma_free(dev,q,buf); return err; } @@ -1363,7 +1363,7 @@ static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) struct saa7146_buf *buf = (struct saa7146_buf *)vb; DEB_CAP(("vbuf:%p\n",vb)); - saa7146_dma_free(dev,buf); + saa7146_dma_free(dev,q,buf); } static struct videobuf_queue_ops video_qops = { diff --git a/drivers/media/dvb/b2c2/flexcop-usb.c b/drivers/media/dvb/b2c2/flexcop-usb.c index a6c91db40ad6..06ec9fff0ec1 100644 --- a/drivers/media/dvb/b2c2/flexcop-usb.c +++ b/drivers/media/dvb/b2c2/flexcop-usb.c @@ -541,6 +541,7 @@ static struct usb_device_id flexcop_usb_table [] = { { USB_DEVICE(0x0af7, 0x0101) }, { } }; +MODULE_DEVICE_TABLE (usb, flexcop_usb_table); /* usb specific object needed to register this driver with the usb subsystem */ static struct usb_driver flexcop_usb_driver = { diff --git a/drivers/media/dvb/bt8xx/Makefile b/drivers/media/dvb/bt8xx/Makefile index d188e4c670b5..9d197efb481d 100644 --- a/drivers/media/dvb/bt8xx/Makefile +++ b/drivers/media/dvb/bt8xx/Makefile @@ -1,3 +1,3 @@ obj-$(CONFIG_DVB_BT8XX) += bt878.o dvb-bt8xx.o dst.o dst_ca.o -EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ -Idrivers/media/video -Idrivers/media/dvb/frontends +EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ -Idrivers/media/video/bt8xx -Idrivers/media/dvb/frontends diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c index e14bf43941e3..a14e737ec848 100644 --- a/drivers/media/dvb/dvb-usb/cxusb.c +++ b/drivers/media/dvb/dvb-usb/cxusb.c @@ -81,18 +81,19 @@ static int cxusb_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num) return -EAGAIN; if (num > 2) - warn("more than 2 i2c messages at a time is not handled yet. TODO."); + warn("more than two i2c messages at a time is not handled yet. TODO."); for (i = 0; i < num; i++) { - switch (msg[i].addr) { - case 0x63: - cxusb_gpio_tuner(d,0); - break; - default: - cxusb_gpio_tuner(d,1); - break; - } + if (d->udev->descriptor.idVendor == USB_VID_MEDION) + switch (msg[i].addr) { + case 0x63: + cxusb_gpio_tuner(d,0); + break; + default: + cxusb_gpio_tuner(d,1); + break; + } /* read request */ if (i+1 < num && (msg[i+1].flags & I2C_M_RD)) { @@ -108,7 +109,7 @@ static int cxusb_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num) break; if (ibuf[0] != 0x08) - deb_info("i2c read could have been failed\n"); + deb_i2c("i2c read may have failed\n"); memcpy(msg[i+1].buf,&ibuf[1],msg[i+1].len); @@ -122,7 +123,7 @@ static int cxusb_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num) if (cxusb_ctrl_msg(d,CMD_I2C_WRITE, obuf, 2+msg[i].len, &ibuf,1) < 0) break; if (ibuf != 0x08) - deb_info("i2c write could have been failed\n"); + deb_i2c("i2c write may have failed\n"); } } @@ -410,7 +411,6 @@ static int bluebird_patch_dvico_firmware_download(struct usb_device *udev, const if (fw->data[BLUEBIRD_01_ID_OFFSET] == (USB_VID_DVICO & 0xff) && fw->data[BLUEBIRD_01_ID_OFFSET + 1] == USB_VID_DVICO >> 8) { - /* FIXME: are we allowed to change the fw-data ? */ fw->data[BLUEBIRD_01_ID_OFFSET + 2] = udev->descriptor.idProduct + 1; fw->data[BLUEBIRD_01_ID_OFFSET + 3] = udev->descriptor.idProduct >> 8; diff --git a/drivers/media/dvb/dvb-usb/cxusb.h b/drivers/media/dvb/dvb-usb/cxusb.h index 087c99427853..c8ef77554b00 100644 --- a/drivers/media/dvb/dvb-usb/cxusb.h +++ b/drivers/media/dvb/dvb-usb/cxusb.h @@ -6,6 +6,8 @@ extern int dvb_usb_cxusb_debug; #define deb_info(args...) dprintk(dvb_usb_cxusb_debug,0x01,args) +#define deb_i2c(args...) if (d->udev->descriptor.idVendor == USB_VID_MEDION) \ + dprintk(dvb_usb_cxusb_debug,0x01,args) /* usb commands - some of it are guesses, don't have a reference yet */ #define CMD_I2C_WRITE 0x08 diff --git a/drivers/media/dvb/ttpci/av7110_v4l.c b/drivers/media/dvb/ttpci/av7110_v4l.c index 2f23ceab8d44..603a22e4bfe2 100644 --- a/drivers/media/dvb/ttpci/av7110_v4l.c +++ b/drivers/media/dvb/ttpci/av7110_v4l.c @@ -369,6 +369,11 @@ static int av7110_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg) fm_matrix = 0x3001; // stereo src = 0x0020; break; + case V4L2_TUNER_MODE_LANG1_LANG2: + dprintk(2, "VIDIOC_S_TUNER: V4L2_TUNER_MODE_LANG1_LANG2\n"); + fm_matrix = 0x3000; // bilingual + src = 0x0020; + break; case V4L2_TUNER_MODE_LANG1: dprintk(2, "VIDIOC_S_TUNER: V4L2_TUNER_MODE_LANG1\n"); fm_matrix = 0x3000; // mono diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index c622a4da5663..f31a19890b15 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig @@ -16,31 +16,7 @@ config VIDEO_ADV_DEBUG V4L devices. In doubt, say N. -config VIDEO_BT848 - tristate "BT848 Video For Linux" - depends on VIDEO_DEV && PCI && I2C - select I2C_ALGOBIT - select FW_LOADER - select VIDEO_BTCX - select VIDEO_BUF - select VIDEO_IR - select VIDEO_TUNER - select VIDEO_TVEEPROM - select VIDEO_MSP3400 - ---help--- - Support for BT848 based frame grabber/overlay boards. This includes - the Miro, Hauppauge and STB boards. Please read the material in - <file:Documentation/video4linux/bttv/> for more information. - - To compile this driver as a module, choose M here: the - module will be called bttv. - -config VIDEO_BT848_DVB - bool "DVB/ATSC Support for bt878 based TV cards" - depends on VIDEO_BT848 && DVB_CORE - select DVB_BT8XX - ---help--- - This adds support for DVB/ATSC cards based on the BT878 chip. +source "drivers/media/video/bt8xx/Kconfig" config VIDEO_SAA6588 tristate "SAA6588 Radio Chip RDS decoder support on BT848 cards" @@ -315,8 +291,6 @@ config VIDEO_HEXIUM_GEMINI source "drivers/media/video/cx88/Kconfig" -source "drivers/media/video/em28xx/Kconfig" - config VIDEO_OVCAMCHIP tristate "OmniVision Camera Chip support" depends on VIDEO_DEV && I2C @@ -391,4 +365,234 @@ config VIDEO_SAA7127 To compile this driver as a module, choose M here: the module will be called saa7127 +# +# USB Multimedia device configuration +# + +menu "V4L USB devices" + depends on USB && VIDEO_DEV + +source "drivers/media/video/em28xx/Kconfig" + +config USB_VICAM + tristate "USB 3com HomeConnect (aka vicam) support (EXPERIMENTAL)" + depends on USB && VIDEO_DEV && EXPERIMENTAL + ---help--- + Say Y here if you have 3com homeconnect camera (vicam). + + This driver uses the Video For Linux API. You must say Y or M to + "Video For Linux" (under Multimedia Devices) to use this driver. + Information on this API and pointers to "v4l" programs may be found + at <file:Documentation/video4linux/API.html>. + + To compile this driver as a module, choose M here: the + module will be called vicam. + +config USB_DSBR + tristate "D-Link USB FM radio support (EXPERIMENTAL)" + depends on USB && VIDEO_DEV && EXPERIMENTAL + ---help--- + Say Y here if you want to connect this type of radio to your + computer's USB port. Note that the audio is not digital, and + you must connect the line out connector to a sound card or a + set of speakers. + + This driver uses the Video For Linux API. You must enable + (Y or M in config) Video For Linux (under Character Devices) + to use this driver. Information on this API and pointers to + "v4l" programs may be found at + <file:Documentation/video4linux/API.html>. + + To compile this driver as a module, choose M here: the + module will be called dsbr100. + +config USB_ET61X251 + tristate "USB ET61X[12]51 PC Camera Controller support" + depends on USB && VIDEO_DEV + ---help--- + Say Y here if you want support for cameras based on Etoms ET61X151 + or ET61X251 PC Camera Controllers. + + See <file:Documentation/usb/et61x251.txt> for more informations. + + This driver uses the Video For Linux API. You must say Y or M to + "Video For Linux" to use this driver. + + To compile this driver as a module, choose M here: the + module will be called et61x251. + +config USB_IBMCAM + tristate "USB IBM (Xirlink) C-it Camera support" + depends on USB && VIDEO_DEV + ---help--- + Say Y here if you want to connect a IBM "C-It" camera, also known as + "Xirlink PC Camera" to your computer's USB port. For more + information, read <file:Documentation/usb/ibmcam.txt>. + + This driver uses the Video For Linux API. You must enable + (Y or M in config) Video For Linux (under Character Devices) + to use this driver. Information on this API and pointers to + "v4l" programs may be found at + <file:Documentation/video4linux/API.html>. + + To compile this driver as a module, choose M here: the + module will be called ibmcam. + + This camera has several configuration options which + can be specified when you load the module. Read + <file:Documentation/usb/ibmcam.txt> to learn more. + +config USB_KONICAWC + tristate "USB Konica Webcam support" + depends on USB && VIDEO_DEV + ---help--- + Say Y here if you want support for webcams based on a Konica + chipset. This is known to work with the Intel YC76 webcam. + + This driver uses the Video For Linux API. You must enable + (Y or M in config) Video For Linux (under Character Devices) + to use this driver. Information on this API and pointers to + "v4l" programs may be found at + <file:Documentation/video4linux/API.html>. + + To compile this driver as a module, choose M here: the + module will be called konicawc. + +config USB_OV511 + tristate "USB OV511 Camera support" + depends on USB && VIDEO_DEV + ---help--- + Say Y here if you want to connect this type of camera to your + computer's USB port. See <file:Documentation/usb/ov511.txt> for more + information and for a list of supported cameras. + + This driver uses the Video For Linux API. You must say Y or M to + "Video For Linux" (under Character Devices) to use this driver. + Information on this API and pointers to "v4l" programs may be found + at <file:Documentation/video4linux/API.html>. + + To compile this driver as a module, choose M here: the + module will be called ov511. + +config USB_SE401 + tristate "USB SE401 Camera support" + depends on USB && VIDEO_DEV + ---help--- + Say Y here if you want to connect this type of camera to your + computer's USB port. See <file:Documentation/usb/se401.txt> for more + information and for a list of supported cameras. + + This driver uses the Video For Linux API. You must say Y or M to + "Video For Linux" (under Multimedia Devices) to use this driver. + Information on this API and pointers to "v4l" programs may be found + at <file:Documentation/video4linux/API.html>. + + To compile this driver as a module, choose M here: the + module will be called se401. + +config USB_SN9C102 + tristate "USB SN9C10x PC Camera Controller support" + depends on USB && VIDEO_DEV + ---help--- + Say Y here if you want support for cameras based on SONiX SN9C101, + SN9C102 or SN9C103 PC Camera Controllers. + + See <file:Documentation/usb/sn9c102.txt> for more informations. + + This driver uses the Video For Linux API. You must say Y or M to + "Video For Linux" to use this driver. + + To compile this driver as a module, choose M here: the + module will be called sn9c102. + +config USB_STV680 + tristate "USB STV680 (Pencam) Camera support" + depends on USB && VIDEO_DEV + ---help--- + Say Y here if you want to connect this type of camera to your + computer's USB port. This includes the Pencam line of cameras. + See <file:Documentation/usb/stv680.txt> for more information and for + a list of supported cameras. + + This driver uses the Video For Linux API. You must say Y or M to + "Video For Linux" (under Multimedia Devices) to use this driver. + Information on this API and pointers to "v4l" programs may be found + at <file:Documentation/video4linux/API.html>. + + To compile this driver as a module, choose M here: the + module will be called stv680. + +config USB_W9968CF + tristate "USB W996[87]CF JPEG Dual Mode Camera support" + depends on USB && VIDEO_DEV && I2C && VIDEO_OVCAMCHIP + ---help--- + Say Y here if you want support for cameras based on OV681 or + Winbond W9967CF/W9968CF JPEG USB Dual Mode Camera Chips. + + This driver has an optional plugin, which is distributed as a + separate module only (released under GPL). It allows to use higher + resolutions and framerates, but cannot be included in the official + Linux kernel for performance purposes. + + See <file:Documentation/usb/w9968cf.txt> for more informations. + + This driver uses the Video For Linux and the I2C APIs. It needs the + OmniVision Camera Chip support as well. You must say Y or M to + "Video For Linux", "I2C Support" and "OmniVision Camera Chip + support" to use this driver. + + To compile this driver as a module, choose M here: the + module will be called w9968cf. + +config USB_ZC0301 + tristate "USB ZC0301 Image Processor and Control Chip support" + depends on USB && VIDEO_DEV + ---help--- + Say Y here if you want support for cameras based on the ZC0301 + Image Processor and Control Chip. + + See <file:Documentation/usb/zc0301.txt> for more informations. + + This driver uses the Video For Linux API. You must say Y or M to + "Video For Linux" to use this driver. + + To compile this driver as a module, choose M here: the + module will be called zc0301. + +config USB_PWC + tristate "USB Philips Cameras" + depends on USB && VIDEO_DEV + ---help--- + Say Y or M here if you want to use one of these Philips & OEM + webcams: + * Philips PCA645, PCA646 + * Philips PCVC675, PCVC680, PCVC690 + * Philips PCVC720/40, PCVC730, PCVC740, PCVC750 + * Askey VC010 + * Logitech QuickCam Pro 3000, 4000, 'Zoom', 'Notebook Pro' + and 'Orbit'/'Sphere' + * Samsung MPC-C10, MPC-C30 + * Creative Webcam 5, Pro Ex + * SOTEC Afina Eye + * Visionite VCS-UC300, VCS-UM100 + + The PCA635, PCVC665 and PCVC720/20 are not supported by this driver + and never will be, but the 665 and 720/20 are supported by other + drivers. + + See <file:Documentation/usb/philips.txt> for more information and + installation instructions. + + The built-in microphone is enabled by selecting USB Audio support. + + This driver uses the Video For Linux API. You must say Y or M to + "Video For Linux" (under Character Devices) to use this driver. + Information on this API and pointers to "v4l" programs may be found + at <file:Documentation/video4linux/API.html>. + + To compile this driver as a module, choose M here: the + module will be called pwc. + +endmenu # V4L USB devices + endmenu diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index f2bd4c0c4f10..1c0e72e5a593 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile @@ -2,9 +2,6 @@ # Makefile for the video capture/playback device drivers. # -bttv-objs := bttv-driver.o bttv-cards.o bttv-if.o \ - bttv-risc.o bttv-vbi.o bttv-i2c.o bttv-gpio.o \ - bttv-input.o zoran-objs := zr36120.o zr36120_i2c.o zr36120_mem.o zr36067-objs := zoran_procfs.o zoran_device.o \ zoran_driver.o zoran_card.o @@ -15,8 +12,8 @@ msp3400-objs := msp3400-driver.o msp3400-kthreads.o obj-$(CONFIG_VIDEO_DEV) += videodev.o v4l2-common.o v4l1-compat.o compat_ioctl32.o -obj-$(CONFIG_VIDEO_BT848) += bttv.o tvaudio.o \ - tda7432.o tda9875.o ir-kbd-i2c.o +obj-$(CONFIG_VIDEO_BT848) += bt8xx/ +obj-$(CONFIG_VIDEO_BT848) += tvaudio.o tda7432.o tda9875.o ir-kbd-i2c.o obj-$(CONFIG_SOUND_TVMIXER) += tvmixer.o obj-$(CONFIG_VIDEO_ZR36120) += zoran.o @@ -68,4 +65,23 @@ obj-$(CONFIG_VIDEO_CX25840) += cx25840/ obj-$(CONFIG_VIDEO_SAA711X) += saa7115.o obj-$(CONFIG_VIDEO_SAA7127) += saa7127.o +et61x251-objs := et61x251_core.o et61x251_tas5130d1b.o +zc0301-objs := zc0301_core.o zc0301_pas202bcb.o + +obj-$(CONFIG_USB_DABUSB) += dabusb.o +obj-$(CONFIG_USB_DSBR) += dsbr100.o +obj-$(CONFIG_USB_OV511) += ov511.o +obj-$(CONFIG_USB_SE401) += se401.o +obj-$(CONFIG_USB_STV680) += stv680.o +obj-$(CONFIG_USB_W9968CF) += w9968cf.o + +obj-$(CONFIG_USB_SN9C102) += sn9c102/ +obj-$(CONFIG_USB_ET61X251) += et61x251/ +obj-$(CONFIG_USB_PWC) += pwc/ +obj-$(CONFIG_USB_ZC0301) += zc0301/ + +obj-$(CONFIG_USB_IBMCAM) += usbvideo/ +obj-$(CONFIG_USB_KONICAWC) += usbvideo/ +obj-$(CONFIG_USB_VICAM) += usbvideo/ + EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core diff --git a/drivers/media/video/adv7170.c b/drivers/media/video/adv7170.c index 671e36db224d..48709582a186 100644 --- a/drivers/media/video/adv7170.c +++ b/drivers/media/video/adv7170.c @@ -1,9 +1,9 @@ -/* +/* * adv7170 - adv7170, adv7171 video encoder driver version 0.0.1 * * Copyright (C) 2002 Maxim Yevtyushkin <max@linuxmedialabs.com> * - * Based on adv7176 driver by: + * Based on adv7176 driver by: * * Copyright (C) 1998 Dave Perks <dperks@ibm.net> * Copyright (C) 1999 Wolfgang Scherr <scherr@net4you.net> @@ -173,7 +173,7 @@ adv7170_write_block (struct i2c_client *client, static const unsigned char init_NTSC[] = { 0x00, 0x10, // MR0 0x01, 0x20, // MR1 - 0x02, 0x0e, // MR2 RTC control: bits 2 and 1 + 0x02, 0x0e, // MR2 RTC control: bits 2 and 1 0x03, 0x80, // MR3 0x04, 0x30, // MR4 0x05, 0x00, // Reserved @@ -196,7 +196,7 @@ static const unsigned char init_NTSC[] = { 0x16, 0x00, // CGMS_WSS_0 0x17, 0x00, // CGMS_WSS_1 0x18, 0x00, // CGMS_WSS_2 - 0x19, 0x00, // Teletext Ctl + 0x19, 0x00, // Teletext Ctl }; static const unsigned char init_PAL[] = { @@ -381,7 +381,7 @@ static unsigned short normal_i2c[] = }; static unsigned short ignore = I2C_CLIENT_END; - + static struct i2c_client_address_data addr_data = { .normal_i2c = normal_i2c, .probe = &ignore, diff --git a/drivers/media/video/adv7175.c b/drivers/media/video/adv7175.c index 085e8863cacb..68e7d7aff5e6 100644 --- a/drivers/media/video/adv7175.c +++ b/drivers/media/video/adv7175.c @@ -1,4 +1,4 @@ -/* +/* * adv7175 - adv7175a video encoder driver version 0.0.3 * * Copyright (C) 1998 Dave Perks <dperks@ibm.net> @@ -233,7 +233,7 @@ adv7175_command (struct i2c_client *client, sizeof(init_common)); adv7175_write(client, 0x07, TR0MODE | TR0RST); adv7175_write(client, 0x07, TR0MODE); - break; + break; case ENCODER_GET_CAPABILITIES: { @@ -399,7 +399,7 @@ static unsigned short normal_i2c[] = }; static unsigned short ignore = I2C_CLIENT_END; - + static struct i2c_client_address_data addr_data = { .normal_i2c = normal_i2c, .probe = &ignore, diff --git a/drivers/media/video/arv.c b/drivers/media/video/arv.c index c586f64b6b7f..dbe025170599 100644 --- a/drivers/media/video/arv.c +++ b/drivers/media/video/arv.c @@ -161,39 +161,39 @@ void iic(int n, unsigned long addr, unsigned long data1, unsigned long data2, { int i; - /* Slave Address */ - ar_outl(addr, PLDI2CDATA); + /* Slave Address */ + ar_outl(addr, PLDI2CDATA); wait_for_vsync(); - /* Start */ - ar_outl(1, PLDI2CCND); + /* Start */ + ar_outl(1, PLDI2CCND); wait_acknowledge(); /* Transfer data 1 */ - ar_outl(data1, PLDI2CDATA); + ar_outl(data1, PLDI2CDATA); wait_for_vsync(); - ar_outl(PLDI2CSTEN_STEN, PLDI2CSTEN); + ar_outl(PLDI2CSTEN_STEN, PLDI2CSTEN); wait_acknowledge(); /* Transfer data 2 */ - ar_outl(data2, PLDI2CDATA); + ar_outl(data2, PLDI2CDATA); wait_for_vsync(); - ar_outl(PLDI2CSTEN_STEN, PLDI2CSTEN); + ar_outl(PLDI2CSTEN_STEN, PLDI2CSTEN); wait_acknowledge(); if (n == 3) { /* Transfer data 3 */ - ar_outl(data3, PLDI2CDATA); + ar_outl(data3, PLDI2CDATA); wait_for_vsync(); - ar_outl(PLDI2CSTEN_STEN, PLDI2CSTEN); + ar_outl(PLDI2CSTEN_STEN, PLDI2CSTEN); wait_acknowledge(); - } + } - /* Stop */ + /* Stop */ for (i = 0; i < 100; i++) cpu_relax(); - ar_outl(2, PLDI2CCND); - ar_outl(2, PLDI2CCND); + ar_outl(2, PLDI2CCND); + ar_outl(2, PLDI2CCND); while (ar_inl(PLDI2CSTS) & PLDI2CSTS_BB) cpu_relax(); @@ -204,24 +204,24 @@ void init_iic(void) { DEBUG(1, "init_iic:\n"); - /* + /* * ICU Setting (iic) */ - /* I2C Setting */ - ar_outl(0x0, PLDI2CCR); /* I2CCR Disable */ - ar_outl(0x0300, PLDI2CMOD); /* I2CMOD ACK/8b-data/7b-addr/auto */ - ar_outl(0x1, PLDI2CACK); /* I2CACK ACK */ + /* I2C Setting */ + ar_outl(0x0, PLDI2CCR); /* I2CCR Disable */ + ar_outl(0x0300, PLDI2CMOD); /* I2CMOD ACK/8b-data/7b-addr/auto */ + ar_outl(0x1, PLDI2CACK); /* I2CACK ACK */ /* I2C CLK */ - /* 50MH-100k */ + /* 50MH-100k */ if (freq == 75) { - ar_outl(369, PLDI2CFREQ); /* BCLK = 75MHz */ + ar_outl(369, PLDI2CFREQ); /* BCLK = 75MHz */ } else if (freq == 50) { ar_outl(244, PLDI2CFREQ); /* BCLK = 50MHz */ } else { ar_outl(244, PLDI2CFREQ); /* default: BCLK = 50MHz */ } - ar_outl(0x1, PLDI2CCR); /* I2CCR Enable */ + ar_outl(0x1, PLDI2CCR); /* I2CCR Enable */ } /************************************************************************** @@ -253,7 +253,7 @@ static inline void wait_for_vertical_sync(int exp_line) /* * check HCOUNT because we cannot check vertical sync. - */ + */ for (; tmout >= 0; tmout--) { l = ar_inl(ARVHCOUNT); if (l == exp_line) @@ -562,8 +562,8 @@ static void ar_interrupt(int irq, void *dev, struct pt_regs *regs) /* operations for interlace mode */ if ( line_count < (AR_HEIGHT_VGA/2) ) /* even line */ line_number = (line_count << 1); - else /* odd line */ - line_number = + else /* odd line */ + line_number = (((line_count - (AR_HEIGHT_VGA/2)) << 1) + 1); } else { line_number = line_count; @@ -651,7 +651,7 @@ static int ar_initialize(struct video_device *dev) cr |= ARVCR1_NORMAL; ar_outl(cr, ARVCR1); - /* + /* * Initialize IIC so that CPU can communicate with AR LSI, * and send boot commands to AR LSI. */ @@ -846,7 +846,7 @@ static int __init ar_init(void) * so register video device as a frame grabber type. * device is named "video[0-64]". * video_register_device() initializes h/w using ar_initialize(). - */ + */ if (video_register_device(ar->vdev, VFL_TYPE_GRABBER, video_nr) != 0) { /* return -1, -ENFILE(full) or others */ printk("arv: register video (Colour AR) failed.\n"); diff --git a/drivers/media/video/bt819.c b/drivers/media/video/bt819.c index d8a18a6a5bee..e7b38fdd5e3c 100644 --- a/drivers/media/video/bt819.c +++ b/drivers/media/video/bt819.c @@ -1,4 +1,4 @@ -/* +/* * bt819 - BT819A VideoStream Decoder (Rockwell Part) * * Copyright (C) 1999 Mike Bernson <mike@mlb.org> @@ -6,7 +6,7 @@ * * Modifications for LML33/DC10plus unified driver * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx> - * + * * Changes by Ronald Bultje <rbultje@ronald.bitfreak.net> * - moved over to linux>=2.4.x i2c protocol (9/9/2002) * @@ -206,9 +206,9 @@ bt819_init (struct i2c_client *client) Bug in the bt819 stepping on my board? */ 0x14, 0x00, /* 0x14 Vertial Scaling lsb */ - 0x16, 0x07, /* 0x16 Video Timing Polarity + 0x16, 0x07, /* 0x16 Video Timing Polarity ACTIVE=active low - FIELD: high=odd, + FIELD: high=odd, vreset=active high, hreset=active high */ 0x18, 0x68, /* 0x18 AGC Delay */ @@ -497,7 +497,7 @@ static unsigned short normal_i2c[] = { }; static unsigned short ignore = I2C_CLIENT_END; - + static struct i2c_client_address_data addr_data = { .normal_i2c = normal_i2c, .probe = &ignore, diff --git a/drivers/media/video/bt856.c b/drivers/media/video/bt856.c index 4d47a0a0e974..af3b61d4fa7d 100644 --- a/drivers/media/video/bt856.c +++ b/drivers/media/video/bt856.c @@ -1,4 +1,4 @@ -/* +/* * bt856 - BT856A Digital Video Encoder (Rockwell Part) * * Copyright (C) 1999 Mike Bernson <mike@mlb.org> @@ -285,7 +285,7 @@ bt856_command (struct i2c_client *client, static unsigned short normal_i2c[] = { I2C_BT856 >> 1, I2C_CLIENT_END }; static unsigned short ignore = I2C_CLIENT_END; - + static struct i2c_client_address_data addr_data = { .normal_i2c = normal_i2c, .probe = &ignore, diff --git a/drivers/media/video/bt8xx/Kconfig b/drivers/media/video/bt8xx/Kconfig new file mode 100644 index 000000000000..085477c12612 --- /dev/null +++ b/drivers/media/video/bt8xx/Kconfig @@ -0,0 +1,25 @@ +config VIDEO_BT848 + tristate "BT848 Video For Linux" + depends on VIDEO_DEV && PCI && I2C + select I2C_ALGOBIT + select FW_LOADER + select VIDEO_BTCX + select VIDEO_BUF + select VIDEO_IR + select VIDEO_TUNER + select VIDEO_TVEEPROM + select VIDEO_MSP3400 + ---help--- + Support for BT848 based frame grabber/overlay boards. This includes + the Miro, Hauppauge and STB boards. Please read the material in + <file:Documentation/video4linux/bttv/> for more information. + + To compile this driver as a module, choose M here: the + module will be called bttv. + +config VIDEO_BT848_DVB + bool "DVB/ATSC Support for bt878 based TV cards" + depends on VIDEO_BT848 && DVB_CORE + select DVB_BT8XX + ---help--- + This adds support for DVB/ATSC cards based on the BT878 chip. diff --git a/drivers/media/video/bt8xx/Makefile b/drivers/media/video/bt8xx/Makefile new file mode 100644 index 000000000000..94350f21cdc0 --- /dev/null +++ b/drivers/media/video/bt8xx/Makefile @@ -0,0 +1,12 @@ +# +# Makefile for the video capture/playback device drivers. +# + +bttv-objs := bttv-driver.o bttv-cards.o bttv-if.o \ + bttv-risc.o bttv-vbi.o bttv-i2c.o bttv-gpio.o \ + bttv-input.o + +obj-$(CONFIG_VIDEO_BT848) += bttv.o + +EXTRA_CFLAGS += -I$(src)/.. +EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core diff --git a/drivers/media/video/bt832.c b/drivers/media/video/bt8xx/bt832.c index cc54b62f4601..a51876137880 100644 --- a/drivers/media/video/bt832.c +++ b/drivers/media/video/bt8xx/bt832.c @@ -30,7 +30,6 @@ #include <linux/init.h> #include <linux/errno.h> #include <linux/slab.h> -#include <media/audiochip.h> #include <media/v4l2-common.h> #include "bttv.h" @@ -39,7 +38,7 @@ MODULE_LICENSE("GPL"); /* Addresses to scan */ -static unsigned short normal_i2c[] = { I2C_BT832_ALT1>>1, I2C_BT832_ALT2>>1, +static unsigned short normal_i2c[] = { I2C_ADDR_BT832_ALT1>>1, I2C_ADDR_BT832_ALT2>>1, I2C_CLIENT_END }; I2C_CLIENT_INSMOD; diff --git a/drivers/media/video/bt832.h b/drivers/media/video/bt8xx/bt832.h index 1ce8fa71f7db..1ce8fa71f7db 100644 --- a/drivers/media/video/bt832.h +++ b/drivers/media/video/bt8xx/bt832.h diff --git a/drivers/media/video/bt848.h b/drivers/media/video/bt8xx/bt848.h index 0bcd95303bb0..0bcd95303bb0 100644 --- a/drivers/media/video/bt848.h +++ b/drivers/media/video/bt8xx/bt848.h diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bt8xx/bttv-cards.c index abfa6ad857a0..f209a7492051 100644 --- a/drivers/media/video/bttv-cards.c +++ b/drivers/media/video/bt8xx/bttv-cards.c @@ -39,6 +39,7 @@ #include "bttvp.h" #include <media/v4l2-common.h> +#include <media/tvaudio.h> /* fwd decl */ static void boot_msp34xx(struct bttv *btv, int pin); @@ -336,7 +337,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 15, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 2, 0, 0, 0, 10 }, + .gpiomux = { 2, 0, 0, 0 }, + .gpiomute = 10, .needs_tvaudio = 1, .tuner_type = -1, .tuner_addr = ADDR_UNSET, @@ -350,7 +352,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 7, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 0, 1, 2, 3, 4 }, + .gpiomux = { 0, 1, 2, 3 }, + .gpiomute = 4, .needs_tvaudio = 1, .tuner_type = -1, .tuner_addr = ADDR_UNSET, @@ -364,7 +367,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 7, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 4, 0, 2, 3, 1 }, + .gpiomux = { 4, 0, 2, 3 }, + .gpiomute = 1, .no_msp34xx = 1, .needs_tvaudio = 1, .tuner_type = TUNER_PHILIPS_NTSC, @@ -383,7 +387,7 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 0 }, + .gpiomux = { 0 }, .needs_tvaudio = 0, .tuner_type = 4, .tuner_addr = ADDR_UNSET, @@ -397,7 +401,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 3, .muxsel = { 2, 3, 1, 0 }, - .audiomux = { 0, 1, 0, 1, 3 }, + .gpiomux = { 0, 1, 0, 1 }, + .gpiomute = 3, .needs_tvaudio = 1, .tuner_type = -1, .tuner_addr = ADDR_UNSET, @@ -411,7 +416,7 @@ struct tvcard bttv_tvcards[] = { .svhs = 3, .muxsel = { 2, 3, 1, 1 }, .gpiomask = 0x0f, - .audiomux = { 0x0c, 0x04, 0x08, 0x04, 0 }, + .gpiomux = { 0x0c, 0x04, 0x08, 0x04 }, /* 0x04 for some cards ?? */ .needs_tvaudio = 1, .tuner_type = -1, @@ -428,7 +433,7 @@ struct tvcard bttv_tvcards[] = { .svhs = 3, .gpiomask = 0, .muxsel = { 2, 3, 1, 0, 0 }, - .audiomux = { 0 }, + .gpiomux = { 0 }, .needs_tvaudio = 1, .tuner_type = -1, .tuner_addr = ADDR_UNSET, @@ -444,7 +449,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0xc00, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 0, 0xc00, 0x800, 0x400, 0xc00, 0 }, + .gpiomux = { 0, 0xc00, 0x800, 0x400 }, + .gpiomute = 0xc00, .needs_tvaudio = 1, .pll = PLL_28, .tuner_type = -1, @@ -459,7 +465,7 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 3, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 1, 1, 2, 3, 0 }, + .gpiomux = { 1, 1, 2, 3 }, .needs_tvaudio = 0, .pll = PLL_28, .tuner_type = TUNER_TEMIC_PAL, @@ -474,7 +480,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0x0f, /* old: 7 */ .muxsel = { 2, 0, 1, 1 }, - .audiomux = { 0, 1, 2, 3, 4 }, + .gpiomux = { 0, 1, 2, 3 }, + .gpiomute = 4, .needs_tvaudio = 1, .pll = PLL_28, .tuner_type = -1, @@ -489,7 +496,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0x3014f, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 0x20001,0x10001, 0, 0,10 }, + .gpiomux = { 0x20001,0x10001, 0, 0 }, + .gpiomute = 10, .needs_tvaudio = 1, .tuner_type = -1, .tuner_addr = ADDR_UNSET, @@ -505,7 +513,7 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 15, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 13, 14, 11, 7, 0, 0 }, + .gpiomux = { 13, 14, 11, 7 }, .needs_tvaudio = 1, .tuner_type = -1, .tuner_addr = ADDR_UNSET, @@ -519,7 +527,7 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 15, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 13, 14, 11, 7, 0, 0 }, + .gpiomux = { 13, 14, 11, 7 }, .needs_tvaudio = 1, .msp34xx_alt = 1, .pll = PLL_28, @@ -537,7 +545,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 7, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 0, 2, 1, 3, 4 }, /* old: {0, 1, 2, 3, 4} */ + .gpiomux = { 0, 2, 1, 3 }, /* old: {0, 1, 2, 3, 4} */ + .gpiomute = 4, .needs_tvaudio = 1, .pll = PLL_28, .tuner_type = -1, @@ -552,7 +561,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 15, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 0 , 0, 1 , 0, 10 }, + .gpiomux = { 0, 0, 1, 0 }, + .gpiomute = 10, .needs_tvaudio = 1, .tuner_type = -1, .tuner_addr = ADDR_UNSET, @@ -570,10 +580,11 @@ struct tvcard bttv_tvcards[] = { .muxsel = { 2, 3, 1, 1 }, #if 0 /* old */ - .audiomux = { 0x01c000, 0, 0x018000, 0x014000, 0x002000, 0 }, + .gpiomux = { 0x01c000, 0, 0x018000, 0x014000, 0x002000 }, #else /* 2003-10-20 by "Anton A. Arapov" <arapov@mail.ru> */ - .audiomux = { 0x001e00, 0, 0x018000, 0x014000, 0x002000, 0 }, + .gpiomux = { 0x001e00, 0, 0x018000, 0x014000 }, + .gpiomute = 0x002000, #endif .needs_tvaudio = 1, .pll = PLL_28, @@ -587,7 +598,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0x8300f8, .muxsel = { 2, 3, 1, 1,0 }, - .audiomux = { 0x4fa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007 }, + .gpiomux = { 0x4fa007,0xcfa007,0xcfa007,0xcfa007 }, + .gpiomute = 0xcfa007, .needs_tvaudio = 1, .tuner_type = -1, .tuner_addr = ADDR_UNSET, @@ -603,7 +615,7 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 1, 0, 0, 0, 0 }, + .gpiomux = { 1, 0, 0, 0 }, .needs_tvaudio = 1, .tuner_type = -1, .tuner_addr = ADDR_UNSET, @@ -617,7 +629,7 @@ struct tvcard bttv_tvcards[] = { .svhs = -1, .gpiomask = 0x8dff00, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 0 }, + .gpiomux = { 0 }, .no_msp34xx = 1, .tuner_type = -1, .tuner_addr = ADDR_UNSET, @@ -644,7 +656,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0x1800, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800 }, + .gpiomux = { 0, 0x800, 0x1000, 0x1000 }, + .gpiomute = 0x1800, .pll = PLL_28, .tuner_type = TUNER_PHILIPS_PAL_I, .tuner_addr = ADDR_UNSET, @@ -658,7 +671,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0xc00, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 0, 1, 0x800, 0x400, 0xc00, 0 }, + .gpiomux = { 0, 1, 0x800, 0x400 }, + .gpiomute = 0xc00, .needs_tvaudio = 1, .pll = PLL_28, .tuner_type = -1, @@ -674,7 +688,7 @@ struct tvcard bttv_tvcards[] = { .gpiomask = 7, .muxsel = { 2, 3, -1 }, .digital_mode = DIGITAL_MODE_CAMERA, - .audiomux = { 0, 0, 0, 0, 0 }, + .gpiomux = { 0, 0, 0, 0 }, .no_msp34xx = 1, .pll = PLL_28, .tuner_type = TUNER_ALPS_TSBB5_PAL_I, @@ -691,7 +705,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0xe00, .muxsel = { 2, 3, 1, 1 }, - .audiomux = {0x400, 0x400, 0x400, 0x400, 0xc00 }, + .gpiomux = {0x400, 0x400, 0x400, 0x400 }, + .gpiomute = 0xc00, .needs_tvaudio = 1, .pll = PLL_28, .tuner_type = -1, @@ -707,7 +722,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0x1f0fff, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 0x20000, 0x30000, 0x10000, 0, 0x40000 }, + .gpiomux = { 0x20000, 0x30000, 0x10000, 0 }, + .gpiomute = 0x40000, .needs_tvaudio = 0, .tuner_type = TUNER_PHILIPS_PAL, .tuner_addr = ADDR_UNSET, @@ -722,7 +738,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 3, .gpiomask = 7, .muxsel = { 2, 0, 1, 1 }, - .audiomux = { 0, 1, 2, 3, 4 }, + .gpiomux = { 0, 1, 2, 3 }, + .gpiomute = 4, .needs_tvaudio = 1, .tuner_type = -1, .tuner_addr = ADDR_UNSET, @@ -736,7 +753,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0x1800, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800 }, + .gpiomux = { 0, 0x800, 0x1000, 0x1000 }, + .gpiomute = 0x1800, .pll = PLL_28, .tuner_type = TUNER_PHILIPS_SECAM, .tuner_addr = ADDR_UNSET, @@ -752,7 +770,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0x1f0fff, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 0x20000, 0x30000, 0x10000, 0x00000, 0x40000 }, + .gpiomux = { 0x20000, 0x30000, 0x10000, 0x00000 }, + .gpiomute = 0x40000, .needs_tvaudio = 0, .tuner_type = TUNER_PHILIPS_PAL, .tuner_addr = ADDR_UNSET, @@ -799,7 +818,7 @@ struct tvcard bttv_tvcards[] = { .svhs = 1, /* was: 4 */ .gpiomask = 0, .muxsel = { 2, 3, 1, 0, 0}, - .audiomux = { 0 }, + .gpiomux = { 0 }, .needs_tvaudio = 1, .tuner_type = -1, .tuner_addr = ADDR_UNSET, @@ -815,7 +834,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0x1800, /* 0x8dfe00 */ .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 0, 0x0800, 0x1000, 0x1000, 0x1800, 0 }, + .gpiomux = { 0, 0x0800, 0x1000, 0x1000 }, + .gpiomute = 0x1800, .pll = PLL_28, .tuner_type = -1, .tuner_addr = ADDR_UNSET, @@ -829,7 +849,7 @@ struct tvcard bttv_tvcards[] = { .svhs = 3, .gpiomask = 1, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 1, 0, 0, 0, 0 }, + .gpiomux = { 1, 0, 0, 0 }, .pll = PLL_28, .tuner_type = TUNER_PHILIPS_PAL, .tuner_addr = ADDR_UNSET, @@ -845,7 +865,7 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 0 }, + .gpiomux = { 0 }, .needs_tvaudio = 0, .tuner_type = 4, .tuner_addr = ADDR_UNSET, @@ -859,7 +879,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0xffff00, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 0x500, 0, 0x300, 0x900, 0x900 }, + .gpiomux = { 0x500, 0, 0x300, 0x900 }, + .gpiomute = 0x900, .needs_tvaudio = 1, .pll = PLL_28, .tuner_type = TUNER_PHILIPS_PAL, @@ -875,11 +896,12 @@ struct tvcard bttv_tvcards[] = { .muxsel = { 2, 3, 1, 1, 0 }, /* TV, CVid, SVid, CVid over SVid connector */ #if 0 .gpiomask = 0xc33000, - .audiomux = { 0x422000,0x1000,0x0000,0x620000,0x800000 }, + .gpiomux = { 0x422000,0x1000,0x0000,0x620000,0x800000 }, #else /* Alexander Varakin <avarakin@hotmail.com> [stereo version] */ .gpiomask = 0xb33000, - .audiomux = { 0x122000,0x1000,0x0000,0x620000,0x800000 }, + .gpiomux = { 0x122000,0x1000,0x0000,0x620000 }, + .gpiomute = 0x800000, #endif /* Audio Routing for "WinFast 2000 XP" (no tv stereo !) gpio23 -- hef4052:nEnable (0x800000) @@ -909,7 +931,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0x1800, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800 }, + .gpiomux = { 0, 0x800, 0x1000, 0x1000 }, + .gpiomute = 0x1800, .pll = PLL_28, .tuner_type = -1, .tuner_addr = ADDR_UNSET, @@ -925,7 +948,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0x1800, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800, 0 }, + .gpiomux = { 0, 0x800, 0x1000, 0x1000 }, + .gpiomute = 0x1800, .pll = PLL_28, .tuner_type = -1, .tuner_addr = ADDR_UNSET, @@ -940,7 +964,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0xff, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 0x21, 0x20, 0x24, 0x2c, 0x29, 0x29 }, + .gpiomux = { 0x21, 0x20, 0x24, 0x2c }, + .gpiomute = 0x29, .no_msp34xx = 1, .pll = PLL_28, .tuner_type = -1, @@ -955,7 +980,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0x551e00, .muxsel = { 2, 3, 1, 0 }, - .audiomux = { 0x551400, 0x551200, 0, 0, 0x551c00, 0x551200 }, + .gpiomux = { 0x551400, 0x551200, 0, 0 }, + .gpiomute = 0x551c00, .needs_tvaudio = 1, .pll = PLL_28, .tuner_type = 1, @@ -971,7 +997,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0x03000F, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 2, 0xd0001, 0, 0, 1 }, + .gpiomux = { 2, 0xd0001, 0, 0 }, + .gpiomute = 1, .needs_tvaudio = 0, .pll = PLL_28, .tuner_type = -1, @@ -988,7 +1015,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 7, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 4, 0, 2, 3, 1 }, + .gpiomux = { 4, 0, 2, 3 }, + .gpiomute = 1, .no_msp34xx = 1, .needs_tvaudio = 1, .tuner_type = TUNER_PHILIPS_NTSC, @@ -1005,7 +1033,7 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 15, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 13, 4, 11, 7, 0, 0 }, + .gpiomux = { 13, 4, 11, 7 }, .needs_tvaudio = 1, .pll = PLL_28, .tuner_type = -1, @@ -1022,7 +1050,7 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0, .muxsel = { 2, 3, 1, 1}, - .audiomux = { 0, 0, 0, 0, 0}, + .gpiomux = { 0, 0, 0, 0}, .needs_tvaudio = 1, .no_msp34xx = 1, .pll = PLL_28, @@ -1038,7 +1066,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0xe00b, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 0xff9ff6, 0xff9ff6, 0xff1ff7, 0, 0xff3ffc }, + .gpiomux = { 0xff9ff6, 0xff9ff6, 0xff1ff7, 0 }, + .gpiomute = 0xff3ffc, .no_msp34xx = 1, .tuner_type = -1, .tuner_addr = ADDR_UNSET, @@ -1054,7 +1083,8 @@ struct tvcard bttv_tvcards[] = { .svhs = -1, .gpiomask = 3, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 1, 1, 0, 2, 3 }, + .gpiomux = { 1, 1, 0, 2 }, + .gpiomute = 3, .no_msp34xx = 1, .pll = PLL_NONE, .tuner_type = -1, @@ -1069,7 +1099,7 @@ struct tvcard bttv_tvcards[] = { .svhs = 3, .gpiomask = 0, .muxsel = { 2, 3, 1, 0, 0 }, - .audiomux = { 0 }, + .gpiomux = { 0 }, .no_msp34xx = 1, .pll = PLL_28, .tuner_type = -1, @@ -1084,7 +1114,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0xbcf03f, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 0xbc803f, 0xbc903f, 0xbcb03f, 0, 0xbcb03f }, + .gpiomux = { 0xbc803f, 0xbc903f, 0xbcb03f, 0 }, + .gpiomute = 0xbcb03f, .no_msp34xx = 1, .pll = PLL_28, .tuner_type = 21, @@ -1099,7 +1130,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0x70000, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 0x20000, 0x30000, 0x10000, 0, 0x40000, 0x20000 }, + .gpiomux = { 0x20000, 0x30000, 0x10000, 0 }, + .gpiomute = 0x40000, .needs_tvaudio = 1, .no_msp34xx = 1, .pll = PLL_35, @@ -1118,7 +1150,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 15, .muxsel = { 2, 3, 1, 1 }, - .audiomux = {2,0,0,0,1 }, + .gpiomux = {2,0,0,0 }, + .gpiomute = 1, .needs_tvaudio = 1, .pll = PLL_28, .tuner_type = -1, @@ -1133,7 +1166,7 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0x010f00, .muxsel = {2, 3, 0, 0 }, - .audiomux = {0x10000, 0, 0x10000, 0, 0, 0 }, + .gpiomux = {0x10000, 0, 0x10000, 0 }, .no_msp34xx = 1, .pll = PLL_28, .tuner_type = TUNER_ALPS_TSHC6_NTSC, @@ -1150,7 +1183,8 @@ struct tvcard bttv_tvcards[] = { .gpiomask = 0xAA0000, .muxsel = { 2,3,1,1,-1 }, .digital_mode = DIGITAL_MODE_CAMERA, - .audiomux = { 0x20000, 0, 0x80000, 0x80000, 0xa8000, 0x46000 }, + .gpiomux = { 0x20000, 0, 0x80000, 0x80000 }, + .gpiomute = 0xa8000, .no_msp34xx = 1, .pll = PLL_28, .tuner_type = TUNER_PHILIPS_PAL_I, @@ -1175,7 +1209,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 7, .muxsel = { 2, 0, 1, 1 }, - .audiomux = { 0, 1, 2, 3, 4 }, + .gpiomux = { 0, 1, 2, 3 }, + .gpiomute = 4, .pll = PLL_28, .tuner_type = -1 /* TUNER_ALPS_TMDH2_NTSC */, .tuner_addr = ADDR_UNSET, @@ -1192,7 +1227,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 3, .gpiomask = 0x03000F, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 1, 0xd0001, 0, 0, 10 }, + .gpiomux = { 1, 0xd0001, 0, 0 }, + .gpiomute = 10, /* sound path (5 sources): MUX1 (mask 0x03), Enable Pin 0x08 (0=enable, 1=disable) 0= ext. Audio IN @@ -1218,7 +1254,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0x1c, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 0, 0, 0x10, 8, 4 }, + .gpiomux = { 0, 0, 0x10, 8 }, + .gpiomute = 4, .needs_tvaudio = 1, .pll = PLL_28, .tuner_type = TUNER_PHILIPS_PAL, @@ -1230,7 +1267,7 @@ struct tvcard bttv_tvcards[] = { /* Tim Röstermundt <rosterm@uni-muenster.de> in de.comp.os.unix.linux.hardware: options bttv card=0 pll=1 radio=1 gpiomask=0x18e0 - audiomux=0x44c71f,0x44d71f,0,0x44d71f,0x44dfff + gpiomux =0x44c71f,0x44d71f,0,0x44d71f,0x44dfff options tuner type=5 */ .name = "Lifeview FlyVideo 2000 /FlyVideo A2/ Lifetec LT 9415 TV [LR90]", .video_inputs = 4, @@ -1239,7 +1276,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0x18e0, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 0x0000,0x0800,0x1000,0x1000,0x18e0 }, + .gpiomux = { 0x0000,0x0800,0x1000,0x1000 }, + .gpiomute = 0x18e0, /* For cards with tda9820/tda9821: 0x0000: Tuner normal stereo 0x0080: Tuner A2 SAP (second audio program = Zweikanalton) @@ -1259,7 +1297,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0xF, .muxsel = { 2, 3, 1, 0 }, - .audiomux = { 2, 0, 0, 0, 10 }, + .gpiomux = { 2, 0, 0, 0 }, + .gpiomute = 10, .needs_tvaudio = 0, .pll = PLL_28, .tuner_type = TUNER_TEMIC_PAL, @@ -1277,7 +1316,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0x1800, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800, 0 }, + .gpiomux = { 0, 0x800, 0x1000, 0x1000 }, + .gpiomute = 0x1800, .pll = PLL_28, .tuner_type = 5, .tuner_addr = ADDR_UNSET, @@ -1294,7 +1334,7 @@ struct tvcard bttv_tvcards[] = { .svhs = 1, .gpiomask = 0, .muxsel = { 3, 1 }, - .audiomux = { 0 }, + .gpiomux = { 0 }, .needs_tvaudio = 0, .no_msp34xx = 1, .pll = PLL_35, @@ -1311,7 +1351,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0xe00, .muxsel = { 2, 3, 1, 1}, - .audiomux = { 0x400, 0x400, 0x400, 0x400, 0x800, 0x400 }, + .gpiomux = { 0x400, 0x400, 0x400, 0x400 }, + .gpiomute = 0x800, .needs_tvaudio = 1, .pll = PLL_28, .tuner_type = TUNER_TEMIC_4036FY5_NTSC, @@ -1327,7 +1368,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0x03000F, .muxsel = { 2, 3, 1, 0 }, - .audiomux = { 2, 0, 0, 0, 1 }, + .gpiomux = { 2, 0, 0, 0 }, + .gpiomute = 1, .pll = PLL_28, .tuner_type = 0, .tuner_addr = ADDR_UNSET, @@ -1344,7 +1386,8 @@ struct tvcard bttv_tvcards[] = { .svhs = -1, .gpiomask = 11, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 2, 0, 0, 1, 8 }, + .gpiomux = { 2, 0, 0, 1 }, + .gpiomute = 8, .pll = PLL_35, .tuner_type = TUNER_TEMIC_PAL, .tuner_addr = ADDR_UNSET, @@ -1359,7 +1402,7 @@ struct tvcard bttv_tvcards[] = { .svhs = 1, .gpiomask = 0xF, .muxsel = { 2, 2 }, - .audiomux = { }, + .gpiomux = { }, .no_msp34xx = 1, .needs_tvaudio = 0, .pll = PLL_28, @@ -1378,7 +1421,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0xFF, .muxsel = { 2, 3, 1, 0 }, - .audiomux = { 1, 0, 4, 4, 9 }, + .gpiomux = { 1, 0, 4, 4 }, + .gpiomute = 9, .needs_tvaudio = 0, .pll = PLL_28, .tuner_type = TUNER_PHILIPS_PAL, @@ -1394,7 +1438,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0xf03f, .muxsel = { 2, 3, 1, 0 }, - .audiomux = { 0xbffe, 0, 0xbfff, 0, 0xbffe }, + .gpiomux = { 0xbffe, 0, 0xbfff, 0 }, + .gpiomute = 0xbffe, .pll = PLL_28, .tuner_type = TUNER_TEMIC_4006FN5_MULTI_PAL, .tuner_addr = ADDR_UNSET, @@ -1411,7 +1456,7 @@ struct tvcard bttv_tvcards[] = { .svhs = -1, .gpiomask = 1, .muxsel = { 2, 3, 0, 1 }, - .audiomux = { 0, 0, 1, 0, 0 }, + .gpiomux = { 0, 0, 1, 0 }, .no_msp34xx = 1, .pll = PLL_28, .tuner_type = TUNER_TEMIC_4006FN5_MULTI_PAL, @@ -1430,7 +1475,8 @@ struct tvcard bttv_tvcards[] = { /* Radio changed from 1e80 to 0x800 to make FlyVideo2000S in .hu happy (gm)*/ /* -dk-???: set mute=0x1800 for tda9874h daughterboard */ - .audiomux = { 0x0000,0x0800,0x1000,0x1000,0x1800, 0x1080 }, + .gpiomux = { 0x0000,0x0800,0x1000,0x1000 }, + .gpiomute = 0x1800, .audio_hook = fv2000s_audio, .no_msp34xx = 1, .no_tda9875 = 1, @@ -1448,7 +1494,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0xffff00, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 0x500, 0x500, 0x300, 0x900, 0x900 }, + .gpiomux = { 0x500, 0x500, 0x300, 0x900 }, + .gpiomute = 0x900, .needs_tvaudio = 1, .pll = PLL_28, .tuner_type = TUNER_PHILIPS_PAL, @@ -1465,7 +1512,7 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0x010f00, .muxsel = {2, 3, 0, 0 }, - .audiomux = {0x10000, 0, 0x10000, 0, 0, 0 }, + .gpiomux = {0x10000, 0, 0x10000, 0 }, .no_msp34xx = 1, .pll = PLL_28, .tuner_type = TUNER_SHARP_2U5JF5540_NTSC, @@ -1486,7 +1533,8 @@ struct tvcard bttv_tvcards[] = { .gpiomask = 0x4f8a00, /* 0x100000: 1=MSP enabled (0=disable again) * 0x010000: Connected to "S0" on tda9880 (0=Pal/BG, 1=NTSC) */ - .audiomux = {0x947fff, 0x987fff,0x947fff,0x947fff, 0x947fff}, + .gpiomux = {0x947fff, 0x987fff,0x947fff,0x947fff }, + .gpiomute = 0x947fff, /* tvtuner, radio, external,internal, mute, stereo * tuner, Composit, SVid, Composit-on-Svid-adapter */ .muxsel = { 2, 3 ,0 ,1 }, @@ -1518,7 +1566,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 15, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 0, 0, 11, 7, 13, 0 }, /* TV and Radio with same GPIO ! */ + .gpiomux = { 0, 0, 11, 7 }, /* TV and Radio with same GPIO ! */ + .gpiomute = 13, .needs_tvaudio = 1, .pll = PLL_28, .tuner_type = 25, @@ -1557,7 +1606,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0x3f, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 0x01, 0x00, 0x03, 0x03, 0x09, 0x02 }, + .gpiomux = { 0x01, 0x00, 0x03, 0x03 }, + .gpiomute = 0x09, .needs_tvaudio = 1, .no_msp34xx = 1, .no_tda9875 = 1, @@ -1586,7 +1636,7 @@ struct tvcard bttv_tvcards[] = { .svhs = 4, .gpiomask = 0, .muxsel = { 2, 3, 1, 0, 0 }, - .audiomux = { 0 }, + .gpiomux = { 0 }, .needs_tvaudio = 0, .tuner_type = -1, .tuner_addr = ADDR_UNSET, @@ -1618,7 +1668,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0x1C800F, /* Bit0-2: Audio select, 8-12:remote control 14:remote valid 15:remote reset */ .muxsel = { 2, 1, 1, }, - .audiomux = { 0, 1, 2, 2, 4 }, + .gpiomux = { 0, 1, 2, 2 }, + .gpiomute = 4, .needs_tvaudio = 0, .tuner_type = TUNER_PHILIPS_PAL, .tuner_addr = ADDR_UNSET, @@ -1637,7 +1688,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0x140007, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 0, 1, 2, 3, 4, 0 }, + .gpiomux = { 0, 1, 2, 3 }, + .gpiomute = 4, .tuner_type = TUNER_PHILIPS_NTSC, .tuner_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET, @@ -1651,7 +1703,7 @@ struct tvcard bttv_tvcards[] = { .svhs = -1, .gpiomask = 0, .muxsel = { 2, 3, 1, 0 }, - .audiomux = { 0 }, + .gpiomux = { 0 }, .needs_tvaudio = 0, .no_msp34xx = 1, .pll = PLL_28, @@ -1667,13 +1719,14 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 7, .muxsel = { 2, 3, 1, 1 }, /* Tuner, SVid, SVHS, SVid to SVHS connector */ - .audiomux = { 0 ,0 ,4, 4,4,4},/* Yes, this tuner uses the same audio output for TV and FM radio! + .gpiomux = { 0, 0, 4, 4 },/* Yes, this tuner uses the same audio output for TV and FM radio! * This card lacks external Audio In, so we mute it on Ext. & Int. * The PCB can take a sbx1637/sbx1673, wiring unknown. * This card lacks PCI subsystem ID, sigh. - * audiomux=1: lower volume, 2+3: mute + * gpiomux =1: lower volume, 2+3: mute * btwincap uses 0x80000/0x80003 */ + .gpiomute = 4, .needs_tvaudio = 0, .no_msp34xx = 1, .pll = PLL_28, @@ -1720,7 +1773,7 @@ struct tvcard bttv_tvcards[] = { .radio_addr = ADDR_UNSET, .gpiomask = 7, - .audiomux = {7}, + .gpiomux = {7}, }, [BTTV_BOARD_GVBCTV5PCI] = { .name = "IODATA GV-BCTV5/PCI", @@ -1730,7 +1783,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0x0f0f80, .muxsel = {2, 3, 1, 0 }, - .audiomux = {0x030000, 0x010000, 0, 0, 0x020000, 0}, + .gpiomux = {0x030000, 0x010000, 0, 0 }, + .gpiomute = 0x020000, .no_msp34xx = 1, .pll = PLL_28, .tuner_type = TUNER_PHILIPS_NTSC_M, @@ -1960,7 +2014,7 @@ struct tvcard bttv_tvcards[] = { .gpiomask = 2, /* TV, Comp1, Composite over SVID con, SVID */ .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 2, 2, 0, 0, 0 }, + .gpiomux = { 2, 2, 0, 0 }, .pll = PLL_28, .has_radio = 1, .tuner_type = TUNER_PHILIPS_PAL, @@ -1984,7 +2038,8 @@ struct tvcard bttv_tvcards[] = { .svhs = -1, .gpiomask = 7, .muxsel = { 2, 3, 1, 1}, - .audiomux = { 0, 1, 2, 3, 4}, + .gpiomux = { 0, 1, 2, 3}, + .gpiomute = 4, .needs_tvaudio = 1, .tuner_type = 5, .tuner_addr = ADDR_UNSET, @@ -2016,7 +2071,7 @@ struct tvcard bttv_tvcards[] = { .svhs = -1, .gpiomask = 0, .muxsel = { 2, 3 }, - .audiomux = { 0 }, + .gpiomux = { 0 }, .needs_tvaudio = 0, .no_msp34xx = 1, .pll = PLL_28, @@ -2035,7 +2090,8 @@ struct tvcard bttv_tvcards[] = { .gpiomask = 0x001e8007, .muxsel = { 2, 3, 1, 0 }, /* Tuner, Radio, external, internal, off, on */ - .audiomux = { 0x08, 0x0f, 0x0a, 0x08, 0x0f, 0x08 }, + .gpiomux = { 0x08, 0x0f, 0x0a, 0x08 }, + .gpiomute = 0x0f, .needs_tvaudio = 0, .no_msp34xx = 1, .pll = PLL_28, @@ -2152,7 +2208,7 @@ struct tvcard bttv_tvcards[] = { .svhs = -1, .gpiomask = 0, .muxsel = { 2, 3, 1, 0 }, - .audiomux = { 0 }, + .gpiomux = { 0 }, .needs_tvaudio = 0, .no_msp34xx = 1, .pll = PLL_28, @@ -2169,7 +2225,7 @@ struct tvcard bttv_tvcards[] = { .svhs = 3, .gpiomask = 0x00, .muxsel = { 2, 3, 1, 0 }, - .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */ + .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ .needs_tvaudio = 1, .pll = PLL_28, .tuner_type = -1, @@ -2184,7 +2240,7 @@ struct tvcard bttv_tvcards[] = { .svhs = 3, .gpiomask = 0x00, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */ + .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ .needs_tvaudio = 1, .pll = PLL_28, .tuner_type = -1, @@ -2204,7 +2260,7 @@ struct tvcard bttv_tvcards[] = { via the upper nibble of muxsel. here: used for xternal video-mux */ .muxsel = { 0x02, 0x12, 0x22, 0x32, 0x03, 0x13, 0x23, 0x33, 0x01, 0x00 }, - .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */ + .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ .needs_tvaudio = 1, .pll = PLL_28, .tuner_type = -1, @@ -2222,7 +2278,7 @@ struct tvcard bttv_tvcards[] = { via the upper nibble of muxsel. here: used for xternal video-mux */ .muxsel = { 0x02, 0x12, 0x22, 0x32, 0x03, 0x13, 0x23, 0x33, 0x01, 0x01 }, - .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */ + .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ .needs_tvaudio = 1, .pll = PLL_28, .tuner_type = -1, @@ -2310,7 +2366,7 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 3, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 1, 1, 1, 1, 0 }, + .gpiomux = { 1, 1, 1, 1 }, .needs_tvaudio = 1, .tuner_type = TUNER_PHILIPS_PAL, .tuner_addr = ADDR_UNSET, @@ -2341,7 +2397,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0x008007, .muxsel = { 2, 3, 0, 0 }, - .audiomux = { 0, 0, 0, 0, 0x000003, 0 }, + .gpiomux = { 0, 0, 0, 0 }, + .gpiomute = 0x000003, .pll = PLL_28, .tuner_type = TUNER_PHILIPS_PAL, .tuner_addr = ADDR_UNSET, @@ -2377,7 +2434,7 @@ struct tvcard bttv_tvcards[] = { .needs_tvaudio = 0, .gpiomask = 0x68, .muxsel = { 2, 3, 1 }, - .audiomux = { 0x68, 0x68, 0x61, 0x61, 0x00 }, + .gpiomux = { 0x68, 0x68, 0x61, 0x61 }, .pll = PLL_28, }, @@ -2392,7 +2449,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0x008007, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 0, 1, 2, 2, 3 }, + .gpiomux = { 0, 1, 2, 2 }, + .gpiomute = 3, .needs_tvaudio = 0, .pll = PLL_28, .tuner_type = TUNER_PHILIPS_PAL, @@ -2417,7 +2475,7 @@ struct tvcard bttv_tvcards[] = { .no_tda9875 = 1, .no_tda7432 = 1, .muxsel = {2,2,2,2},/*878A input is always MUX0, see above.*/ - .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */ + .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ .pll = PLL_28, .needs_tvaudio = 0, .muxsel_hook = picolo_tetra_muxsel,/*Required as it doesn't follow the classic input selection policy*/ @@ -2435,7 +2493,7 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0x0000000f, .muxsel = { 2, 1, 1 }, - .audiomux = { 0x02, 0x00, 0x00, 0x00, 0x00 }, + .gpiomux = { 0x02, 0x00, 0x00, 0x00 }, .tuner_type = TUNER_TEMIC_PAL, .tuner_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET, @@ -2491,7 +2549,7 @@ struct tvcard bttv_tvcards[] = { .muxsel = { 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3 }, .muxsel_hook = sigmaSQ_muxsel, - .audiomux = { 0 }, + .gpiomux = { 0 }, .no_msp34xx = 1, .pll = PLL_28, .tuner_type = -1, @@ -2508,7 +2566,7 @@ struct tvcard bttv_tvcards[] = { .gpiomask = 0x0, .muxsel = { 2, 2, 2, 2 }, .muxsel_hook = sigmaSLC_muxsel, - .audiomux = { 0 }, + .gpiomux = { 0 }, .no_msp34xx = 1, .pll = PLL_28, .tuner_type = -1, @@ -2526,7 +2584,8 @@ struct tvcard bttv_tvcards[] = { .svhs = -1, .gpiomask = 0xFF, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 2, 0, 0, 0, 10 }, + .gpiomux = { 2, 0, 0, 0 }, + .gpiomute = 10, .needs_tvaudio = 0, .pll = PLL_28, .tuner_type = TUNER_PHILIPS_PAL, @@ -2560,7 +2619,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0x3f, .muxsel = {2, 3, 1, 0 }, - .audiomux = {0x31, 0x31, 0x31, 0x31, 0x31, 0x31 }, + .gpiomux = {0x31, 0x31, 0x31, 0x31 }, + .gpiomute = 0x31, .no_msp34xx = 1, .pll = PLL_28, .tuner_type = TUNER_PHILIPS_NTSC_M, @@ -2583,7 +2643,7 @@ struct tvcard bttv_tvcards[] = { .tuner_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET, .gpiomask = 0x008007, - .audiomux = { 0, 0x000001,0,0, 0 }, + .gpiomux = { 0, 0x000001,0,0 }, .needs_tvaudio = 1, .has_radio = 1, }, @@ -2693,7 +2753,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .muxsel = { 2, 3, 1 }, .gpiomask = 0x00e00007, - .audiomux = { 0x00400005, 0, 0x00000001, 0, 0x00c00007, 0 }, + .gpiomux = { 0x00400005, 0, 0x00000001, 0 }, + .gpiomute = 0x00c00007, .no_msp34xx = 1, .no_tda9875 = 1, .no_tda7432 = 1, @@ -2709,7 +2770,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0x01fe00, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 0x001e00, 0, 0x018000, 0x014000, 0x002000, 0 }, + .gpiomux = { 0x001e00, 0, 0x018000, 0x014000 }, + .gpiomute = 0x002000, .needs_tvaudio = 1, .pll = PLL_28, .tuner_type = TUNER_YMEC_TVF66T5_B_DFF, @@ -2726,7 +2788,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0x001c0007, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 0, 1, 2, 2, 3 }, + .gpiomux = { 0, 1, 2, 2 }, + .gpiomute = 3, .needs_tvaudio = 0, .pll = PLL_28, .tuner_type = TUNER_TENA_9533_DI, @@ -2745,7 +2808,8 @@ struct tvcard bttv_tvcards[] = { .gpiomask = 0x01fe00, .muxsel = { 2,3,1,1,-1 }, .digital_mode = DIGITAL_MODE_CAMERA, - .audiomux = { 0x00400, 0x10400, 0x04400, 0x80000, 0x12400, 0x46000 }, + .gpiomux = { 0x00400, 0x10400, 0x04400, 0x80000 }, + .gpiomute = 0x12400, .no_msp34xx = 1, .pll = PLL_28, .tuner_type = TUNER_LG_PAL_FM, @@ -2763,7 +2827,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0x3f, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 0x21, 0x20, 0x24, 0x2c, 0x29, 0x29 }, + .gpiomux = { 0x21, 0x20, 0x24, 0x2c }, + .gpiomute = 0x29, .no_msp34xx = 1, .pll = PLL_28, .tuner_type = TUNER_YMEC_TVF_5533MF, @@ -2797,7 +2862,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 15, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 2, 0, 0, 0, 1 }, + .gpiomux = { 2, 0, 0, 0 }, + .gpiomute = 1, .needs_tvaudio = 1, .pll = PLL_28, .tuner_type = 2, @@ -2813,7 +2879,7 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 0x108007, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 100000, 100002, 100002, 100000 }, + .gpiomux = { 100000, 100002, 100002, 100000 }, .no_msp34xx = 1, .no_tda9875 = 1, .no_tda7432 = 1, @@ -2853,7 +2919,8 @@ struct tvcard bttv_tvcards[] = { .svhs = 2, .gpiomask = 7, .muxsel = { 2, 3, 1, 1 }, - .audiomux = { 0, 1, 2, 3, 4 }, + .gpiomux = { 0, 1, 2, 3 }, + .gpiomute = 4, .tuner_type = TUNER_TEMIC_4009FR5_PAL, .tuner_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET, @@ -2925,20 +2992,20 @@ void __devinit bttv_idcard(struct bttv *btv) if (UNSET != audiomux[0]) { gpiobits = 0; for (i = 0; i < 5; i++) { - bttv_tvcards[btv->c.type].audiomux[i] = audiomux[i]; + bttv_tvcards[btv->c.type].gpiomux[i] = audiomux[i]; gpiobits |= audiomux[i]; } } else { gpiobits = audioall; for (i = 0; i < 5; i++) { - bttv_tvcards[btv->c.type].audiomux[i] = audioall; + bttv_tvcards[btv->c.type].gpiomux[i] = audioall; } } bttv_tvcards[btv->c.type].gpiomask = (UNSET != gpiomask) ? gpiomask : gpiobits; printk(KERN_INFO "bttv%d: gpio config override: mask=0x%x, mux=", btv->c.nr,bttv_tvcards[btv->c.type].gpiomask); for (i = 0; i < 5; i++) { - printk("%s0x%x", i ? "," : "", bttv_tvcards[btv->c.type].audiomux[i]); + printk("%s0x%x", i ? "," : "", bttv_tvcards[btv->c.type].gpiomux[i]); } printk("\n"); } @@ -3046,7 +3113,7 @@ static void miro_pinnacle_gpio(struct bttv *btv) gpio_inout(0xffffff, 0); gpio = gpio_read(); id = ((gpio>>10) & 63) -1; - msp = bttv_I2CRead(btv, I2C_MSP3400, "MSP34xx"); + msp = bttv_I2CRead(btv, I2C_ADDR_MSP3400, "MSP34xx"); if (id < 32) { btv->tuner_type = miro_tunermap[id]; if (0 == (gpio & 0x20)) { @@ -3442,8 +3509,8 @@ void __devinit bttv_init_card2(struct bttv *btv) if (bttv_tvcards[btv->c.type].digital_mode == DIGITAL_MODE_CAMERA) { /* detect Bt832 chip for quartzsight digital camera */ - if ((bttv_I2CRead(btv, I2C_BT832_ALT1, "Bt832") >=0) || - (bttv_I2CRead(btv, I2C_BT832_ALT2, "Bt832") >=0)) + if ((bttv_I2CRead(btv, I2C_ADDR_BT832_ALT1, "Bt832") >=0) || + (bttv_I2CRead(btv, I2C_ADDR_BT832_ALT2, "Bt832") >=0)) boot_bt832(btv); } @@ -3452,19 +3519,19 @@ void __devinit bttv_init_card2(struct bttv *btv) /* try to detect audio/fader chips */ if (!bttv_tvcards[btv->c.type].no_msp34xx && - bttv_I2CRead(btv, I2C_MSP3400, "MSP34xx") >=0) + bttv_I2CRead(btv, I2C_ADDR_MSP3400, "MSP34xx") >=0) request_module("msp3400"); if (bttv_tvcards[btv->c.type].msp34xx_alt && - bttv_I2CRead(btv, I2C_MSP3400_ALT, "MSP34xx (alternate address)") >=0) + bttv_I2CRead(btv, I2C_ADDR_MSP3400_ALT, "MSP34xx (alternate address)") >=0) request_module("msp3400"); if (!bttv_tvcards[btv->c.type].no_tda9875 && - bttv_I2CRead(btv, I2C_TDA9875, "TDA9875") >=0) + bttv_I2CRead(btv, I2C_ADDR_TDA9875, "TDA9875") >=0) request_module("tda9875"); if (!bttv_tvcards[btv->c.type].no_tda7432 && - bttv_I2CRead(btv, I2C_TDA7432, "TDA7432") >=0) + bttv_I2CRead(btv, I2C_ADDR_TDA7432, "TDA7432") >=0) request_module("tda7432"); if (bttv_tvcards[btv->c.type].needs_tvaudio) @@ -3475,7 +3542,7 @@ void __devinit bttv_init_card2(struct bttv *btv) if (btv->tda9887_conf) tda9887 = 1; if (0 == tda9887 && 0 == bttv_tvcards[btv->c.type].has_dvb && - bttv_I2CRead(btv, I2C_TDA9887, "TDA9887") >=0) + bttv_I2CRead(btv, I2C_ADDR_TDA9887, "TDA9887") >=0) tda9887 = 1; /* Hybrid DVB card, DOES have a tda9887 */ if (btv->c.type == BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE) @@ -3796,18 +3863,18 @@ void bttv_tda9880_setnorm(struct bttv *btv, int norm) { /* fix up our card entry */ if(norm==VIDEO_MODE_NTSC) { - bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].audiomux[0]=0x957fff; - bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].audiomux[4]=0x957fff; + bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].gpiomux[TVAUDIO_INPUT_TUNER]=0x957fff; + bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].gpiomute=0x957fff; dprintk("bttv_tda9880_setnorm to NTSC\n"); } else { - bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].audiomux[0]=0x947fff; - bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].audiomux[4]=0x947fff; + bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].gpiomux[TVAUDIO_INPUT_TUNER]=0x947fff; + bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].gpiomute=0x947fff; dprintk("bttv_tda9880_setnorm to PAL\n"); } /* set GPIO according */ gpio_bits(bttv_tvcards[btv->c.type].gpiomask, - bttv_tvcards[btv->c.type].audiomux[btv->audio]); + bttv_tvcards[btv->c.type].gpiomux[btv->audio]); } diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index c0415d6e7fee..74def9c23952 100644 --- a/drivers/media/video/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c @@ -36,13 +36,15 @@ #include <linux/kdev_t.h> #include "bttvp.h" #include <media/v4l2-common.h> +#include <media/tvaudio.h> +#include <media/msp3400.h> #include <linux/dma-mapping.h> #include <asm/io.h> #include <asm/byteorder.h> -#include "rds.h" +#include <media/rds.h> unsigned int bttv_num; /* number of Bt848s in use */ @@ -926,45 +928,98 @@ video_mux(struct bttv *btv, unsigned int input) static char *audio_modes[] = { "audio: tuner", "audio: radio", "audio: extern", - "audio: intern", "audio: off" + "audio: intern", "audio: mute" }; static int -audio_mux(struct bttv *btv, int mode) +audio_mux(struct bttv *btv, int input, int mute) { - int val,mux,i2c_mux,signal; + int gpio_val, signal; + struct v4l2_control ctrl; + struct i2c_client *c; gpio_inout(bttv_tvcards[btv->c.type].gpiomask, bttv_tvcards[btv->c.type].gpiomask); signal = btread(BT848_DSTATUS) & BT848_DSTATUS_HLOC; - switch (mode) { - case AUDIO_MUTE: - btv->audio |= AUDIO_MUTE; - break; - case AUDIO_UNMUTE: - btv->audio &= ~AUDIO_MUTE; - break; - case AUDIO_TUNER: - case AUDIO_RADIO: - case AUDIO_EXTERN: - case AUDIO_INTERN: - btv->audio &= AUDIO_MUTE; - btv->audio |= mode; - } - i2c_mux = mux = (btv->audio & AUDIO_MUTE) ? AUDIO_OFF : btv->audio; - if (btv->opt_automute && !signal && !btv->radio_user) - mux = AUDIO_OFF; - - val = bttv_tvcards[btv->c.type].audiomux[mux]; - gpio_bits(bttv_tvcards[btv->c.type].gpiomask,val); + btv->mute = mute; + btv->audio = input; + + /* automute */ + mute = mute || (btv->opt_automute && !signal && !btv->radio_user); + + if (mute) + gpio_val = bttv_tvcards[btv->c.type].gpiomute; + else + gpio_val = bttv_tvcards[btv->c.type].gpiomux[input]; + + gpio_bits(bttv_tvcards[btv->c.type].gpiomask, gpio_val); if (bttv_gpio) - bttv_gpio_tracking(btv,audio_modes[mux]); - if (!in_interrupt()) - bttv_call_i2c_clients(btv,AUDC_SET_INPUT,&(i2c_mux)); + bttv_gpio_tracking(btv, audio_modes[mute ? 4 : input]); + if (in_interrupt()) + return 0; + + ctrl.id = V4L2_CID_AUDIO_MUTE; + ctrl.value = btv->mute; + bttv_call_i2c_clients(btv, VIDIOC_S_CTRL, &ctrl); + c = btv->i2c_msp34xx_client; + if (c) { + struct v4l2_routing route; + + /* Note: the inputs tuner/radio/extern/intern are translated + to msp routings. This assumes common behavior for all msp3400 + based TV cards. When this assumption fails, then the + specific MSP routing must be added to the card table. + For now this is sufficient. */ + switch (input) { + case TVAUDIO_INPUT_RADIO: + route.input = MSP_INPUT(MSP_IN_SCART_2, MSP_IN_TUNER_1, + MSP_DSP_OUT_SCART, MSP_DSP_OUT_SCART); + break; + case TVAUDIO_INPUT_EXTERN: + route.input = MSP_INPUT(MSP_IN_SCART_1, MSP_IN_TUNER_1, + MSP_DSP_OUT_SCART, MSP_DSP_OUT_SCART); + break; + case TVAUDIO_INPUT_INTERN: + /* Yes, this is the same input as for RADIO. I doubt + if this is ever used. The only board with an INTERN + input is the BTTV_BOARD_AVERMEDIA98. I wonder how + that was tested. My guess is that the whole INTERN + input does not work. */ + route.input = MSP_INPUT(MSP_IN_SCART_2, MSP_IN_TUNER_1, + MSP_DSP_OUT_SCART, MSP_DSP_OUT_SCART); + break; + case TVAUDIO_INPUT_TUNER: + default: + route.input = MSP_INPUT_DEFAULT; + break; + } + route.output = MSP_OUTPUT_DEFAULT; + c->driver->command(c, VIDIOC_INT_S_AUDIO_ROUTING, &route); + } + c = btv->i2c_tvaudio_client; + if (c) { + struct v4l2_routing route; + + route.input = input; + route.output = 0; + c->driver->command(c, VIDIOC_INT_S_AUDIO_ROUTING, &route); + } return 0; } +static inline int +audio_mute(struct bttv *btv, int mute) +{ + return audio_mux(btv, btv->audio, mute); +} + +static inline int +audio_input(struct bttv *btv, int input) +{ + return audio_mux(btv, input, btv->mute); +} + static void i2c_vidiocschan(struct bttv *btv) { @@ -1023,8 +1078,8 @@ set_input(struct bttv *btv, unsigned int input) } else { video_mux(btv,input); } - audio_mux(btv,(input == bttv_tvcards[btv->c.type].tuner ? - AUDIO_TUNER : AUDIO_EXTERN)); + audio_input(btv,(input == bttv_tvcards[btv->c.type].tuner ? + TVAUDIO_INPUT_TUNER : TVAUDIO_INPUT_EXTERN)); set_tvnorm(btv,btv->tvnorm); i2c_vidiocschan(btv); } @@ -1236,10 +1291,10 @@ static int set_control(struct bttv *btv, struct v4l2_control *c) case V4L2_CID_AUDIO_MUTE: if (c->value) { va.flags |= VIDEO_AUDIO_MUTE; - audio_mux(btv, AUDIO_MUTE); + audio_mute(btv, 1); } else { va.flags &= ~VIDEO_AUDIO_MUTE; - audio_mux(btv, AUDIO_UNMUTE); + audio_mute(btv, 0); } break; @@ -1397,7 +1452,7 @@ bttv_switch_overlay(struct bttv *btv, struct bttv_fh *fh, free_btres(btv,fh,RESOURCE_OVERLAY); if (NULL != old) { dprintk("switch_overlay: old=%p state is %d\n",old,old->vb.state); - bttv_dma_free(btv, old); + bttv_dma_free(&fh->cap,btv, old); kfree(old); } dprintk("switch_overlay: done\n"); @@ -1407,7 +1462,8 @@ bttv_switch_overlay(struct bttv *btv, struct bttv_fh *fh, /* ----------------------------------------------------------------------- */ /* video4linux (1) interface */ -static int bttv_prepare_buffer(struct bttv *btv, struct bttv_buffer *buf, +static int bttv_prepare_buffer(struct videobuf_queue *q,struct bttv *btv, + struct bttv_buffer *buf, const struct bttv_format *fmt, unsigned int width, unsigned int height, enum v4l2_field field) @@ -1450,7 +1506,7 @@ static int bttv_prepare_buffer(struct bttv *btv, struct bttv_buffer *buf, /* alloc risc memory */ if (STATE_NEEDS_INIT == buf->vb.state) { redo_dma_risc = 1; - if (0 != (rc = videobuf_iolock(btv->c.pci,&buf->vb,&btv->fbuf))) + if (0 != (rc = videobuf_iolock(q,&buf->vb,&btv->fbuf))) goto fail; } @@ -1462,7 +1518,7 @@ static int bttv_prepare_buffer(struct bttv *btv, struct bttv_buffer *buf, return 0; fail: - bttv_dma_free(btv,buf); + bttv_dma_free(q,btv,buf); return rc; } @@ -1486,7 +1542,7 @@ buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, struct bttv_buffer *buf = container_of(vb,struct bttv_buffer,vb); struct bttv_fh *fh = q->priv_data; - return bttv_prepare_buffer(fh->btv, buf, fh->fmt, + return bttv_prepare_buffer(q,fh->btv, buf, fh->fmt, fh->width, fh->height, field); } @@ -1510,7 +1566,7 @@ static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) struct bttv_buffer *buf = container_of(vb,struct bttv_buffer,vb); struct bttv_fh *fh = q->priv_data; - bttv_dma_free(fh->btv,buf); + bttv_dma_free(&fh->cap,fh->btv,buf); } static struct videobuf_queue_ops bttv_video_qops = { @@ -1653,7 +1709,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) return -EINVAL; mutex_lock(&btv->lock); - audio_mux(btv, (v->flags&VIDEO_AUDIO_MUTE) ? AUDIO_MUTE : AUDIO_UNMUTE); + audio_mute(btv, (v->flags&VIDEO_AUDIO_MUTE) ? 1 : 0); bttv_call_i2c_clients(btv,cmd,v); /* card specific hooks */ @@ -1822,7 +1878,8 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) bttv_call_i2c_clients(btv, VIDIOCGAUDIO, &va); if (t->audmode == V4L2_TUNER_MODE_MONO) va.mode = VIDEO_SOUND_MONO; - else if (t->audmode == V4L2_TUNER_MODE_STEREO) + else if (t->audmode == V4L2_TUNER_MODE_STEREO || + t->audmode == V4L2_TUNER_MODE_LANG1_LANG2) va.mode = VIDEO_SOUND_STEREO; else if (t->audmode == V4L2_TUNER_MODE_LANG1) va.mode = VIDEO_SOUND_LANG1; @@ -2496,7 +2553,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, field = (vm->height > bttv_tvnorms[btv->tvnorm].sheight/2) ? V4L2_FIELD_INTERLACED : V4L2_FIELD_BOTTOM; - retval = bttv_prepare_buffer(btv,buf, + retval = bttv_prepare_buffer(&fh->cap,btv,buf, format_by_palette(vm->format), vm->width,vm->height,field); if (0 != retval) @@ -2528,8 +2585,8 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, retval = -EIO; /* fall through */ case STATE_DONE: - videobuf_dma_pci_sync(btv->c.pci,&buf->vb.dma); - bttv_dma_free(btv,buf); + videobuf_dma_sync(&fh->cap,&buf->vb.dma); + bttv_dma_free(&fh->cap,btv,buf); break; default: retval = -EINVAL; @@ -3162,8 +3219,8 @@ static int radio_open(struct inode *inode, struct file *file) file->private_data = btv; - bttv_call_i2c_clients(btv,AUDC_SET_RADIO,&btv->tuner_type); - audio_mux(btv,AUDIO_RADIO); + bttv_call_i2c_clients(btv,AUDC_SET_RADIO,NULL); + audio_input(btv,TVAUDIO_INPUT_RADIO); mutex_unlock(&btv->lock); return 0; @@ -3749,7 +3806,7 @@ static irqreturn_t bttv_irq(int irq, void *dev_id, struct pt_regs * regs) bttv_irq_switch_video(btv); if ((astat & BT848_INT_HLOCK) && btv->opt_automute) - audio_mux(btv, -1); + audio_mute(btv, btv->mute); /* trigger automute */ if (astat & (BT848_INT_SCERR|BT848_INT_OCERR)) { printk(KERN_INFO "bttv%d: %s%s @ %08x,",btv->c.nr, @@ -4050,7 +4107,7 @@ static int __devinit bttv_probe(struct pci_dev *dev, bt848_contrast(btv,32768); bt848_hue(btv,32768); bt848_sat(btv,32768); - audio_mux(btv,AUDIO_MUTE); + audio_mute(btv, 1); set_input(btv,0); } diff --git a/drivers/media/video/bttv-gpio.c b/drivers/media/video/bt8xx/bttv-gpio.c index c4d5e2b70c28..c4d5e2b70c28 100644 --- a/drivers/media/video/bttv-gpio.c +++ b/drivers/media/video/bt8xx/bttv-gpio.c diff --git a/drivers/media/video/bttv-i2c.c b/drivers/media/video/bt8xx/bttv-i2c.c index 614c12018557..4b562b386fcf 100644 --- a/drivers/media/video/bttv-i2c.c +++ b/drivers/media/video/bt8xx/bttv-i2c.c @@ -302,6 +302,10 @@ static int attach_inform(struct i2c_client *client) if (!client->driver->command) return 0; + if (client->driver->id == I2C_DRIVERID_MSP3400) + btv->i2c_msp34xx_client = client; + if (client->driver->id == I2C_DRIVERID_TVAUDIO) + btv->i2c_tvaudio_client = client; if (btv->tuner_type != UNSET) { struct tuner_setup tun_setup; diff --git a/drivers/media/video/bttv-if.c b/drivers/media/video/bt8xx/bttv-if.c index 19b564ab0e92..19b564ab0e92 100644 --- a/drivers/media/video/bttv-if.c +++ b/drivers/media/video/bt8xx/bttv-if.c diff --git a/drivers/media/video/bttv-input.c b/drivers/media/video/bt8xx/bttv-input.c index 69efa0e5174d..69efa0e5174d 100644 --- a/drivers/media/video/bttv-input.c +++ b/drivers/media/video/bt8xx/bttv-input.c diff --git a/drivers/media/video/bttv-risc.c b/drivers/media/video/bt8xx/bttv-risc.c index 344f84e9af04..16323a5d68ac 100644 --- a/drivers/media/video/bttv-risc.c +++ b/drivers/media/video/bt8xx/bttv-risc.c @@ -509,11 +509,11 @@ bttv_risc_hook(struct bttv *btv, int slot, struct btcx_riscmem *risc, } void -bttv_dma_free(struct bttv *btv, struct bttv_buffer *buf) +bttv_dma_free(struct videobuf_queue *q,struct bttv *btv, struct bttv_buffer *buf) { BUG_ON(in_interrupt()); videobuf_waiton(&buf->vb,0,0); - videobuf_dma_pci_unmap(btv->c.pci, &buf->vb.dma); + videobuf_dma_unmap(q, &buf->vb.dma); videobuf_dma_free(&buf->vb.dma); btcx_riscmem_free(btv->c.pci,&buf->bottom); btcx_riscmem_free(btv->c.pci,&buf->top); diff --git a/drivers/media/video/bttv-vbi.c b/drivers/media/video/bt8xx/bttv-vbi.c index 72afdd64b882..e20ff238e409 100644 --- a/drivers/media/video/bttv-vbi.c +++ b/drivers/media/video/bt8xx/bttv-vbi.c @@ -96,7 +96,7 @@ static int vbi_buffer_prepare(struct videobuf_queue *q, return -EINVAL; if (STATE_NEEDS_INIT == buf->vb.state) { - if (0 != (rc = videobuf_iolock(btv->c.pci, &buf->vb, NULL))) + if (0 != (rc = videobuf_iolock(q, &buf->vb, NULL))) goto fail; if (0 != (rc = vbi_buffer_risc(btv,buf,fh->lines))) goto fail; @@ -109,7 +109,7 @@ static int vbi_buffer_prepare(struct videobuf_queue *q, return 0; fail: - bttv_dma_free(btv,buf); + bttv_dma_free(q,btv,buf); return rc; } @@ -136,7 +136,7 @@ static void vbi_buffer_release(struct videobuf_queue *q, struct videobuf_buffer struct bttv_buffer *buf = container_of(vb,struct bttv_buffer,vb); dprintk("free %p\n",vb); - bttv_dma_free(fh->btv,buf); + bttv_dma_free(&fh->cap,fh->btv,buf); } struct videobuf_queue_ops bttv_vbi_qops = { diff --git a/drivers/media/video/bttv.h b/drivers/media/video/bt8xx/bttv.h index 9908c8e0c951..3a23265c1538 100644 --- a/drivers/media/video/bttv.h +++ b/drivers/media/video/bt8xx/bttv.h @@ -18,6 +18,7 @@ #include <linux/i2c.h> #include <media/ir-common.h> #include <media/ir-kbd-i2c.h> +#include <media/i2c-addr.h> /* ---------------------------------------------------------- */ /* exported by bttv-cards.c */ @@ -168,25 +169,6 @@ #define BTTV_BOARD_HAUPPAUGE_IMPACTVCB 0x8f #define BTTV_BOARD_MACHTV_MAGICTV 0x90 -/* i2c address list */ -#define I2C_TSA5522 0xc2 -#define I2C_TDA7432 0x8a -#define I2C_BT832_ALT1 0x88 -#define I2C_BT832_ALT2 0x8a // alternate setting -#define I2C_TDA8425 0x82 -#define I2C_TDA9840 0x84 -#define I2C_TDA9850 0xb6 /* also used by 9855,9873 */ -#define I2C_TDA9874 0xb0 /* also used by 9875 */ -#define I2C_TDA9875 0xb0 -#define I2C_HAUPEE 0xa0 -#define I2C_STBEE 0xae -#define I2C_VHX 0xc0 -#define I2C_MSP3400 0x80 -#define I2C_MSP3400_ALT 0x88 -#define I2C_TEA6300 0x80 /* also used by 6320 */ -#define I2C_DPL3518 0x84 -#define I2C_TDA9887 0x86 - /* more card-specific defines */ #define PT2254_L_CHANNEL 0x10 #define PT2254_R_CHANNEL 0x08 @@ -252,7 +234,8 @@ struct tvcard unsigned int digital_mode; // DIGITAL_MODE_CAMERA or DIGITAL_MODE_VIDEO u32 gpiomask; u32 muxsel[16]; - u32 audiomux[6]; /* Tuner, Radio, external, internal, mute, stereo */ + u32 gpiomux[4]; /* Tuner, Radio, external, internal */ + u32 gpiomute; /* GPIO mute setting */ u32 gpiomask2; /* GPIO MUX mask */ /* i2c audio flags */ diff --git a/drivers/media/video/bttvp.h b/drivers/media/video/bt8xx/bttvp.h index 9cb72f176f7d..ee989d2e15d9 100644 --- a/drivers/media/video/bttvp.h +++ b/drivers/media/video/bt8xx/bttvp.h @@ -41,7 +41,6 @@ #include <linux/device.h> #include <media/video-buf.h> -#include <media/audiochip.h> #include <media/tuner.h> #include <media/tveeprom.h> #include <media/ir-common.h> @@ -190,7 +189,8 @@ int bttv_buffer_activate_video(struct bttv *btv, struct bttv_buffer_set *set); int bttv_buffer_activate_vbi(struct bttv *btv, struct bttv_buffer *vbi); -void bttv_dma_free(struct bttv *btv, struct bttv_buffer *buf); +void bttv_dma_free(struct videobuf_queue *q, struct bttv *btv, + struct bttv_buffer *buf); /* overlay handling */ int bttv_overlay_risc(struct bttv *btv, struct bttv_overlay *ov, @@ -298,6 +298,8 @@ struct bttv { int i2c_state, i2c_rc; int i2c_done; wait_queue_head_t i2c_queue; + struct i2c_client *i2c_msp34xx_client; + struct i2c_client *i2c_tvaudio_client; /* video4linux (1) */ struct video_device *video_dev; @@ -320,6 +322,7 @@ struct bttv { /* video state */ unsigned int input; unsigned int audio; + unsigned int mute; unsigned long freq; int tvnorm,hue,contrast,bright,saturation; struct v4l2_framebuffer fbuf; diff --git a/drivers/media/video/bw-qcam.c b/drivers/media/video/bw-qcam.c index d97b7d8ac33d..cf61c590f4ad 100644 --- a/drivers/media/video/bw-qcam.c +++ b/drivers/media/video/bw-qcam.c @@ -150,7 +150,7 @@ static int qc_calibrate(struct qcam_device *q) static struct qcam_device *qcam_init(struct parport *port) { struct qcam_device *q; - + q = kmalloc(sizeof(struct qcam_device), GFP_KERNEL); if(q==NULL) return NULL; @@ -158,16 +158,16 @@ static struct qcam_device *qcam_init(struct parport *port) q->pport = port; q->pdev = parport_register_device(port, "bw-qcam", NULL, NULL, NULL, 0, NULL); - if (q->pdev == NULL) + if (q->pdev == NULL) { printk(KERN_ERR "bw-qcam: couldn't register for %s.\n", port->name); kfree(q); return NULL; } - + memcpy(&q->vdev, &qcam_template, sizeof(qcam_template)); - + mutex_init(&q->lock); q->port_mode = (QC_ANY | QC_NOTSET); @@ -236,12 +236,12 @@ static int qc_waithand(struct qcam_device *q, int val) while (!((status = read_lpstatus(q)) & 8)) { /* 1000 is enough spins on the I/O for all normal - cases, at that point we start to poll slowly + cases, at that point we start to poll slowly until the camera wakes up. However, we are busy blocked until the camera responds, so setting it lower is much better for interactive response. */ - + if(runs++>maxpoll) { msleep_interruptible(5); @@ -255,12 +255,12 @@ static int qc_waithand(struct qcam_device *q, int val) while (((status = read_lpstatus(q)) & 8)) { /* 1000 is enough spins on the I/O for all normal - cases, at that point we start to poll slowly + cases, at that point we start to poll slowly until the camera wakes up. However, we are busy blocked until the camera responds, so setting it lower is much better for interactive response. */ - + if(runs++>maxpoll) { msleep_interruptible(5); @@ -282,17 +282,17 @@ static unsigned int qc_waithand2(struct qcam_device *q, int val) { unsigned int status; int runs=0; - - do + + do { status = read_lpdata(q); /* 1000 is enough spins on the I/O for all normal - cases, at that point we start to poll slowly + cases, at that point we start to poll slowly until the camera wakes up. However, we are busy blocked until the camera responds, so setting it lower is much better for interactive response. */ - + if(runs++>maxpoll) { msleep_interruptible(5); @@ -321,7 +321,7 @@ static int qc_detect(struct qcam_device *q) lastreg = reg = read_lpstatus(q) & 0xf0; - for (i = 0; i < 500; i++) + for (i = 0; i < 500; i++) { reg = read_lpstatus(q) & 0xf0; if (reg != lastreg) @@ -357,7 +357,7 @@ static int qc_detect(struct qcam_device *q) static void qc_reset(struct qcam_device *q) { - switch (q->port_mode & QC_FORCE_MASK) + switch (q->port_mode & QC_FORCE_MASK) { case QC_FORCE_UNIDIR: q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_UNIDIR; @@ -370,7 +370,7 @@ static void qc_reset(struct qcam_device *q) case QC_ANY: write_lpcontrol(q, 0x20); write_lpdata(q, 0x75); - + if (read_lpdata(q) != 0x75) { q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_BIDIR; } else { @@ -398,8 +398,8 @@ static void qc_reset(struct qcam_device *q) static int qc_setscanmode(struct qcam_device *q) { int old_mode = q->mode; - - switch (q->transfer_scale) + + switch (q->transfer_scale) { case 1: q->mode = 0; @@ -412,7 +412,7 @@ static int qc_setscanmode(struct qcam_device *q) break; } - switch (q->bpp) + switch (q->bpp) { case 4: break; @@ -421,7 +421,7 @@ static int qc_setscanmode(struct qcam_device *q) break; } - switch (q->port_mode & QC_MODE_MASK) + switch (q->port_mode & QC_MODE_MASK) { case QC_BIDIR: q->mode += 1; @@ -430,10 +430,10 @@ static int qc_setscanmode(struct qcam_device *q) case QC_UNIDIR: break; } - + if (q->mode != old_mode) q->status |= QC_PARAM_CHANGE; - + return 0; } @@ -451,7 +451,7 @@ static void qc_set(struct qcam_device *q) /* Set the brightness. Yes, this is repetitive, but it works. * Shorter versions seem to fail subtly. Feel free to try :-). */ /* I think the problem was in qc_command, not here -- bls */ - + qc_command(q, 0xb); qc_command(q, q->brightness); @@ -502,13 +502,13 @@ static inline int qc_readbytes(struct qcam_device *q, char buffer[]) unsigned int hi2, lo2; static int state = 0; - if (buffer == NULL) + if (buffer == NULL) { state = 0; return 0; } - - switch (q->port_mode & QC_MODE_MASK) + + switch (q->port_mode & QC_MODE_MASK) { case QC_BIDIR: /* Bi-directional Port */ write_lpcontrol(q, 0x26); @@ -517,7 +517,7 @@ static inline int qc_readbytes(struct qcam_device *q, char buffer[]) write_lpcontrol(q, 0x2e); lo2 = (qc_waithand2(q, 0) >> 1); hi2 = (read_lpstatus(q) >> 3) & 0x1f; - switch (q->bpp) + switch (q->bpp) { case 4: buffer[0] = lo & 0xf; @@ -544,7 +544,7 @@ static inline int qc_readbytes(struct qcam_device *q, char buffer[]) write_lpcontrol(q, 0xe); hi = (qc_waithand(q, 0) & 0xf0) >> 4; - switch (q->bpp) + switch (q->bpp) { case 4: buffer[0] = lo; @@ -552,7 +552,7 @@ static inline int qc_readbytes(struct qcam_device *q, char buffer[]) ret = 2; break; case 6: - switch (state) + switch (state) { case 0: buffer[0] = (lo << 2) | ((hi & 0xc) >> 2); @@ -604,13 +604,13 @@ static long qc_capture(struct qcam_device * q, char __user *buf, unsigned long l int shift=8-q->bpp; char invert; - if (q->mode == -1) + if (q->mode == -1) return -ENXIO; qc_command(q, 0x7); qc_command(q, q->mode); - if ((q->port_mode & QC_MODE_MASK) == QC_BIDIR) + if ((q->port_mode & QC_MODE_MASK) == QC_BIDIR) { write_lpcontrol(q, 0x2e); /* turn port around */ write_lpcontrol(q, 0x26); @@ -618,7 +618,7 @@ static long qc_capture(struct qcam_device * q, char __user *buf, unsigned long l write_lpcontrol(q, 0x2e); (void) qc_waithand(q, 0); } - + /* strange -- should be 15:63 below, but 4bpp is odd */ invert = (q->bpp == 4) ? 16 : 63; @@ -629,15 +629,15 @@ static long qc_capture(struct qcam_device * q, char __user *buf, unsigned long l q->transfer_scale; transperline = (transperline + divisor - 1) / divisor; - for (i = 0, yield = yieldlines; i < linestotrans; i++) + for (i = 0, yield = yieldlines; i < linestotrans; i++) { - for (pixels_read = j = 0; j < transperline; j++) + for (pixels_read = j = 0; j < transperline; j++) { bytes = qc_readbytes(q, buffer); - for (k = 0; k < bytes && (pixels_read + k) < pixels_per_line; k++) + for (k = 0; k < bytes && (pixels_read + k) < pixels_per_line; k++) { int o; - if (buffer[k] == 0 && invert == 16) + if (buffer[k] == 0 && invert == 16) { /* 4bpp is odd (again) -- inverter is 16, not 15, but output must be 0-15 -- bls */ @@ -653,7 +653,7 @@ static long qc_capture(struct qcam_device * q, char __user *buf, unsigned long l pixels_read += bytes; } (void) qc_readbytes(q, NULL); /* reset state machine */ - + /* Grabbing an entire frame from the quickcam is a lengthy process. We don't (usually) want to busy-block the processor for the entire frame. yieldlines is a module @@ -666,7 +666,7 @@ static long qc_capture(struct qcam_device * q, char __user *buf, unsigned long l } } - if ((q->port_mode & QC_MODE_MASK) == QC_BIDIR) + if ((q->port_mode & QC_MODE_MASK) == QC_BIDIR) { write_lpcontrol(q, 2); write_lpcontrol(q, 6); @@ -687,7 +687,7 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file, { struct video_device *dev = video_devdata(file); struct qcam_device *qcam=(struct qcam_device *)dev; - + switch(cmd) { case VIDIOCGCAP: @@ -762,7 +762,7 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file, return -EINVAL; if(p->depth!=4 && p->depth!=6) return -EINVAL; - + /* * Now load the camera. */ @@ -790,11 +790,11 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file, return -EINVAL; if(vw->width<80||vw->width>320) return -EINVAL; - + qcam->width = 320; qcam->height = 240; qcam->transfer_scale = 4; - + if(vw->width>=160 && vw->height>=120) { qcam->transfer_scale = 2; @@ -808,11 +808,11 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file, mutex_lock(&qcam->lock); qc_setscanmode(qcam); mutex_unlock(&qcam->lock); - + /* We must update the camera before we grab. We could just have changed the grab size */ qcam->status |= QC_PARAM_CHANGE; - + /* Ok we figured out what to use from our wide choice */ return 0; } @@ -853,9 +853,9 @@ static ssize_t qcam_read(struct file *file, char __user *buf, struct qcam_device *qcam=(struct qcam_device *)v; int len; parport_claim_or_block(qcam->pdev); - + mutex_lock(&qcam->lock); - + qc_reset(qcam); /* Update the camera parameters if we need to */ @@ -863,13 +863,13 @@ static ssize_t qcam_read(struct file *file, char __user *buf, qc_set(qcam); len=qc_capture(qcam, buf,count); - + mutex_unlock(&qcam->lock); - + parport_release(qcam->pdev); return len; } - + static struct file_operations qcam_fops = { .owner = THIS_MODULE, .open = video_exclusive_open, @@ -905,11 +905,11 @@ static int init_bwqcam(struct parport *port) qcam=qcam_init(port); if(qcam==NULL) return -ENODEV; - + parport_claim_or_block(qcam->pdev); qc_reset(qcam); - + if(qc_detect(qcam)==0) { parport_release(qcam->pdev); @@ -920,9 +920,9 @@ static int init_bwqcam(struct parport *port) qc_calibrate(qcam); parport_release(qcam->pdev); - + printk(KERN_INFO "Connectix Quickcam on %s\n", qcam->pport->name); - + if(video_register_device(&qcam->vdev, VFL_TYPE_GRABBER, video_nr)==-1) { parport_unregister_device(qcam->pdev); @@ -1013,7 +1013,7 @@ static int __init init_bw_qcams(void) printk("Connectix Quickcam max-poll was above 5000. Using 5000.\n"); maxpoll = 5000; } - + if (yieldlines < 1) { printk("Connectix Quickcam yieldlines was less than 1. Using 1.\n"); yieldlines = 1; diff --git a/drivers/media/video/c-qcam.c b/drivers/media/video/c-qcam.c index 8211fd8d7cbf..22a7386bbea6 100644 --- a/drivers/media/video/c-qcam.c +++ b/drivers/media/video/c-qcam.c @@ -16,7 +16,7 @@ * * The parport parameter controls which parports will be scanned. * Scanning all parports causes some printers to print a garbage page. - * -- March 14, 1999 Billy Donahue <billy@escape.com> + * -- March 14, 1999 Billy Donahue <billy@escape.com> * * Fixed data format to BGR, added force_rgb parameter. Added missing * parport_unregister_driver() on module removal. @@ -88,7 +88,7 @@ static inline unsigned int qcam_ready2(struct qcam_device *qcam) return (parport_read_data(qcam->pport) & 0x1)?1:0; } -static unsigned int qcam_await_ready1(struct qcam_device *qcam, +static unsigned int qcam_await_ready1(struct qcam_device *qcam, int value) { unsigned long oldjiffies = jiffies; @@ -98,7 +98,7 @@ static unsigned int qcam_await_ready1(struct qcam_device *qcam, if (qcam_ready1(qcam) == value) return 0; - /* If the camera didn't respond within 1/25 second, poll slowly + /* If the camera didn't respond within 1/25 second, poll slowly for a while. */ for (i = 0; i < 50; i++) { @@ -123,7 +123,7 @@ static unsigned int qcam_await_ready2(struct qcam_device *qcam, int value) if (qcam_ready2(qcam) == value) return 0; - /* If the camera didn't respond within 1/25 second, poll slowly + /* If the camera didn't respond within 1/25 second, poll slowly for a while. */ for (i = 0; i < 50; i++) { @@ -157,12 +157,12 @@ static int qcam_write_data(struct qcam_device *qcam, unsigned int data) unsigned int idata; parport_write_data(qcam->pport, data); idata = qcam_read_data(qcam); - if (data != idata) + if (data != idata) { - printk(KERN_WARNING "cqcam: sent %x but received %x\n", data, + printk(KERN_WARNING "cqcam: sent %x but received %x\n", data, idata); return 1; - } + } return 0; } @@ -193,12 +193,12 @@ static int qc_detect(struct qcam_device *qcam) no device was found". Fix this one day. */ if (qcam->pport->probe_info[0].class == PARPORT_CLASS_MEDIA && qcam->pport->probe_info[0].model - && !strcmp(qcam->pdev->port->probe_info[0].model, + && !strcmp(qcam->pdev->port->probe_info[0].model, "Color QuickCam 2.0")) { printk(KERN_DEBUG "QuickCam: Found by IEEE1284 probe.\n"); return 1; } - + if (probe < 2) return 0; @@ -206,11 +206,11 @@ static int qc_detect(struct qcam_device *qcam) /* look for a heartbeat */ ostat = stat = parport_read_status(qcam->pport); - for (i=0; i<250; i++) + for (i=0; i<250; i++) { mdelay(1); stat = parport_read_status(qcam->pport); - if (ostat != stat) + if (ostat != stat) { if (++count >= 3) return 1; ostat = stat; @@ -226,11 +226,11 @@ static int qc_detect(struct qcam_device *qcam) count = 0; ostat = stat = parport_read_status(qcam->pport); - for (i=0; i<250; i++) + for (i=0; i<250; i++) { mdelay(1); stat = parport_read_status(qcam->pport); - if (ostat != stat) + if (ostat != stat) { if (++count >= 3) return 1; ostat = stat; @@ -247,7 +247,7 @@ static void qc_reset(struct qcam_device *qcam) parport_write_control(qcam->pport, 0x8); mdelay(1); parport_write_control(qcam->pport, 0xc); - mdelay(1); + mdelay(1); } /* Reset the QuickCam and program for brightness, contrast, @@ -258,7 +258,7 @@ static void qc_setup(struct qcam_device *q) qc_reset(q); /* Set the brightness. */ - qcam_set(q, 11, q->brightness); + qcam_set(q, 11, q->brightness); /* Set the height and width. These refer to the actual CCD area *before* applying the selected decimation. */ @@ -272,12 +272,12 @@ static void qc_setup(struct qcam_device *q) /* Set contrast and white balance. */ qcam_set(q, 0x19, q->contrast); qcam_set(q, 0x1f, q->whitebal); - + /* Set the speed. */ qcam_set(q, 45, 2); } -/* Read some bytes from the camera and put them in the buffer. +/* Read some bytes from the camera and put them in the buffer. nbytes should be a multiple of 3, because bidirectional mode gives us three bytes at a time. */ @@ -383,7 +383,7 @@ static long qc_capture(struct qcam_device *q, char __user *buf, unsigned long le if (qcam_set(q, 7, (q->mode | (is_bi_dir?1:0)) + 1)) return -EIO; - + lines = q->height; pixelsperline = q->width; bitsperxfer = (is_bi_dir) ? 24 : 8; @@ -499,7 +499,7 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file, { struct video_device *dev = video_devdata(file); struct qcam_device *qcam=(struct qcam_device *)dev; - + switch(cmd) { case VIDIOCGCAP: @@ -574,7 +574,7 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file, */ if (p->depth != 24 || p->palette != VIDEO_PALETTE_RGB24) return -EINVAL; - + /* * Now load the camera. */ @@ -584,7 +584,7 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file, mutex_lock(&qcam->lock); parport_claim_or_block(qcam->pdev); - qc_setup(qcam); + qc_setup(qcam); parport_release(qcam->pdev); mutex_unlock(&qcam->lock); return 0; @@ -601,11 +601,11 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file, return -EINVAL; if(vw->width<80||vw->width>320) return -EINVAL; - + qcam->width = 80; qcam->height = 60; qcam->mode = QC_DECIMATION_4; - + if(vw->width>=160 && vw->height>=120) { qcam->width = 160; @@ -627,7 +627,7 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file, qcam->mode = QC_BILLIONS | QC_DECIMATION_1; } #endif - /* Ok we figured out what to use from our + /* Ok we figured out what to use from our wide choice */ mutex_lock(&qcam->lock); parport_claim_or_block(qcam->pdev); @@ -676,7 +676,7 @@ static ssize_t qcam_read(struct file *file, char __user *buf, mutex_lock(&qcam->lock); parport_claim_or_block(qcam->pdev); /* Probably should have a semaphore against multiple users */ - len = qc_capture(qcam, buf,count); + len = qc_capture(qcam, buf,count); parport_release(qcam->pdev); mutex_unlock(&qcam->lock); return len; @@ -707,7 +707,7 @@ static struct video_device qcam_template= static struct qcam_device *qcam_init(struct parport *port) { struct qcam_device *q; - + q = kmalloc(sizeof(struct qcam_device), GFP_KERNEL); if(q==NULL) return NULL; @@ -718,14 +718,14 @@ static struct qcam_device *qcam_init(struct parport *port) q->bidirectional = (q->pport->modes & PARPORT_MODE_TRISTATE)?1:0; - if (q->pdev == NULL) + if (q->pdev == NULL) { printk(KERN_ERR "c-qcam: couldn't register for %s.\n", port->name); kfree(q); return NULL; } - + memcpy(&q->vdev, &qcam_template, sizeof(qcam_template)); mutex_init(&q->lock); @@ -766,11 +766,11 @@ static int init_cqcam(struct parport *port) qcam = qcam_init(port); if (qcam==NULL) return -ENODEV; - + parport_claim_or_block(qcam->pdev); qc_reset(qcam); - + if (probe && qc_detect(qcam)==0) { parport_release(qcam->pdev); @@ -782,7 +782,7 @@ static int init_cqcam(struct parport *port) qc_setup(qcam); parport_release(qcam->pdev); - + if (video_register_device(&qcam->vdev, VFL_TYPE_GRABBER, video_nr)==-1) { printk(KERN_ERR "Unable to register Colour QuickCam on %s\n", @@ -792,9 +792,9 @@ static int init_cqcam(struct parport *port) return -ENODEV; } - printk(KERN_INFO "video%d: Colour QuickCam found on %s\n", + printk(KERN_INFO "video%d: Colour QuickCam found on %s\n", qcam->vdev.minor, qcam->pport->name); - + qcams[num_cams++] = qcam; return 0; diff --git a/drivers/media/video/cpia.c b/drivers/media/video/cpia.c index 3cebfa91ca14..2227c5640c12 100644 --- a/drivers/media/video/cpia.c +++ b/drivers/media/video/cpia.c @@ -24,7 +24,7 @@ */ /* define _CPIA_DEBUG_ for verbose debug output (see cpia.h) */ -/* #define _CPIA_DEBUG_ 1 */ +/* #define _CPIA_DEBUG_ 1 */ #include <linux/config.h> @@ -67,11 +67,11 @@ MODULE_SUPPORTED_DEVICE("video"); static unsigned short colorspace_conv = 0; module_param(colorspace_conv, ushort, 0444); MODULE_PARM_DESC(colorspace_conv, - "\n<n> Colorspace conversion:" - "\n0 = disable" - "\n1 = enable" - "\nDefault value is 0" - "\n"); + "\n<n> Colorspace conversion:" + "\n0 = disable" + "\n1 = enable" + "\nDefault value is 0" + "\n"); #define ABOUT "V4L-Driver for Vision CPiA based cameras" @@ -189,8 +189,8 @@ enum { #define TC 94 #define EXP_ACC_DARK 50 #define EXP_ACC_LIGHT 90 -#define HIGH_COMP_102 160 -#define MAX_COMP 239 +#define HIGH_COMP_102 160 +#define MAX_COMP 239 #define DARK_TIME 3 #define LIGHT_TIME 3 @@ -208,7 +208,7 @@ static u8 flicker_jumps[2][2][4] = static void reset_camera_struct(struct cam_data *cam); static int find_over_exposure(int brightness); static void set_flicker(struct cam_params *params, volatile u32 *command_flags, - int on); + int on); /********************************************************************** @@ -262,7 +262,7 @@ static void rvfree(void *mem, unsigned long size) static struct proc_dir_entry *cpia_proc_root=NULL; static int cpia_read_proc(char *page, char **start, off_t off, - int count, int *eof, void *data) + int count, int *eof, void *data) { char *out = page; int len, tmp; @@ -276,58 +276,58 @@ static int cpia_read_proc(char *page, char **start, off_t off, out += sprintf(out, "V4L Driver version: %d.%d.%d\n", CPIA_MAJ_VER, CPIA_MIN_VER, CPIA_PATCH_VER); out += sprintf(out, "CPIA Version: %d.%02d (%d.%d)\n", - cam->params.version.firmwareVersion, - cam->params.version.firmwareRevision, - cam->params.version.vcVersion, - cam->params.version.vcRevision); + cam->params.version.firmwareVersion, + cam->params.version.firmwareRevision, + cam->params.version.vcVersion, + cam->params.version.vcRevision); out += sprintf(out, "CPIA PnP-ID: %04x:%04x:%04x\n", - cam->params.pnpID.vendor, cam->params.pnpID.product, - cam->params.pnpID.deviceRevision); + cam->params.pnpID.vendor, cam->params.pnpID.product, + cam->params.pnpID.deviceRevision); out += sprintf(out, "VP-Version: %d.%d %04x\n", - cam->params.vpVersion.vpVersion, - cam->params.vpVersion.vpRevision, - cam->params.vpVersion.cameraHeadID); - + cam->params.vpVersion.vpVersion, + cam->params.vpVersion.vpRevision, + cam->params.vpVersion.cameraHeadID); + out += sprintf(out, "system_state: %#04x\n", - cam->params.status.systemState); + cam->params.status.systemState); out += sprintf(out, "grab_state: %#04x\n", - cam->params.status.grabState); + cam->params.status.grabState); out += sprintf(out, "stream_state: %#04x\n", - cam->params.status.streamState); + cam->params.status.streamState); out += sprintf(out, "fatal_error: %#04x\n", - cam->params.status.fatalError); + cam->params.status.fatalError); out += sprintf(out, "cmd_error: %#04x\n", - cam->params.status.cmdError); + cam->params.status.cmdError); out += sprintf(out, "debug_flags: %#04x\n", - cam->params.status.debugFlags); + cam->params.status.debugFlags); out += sprintf(out, "vp_status: %#04x\n", - cam->params.status.vpStatus); + cam->params.status.vpStatus); out += sprintf(out, "error_code: %#04x\n", - cam->params.status.errorCode); + cam->params.status.errorCode); /* QX3 specific entries */ if (cam->params.qx3.qx3_detected) { out += sprintf(out, "button: %4d\n", - cam->params.qx3.button); + cam->params.qx3.button); out += sprintf(out, "cradled: %4d\n", - cam->params.qx3.cradled); + cam->params.qx3.cradled); } out += sprintf(out, "video_size: %s\n", - cam->params.format.videoSize == VIDEOSIZE_CIF ? + cam->params.format.videoSize == VIDEOSIZE_CIF ? "CIF " : "QCIF"); out += sprintf(out, "roi: (%3d, %3d) to (%3d, %3d)\n", - cam->params.roi.colStart*8, - cam->params.roi.rowStart*4, - cam->params.roi.colEnd*8, - cam->params.roi.rowEnd*4); + cam->params.roi.colStart*8, + cam->params.roi.rowStart*4, + cam->params.roi.colEnd*8, + cam->params.roi.rowEnd*4); out += sprintf(out, "actual_fps: %3d\n", cam->fps); out += sprintf(out, "transfer_rate: %4dkB/s\n", - cam->transfer_rate); - + cam->transfer_rate); + out += sprintf(out, "\nread-write\n"); out += sprintf(out, "----------------------- current min" - " max default comment\n"); + " max default comment\n"); out += sprintf(out, "brightness: %8d %8d %8d %8d\n", - cam->params.colourParams.brightness, 0, 100, 50); + cam->params.colourParams.brightness, 0, 100, 50); if (cam->params.version.firmwareVersion == 1 && cam->params.version.firmwareRevision == 2) /* 1-02 firmware limits contrast to 80 */ @@ -336,26 +336,26 @@ static int cpia_read_proc(char *page, char **start, off_t off, tmp = 96; out += sprintf(out, "contrast: %8d %8d %8d %8d" - " steps of 8\n", - cam->params.colourParams.contrast, 0, tmp, 48); + " steps of 8\n", + cam->params.colourParams.contrast, 0, tmp, 48); out += sprintf(out, "saturation: %8d %8d %8d %8d\n", - cam->params.colourParams.saturation, 0, 100, 50); + cam->params.colourParams.saturation, 0, 100, 50); tmp = (25000+5000*cam->params.sensorFps.baserate)/ (1<<cam->params.sensorFps.divisor); out += sprintf(out, "sensor_fps: %4d.%03d %8d %8d %8d\n", - tmp/1000, tmp%1000, 3, 30, 15); + tmp/1000, tmp%1000, 3, 30, 15); out += sprintf(out, "stream_start_line: %8d %8d %8d %8d\n", - 2*cam->params.streamStartLine, 0, + 2*cam->params.streamStartLine, 0, cam->params.format.videoSize == VIDEOSIZE_CIF ? 288:144, cam->params.format.videoSize == VIDEOSIZE_CIF ? 240:120); out += sprintf(out, "sub_sample: %8s %8s %8s %8s\n", - cam->params.format.subSample == SUBSAMPLE_420 ? + cam->params.format.subSample == SUBSAMPLE_420 ? "420" : "422", "420", "422", "422"); out += sprintf(out, "yuv_order: %8s %8s %8s %8s\n", - cam->params.format.yuvOrder == YUVORDER_YUYV ? + cam->params.format.yuvOrder == YUVORDER_YUYV ? "YUYV" : "UYVY", "YUYV" , "UYVY", "YUYV"); out += sprintf(out, "ecp_timing: %8s %8s %8s %8s\n", - cam->params.ecpTiming ? "slow" : "normal", "slow", + cam->params.ecpTiming ? "slow" : "normal", "slow", "normal", "normal"); if (cam->params.colourBalance.balanceMode == 2) { @@ -366,11 +366,11 @@ static int cpia_read_proc(char *page, char **start, off_t off, out += sprintf(out, "color_balance_mode: %8s %8s %8s" " %8s\n", tmpstr, "manual", "auto", "auto"); out += sprintf(out, "red_gain: %8d %8d %8d %8d\n", - cam->params.colourBalance.redGain, 0, 212, 32); + cam->params.colourBalance.redGain, 0, 212, 32); out += sprintf(out, "green_gain: %8d %8d %8d %8d\n", - cam->params.colourBalance.greenGain, 0, 212, 6); + cam->params.colourBalance.greenGain, 0, 212, 6); out += sprintf(out, "blue_gain: %8d %8d %8d %8d\n", - cam->params.colourBalance.blueGain, 0, 212, 92); + cam->params.colourBalance.blueGain, 0, 212, 92); if (cam->params.version.firmwareVersion == 1 && cam->params.version.firmwareRevision == 2) @@ -381,11 +381,11 @@ static int cpia_read_proc(char *page, char **start, off_t off, if (cam->params.exposure.gainMode == 0) out += sprintf(out, "max_gain: unknown %28s" - " powers of 2\n", tmpstr); + " powers of 2\n", tmpstr); else out += sprintf(out, "max_gain: %8d %28s" " 1,2,4 or 8 \n", - 1<<(cam->params.exposure.gainMode-1), tmpstr); + 1<<(cam->params.exposure.gainMode-1), tmpstr); switch(cam->params.exposure.expMode) { case 1: @@ -402,10 +402,10 @@ static int cpia_read_proc(char *page, char **start, off_t off, out += sprintf(out, "exposure_mode: %8s %8s %8s" " %8s\n", tmpstr, "manual", "auto", "auto"); out += sprintf(out, "centre_weight: %8s %8s %8s %8s\n", - (2-cam->params.exposure.centreWeight) ? "on" : "off", - "off", "on", "on"); + (2-cam->params.exposure.centreWeight) ? "on" : "off", + "off", "on", "on"); out += sprintf(out, "gain: %8d %8d max_gain %8d 1,2,4,8 possible\n", - 1<<cam->params.exposure.gain, 1, 1); + 1<<cam->params.exposure.gain, 1, 1); if (cam->params.version.firmwareVersion == 1 && cam->params.version.firmwareRevision == 2) /* 1-02 firmware limits fineExp/2 to 127 */ @@ -414,7 +414,7 @@ static int cpia_read_proc(char *page, char **start, off_t off, tmp = 510; out += sprintf(out, "fine_exp: %8d %8d %8d %8d\n", - cam->params.exposure.fineExp*2, 0, tmp, 0); + cam->params.exposure.fineExp*2, 0, tmp, 0); if (cam->params.version.firmwareVersion == 1 && cam->params.version.firmwareRevision == 2) /* 1-02 firmware limits coarseExpHi to 0 */ @@ -426,46 +426,46 @@ static int cpia_read_proc(char *page, char **start, off_t off, " %8d\n", cam->params.exposure.coarseExpLo+ 256*cam->params.exposure.coarseExpHi, 0, tmp, 185); out += sprintf(out, "red_comp: %8d %8d %8d %8d\n", - cam->params.exposure.redComp, COMP_RED, 255, COMP_RED); + cam->params.exposure.redComp, COMP_RED, 255, COMP_RED); out += sprintf(out, "green1_comp: %8d %8d %8d %8d\n", - cam->params.exposure.green1Comp, COMP_GREEN1, 255, + cam->params.exposure.green1Comp, COMP_GREEN1, 255, COMP_GREEN1); out += sprintf(out, "green2_comp: %8d %8d %8d %8d\n", - cam->params.exposure.green2Comp, COMP_GREEN2, 255, + cam->params.exposure.green2Comp, COMP_GREEN2, 255, COMP_GREEN2); out += sprintf(out, "blue_comp: %8d %8d %8d %8d\n", - cam->params.exposure.blueComp, COMP_BLUE, 255, COMP_BLUE); - + cam->params.exposure.blueComp, COMP_BLUE, 255, COMP_BLUE); + out += sprintf(out, "apcor_gain1: %#8x %#8x %#8x %#8x\n", - cam->params.apcor.gain1, 0, 0xff, 0x1c); + cam->params.apcor.gain1, 0, 0xff, 0x1c); out += sprintf(out, "apcor_gain2: %#8x %#8x %#8x %#8x\n", - cam->params.apcor.gain2, 0, 0xff, 0x1a); + cam->params.apcor.gain2, 0, 0xff, 0x1a); out += sprintf(out, "apcor_gain4: %#8x %#8x %#8x %#8x\n", - cam->params.apcor.gain4, 0, 0xff, 0x2d); + cam->params.apcor.gain4, 0, 0xff, 0x2d); out += sprintf(out, "apcor_gain8: %#8x %#8x %#8x %#8x\n", - cam->params.apcor.gain8, 0, 0xff, 0x2a); + cam->params.apcor.gain8, 0, 0xff, 0x2a); out += sprintf(out, "vl_offset_gain1: %8d %8d %8d %8d\n", - cam->params.vlOffset.gain1, 0, 255, 24); + cam->params.vlOffset.gain1, 0, 255, 24); out += sprintf(out, "vl_offset_gain2: %8d %8d %8d %8d\n", - cam->params.vlOffset.gain2, 0, 255, 28); + cam->params.vlOffset.gain2, 0, 255, 28); out += sprintf(out, "vl_offset_gain4: %8d %8d %8d %8d\n", - cam->params.vlOffset.gain4, 0, 255, 30); + cam->params.vlOffset.gain4, 0, 255, 30); out += sprintf(out, "vl_offset_gain8: %8d %8d %8d %8d\n", - cam->params.vlOffset.gain8, 0, 255, 30); + cam->params.vlOffset.gain8, 0, 255, 30); out += sprintf(out, "flicker_control: %8s %8s %8s %8s\n", - cam->params.flickerControl.flickerMode ? "on" : "off", + cam->params.flickerControl.flickerMode ? "on" : "off", "off", "on", "off"); out += sprintf(out, "mains_frequency: %8d %8d %8d %8d" - " only 50/60\n", - cam->mainsFreq ? 60 : 50, 50, 60, 50); + " only 50/60\n", + cam->mainsFreq ? 60 : 50, 50, 60, 50); if(cam->params.flickerControl.allowableOverExposure < 0) out += sprintf(out, "allowable_overexposure: %4dauto auto %8d auto\n", - -cam->params.flickerControl.allowableOverExposure, - 255); + -cam->params.flickerControl.allowableOverExposure, + 255); else out += sprintf(out, "allowable_overexposure: %8d auto %8d auto\n", - cam->params.flickerControl.allowableOverExposure, - 255); + cam->params.flickerControl.allowableOverExposure, + 255); out += sprintf(out, "compression_mode: "); switch(cam->params.compression.mode) { case CPIA_COMPRESSION_NONE: @@ -483,52 +483,52 @@ static int cpia_read_proc(char *page, char **start, off_t off, } out += sprintf(out, " none,auto,manual auto\n"); out += sprintf(out, "decimation_enable: %8s %8s %8s %8s\n", - cam->params.compression.decimation == - DECIMATION_ENAB ? "on":"off", "off", "on", + cam->params.compression.decimation == + DECIMATION_ENAB ? "on":"off", "off", "on", "off"); out += sprintf(out, "compression_target: %9s %9s %9s %9s\n", - cam->params.compressionTarget.frTargeting == + cam->params.compressionTarget.frTargeting == CPIA_COMPRESSION_TARGET_FRAMERATE ? "framerate":"quality", "framerate", "quality", "quality"); out += sprintf(out, "target_framerate: %8d %8d %8d %8d\n", - cam->params.compressionTarget.targetFR, 1, 30, 15); + cam->params.compressionTarget.targetFR, 1, 30, 15); out += sprintf(out, "target_quality: %8d %8d %8d %8d\n", - cam->params.compressionTarget.targetQ, 1, 64, 5); + cam->params.compressionTarget.targetQ, 1, 64, 5); out += sprintf(out, "y_threshold: %8d %8d %8d %8d\n", - cam->params.yuvThreshold.yThreshold, 0, 31, 6); + cam->params.yuvThreshold.yThreshold, 0, 31, 6); out += sprintf(out, "uv_threshold: %8d %8d %8d %8d\n", - cam->params.yuvThreshold.uvThreshold, 0, 31, 6); + cam->params.yuvThreshold.uvThreshold, 0, 31, 6); out += sprintf(out, "hysteresis: %8d %8d %8d %8d\n", - cam->params.compressionParams.hysteresis, 0, 255, 3); + cam->params.compressionParams.hysteresis, 0, 255, 3); out += sprintf(out, "threshold_max: %8d %8d %8d %8d\n", - cam->params.compressionParams.threshMax, 0, 255, 11); + cam->params.compressionParams.threshMax, 0, 255, 11); out += sprintf(out, "small_step: %8d %8d %8d %8d\n", - cam->params.compressionParams.smallStep, 0, 255, 1); + cam->params.compressionParams.smallStep, 0, 255, 1); out += sprintf(out, "large_step: %8d %8d %8d %8d\n", - cam->params.compressionParams.largeStep, 0, 255, 3); + cam->params.compressionParams.largeStep, 0, 255, 3); out += sprintf(out, "decimation_hysteresis: %8d %8d %8d %8d\n", - cam->params.compressionParams.decimationHysteresis, + cam->params.compressionParams.decimationHysteresis, 0, 255, 2); out += sprintf(out, "fr_diff_step_thresh: %8d %8d %8d %8d\n", - cam->params.compressionParams.frDiffStepThresh, + cam->params.compressionParams.frDiffStepThresh, 0, 255, 5); out += sprintf(out, "q_diff_step_thresh: %8d %8d %8d %8d\n", - cam->params.compressionParams.qDiffStepThresh, + cam->params.compressionParams.qDiffStepThresh, 0, 255, 3); out += sprintf(out, "decimation_thresh_mod: %8d %8d %8d %8d\n", - cam->params.compressionParams.decimationThreshMod, + cam->params.compressionParams.decimationThreshMod, 0, 255, 2); /* QX3 specific entries */ if (cam->params.qx3.qx3_detected) { - out += sprintf(out, "toplight: %8s %8s %8s %8s\n", - cam->params.qx3.toplight ? "on" : "off", + out += sprintf(out, "toplight: %8s %8s %8s %8s\n", + cam->params.qx3.toplight ? "on" : "off", "off", "on", "off"); - out += sprintf(out, "bottomlight: %8s %8s %8s %8s\n", - cam->params.qx3.bottomlight ? "on" : "off", + out += sprintf(out, "bottomlight: %8s %8s %8s %8s\n", + cam->params.qx3.bottomlight ? "on" : "off", "off", "on", "off"); } - + len = out - page; len -= off; if (len < count) { @@ -543,7 +543,7 @@ static int cpia_read_proc(char *page, char **start, off_t off, static int match(char *checkstr, char **buffer, unsigned long *count, - int *find_colon, int *err) + int *find_colon, int *err) { int ret, colon_found = 1; int len = strlen(checkstr); @@ -583,7 +583,7 @@ static unsigned long int value(char **buffer, unsigned long *count, int *err) } static int cpia_write_proc(struct file *file, const char __user *buf, - unsigned long count, void *data) + unsigned long count, void *data) { struct cam_data *cam = data; struct cam_params new_params; @@ -619,12 +619,12 @@ static int cpia_write_proc(struct file *file, const char __user *buf, retval = -EINVAL; goto out; } - + buffer = page; - + if (mutex_lock_interruptible(&cam->param_lock)) return -ERESTARTSYS; - + /* * Skip over leading whitespace */ @@ -632,15 +632,15 @@ static int cpia_write_proc(struct file *file, const char __user *buf, --count; ++buffer; } - + memcpy(&new_params, &cam->params, sizeof(struct cam_params)); new_mains = cam->mainsFreq; - + #define MATCH(x) (match(x, &buffer, &count, &find_colon, &retval)) #define VALUE (value(&buffer,&count, &retval)) #define FIRMWARE_VERSION(x,y) (new_params.version.firmwareVersion == (x) && \ - new_params.version.firmwareRevision == (y)) - + new_params.version.firmwareRevision == (y)) + retval = 0; while (count && !retval) { find_colon = 1; @@ -656,7 +656,7 @@ static int cpia_write_proc(struct file *file, const char __user *buf, } command_flags |= COMMAND_SETCOLOURPARAMS; if(new_params.flickerControl.allowableOverExposure < 0) - new_params.flickerControl.allowableOverExposure = + new_params.flickerControl.allowableOverExposure = -find_over_exposure(new_params.colourParams.brightness); if(new_params.flickerControl.flickerMode != 0) command_flags |= COMMAND_SETFLICKERCTRL; @@ -721,7 +721,7 @@ static int cpia_write_proc(struct file *file, const char __user *buf, /* Either base rate would work here */ new_params.sensorFps.baserate = 1; } - new_params.flickerControl.coarseJump = + new_params.flickerControl.coarseJump = flicker_jumps[new_mains] [new_params.sensorFps.baserate] [new_params.sensorFps.divisor]; @@ -1085,7 +1085,7 @@ static int cpia_write_proc(struct file *file, const char __user *buf, } else if (MATCH("mains_frequency")) { if (!retval && MATCH("50")) { new_mains = 0; - new_params.flickerControl.coarseJump = + new_params.flickerControl.coarseJump = flicker_jumps[new_mains] [new_params.sensorFps.baserate] [new_params.sensorFps.divisor]; @@ -1093,7 +1093,7 @@ static int cpia_write_proc(struct file *file, const char __user *buf, command_flags |= COMMAND_SETFLICKERCTRL; } else if (!retval && MATCH("60")) { new_mains = 1; - new_params.flickerControl.coarseJump = + new_params.flickerControl.coarseJump = flicker_jumps[new_mains] [new_params.sensorFps.baserate] [new_params.sensorFps.divisor]; @@ -1103,7 +1103,7 @@ static int cpia_write_proc(struct file *file, const char __user *buf, retval = -EINVAL; } else if (MATCH("allowable_overexposure")) { if (!retval && MATCH("auto")) { - new_params.flickerControl.allowableOverExposure = + new_params.flickerControl.allowableOverExposure = -find_over_exposure(new_params.colourParams.brightness); if(new_params.flickerControl.flickerMode != 0) command_flags |= COMMAND_SETFLICKERCTRL; @@ -1146,10 +1146,10 @@ static int cpia_write_proc(struct file *file, const char __user *buf, command_flags |= COMMAND_SETCOMPRESSION; } else if (MATCH("compression_target")) { if (!retval && MATCH("quality")) - new_params.compressionTarget.frTargeting = + new_params.compressionTarget.frTargeting = CPIA_COMPRESSION_TARGET_QUALITY; else if (!retval && MATCH("framerate")) - new_params.compressionTarget.frTargeting = + new_params.compressionTarget.frTargeting = CPIA_COMPRESSION_TARGET_FRAMERATE; else retval = -EINVAL; @@ -1173,7 +1173,7 @@ static int cpia_write_proc(struct file *file, const char __user *buf, if (!retval) { if(val > 0 && val <= 64) new_params.compressionTarget.targetQ = val; - else + else retval = -EINVAL; } command_flags |= COMMAND_SETCOMPRESSIONTARGET; @@ -1288,19 +1288,19 @@ static int cpia_write_proc(struct file *file, const char __user *buf, } command_flags |= COMMAND_SETCOMPRESSIONPARAMS; } else if (MATCH("toplight")) { - if (!retval && MATCH("on")) + if (!retval && MATCH("on")) new_params.qx3.toplight = 1; else if (!retval && MATCH("off")) new_params.qx3.toplight = 0; - else + else retval = -EINVAL; command_flags |= COMMAND_SETLIGHTS; } else if (MATCH("bottomlight")) { - if (!retval && MATCH("on")) + if (!retval && MATCH("on")) new_params.qx3.bottomlight = 1; - else if (!retval && MATCH("off")) + else if (!retval && MATCH("off")) new_params.qx3.bottomlight = 0; - else + else retval = -EINVAL; command_flags |= COMMAND_SETLIGHTS; } else { @@ -1326,7 +1326,7 @@ static int cpia_write_proc(struct file *file, const char __user *buf, } } } -#undef MATCH +#undef MATCH #undef VALUE #undef FIRMWARE_VERSION if (!retval) { @@ -1349,24 +1349,24 @@ static int cpia_write_proc(struct file *file, const char __user *buf, retval = size; } else DBG("error: %d\n", retval); - + mutex_unlock(&cam->param_lock); - + out: free_page((unsigned long)page); - return retval; + return retval; } static void create_proc_cpia_cam(struct cam_data *cam) { char name[7]; struct proc_dir_entry *ent; - + if (!cpia_proc_root || !cam) return; sprintf(name, "video%d", cam->vdev.minor); - + ent = create_proc_entry(name, S_IFREG|S_IRUGO|S_IWUSR, cpia_proc_root); if (!ent) return; @@ -1374,9 +1374,9 @@ static void create_proc_cpia_cam(struct cam_data *cam) ent->data = cam; ent->read_proc = cpia_read_proc; ent->write_proc = cpia_write_proc; - /* + /* size of the proc entry is 3736 bytes for the standard webcam; - the extra features of the QX3 microscope add 189 bytes. + the extra features of the QX3 microscope add 189 bytes. (we have not yet probed the camera to see which type it is). */ ent->size = 3736 + 189; @@ -1386,10 +1386,10 @@ static void create_proc_cpia_cam(struct cam_data *cam) static void destroy_proc_cpia_cam(struct cam_data *cam) { char name[7]; - + if (!cam || !cam->proc_entry) return; - + sprintf(name, "video%d", cam->vdev.minor); remove_proc_entry(name, cpia_proc_root); cam->proc_entry = NULL; @@ -1596,13 +1596,13 @@ static void set_vw_size(struct cam_data *cam) cam->vc.width = cam->vw.width; if(cam->vc.height == 0) cam->vc.height = cam->vw.height; - + cam->params.roi.colStart += cam->vc.x >> 3; cam->params.roi.colEnd = cam->params.roi.colStart + - (cam->vc.width >> 3); + (cam->vc.width >> 3); cam->params.roi.rowStart += cam->vc.y >> 2; cam->params.roi.rowEnd = cam->params.roi.rowStart + - (cam->vc.height >> 2); + (cam->vc.height >> 2); return; } @@ -1624,7 +1624,7 @@ static int allocate_frame_buf(struct cam_data *cam) static int free_frame_buf(struct cam_data *cam) { int i; - + rvfree(cam->frame_buf, FRAME_NUM*CPIA_MAX_FRAME_SIZE); cam->frame_buf = NULL; for (i=0; i < FRAME_NUM; i++) @@ -1667,7 +1667,7 @@ static int do_command(struct cam_data *cam, u16 command, u8 a, u8 b, u8 c, u8 d) mutex_lock(&cam->param_lock); datasize=8; break; - case CPIA_COMMAND_ReadMCPorts: + case CPIA_COMMAND_ReadMCPorts: case CPIA_COMMAND_ReadVCRegs: datasize = 4; break; @@ -1746,10 +1746,10 @@ static int do_command(struct cam_data *cam, u16 command, u8 a, u8 b, u8 c, u8 d) mutex_unlock(&cam->param_lock); break; - case CPIA_COMMAND_ReadMCPorts: - if (!cam->params.qx3.qx3_detected) + case CPIA_COMMAND_ReadMCPorts: + if (!cam->params.qx3.qx3_detected) break; - /* test button press */ + /* test button press */ cam->params.qx3.button = ((data[1] & 0x02) == 0); if (cam->params.qx3.button) { /* button pressed - unlock the latch */ @@ -1770,9 +1770,9 @@ static int do_command(struct cam_data *cam, u16 command, u8 a, u8 b, u8 c, u8 d) /* send a command to the camera with an additional data transaction */ static int do_command_extended(struct cam_data *cam, u16 command, - u8 a, u8 b, u8 c, u8 d, - u8 e, u8 f, u8 g, u8 h, - u8 i, u8 j, u8 k, u8 l) + u8 a, u8 b, u8 c, u8 d, + u8 e, u8 f, u8 g, u8 h, + u8 i, u8 j, u8 k, u8 l) { int retval; u8 cmd[8], data[8]; @@ -1809,10 +1809,10 @@ static int do_command_extended(struct cam_data *cam, u16 command, #define LIMIT(x) ((((x)>0xffffff)?0xff0000:(((x)<=0xffff)?0:(x)&0xff0000))>>16) static int convert420(unsigned char *yuv, unsigned char *rgb, int out_fmt, - int linesize, int mmap_kludge) + int linesize, int mmap_kludge) { int y, u, v, r, g, b, y1; - + /* Odd lines use the same u and v as the previous line. * Because of compression, it is necessary to get this * information from the decoded image. */ @@ -1925,7 +1925,7 @@ static int convert420(unsigned char *yuv, unsigned char *rgb, int out_fmt, static int yuvconvert(unsigned char *yuv, unsigned char *rgb, int out_fmt, - int in_uyvy, int mmap_kludge) + int in_uyvy, int mmap_kludge) { int y, u, v, r, g, b, y1; @@ -2078,21 +2078,21 @@ static int parse_picture(struct cam_data *cam, int size) mutex_unlock(&cam->param_lock); return -1; } - + if (ibuf[17] != SUBSAMPLE_420 && ibuf[17] != SUBSAMPLE_422) { LOG("illegal subtype %d\n",ibuf[17]); mutex_unlock(&cam->param_lock); return -1; } subsample_422 = ibuf[17] == SUBSAMPLE_422; - + if (ibuf[18] != YUVORDER_YUYV && ibuf[18] != YUVORDER_UYVY) { LOG("illegal yuvorder %d\n",ibuf[18]); mutex_unlock(&cam->param_lock); return -1; } in_uyvy = ibuf[18] == YUVORDER_UYVY; - + if ((ibuf[24] != cam->params.roi.colStart) || (ibuf[25] != cam->params.roi.colEnd) || (ibuf[26] != cam->params.roi.rowStart) || @@ -2104,20 +2104,20 @@ static int parse_picture(struct cam_data *cam, int size) cols = 8*(ibuf[25] - ibuf[24]); rows = 4*(ibuf[27] - ibuf[26]); - + if ((ibuf[28] != NOT_COMPRESSED) && (ibuf[28] != COMPRESSED)) { LOG("illegal compression %d\n",ibuf[28]); mutex_unlock(&cam->param_lock); return -1; } compressed = (ibuf[28] == COMPRESSED); - + if (ibuf[29] != NO_DECIMATION && ibuf[29] != DECIMATION_ENAB) { LOG("illegal decimation %d\n",ibuf[29]); mutex_unlock(&cam->param_lock); return -1; } - decimation = (ibuf[29] == DECIMATION_ENAB); + decimation = (ibuf[29] == DECIMATION_ENAB); cam->params.yuvThreshold.yThreshold = ibuf[30]; cam->params.yuvThreshold.uvThreshold = ibuf[31]; @@ -2131,7 +2131,7 @@ static int parse_picture(struct cam_data *cam, int size) cam->params.status.errorCode = ibuf[39]; cam->fps = ibuf[41]; mutex_unlock(&cam->param_lock); - + linesize = skipcount(cols, out_fmt); ibuf += FRAME_HEADER_SIZE; size -= FRAME_HEADER_SIZE; @@ -2150,14 +2150,14 @@ static int parse_picture(struct cam_data *cam, int size) if (!compressed || (compressed && !(*ibuf & 1))) { if(subsample_422 || even_line) { obuf += yuvconvert(ibuf, obuf, out_fmt, - in_uyvy, cam->mmap_kludge); + in_uyvy, cam->mmap_kludge); ibuf += 4; ll -= 4; } else { /* SUBSAMPLE_420 on an odd line */ obuf += convert420(ibuf, obuf, - out_fmt, linesize, - cam->mmap_kludge); + out_fmt, linesize, + cam->mmap_kludge); ibuf += 2; ll -= 2; } @@ -2183,7 +2183,7 @@ static int parse_picture(struct cam_data *cam, int size) if ((size > 3) && (ibuf[0] == EOI) && (ibuf[1] == EOI) && (ibuf[2] == EOI) && (ibuf[3] == EOI)) { - size -= 4; + size -= 4; break; } @@ -2204,7 +2204,7 @@ static int parse_picture(struct cam_data *cam, int size) return -1; } } - + if(decimation) { /* interpolate odd rows */ int i, j; @@ -2233,7 +2233,7 @@ static int parse_picture(struct cam_data *cam, int size) static inline int init_stream_cap(struct cam_data *cam) { return do_command(cam, CPIA_COMMAND_InitStreamCap, - 0, cam->params.streamStartLine, 0, 0); + 0, cam->params.streamStartLine, 0, 0); } @@ -2254,7 +2254,7 @@ static int find_over_exposure(int brightness) int MaxAllowableOverExposure, OverExposure; MaxAllowableOverExposure = FLICKER_MAX_EXPOSURE - brightness - - FLICKER_BRIGHTNESS_CONSTANT; + FLICKER_BRIGHTNESS_CONSTANT; if (MaxAllowableOverExposure < FLICKER_ALLOWABLE_OVER_EXPOSURE) { OverExposure = MaxAllowableOverExposure; @@ -2280,62 +2280,62 @@ static void dispatch_commands(struct cam_data *cam) DEB_BYTE(cam->cmd_queue>>8); if (cam->cmd_queue & COMMAND_SETFORMAT) { do_command(cam, CPIA_COMMAND_SetFormat, - cam->params.format.videoSize, - cam->params.format.subSample, - cam->params.format.yuvOrder, 0); + cam->params.format.videoSize, + cam->params.format.subSample, + cam->params.format.yuvOrder, 0); do_command(cam, CPIA_COMMAND_SetROI, - cam->params.roi.colStart, cam->params.roi.colEnd, - cam->params.roi.rowStart, cam->params.roi.rowEnd); + cam->params.roi.colStart, cam->params.roi.colEnd, + cam->params.roi.rowStart, cam->params.roi.rowEnd); cam->first_frame = 1; } if (cam->cmd_queue & COMMAND_SETCOLOURPARAMS) do_command(cam, CPIA_COMMAND_SetColourParams, - cam->params.colourParams.brightness, - cam->params.colourParams.contrast, - cam->params.colourParams.saturation, 0); + cam->params.colourParams.brightness, + cam->params.colourParams.contrast, + cam->params.colourParams.saturation, 0); if (cam->cmd_queue & COMMAND_SETAPCOR) do_command(cam, CPIA_COMMAND_SetApcor, - cam->params.apcor.gain1, - cam->params.apcor.gain2, - cam->params.apcor.gain4, - cam->params.apcor.gain8); + cam->params.apcor.gain1, + cam->params.apcor.gain2, + cam->params.apcor.gain4, + cam->params.apcor.gain8); if (cam->cmd_queue & COMMAND_SETVLOFFSET) do_command(cam, CPIA_COMMAND_SetVLOffset, - cam->params.vlOffset.gain1, - cam->params.vlOffset.gain2, - cam->params.vlOffset.gain4, - cam->params.vlOffset.gain8); + cam->params.vlOffset.gain1, + cam->params.vlOffset.gain2, + cam->params.vlOffset.gain4, + cam->params.vlOffset.gain8); if (cam->cmd_queue & COMMAND_SETEXPOSURE) { do_command_extended(cam, CPIA_COMMAND_SetExposure, - cam->params.exposure.gainMode, - 1, - cam->params.exposure.compMode, - cam->params.exposure.centreWeight, - cam->params.exposure.gain, - cam->params.exposure.fineExp, - cam->params.exposure.coarseExpLo, - cam->params.exposure.coarseExpHi, - cam->params.exposure.redComp, - cam->params.exposure.green1Comp, - cam->params.exposure.green2Comp, - cam->params.exposure.blueComp); + cam->params.exposure.gainMode, + 1, + cam->params.exposure.compMode, + cam->params.exposure.centreWeight, + cam->params.exposure.gain, + cam->params.exposure.fineExp, + cam->params.exposure.coarseExpLo, + cam->params.exposure.coarseExpHi, + cam->params.exposure.redComp, + cam->params.exposure.green1Comp, + cam->params.exposure.green2Comp, + cam->params.exposure.blueComp); if(cam->params.exposure.expMode != 1) { do_command_extended(cam, CPIA_COMMAND_SetExposure, - 0, - cam->params.exposure.expMode, - 0, 0, - cam->params.exposure.gain, - cam->params.exposure.fineExp, - cam->params.exposure.coarseExpLo, - cam->params.exposure.coarseExpHi, - 0, 0, 0, 0); + 0, + cam->params.exposure.expMode, + 0, 0, + cam->params.exposure.gain, + cam->params.exposure.fineExp, + cam->params.exposure.coarseExpLo, + cam->params.exposure.coarseExpHi, + 0, 0, 0, 0); } } - + if (cam->cmd_queue & COMMAND_SETCOLOURBALANCE) { if (cam->params.colourBalance.balanceMode == 1) { do_command(cam, CPIA_COMMAND_SetColourBalance, @@ -2358,47 +2358,47 @@ static void dispatch_commands(struct cam_data *cam) if (cam->cmd_queue & COMMAND_SETCOMPRESSIONTARGET) do_command(cam, CPIA_COMMAND_SetCompressionTarget, - cam->params.compressionTarget.frTargeting, - cam->params.compressionTarget.targetFR, - cam->params.compressionTarget.targetQ, 0); + cam->params.compressionTarget.frTargeting, + cam->params.compressionTarget.targetFR, + cam->params.compressionTarget.targetQ, 0); if (cam->cmd_queue & COMMAND_SETYUVTHRESH) do_command(cam, CPIA_COMMAND_SetYUVThresh, - cam->params.yuvThreshold.yThreshold, - cam->params.yuvThreshold.uvThreshold, 0, 0); + cam->params.yuvThreshold.yThreshold, + cam->params.yuvThreshold.uvThreshold, 0, 0); if (cam->cmd_queue & COMMAND_SETCOMPRESSIONPARAMS) do_command_extended(cam, CPIA_COMMAND_SetCompressionParams, - 0, 0, 0, 0, - cam->params.compressionParams.hysteresis, - cam->params.compressionParams.threshMax, - cam->params.compressionParams.smallStep, - cam->params.compressionParams.largeStep, - cam->params.compressionParams.decimationHysteresis, - cam->params.compressionParams.frDiffStepThresh, - cam->params.compressionParams.qDiffStepThresh, - cam->params.compressionParams.decimationThreshMod); + 0, 0, 0, 0, + cam->params.compressionParams.hysteresis, + cam->params.compressionParams.threshMax, + cam->params.compressionParams.smallStep, + cam->params.compressionParams.largeStep, + cam->params.compressionParams.decimationHysteresis, + cam->params.compressionParams.frDiffStepThresh, + cam->params.compressionParams.qDiffStepThresh, + cam->params.compressionParams.decimationThreshMod); if (cam->cmd_queue & COMMAND_SETCOMPRESSION) do_command(cam, CPIA_COMMAND_SetCompression, - cam->params.compression.mode, + cam->params.compression.mode, cam->params.compression.decimation, 0, 0); if (cam->cmd_queue & COMMAND_SETSENSORFPS) do_command(cam, CPIA_COMMAND_SetSensorFPS, - cam->params.sensorFps.divisor, - cam->params.sensorFps.baserate, 0, 0); + cam->params.sensorFps.divisor, + cam->params.sensorFps.baserate, 0, 0); if (cam->cmd_queue & COMMAND_SETFLICKERCTRL) do_command(cam, CPIA_COMMAND_SetFlickerCtrl, - cam->params.flickerControl.flickerMode, - cam->params.flickerControl.coarseJump, - abs(cam->params.flickerControl.allowableOverExposure), - 0); + cam->params.flickerControl.flickerMode, + cam->params.flickerControl.coarseJump, + abs(cam->params.flickerControl.allowableOverExposure), + 0); if (cam->cmd_queue & COMMAND_SETECPTIMING) do_command(cam, CPIA_COMMAND_SetECPTiming, - cam->params.ecpTiming, 0, 0, 0); + cam->params.ecpTiming, 0, 0, 0); if (cam->cmd_queue & COMMAND_PAUSE) do_command(cam, CPIA_COMMAND_EndStreamCap, 0, 0, 0, 0); @@ -2409,9 +2409,9 @@ static void dispatch_commands(struct cam_data *cam) if (cam->cmd_queue & COMMAND_SETLIGHTS && cam->params.qx3.qx3_detected) { int p1 = (cam->params.qx3.bottomlight == 0) << 1; - int p2 = (cam->params.qx3.toplight == 0) << 3; - do_command(cam, CPIA_COMMAND_WriteVCReg, 0x90, 0x8F, 0x50, 0); - do_command(cam, CPIA_COMMAND_WriteMCPort, 2, 0, (p1|p2|0xE0), 0); + int p2 = (cam->params.qx3.toplight == 0) << 3; + do_command(cam, CPIA_COMMAND_WriteVCReg, 0x90, 0x8F, 0x50, 0); + do_command(cam, CPIA_COMMAND_WriteMCPort, 2, 0, (p1|p2|0xE0), 0); } cam->cmd_queue = COMMAND_NONE; @@ -2422,11 +2422,11 @@ static void dispatch_commands(struct cam_data *cam) static void set_flicker(struct cam_params *params, volatile u32 *command_flags, - int on) + int on) { /* Everything in here is from the Windows driver */ #define FIRMWARE_VERSION(x,y) (params->version.firmwareVersion == (x) && \ - params->version.firmwareRevision == (y)) + params->version.firmwareRevision == (y)) /* define for compgain calculation */ #if 0 #define COMPGAIN(base, curexp, newexp) \ @@ -2441,7 +2441,7 @@ static void set_flicker(struct cam_params *params, volatile u32 *command_flags, (u16)(((u32)(curexp * (u8)(curcomp + 128)) / (u8)(basecomp - 128))) #endif - + int currentexp = params->exposure.coarseExpLo + params->exposure.coarseExpHi*256; int startexp; @@ -2482,7 +2482,7 @@ static void set_flicker(struct cam_params *params, volatile u32 *command_flags, } if(FIRMWARE_VERSION(1,2)) params->exposure.compMode = 0; - else + else params->exposure.compMode = 1; params->apcor.gain1 = 0x18; @@ -2533,14 +2533,14 @@ static void set_flicker(struct cam_params *params, volatile u32 *command_flags, } #define FIRMWARE_VERSION(x,y) (cam->params.version.firmwareVersion == (x) && \ - cam->params.version.firmwareRevision == (y)) + cam->params.version.firmwareRevision == (y)) /* monitor the exposure and adjust the sensor frame rate if needed */ static void monitor_exposure(struct cam_data *cam) { u8 exp_acc, bcomp, gain, coarseL, cmd[8], data[8]; int retval, light_exp, dark_exp, very_dark_exp; int old_exposure, new_exposure, framerate; - + /* get necessary stats and register settings from camera */ /* do_command can't handle this, so do it ourselves */ cmd[0] = CPIA_COMMAND_ReadVPRegs>>8; @@ -2564,17 +2564,17 @@ static void monitor_exposure(struct cam_data *cam) mutex_lock(&cam->param_lock); light_exp = cam->params.colourParams.brightness + - TC - 50 + EXP_ACC_LIGHT; + TC - 50 + EXP_ACC_LIGHT; if(light_exp > 255) light_exp = 255; dark_exp = cam->params.colourParams.brightness + - TC - 50 - EXP_ACC_DARK; + TC - 50 - EXP_ACC_DARK; if(dark_exp < 0) dark_exp = 0; very_dark_exp = dark_exp/2; - + old_exposure = cam->params.exposure.coarseExpHi * 256 + - cam->params.exposure.coarseExpLo; + cam->params.exposure.coarseExpLo; if(!cam->params.flickerControl.disabled) { /* Flicker control on */ @@ -2667,11 +2667,11 @@ static void monitor_exposure(struct cam_data *cam) cam->exposure_status = EXPOSURE_NORMAL; } } - + framerate = cam->fps; if(framerate > 30 || framerate < 1) framerate = 1; - + if(!cam->params.flickerControl.disabled) { /* Flicker control on */ if((cam->exposure_status == EXPOSURE_VERY_DARK || @@ -2683,10 +2683,10 @@ static void monitor_exposure(struct cam_data *cam) ++cam->params.sensorFps.divisor; cam->cmd_queue |= COMMAND_SETSENSORFPS; - cam->params.flickerControl.coarseJump = + cam->params.flickerControl.coarseJump = flicker_jumps[cam->mainsFreq] - [cam->params.sensorFps.baserate] - [cam->params.sensorFps.divisor]; + [cam->params.sensorFps.baserate] + [cam->params.sensorFps.divisor]; cam->cmd_queue |= COMMAND_SETFLICKERCTRL; new_exposure = cam->params.flickerControl.coarseJump-1; @@ -2704,15 +2704,15 @@ static void monitor_exposure(struct cam_data *cam) cam->params.sensorFps.divisor > 0) { /* light for too long */ - int max_exp = FIRMWARE_VERSION(1,2) ? MAX_EXP_102 : MAX_EXP ; + int max_exp = FIRMWARE_VERSION(1,2) ? MAX_EXP_102 : MAX_EXP ; --cam->params.sensorFps.divisor; cam->cmd_queue |= COMMAND_SETSENSORFPS; - cam->params.flickerControl.coarseJump = + cam->params.flickerControl.coarseJump = flicker_jumps[cam->mainsFreq] - [cam->params.sensorFps.baserate] - [cam->params.sensorFps.divisor]; + [cam->params.sensorFps.baserate] + [cam->params.sensorFps.divisor]; cam->cmd_queue |= COMMAND_SETFLICKERCTRL; new_exposure = cam->params.flickerControl.coarseJump-1; @@ -2772,7 +2772,7 @@ static void monitor_exposure(struct cam_data *cam) It also adjust the colour balance when an exposure step is detected - as long as flicker is running -*/ +*/ static void restart_flicker(struct cam_data *cam) { int cam_exposure, old_exp; @@ -2786,22 +2786,22 @@ static void restart_flicker(struct cam_data *cam) } cam_exposure = cam->raw_image[39]*2; old_exp = cam->params.exposure.coarseExpLo + - cam->params.exposure.coarseExpHi*256; - /* - see how far away camera exposure is from a valid - flicker exposure value - */ - cam_exposure %= cam->params.flickerControl.coarseJump; + cam->params.exposure.coarseExpHi*256; + /* + see how far away camera exposure is from a valid + flicker exposure value + */ + cam_exposure %= cam->params.flickerControl.coarseJump; if(!cam->params.flickerControl.disabled && - cam_exposure <= cam->params.flickerControl.coarseJump - 3) { + cam_exposure <= cam->params.flickerControl.coarseJump - 3) { /* Flicker control auto-disabled */ cam->params.flickerControl.disabled = 1; } - + if(cam->params.flickerControl.disabled && cam->params.flickerControl.flickerMode && old_exp > cam->params.flickerControl.coarseJump + - ROUND_UP_EXP_FOR_FLICKER) { + ROUND_UP_EXP_FOR_FLICKER) { /* exposure is now high enough to switch flicker control back on */ set_flicker(&cam->params, &cam->cmd_queue, 1); @@ -2818,7 +2818,7 @@ static int clear_stall(struct cam_data *cam) { /* FIXME: Does this actually work? */ LOG("Clearing stall\n"); - + cam->ops->streamRead(cam->lowlevel_data, cam->raw_image, 0); do_command(cam, CPIA_COMMAND_GetCameraStatus,0,0,0,0); return cam->params.status.streamState != STREAM_PAUSED; @@ -2878,7 +2878,7 @@ static int fetch_frame(void *data) return -EINTR; do_command(cam, CPIA_COMMAND_GetCameraStatus, - 0, 0, 0, 0); + 0, 0, 0, 0); } if(cam->params.status.streamState != STREAM_READY) { continue; @@ -2903,18 +2903,18 @@ static int fetch_frame(void *data) /* Switch flicker control back on if it got turned off */ restart_flicker(cam); - + /* If AEC is enabled, monitor the exposure and adjust the sensor frame rate if needed */ if(cam->params.exposure.expMode == 2) monitor_exposure(cam); - + /* camera idle now so dispatch queued commands */ dispatch_commands(cam); /* Update our knowledge of the camera state */ - do_command(cam, CPIA_COMMAND_GetColourBalance, 0, 0, 0, 0); - do_command(cam, CPIA_COMMAND_GetExposure, 0, 0, 0, 0); + do_command(cam, CPIA_COMMAND_GetColourBalance, 0, 0, 0, 0); + do_command(cam, CPIA_COMMAND_GetExposure, 0, 0, 0, 0); do_command(cam, CPIA_COMMAND_ReadMCPorts, 0, 0, 0, 0); /* decompress and convert image to by copying it from @@ -2933,7 +2933,7 @@ static int fetch_frame(void *data) uncompressed. */ cam->first_frame = 1; do_command(cam, CPIA_COMMAND_SetGrabMode, - CPIA_GRAB_SINGLE, 0, 0, 0); + CPIA_GRAB_SINGLE, 0, 0, 0); /* FIXME: Trial & error - need up to 70ms for the grab mode change to complete ? */ msleep_interruptible(70); @@ -2957,12 +2957,12 @@ static int fetch_frame(void *data) if (cam->first_frame) { cam->first_frame = 0; do_command(cam, CPIA_COMMAND_SetCompression, - cam->params.compression.mode, + cam->params.compression.mode, cam->params.compression.decimation, 0, 0); /* Switch from single-grab to continuous grab */ do_command(cam, CPIA_COMMAND_SetGrabMode, - CPIA_GRAB_CONTINUOUS, 0, 0, 0); + CPIA_GRAB_CONTINUOUS, 0, 0, 0); } return 0; } @@ -2977,12 +2977,12 @@ static int capture_frame(struct cam_data *cam, struct video_mmap *vm) if ((err = allocate_frame_buf(cam))) return err; } - + cam->curframe = vm->frame; cam->frame[cam->curframe].state = FRAME_READY; return fetch_frame(cam); } - + static int goto_high_power(struct cam_data *cam) { if (do_command(cam, CPIA_COMMAND_GotoHiPower, 0, 0, 0, 0)) @@ -3039,22 +3039,22 @@ static void save_camera_state(struct cam_data *cam) static int set_camera_state(struct cam_data *cam) { cam->cmd_queue = COMMAND_SETCOMPRESSION | - COMMAND_SETCOMPRESSIONTARGET | - COMMAND_SETCOLOURPARAMS | - COMMAND_SETFORMAT | - COMMAND_SETYUVTHRESH | - COMMAND_SETECPTIMING | - COMMAND_SETCOMPRESSIONPARAMS | - COMMAND_SETEXPOSURE | - COMMAND_SETCOLOURBALANCE | - COMMAND_SETSENSORFPS | - COMMAND_SETAPCOR | - COMMAND_SETFLICKERCTRL | - COMMAND_SETVLOFFSET; + COMMAND_SETCOMPRESSIONTARGET | + COMMAND_SETCOLOURPARAMS | + COMMAND_SETFORMAT | + COMMAND_SETYUVTHRESH | + COMMAND_SETECPTIMING | + COMMAND_SETCOMPRESSIONPARAMS | + COMMAND_SETEXPOSURE | + COMMAND_SETCOLOURBALANCE | + COMMAND_SETSENSORFPS | + COMMAND_SETAPCOR | + COMMAND_SETFLICKERCTRL | + COMMAND_SETVLOFFSET; do_command(cam, CPIA_COMMAND_SetGrabMode, CPIA_GRAB_SINGLE,0,0,0); dispatch_commands(cam); - + /* Wait 6 frames for the sensor to get all settings and AEC/ACB to settle */ msleep_interruptible(6*(cam->params.sensorFps.baserate ? 33 : 40) * @@ -3062,7 +3062,7 @@ static int set_camera_state(struct cam_data *cam) if(signal_pending(current)) return -EINTR; - + save_camera_state(cam); return 0; @@ -3094,9 +3094,9 @@ static int reset_camera(struct cam_data *cam) if (goto_low_power(cam)) return -ENODEV; } - + /* procedure described in developer's guide p3-28 */ - + /* Check the firmware version. */ cam->params.version.firmwareVersion = 0; get_version_information(cam); @@ -3113,14 +3113,14 @@ static int reset_camera(struct cam_data *cam) cam->params.qx3.qx3_detected = (cam->params.pnpID.vendor == 0x0813 && cam->params.pnpID.product == 0x0001); - /* The fatal error checking should be done after + /* The fatal error checking should be done after * the camera powers up (developer's guide p 3-38) */ /* Set streamState before transition to high power to avoid bug * in firmware 1-02 */ do_command(cam, CPIA_COMMAND_ModifyCameraStatus, STREAMSTATE, 0, - STREAM_NOT_READY, 0); - + STREAM_NOT_READY, 0); + /* GotoHiPower */ err = goto_high_power(cam); if (err) @@ -3142,16 +3142,16 @@ static int reset_camera(struct cam_data *cam) /* Firmware 1-02 may do this for parallel port cameras, * just clear the flags (developer's guide p 3-38) */ do_command(cam, CPIA_COMMAND_ModifyCameraStatus, - FATALERROR, ~(COM_FLAG|CPIA_FLAG), 0, 0); + FATALERROR, ~(COM_FLAG|CPIA_FLAG), 0, 0); } } - + /* Check the camera status again */ if (cam->params.status.fatalError) { if (cam->params.status.fatalError) return -EIO; } - + /* VPVersion can't be retrieved before the camera is in HiPower, * so get it here instead of in get_version_information. */ do_command(cam, CPIA_COMMAND_GetVPVersion, 0, 0, 0, 0); @@ -3193,24 +3193,24 @@ static int cpia_open(struct inode *inode, struct file *file) if (!cam->raw_image) goto oops; } - + if (!cam->decompressed_frame.data) { cam->decompressed_frame.data = rvmalloc(CPIA_MAX_FRAME_SIZE); if (!cam->decompressed_frame.data) goto oops; } - + /* open cpia */ err = -ENODEV; if (cam->ops->open(cam->lowlevel_data)) goto oops; - + /* reset the camera */ if ((err = reset_camera(cam)) != 0) { cam->ops->close(cam->lowlevel_data); goto oops; } - + err = -EINTR; if(signal_pending(current)) goto oops; @@ -3224,7 +3224,7 @@ static int cpia_open(struct inode *inode, struct file *file) /* init it to something */ cam->mmap_kludge = 0; - + ++cam->open_count; file->private_data = dev; mutex_unlock(&cam->busy_lock); @@ -3250,10 +3250,10 @@ static int cpia_close(struct inode *inode, struct file *file) struct cam_data *cam = dev->priv; if (cam->ops) { - /* Return ownership of /proc/cpia/videoX to root */ + /* Return ownership of /proc/cpia/videoX to root */ if(cam->proc_entry) cam->proc_entry->uid = 0; - + /* save camera state for later open (developers guide ch 3.5.3) */ save_camera_state(cam); @@ -3342,7 +3342,7 @@ static ssize_t cpia_read(struct file *file, char __user *buf, return -EFAULT; } if (copy_to_user(buf, cam->decompressed_frame.data, - cam->decompressed_frame.count)) { + cam->decompressed_frame.count)) { DBG("copy_to_user failed\n"); mutex_unlock(&cam->busy_lock); return -EFAULT; @@ -3361,7 +3361,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, if (!cam || !cam->ops) return -ENODEV; - + /* make this _really_ smp-safe */ if (mutex_lock_interruptible(&cam->busy_lock)) return -EINTR; @@ -3405,7 +3405,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, v->norm = 0; break; } - + case VIDIOCSCHAN: { struct video_channel *v = arg; @@ -3424,7 +3424,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, *pic = cam->vp; break; } - + case VIDIOCSPICT: { struct video_picture *vp = arg; @@ -3458,11 +3458,11 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, /* Adjust flicker control if necessary */ if(cam->params.flickerControl.allowableOverExposure < 0) - cam->params.flickerControl.allowableOverExposure = + cam->params.flickerControl.allowableOverExposure = -find_over_exposure(cam->params.colourParams.brightness); if(cam->params.flickerControl.flickerMode != 0) cam->cmd_queue |= COMMAND_SETFLICKERCTRL; - + /* queue command to update camera */ cam->cmd_queue |= COMMAND_SETCOLOURPARAMS; @@ -3482,7 +3482,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, *vw = cam->vw; break; } - + case VIDIOCSWIN: { /* copy_from_user, check validity, copy to internal structure */ @@ -3514,7 +3514,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, /* video size is changing, reset the subcapture area */ memset(&cam->vc, 0, sizeof(cam->vc)); - + set_vw_size(cam); DBG("%d / %d\n", cam->vw.width, cam->vw.height); cam->cmd_queue |= COMMAND_SETFORMAT; @@ -3547,7 +3547,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, vm->offsets[i] = CPIA_MAX_FRAME_SIZE * i; break; } - + case VIDIOCMCAPTURE: { struct video_mmap *vm = arg; @@ -3597,7 +3597,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, /* video size is changing, reset the subcapture area */ memset(&cam->vc, 0, sizeof(cam->vc)); - + set_vw_size(cam); cam->cmd_queue |= COMMAND_SETFORMAT; dispatch_commands(cam); @@ -3608,7 +3608,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, break; } - + case VIDIOCSYNC: { int *frame = arg; @@ -3649,7 +3649,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, *vc = cam->vc; break; - } + } case VIDIOCSCAPTURE: { @@ -3665,7 +3665,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, retval = -EINVAL; break; } - + /* Clip to the resolution we can set for the ROI (every 8 columns and 4 rows) */ vc->x = vc->x & ~(__u32)7; @@ -3681,14 +3681,14 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, } DBG("%d,%d/%dx%d\n", vc->x,vc->y,vc->width, vc->height); - + mutex_lock(&cam->param_lock); - + cam->vc.x = vc->x; cam->vc.y = vc->y; cam->vc.width = vc->width; cam->vc.height = vc->height; - + set_vw_size(cam); cam->cmd_queue |= COMMAND_SETFORMAT; @@ -3699,7 +3699,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, dispatch_commands(cam); break; } - + case VIDIOCGUNIT: { struct video_unit *vu = arg; @@ -3715,7 +3715,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, break; } - + /* pointless to implement overlay with this camera */ case VIDIOCCAPTURE: case VIDIOCGFBUF: @@ -3738,7 +3738,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, mutex_unlock(&cam->busy_lock); return retval; -} +} static int cpia_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) @@ -3759,7 +3759,7 @@ static int cpia_mmap(struct file *file, struct vm_area_struct *vma) if (!cam || !cam->ops) return -ENODEV; - + DBG("cpia_mmap: %ld\n", size); if (size > FRAME_NUM*CPIA_MAX_FRAME_SIZE) @@ -3767,7 +3767,7 @@ static int cpia_mmap(struct file *file, struct vm_area_struct *vma) if (!cam || !cam->ops) return -ENODEV; - + /* make this _really_ smp-safe */ if (mutex_lock_interruptible(&cam->busy_lock)) return -EINTR; @@ -3851,11 +3851,11 @@ static void reset_camera_struct(struct cam_data *cam) cam->params.flickerControl.flickerMode = 0; cam->params.flickerControl.disabled = 1; - cam->params.flickerControl.coarseJump = + cam->params.flickerControl.coarseJump = flicker_jumps[cam->mainsFreq] - [cam->params.sensorFps.baserate] - [cam->params.sensorFps.divisor]; - cam->params.flickerControl.allowableOverExposure = + [cam->params.sensorFps.baserate] + [cam->params.sensorFps.divisor]; + cam->params.flickerControl.allowableOverExposure = -find_over_exposure(cam->params.colourParams.brightness); cam->params.vlOffset.gain1 = 20; cam->params.vlOffset.gain2 = 24; @@ -3870,21 +3870,21 @@ static void reset_camera_struct(struct cam_data *cam) cam->params.compressionParams.qDiffStepThresh = 3; cam->params.compressionParams.decimationThreshMod = 2; /* End of default values from Software Developer's Guide */ - + cam->transfer_rate = 0; cam->exposure_status = EXPOSURE_NORMAL; - + /* Set Sensor FPS to 15fps. This seems better than 30fps * for indoor lighting. */ cam->params.sensorFps.divisor = 1; cam->params.sensorFps.baserate = 1; - + cam->params.yuvThreshold.yThreshold = 6; /* From windows driver */ cam->params.yuvThreshold.uvThreshold = 6; /* From windows driver */ - + cam->params.format.subSample = SUBSAMPLE_422; cam->params.format.yuvOrder = YUVORDER_YUYV; - + cam->params.compression.mode = CPIA_COMPRESSION_AUTO; cam->params.compressionTarget.frTargeting = CPIA_COMPRESSION_TARGET_QUALITY; @@ -3898,7 +3898,7 @@ static void reset_camera_struct(struct cam_data *cam) cam->params.qx3.cradled = 0; cam->video_size = VIDEOSIZE_CIF; - + cam->vp.colour = 32768; /* 50% */ cam->vp.hue = 32768; /* 50% */ cam->vp.brightness = 32768; /* 50% */ @@ -3911,7 +3911,7 @@ static void reset_camera_struct(struct cam_data *cam) cam->vc.y = 0; cam->vc.width = 0; cam->vc.height = 0; - + cam->vw.x = 0; cam->vw.y = 0; set_vw_size(cam); @@ -3928,7 +3928,7 @@ static void reset_camera_struct(struct cam_data *cam) /* initialize cam_data structure */ static void init_camera_struct(struct cam_data *cam, - struct cpia_camera_ops *ops ) + struct cpia_camera_ops *ops ) { int i; @@ -3945,7 +3945,7 @@ static void init_camera_struct(struct cam_data *cam, memcpy(&cam->vdev, &cpia_template, sizeof(cpia_template)); cam->vdev.priv = cam; - + cam->curframe = 0; for (i = 0; i < FRAME_NUM; i++) { cam->frame[i].width = 0; @@ -3961,15 +3961,15 @@ static void init_camera_struct(struct cam_data *cam, struct cam_data *cpia_register_camera(struct cpia_camera_ops *ops, void *lowlevel) { - struct cam_data *camera; - + struct cam_data *camera; + if ((camera = kmalloc(sizeof(struct cam_data), GFP_KERNEL)) == NULL) return NULL; - + init_camera_struct( camera, ops ); camera->lowlevel_data = lowlevel; - + /* register v4l device */ if (video_register_device(&camera->vdev, VFL_TYPE_GRABBER, video_nr) == -1) { kfree(camera); @@ -3982,7 +3982,7 @@ struct cam_data *cpia_register_camera(struct cpia_camera_ops *ops, void *lowleve /* open cpia */ if (camera->ops->open(camera->lowlevel_data)) return camera; - + /* reset the camera */ if (reset_camera(camera) != 0) { camera->ops->close(camera->lowlevel_data); @@ -4022,11 +4022,11 @@ void cpia_unregister_camera(struct cam_data *cam) DBG("camera open -- setting ops to NULL\n"); cam->ops = NULL; } - + #ifdef CONFIG_PROC_FS DBG("destroying /proc/cpia/video%d\n", cam->vdev.minor); destroy_proc_cpia_cam(cam); -#endif +#endif if (!cam->open_count) { DBG("freeing camera\n"); kfree(cam); diff --git a/drivers/media/video/cpia.h b/drivers/media/video/cpia.h index de6678200a57..dde27a6a4a09 100644 --- a/drivers/media/video/cpia.h +++ b/drivers/media/video/cpia.h @@ -52,10 +52,10 @@ struct cpia_camera_ops { /* open sets privdata to point to structure for this camera. - * Returns negative value on error, otherwise 0. + * Returns negative value on error, otherwise 0. */ int (*open)(void *privdata); - + /* Registers callback function cb to be called with cbdata * when an image is ready. If cb is NULL, only single image grabs * should be used. cb should immediately call streamRead to read @@ -63,8 +63,8 @@ struct cpia_camera_ops * otherwise 0. */ int (*registerCallback)(void *privdata, void (*cb)(void *cbdata), - void *cbdata); - + void *cbdata); + /* transferCmd sends commands to the camera. command MUST point to * an 8 byte buffer in kernel space. data can be NULL if no extra * data is needed. The size of the data is given by the last 2 @@ -77,30 +77,30 @@ struct cpia_camera_ops * Returns negative value on error, otherwise 0. */ int (*streamStart)(void *privdata); - + /* streamStop terminates stream capture mode. * Returns negative value on error, otherwise 0. */ int (*streamStop)(void *privdata); - + /* streamRead reads a frame from the camera. buffer points to a - * buffer large enough to hold a complete frame in kernel space. - * noblock indicates if this should be a non blocking read. + * buffer large enough to hold a complete frame in kernel space. + * noblock indicates if this should be a non blocking read. * Returns the number of bytes read, or negative value on error. - */ + */ int (*streamRead)(void *privdata, u8 *buffer, int noblock); - + /* close disables the device until open() is called again. * Returns negative value on error, otherwise 0. */ int (*close)(void *privdata); - + /* If wait_for_stream_ready is non-zero, wait until the streamState * is STREAM_READY before calling streamRead. */ int wait_for_stream_ready; - /* + /* * Used to maintain lowlevel module usage counts */ struct module *owner; @@ -215,14 +215,14 @@ struct cam_params { u8 videoSize; /* CIF/QCIF */ u8 subSample; u8 yuvOrder; - } format; - struct { /* Intel QX3 specific data */ - u8 qx3_detected; /* a QX3 is present */ - u8 toplight; /* top light lit , R/W */ - u8 bottomlight; /* bottom light lit, R/W */ - u8 button; /* snapshot button pressed (R/O) */ - u8 cradled; /* microscope is in cradle (R/O) */ - } qx3; + } format; + struct { /* Intel QX3 specific data */ + u8 qx3_detected; /* a QX3 is present */ + u8 toplight; /* top light lit , R/W */ + u8 bottomlight; /* bottom light lit, R/W */ + u8 button; /* snapshot button pressed (R/O) */ + u8 cradled; /* microscope is in cradle (R/O) */ + } qx3; struct { u8 colStart; /* skip first 8*colStart pixels */ u8 colEnd; /* finish at 8*colEnd pixels */ @@ -247,13 +247,13 @@ enum v4l_camstates { struct cam_data { struct list_head cam_data_list; - struct mutex busy_lock; /* guard against SMP multithreading */ + struct mutex busy_lock; /* guard against SMP multithreading */ struct cpia_camera_ops *ops; /* lowlevel driver operations */ void *lowlevel_data; /* private data for lowlevel driver */ u8 *raw_image; /* buffer for raw image data */ struct cpia_frame decompressed_frame; - /* buffer to hold decompressed frame */ - int image_size; /* sizeof last decompressed image */ + /* buffer to hold decompressed frame */ + int image_size; /* sizeof last decompressed image */ int open_count; /* # of process that have camera open */ /* camera status */ @@ -265,7 +265,7 @@ struct cam_data { struct mutex param_lock; /* params lock for this camera */ struct cam_params params; /* camera settings */ struct proc_dir_entry *proc_entry; /* /proc/cpia/videoX */ - + /* v4l */ int video_size; /* VIDEO_SIZE_ */ volatile enum v4l_camstates camstate; /* v4l layer status */ @@ -277,7 +277,7 @@ struct cam_data { /* mmap interface */ int curframe; /* the current frame to grab into */ u8 *frame_buf; /* frame buffer data */ - struct cpia_frame frame[FRAME_NUM]; + struct cpia_frame frame[FRAME_NUM]; /* FRAME_NUM-buffering, so we need a array */ int first_frame; @@ -424,7 +424,7 @@ void cpia_unregister_camera(struct cam_data *cam); #define DEB_BYTE(p)\ DBG("%1d %1d %1d %1d %1d %1d %1d %1d \n",\ (p)&0x80?1:0, (p)&0x40?1:0, (p)&0x20?1:0, (p)&0x10?1:0,\ - (p)&0x08?1:0, (p)&0x04?1:0, (p)&0x02?1:0, (p)&0x01?1:0); + (p)&0x08?1:0, (p)&0x04?1:0, (p)&0x02?1:0, (p)&0x01?1:0); #endif /* __KERNEL__ */ diff --git a/drivers/media/video/cpia2/cpia2.h b/drivers/media/video/cpia2/cpia2.h index 95d3afa94a3d..8394283993f6 100644 --- a/drivers/media/video/cpia2/cpia2.h +++ b/drivers/media/video/cpia2/cpia2.h @@ -381,7 +381,7 @@ struct cpia2_fh { struct camera_data { /* locks */ - struct semaphore busy_lock; /* guard against SMP multithreading */ + struct mutex busy_lock; /* guard against SMP multithreading */ struct v4l2_prio_state prio; /* camera status */ diff --git a/drivers/media/video/cpia2/cpia2_core.c b/drivers/media/video/cpia2/cpia2_core.c index 5dfb242d5b8c..fd771c7a2fe2 100644 --- a/drivers/media/video/cpia2/cpia2_core.c +++ b/drivers/media/video/cpia2/cpia2_core.c @@ -2238,7 +2238,7 @@ struct camera_data *cpia2_init_camera_struct(void) memset(cam, 0, sizeof(struct camera_data)); cam->present = 1; - init_MUTEX(&cam->busy_lock); + mutex_init(&cam->busy_lock); init_waitqueue_head(&cam->wq_stream); return cam; @@ -2371,12 +2371,12 @@ long cpia2_read(struct camera_data *cam, } /* make this _really_ smp and multithread-safe */ - if (down_interruptible(&cam->busy_lock)) + if (mutex_lock_interruptible(&cam->busy_lock)) return -ERESTARTSYS; if (!cam->present) { LOG("%s: camera removed\n",__FUNCTION__); - up(&cam->busy_lock); + mutex_unlock(&cam->busy_lock); return 0; /* EOF */ } @@ -2389,34 +2389,34 @@ long cpia2_read(struct camera_data *cam, /* Copy cam->curbuff in case it changes while we're processing */ frame = cam->curbuff; if (noblock && frame->status != FRAME_READY) { - up(&cam->busy_lock); + mutex_unlock(&cam->busy_lock); return -EAGAIN; } if(frame->status != FRAME_READY) { - up(&cam->busy_lock); + mutex_unlock(&cam->busy_lock); wait_event_interruptible(cam->wq_stream, !cam->present || (frame = cam->curbuff)->status == FRAME_READY); if (signal_pending(current)) return -ERESTARTSYS; /* make this _really_ smp and multithread-safe */ - if (down_interruptible(&cam->busy_lock)) { + if (mutex_lock_interruptible(&cam->busy_lock)) { return -ERESTARTSYS; } if(!cam->present) { - up(&cam->busy_lock); + mutex_unlock(&cam->busy_lock); return 0; } } /* copy data to user space */ if (frame->length > count) { - up(&cam->busy_lock); + mutex_unlock(&cam->busy_lock); return -EFAULT; } if (copy_to_user(buf, frame->data, frame->length)) { - up(&cam->busy_lock); + mutex_unlock(&cam->busy_lock); return -EFAULT; } @@ -2424,7 +2424,7 @@ long cpia2_read(struct camera_data *cam, frame->status = FRAME_EMPTY; - up(&cam->busy_lock); + mutex_unlock(&cam->busy_lock); return count; } @@ -2443,10 +2443,10 @@ unsigned int cpia2_poll(struct camera_data *cam, struct file *filp, return POLLERR; } - down(&cam->busy_lock); + mutex_lock(&cam->busy_lock); if(!cam->present) { - up(&cam->busy_lock); + mutex_unlock(&cam->busy_lock); return POLLHUP; } @@ -2456,16 +2456,16 @@ unsigned int cpia2_poll(struct camera_data *cam, struct file *filp, cam->params.camera_state.stream_mode); } - up(&cam->busy_lock); + mutex_unlock(&cam->busy_lock); poll_wait(filp, &cam->wq_stream, wait); - down(&cam->busy_lock); + mutex_lock(&cam->busy_lock); if(!cam->present) status = POLLHUP; else if(cam->curbuff->status == FRAME_READY) status = POLLIN | POLLRDNORM; - up(&cam->busy_lock); + mutex_unlock(&cam->busy_lock); return status; } @@ -2488,18 +2488,18 @@ int cpia2_remap_buffer(struct camera_data *cam, struct vm_area_struct *vma) DBG("mmap offset:%ld size:%ld\n", start_offset, size); /* make this _really_ smp-safe */ - if (down_interruptible(&cam->busy_lock)) + if (mutex_lock_interruptible(&cam->busy_lock)) return -ERESTARTSYS; if (!cam->present) { - up(&cam->busy_lock); + mutex_unlock(&cam->busy_lock); return -ENODEV; } if (size > cam->frame_size*cam->num_frames || (start_offset % cam->frame_size) != 0 || (start_offset+size > cam->frame_size*cam->num_frames)) { - up(&cam->busy_lock); + mutex_unlock(&cam->busy_lock); return -EINVAL; } @@ -2507,7 +2507,7 @@ int cpia2_remap_buffer(struct camera_data *cam, struct vm_area_struct *vma) while (size > 0) { page = kvirt_to_pa(pos); if (remap_pfn_range(vma, start, page >> PAGE_SHIFT, PAGE_SIZE, PAGE_SHARED)) { - up(&cam->busy_lock); + mutex_unlock(&cam->busy_lock); return -EAGAIN; } start += PAGE_SIZE; @@ -2519,7 +2519,7 @@ int cpia2_remap_buffer(struct camera_data *cam, struct vm_area_struct *vma) } cam->mmapped = true; - up(&cam->busy_lock); + mutex_unlock(&cam->busy_lock); return 0; } diff --git a/drivers/media/video/cpia2/cpia2_v4l.c b/drivers/media/video/cpia2/cpia2_v4l.c index 08f8be345fa8..481e178ef56d 100644 --- a/drivers/media/video/cpia2/cpia2_v4l.c +++ b/drivers/media/video/cpia2/cpia2_v4l.c @@ -255,7 +255,7 @@ static int cpia2_open(struct inode *inode, struct file *file) return -ENODEV; } - if(down_interruptible(&cam->busy_lock)) + if(mutex_lock_interruptible(&cam->busy_lock)) return -ERESTARTSYS; if(!cam->present) { @@ -299,7 +299,7 @@ skip_init: cpia2_dbg_dump_registers(cam); err_return: - up(&cam->busy_lock); + mutex_unlock(&cam->busy_lock); return retval; } @@ -314,7 +314,7 @@ static int cpia2_close(struct inode *inode, struct file *file) struct camera_data *cam = video_get_drvdata(dev); struct cpia2_fh *fh = file->private_data; - down(&cam->busy_lock); + mutex_lock(&cam->busy_lock); if (cam->present && (cam->open_count == 1 @@ -347,7 +347,7 @@ static int cpia2_close(struct inode *inode, struct file *file) } } - up(&cam->busy_lock); + mutex_unlock(&cam->busy_lock); return 0; } @@ -523,11 +523,11 @@ static int sync(struct camera_data *cam, int frame_nr) return 0; } - up(&cam->busy_lock); + mutex_unlock(&cam->busy_lock); wait_event_interruptible(cam->wq_stream, !cam->streaming || frame->status == FRAME_READY); - down(&cam->busy_lock); + mutex_lock(&cam->busy_lock); if (signal_pending(current)) return -ERESTARTSYS; if(!cam->present) @@ -1544,11 +1544,11 @@ static int ioctl_dqbuf(void *arg,struct camera_data *cam, struct file *file) if(frame < 0) { /* Wait for a frame to become available */ struct framebuf *cb=cam->curbuff; - up(&cam->busy_lock); + mutex_unlock(&cam->busy_lock); wait_event_interruptible(cam->wq_stream, !cam->present || (cb=cam->curbuff)->status == FRAME_READY); - down(&cam->busy_lock); + mutex_lock(&cam->busy_lock); if (signal_pending(current)) return -ERESTARTSYS; if(!cam->present) @@ -1591,11 +1591,11 @@ static int cpia2_do_ioctl(struct inode *inode, struct file *file, return -ENOTTY; /* make this _really_ smp-safe */ - if (down_interruptible(&cam->busy_lock)) + if (mutex_lock_interruptible(&cam->busy_lock)) return -ERESTARTSYS; if (!cam->present) { - up(&cam->busy_lock); + mutex_unlock(&cam->busy_lock); return -ENODEV; } @@ -1608,7 +1608,7 @@ static int cpia2_do_ioctl(struct inode *inode, struct file *file, struct cpia2_fh *fh = file->private_data; retval = v4l2_prio_check(&cam->prio, &fh->prio); if(retval) { - up(&cam->busy_lock); + mutex_unlock(&cam->busy_lock); return retval; } break; @@ -1618,7 +1618,7 @@ static int cpia2_do_ioctl(struct inode *inode, struct file *file, { struct cpia2_fh *fh = file->private_data; if(fh->prio != V4L2_PRIORITY_RECORD) { - up(&cam->busy_lock); + mutex_unlock(&cam->busy_lock); return -EBUSY; } break; @@ -1847,7 +1847,7 @@ static int cpia2_do_ioctl(struct inode *inode, struct file *file, break; } - up(&cam->busy_lock); + mutex_unlock(&cam->busy_lock); return retval; } @@ -1924,14 +1924,15 @@ static void reset_camera_struct_v4l(struct camera_data *cam) * The v4l video device structure initialized for this device ***/ static struct file_operations fops_template = { - .owner= THIS_MODULE, - .open= cpia2_open, - .release= cpia2_close, - .read= cpia2_v4l_read, - .poll= cpia2_v4l_poll, - .ioctl= cpia2_ioctl, - .llseek= no_llseek, - .mmap= cpia2_mmap, + .owner = THIS_MODULE, + .open = cpia2_open, + .release = cpia2_close, + .read = cpia2_v4l_read, + .poll = cpia2_v4l_poll, + .ioctl = cpia2_ioctl, + .llseek = no_llseek, + .compat_ioctl = v4l_compat_ioctl32, + .mmap = cpia2_mmap, }; static struct video_device cpia2_template = { diff --git a/drivers/media/video/cpia_pp.c b/drivers/media/video/cpia_pp.c index 74cff626e044..3021f21aae36 100644 --- a/drivers/media/video/cpia_pp.c +++ b/drivers/media/video/cpia_pp.c @@ -23,7 +23,7 @@ */ /* define _CPIA_DEBUG_ for verbose debug output (see cpia.h) */ -/* #define _CPIA_DEBUG_ 1 */ +/* #define _CPIA_DEBUG_ 1 */ #include <linux/config.h> @@ -45,7 +45,7 @@ static int cpia_pp_open(void *privdata); static int cpia_pp_registerCallback(void *privdata, void (*cb) (void *cbdata), - void *cbdata); + void *cbdata); static int cpia_pp_transferCmd(void *privdata, u8 *command, u8 *data); static int cpia_pp_streamStart(void *privdata); static int cpia_pp_streamStop(void *privdata); @@ -93,7 +93,7 @@ struct pp_cam_entry { int stream_irq; }; -static struct cpia_camera_ops cpia_pp_ops = +static struct cpia_camera_ops cpia_pp_ops = { cpia_pp_open, cpia_pp_registerCallback, @@ -123,7 +123,7 @@ static void cpia_parport_disable_irq( struct parport *port ) { } /* Special CPiA PPC modes: These are invoked by using the 1284 Extensibility - * Link Flag during negotiation */ + * Link Flag during negotiation */ #define UPLOAD_FLAG 0x08 #define NIBBLE_TRANSFER 0x01 #define ECP_TRANSFER 0x03 @@ -139,17 +139,17 @@ static void cpia_parport_disable_irq( struct parport *port ) { /* CPiA nonstandard "Nibble" mode (no nDataAvail signal after each byte). */ /* The standard kernel parport_ieee1284_read_nibble() fails with the CPiA... */ -static size_t cpia_read_nibble (struct parport *port, - void *buffer, size_t len, +static size_t cpia_read_nibble (struct parport *port, + void *buffer, size_t len, int flags) { - /* adapted verbatim, with one change, from + /* adapted verbatim, with one change, from parport_ieee1284_read_nibble() in drivers/parport/ieee1284-ops.c */ unsigned char *buf = buffer; int i; unsigned char byte = 0; - + len *= 2; /* in nibbles */ for (i=0; i < len; i++) { unsigned char nibble; @@ -158,12 +158,12 @@ static size_t cpia_read_nibble (struct parport *port, * after every second nibble to signal that more * data is available. (the total number of Bytes that * should be sent is known; if too few are received, an error - * will be recorded after a timeout). + * will be recorded after a timeout). * This is incompatible with parport_ieee1284_read_nibble(), * which expects to find nFault LO after every second nibble. */ - /* Solution: modify cpia_read_nibble to only check for + /* Solution: modify cpia_read_nibble to only check for * nDataAvail before the first nibble is sent. */ @@ -216,7 +216,7 @@ static size_t cpia_read_nibble (struct parport *port, /* Second nibble */ byte |= nibble << 4; *buf++ = byte; - } else + } else byte = nibble; } @@ -238,18 +238,18 @@ static size_t cpia_read_nibble (struct parport *port, } /* CPiA nonstandard "Nibble Stream" mode (2 nibbles per cycle, instead of 1) - * (See CPiA Data sheet p. 31) - * - * "Nibble Stream" mode used by CPiA for uploads to non-ECP ports is a - * nonstandard variant of nibble mode which allows the same (mediocre) - * data flow of 8 bits per cycle as software-enabled ECP by TRISTATE-capable + * (See CPiA Data sheet p. 31) + * + * "Nibble Stream" mode used by CPiA for uploads to non-ECP ports is a + * nonstandard variant of nibble mode which allows the same (mediocre) + * data flow of 8 bits per cycle as software-enabled ECP by TRISTATE-capable * parallel ports, but works also for non-TRISTATE-capable ports. * (Standard nibble mode only send 4 bits per cycle) * */ -static size_t cpia_read_nibble_stream(struct parport *port, - void *buffer, size_t len, +static size_t cpia_read_nibble_stream(struct parport *port, + void *buffer, size_t len, int flags) { int i; @@ -260,7 +260,7 @@ static size_t cpia_read_nibble_stream(struct parport *port, unsigned char nibble[2], byte = 0; int j; - /* Image Data is complete when 4 consecutive EOI bytes (0xff) are seen */ + /* Image Data is complete when 4 consecutive EOI bytes (0xff) are seen */ if (endseen > 3 ) break; @@ -268,7 +268,7 @@ static size_t cpia_read_nibble_stream(struct parport *port, parport_frob_control (port, PARPORT_CONTROL_AUTOFD, PARPORT_CONTROL_AUTOFD); - + /* Event 9: nAck goes low. */ port->ieee1284.phase = IEEE1284_PH_REV_DATA; if (parport_wait_peripheral (port, @@ -282,7 +282,7 @@ static size_t cpia_read_nibble_stream(struct parport *port, /* Read lower nibble */ nibble[0] = parport_read_status (port) >>3; - + /* Event 10: Set nAutoFd high. */ parport_frob_control (port, PARPORT_CONTROL_AUTOFD, 0); @@ -295,10 +295,10 @@ static size_t cpia_read_nibble_stream(struct parport *port, port->name); break; } - + /* Read upper nibble */ nibble[1] = parport_read_status (port) >>3; - + /* reassemble the byte */ for (j = 0; j < 2 ; j++ ) { nibble[j] &= ~8; @@ -335,8 +335,8 @@ static void EndTransferMode(struct pp_cam_entry *cam) static int ForwardSetup(struct pp_cam_entry *cam) { int retry; - - /* The CPiA uses ECP protocol for Downloads from the Host to the camera. + + /* The CPiA uses ECP protocol for Downloads from the Host to the camera. * This will be software-emulated if ECP hardware is not present */ @@ -375,9 +375,9 @@ static int ReverseSetup(struct pp_cam_entry *cam, int extensibility) upload_mode = mode; if(extensibility) mode = UPLOAD_FLAG|transfer_mode|IEEE1284_EXT_LINK; - /* the usual camera maximum response time is 10ms, but after + /* the usual camera maximum response time is 10ms, but after * receiving some commands, it needs up to 40ms. */ - + for(retry = 0; retry < 4; ++retry) { if(!parport_negotiate(cam->port, mode)) { break; @@ -439,10 +439,10 @@ static int ReadPacket(struct pp_cam_entry *cam, u8 *packet, size_t size) /* support for CPiA variant nibble reads */ if(cam->port->ieee1284.mode == IEEE1284_MODE_NIBBLE) { - if(cpia_read_nibble(cam->port, packet, size, 0) != size) - retval = -EIO; + if(cpia_read_nibble(cam->port, packet, size, 0) != size) + retval = -EIO; } else { - if(parport_read(cam->port, packet, size) != size) + if(parport_read(cam->port, packet, size) != size) retval = -EIO; } EndTransferMode(cam); @@ -542,18 +542,18 @@ static int cpia_pp_streamRead(void *privdata, u8 *buffer, int noblock) block_size = PARPORT_CHUNK_SIZE; while( !cam->image_complete ) { cond_resched(); - + new_bytes = cpia_pp_read(cam->port, buffer, block_size ); if( new_bytes <= 0 ) { break; } i=-1; while(++i<new_bytes && endseen<4) { - if(*buffer==EOI) { - endseen++; - } else { - endseen=0; - } + if(*buffer==EOI) { + endseen++; + } else { + endseen=0; + } buffer++; } read_bytes += i; @@ -601,7 +601,7 @@ static int cpia_pp_transferCmd(void *privdata, u8 *command, u8 *data) } if((err = ReadPacket(cam, buffer, 8)) < 0) { DBG("Error reading command result\n"); - return err; + return err; } memcpy(data, buffer, databytes); } else if(command[0] == DATA_OUT) { @@ -631,10 +631,10 @@ static int cpia_pp_transferCmd(void *privdata, u8 *command, u8 *data) static int cpia_pp_open(void *privdata) { struct pp_cam_entry *cam = (struct pp_cam_entry *)privdata; - + if (cam == NULL) return -EINVAL; - + if(cam->open_count == 0) { if (parport_claim(cam->pdev)) { DBG("failed to claim the port\n"); @@ -645,12 +645,12 @@ static int cpia_pp_open(void *privdata) parport_write_control(cam->port, PARPORT_CONTROL_SELECT); udelay(50); parport_write_control(cam->port, - PARPORT_CONTROL_SELECT - | PARPORT_CONTROL_INIT); + PARPORT_CONTROL_SELECT + | PARPORT_CONTROL_INIT); } - + ++cam->open_count; - + return 0; } @@ -663,7 +663,7 @@ static int cpia_pp_registerCallback(void *privdata, void (*cb)(void *cbdata), vo { struct pp_cam_entry *cam = privdata; int retval = 0; - + if(cam->port->irq != PARPORT_IRQ_NONE) { INIT_WORK(&cam->cb_task, cb, cbdata); } else { @@ -707,9 +707,9 @@ static int cpia_pp_register(struct parport *port) LOG("failed to allocate camera structure\n"); return -ENOMEM; } - + pdev = parport_register_device(port, "cpia_pp", NULL, NULL, - NULL, 0, cam); + NULL, 0, cam); if (!pdev) { LOG("failed to parport_register_device\n"); @@ -753,19 +753,19 @@ static void cpia_pp_detach (struct parport *port) } cpia = NULL; } - spin_unlock( &cam_list_lock_pp ); + spin_unlock( &cam_list_lock_pp ); if (!cpia) { DBG("cpia_pp_detach failed to find cam_data in cam_list\n"); return; } - - cam = (struct pp_cam_entry *) cpia->lowlevel_data; + + cam = (struct pp_cam_entry *) cpia->lowlevel_data; cpia_unregister_camera(cpia); - if(cam->open_count > 0) + if(cam->open_count > 0) cpia_pp_close(cam); parport_unregister_device(cam->pdev); - cpia->lowlevel_data = NULL; + cpia->lowlevel_data = NULL; kfree(cam); } @@ -805,14 +805,14 @@ static struct parport_driver cpia_pp_driver = { int cpia_pp_init(void) { - printk(KERN_INFO "%s v%d.%d.%d\n",ABOUT, + printk(KERN_INFO "%s v%d.%d.%d\n",ABOUT, CPIA_PP_MAJ_VER,CPIA_PP_MIN_VER,CPIA_PP_PATCH_VER); if(parport_nr[0] == PPCPIA_PARPORT_OFF) { printk(" disabled\n"); return 0; } - + spin_lock_init( &cam_list_lock_pp ); if (parport_register_driver (&cpia_pp_driver)) { diff --git a/drivers/media/video/cpia_usb.c b/drivers/media/video/cpia_usb.c index 03275c37c5d3..9c49a4b00116 100644 --- a/drivers/media/video/cpia_usb.c +++ b/drivers/media/video/cpia_usb.c @@ -22,7 +22,7 @@ */ /* define _CPIA_DEBUG_ for verbose debug output (see cpia.h) */ -/* #define _CPIA_DEBUG_ 1 */ +/* #define _CPIA_DEBUG_ 1 */ #include <linux/module.h> #include <linux/kernel.h> @@ -85,7 +85,7 @@ struct usb_cpia { static int cpia_usb_open(void *privdata); static int cpia_usb_registerCallback(void *privdata, void (*cb) (void *cbdata), - void *cbdata); + void *cbdata); static int cpia_usb_transferCmd(void *privdata, u8 *command, u8 *data); static int cpia_usb_streamStart(void *privdata); static int cpia_usb_streamStop(void *privdata); @@ -127,7 +127,7 @@ static void cpia_usb_complete(struct urb *urb, struct pt_regs *regs) ucpia->workbuff->status = FRAME_READING; ucpia->workbuff->length = 0; } - + for (i = 0; i < urb->number_of_packets; i++) { int n = urb->iso_frame_desc[i].actual_length; int st = urb->iso_frame_desc[i].status; @@ -141,9 +141,9 @@ static void cpia_usb_complete(struct urb *urb, struct pt_regs *regs) printk(KERN_DEBUG "cpia: scratch buf overflow!scr_len: %d, n: %d\n", ucpia->workbuff->length, n); return; } - + if (n) { - if ((ucpia->workbuff->length > 0) || + if ((ucpia->workbuff->length > 0) || (0x19 == cdata[0] && 0x68 == cdata[1])) { memcpy(ucpia->workbuff->data + ucpia->workbuff->length, cdata, n); ucpia->workbuff->length += n; @@ -160,7 +160,7 @@ static void cpia_usb_complete(struct urb *urb, struct pt_regs *regs) ucpia->workbuff = ucpia->workbuff->next; ucpia->workbuff->status = FRAME_EMPTY; ucpia->workbuff->length = 0; - + if (waitqueue_active(&ucpia->wq_stream)) wake_up_interruptible(&ucpia->wq_stream); } @@ -178,7 +178,7 @@ static int cpia_usb_open(void *privdata) struct usb_cpia *ucpia = (struct usb_cpia *) privdata; struct urb *urb; int ret, retval = 0, fx, err; - + if (!ucpia) return -EINVAL; @@ -191,7 +191,7 @@ static int cpia_usb_open(void *privdata) retval = -EINVAL; goto error_0; } - + ret = usb_set_interface(ucpia->dev, ucpia->iface, 3); if (ret < 0) { printk(KERN_ERR "cpia_usb_open: usb_set_interface error (ret = %d)\n", ret); @@ -286,7 +286,7 @@ error_1: error_0: kfree (ucpia->sbuf[0].data); ucpia->sbuf[0].data = NULL; - + return retval; } @@ -307,7 +307,7 @@ static int WritePacket(struct usb_device *udev, const u8 *packet, u8 *buf, size_ return usb_control_msg(udev, usb_sndctrlpipe(udev, 0), packet[1] + (packet[0] << 8), USB_TYPE_VENDOR | USB_RECIP_DEVICE, - packet[2] + (packet[3] << 8), + packet[2] + (packet[3] << 8), packet[4] + (packet[5] << 8), buf, size, 1000); } @@ -324,7 +324,7 @@ static int ReadPacket(struct usb_device *udev, u8 *packet, u8 *buf, size_t size) return usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), packet[1] + (packet[0] << 8), USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - packet[2] + (packet[3] << 8), + packet[2] + (packet[3] << 8), packet[4] + (packet[5] << 8), buf, size, 1000); } @@ -393,7 +393,7 @@ static int cpia_usb_streamRead(void *privdata, u8 *frame, int noblock) if (!ucpia || !ucpia->present) return -1; - + if (ucpia->curbuff->status != FRAME_READY) interruptible_sleep_on(&ucpia->wq_stream); else @@ -403,7 +403,7 @@ static int cpia_usb_streamRead(void *privdata, u8 *frame, int noblock) if (!mybuff) return -1; - + if (mybuff->status != FRAME_READY || mybuff->length < 4) { DBG("Something went wrong!\n"); return -1; @@ -411,7 +411,7 @@ static int cpia_usb_streamRead(void *privdata, u8 *frame, int noblock) memcpy(frame, mybuff->data, mybuff->length); mybuff->status = FRAME_EMPTY; - + /* DBG("read done, %d bytes, Header: %x/%x, Footer: %x%x%x%x\n", */ /* mybuff->length, frame[0], frame[1], */ /* frame[mybuff->length-4], frame[mybuff->length-3], */ @@ -447,7 +447,7 @@ static void cpia_usb_free_resources(struct usb_cpia *ucpia, int try) kfree(ucpia->sbuf[1].data); ucpia->sbuf[1].data = NULL; - + if (ucpia->sbuf[0].urb) { usb_kill_urb(ucpia->sbuf[0].urb); usb_free_urb(ucpia->sbuf[0].urb); @@ -490,7 +490,7 @@ static int cpia_probe(struct usb_interface *intf, struct usb_cpia *ucpia; struct cam_data *cam; int ret; - + /* A multi-config CPiA camera? */ if (udev->descriptor.bNumConfigurations != 1) return -ENODEV; @@ -539,7 +539,7 @@ static int cpia_probe(struct usb_interface *intf, /* Before register_camera, important */ ucpia->present = 1; - + cam = cpia_register_camera(&cpia_usb_ops, ucpia); if (!cam) { LOG("failed to cpia_register_camera\n"); @@ -591,7 +591,7 @@ static void cpia_disconnect(struct usb_interface *intf) struct cam_data *cam = usb_get_intfdata(intf); struct usb_cpia *ucpia; struct usb_device *udev; - + usb_set_intfdata(intf, NULL); if (!cam) return; @@ -600,7 +600,7 @@ static void cpia_disconnect(struct usb_interface *intf) spin_lock( &cam_list_lock_usb ); list_del(&cam->cam_data_list); spin_unlock( &cam_list_lock_usb ); - + ucpia->present = 0; cpia_unregister_camera(cam); @@ -631,7 +631,7 @@ static void cpia_disconnect(struct usb_interface *intf) static int __init usb_cpia_init(void) { - printk(KERN_INFO "%s v%d.%d.%d\n",ABOUT, + printk(KERN_INFO "%s v%d.%d.%d\n",ABOUT, CPIA_USB_MAJ_VER,CPIA_USB_MIN_VER,CPIA_USB_PATCH_VER); spin_lock_init(&cam_list_lock_usb); diff --git a/drivers/media/video/cs53l32a.c b/drivers/media/video/cs53l32a.c index 8739c64785ef..de87247c74ee 100644 --- a/drivers/media/video/cs53l32a.c +++ b/drivers/media/video/cs53l32a.c @@ -59,25 +59,25 @@ static int cs53l32a_read(struct i2c_client *client, u8 reg) static int cs53l32a_command(struct i2c_client *client, unsigned int cmd, void *arg) { - struct v4l2_audio *input = arg; + struct v4l2_routing *route = arg; struct v4l2_control *ctrl = arg; switch (cmd) { - case VIDIOC_S_AUDIO: + case VIDIOC_INT_G_AUDIO_ROUTING: + route->input = (cs53l32a_read(client, 0x01) >> 4) & 3; + route->output = 0; + break; + + case VIDIOC_INT_S_AUDIO_ROUTING: /* There are 2 physical inputs, but the second input can be placed in two modes, the first mode bypasses the PGA (gain), the second goes through the PGA. Hence there are three possible inputs to choose from. */ - if (input->index > 2) { - v4l_err(client, "Invalid input %d.\n", input->index); + if (route->input > 2) { + v4l_err(client, "Invalid input %d.\n", route->input); return -EINVAL; } - cs53l32a_write(client, 0x01, 0x01 + (input->index << 4)); - break; - - case VIDIOC_G_AUDIO: - memset(input, 0, sizeof(*input)); - input->index = (cs53l32a_read(client, 0x01) >> 4) & 3; + cs53l32a_write(client, 0x01, 0x01 + (route->input << 4)); break; case VIDIOC_G_CTRL: diff --git a/drivers/media/video/cs8420.h b/drivers/media/video/cs8420.h index 2b22f3a38de5..621c0c6678ea 100644 --- a/drivers/media/video/cs8420.h +++ b/drivers/media/video/cs8420.h @@ -20,7 +20,7 @@ #define __CS8420_H__ /* Initialization Sequence */ - + static __u8 init8420[] = { 1, 0x01, 2, 0x02, 3, 0x00, 4, 0x46, 5, 0x24, 6, 0x84, 18, 0x18, 19, 0x13, diff --git a/drivers/media/video/cx25840/cx25840-audio.c b/drivers/media/video/cx25840/cx25840-audio.c index cb9a7981e408..a4540e858f21 100644 --- a/drivers/media/video/cx25840/cx25840-audio.c +++ b/drivers/media/video/cx25840/cx25840-audio.c @@ -18,7 +18,6 @@ #include <linux/videodev2.h> #include <linux/i2c.h> -#include <media/audiochip.h> #include <media/v4l2-common.h> #include "cx25840.h" diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c index 8a257978056f..a65b3cc4bf03 100644 --- a/drivers/media/video/cx25840/cx25840-core.c +++ b/drivers/media/video/cx25840/cx25840-core.c @@ -31,7 +31,6 @@ #include <linux/slab.h> #include <linux/videodev2.h> #include <linux/i2c.h> -#include <media/audiochip.h> #include <media/v4l2-common.h> #include "cx25840.h" @@ -176,9 +175,9 @@ static void cx25840_initialize(struct i2c_client *client, int loadfw) cx25840_write(client, 0x4a5, 0x00); cx25840_write(client, 0x402, 0x00); /* 8. */ - cx25840_write(client, 0x401, 0x18); - cx25840_write(client, 0x4a2, 0x10); - cx25840_write(client, 0x402, 0x04); + cx25840_and_or(client, 0x401, ~0x18, 0); + cx25840_and_or(client, 0x4a2, ~0x10, 0x10); + /* steps 8c and 8d are done in change_input() */ /* 10. */ cx25840_write(client, 0x8d3, 0x1f); cx25840_write(client, 0x8e3, 0x03); @@ -209,6 +208,17 @@ static void input_change(struct i2c_client *client) struct cx25840_state *state = i2c_get_clientdata(client); v4l2_std_id std = cx25840_get_v4lstd(client); + /* Follow step 8c and 8d of section 3.16 in the cx25840 datasheet */ + if (std & V4L2_STD_SECAM) { + cx25840_write(client, 0x402, 0); + } + else { + cx25840_write(client, 0x402, 0x04); + cx25840_write(client, 0x49f, (std & V4L2_STD_NTSC) ? 0x14 : 0x11); + } + cx25840_and_or(client, 0x401, ~0x60, 0); + cx25840_and_or(client, 0x401, ~0x60, 0x60); + /* Note: perhaps V4L2_STD_PAL_M should be handled as V4L2_STD_NTSC instead of V4L2_STD_PAL. Someone needs to test this. */ if (std & V4L2_STD_PAL) { @@ -343,6 +353,15 @@ static int set_v4lstd(struct i2c_client *client, v4l2_std_id std) } } + /* Follow step 9 of section 3.16 in the cx25840 datasheet. + Without this PAL may display a vertical ghosting effect. + This happens for example with the Yuan MPC622. */ + if (fmt >= 4 && fmt < 8) { + /* Set format to NTSC-M */ + cx25840_and_or(client, 0x400, ~0xf, 1); + /* Turn off LCOMB */ + cx25840_and_or(client, 0x47b, ~6, 0); + } cx25840_and_or(client, 0x400, ~0xf, fmt); cx25840_vbi_setup(client); return 0; @@ -359,7 +378,14 @@ v4l2_std_id cx25840_get_v4lstd(struct i2c_client * client) } switch (fmt) { - case 0x1: return V4L2_STD_NTSC_M | V4L2_STD_NTSC_M_KR; + case 0x1: + { + /* if the audio std is A2-M, then this is the South Korean + NTSC standard */ + if (cx25840_read(client, 0x805) == 2) + return V4L2_STD_NTSC_M_KR; + return V4L2_STD_NTSC_M; + } case 0x2: return V4L2_STD_NTSC_M_JP; case 0x3: return V4L2_STD_NTSC_443; case 0x4: return V4L2_STD_PAL; @@ -737,16 +763,6 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd, return set_input(client, state->vid_input, input->index); } - case VIDIOC_G_AUDIO: - { - struct v4l2_audio *input = arg; - - memset(input, 0, sizeof(*input)); - input->index = state->aud_input; - input->capability = V4L2_AUDCAP_STEREO; - break; - } - case VIDIOC_S_FREQUENCY: input_change(client); break; @@ -794,13 +810,14 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd, bilingual -> lang1 */ cx25840_and_or(client, 0x809, ~0xf, 0x00); break; + case V4L2_TUNER_MODE_STEREO: case V4L2_TUNER_MODE_LANG1: /* mono -> mono stereo -> stereo bilingual -> lang1 */ cx25840_and_or(client, 0x809, ~0xf, 0x04); break; - case V4L2_TUNER_MODE_STEREO: + case V4L2_TUNER_MODE_LANG1_LANG2: /* mono -> mono stereo -> stereo bilingual -> lang1/lang2 */ @@ -808,7 +825,7 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd, break; case V4L2_TUNER_MODE_LANG2: /* mono -> mono - stereo ->stereo + stereo -> stereo bilingual -> lang2 */ cx25840_and_or(client, 0x809, ~0xf, 0x01); break; diff --git a/drivers/media/video/cx88/Kconfig b/drivers/media/video/cx88/Kconfig index e140996e6ee4..ff0f72340d69 100644 --- a/drivers/media/video/cx88/Kconfig +++ b/drivers/media/video/cx88/Kconfig @@ -16,12 +16,13 @@ config VIDEO_CX88 module will be called cx8800 config VIDEO_CX88_ALSA - tristate "ALSA DMA audio support" + tristate "Conexant 2388x DMA audio support" depends on VIDEO_CX88 && SND && EXPERIMENTAL select SND_PCM ---help--- This is a video4linux driver for direct (DMA) audio on - Conexant 2388x based TV cards. + Conexant 2388x based TV cards using ALSA. + It only works with boards with function 01 enabled. To check if your board supports, use lspci -n. If supported, you should see 1471:8801 or 1471:8811 diff --git a/drivers/media/video/cx88/cx88-alsa.c b/drivers/media/video/cx88/cx88-alsa.c index 3170b8f72c68..f9d87b86492c 100644 --- a/drivers/media/video/cx88/cx88-alsa.c +++ b/drivers/media/video/cx88/cx88-alsa.c @@ -303,7 +303,7 @@ static int dsp_buffer_free(snd_cx88_card_t *chip) BUG_ON(!chip->dma_size); dprintk(2,"Freeing buffer\n"); - videobuf_dma_pci_unmap(chip->pci, &chip->dma_risc); + videobuf_pci_dma_unmap(chip->pci, &chip->dma_risc); videobuf_dma_free(&chip->dma_risc); btcx_riscmem_free(chip->pci,&chip->buf->risc); kfree(chip->buf); @@ -429,7 +429,7 @@ static int snd_cx88_hw_params(struct snd_pcm_substream * substream, videobuf_dma_init_kernel(&buf->vb.dma,PCI_DMA_FROMDEVICE, (PAGE_ALIGN(buf->vb.size) >> PAGE_SHIFT)); - videobuf_dma_pci_map(chip->pci,&buf->vb.dma); + videobuf_pci_dma_map(chip->pci,&buf->vb.dma); cx88_risc_databuffer(chip->pci, &buf->risc, diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c index a502a4d6e4ae..e100d8ef369a 100644 --- a/drivers/media/video/cx88/cx88-blackbird.c +++ b/drivers/media/video/cx88/cx88-blackbird.c @@ -1341,7 +1341,7 @@ bb_buf_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, enum v4l2_field field) { struct cx8802_fh *fh = q->priv_data; - return cx8802_buf_prepare(fh->dev, (struct cx88_buffer*)vb, field); + return cx8802_buf_prepare(q, fh->dev, (struct cx88_buffer*)vb, field); } static void @@ -1354,8 +1354,7 @@ bb_buf_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) static void bb_buf_release(struct videobuf_queue *q, struct videobuf_buffer *vb) { - struct cx8802_fh *fh = q->priv_data; - cx88_free_buffer(fh->dev->pci, (struct cx88_buffer*)vb); + cx88_free_buffer(q, (struct cx88_buffer*)vb); } static struct videobuf_queue_ops blackbird_qops = { diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c index c2cdbafdb77b..2c3d9f1999be 100644 --- a/drivers/media/video/cx88/cx88-core.c +++ b/drivers/media/video/cx88/cx88-core.c @@ -213,13 +213,13 @@ int cx88_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc, } void -cx88_free_buffer(struct pci_dev *pci, struct cx88_buffer *buf) +cx88_free_buffer(struct videobuf_queue *q, struct cx88_buffer *buf) { BUG_ON(in_interrupt()); videobuf_waiton(&buf->vb,0,0); - videobuf_dma_pci_unmap(pci, &buf->vb.dma); + videobuf_dma_unmap(q, &buf->vb.dma); videobuf_dma_free(&buf->vb.dma); - btcx_riscmem_free(pci, &buf->risc); + btcx_riscmem_free((struct pci_dev *)q->dev, &buf->risc); buf->vb.state = STATE_NEEDS_INIT; } diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index a9fc2695b157..f0ea9b5cdbc2 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c @@ -90,7 +90,7 @@ static int dvb_buf_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, enum v4l2_field field) { struct cx8802_dev *dev = q->priv_data; - return cx8802_buf_prepare(dev, (struct cx88_buffer*)vb,field); + return cx8802_buf_prepare(q, dev, (struct cx88_buffer*)vb,field); } static void dvb_buf_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) @@ -101,8 +101,7 @@ static void dvb_buf_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) static void dvb_buf_release(struct videobuf_queue *q, struct videobuf_buffer *vb) { - struct cx8802_dev *dev = q->priv_data; - cx88_free_buffer(dev->pci, (struct cx88_buffer*)vb); + cx88_free_buffer(q, (struct cx88_buffer*)vb); } static struct videobuf_queue_ops dvb_qops = { diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c index c79cc1d2bf8b..7d16888b4a86 100644 --- a/drivers/media/video/cx88/cx88-mpeg.c +++ b/drivers/media/video/cx88/cx88-mpeg.c @@ -163,8 +163,8 @@ static int cx8802_restart_queue(struct cx8802_dev *dev, /* ------------------------------------------------------------------ */ -int cx8802_buf_prepare(struct cx8802_dev *dev, struct cx88_buffer *buf, - enum v4l2_field field) +int cx8802_buf_prepare(struct videobuf_queue *q, struct cx8802_dev *dev, + struct cx88_buffer *buf, enum v4l2_field field) { int size = dev->ts_packet_size * dev->ts_packet_count; int rc; @@ -179,7 +179,7 @@ int cx8802_buf_prepare(struct cx8802_dev *dev, struct cx88_buffer *buf, buf->vb.size = size; buf->vb.field = field /*V4L2_FIELD_TOP*/; - if (0 != (rc = videobuf_iolock(dev->pci,&buf->vb,NULL))) + if (0 != (rc = videobuf_iolock(q,&buf->vb,NULL))) goto fail; cx88_risc_databuffer(dev->pci, &buf->risc, buf->vb.dma.sglist, @@ -189,36 +189,36 @@ int cx8802_buf_prepare(struct cx8802_dev *dev, struct cx88_buffer *buf, return 0; fail: - cx88_free_buffer(dev->pci,buf); + cx88_free_buffer(q,buf); return rc; } void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf) { struct cx88_buffer *prev; - struct cx88_dmaqueue *q = &dev->mpegq; + struct cx88_dmaqueue *cx88q = &dev->mpegq; dprintk( 1, "cx8802_buf_queue\n" ); /* add jump to stopper */ buf->risc.jmp[0] = cpu_to_le32(RISC_JUMP | RISC_IRQ1 | RISC_CNT_INC); - buf->risc.jmp[1] = cpu_to_le32(q->stopper.dma); + buf->risc.jmp[1] = cpu_to_le32(cx88q->stopper.dma); - if (list_empty(&q->active)) { + if (list_empty(&cx88q->active)) { dprintk( 0, "queue is empty - first active\n" ); - list_add_tail(&buf->vb.queue,&q->active); - cx8802_start_dma(dev, q, buf); + list_add_tail(&buf->vb.queue,&cx88q->active); + cx8802_start_dma(dev, cx88q, buf); buf->vb.state = STATE_ACTIVE; - buf->count = q->count++; - mod_timer(&q->timeout, jiffies+BUFFER_TIMEOUT); + buf->count = cx88q->count++; + mod_timer(&cx88q->timeout, jiffies+BUFFER_TIMEOUT); dprintk(0,"[%p/%d] %s - first active\n", buf, buf->vb.i, __FUNCTION__); } else { dprintk( 1, "queue is not empty - append to active\n" ); - prev = list_entry(q->active.prev, struct cx88_buffer, vb.queue); - list_add_tail(&buf->vb.queue,&q->active); + prev = list_entry(cx88q->active.prev, struct cx88_buffer, vb.queue); + list_add_tail(&buf->vb.queue,&cx88q->active); buf->vb.state = STATE_ACTIVE; - buf->count = q->count++; + buf->count = cx88q->count++; prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma); dprintk( 1, "[%p/%d] %s - append to active\n", buf, buf->vb.i, __FUNCTION__); diff --git a/drivers/media/video/cx88/cx88-tvaudio.c b/drivers/media/video/cx88/cx88-tvaudio.c index da8d97ce0c4b..641a0c5a6490 100644 --- a/drivers/media/video/cx88/cx88-tvaudio.c +++ b/drivers/media/video/cx88/cx88-tvaudio.c @@ -885,6 +885,7 @@ void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual) set_audio_standard_BTSC(core, 1, EN_BTSC_FORCE_SAP); break; case V4L2_TUNER_MODE_STEREO: + case V4L2_TUNER_MODE_LANG1_LANG2: set_audio_standard_BTSC(core, 0, EN_BTSC_FORCE_STEREO); break; } @@ -905,6 +906,7 @@ void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual) EN_NICAM_FORCE_MONO2); break; case V4L2_TUNER_MODE_STEREO: + case V4L2_TUNER_MODE_LANG1_LANG2: set_audio_standard_NICAM(core, EN_NICAM_FORCE_STEREO); break; @@ -926,6 +928,7 @@ void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual) EN_A2_FORCE_MONO2); break; case V4L2_TUNER_MODE_STEREO: + case V4L2_TUNER_MODE_LANG1_LANG2: set_audio_standard_A2(core, EN_A2_FORCE_STEREO); break; diff --git a/drivers/media/video/cx88/cx88-vbi.c b/drivers/media/video/cx88/cx88-vbi.c index 9bc6c8995581..846faadc9f1c 100644 --- a/drivers/media/video/cx88/cx88-vbi.c +++ b/drivers/media/video/cx88/cx88-vbi.c @@ -175,7 +175,7 @@ vbi_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, buf->vb.size = size; buf->vb.field = V4L2_FIELD_SEQ_TB; - if (0 != (rc = videobuf_iolock(dev->pci,&buf->vb,NULL))) + if (0 != (rc = videobuf_iolock(q,&buf->vb,NULL))) goto fail; cx88_risc_buffer(dev->pci, &buf->risc, buf->vb.dma.sglist, @@ -187,7 +187,7 @@ vbi_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, return 0; fail: - cx88_free_buffer(dev->pci,buf); + cx88_free_buffer(q,buf); return rc; } @@ -227,9 +227,8 @@ vbi_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) static void vbi_release(struct videobuf_queue *q, struct videobuf_buffer *vb) { struct cx88_buffer *buf = container_of(vb,struct cx88_buffer,vb); - struct cx8800_fh *fh = q->priv_data; - cx88_free_buffer(fh->dev->pci,buf); + cx88_free_buffer(q,buf); } struct videobuf_queue_ops cx8800_vbi_qops = { diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index 6c97aa740d27..72a417b31745 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c @@ -564,7 +564,7 @@ buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, if (STATE_NEEDS_INIT == buf->vb.state) { init_buffer = 1; - if (0 != (rc = videobuf_iolock(dev->pci,&buf->vb,NULL))) + if (0 != (rc = videobuf_iolock(q,&buf->vb,NULL))) goto fail; } @@ -614,7 +614,7 @@ buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, return 0; fail: - cx88_free_buffer(dev->pci,buf); + cx88_free_buffer(q,buf); return rc; } @@ -671,9 +671,8 @@ buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) { struct cx88_buffer *buf = container_of(vb,struct cx88_buffer,vb); - struct cx8800_fh *fh = q->priv_data; - cx88_free_buffer(fh->dev->pci,buf); + cx88_free_buffer(q,buf); } static struct videobuf_queue_ops cx8800_video_qops = { @@ -1251,9 +1250,17 @@ int cx88_do_ioctl(struct inode *inode, struct file *file, int radio, { int err; - dprintk(2, "CORE IOCTL: 0x%x\n", cmd ); - if (video_debug > 1) - v4l_print_ioctl(core->name,cmd); + if (video_debug) { + if (video_debug > 1) { + if (_IOC_DIR(cmd) & _IOC_WRITE) + v4l_printk_ioctl_arg("cx88(w)",cmd, arg); + else if (!_IOC_DIR(cmd) & _IOC_READ) { + v4l_print_ioctl("cx88", cmd); + } + } else + v4l_print_ioctl(core->name,cmd); + + } switch (cmd) { /* ---------- tv norms ---------- */ @@ -1460,7 +1467,19 @@ int cx88_do_ioctl(struct inode *inode, struct file *file, int radio, static int video_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { - return video_usercopy(inode, file, cmd, arg, video_do_ioctl); + int retval; + + retval=video_usercopy(inode, file, cmd, arg, video_do_ioctl); + + if (video_debug > 1) { + if (retval < 0) { + v4l_print_ioctl("cx88(err)", cmd); + printk(KERN_DEBUG "cx88(err): errcode=%d\n",retval); + } else if (_IOC_DIR(cmd) & _IOC_READ) + v4l_printk_ioctl_arg("cx88(r)",cmd, (void *)arg); + } + + return retval; } /* ----------------------------------------------------------- */ diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index cfa8668784b4..326a25f147f6 100644 --- a/drivers/media/video/cx88/cx88.h +++ b/drivers/media/video/cx88/cx88.h @@ -27,7 +27,6 @@ #include <media/tuner.h> #include <media/tveeprom.h> -#include <media/audiochip.h> #include <media/video-buf.h> #include <media/video-buf-dvb.h> @@ -485,7 +484,7 @@ extern int cx88_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc, u32 reg, u32 mask, u32 value); extern void -cx88_free_buffer(struct pci_dev *pci, struct cx88_buffer *buf); +cx88_free_buffer(struct videobuf_queue *q, struct cx88_buffer *buf); extern void cx88_risc_disasm(struct cx88_core *core, struct btcx_riscmem *risc); @@ -577,8 +576,8 @@ void cx88_ir_irq(struct cx88_core *core); /* ----------------------------------------------------------- */ /* cx88-mpeg.c */ -int cx8802_buf_prepare(struct cx8802_dev *dev, struct cx88_buffer *buf, - enum v4l2_field field); +int cx8802_buf_prepare(struct videobuf_queue *q,struct cx8802_dev *dev, + struct cx88_buffer *buf, enum v4l2_field field); void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf); void cx8802_cancel_buffers(struct cx8802_dev *dev); diff --git a/drivers/usb/media/dabfirmware.h b/drivers/media/video/dabfirmware.h index d14d803566a3..d14d803566a3 100644 --- a/drivers/usb/media/dabfirmware.h +++ b/drivers/media/video/dabfirmware.h diff --git a/drivers/usb/media/dabusb.c b/drivers/media/video/dabusb.c index 1774ab7a40d2..b9ba95f5e026 100644 --- a/drivers/usb/media/dabusb.c +++ b/drivers/media/video/dabusb.c @@ -86,7 +86,7 @@ static int dabusb_add_buf_tail (pdabusb_t s, struct list_head *dst, struct list_ return ret; } /*-------------------------------------------------------------------*/ -#ifdef DEBUG +#ifdef DEBUG static void dump_urb (struct urb *urb) { dbg("urb :%p", urb); @@ -136,7 +136,7 @@ static int dabusb_free_queue (struct list_head *q) for (p = q->next; p != q;) { b = list_entry (p, buff_t, buff_list); -#ifdef DEBUG +#ifdef DEBUG dump_urb(b->purb); #endif kfree(b->purb->transfer_buffer); @@ -287,7 +287,7 @@ static int dabusb_bulk (pdabusb_t s, pbulk_transfer_t pb) } } - + if( ret == -EPIPE ) { warn("CLEAR_FEATURE request to remove STALL condition."); if(usb_clear_halt(s->usbdev, usb_pipeendpoint(pipe))) @@ -328,7 +328,7 @@ static int dabusb_loadmem (pdabusb_t s, const char *fname) PINTEL_HEX_RECORD ptr = firmware; dbg("Enter dabusb_loadmem (internal)"); - + ret = dabusb_8051_reset (s, 1); while (ptr->Type == 0) { @@ -449,7 +449,7 @@ static int dabusb_startrek (pdabusb_t s) if (!list_empty (&s->free_buff_list)) { pbuff_t end; int ret; - + while (!dabusb_add_buf_tail (s, &s->rec_buff_list, &s->free_buff_list)) { dbg("submitting: end:%p s->rec_buff_list:%p", s->rec_buff_list.prev, &s->rec_buff_list); @@ -506,7 +506,7 @@ static ssize_t dabusb_read (struct file *file, char __user *buf, size_t count, l err("error: rec_buf_list is empty"); goto err; } - + b = list_entry (s->rec_buff_list.next, buff_t, buff_list); purb = b->purb; @@ -783,9 +783,9 @@ static void dabusb_disconnect (struct usb_interface *intf) pdabusb_t s = usb_get_intfdata (intf); dbg("dabusb_disconnect"); - + init_waitqueue_entry(&__wait, current); - + usb_set_intfdata (intf, NULL); if (s) { usb_deregister_dev (intf, &dabusb_class); @@ -797,7 +797,7 @@ static void dabusb_disconnect (struct usb_interface *intf) schedule(); current->state = TASK_RUNNING; remove_wait_queue(&s->remove_ok, &__wait); - + s->usbdev = NULL; s->overruns = 0; } diff --git a/drivers/usb/media/dabusb.h b/drivers/media/video/dabusb.h index 96b03e4af8b9..00eb34c863eb 100644 --- a/drivers/usb/media/dabusb.h +++ b/drivers/media/video/dabusb.h @@ -10,7 +10,7 @@ typedef struct #define DABUSB_VERSION 0x1000 #define IOCTL_DAB_BULK _IOWR('d', 0x30, bulk_transfer_t) #define IOCTL_DAB_OVERRUNS _IOR('d', 0x15, int) -#define IOCTL_DAB_VERSION _IOR('d', 0x3f, int) +#define IOCTL_DAB_VERSION _IOR('d', 0x3f, int) #ifdef __KERNEL__ @@ -36,7 +36,7 @@ typedef struct struct list_head rec_buff_list; } dabusb_t,*pdabusb_t; -typedef struct +typedef struct { pdabusb_t s; struct urb *purb; diff --git a/drivers/usb/media/dsbr100.c b/drivers/media/video/dsbr100.c index 25646804d5be..3b4e9985c3d7 100644 --- a/drivers/usb/media/dsbr100.c +++ b/drivers/media/video/dsbr100.c @@ -37,28 +37,28 @@ Markus: Updates for 2.6.x kernels, code layout changes, name sanitizing Version 0.30: - Markus: Updates for 2.5.x kernel and more ISO compliant source + Markus: Updates for 2.5.x kernel and more ISO compliant source Version 0.25: - PSL and Markus: Cleanup, radio now doesn't stop on device close + PSL and Markus: Cleanup, radio now doesn't stop on device close Version 0.24: - Markus: Hope I got these silly VIDEO_TUNER_LOW issues finally + Markus: Hope I got these silly VIDEO_TUNER_LOW issues finally right. Some minor cleanup, improved standalone compilation Version 0.23: - Markus: Sign extension bug fixed by declaring transfer_buffer unsigned + Markus: Sign extension bug fixed by declaring transfer_buffer unsigned Version 0.22: - Markus: Some (brown bag) cleanup in what VIDIOCSTUNER returns, + Markus: Some (brown bag) cleanup in what VIDIOCSTUNER returns, thanks to Mike Cox for pointing the problem out. Version 0.21: - Markus: Minor cleanup, warnings if something goes wrong, lame attempt + Markus: Minor cleanup, warnings if something goes wrong, lame attempt to adhere to Documentation/CodingStyle - Version 0.2: - Brad Hards <bradh@dynamite.com.au>: Fixes to make it work as non-module + Version 0.2: + Brad Hards <bradh@dynamite.com.au>: Fixes to make it work as non-module Markus: Copyright clarification Version 0.01: Markus: initial release @@ -163,11 +163,11 @@ static struct usb_driver usb_dsbr100_driver = { static int dsbr100_start(dsbr100_device *radio) { if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), - USB_REQ_GET_STATUS, + USB_REQ_GET_STATUS, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, 0x00, 0xC7, radio->transfer_buffer, 8, 300)<0 || usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), - DSB100_ONOFF, + DSB100_ONOFF, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, 0x01, 0x00, radio->transfer_buffer, 8, 300)<0) return -1; @@ -179,11 +179,11 @@ static int dsbr100_start(dsbr100_device *radio) static int dsbr100_stop(dsbr100_device *radio) { if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), - USB_REQ_GET_STATUS, + USB_REQ_GET_STATUS, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, 0x16, 0x1C, radio->transfer_buffer, 8, 300)<0 || usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), - DSB100_ONOFF, + DSB100_ONOFF, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, 0x00, 0x00, radio->transfer_buffer, 8, 300)<0) return -1; @@ -195,16 +195,16 @@ static int dsbr100_setfreq(dsbr100_device *radio, int freq) { freq = (freq/16*80)/1000+856; if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), - DSB100_TUNE, + DSB100_TUNE, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, - (freq>>8)&0x00ff, freq&0xff, + (freq>>8)&0x00ff, freq&0xff, radio->transfer_buffer, 8, 300)<0 || usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), - USB_REQ_GET_STATUS, + USB_REQ_GET_STATUS, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, 0x96, 0xB7, radio->transfer_buffer, 8, 300)<0 || usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), - USB_REQ_GET_STATUS, + USB_REQ_GET_STATUS, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, 0x00, 0x24, radio->transfer_buffer, 8, 300)<0) { radio->stereo = -1; @@ -219,7 +219,7 @@ sees a stereo signal or not. Pity. */ static void dsbr100_getstat(dsbr100_device *radio) { if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), - USB_REQ_GET_STATUS, + USB_REQ_GET_STATUS, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, 0x00 , 0x24, radio->transfer_buffer, 8, 300)<0) radio->stereo = -1; @@ -232,7 +232,7 @@ static void dsbr100_getstat(dsbr100_device *radio) /* check if the device is present and register with v4l and usb if it is */ -static int usb_dsbr100_probe(struct usb_interface *intf, +static int usb_dsbr100_probe(struct usb_interface *intf, const struct usb_device_id *id) { dsbr100_device *radio; @@ -243,7 +243,7 @@ static int usb_dsbr100_probe(struct usb_interface *intf, kfree(radio); return -ENOMEM; } - memcpy(radio->videodev, &dsbr100_videodev_template, + memcpy(radio->videodev, &dsbr100_videodev_template, sizeof(dsbr100_videodev_template)); radio->removed = 0; radio->users = 0; @@ -310,7 +310,7 @@ static int usb_dsbr100_do_ioctl(struct inode *inode, struct file *file, struct video_tuner *v = arg; dsbr100_getstat(radio); - if(v->tuner) /* Only 1 tuner */ + if(v->tuner) /* Only 1 tuner */ return -EINVAL; v->rangelow = FREQ_MIN*FREQ_MUL; v->rangehigh = FREQ_MAX*FREQ_MUL; @@ -355,12 +355,12 @@ static int usb_dsbr100_do_ioctl(struct inode *inode, struct file *file, v->volume = 1; v->step = 1; strcpy(v->name, "Radio"); - return 0; + return 0; } case VIDIOCSAUDIO: { struct video_audio *v = arg; - if (v->audio) + if (v->audio) return -EINVAL; if (v->flags&VIDEO_AUDIO_MUTE) { if (dsbr100_stop(radio)==-1) diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index 4e22fc4889e1..f62fd706b45a 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c @@ -28,10 +28,10 @@ #include <linux/i2c.h> #include <linux/usb.h> #include <media/tuner.h> -#include <media/audiochip.h> +#include <media/msp3400.h> #include <media/tveeprom.h> +#include <media/audiochip.h> #include <media/v4l2-common.h> -#include "msp3400.h" #include "em28xx.h" @@ -147,11 +147,12 @@ struct em28xx_board em28xx_boards[] = { .input = {{ .type = EM28XX_VMUX_TELEVISION, .vmux = 0, - .amux = 6, + .amux = MSP_INPUT_DEFAULT, },{ .type = EM28XX_VMUX_SVIDEO, .vmux = 2, - .amux = 1, + .amux = MSP_INPUT(MSP_IN_SCART_1, MSP_IN_TUNER_1, + MSP_DSP_OUT_SCART, MSP_DSP_OUT_SCART), }}, }, [EM2820_BOARD_MSI_VOX_USB_2] = { diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 780342f7b239..dfba33d0fa61 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c @@ -38,6 +38,7 @@ #include "em28xx.h" #include <media/tuner.h> #include <media/v4l2-common.h> +#include <media/msp3400.h> #define DRIVER_AUTHOR "Ludovico Cavedon <cavedon@sssup.it>, " \ "Markus Rechberger <mrechberger@gmail.com>, " \ @@ -216,9 +217,14 @@ static void video_mux(struct em28xx *dev, int index) em28xx_videodbg("Setting input index=%d, vmux=%d, amux=%d\n",index,input,dev->ctl_ainput); if (dev->has_msp34xx) { + struct v4l2_routing route; + if (dev->i2s_speed) em28xx_i2c_call_clients(dev, VIDIOC_INT_I2S_CLOCK_FREQ, &dev->i2s_speed); - em28xx_i2c_call_clients(dev, VIDIOC_S_AUDIO, &dev->ctl_ainput); + route.input = dev->ctl_ainput; + route.output = MSP_OUTPUT(MSP_OUT_SCART1_DA); + /* Note: this is msp3400 specific */ + em28xx_i2c_call_clients(dev, VIDIOC_INT_S_AUDIO_ROUTING, &route); ainput = EM28XX_AUDIO_SRC_TUNER; em28xx_audio_source(dev, ainput); } else { diff --git a/drivers/media/video/et61x251/Makefile b/drivers/media/video/et61x251/Makefile new file mode 100644 index 000000000000..2ff4db9ec882 --- /dev/null +++ b/drivers/media/video/et61x251/Makefile @@ -0,0 +1,4 @@ +et61x251-objs := et61x251_core.o et61x251_tas5130d1b.o + +obj-$(CONFIG_USB_ET61X251) += et61x251.o + diff --git a/drivers/usb/media/et61x251.h b/drivers/media/video/et61x251/et61x251.h index eee8afc9be72..2e5ca4032489 100644 --- a/drivers/usb/media/et61x251.h +++ b/drivers/media/video/et61x251/et61x251.h @@ -180,7 +180,7 @@ et61x251_match_id(struct et61x251_device* cam, const struct usb_device_id *id) void et61x251_attach_sensor(struct et61x251_device* cam, - struct et61x251_sensor* sensor) + struct et61x251_sensor* sensor) { memcpy(&cam->sensor, sensor, sizeof(struct et61x251_sensor)); } @@ -199,7 +199,7 @@ do { \ dev_info(&cam->usbdev->dev, fmt "\n", ## args); \ else if ((level) >= 3) \ dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ - __FUNCTION__, __LINE__ , ## args); \ + __FUNCTION__, __LINE__ , ## args); \ } \ } while (0) # define KDBG(level, fmt, args...) \ @@ -209,7 +209,7 @@ do { \ pr_info("et61x251: " fmt "\n", ## args); \ else if ((level) == 3) \ pr_debug("et61x251: [%s:%d] " fmt "\n", __FUNCTION__, \ - __LINE__ , ## args); \ + __LINE__ , ## args); \ } \ } while (0) # define V4LDBG(level, name, cmd) \ @@ -226,7 +226,7 @@ do { \ #undef PDBG #define PDBG(fmt, args...) \ dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ - __FUNCTION__, __LINE__ , ## args) + __FUNCTION__, __LINE__ , ## args) #undef PDBGG #define PDBGG(fmt, args...) do {;} while(0) /* placeholder */ diff --git a/drivers/usb/media/et61x251_core.c b/drivers/media/video/et61x251/et61x251_core.c index 7cc01b828b3d..dfc9dd732c9d 100644 --- a/drivers/usb/media/et61x251_core.c +++ b/drivers/media/video/et61x251/et61x251_core.c @@ -44,7 +44,7 @@ /*****************************************************************************/ #define ET61X251_MODULE_NAME "V4L2 driver for ET61X[12]51 " \ - "PC Camera Controllers" + "PC Camera Controllers" #define ET61X251_MODULE_AUTHOR "(C) 2006 Luca Risolia" #define ET61X251_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>" #define ET61X251_MODULE_LICENSE "GPL" @@ -63,68 +63,68 @@ MODULE_LICENSE(ET61X251_MODULE_LICENSE); static short video_nr[] = {[0 ... ET61X251_MAX_DEVICES-1] = -1}; module_param_array(video_nr, short, NULL, 0444); MODULE_PARM_DESC(video_nr, - "\n<-1|n[,...]> Specify V4L2 minor mode number." - "\n -1 = use next available (default)" - "\n n = use minor number n (integer >= 0)" - "\nYou can specify up to " - __MODULE_STRING(ET61X251_MAX_DEVICES) " cameras this way." - "\nFor example:" - "\nvideo_nr=-1,2,-1 would assign minor number 2 to" - "\nthe second registered camera and use auto for the first" - "\none and for every other camera." - "\n"); + "\n<-1|n[,...]> Specify V4L2 minor mode number." + "\n -1 = use next available (default)" + "\n n = use minor number n (integer >= 0)" + "\nYou can specify up to " + __MODULE_STRING(ET61X251_MAX_DEVICES) " cameras this way." + "\nFor example:" + "\nvideo_nr=-1,2,-1 would assign minor number 2 to" + "\nthe second registered camera and use auto for the first" + "\none and for every other camera." + "\n"); static short force_munmap[] = {[0 ... ET61X251_MAX_DEVICES-1] = - ET61X251_FORCE_MUNMAP}; + ET61X251_FORCE_MUNMAP}; module_param_array(force_munmap, bool, NULL, 0444); MODULE_PARM_DESC(force_munmap, - "\n<0|1[,...]> Force the application to unmap previously" - "\nmapped buffer memory before calling any VIDIOC_S_CROP or" - "\nVIDIOC_S_FMT ioctl's. Not all the applications support" - "\nthis feature. This parameter is specific for each" - "\ndetected camera." - "\n 0 = do not force memory unmapping" - "\n 1 = force memory unmapping (save memory)" - "\nDefault value is "__MODULE_STRING(SN9C102_FORCE_MUNMAP)"." - "\n"); + "\n<0|1[,...]> Force the application to unmap previously" + "\nmapped buffer memory before calling any VIDIOC_S_CROP or" + "\nVIDIOC_S_FMT ioctl's. Not all the applications support" + "\nthis feature. This parameter is specific for each" + "\ndetected camera." + "\n 0 = do not force memory unmapping" + "\n 1 = force memory unmapping (save memory)" + "\nDefault value is "__MODULE_STRING(SN9C102_FORCE_MUNMAP)"." + "\n"); static unsigned int frame_timeout[] = {[0 ... ET61X251_MAX_DEVICES-1] = - ET61X251_FRAME_TIMEOUT}; + ET61X251_FRAME_TIMEOUT}; module_param_array(frame_timeout, uint, NULL, 0644); MODULE_PARM_DESC(frame_timeout, - "\n<n[,...]> Timeout for a video frame in seconds." - "\nThis parameter is specific for each detected camera." - "\nDefault value is " - __MODULE_STRING(ET61X251_FRAME_TIMEOUT)"." - "\n"); + "\n<n[,...]> Timeout for a video frame in seconds." + "\nThis parameter is specific for each detected camera." + "\nDefault value is " + __MODULE_STRING(ET61X251_FRAME_TIMEOUT)"." + "\n"); #ifdef ET61X251_DEBUG static unsigned short debug = ET61X251_DEBUG_LEVEL; module_param(debug, ushort, 0644); MODULE_PARM_DESC(debug, - "\n<n> Debugging information level, from 0 to 3:" - "\n0 = none (use carefully)" - "\n1 = critical errors" - "\n2 = significant informations" - "\n3 = more verbose messages" - "\nLevel 3 is useful for testing only, when only " - "one device is used." - "\nDefault value is "__MODULE_STRING(ET61X251_DEBUG_LEVEL)"." - "\n"); + "\n<n> Debugging information level, from 0 to 3:" + "\n0 = none (use carefully)" + "\n1 = critical errors" + "\n2 = significant informations" + "\n3 = more verbose messages" + "\nLevel 3 is useful for testing only, when only " + "one device is used." + "\nDefault value is "__MODULE_STRING(ET61X251_DEBUG_LEVEL)"." + "\n"); #endif /*****************************************************************************/ static u32 et61x251_request_buffers(struct et61x251_device* cam, u32 count, - enum et61x251_io_method io) + enum et61x251_io_method io) { struct v4l2_pix_format* p = &(cam->sensor.pix_format); struct v4l2_rect* r = &(cam->sensor.cropcap.bounds); const size_t imagesize = cam->module_param.force_munmap || - io == IO_READ ? - (p->width * p->height * p->priv) / 8 : - (r->width * r->height * p->priv) / 8; + io == IO_READ ? + (p->width * p->height * p->priv) / 8 : + (r->width * r->height * p->priv) / 8; void* buff = NULL; u32 i; @@ -216,7 +216,7 @@ int et61x251_write_reg(struct et61x251_device* cam, u8 value, u16 index) *buff = value; res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, - 0, index, buff, 1, ET61X251_CTRL_TIMEOUT); + 0, index, buff, 1, ET61X251_CTRL_TIMEOUT); if (res < 0) { DBG(3, "Failed to write a register (value 0x%02X, index " "0x%02X, error %d)", value, index, res); @@ -234,7 +234,7 @@ int et61x251_read_reg(struct et61x251_device* cam, u16 index) int res; res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, 0xc1, - 0, index, buff, 1, ET61X251_CTRL_TIMEOUT); + 0, index, buff, 1, ET61X251_CTRL_TIMEOUT); if (res < 0) DBG(3, "Failed to read a register (index 0x%02X, error %d)", index, res); @@ -269,7 +269,7 @@ et61x251_i2c_wait(struct et61x251_device* cam, struct et61x251_sensor* sensor) int et61x251_i2c_try_read(struct et61x251_device* cam, - struct et61x251_sensor* sensor, u8 address) + struct et61x251_sensor* sensor, u8 address) { struct usb_device* udev = cam->usbdev; u8* data = cam->control_buffer; @@ -280,14 +280,14 @@ et61x251_i2c_try_read(struct et61x251_device* cam, data[2] = cam->sensor.rsta | 0x10; data[3] = !(et61x251_read_reg(cam, 0x8b) & 0x02); res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, - 0, 0x88, data, 4, ET61X251_CTRL_TIMEOUT); + 0, 0x88, data, 4, ET61X251_CTRL_TIMEOUT); if (res < 0) err += res; err += et61x251_i2c_wait(cam, sensor); res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, 0xc1, - 0, 0x80, data, 8, ET61X251_CTRL_TIMEOUT); + 0, 0x80, data, 8, ET61X251_CTRL_TIMEOUT); if (res < 0) err += res; @@ -302,7 +302,7 @@ et61x251_i2c_try_read(struct et61x251_device* cam, int et61x251_i2c_try_write(struct et61x251_device* cam, - struct et61x251_sensor* sensor, u8 address, u8 value) + struct et61x251_sensor* sensor, u8 address, u8 value) { struct usb_device* udev = cam->usbdev; u8* data = cam->control_buffer; @@ -312,13 +312,13 @@ et61x251_i2c_try_write(struct et61x251_device* cam, data[1] = cam->sensor.i2c_slave_id; data[2] = cam->sensor.rsta | 0x12; res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, - 0, 0x88, data, 3, ET61X251_CTRL_TIMEOUT); + 0, 0x88, data, 3, ET61X251_CTRL_TIMEOUT); if (res < 0) err += res; data[0] = value; res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, - 0, 0x80, data, 1, ET61X251_CTRL_TIMEOUT); + 0, 0x80, data, 1, ET61X251_CTRL_TIMEOUT); if (res < 0) err += res; @@ -335,8 +335,8 @@ et61x251_i2c_try_write(struct et61x251_device* cam, int et61x251_i2c_raw_write(struct et61x251_device* cam, u8 n, u8 data1, u8 data2, - u8 data3, u8 data4, u8 data5, u8 data6, u8 data7, - u8 data8, u8 address) + u8 data3, u8 data4, u8 data5, u8 data6, u8 data7, + u8 data8, u8 address) { struct usb_device* udev = cam->usbdev; u8* data = cam->control_buffer; @@ -350,7 +350,7 @@ et61x251_i2c_raw_write(struct et61x251_device* cam, u8 n, u8 data1, u8 data2, data[5] = data7; data[6] = data8; res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, - 0, 0x81, data, n-1, ET61X251_CTRL_TIMEOUT); + 0, 0x81, data, n-1, ET61X251_CTRL_TIMEOUT); if (res < 0) err += res; @@ -358,14 +358,14 @@ et61x251_i2c_raw_write(struct et61x251_device* cam, u8 n, u8 data1, u8 data2, data[1] = cam->sensor.i2c_slave_id; data[2] = cam->sensor.rsta | 0x02 | (n << 4); res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, - 0, 0x88, data, 3, ET61X251_CTRL_TIMEOUT); + 0, 0x88, data, 3, ET61X251_CTRL_TIMEOUT); if (res < 0) err += res; /* Start writing through the serial interface */ data[0] = data1; res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, - 0, 0x80, data, 1, ET61X251_CTRL_TIMEOUT); + 0, 0x80, data, 1, ET61X251_CTRL_TIMEOUT); if (res < 0) err += res; @@ -432,11 +432,11 @@ static void et61x251_urb_complete(struct urb *urb, struct pt_regs* regs) if (!(*f)) (*f) = list_entry(cam->inqueue.next, struct et61x251_frame_t, - frame); + frame); imagesize = (cam->sensor.pix_format.width * - cam->sensor.pix_format.height * - cam->sensor.pix_format.priv) / 8; + cam->sensor.pix_format.height * + cam->sensor.pix_format.priv) / 8; for (i = 0; i < urb->number_of_packets; i++) { unsigned int len, status; @@ -476,7 +476,7 @@ start_of_frame: if ((*f)->state == F_GRABBING) { if (sof && (*f)->buf.bytesused) { if (cam->sensor.pix_format.pixelformat == - V4L2_PIX_FMT_ET61X251) + V4L2_PIX_FMT_ET61X251) goto end_of_frame; else { DBG(3, "Not expected SOF detected " @@ -508,8 +508,8 @@ end_of_frame: list_move_tail(&(*f)->frame, &cam->outqueue); if (!list_empty(&cam->inqueue)) (*f) = list_entry(cam->inqueue.next, - struct et61x251_frame_t, - frame); + struct et61x251_frame_t, + frame); else (*f) = NULL; spin_unlock(&cam->queue_lock); @@ -521,7 +521,7 @@ end_of_frame: if (sof && cam->sensor.pix_format.pixelformat == - V4L2_PIX_FMT_ET61X251) + V4L2_PIX_FMT_ET61X251) goto start_of_frame; } } @@ -544,15 +544,15 @@ static int et61x251_start_transfer(struct et61x251_device* cam) struct usb_device *udev = cam->usbdev; struct urb* urb; const unsigned int wMaxPacketSize[] = {0, 256, 384, 512, 640, 768, 832, - 864, 896, 920, 956, 980, 1000, - 1022}; + 864, 896, 920, 956, 980, 1000, + 1022}; const unsigned int psz = wMaxPacketSize[ET61X251_ALTERNATE_SETTING]; s8 i, j; int err = 0; for (i = 0; i < ET61X251_URBS; i++) { cam->transfer_buffer[i] = kzalloc(ET61X251_ISO_PACKETS * psz, - GFP_KERNEL); + GFP_KERNEL); if (!cam->transfer_buffer[i]) { err = -ENOMEM; DBG(1, "Not enough memory"); @@ -653,9 +653,9 @@ static int et61x251_stream_interrupt(struct et61x251_device* cam) cam->stream = STREAM_INTERRUPT; timeout = wait_event_timeout(cam->wait_stream, - (cam->stream == STREAM_OFF) || - (cam->state & DEV_DISCONNECTED), - ET61X251_URB_TIMEOUT); + (cam->stream == STREAM_OFF) || + (cam->state & DEV_DISCONNECTED), + ET61X251_URB_TIMEOUT); if (cam->state & DEV_DISCONNECTED) return -ENODEV; else if (cam->stream != STREAM_OFF) { @@ -699,7 +699,7 @@ static u8 et61x251_strtou8(const char* buff, size_t len, ssize_t* count) /* NOTE 1: being inside one of the following methods implies that the v4l - device exists for sure (see kobjects and reference counters) + device exists for sure (see kobjects and reference counters) NOTE 2: buffers are PAGE_SIZE long */ @@ -964,13 +964,13 @@ et61x251_store_i2c_val(struct class_device* cd, const char* buf, size_t len) static CLASS_DEVICE_ATTR(reg, S_IRUGO | S_IWUSR, - et61x251_show_reg, et61x251_store_reg); + et61x251_show_reg, et61x251_store_reg); static CLASS_DEVICE_ATTR(val, S_IRUGO | S_IWUSR, - et61x251_show_val, et61x251_store_val); + et61x251_show_val, et61x251_store_val); static CLASS_DEVICE_ATTR(i2c_reg, S_IRUGO | S_IWUSR, - et61x251_show_i2c_reg, et61x251_store_i2c_reg); + et61x251_show_i2c_reg, et61x251_store_i2c_reg); static CLASS_DEVICE_ATTR(i2c_val, S_IRUGO | S_IWUSR, - et61x251_show_i2c_val, et61x251_store_i2c_val); + et61x251_show_i2c_val, et61x251_store_i2c_val); static void et61x251_create_sysfs(struct et61x251_device* cam) @@ -990,7 +990,7 @@ static void et61x251_create_sysfs(struct et61x251_device* cam) static int et61x251_set_pix_format(struct et61x251_device* cam, - struct v4l2_pix_format* pix) + struct v4l2_pix_format* pix) { int r, err = 0; @@ -1007,7 +1007,7 @@ et61x251_set_pix_format(struct et61x251_device* cam, static int et61x251_set_compression(struct et61x251_device* cam, - struct v4l2_jpegcompression* compression) + struct v4l2_jpegcompression* compression) { int r, err = 0; @@ -1049,9 +1049,9 @@ et61x251_set_crop(struct et61x251_device* cam, struct v4l2_rect* rect) { struct et61x251_sensor* s = &cam->sensor; u16 fmw_sx = (u16)(rect->left - s->cropcap.bounds.left + - s->active_pixel.left), + s->active_pixel.left), fmw_sy = (u16)(rect->top - s->cropcap.bounds.top + - s->active_pixel.top), + s->active_pixel.top), fmw_length = (u16)(rect->width), fmw_height = (u16)(rect->height); int err = 0; @@ -1061,8 +1061,8 @@ et61x251_set_crop(struct et61x251_device* cam, struct v4l2_rect* rect) err += et61x251_write_reg(cam, fmw_length & 0xff, 0x6b); err += et61x251_write_reg(cam, fmw_height & 0xff, 0x6c); err += et61x251_write_reg(cam, (fmw_sx >> 8) | ((fmw_sy & 0x300) >> 6) - | ((fmw_length & 0x300) >> 4) - | ((fmw_height & 0x300) >> 2), 0x6d); + | ((fmw_length & 0x300) >> 4) + | ((fmw_height & 0x300) >> 2), 0x6d); if (err) return -EIO; @@ -1203,8 +1203,8 @@ static int et61x251_open(struct inode* inode, struct file* filp) } mutex_unlock(&cam->dev_mutex); err = wait_event_interruptible_exclusive(cam->open, - cam->state & DEV_DISCONNECTED - || !cam->users); + cam->state & DEV_DISCONNECTED + || !cam->users); if (err) { up_read(&et61x251_disconnect); return err; @@ -1277,7 +1277,7 @@ static int et61x251_release(struct inode* inode, struct file* filp) static ssize_t et61x251_read(struct file* filp, char __user * buf, - size_t count, loff_t* f_pos) + size_t count, loff_t* f_pos) { struct et61x251_device* cam = video_get_drvdata(video_devdata(filp)); struct et61x251_frame_t* f, * i; @@ -1310,7 +1310,7 @@ et61x251_read(struct file* filp, char __user * buf, if (cam->io == IO_NONE) { if (!et61x251_request_buffers(cam, cam->nreadbuffers, - IO_READ)) { + IO_READ)) { DBG(1, "read() failed, not enough memory"); mutex_unlock(&cam->fileop_mutex); return -ENOMEM; @@ -1336,12 +1336,12 @@ et61x251_read(struct file* filp, char __user * buf, return -EAGAIN; } timeout = wait_event_interruptible_timeout - ( cam->wait_frame, - (!list_empty(&cam->outqueue)) || - (cam->state & DEV_DISCONNECTED) || - (cam->state & DEV_MISCONFIGURED), - cam->module_param.frame_timeout * - 1000 * msecs_to_jiffies(1) ); + ( cam->wait_frame, + (!list_empty(&cam->outqueue)) || + (cam->state & DEV_DISCONNECTED) || + (cam->state & DEV_MISCONFIGURED), + cam->module_param.frame_timeout * + 1000 * msecs_to_jiffies(1) ); if (timeout < 0) { mutex_unlock(&cam->fileop_mutex); return timeout; @@ -1408,7 +1408,7 @@ static unsigned int et61x251_poll(struct file *filp, poll_table *wait) if (cam->io == IO_NONE) { if (!et61x251_request_buffers(cam, cam->nreadbuffers, - IO_READ)) { + IO_READ)) { DBG(1, "poll() failed, not enough memory"); goto error; } @@ -1465,7 +1465,7 @@ static int et61x251_mmap(struct file* filp, struct vm_area_struct *vma) { struct et61x251_device* cam = video_get_drvdata(video_devdata(filp)); unsigned long size = vma->vm_end - vma->vm_start, - start = vma->vm_start; + start = vma->vm_start; void *pos; u32 i; @@ -1533,13 +1533,13 @@ et61x251_vidioc_querycap(struct et61x251_device* cam, void __user * arg) .driver = "et61x251", .version = ET61X251_MODULE_VERSION_CODE, .capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | - V4L2_CAP_STREAMING, + V4L2_CAP_STREAMING, }; strlcpy(cap.card, cam->v4ldev->name, sizeof(cap.card)); if (usb_make_path(cam->usbdev, cap.bus_info, sizeof(cap.bus_info)) < 0) strlcpy(cap.bus_info, cam->usbdev->dev.bus_id, - sizeof(cap.bus_info)); + sizeof(cap.bus_info)); if (copy_to_user(arg, &cap, sizeof(cap))) return -EFAULT; @@ -1871,7 +1871,7 @@ et61x251_vidioc_g_fmt(struct et61x251_device* cam, void __user * arg) return -EINVAL; pfmt->bytesperline = (pfmt->pixelformat==V4L2_PIX_FMT_ET61X251) - ? 0 : (pfmt->width * pfmt->priv) / 8; + ? 0 : (pfmt->width * pfmt->priv) / 8; pfmt->sizeimage = pfmt->height * ((pfmt->width*pfmt->priv)/8); pfmt->field = V4L2_FIELD_NONE; memcpy(&(format.fmt.pix), pfmt, sizeof(*pfmt)); @@ -1885,7 +1885,7 @@ et61x251_vidioc_g_fmt(struct et61x251_device* cam, void __user * arg) static int et61x251_vidioc_try_s_fmt(struct et61x251_device* cam, unsigned int cmd, - void __user * arg) + void __user * arg) { struct et61x251_sensor* s = &cam->sensor; struct v4l2_format format; @@ -1947,7 +1947,7 @@ et61x251_vidioc_try_s_fmt(struct et61x251_device* cam, unsigned int cmd, pix->priv = pfmt->priv; /* bpp */ pix->colorspace = pfmt->colorspace; pix->bytesperline = (pix->pixelformat == V4L2_PIX_FMT_ET61X251) - ? 0 : (pix->width * pix->priv) / 8; + ? 0 : (pix->width * pix->priv) / 8; pix->sizeimage = pix->height * ((pix->width * pix->priv) / 8); pix->field = V4L2_FIELD_NONE; @@ -2020,7 +2020,7 @@ static int et61x251_vidioc_g_jpegcomp(struct et61x251_device* cam, void __user * arg) { if (copy_to_user(arg, &cam->compression, - sizeof(cam->compression))) + sizeof(cam->compression))) return -EFAULT; return 0; @@ -2169,7 +2169,7 @@ et61x251_vidioc_qbuf(struct et61x251_device* cam, void __user * arg) static int et61x251_vidioc_dqbuf(struct et61x251_device* cam, struct file* filp, - void __user * arg) + void __user * arg) { struct v4l2_buffer b; struct et61x251_frame_t *f; @@ -2188,12 +2188,12 @@ et61x251_vidioc_dqbuf(struct et61x251_device* cam, struct file* filp, if (filp->f_flags & O_NONBLOCK) return -EAGAIN; timeout = wait_event_interruptible_timeout - ( cam->wait_frame, - (!list_empty(&cam->outqueue)) || - (cam->state & DEV_DISCONNECTED) || - (cam->state & DEV_MISCONFIGURED), - cam->module_param.frame_timeout * - 1000 * msecs_to_jiffies(1) ); + ( cam->wait_frame, + (!list_empty(&cam->outqueue)) || + (cam->state & DEV_DISCONNECTED) || + (cam->state & DEV_MISCONFIGURED), + cam->module_param.frame_timeout * + 1000 * msecs_to_jiffies(1) ); if (timeout < 0) return timeout; if (cam->state & DEV_DISCONNECTED) @@ -2317,7 +2317,7 @@ et61x251_vidioc_s_parm(struct et61x251_device* cam, void __user * arg) static int et61x251_ioctl_v4l2(struct inode* inode, struct file* filp, - unsigned int cmd, void __user * arg) + unsigned int cmd, void __user * arg) { struct et61x251_device* cam = video_get_drvdata(video_devdata(filp)); @@ -2411,7 +2411,7 @@ static int et61x251_ioctl_v4l2(struct inode* inode, struct file* filp, static int et61x251_ioctl(struct inode* inode, struct file* filp, - unsigned int cmd, unsigned long arg) + unsigned int cmd, unsigned long arg) { struct et61x251_device* cam = video_get_drvdata(video_devdata(filp)); int err = 0; @@ -2518,7 +2518,7 @@ et61x251_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) mutex_lock(&cam->dev_mutex); err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER, - video_nr[dev_nr]); + video_nr[dev_nr]); if (err) { DBG(1, "V4L2 device registration failed"); if (err == -ENFILE && video_nr[dev_nr] == -1) diff --git a/drivers/usb/media/et61x251_sensor.h b/drivers/media/video/et61x251/et61x251_sensor.h index 56841ae8a207..65edd08dc386 100644 --- a/drivers/usb/media/et61x251_sensor.h +++ b/drivers/media/video/et61x251/et61x251_sensor.h @@ -47,7 +47,7 @@ et61x251_match_id(struct et61x251_device* cam, const struct usb_device_id *id); extern void et61x251_attach_sensor(struct et61x251_device* cam, - struct et61x251_sensor* sensor); + struct et61x251_sensor* sensor); /*****************************************************************************/ @@ -56,13 +56,13 @@ extern int et61x251_read_reg(struct et61x251_device*, u16 index); extern int et61x251_i2c_write(struct et61x251_device*, u8 address, u8 value); extern int et61x251_i2c_read(struct et61x251_device*, u8 address); extern int et61x251_i2c_try_write(struct et61x251_device*, - struct et61x251_sensor*, u8 address, - u8 value); + struct et61x251_sensor*, u8 address, + u8 value); extern int et61x251_i2c_try_read(struct et61x251_device*, - struct et61x251_sensor*, u8 address); + struct et61x251_sensor*, u8 address); extern int et61x251_i2c_raw_write(struct et61x251_device*, u8 n, u8 data1, - u8 data2, u8 data3, u8 data4, u8 data5, - u8 data6, u8 data7, u8 data8, u8 address); + u8 data2, u8 data3, u8 data4, u8 data5, + u8 data6, u8 data7, u8 data8, u8 address); /*****************************************************************************/ @@ -100,13 +100,13 @@ struct et61x251_sensor { int (*init)(struct et61x251_device* cam); int (*get_ctrl)(struct et61x251_device* cam, - struct v4l2_control* ctrl); + struct v4l2_control* ctrl); int (*set_ctrl)(struct et61x251_device* cam, - const struct v4l2_control* ctrl); + const struct v4l2_control* ctrl); int (*set_crop)(struct et61x251_device* cam, - const struct v4l2_rect* rect); + const struct v4l2_rect* rect); int (*set_pix_format)(struct et61x251_device* cam, - const struct v4l2_pix_format* pix); + const struct v4l2_pix_format* pix); /* Private */ struct v4l2_queryctrl _qctrl[ET61X251_MAX_CTRLS]; diff --git a/drivers/usb/media/et61x251_tas5130d1b.c b/drivers/media/video/et61x251/et61x251_tas5130d1b.c index 3998d76a307a..a7d65b82b2fb 100644 --- a/drivers/usb/media/et61x251_tas5130d1b.c +++ b/drivers/media/video/et61x251/et61x251_tas5130d1b.c @@ -46,20 +46,20 @@ static int tas5130d1b_init(struct et61x251_device* cam) static int tas5130d1b_set_ctrl(struct et61x251_device* cam, - const struct v4l2_control* ctrl) + const struct v4l2_control* ctrl) { int err = 0; switch (ctrl->id) { case V4L2_CID_GAIN: err += et61x251_i2c_raw_write(cam, 2, 0x20, - 0xf6-ctrl->value, 0, 0, 0, - 0, 0, 0, 0); + 0xf6-ctrl->value, 0, 0, 0, + 0, 0, 0, 0); break; case V4L2_CID_EXPOSURE: err += et61x251_i2c_raw_write(cam, 2, 0x40, - 0x47-ctrl->value, 0, 0, 0, - 0, 0, 0, 0); + 0x47-ctrl->value, 0, 0, 0, + 0, 0, 0, 0); break; default: return -EINVAL; diff --git a/drivers/media/video/font.h b/drivers/media/video/font.h new file mode 100644 index 000000000000..8b1fecc37599 --- /dev/null +++ b/drivers/media/video/font.h @@ -0,0 +1,407 @@ +static unsigned char rom8x16_bits[] = { +/* Character 0 (0x30): + ht=16, width=8 + +--------+ + | | + | | + | ***** | + |** ** | + |** ** | + |** *** | + |** **** | + |**** ** | + |*** ** | + |** ** | + |** ** | + | ***** | + | | + | | + | | + | | + +--------+ */ +0x00, +0x00, +0x7c, +0xc6, +0xc6, +0xce, +0xde, +0xf6, +0xe6, +0xc6, +0xc6, +0x7c, +0x00, +0x00, +0x00, +0x00, + +/* Character 1 (0x31): + ht=16, width=8 + +--------+ + | | + | | + | ** | + | **** | + | ** | + | ** | + | ** | + | ** | + | ** | + | ** | + | ** | + | ****** | + | | + | | + | | + | | + +--------+ */ +0x00, +0x00, +0x18, +0x78, +0x18, +0x18, +0x18, +0x18, +0x18, +0x18, +0x18, +0x7e, +0x00, +0x00, +0x00, +0x00, + +/* Character 2 (0x32): + ht=16, width=8 + +--------+ + | | + | | + | ***** | + |** ** | + |** ** | + | ** | + | ** | + | ** | + | ** | + | ** | + |** ** | + |******* | + | | + | | + | | + | | + +--------+ */ +0x00, +0x00, +0x7c, +0xc6, +0xc6, +0x06, +0x0c, +0x18, +0x30, +0x60, +0xc6, +0xfe, +0x00, +0x00, +0x00, +0x00, + +/* Character 3 (0x33): + ht=16, width=8 + +--------+ + | | + | | + | ***** | + |** ** | + | ** | + | ** | + | **** | + | ** | + | ** | + | ** | + |** ** | + | ***** | + | | + | | + | | + | | + +--------+ */ +0x00, +0x00, +0x7c, +0xc6, +0x06, +0x06, +0x3c, +0x06, +0x06, +0x06, +0xc6, +0x7c, +0x00, +0x00, +0x00, +0x00, + +/* Character 4 (0x34): + ht=16, width=8 + +--------+ + | | + | | + | ** | + | *** | + | **** | + | ** ** | + |** ** | + |** ** | + |******* | + | ** | + | ** | + | **** | + | | + | | + | | + | | + +--------+ */ +0x00, +0x00, +0x0c, +0x1c, +0x3c, +0x6c, +0xcc, +0xcc, +0xfe, +0x0c, +0x0c, +0x1e, +0x00, +0x00, +0x00, +0x00, + +/* Character 5 (0x35): + ht=16, width=8 + +--------+ + | | + | | + |******* | + |** | + |** | + |** | + |****** | + | ** | + | ** | + | ** | + |** ** | + | ***** | + | | + | | + | | + | | + +--------+ */ +0x00, +0x00, +0xfe, +0xc0, +0xc0, +0xc0, +0xfc, +0x06, +0x06, +0x06, +0xc6, +0x7c, +0x00, +0x00, +0x00, +0x00, + +/* Character 6 (0x36): + ht=16, width=8 + +--------+ + | | + | | + | ***** | + |** ** | + |** | + |** | + |****** | + |** ** | + |** ** | + |** ** | + |** ** | + | ***** | + | | + | | + | | + | | + +--------+ */ +0x00, +0x00, +0x7c, +0xc6, +0xc0, +0xc0, +0xfc, +0xc6, +0xc6, +0xc6, +0xc6, +0x7c, +0x00, +0x00, +0x00, +0x00, + +/* Character 7 (0x37): + ht=16, width=8 + +--------+ + | | + | | + |******* | + |** ** | + | ** | + | ** | + | ** | + | ** | + | ** | + | ** | + | ** | + | ** | + | | + | | + | | + | | + +--------+ */ +0x00, +0x00, +0xfe, +0xc6, +0x06, +0x0c, +0x18, +0x30, +0x30, +0x30, +0x30, +0x30, +0x00, +0x00, +0x00, +0x00, + +/* Character 8 (0x38): + ht=16, width=8 + +--------+ + | | + | | + | ***** | + |** ** | + |** ** | + |** ** | + | ***** | + |** ** | + |** ** | + |** ** | + |** ** | + | ***** | + | | + | | + | | + | | + +--------+ */ +0x00, +0x00, +0x7c, +0xc6, +0xc6, +0xc6, +0x7c, +0xc6, +0xc6, +0xc6, +0xc6, +0x7c, +0x00, +0x00, +0x00, +0x00, + +/* Character 9 (0x39): + ht=16, width=8 + +--------+ + | | + | | + | ***** | + |** ** | + |** ** | + |** ** | + |** ** | + | ****** | + | ** | + | ** | + |** ** | + | ***** | + | | + | | + | | + | | + +--------+ */ +0x00, +0x00, +0x7c, +0xc6, +0xc6, +0xc6, +0xc6, +0x7e, +0x06, +0x06, +0xc6, +0x7c, +0x00, +0x00, +0x00, +0x00, +/* Character : (0x3a): + ht=16, width=8 + +--------+ + | | + | | + | | + | | + | | + | ** | + | ** | + | | + | | + | ** | + | ** | + | | + | | + | | + | | + | | + +--------+ */ +0x00, +0x00, +0x00, +0x00, +0x00, +0x0c, +0x0c, +0x00, +0x00, +0x0c, +0x0c, +0x00, +0x00, +0x00, +0x00, +0x00, +}; diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c index 11ea9765769c..c40e8ba9a2ea 100644 --- a/drivers/media/video/msp3400-driver.c +++ b/drivers/media/video/msp3400-driver.c @@ -53,10 +53,11 @@ #include <linux/videodev.h> #include <linux/videodev2.h> #include <media/v4l2-common.h> -#include <media/audiochip.h> +#include <media/tvaudio.h> +#include <media/msp3400.h> #include <linux/kthread.h> #include <linux/suspend.h> -#include "msp3400.h" +#include "msp3400-driver.h" /* ---------------------------------------------------------------------- */ @@ -245,31 +246,31 @@ int msp_write_dsp(struct i2c_client *client, int addr, int val) * ----------------------------------------------------------------------- */ static int scarts[3][9] = { - /* MASK IN1 IN2 IN1_DA IN2_DA IN3 IN4 MONO MUTE */ + /* MASK IN1 IN2 IN3 IN4 IN1_DA IN2_DA MONO MUTE */ /* SCART DSP Input select */ - { 0x0320, 0x0000, 0x0200, -1, -1, 0x0300, 0x0020, 0x0100, 0x0320 }, + { 0x0320, 0x0000, 0x0200, 0x0300, 0x0020, -1, -1, 0x0100, 0x0320 }, /* SCART1 Output select */ - { 0x0c40, 0x0440, 0x0400, 0x0c00, 0x0040, 0x0000, 0x0840, 0x0800, 0x0c40 }, + { 0x0c40, 0x0440, 0x0400, 0x0000, 0x0840, 0x0c00, 0x0040, 0x0800, 0x0c40 }, /* SCART2 Output select */ - { 0x3080, 0x1000, 0x1080, 0x0000, 0x0080, 0x2080, 0x3080, 0x2000, 0x3000 }, + { 0x3080, 0x1000, 0x1080, 0x2080, 0x3080, 0x0000, 0x0080, 0x2000, 0x3000 }, }; static char *scart_names[] = { - "mask", "in1", "in2", "in1 da", "in2 da", "in3", "in4", "mono", "mute" + "in1", "in2", "in3", "in4", "in1 da", "in2 da", "mono", "mute" }; void msp_set_scart(struct i2c_client *client, int in, int out) { struct msp_state *state = i2c_get_clientdata(client); - state->in_scart=in; + state->in_scart = in; - if (in >= 1 && in <= 8 && out >= 0 && out <= 2) { - if (-1 == scarts[out][in]) + if (in >= 0 && in <= 7 && out >= 0 && out <= 2) { + if (-1 == scarts[out][in + 1]) return; - state->acb &= ~scarts[out][SCART_MASK]; - state->acb |= scarts[out][in]; + state->acb &= ~scarts[out][0]; + state->acb |= scarts[out][in + 1]; } else state->acb = 0xf60; /* Mute Input and SCART 1 Output */ @@ -336,37 +337,6 @@ void msp_set_audio(struct i2c_client *client) msp_write_dsp(client, 0x0033, loudness); } -int msp_modus(struct i2c_client *client) -{ - struct msp_state *state = i2c_get_clientdata(client); - - if (state->radio) { - v4l_dbg(1, msp_debug, client, "video mode selected to Radio\n"); - return 0x0003; - } - - if (state->v4l2_std & V4L2_STD_PAL) { - v4l_dbg(1, msp_debug, client, "video mode selected to PAL\n"); - -#if 1 - /* experimental: not sure this works with all chip versions */ - return 0x7003; -#else - /* previous value, try this if it breaks ... */ - return 0x1003; -#endif - } - if (state->v4l2_std & V4L2_STD_NTSC) { - v4l_dbg(1, msp_debug, client, "video mode selected to NTSC\n"); - return 0x2003; - } - if (state->v4l2_std & V4L2_STD_SECAM) { - v4l_dbg(1, msp_debug, client, "video mode selected to SECAM\n"); - return 0x0003; - } - return 0x0003; -} - /* ------------------------------------------------------------------------ */ @@ -585,51 +555,11 @@ static int msp_set_ctrl(struct i2c_client *client, struct v4l2_control *ctrl) static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) { struct msp_state *state = i2c_get_clientdata(client); - u16 *sarg = arg; - int scart = 0; if (msp_debug >= 2) v4l_i2c_print_ioctl(client, cmd); switch (cmd) { - case AUDC_SET_INPUT: - if (*sarg == state->input) - break; - state->input = *sarg; - switch (*sarg) { - case AUDIO_RADIO: - /* Hauppauge uses IN2 for the radio */ - state->mode = MSP_MODE_FM_RADIO; - scart = SCART_IN2; - break; - case AUDIO_EXTERN_1: - /* IN1 is often used for external input ... */ - state->mode = MSP_MODE_EXTERN; - scart = SCART_IN1; - break; - case AUDIO_EXTERN_2: - /* ... sometimes it is IN2 through ;) */ - state->mode = MSP_MODE_EXTERN; - scart = SCART_IN2; - break; - case AUDIO_TUNER: - state->mode = -1; - break; - default: - if (*sarg & AUDIO_MUTE) - msp_set_scart(client, SCART_MUTE, 0); - break; - } - if (scart) { - state->rxsubchans = V4L2_TUNER_SUB_STEREO; - msp_set_scart(client, scart, 0); - msp_write_dsp(client, 0x000d, 0x1900); - if (state->opmode != OPMODE_AUTOSELECT) - msp_set_audmode(client); - } - msp_wake_thread(client); - break; - case AUDC_SET_RADIO: if (state->radio) return 0; @@ -692,6 +622,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) if (va->mode != 0 && state->radio == 0) { state->audmode = msp_mode_v4l1_to_v4l2(va->mode); + msp_set_audmode(client); } break; } @@ -728,15 +659,6 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) break; } - /* msp34xx specific */ - case MSP_SET_MATRIX: - { - struct msp_matrix *mspm = arg; - - msp_set_scart(client, mspm->input, mspm->output); - break; - } - /* --- v4l2 ioctls --- */ case VIDIOC_S_STD: { @@ -750,90 +672,34 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) return 0; } - case VIDIOC_ENUMINPUT: - { - struct v4l2_input *i = arg; - - if (i->index != 0) - return -EINVAL; - - i->type = V4L2_INPUT_TYPE_TUNER; - switch (i->index) { - case AUDIO_RADIO: - strcpy(i->name, "Radio"); - break; - case AUDIO_EXTERN_1: - strcpy(i->name, "Extern 1"); - break; - case AUDIO_EXTERN_2: - strcpy(i->name, "Extern 2"); - break; - case AUDIO_TUNER: - strcpy(i->name, "Television"); - break; - default: - return -EINVAL; - } - return 0; - } - - case VIDIOC_G_AUDIO: + case VIDIOC_INT_G_AUDIO_ROUTING: { - struct v4l2_audio *a = arg; + struct v4l2_routing *rt = arg; - memset(a, 0, sizeof(*a)); - - switch (a->index) { - case AUDIO_RADIO: - strcpy(a->name, "Radio"); - break; - case AUDIO_EXTERN_1: - strcpy(a->name, "Extern 1"); - break; - case AUDIO_EXTERN_2: - strcpy(a->name, "Extern 2"); - break; - case AUDIO_TUNER: - strcpy(a->name, "Television"); - break; - default: - return -EINVAL; - } - - a->capability = V4L2_AUDCAP_STEREO; - a->mode = 0; /* TODO: add support for AVL */ + *rt = state->routing; break; } - case VIDIOC_S_AUDIO: + case VIDIOC_INT_S_AUDIO_ROUTING: { - struct v4l2_audio *sarg = arg; - - switch (sarg->index) { - case AUDIO_RADIO: - /* Hauppauge uses IN2 for the radio */ - state->mode = MSP_MODE_FM_RADIO; - scart = SCART_IN2; - break; - case AUDIO_EXTERN_1: - /* IN1 is often used for external input ... */ - state->mode = MSP_MODE_EXTERN; - scart = SCART_IN1; - break; - case AUDIO_EXTERN_2: - /* ... sometimes it is IN2 through ;) */ - state->mode = MSP_MODE_EXTERN; - scart = SCART_IN2; - break; - case AUDIO_TUNER: - state->mode = -1; - break; - } - if (scart) { - state->rxsubchans = V4L2_TUNER_SUB_STEREO; - msp_set_scart(client, scart, 0); - msp_write_dsp(client, 0x000d, 0x1900); + struct v4l2_routing *rt = arg; + int tuner = (rt->input >> 3) & 1; + int sc_in = rt->input & 0x7; + int sc1_out = rt->output & 0xf; + int sc2_out = (rt->output >> 4) & 0xf; + u16 val; + + state->routing = *rt; + if (state->opmode == OPMODE_AUTOSELECT) { + val = msp_read_dem(client, 0x30) & ~0x100; + msp_write_dem(client, 0x30, val | (tuner ? 0x100 : 0)); + } else { + val = msp_read_dem(client, 0xbb) & ~0x100; + msp_write_dem(client, 0xbb, val | (tuner ? 0x100 : 0)); } + msp_set_scart(client, sc_in, 0); + msp_set_scart(client, sc1_out, 1); + msp_set_scart(client, sc2_out, 2); msp_set_audmode(client); msp_wake_thread(client); break; @@ -866,42 +732,6 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) break; } - case VIDIOC_G_AUDOUT: - { - struct v4l2_audioout *a = (struct v4l2_audioout *)arg; - int idx = a->index; - - memset(a, 0, sizeof(*a)); - - switch (idx) { - case 0: - strcpy(a->name, "Scart1 Out"); - break; - case 1: - strcpy(a->name, "Scart2 Out"); - break; - case 2: - strcpy(a->name, "I2S Out"); - break; - default: - return -EINVAL; - } - break; - } - - case VIDIOC_S_AUDOUT: - { - struct v4l2_audioout *a = (struct v4l2_audioout *)arg; - - if (a->index < 0 || a->index > 2) - return -EINVAL; - - v4l_dbg(1, msp_debug, client, "Setting audio out on msp34xx to input %i\n", a->index); - msp_set_scart(client, state->in_scart, a->index + 1); - - break; - } - case VIDIOC_INT_I2S_CLOCK_FREQ: { u32 *a = (u32 *)arg; @@ -979,12 +809,16 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) (state->rxsubchans & V4L2_TUNER_SUB_STEREO) ? "stereo" : "mono", (state->rxsubchans & V4L2_TUNER_SUB_LANG2) ? ", dual" : ""); } else { - v4l_info(client, "Mode: %s\n", p); + if (state->opmode == OPMODE_AUTODETECT) + v4l_info(client, "Mode: %s\n", p); v4l_info(client, "Standard: %s (%s%s)\n", msp_standard_std_name(state->std), (state->rxsubchans & V4L2_TUNER_SUB_STEREO) ? "stereo" : "mono", (state->rxsubchans & V4L2_TUNER_SUB_LANG2) ? ", dual" : ""); } + v4l_info(client, "Audmode: 0x%04x\n", state->audmode); + v4l_info(client, "Routing: 0x%08x (input) 0x%08x (output)\n", + state->routing.input, state->routing.output); v4l_info(client, "ACB: 0x%04x\n", state->acb); break; } @@ -1063,6 +897,9 @@ static int msp_attach(struct i2c_adapter *adapter, int address, int kind) state->muted = 0; state->i2s_mode = 0; init_waitqueue_head(&state->wq); + /* These are the reset input/output positions */ + state->routing.input = MSP_INPUT_DEFAULT; + state->routing.output = MSP_OUTPUT_DEFAULT; state->rev1 = msp_read_dsp(client, 0x1e); if (state->rev1 != -1) diff --git a/drivers/media/video/msp3400.h b/drivers/media/video/msp3400-driver.h index 6fb5c8c994e7..1940748bb633 100644 --- a/drivers/media/video/msp3400.h +++ b/drivers/media/video/msp3400-driver.h @@ -1,8 +1,10 @@ /* */ -#ifndef MSP3400_H -#define MSP3400_H +#ifndef MSP3400_DRIVER_H +#define MSP3400_DRIVER_H + +#include <media/msp3400.h> /* ---------------------------------------------------------------------- */ @@ -20,15 +22,14 @@ #define MSP_MODE_BTSC 8 #define MSP_MODE_EXTERN 9 -#define SCART_MASK 0 -#define SCART_IN1 1 -#define SCART_IN2 2 -#define SCART_IN1_DA 3 -#define SCART_IN2_DA 4 -#define SCART_IN3 5 -#define SCART_IN4 6 -#define SCART_MONO 7 -#define SCART_MUTE 8 +#define SCART_IN1 0 +#define SCART_IN2 1 +#define SCART_IN3 2 +#define SCART_IN4 3 +#define SCART_IN1_DA 4 +#define SCART_IN2_DA 5 +#define SCART_MONO 6 +#define SCART_MUTE 7 #define SCART_DSP_IN 0 #define SCART1_OUT 1 @@ -73,7 +74,7 @@ struct msp_state { int i2s_mode; int main, second; /* sound carrier */ int input; - int source; /* see msp34xxg_set_source */ + struct v4l2_routing routing; /* v4l2 */ int audmode; @@ -99,17 +100,16 @@ int msp_reset(struct i2c_client *client); void msp_set_scart(struct i2c_client *client, int in, int out); void msp_set_mute(struct i2c_client *client); void msp_set_audio(struct i2c_client *client); -int msp_modus(struct i2c_client *client); int msp_sleep(struct msp_state *state, int timeout); /* msp3400-kthreads.c */ const char *msp_standard_std_name(int std); void msp_set_audmode(struct i2c_client *client); -void msp_detect_stereo(struct i2c_client *client); +int msp_detect_stereo(struct i2c_client *client); int msp3400c_thread(void *data); int msp3410d_thread(void *data); int msp34xxg_thread(void *data); void msp3400c_set_mode(struct i2c_client *client, int mode); void msp3400c_set_carrier(struct i2c_client *client, int cdo1, int cdo2); -#endif /* MSP3400_H */ +#endif /* MSP3400_DRIVER_H */ diff --git a/drivers/media/video/msp3400-kthreads.c b/drivers/media/video/msp3400-kthreads.c index 852ab6a115fa..c3984ea9ca07 100644 --- a/drivers/media/video/msp3400-kthreads.c +++ b/drivers/media/video/msp3400-kthreads.c @@ -26,10 +26,10 @@ #include <linux/videodev.h> #include <linux/videodev2.h> #include <media/v4l2-common.h> -#include <media/audiochip.h> +#include <media/msp3400.h> #include <linux/kthread.h> #include <linux/suspend.h> -#include "msp3400.h" +#include "msp3400-driver.h" /* this one uses the automatic sound standard detection of newer msp34xx chip versions */ @@ -45,11 +45,13 @@ static struct { { 0x0004, MSP_CARRIER(6.5), MSP_CARRIER(6.2578125), "6.5/6.25 D/K1 Dual FM-Stereo" }, { 0x0005, MSP_CARRIER(6.5), MSP_CARRIER(6.7421875), "6.5/6.74 D/K2 Dual FM-Stereo" }, { 0x0006, MSP_CARRIER(6.5), MSP_CARRIER(6.5), "6.5 D/K FM-Mono (HDEV3)" }, + { 0x0007, MSP_CARRIER(6.5), MSP_CARRIER(5.7421875), "6.5/5.74 D/K3 Dual FM-Stereo" }, { 0x0008, MSP_CARRIER(5.5), MSP_CARRIER(5.85), "5.5/5.85 B/G NICAM FM" }, { 0x0009, MSP_CARRIER(6.5), MSP_CARRIER(5.85), "6.5/5.85 L NICAM AM" }, { 0x000a, MSP_CARRIER(6.0), MSP_CARRIER(6.55), "6.0/6.55 I NICAM FM" }, { 0x000b, MSP_CARRIER(6.5), MSP_CARRIER(5.85), "6.5/5.85 D/K NICAM FM" }, { 0x000c, MSP_CARRIER(6.5), MSP_CARRIER(5.85), "6.5/5.85 D/K NICAM FM (HDEV2)" }, + { 0x000d, MSP_CARRIER(6.5), MSP_CARRIER(5.85), "6.5/5.85 D/K NICAM FM (HDEV3)" }, { 0x0020, MSP_CARRIER(4.5), MSP_CARRIER(4.5), "4.5 M BTSC-Stereo" }, { 0x0021, MSP_CARRIER(4.5), MSP_CARRIER(4.5), "4.5 M BTSC-Mono + SAP" }, { 0x0030, MSP_CARRIER(4.5), MSP_CARRIER(4.5), "4.5 M EIA-J Japan Stereo" }, @@ -185,13 +187,14 @@ void msp3400c_set_mode(struct i2c_client *client, int mode) { struct msp_state *state = i2c_get_clientdata(client); struct msp3400c_init_data_dem *data = &msp3400c_init_data[mode]; + int tuner = (state->routing.input >> 3) & 1; int i; v4l_dbg(1, msp_debug, client, "set_mode: %d\n", mode); state->mode = mode; state->rxsubchans = V4L2_TUNER_SUB_MONO; - msp_write_dem(client, 0x00bb, data->ad_cv); + msp_write_dem(client, 0x00bb, data->ad_cv | (tuner ? 0x100 : 0)); for (i = 5; i >= 0; i--) /* fir 1 */ msp_write_dem(client, 0x0001, data->fir1[i]); @@ -207,21 +210,22 @@ void msp3400c_set_mode(struct i2c_client *client, int mode) msp3400c_set_carrier(client, data->cdo1, data->cdo2); msp_set_source(client, data->dsp_src); - msp_write_dsp(client, 0x000e, data->dsp_matrix); + /* set prescales */ - if (state->has_nicam) { - /* nicam prescale */ - msp_write_dsp(client, 0x0010, 0x5a00); /* was: 0x3000 */ - } + /* volume prescale for SCART (AM mono input) */ + msp_write_dsp(client, 0x000d, 0x1900); + msp_write_dsp(client, 0x000e, data->dsp_matrix); + if (state->has_nicam) /* nicam prescale */ + msp_write_dsp(client, 0x0010, 0x5a00); } /* Set audio mode. Note that the pre-'G' models do not support BTSC+SAP, nor do they support stereo BTSC. */ static void msp3400c_set_audmode(struct i2c_client *client) { - static char *strmode[] = { "mono", "stereo", "lang2", "lang1" }; + static char *strmode[] = { "mono", "stereo", "lang2", "lang1", "lang1+lang2" }; struct msp_state *state = i2c_get_clientdata(client); - char *modestr = (state->audmode >= 0 && state->audmode < 4) ? + char *modestr = (state->audmode >= 0 && state->audmode < 5) ? strmode[state->audmode] : "unknown"; int src = 0; /* channel source: FM/AM, nicam or SCART */ @@ -246,6 +250,7 @@ static void msp3400c_set_audmode(struct i2c_client *client) case V4L2_TUNER_MODE_MONO: case V4L2_TUNER_MODE_LANG1: case V4L2_TUNER_MODE_LANG2: + case V4L2_TUNER_MODE_LANG1_LANG2: msp_write_dsp(client, 0x000e, 0x3000); break; } @@ -257,6 +262,7 @@ static void msp3400c_set_audmode(struct i2c_client *client) msp3400c_set_carrier(client, MSP_CARRIER(6.5), MSP_CARRIER(6.5)); break; case V4L2_TUNER_MODE_STEREO: + case V4L2_TUNER_MODE_LANG1_LANG2: msp3400c_set_carrier(client, MSP_CARRIER(7.2), MSP_CARRIER(7.02)); break; case V4L2_TUNER_MODE_LANG1: @@ -271,7 +277,6 @@ static void msp3400c_set_audmode(struct i2c_client *client) case MSP_MODE_FM_NICAM2: case MSP_MODE_AM_NICAM: v4l_dbg(1, msp_debug, client, "NICAM set_audmode: %s\n",modestr); - msp3400c_set_carrier(client, state->second, state->main); if (state->nicam_on) src = 0x0100; /* NICAM */ break; @@ -293,6 +298,7 @@ static void msp3400c_set_audmode(struct i2c_client *client) /* switch audio */ switch (state->audmode) { case V4L2_TUNER_MODE_STEREO: + case V4L2_TUNER_MODE_LANG1_LANG2: src |= 0x0020; break; case V4L2_TUNER_MODE_MONO: @@ -427,8 +433,8 @@ static void watch_stereo(struct i2c_client *client) { struct msp_state *state = i2c_get_clientdata(client); - if (msp3400c_detect_stereo(client)) { - msp3400c_set_audmode(client); + if (msp_detect_stereo(client)) { + msp_set_audmode(client); } if (msp_once) @@ -464,7 +470,7 @@ int msp3400c_thread(void *data) /* mute */ msp_set_mute(client); - msp3400c_set_mode(client, MSP_MODE_AM_DETECT /* +1 */ ); + msp3400c_set_mode(client, MSP_MODE_AM_DETECT); val1 = val2 = 0; max1 = max2 = -1; state->watch_stereo = 0; @@ -572,8 +578,6 @@ int msp3400c_thread(void *data) state->second = msp3400c_carrier_detect_65[max2].cdo; msp3400c_set_mode(client, MSP_MODE_AM_NICAM); msp3400c_set_carrier(client, state->second, state->main); - /* volume prescale for SCART (AM mono input) */ - msp_write_dsp(client, 0x000d, 0x1900); state->watch_stereo = 1; } else if (max2 == 0 && state->has_nicam) { /* D/K NICAM */ @@ -651,7 +655,8 @@ int msp3410d_thread(void *data) if (msp_sleep(state,200)) goto restart; - /* start autodetect */ + /* start autodetect. Note: autodetect is not supported for + NTSC-M and radio, hence we force the standard in those cases. */ if (state->radio) std = 0x40; else @@ -695,23 +700,19 @@ int msp3410d_thread(void *data) v4l_dbg(1, msp_debug, client, "autodetection failed," " switching to backup standard: %s (0x%04x)\n", msp_stdlist[8].name ? msp_stdlist[8].name : "unknown",val); - val = 0x0009; + state->std = val = 0x0009; msp_write_dem(client, 0x20, val); } - /* set various prescales */ - msp_write_dsp(client, 0x0d, 0x1900); /* scart */ - msp_write_dsp(client, 0x0e, 0x2403); /* FM */ - msp_write_dsp(client, 0x10, 0x5a00); /* nicam */ - /* set stereo */ switch (val) { case 0x0008: /* B/G NICAM */ case 0x000a: /* I NICAM */ - if (val == 0x0008) - state->mode = MSP_MODE_FM_NICAM1; - else + case 0x000b: /* D/K NICAM */ + if (val == 0x000a) state->mode = MSP_MODE_FM_NICAM2; + else + state->mode = MSP_MODE_FM_NICAM1; /* just turn on stereo */ state->rxsubchans = V4L2_TUNER_SUB_STEREO; state->nicam_on = 1; @@ -739,6 +740,7 @@ int msp3410d_thread(void *data) /* scart routing (this doesn't belong here I think) */ msp_set_scart(client,SCART_IN2,0); break; + case 0x0002: case 0x0003: case 0x0004: case 0x0005: @@ -748,12 +750,19 @@ int msp3410d_thread(void *data) break; } - /* unmute, restore misc registers */ - msp_set_audio(client); - msp_write_dsp(client, 0x13, state->acb); + /* set various prescales */ + msp_write_dsp(client, 0x0d, 0x1900); /* scart */ + msp_write_dsp(client, 0x0e, 0x3000); /* FM */ + if (state->has_nicam) + msp_write_dsp(client, 0x10, 0x5a00); /* nicam */ + if (state->has_i2s_conf) msp_write_dem(client, 0x40, state->i2s_mode); + /* unmute, restore misc registers */ + msp_set_audio(client); + + msp_write_dsp(client, 0x13, state->acb); msp3400c_set_audmode(client); /* monitor tv audio mode, the first time don't wait @@ -772,97 +781,154 @@ int msp3410d_thread(void *data) /* ----------------------------------------------------------------------- */ -/* msp34xxG + (autoselect no-thread) */ -/* this one uses both automatic standard detection and automatic sound */ -/* select which are available in the newer G versions */ -/* struct msp: only norm, acb and source are really used in this mode */ - -/* set the same 'source' for the loudspeaker, scart and quasi-peak detector - * the value for source is the same as bit 15:8 of DSP registers 0x08, - * 0x0a and 0x0c: 0=mono, 1=stereo or A|B, 2=SCART, 3=stereo or A, 4=stereo or B - * - * this function replaces msp3400c_set_audmode +/* msp34xxG + (autoselect no-thread) + * this one uses both automatic standard detection and automatic sound + * select which are available in the newer G versions + * struct msp: only norm, acb and source are really used in this mode */ -static void msp34xxg_set_source(struct i2c_client *client, int source) + +static int msp34xxg_modus(struct i2c_client *client) { struct msp_state *state = i2c_get_clientdata(client); - /* fix matrix mode to stereo and let the msp choose what - * to output according to 'source', as recommended - * for MONO (source==0) downmixing set bit[7:0] to 0x30 - */ - int value = (source & 0x07) << 8 | (source == 0 ? 0x30 : 0x20); + if (state->radio) { + v4l_dbg(1, msp_debug, client, "selected radio modus\n"); + return 0x0001; + } - v4l_dbg(1, msp_debug, client, "set source to %d (0x%x)\n", source, value); - msp_set_source(client, value); - /* - * set identification threshold. Personally, I - * I set it to a higher value that the default - * of 0x190 to ignore noisy stereo signals. - * this needs tuning. (recommended range 0x00a0-0x03c0) - * 0x7f0 = forced mono mode - */ - /* a2 threshold for stereo/bilingual */ - msp_write_dem(client, 0x22, msp_stereo_thresh); - state->source = source; + if (state->v4l2_std & V4L2_STD_PAL) { + v4l_dbg(1, msp_debug, client, "selected PAL modus\n"); + return 0x7001; + } + if (state->v4l2_std == V4L2_STD_NTSC_M_JP) { + v4l_dbg(1, msp_debug, client, "selected M (EIA-J) modus\n"); + return 0x4001; + } + if (state->v4l2_std == V4L2_STD_NTSC_M_KR) { + v4l_dbg(1, msp_debug, client, "selected M (A2) modus\n"); + return 0x0001; + } + if (state->v4l2_std & V4L2_STD_MN) { + v4l_dbg(1, msp_debug, client, "selected M (BTSC) modus\n"); + return 0x2001; + } + if (state->v4l2_std & V4L2_STD_SECAM) { + v4l_dbg(1, msp_debug, client, "selected SECAM modus\n"); + return 0x6001; + } + return 0x0001; } -/* (re-)initialize the msp34xxg, according to the current norm in state->norm - * return 0 if it worked, -1 if it failed - */ -static int msp34xxg_reset(struct i2c_client *client) +static void msp34xxg_set_source(struct i2c_client *client, u16 reg, int in) + { + struct msp_state *state = i2c_get_clientdata(client); + int source, matrix; + + switch (state->audmode) { + case V4L2_TUNER_MODE_MONO: + source = 0; /* mono only */ + matrix = 0x30; + break; + case V4L2_TUNER_MODE_LANG1: + source = 3; /* stereo or A */ + matrix = 0x00; + break; + case V4L2_TUNER_MODE_LANG2: + source = 4; /* stereo or B */ + matrix = 0x10; + break; + case V4L2_TUNER_MODE_STEREO: + case V4L2_TUNER_MODE_LANG1_LANG2: + default: + source = 1; /* stereo or A|B */ + matrix = 0x20; + break; + } + + if (in == MSP_DSP_OUT_TUNER) + source = (source << 8) | 0x20; + /* the msp34x2g puts the MAIN_AVC, MAIN and AUX sources in 12, 13, 14 + instead of 11, 12, 13. So we add one for that msp version. */ + else if (in >= MSP_DSP_OUT_MAIN_AVC && state->has_dolby_pro_logic) + source = ((in + 1) << 8) | matrix; + else + source = (in << 8) | matrix; + + v4l_dbg(1, msp_debug, client, "set source to %d (0x%x) for output %02x\n", + in, source, reg); + msp_write_dsp(client, reg, source); +} + +static void msp34xxg_set_sources(struct i2c_client *client) +{ + struct msp_state *state = i2c_get_clientdata(client); + u32 in = state->routing.input; + + msp34xxg_set_source(client, 0x0008, (in >> 4) & 0xf); + /* quasi-peak detector is set to same input as the loudspeaker (MAIN) */ + msp34xxg_set_source(client, 0x000c, (in >> 4) & 0xf); + msp34xxg_set_source(client, 0x0009, (in >> 8) & 0xf); + msp34xxg_set_source(client, 0x000a, (in >> 12) & 0xf); + if (state->has_scart23_in_scart2_out) + msp34xxg_set_source(client, 0x0041, (in >> 16) & 0xf); + msp34xxg_set_source(client, 0x000b, (in >> 20) & 0xf); +} + +/* (re-)initialize the msp34xxg */ +static void msp34xxg_reset(struct i2c_client *client) { struct msp_state *state = i2c_get_clientdata(client); - int modus, std; + int tuner = (state->routing.input >> 3) & 1; + int modus; + + /* initialize std to 1 (autodetect) to signal that no standard is + selected yet. */ + state->std = 1; - if (msp_reset(client)) - return -1; + msp_reset(client); /* make sure that input/output is muted (paranoid mode) */ /* ACB, mute DSP input, mute SCART 1 */ - if (msp_write_dsp(client, 0x13, 0x0f20)) - return -1; + msp_write_dsp(client, 0x13, 0x0f20); if (state->has_i2s_conf) msp_write_dem(client, 0x40, state->i2s_mode); /* step-by-step initialisation, as described in the manual */ - modus = msp_modus(client); - if (state->radio) - std = 0x40; - else - std = (state->v4l2_std & V4L2_STD_NTSC) ? 0x20 : 1; - modus &= ~0x03; /* STATUS_CHANGE = 0 */ - modus |= 0x01; /* AUTOMATIC_SOUND_DETECTION = 1 */ - if (msp_write_dem(client, 0x30, modus)) - return -1; - if (msp_write_dem(client, 0x20, std)) - return -1; + modus = msp34xxg_modus(client); + modus |= tuner ? 0x100 : 0; + msp_write_dem(client, 0x30, modus); /* write the dsps that may have an influence on standard/audio autodetection right now */ - msp34xxg_set_source(client, state->source); - - /* AM/FM Prescale [15:8] 75khz deviation */ - if (msp_write_dsp(client, 0x0e, 0x3000)) - return -1; + msp34xxg_set_sources(client); - /* NICAM Prescale 9db gain (as recommended) */ - if (msp_write_dsp(client, 0x10, 0x5a00)) - return -1; + msp_write_dsp(client, 0x0d, 0x1900); /* scart */ + msp_write_dsp(client, 0x0e, 0x3000); /* FM */ + if (state->has_nicam) + msp_write_dsp(client, 0x10, 0x5a00); /* nicam */ - return 0; + /* set identification threshold. Personally, I + * I set it to a higher value than the default + * of 0x190 to ignore noisy stereo signals. + * this needs tuning. (recommended range 0x00a0-0x03c0) + * 0x7f0 = forced mono mode + * + * a2 threshold for stereo/bilingual. + * Note: this register is part of the Manual/Compatibility mode. + * It is supported by all 'G'-family chips. + */ + msp_write_dem(client, 0x22, msp_stereo_thresh); } int msp34xxg_thread(void *data) { struct i2c_client *client = data; struct msp_state *state = i2c_get_clientdata(client); - int val, std, i; + int val, i; v4l_dbg(1, msp_debug, client, "msp34xxg daemon started\n"); - state->source = 1; /* default */ for (;;) { v4l_dbg(2, msp_debug, client, "msp34xxg thread: sleep\n"); msp_sleep(state, -1); @@ -876,12 +942,14 @@ int msp34xxg_thread(void *data) /* setup the chip*/ msp34xxg_reset(client); - std = msp_standard; - if (std != 0x01) + state->std = state->radio ? 0x40 : msp_standard; + if (state->std != 1) goto unmute; + /* start autodetect */ + msp_write_dem(client, 0x20, state->std); /* watch autodetect */ - v4l_dbg(1, msp_debug, client, "triggered autodetect, waiting for result\n"); + v4l_dbg(1, msp_debug, client, "started autodetect, waiting for result\n"); for (i = 0; i < 10; i++) { if (msp_sleep(state, 100)) goto restart; @@ -889,20 +957,19 @@ int msp34xxg_thread(void *data) /* check results */ val = msp_read_dem(client, 0x7e); if (val < 0x07ff) { - std = val; + state->std = val; break; } v4l_dbg(2, msp_debug, client, "detection still in progress\n"); } - if (std == 1) { + if (state->std == 1) { v4l_dbg(1, msp_debug, client, "detection still in progress after 10 tries. giving up.\n"); continue; } unmute: - state->std = std; - v4l_dbg(1, msp_debug, client, "current standard: %s (0x%04x)\n", - msp_standard_std_name(std), std); + v4l_dbg(1, msp_debug, client, "detected standard: %s (0x%04x)\n", + msp_standard_std_name(state->std), state->std); /* unmute: dispatch sound to scart output, set scart volume */ msp_set_audio(client); @@ -911,20 +978,33 @@ int msp34xxg_thread(void *data) if (msp_write_dsp(client, 0x13, state->acb)) return -1; - if (state->has_i2s_conf) - msp_write_dem(client, 0x40, state->i2s_mode); + /* the periodic stereo/SAP check is only relevant for + the 0x20 standard (BTSC) */ + if (state->std != 0x20) + continue; + + state->watch_stereo = 1; + + /* monitor tv audio mode, the first time don't wait + in order to get a quick stereo/SAP update */ + watch_stereo(client); + while (state->watch_stereo) { + watch_stereo(client); + if (msp_sleep(state, 5000)) + goto restart; + } } v4l_dbg(1, msp_debug, client, "thread: exit\n"); return 0; } -static void msp34xxg_detect_stereo(struct i2c_client *client) +static int msp34xxg_detect_stereo(struct i2c_client *client) { struct msp_state *state = i2c_get_clientdata(client); - int status = msp_read_dem(client, 0x0200); int is_bilingual = status & 0x100; int is_stereo = status & 0x40; + int oldrx = state->rxsubchans; state->rxsubchans = 0; if (is_stereo) @@ -932,42 +1012,31 @@ static void msp34xxg_detect_stereo(struct i2c_client *client) else state->rxsubchans = V4L2_TUNER_SUB_MONO; if (is_bilingual) { - state->rxsubchans = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2; - /* I'm supposed to check whether it's SAP or not - * and set only LANG2/SAP in this case. Yet, the MSP - * does a lot of work to hide this and handle everything - * the same way. I don't want to work around it so unless - * this is a problem, I'll handle SAP just like lang1/lang2. - */ + if (state->std == 0x20) + state->rxsubchans |= V4L2_TUNER_SUB_SAP; + else + state->rxsubchans = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2; } v4l_dbg(1, msp_debug, client, "status=0x%x, stereo=%d, bilingual=%d -> rxsubchans=%d\n", status, is_stereo, is_bilingual, state->rxsubchans); + return (oldrx != state->rxsubchans); } static void msp34xxg_set_audmode(struct i2c_client *client) { struct msp_state *state = i2c_get_clientdata(client); - int source; - switch (state->audmode) { - case V4L2_TUNER_MODE_MONO: - source = 0; /* mono only */ - break; - case V4L2_TUNER_MODE_STEREO: - source = 1; /* stereo or A|B, see comment in msp34xxg_get_v4l2_stereo() */ - /* problem: that could also mean 2 (scart input) */ - break; - case V4L2_TUNER_MODE_LANG1: - source = 3; /* stereo or A */ - break; - case V4L2_TUNER_MODE_LANG2: - source = 4; /* stereo or B */ - break; - default: - source = 1; - break; + if (state->std == 0x20) { + if ((state->rxsubchans & V4L2_TUNER_SUB_SAP) && + (state->audmode == V4L2_TUNER_MODE_STEREO || + state->audmode == V4L2_TUNER_MODE_LANG2)) { + msp_write_dem(client, 0x20, 0x21); + } else { + msp_write_dem(client, 0x20, 0x20); + } } - msp34xxg_set_source(client, source); + + msp34xxg_set_sources(client); } void msp_set_audmode(struct i2c_client *client) @@ -977,7 +1046,6 @@ void msp_set_audmode(struct i2c_client *client) switch (state->opmode) { case OPMODE_MANUAL: case OPMODE_AUTODETECT: - state->watch_stereo = 0; msp3400c_set_audmode(client); break; case OPMODE_AUTOSELECT: @@ -986,18 +1054,17 @@ void msp_set_audmode(struct i2c_client *client) } } -void msp_detect_stereo(struct i2c_client *client) +int msp_detect_stereo(struct i2c_client *client) { struct msp_state *state = i2c_get_clientdata(client); switch (state->opmode) { case OPMODE_MANUAL: case OPMODE_AUTODETECT: - msp3400c_detect_stereo(client); - break; + return msp3400c_detect_stereo(client); case OPMODE_AUTOSELECT: - msp34xxg_detect_stereo(client); - break; + return msp34xxg_detect_stereo(client); } + return 0; } diff --git a/drivers/media/video/mxb.c b/drivers/media/video/mxb.c index eb3b31867494..b0aea4002d11 100644 --- a/drivers/media/video/mxb.c +++ b/drivers/media/video/mxb.c @@ -198,13 +198,13 @@ static int mxb_probe(struct saa7146_dev* dev) /* loop through all i2c-devices on the bus and look who is there */ list_for_each(item,&mxb->i2c_adapter.clients) { client = list_entry(item, struct i2c_client, list); - if( I2C_TEA6420_1 == client->addr ) + if( I2C_ADDR_TEA6420_1 == client->addr ) mxb->tea6420_1 = client; - if( I2C_TEA6420_2 == client->addr ) + if( I2C_ADDR_TEA6420_2 == client->addr ) mxb->tea6420_2 = client; if( I2C_TEA6415C_2 == client->addr ) mxb->tea6415c = client; - if( I2C_TDA9840 == client->addr ) + if( I2C_ADDR_TDA9840 == client->addr ) mxb->tda9840 = client; if( I2C_SAA7111 == client->addr ) mxb->saa7111a = client; @@ -790,6 +790,12 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg) DEB_D(("VIDIOC_S_TUNER: V4L2_TUNER_MODE_STEREO\n")); break; } + case V4L2_TUNER_MODE_LANG1_LANG2: { + mxb->cur_mode = V4L2_TUNER_MODE_LANG1_LANG2; + byte = TDA9840_SET_BOTH; + DEB_D(("VIDIOC_S_TUNER: V4L2_TUNER_MODE_LANG1_LANG2\n")); + break; + } case V4L2_TUNER_MODE_LANG1: { mxb->cur_mode = V4L2_TUNER_MODE_LANG1; byte = TDA9840_SET_LANG1; diff --git a/drivers/usb/media/ov511.c b/drivers/media/video/ov511.c index da44579d6f29..fdc8e3f13937 100644 --- a/drivers/usb/media/ov511.c +++ b/drivers/media/video/ov511.c @@ -15,7 +15,7 @@ * * Based on the Linux CPiA driver written by Peter Pregler, * Scott J. Bertin and Johannes Erdfelt. - * + * * Please see the file: Documentation/usb/ov511.txt * and the website at: http://alpha.dyndns.org/ov511 * for more info. @@ -433,7 +433,7 @@ reg_w_mask(struct usb_ov511 *ov, return (reg_w(ov, reg, newval)); } -/* +/* * Writes multiple (n) byte value to a single register. Only valid with certain * registers (0x30 and 0xc4 - 0xce). */ @@ -629,7 +629,7 @@ ov511_i2c_write_internal(struct usb_ov511 *ov, /* Retry until idle */ do rc = reg_r(ov, R511_I2C_CTL); - while (rc > 0 && ((rc&1) == 0)); + while (rc > 0 && ((rc&1) == 0)); if (rc < 0) break; @@ -1752,7 +1752,7 @@ sensor_set_picture(struct usb_ov511 *ov, struct video_picture *p) ov->whiteness = p->whiteness; /* Don't return error if a setting is unsupported, or rest of settings - * will not be performed */ + * will not be performed */ rc = sensor_set_contrast(ov, p->contrast); if (FATAL_ERROR(rc)) @@ -1781,7 +1781,7 @@ sensor_get_picture(struct usb_ov511 *ov, struct video_picture *p) PDEBUG(4, "sensor_get_picture"); /* Don't return error if a setting is unsupported, or rest of settings - * will not be performed */ + * will not be performed */ rc = sensor_get_contrast(ov, &(p->contrast)); if (FATAL_ERROR(rc)) @@ -2251,7 +2251,7 @@ mode_init_ov_sensor_regs(struct usb_ov511 *ov, int width, int height, /******** Clock programming ********/ - /* The OV6620 needs special handling. This prevents the + /* The OV6620 needs special handling. This prevents the * severe banding that normally occurs */ if (ov->sensor == SEN_OV6620 || ov->sensor == SEN_OV6630) { @@ -2326,7 +2326,7 @@ set_ov_sensor_window(struct usb_ov511 *ov, int width, int height, int mode, int sub_flag) { int ret; - int hwsbase, hwebase, vwsbase, vwebase, hwsize, vwsize; + int hwsbase, hwebase, vwsbase, vwebase, hwsize, vwsize; int hoffset, voffset, hwscale = 0, vwscale = 0; /* The different sensor ICs handle setting up of window differently. @@ -2575,7 +2575,7 @@ ov518_mode_init_regs(struct usb_ov511 *ov, /* OV518 needs U and V swapped */ i2c_w_mask(ov, 0x15, 0x00, 0x01); - if (mode == VIDEO_PALETTE_GREY) { + if (mode == VIDEO_PALETTE_GREY) { /* Set 16-bit input format (UV data are ignored) */ reg_w_mask(ov, 0x20, 0x00, 0x08); @@ -2894,7 +2894,7 @@ make_8x8(unsigned char *pIn, unsigned char *pOut, int w) * ... ... ... * 56 57 ... 63 120 121 ... 127 248 249 ... 255 * - */ + */ static void yuv400raw_to_yuv400p(struct ov511_frame *frame, unsigned char *pIn0, unsigned char *pOut0) @@ -2923,7 +2923,7 @@ yuv400raw_to_yuv400p(struct ov511_frame *frame, * * 0 1 ... 7 * 8 9 ... 15 - * ... + * ... * 56 57 ... 63 * * U and V are shipped at half resolution (1 U,V sample -> one 2x2 block). @@ -3034,7 +3034,7 @@ decompress(struct usb_ov511 *ov, struct ov511_frame *frame, */ static void deinterlace(struct ov511_frame *frame, int rawformat, - unsigned char *pIn0, unsigned char *pOut0) + unsigned char *pIn0, unsigned char *pOut0) { const int fieldheight = frame->rawheight / 2; const int fieldpix = fieldheight * frame->rawwidth; @@ -3112,7 +3112,7 @@ ov51x_postprocess_grey(struct usb_ov511 *ov, struct ov511_frame *frame) frame->tempdata); deinterlace(frame, RAWFMT_YUV400, frame->tempdata, - frame->data); + frame->data); } else { if (frame->compressed) decompress(ov, frame, frame->rawdata, @@ -3136,7 +3136,7 @@ ov51x_postprocess_yuv420(struct usb_ov511 *ov, struct ov511_frame *frame) frame->tempdata); deinterlace(frame, RAWFMT_YUV420, frame->tempdata, - frame->data); + frame->data); } else { if (frame->compressed) decompress(ov, frame, frame->rawdata, frame->data); @@ -3226,7 +3226,7 @@ ov511_move_data(struct usb_ov511 *ov, unsigned char *in, int n) frame->rawwidth = ((int)(in[9]) + 1) * 8; frame->rawheight = ((int)(in[10]) + 1) * 8; - PDEBUG(4, "Frame end, frame=%d, pnum=%d, w=%d, h=%d, recvd=%d", + PDEBUG(4, "Frame end, frame=%d, pnum=%d, w=%d, h=%d, recvd=%d", ov->curframe, pnum, frame->rawwidth, frame->rawheight, frame->bytes_recvd); @@ -3527,10 +3527,10 @@ ov51x_isoc_irq(struct urb *urb, struct pt_regs *regs) return; } - if (urb->status == -ENOENT || urb->status == -ECONNRESET) { - PDEBUG(4, "URB unlinked"); - return; - } + if (urb->status == -ENOENT || urb->status == -ECONNRESET) { + PDEBUG(4, "URB unlinked"); + return; + } if (urb->status != -EINPROGRESS && urb->status != 0) { err("ERROR: urb->status=%d: %s", urb->status, @@ -4627,8 +4627,8 @@ ov51x_v4l1_mmap(struct file *file, struct vm_area_struct *vma) PDEBUG(4, "mmap: %ld (%lX) bytes", size, size); if (size > (((OV511_NUMFRAMES - * MAX_DATA_SIZE(ov->maxwidth, ov->maxheight) - + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1)))) + * MAX_DATA_SIZE(ov->maxwidth, ov->maxheight) + + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1)))) return -EINVAL; if (mutex_lock_interruptible(&ov->lock)) @@ -5062,7 +5062,7 @@ ov6xx0_configure(struct usb_ov511 *ov) } /* This initializes the KS0127 and KS0127B video decoders. */ -static int +static int ks0127_configure(struct usb_ov511 *ov) { int rc; @@ -5193,7 +5193,7 @@ saa7111a_configure(struct usb_ov511 *ov) return -1; /* Detect version of decoder. This must be done after writing the - * initial regs or the decoder will lock up. */ + * initial regs or the decoder will lock up. */ rc = i2c_r(ov, 0x00); if (rc < 0) { @@ -5216,13 +5216,13 @@ saa7111a_configure(struct usb_ov511 *ov) } /* This initializes the OV511/OV511+ and the sensor */ -static int +static int ov511_configure(struct usb_ov511 *ov) { static struct ov511_regvals aRegvalsInit511[] = { { OV511_REG_BUS, R51x_SYS_RESET, 0x7f }, - { OV511_REG_BUS, R51x_SYS_INIT, 0x01 }, - { OV511_REG_BUS, R51x_SYS_RESET, 0x7f }, + { OV511_REG_BUS, R51x_SYS_INIT, 0x01 }, + { OV511_REG_BUS, R51x_SYS_RESET, 0x7f }, { OV511_REG_BUS, R51x_SYS_INIT, 0x01 }, { OV511_REG_BUS, R51x_SYS_RESET, 0x3f }, { OV511_REG_BUS, R51x_SYS_INIT, 0x01 }, @@ -5269,7 +5269,7 @@ ov511_configure(struct usb_ov511 *ov) err("Please notify " EMAIL " of the name,"); err("manufacturer, model, and this number of your camera."); err("Also include the output of the detection process."); - } + } if (ov->customid == 70) /* USB Life TV (PAL/SECAM) */ ov->pal = 1; @@ -5336,17 +5336,17 @@ ov511_configure(struct usb_ov511 *ov) if (i2c_w(ov, 0x10, 0x00) < 0) { err("Can't determine sensor slave IDs"); - goto error; + goto error; } else { if (ks0127_configure(ov) < 0) { err("Failed to configure KS0127"); - goto error; + goto error; } } } else { if (saa7111a_configure(ov) < 0) { err("Failed to configure SAA7111A"); - goto error; + goto error; } } } else { @@ -5356,13 +5356,13 @@ ov511_configure(struct usb_ov511 *ov) } else { if (ov6xx0_configure(ov) < 0) { err("Failed to configure OV6xx0"); - goto error; + goto error; } } } else { if (ov7xx0_configure(ov) < 0) { err("Failed to configure OV7xx0"); - goto error; + goto error; } } @@ -5381,12 +5381,12 @@ ov518_configure(struct usb_ov511 *ov) /* For 518 and 518+ */ static struct ov511_regvals aRegvalsInit518[] = { { OV511_REG_BUS, R51x_SYS_RESET, 0x40 }, - { OV511_REG_BUS, R51x_SYS_INIT, 0xe1 }, - { OV511_REG_BUS, R51x_SYS_RESET, 0x3e }, + { OV511_REG_BUS, R51x_SYS_INIT, 0xe1 }, + { OV511_REG_BUS, R51x_SYS_RESET, 0x3e }, { OV511_REG_BUS, R51x_SYS_INIT, 0xe1 }, { OV511_REG_BUS, R51x_SYS_RESET, 0x00 }, { OV511_REG_BUS, R51x_SYS_INIT, 0xe1 }, - { OV511_REG_BUS, 0x46, 0x00 }, + { OV511_REG_BUS, 0x46, 0x00 }, { OV511_REG_BUS, 0x5d, 0x03 }, { OV511_DONE_BUS, 0x0, 0x00}, }; @@ -5517,7 +5517,7 @@ ov518_configure(struct usb_ov511 *ov) if (init_ov_sensor(ov) < 0) { err("Can't determine sensor slave IDs"); - goto error; + goto error; } else { err("Detected unsupported OV8xx0 sensor"); goto error; @@ -5525,13 +5525,13 @@ ov518_configure(struct usb_ov511 *ov) } else { if (ov6xx0_configure(ov) < 0) { err("Failed to configure OV6xx0"); - goto error; + goto error; } } } else { if (ov7xx0_configure(ov) < 0) { err("Failed to configure OV7xx0"); - goto error; + goto error; } } @@ -5564,28 +5564,28 @@ static ssize_t show_custom_id(struct class_device *cd, char *buf) { struct usb_ov511 *ov = cd_to_ov(cd); return sprintf(buf, "%d\n", ov->customid); -} +} static CLASS_DEVICE_ATTR(custom_id, S_IRUGO, show_custom_id, NULL); static ssize_t show_model(struct class_device *cd, char *buf) { struct usb_ov511 *ov = cd_to_ov(cd); return sprintf(buf, "%s\n", ov->desc); -} +} static CLASS_DEVICE_ATTR(model, S_IRUGO, show_model, NULL); static ssize_t show_bridge(struct class_device *cd, char *buf) { struct usb_ov511 *ov = cd_to_ov(cd); return sprintf(buf, "%s\n", symbolic(brglist, ov->bridge)); -} +} static CLASS_DEVICE_ATTR(bridge, S_IRUGO, show_bridge, NULL); static ssize_t show_sensor(struct class_device *cd, char *buf) { struct usb_ov511 *ov = cd_to_ov(cd); return sprintf(buf, "%s\n", symbolic(senlist, ov->sensor)); -} +} static CLASS_DEVICE_ATTR(sensor, S_IRUGO, show_sensor, NULL); static ssize_t show_brightness(struct class_device *cd, char *buf) @@ -5597,7 +5597,7 @@ static ssize_t show_brightness(struct class_device *cd, char *buf) return -ENODEV; sensor_get_brightness(ov, &x); return sprintf(buf, "%d\n", x >> 8); -} +} static CLASS_DEVICE_ATTR(brightness, S_IRUGO, show_brightness, NULL); static ssize_t show_saturation(struct class_device *cd, char *buf) @@ -5609,7 +5609,7 @@ static ssize_t show_saturation(struct class_device *cd, char *buf) return -ENODEV; sensor_get_saturation(ov, &x); return sprintf(buf, "%d\n", x >> 8); -} +} static CLASS_DEVICE_ATTR(saturation, S_IRUGO, show_saturation, NULL); static ssize_t show_contrast(struct class_device *cd, char *buf) @@ -5621,7 +5621,7 @@ static ssize_t show_contrast(struct class_device *cd, char *buf) return -ENODEV; sensor_get_contrast(ov, &x); return sprintf(buf, "%d\n", x >> 8); -} +} static CLASS_DEVICE_ATTR(contrast, S_IRUGO, show_contrast, NULL); static ssize_t show_hue(struct class_device *cd, char *buf) @@ -5633,7 +5633,7 @@ static ssize_t show_hue(struct class_device *cd, char *buf) return -ENODEV; sensor_get_hue(ov, &x); return sprintf(buf, "%d\n", x >> 8); -} +} static CLASS_DEVICE_ATTR(hue, S_IRUGO, show_hue, NULL); static ssize_t show_exposure(struct class_device *cd, char *buf) @@ -5645,7 +5645,7 @@ static ssize_t show_exposure(struct class_device *cd, char *buf) return -ENODEV; sensor_get_exposure(ov, &exp); return sprintf(buf, "%d\n", exp >> 8); -} +} static CLASS_DEVICE_ATTR(exposure, S_IRUGO, show_exposure, NULL); static void ov_create_sysfs(struct video_device *vdev) diff --git a/drivers/usb/media/ov511.h b/drivers/media/video/ov511.h index bce9b3633889..12b3d51e1c34 100644 --- a/drivers/usb/media/ov511.h +++ b/drivers/media/video/ov511.h @@ -130,7 +130,7 @@ #define R511_COMP_QVY 0x76 #define R511_COMP_QVUV 0x77 #define R511_COMP_EN 0x78 -#define R511_COMP_LUT_EN 0x79 +#define R511_COMP_LUT_EN 0x79 #define R511_COMP_LUT_BEGIN 0x80 /* --------------------------------- */ @@ -459,14 +459,14 @@ struct usb_ov511 { int subh; /* Pix Array subcapture height */ int curframe; /* Current receiving sbuf */ - struct ov511_frame frame[OV511_NUMFRAMES]; + struct ov511_frame frame[OV511_NUMFRAMES]; struct ov511_sbuf sbuf[OV511_NUMSBUF]; wait_queue_head_t wq; /* Processes waiting */ int snap_enabled; /* Snapshot mode enabled */ - + int bridge; /* Type of bridge (BRG_*) */ int bclass; /* Class of bridge (BCL_*) */ int sensor; /* Type of image sensor chip (SEN_*) */ @@ -512,7 +512,7 @@ struct symbolic_list { /* Returns the name of the matching element in the symbolic_list array. The * end of the list must be marked with an element that has a NULL name. */ -static inline char * +static inline char * symbolic(struct symbolic_list list[], int num) { int i; diff --git a/drivers/media/video/ovcamchip/Makefile b/drivers/media/video/ovcamchip/Makefile index bca41ad93de8..cba4cdf20f49 100644 --- a/drivers/media/video/ovcamchip/Makefile +++ b/drivers/media/video/ovcamchip/Makefile @@ -1,4 +1,4 @@ ovcamchip-objs := ovcamchip_core.o ov6x20.o ov6x30.o ov7x10.o ov7x20.o \ - ov76be.o + ov76be.o obj-$(CONFIG_VIDEO_OVCAMCHIP) += ovcamchip.o diff --git a/drivers/media/video/ovcamchip/ovcamchip_core.c b/drivers/media/video/ovcamchip/ovcamchip_core.c index e76b53d5909c..3fe9fa04cd84 100644 --- a/drivers/media/video/ovcamchip/ovcamchip_core.c +++ b/drivers/media/video/ovcamchip/ovcamchip_core.c @@ -266,17 +266,17 @@ static int ovcamchip_detect(struct i2c_client *c) PDEBUG(3, "Testing for 0V6xx0"); c->addr = OV6xx0_SID; if (init_camchip(c) < 0) { - return -ENODEV; + return -ENODEV; } else { if (ov6xx0_detect(c) < 0) { PERROR("Failed to init OV6xx0"); - return -EIO; + return -EIO; } } } else { if (ov7xx0_detect(c) < 0) { PERROR("Failed to init OV7xx0"); - return -EIO; + return -EIO; } } diff --git a/drivers/media/video/ovcamchip/ovcamchip_priv.h b/drivers/media/video/ovcamchip/ovcamchip_priv.h index 575e612a5546..1231335a9f4a 100644 --- a/drivers/media/video/ovcamchip/ovcamchip_priv.h +++ b/drivers/media/video/ovcamchip/ovcamchip_priv.h @@ -82,6 +82,6 @@ extern int ov_write_regvals(struct i2c_client *c, struct ovcamchip_regvals *rvals); extern int ov_write_mask(struct i2c_client *c, unsigned char reg, - unsigned char value, unsigned char mask); + unsigned char value, unsigned char mask); #endif diff --git a/drivers/media/video/planb.c b/drivers/media/video/planb.c index 15fd85acabda..522e9ddeb089 100644 --- a/drivers/media/video/planb.c +++ b/drivers/media/video/planb.c @@ -1,4 +1,4 @@ -/* +/* planb - PlanB frame grabber driver PlanB is used in the 7x00/8x00 series of PowerMacintosh @@ -584,7 +584,7 @@ finish: wake_up_interruptible(&pb->suspendq); } -static void add_clip(struct planb *pb, struct video_clip *clip) +static void add_clip(struct planb *pb, struct video_clip *clip) { volatile unsigned char *base; int xc = clip->x, yc = clip->y; @@ -758,7 +758,7 @@ static void cmd_buff(struct planb *pb) PLANB_SET(CH_SYNC)); tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->ch1.br_sel), PLANB_SET(DMA_ABORT)); - + /* odd field data: */ jump = virt_to_bus(c1 + nlines / 2); for (i=1; i < nlines; i += stepsize, c1++) @@ -1247,7 +1247,7 @@ static volatile struct dbdma_cmd *setup_grab_cmd(int fr, struct planb *pb) tab_cmd_dbdma(c1, DBDMA_NOP | BR_IFCLR, virt_to_bus(c1-3)); c1++; tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->ch1.br_sel), PLANB_SET(DMA_ABORT)); - + /* odd field data: */ jump_addr = c1 + TAB_FACTOR * nlines / 2; jump = virt_to_bus(jump_addr); @@ -1383,7 +1383,7 @@ static int planb_open(struct video_device *dev, int mode) pb->user++; DEBUG("PlanB: device opened\n"); - return 0; + return 0; } static void planb_close(struct video_device *dev) @@ -1424,9 +1424,9 @@ static long planb_write(struct video_device *v, const char *buf, static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg) { struct planb *pb=(struct planb *)dev; - + switch (cmd) - { + { case VIDIOCGCAP: { struct video_capability b; @@ -1440,26 +1440,26 @@ static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg) b.channels = 2; /* composite & svhs */ b.audios = 0; b.maxwidth = PLANB_MAXPIXELS; - b.maxheight = PLANB_MAXLINES; - b.minwidth = 32; /* wild guess */ - b.minheight = 32; - if (copy_to_user(arg,&b,sizeof(b))) - return -EFAULT; + b.maxheight = PLANB_MAXLINES; + b.minwidth = 32; /* wild guess */ + b.minheight = 32; + if (copy_to_user(arg,&b,sizeof(b))) + return -EFAULT; return 0; } case VIDIOCSFBUF: { - struct video_buffer v; + struct video_buffer v; unsigned short bpp; unsigned int fmt; DEBUG("PlanB: IOCTL VIDIOCSFBUF\n"); - if (!capable(CAP_SYS_ADMIN) + if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO)) - return -EPERM; - if (copy_from_user(&v, arg,sizeof(v))) - return -EFAULT; + return -EPERM; + if (copy_from_user(&v, arg,sizeof(v))) + return -EFAULT; planb_lock(pb); switch(v.depth) { case 8: @@ -1478,7 +1478,7 @@ static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg) break; default: planb_unlock(pb); - return -EINVAL; + return -EINVAL; } if (bpp * v.width > v.bytesperline) { planb_unlock(pb); @@ -1493,7 +1493,7 @@ static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg) pb->win.bpl = pb->win.bpp * pb->win.swidth; pb->win.pad = v.bytesperline - pb->win.bpl; - DEBUG("PlanB: Display at %p is %d by %d, bytedepth %d," + DEBUG("PlanB: Display at %p is %d by %d, bytedepth %d," " bpl %d (+ %d)\n", v.base, v.width,v.height, pb->win.bpp, pb->win.bpl, pb->win.pad); @@ -1504,11 +1504,11 @@ static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg) resume_overlay(pb); } planb_unlock(pb); - return 0; + return 0; } case VIDIOCGFBUF: { - struct video_buffer v; + struct video_buffer v; DEBUG("PlanB: IOCTL VIDIOCGFBUF\n"); @@ -1518,15 +1518,15 @@ static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg) v.depth = pb->win.depth; v.bytesperline = pb->win.bpl + pb->win.pad; if (copy_to_user(arg, &v, sizeof(v))) - return -EFAULT; + return -EFAULT; return 0; } case VIDIOCCAPTURE: { int i; - if(copy_from_user(&i, arg, sizeof(i))) - return -EFAULT; + if(copy_from_user(&i, arg, sizeof(i))) + return -EFAULT; if(i==0) { DEBUG("PlanB: IOCTL VIDIOCCAPTURE Stop\n"); @@ -1695,7 +1695,7 @@ static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg) struct video_window vw; struct video_clip clip; int i; - + DEBUG("PlanB: IOCTL VIDIOCSWIN\n"); if(copy_from_user(&vw,arg,sizeof(vw))) @@ -1749,7 +1749,7 @@ static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg) return -EFAULT; return 0; } - case VIDIOCSYNC: { + case VIDIOCSYNC: { int i; IDEBUG("PlanB: IOCTL VIDIOCSYNC\n"); @@ -1759,42 +1759,42 @@ static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg) IDEBUG("PlanB: sync to frame %d\n", i); - if(i > (MAX_GBUFFERS - 1) || i < 0) - return -EINVAL; + if(i > (MAX_GBUFFERS - 1) || i < 0) + return -EINVAL; chk_grab: - switch (pb->frame_stat[i]) { - case GBUFFER_UNUSED: - return -EINVAL; + switch (pb->frame_stat[i]) { + case GBUFFER_UNUSED: + return -EINVAL; case GBUFFER_GRABBING: IDEBUG("PlanB: waiting for grab" " done (%d)\n", i); - interruptible_sleep_on(&pb->capq); + interruptible_sleep_on(&pb->capq); if(signal_pending(current)) return -EINTR; goto chk_grab; - case GBUFFER_DONE: - pb->frame_stat[i] = GBUFFER_UNUSED; - break; - } - return 0; + case GBUFFER_DONE: + pb->frame_stat[i] = GBUFFER_UNUSED; + break; + } + return 0; } - case VIDIOCMCAPTURE: + case VIDIOCMCAPTURE: { - struct video_mmap vm; + struct video_mmap vm; volatile unsigned int status; IDEBUG("PlanB: IOCTL VIDIOCMCAPTURE\n"); if(copy_from_user((void *) &vm,(void *)arg,sizeof(vm))) return -EFAULT; - status = pb->frame_stat[vm.frame]; - if (status != GBUFFER_UNUSED) - return -EBUSY; + status = pb->frame_stat[vm.frame]; + if (status != GBUFFER_UNUSED) + return -EBUSY; - return vgrab(pb, &vm); + return vgrab(pb, &vm); } - + case VIDIOCGMBUF: { int i; @@ -1811,7 +1811,7 @@ chk_grab: return -EFAULT; return 0; } - + case PLANBIOCGSAAREGS: { struct planb_saa_regs preg; @@ -1828,7 +1828,7 @@ chk_grab: return -EFAULT; return 0; } - + case PLANBIOCSSAAREGS: { struct planb_saa_regs preg; @@ -1842,7 +1842,7 @@ chk_grab: saa_set (preg.addr, preg.val, pb); return 0; } - + case PLANBIOCGSTAT: { struct planb_stat_regs pstat; @@ -1859,7 +1859,7 @@ chk_grab: return -EFAULT; return 0; } - + case PLANBIOCSMODE: { int v; @@ -1985,10 +1985,10 @@ static int planb_mmap(struct vm_area_struct *vma, struct video_device *dev, cons { int i; struct planb *pb = (struct planb *)dev; - unsigned long start = (unsigned long)adr; + unsigned long start = (unsigned long)adr; if (size > MAX_GBUFFERS * PLANB_MAX_FBUF) - return -EINVAL; + return -EINVAL; if (!pb->rawbuf) { int err; if((err=grabbuf_alloc(pb))) @@ -2091,10 +2091,10 @@ static int init_planb(struct planb *pb) /* clear interrupt mask */ pb->intr_mask = PLANB_CLR_IRQ; - result = request_irq(pb->irq, planb_irq, 0, "PlanB", (void *)pb); - if (result < 0) { - if (result==-EINVAL) - printk(KERN_ERR "PlanB: Bad irq number (%d) " + result = request_irq(pb->irq, planb_irq, 0, "PlanB", (void *)pb); + if (result < 0) { + if (result==-EINVAL) + printk(KERN_ERR "PlanB: Bad irq number (%d) " "or handler\n", (int)pb->irq); else if (result==-EBUSY) printk(KERN_ERR "PlanB: I don't know why, " @@ -2102,7 +2102,7 @@ static int init_planb(struct planb *pb) return result; } disable_irq(pb->irq); - + /* Now add the template and register the device unit. */ memcpy(&pb->video_dev,&planb_template,sizeof(planb_template)); @@ -2143,7 +2143,7 @@ static int init_planb(struct planb *pb) } /* - * Scan for a PlanB controller, request the irq and map the io memory + * Scan for a PlanB controller, request the irq and map the io memory */ static int find_planb(void) @@ -2171,9 +2171,9 @@ static int find_planb(void) pb = &planbs[0]; planb_num = 1; - if (planb_devices->n_addrs != 1) { - printk (KERN_WARNING "PlanB: expecting 1 address for planb " - "(got %d)", planb_devices->n_addrs); + if (planb_devices->n_addrs != 1) { + printk (KERN_WARNING "PlanB: expecting 1 address for planb " + "(got %d)", planb_devices->n_addrs); return 0; } @@ -2236,7 +2236,7 @@ static int find_planb(void) pb->planb_base = planb_regs; pb->planb_base_phys = (struct planb_registers *)new_base; pb->irq = irq; - + return planb_num; err_out_disable: @@ -2251,7 +2251,7 @@ static void release_planb(void) int i; struct planb *pb; - for (i=0;i<planb_num; i++) + for (i=0;i<planb_num; i++) { pb=&planbs[i]; @@ -2278,7 +2278,7 @@ static void release_planb(void) static int __init init_planbs(void) { int i; - + if (find_planb()<=0) return -EIO; @@ -2288,9 +2288,9 @@ static int __init init_planbs(void) " with v4l\n", i); release_planb(); return -EIO; - } + } printk(KERN_INFO "PlanB: registered device %d with v4l\n", i); - } + } return 0; } diff --git a/drivers/media/video/planb.h b/drivers/media/video/planb.h index 79b6b561426e..92823211d0c5 100644 --- a/drivers/media/video/planb.h +++ b/drivers/media/video/planb.h @@ -1,4 +1,4 @@ -/* +/* planb - PlanB frame grabber driver PlanB is used in the 7x00/8x00 series of PowerMacintosh @@ -167,7 +167,7 @@ struct planb { struct video_device video_dev; struct video_picture picture; /* Current picture params */ struct video_audio audio_dev; /* Current audio params */ - + volatile struct planb_registers *planb_base; /* virt base of planb */ struct planb_registers *planb_base_phys; /* phys base of planb */ void *priv_space; /* Org. alloc. mem for kfree */ @@ -209,7 +209,7 @@ struct planb { int gwidth[MAX_GBUFFERS], gheight[MAX_GBUFFERS]; unsigned int gfmt[MAX_GBUFFERS]; int gnorm_switch[MAX_GBUFFERS]; - volatile unsigned int *frame_stat; + volatile unsigned int *frame_stat; #define GBUFFER_UNUSED 0x00U #define GBUFFER_GRABBING 0x01U #define GBUFFER_DONE 0x02U diff --git a/drivers/media/video/pms.c b/drivers/media/video/pms.c index 05ca55939e77..09835ca098b1 100644 --- a/drivers/media/video/pms.c +++ b/drivers/media/video/pms.c @@ -12,10 +12,10 @@ * Most of this code is directly derived from his userspace driver. * His driver works so send any reports to alan@redhat.com unless the * userspace driver also doesn't work for you... - * + * * Changes: * 08/07/2003 Daniele Bellucci <bellucda@tiscali.it> - * - pms_capture: report back -EFAULT + * - pms_capture: report back -EFAULT */ #include <linux/module.h> @@ -66,14 +66,14 @@ static int standard = 0; /* 0 - auto 1 - ntsc 2 - pal 3 - secam */ /* * I/O ports and Shared Memory */ - + static int io_port = 0x250; static int data_port = 0x251; static int mem_base = 0xC8000; static void __iomem *mem; static int video_nr = -1; - + static inline void mvv_write(u8 index, u8 value) { @@ -90,9 +90,9 @@ static int pms_i2c_stat(u8 slave) { int counter; int i; - + outb(0x28, io_port); - + counter=0; while((inb(data_port)&0x01)==0) if(counter++==256) @@ -101,9 +101,9 @@ static int pms_i2c_stat(u8 slave) while((inb(data_port)&0x01)!=0) if(counter++==256) break; - + outb(slave, io_port); - + counter=0; while((inb(data_port)&0x01)==0) if(counter++==256) @@ -112,7 +112,7 @@ static int pms_i2c_stat(u8 slave) while((inb(data_port)&0x01)!=0) if(counter++==256) break; - + for(i=0;i<12;i++) { char st=inb(data_port); @@ -122,7 +122,7 @@ static int pms_i2c_stat(u8 slave) break; } outb(0x29, io_port); - return inb(data_port); + return inb(data_port); } static int pms_i2c_write(u16 slave, u16 sub, u16 data) @@ -130,19 +130,19 @@ static int pms_i2c_write(u16 slave, u16 sub, u16 data) int skip=0; int count; int i; - + for(i=0;i<i2c_count;i++) { if((i2cinfo[i].slave==slave) && (i2cinfo[i].sub == sub)) { - if(i2cinfo[i].data==data) - skip=1; - i2cinfo[i].data=data; - i=i2c_count+1; + if(i2cinfo[i].data==data) + skip=1; + i2cinfo[i].data=data; + i=i2c_count+1; } } - + if(i==i2c_count && i2c_count<64) { i2cinfo[i2c_count].slave=slave; @@ -150,16 +150,16 @@ static int pms_i2c_write(u16 slave, u16 sub, u16 data) i2cinfo[i2c_count].data=data; i2c_count++; } - + if(skip) return 0; - + mvv_write(0x29, sub); mvv_write(0x2A, data); mvv_write(0x28, slave); - + outb(0x28, io_port); - + count=0; while((inb(data_port)&1)==0) if(count>255) @@ -167,9 +167,9 @@ static int pms_i2c_write(u16 slave, u16 sub, u16 data) while((inb(data_port)&1)!=0) if(count>255) break; - + count=inb(data_port); - + if(count&2) return -1; return count; @@ -189,8 +189,8 @@ static int pms_i2c_read(int slave, int sub) static void pms_i2c_andor(int slave, int sub, int and, int or) { - u8 tmp; - + u8 tmp; + tmp=pms_i2c_read(slave, sub); tmp = (tmp&and)|or; pms_i2c_write(slave, sub, tmp); @@ -199,7 +199,7 @@ static void pms_i2c_andor(int slave, int sub, int and, int or) /* * Control functions */ - + static void pms_videosource(short source) { @@ -234,8 +234,8 @@ static void pms_colour(short colour) break; } } - - + + static void pms_contrast(short contrast) { switch(decoder) @@ -269,14 +269,14 @@ static void pms_format(short format) { int target; standard = format; - + if(decoder==PHILIPS1) target=0x42; else if(decoder==PHILIPS2) target=0x8A; else return; - + switch(format) { case 0: /* Auto */ @@ -302,7 +302,7 @@ static void pms_format(short format) /* * These features of the PMS card are not currently exposes. They - * could become a private v4l ioctl for PMSCONFIG or somesuch if + * could become a private v4l ioctl for PMSCONFIG or somesuch if * people need it. We also don't yet use the PMS interrupt. */ @@ -324,7 +324,7 @@ static void pms_hstart(short start) /* * Bandpass filters */ - + static void pms_bandpass(short pass) { if(decoder==PHILIPS2) @@ -493,7 +493,7 @@ static void pms_vert(u8 deciden, u8 decinum) /* * Turn 16bit ratios into best small ratio the chipset can grok */ - + static void pms_vertdeci(unsigned short decinum, unsigned short deciden) { /* Knock it down by /5 once */ @@ -546,7 +546,7 @@ static void pms_horzdeci(short decinum, short deciden) decinum=512; deciden=640; /* 768 would be ideal */ } - + while(((decinum|deciden)&1)==0) { decinum>>=1; @@ -559,7 +559,7 @@ static void pms_horzdeci(short decinum, short deciden) } if(deciden==32) deciden--; - + mvv_write(0x24, 0x80|deciden); mvv_write(0x25, decinum); } @@ -567,14 +567,14 @@ static void pms_horzdeci(short decinum, short deciden) static void pms_resolution(short width, short height) { int fg_height; - + fg_height=height; if(fg_height>280) fg_height=280; - + mvv_write(0x18, fg_height); mvv_write(0x19, fg_height>>8); - + if(standard==1) { mvv_write(0x1A, 0xFC); @@ -598,7 +598,7 @@ static void pms_resolution(short width, short height) mvv_write(0x42, 0x00); mvv_write(0x43, 0x00); mvv_write(0x44, MVVMEMORYWIDTH); - + mvv_write(0x22, width+8); mvv_write(0x23, (width+8)>> 8); @@ -618,7 +618,7 @@ static void pms_resolution(short width, short height) /* * Set Input */ - + static void pms_vcrinput(short input) { if(decoder==PHILIPS2) @@ -643,20 +643,20 @@ static int pms_capture(struct pms_device *dev, char __user *buf, int rgb555, int mvv_write(0x08,r8); /* capture rgb555/565, init DRAM, PC enable */ /* printf("%d %d %d %d %d %x %x\n",width,height,voff,nom,den,mvv_buf); */ - - for (y = 0; y < dev->height; y++ ) + + for (y = 0; y < dev->height; y++ ) { writeb(0, mem); /* synchronisiert neue Zeile */ - + /* * This is in truth a fifo, be very careful as if you * forgot this odd things will occur 8) */ - + memcpy_fromio(tmp, mem, dw+32); /* discard 16 word */ cnt -= dev->height; - while (cnt <= 0) - { + while (cnt <= 0) + { /* * Don't copy too far */ @@ -666,7 +666,7 @@ static int pms_capture(struct pms_device *dev, char __user *buf, int rgb555, int cnt += dev->height; if (copy_to_user(buf, tmp+32, dt)) return len ? len : -EFAULT; - buf += dt; + buf += dt; len += dt; } } @@ -683,7 +683,7 @@ static int pms_do_ioctl(struct inode *inode, struct file *file, { struct video_device *dev = video_devdata(file); struct pms_device *pd=(struct pms_device *)dev; - + switch(cmd) { case VIDIOCGCAP: @@ -806,7 +806,7 @@ static int pms_do_ioctl(struct inode *inode, struct file *file, ||(p->palette==VIDEO_PALETTE_RGB555 && p->depth==15))) return -EINVAL; pd->picture= *p; - + /* * Now load the card. */ @@ -815,7 +815,7 @@ static int pms_do_ioctl(struct inode *inode, struct file *file, pms_brightness(p->brightness>>8); pms_hue(p->hue>>8); pms_colour(p->colour>>8); - pms_contrast(p->contrast>>8); + pms_contrast(p->contrast>>8); mutex_unlock(&pd->lock); return 0; } @@ -873,7 +873,7 @@ static ssize_t pms_read(struct file *file, char __user *buf, struct video_device *v = video_devdata(file); struct pms_device *pd=(struct pms_device *)v; int len; - + mutex_lock(&pd->lock); len=pms_capture(pd, buf, (pd->picture.depth==16)?0:1,count); mutex_unlock(&pd->lock); @@ -905,13 +905,13 @@ static struct pms_device pms_device; /* * Probe for and initialise the Mediavision PMS */ - + static int init_mediavision(void) { int id; int idec, decst; int i; - + unsigned char i2c_defs[]={ 0x4C,0x30,0x00,0xE8, 0xB6,0xE2,0x00,0x00, @@ -925,7 +925,7 @@ static int init_mediavision(void) mem = ioremap(mem_base, 0x800); if (!mem) return -ENOMEM; - + if (!request_region(0x9A01, 1, "Mediavision PMS config")) { printk(KERN_WARNING "mediavision: unable to detect: 0x9A01 in use.\n"); @@ -941,18 +941,18 @@ static int init_mediavision(void) } outb(0xB8, 0x9A01); /* Unlock */ outb(io_port>>4, 0x9A01); /* Set IO port */ - - + + id=mvv_read(3); decst=pms_i2c_stat(0x43); - + if(decst!=-1) idec=2; else if(pms_i2c_stat(0xb9)!=-1) idec=3; else if(pms_i2c_stat(0x8b)!=-1) idec=1; - else + else idec=0; printk(KERN_INFO "PMS type is %d\n", idec); @@ -966,11 +966,11 @@ static int init_mediavision(void) /* * Ok we have a PMS of some sort */ - + mvv_write(0x04, mem_base>>12); /* Set the memory area */ - + /* Ok now load the defaults */ - + for(i=0;i<0x19;i++) { if(i2c_defs[i]==0xFF) @@ -978,7 +978,7 @@ static int init_mediavision(void) else pms_i2c_write(0x8A, i, i2c_defs[i]); } - + pms_i2c_write(0xB8,0x00,0x12); pms_i2c_write(0xB8,0x04,0x00); pms_i2c_write(0xB8,0x07,0x00); @@ -987,18 +987,18 @@ static int init_mediavision(void) pms_i2c_write(0xB8,0x0A,0x00); pms_i2c_write(0xB8,0x0B,0x10); pms_i2c_write(0xB8,0x10,0x03); - + mvv_write(0x01, 0x00); mvv_write(0x05, 0xA0); mvv_write(0x08, 0x25); mvv_write(0x09, 0x00); - mvv_write(0x0A, 0x20|MVVMEMORYWIDTH); - + mvv_write(0x0A, 0x20|MVVMEMORYWIDTH); + mvv_write(0x10, 0x02); mvv_write(0x1E, 0x0C); mvv_write(0x1F, 0x03); mvv_write(0x26, 0x06); - + mvv_write(0x2B, 0x00); mvv_write(0x2C, 0x20); mvv_write(0x2D, 0x00); @@ -1018,13 +1018,13 @@ static int init_mediavision(void) /* * Initialization and module stuff */ - + static int __init init_pms_cards(void) { printk(KERN_INFO "Mediavision Pro Movie Studio driver 0.02\n"); - + data_port = io_port +1; - + if(init_mediavision()) { printk(KERN_INFO "Board not found.\n"); diff --git a/drivers/usb/media/pwc/Makefile b/drivers/media/video/pwc/Makefile index 2d93a775011a..8326684f49f3 100644 --- a/drivers/usb/media/pwc/Makefile +++ b/drivers/media/video/pwc/Makefile @@ -15,6 +15,6 @@ default: endif clean: - rm -f *.[oas] .*.flags *.ko .*.cmd .*.d .*.tmp *.mod.c + rm -f *.[oas] .*.flags *.ko .*.cmd .*.d .*.tmp *.mod.c rm -rf .tmp_versions diff --git a/drivers/usb/media/pwc/philips.txt b/drivers/media/video/pwc/philips.txt index 04a640d723ed..11f751a6bda5 100644 --- a/drivers/usb/media/pwc/philips.txt +++ b/drivers/media/video/pwc/philips.txt @@ -47,17 +47,17 @@ don't know how to set it properly in the driver. The options are: size Can be one of 'sqcif', 'qsif', 'qcif', 'sif', 'cif' or 'vga', for an image size of resp. 128x96, 160x120, 176x144, - 320x240, 352x288 and 640x480 (of course, only for those cameras that + 320x240, 352x288 and 640x480 (of course, only for those cameras that support these resolutions). fps Specifies the desired framerate. Is an integer in the range of 4-30. fbufs - This paramter specifies the number of internal buffers to use for storing - frames from the cam. This will help if the process that reads images from - the cam is a bit slow or momentarely busy. However, on slow machines it - only introduces lag, so choose carefully. The default is 3, which is + This paramter specifies the number of internal buffers to use for storing + frames from the cam. This will help if the process that reads images from + the cam is a bit slow or momentarely busy. However, on slow machines it + only introduces lag, so choose carefully. The default is 3, which is reasonable. You can set it between 2 and 5. mbufs @@ -65,9 +65,9 @@ mbufs buffers to reserve for mmap(), VIDIOCCGMBUF, VIDIOCMCAPTURE and friends. The default is 2, which is adequate for most applications (double buffering). - + Should you experience a lot of 'Dumping frame...' messages during - grabbing with a tool that uses mmap(), you might want to increase if. + grabbing with a tool that uses mmap(), you might want to increase if. However, it doesn't really buffer images, it just gives you a bit more slack when your program is behind. But you need a multi-threaded or forked program to really take advantage of these buffers. @@ -88,15 +88,15 @@ power_save compression (only useful with the plugin) With this option you can control the compression factor that the camera - uses to squeeze the image through the USB bus. You can set the + uses to squeeze the image through the USB bus. You can set the parameter between 0 and 3: 0 = prefer uncompressed images; if the requested mode is not available - in an uncompressed format, the driver will silently switch to low - compression. + in an uncompressed format, the driver will silently switch to low + compression. 1 = low compression. 2 = medium compression. 3 = high compression. - + High compression takes less bandwidth of course, but it could also introduce some unwanted artefacts. The default is 2, medium compression. See the FAQ on the website for an overview of which modes require @@ -112,7 +112,7 @@ leds this is let the LED blink while the camera is in use. This: leds=500,500 - + will blink the LED once every second. But with: leds=0,0 @@ -123,7 +123,7 @@ leds when the camera is not used anymore. This parameter works only with the ToUCam range of cameras (720, 730, 740, - 750) and OEMs. For other cameras this command is silently ignored, and + 750) and OEMs. For other cameras this command is silently ignored, and the LED cannot be controlled. Finally: this parameters does not take effect UNTIL the first time you @@ -144,35 +144,35 @@ dev_hint format: [type[.serialnumber]:]node - + The square brackets mean that both the type and the serialnumber are optional, but a serialnumber cannot be specified without a type (which would be rather pointless). The serialnumber is separated from the type by a '.'; the node number by a ':'. - + This somewhat cryptic syntax is best explained by a few examples: dev_hint=3,5 The first detected cam gets assigned - /dev/video3, the second /dev/video5. Any - other cameras will get the first free - available slot (see below). + /dev/video3, the second /dev/video5. Any + other cameras will get the first free + available slot (see below). dev_hint=645:1,680:2 The PCA645 camera will get /dev/video1, - and a PCVC680 /dev/video2. - - dev_hint=645.0123:3,645.4567:0 The PCA645 camera with serialnumber - 0123 goes to /dev/video3, the same - camera model with the 4567 serial - gets /dev/video0. + and a PCVC680 /dev/video2. + + dev_hint=645.0123:3,645.4567:0 The PCA645 camera with serialnumber + 0123 goes to /dev/video3, the same + camera model with the 4567 serial + gets /dev/video0. - dev_hint=750:1,4,5,6 The PCVC750 camera will get /dev/video1, the - next 3 Philips cams will use /dev/video4 - through /dev/video6. + dev_hint=750:1,4,5,6 The PCVC750 camera will get /dev/video1, the + next 3 Philips cams will use /dev/video4 + through /dev/video6. Some points worth knowing: - - Serialnumbers are case sensitive and must be written full, including + - Serialnumbers are case sensitive and must be written full, including leading zeroes (it's treated as a string). - - If a device node is already occupied, registration will fail and + - If a device node is already occupied, registration will fail and the webcam is not available. - You can have up to 64 video devices; be sure to make enough device nodes in /dev if you want to spread the numbers (this does not apply @@ -186,13 +186,13 @@ trace kernel log at debug level. The trace variable is a bitmask; each bit represents a certain feature. - If you want to trace something, look up the bit value(s) in the table + If you want to trace something, look up the bit value(s) in the table below, add the values together and supply that to the trace variable. Value Value Description Default (dec) (hex) 1 0x1 Module initialization; this will log messages On - while loading and unloading the module + while loading and unloading the module 2 0x2 probe() and disconnect() traces On @@ -203,7 +203,7 @@ trace 16 0x10 Memory allocation of buffers, etc. Off 32 0x20 Showing underflow, overflow and Dumping frame On - messages + messages 64 0x40 Show viewport and image sizes Off @@ -217,7 +217,7 @@ trace Example: - + # modprobe pwc size=cif fps=15 power_save=1 The fbufs, mbufs and trace parameters are global and apply to all connected diff --git a/drivers/usb/media/pwc/pwc-ctrl.c b/drivers/media/video/pwc/pwc-ctrl.c index 0398b812e0ce..4ba549bfa0e0 100644 --- a/drivers/usb/media/pwc/pwc-ctrl.c +++ b/drivers/media/video/pwc/pwc-ctrl.c @@ -31,17 +31,17 @@ /* Changes - 2001/08/03 Alvarado Added methods for changing white balance and - red/green gains + 2001/08/03 Alvarado Added methods for changing white balance and + red/green gains */ /* Control functions for the cam; brightness, contrast, video mode, etc. */ #ifdef __KERNEL__ -#include <asm/uaccess.h> +#include <asm/uaccess.h> #endif #include <asm/errno.h> - + #include "pwc.h" #include "pwc-ioctl.h" #include "pwc-uncompress.h" @@ -116,13 +116,13 @@ static const char *size2name[PSZ_MAX] = "SIF", "CIF", "VGA", -}; +}; /********/ -/* Entries for the Nala (645/646) camera; the Nala doesn't have compression +/* Entries for the Nala (645/646) camera; the Nala doesn't have compression preferences, so you either get compressed or non-compressed streams. - + An alternate value of 0 means this mode is not available at all. */ @@ -205,13 +205,13 @@ static inline int set_video_mode_Nala(struct pwc_device *pdev, int size, int fra { /* closest match of framerate */ 0, 0, 0, 0, 4, /* 0-4 */ 5, 5, 7, 7, 10, /* 5-9 */ - 10, 10, 12, 12, 15, /* 10-14 */ - 15, 15, 15, 20, 20, /* 15-19 */ - 20, 20, 20, 24, 24, /* 20-24 */ - 24, 24, 24, 24, 24, /* 25-29 */ - 24 /* 30 */ + 10, 10, 12, 12, 15, /* 10-14 */ + 15, 15, 15, 20, 20, /* 15-19 */ + 20, 20, 20, 24, 24, /* 20-24 */ + 24, 24, 24, 24, 24, /* 25-29 */ + 24 /* 30 */ }; - int frames2table[31] = + int frames2table[31] = { 0, 0, 0, 0, 0, /* 0-4 */ 1, 1, 1, 2, 2, /* 5-9 */ 3, 3, 4, 4, 4, /* 10-14 */ @@ -220,7 +220,7 @@ static inline int set_video_mode_Nala(struct pwc_device *pdev, int size, int fra 7, 7, 7, 7, 7, /* 25-29 */ 7 /* 30 */ }; - + if (size < 0 || size > PSZ_CIF || frames < 4 || frames > 25) return -EINVAL; frames = frames2frames[frames]; @@ -232,7 +232,7 @@ static inline int set_video_mode_Nala(struct pwc_device *pdev, int size, int fra if (pEntry->compressed) return -ENOENT; /* Not supported. */ - memcpy(buf, pEntry->mode, 3); + memcpy(buf, pEntry->mode, 3); ret = send_video_command(pdev->udev, pdev->vendpoint, buf, 3); if (ret < 0) { Debug("Failed to send video command... %d\n", ret); @@ -257,7 +257,7 @@ static inline int set_video_mode_Nala(struct pwc_device *pdev, int size, int fra break; } } - + pdev->cmd_len = 3; memcpy(pdev->cmd_buf, buf, 3); @@ -352,13 +352,13 @@ static inline int set_video_mode_Kiara(struct pwc_device *pdev, int size, int fr /* special case: VGA @ 5 fps and snapshot is raw bayer mode */ if (size == PSZ_VGA && frames == 5 && snapshot) { - /* Only available in case the raw palette is selected or - we have the decompressor available. This mode is - only available in compressed form + /* Only available in case the raw palette is selected or + we have the decompressor available. This mode is + only available in compressed form */ if (pdev->vpalette == VIDEO_PALETTE_RAW) { - Info("Choosing VGA/5 BAYER mode (%d).\n", pdev->vpalette); + Info("Choosing VGA/5 BAYER mode (%d).\n", pdev->vpalette); pChoose = &RawEntry; } else @@ -368,9 +368,9 @@ static inline int set_video_mode_Kiara(struct pwc_device *pdev, int size, int fr } else { - /* Find a supported framerate with progressively higher compression ratios + /* Find a supported framerate with progressively higher compression ratios if the preferred ratio is not available. - Skip this step when using RAW modes. + Skip this step when using RAW modes. */ while (compression <= 3) { pChoose = &Kiara_table[size][fps][compression]; @@ -383,7 +383,7 @@ static inline int set_video_mode_Kiara(struct pwc_device *pdev, int size, int fr return -ENOENT; /* Not supported. */ Debug("Using alternate setting %d.\n", pChoose->alternate); - + /* usb_control_msg won't take staticly allocated arrays as argument?? */ memcpy(buf, pChoose->mode, 12); if (snapshot) @@ -463,9 +463,9 @@ static void pwc_set_image_buffer_size(struct pwc_device *pdev) */ int pwc_set_video_mode(struct pwc_device *pdev, int width, int height, int frames, int compression, int snapshot) { - int ret, size; + int ret, size; - Trace(TRACE_FLOW, "set_video_mode(%dx%d @ %d, palette %d).\n", width, height, frames, pdev->vpalette); + Trace(TRACE_FLOW, "set_video_mode(%dx%d @ %d, palette %d).\n", width, height, frames, pdev->vpalette); size = pwc_decode_size(pdev, width, height); if (size < 0) { Debug("Could not find suitable size.\n"); @@ -473,7 +473,7 @@ int pwc_set_video_mode(struct pwc_device *pdev, int width, int height, int frame } Debug("decode_size = %d.\n", size); - ret = -EINVAL; + ret = -EINVAL; switch(pdev->type) { case 645: case 646: @@ -485,7 +485,7 @@ int pwc_set_video_mode(struct pwc_device *pdev, int width, int height, int frame case 690: ret = set_video_mode_Timon(pdev, size, frames, compression, snapshot); break; - + case 720: case 730: case 740: @@ -517,7 +517,7 @@ int pwc_get_brightness(struct pwc_device *pdev) char buf; int ret; - ret = RecvControlMsg(GET_LUM_CTL, BRIGHTNESS_FORMATTER, 1); + ret = RecvControlMsg(GET_LUM_CTL, BRIGHTNESS_FORMATTER, 1); if (ret < 0) return ret; return buf << 9; @@ -566,7 +566,7 @@ int pwc_get_gamma(struct pwc_device *pdev) { char buf; int ret; - + ret = RecvControlMsg(GET_LUM_CTL, GAMMA_FORMATTER, 1); if (ret < 0) return ret; @@ -622,14 +622,14 @@ static inline int pwc_set_agc(struct pwc_device *pdev, int mode, int value) { char buf; int ret; - + if (mode) buf = 0x0; /* auto */ else buf = 0xff; /* fixed */ ret = SendControlMsg(SET_LUM_CTL, AGC_MODE_FORMATTER, 1); - + if (!mode && ret >= 0) { if (value < 0) value = 0; @@ -647,7 +647,7 @@ static inline int pwc_get_agc(struct pwc_device *pdev, int *value) { unsigned char buf; int ret; - + ret = RecvControlMsg(GET_LUM_CTL, AGC_MODE_FORMATTER, 1); if (ret < 0) return ret; @@ -658,7 +658,7 @@ static inline int pwc_get_agc(struct pwc_device *pdev, int *value) return ret; if (buf > 0x3F) buf = 0x3F; - *value = (buf << 10); + *value = (buf << 10); } else { /* auto */ ret = RecvControlMsg(GET_STATUS_CTL, READ_AGC_FORMATTER, 1); @@ -683,7 +683,7 @@ static inline int pwc_set_shutter_speed(struct pwc_device *pdev, int mode, int v buf[0] = 0x0; /* auto */ else buf[0] = 0xff; /* fixed */ - + ret = SendControlMsg(SET_LUM_CTL, SHUTTER_MODE_FORMATTER, 1); if (!mode && ret >= 0) { @@ -713,7 +713,7 @@ static inline int pwc_set_shutter_speed(struct pwc_device *pdev, int mode, int v ret = SendControlMsg(SET_LUM_CTL, PRESET_SHUTTER_FORMATTER, 2); } return ret; -} +} /* POWER */ @@ -765,22 +765,22 @@ static inline int pwc_restore_factory(struct pwc_device *pdev) * 02: fluorescent lighting * 03: manual * 04: auto - */ + */ static inline int pwc_set_awb(struct pwc_device *pdev, int mode) { char buf; int ret; - + if (mode < 0) mode = 0; - + if (mode > 4) mode = 4; - + buf = mode & 0x07; /* just the lowest three bits */ - + ret = SendControlMsg(SET_CHROM_CTL, WB_MODE_FORMATTER, 1); - + if (ret < 0) return ret; return 0; @@ -790,17 +790,17 @@ static inline int pwc_get_awb(struct pwc_device *pdev) { unsigned char buf; int ret; - + ret = RecvControlMsg(GET_CHROM_CTL, WB_MODE_FORMATTER, 1); - if (ret < 0) + if (ret < 0) return ret; return buf; } static inline int pwc_set_red_gain(struct pwc_device *pdev, int value) { - unsigned char buf; + unsigned char buf; if (value < 0) value = 0; @@ -815,7 +815,7 @@ static inline int pwc_get_red_gain(struct pwc_device *pdev, int *value) { unsigned char buf; int ret; - + ret = RecvControlMsg(GET_CHROM_CTL, PRESET_MANUAL_RED_GAIN_FORMATTER, 1); if (ret < 0) return ret; @@ -841,7 +841,7 @@ static inline int pwc_get_blue_gain(struct pwc_device *pdev, int *value) { unsigned char buf; int ret; - + ret = RecvControlMsg(GET_CHROM_CTL, PRESET_MANUAL_BLUE_GAIN_FORMATTER, 1); if (ret < 0) return ret; @@ -851,14 +851,14 @@ static inline int pwc_get_blue_gain(struct pwc_device *pdev, int *value) /* The following two functions are different, since they only read the - internal red/blue gains, which may be different from the manual + internal red/blue gains, which may be different from the manual gains set or read above. - */ + */ static inline int pwc_read_red_gain(struct pwc_device *pdev, int *value) { unsigned char buf; int ret; - + ret = RecvControlMsg(GET_STATUS_CTL, READ_RED_GAIN_FORMATTER, 1); if (ret < 0) return ret; @@ -870,7 +870,7 @@ static inline int pwc_read_blue_gain(struct pwc_device *pdev, int *value) { unsigned char buf; int ret; - + ret = RecvControlMsg(GET_STATUS_CTL, READ_BLUE_GAIN_FORMATTER, 1); if (ret < 0) return ret; @@ -882,7 +882,7 @@ static inline int pwc_read_blue_gain(struct pwc_device *pdev, int *value) static inline int pwc_set_wb_speed(struct pwc_device *pdev, int speed) { unsigned char buf; - + /* useful range is 0x01..0x20 */ buf = speed / 0x7f0; return SendControlMsg(SET_CHROM_CTL, AWB_CONTROL_SPEED_FORMATTER, 1); @@ -892,7 +892,7 @@ static inline int pwc_get_wb_speed(struct pwc_device *pdev, int *value) { unsigned char buf; int ret; - + ret = RecvControlMsg(GET_CHROM_CTL, AWB_CONTROL_SPEED_FORMATTER, 1); if (ret < 0) return ret; @@ -904,7 +904,7 @@ static inline int pwc_get_wb_speed(struct pwc_device *pdev, int *value) static inline int pwc_set_wb_delay(struct pwc_device *pdev, int delay) { unsigned char buf; - + /* useful range is 0x01..0x3F */ buf = (delay >> 10); return SendControlMsg(SET_CHROM_CTL, AWB_CONTROL_DELAY_FORMATTER, 1); @@ -914,7 +914,7 @@ static inline int pwc_get_wb_delay(struct pwc_device *pdev, int *value) { unsigned char buf; int ret; - + ret = RecvControlMsg(GET_CHROM_CTL, AWB_CONTROL_DELAY_FORMATTER, 1); if (ret < 0) return ret; @@ -950,7 +950,7 @@ static int pwc_get_leds(struct pwc_device *pdev, int *on_value, int *off_value) { unsigned char buf[2]; int ret; - + if (pdev->type < 730) { *on_value = -1; *off_value = -1; @@ -969,7 +969,7 @@ static inline int pwc_set_contour(struct pwc_device *pdev, int contour) { unsigned char buf; int ret; - + if (contour < 0) buf = 0xff; /* auto contour on */ else @@ -977,16 +977,16 @@ static inline int pwc_set_contour(struct pwc_device *pdev, int contour) ret = SendControlMsg(SET_LUM_CTL, AUTO_CONTOUR_FORMATTER, 1); if (ret < 0) return ret; - + if (contour < 0) return 0; if (contour > 0xffff) contour = 0xffff; - + buf = (contour >> 10); /* contour preset is [0..3f] */ ret = SendControlMsg(SET_LUM_CTL, PRESET_CONTOUR_FORMATTER, 1); - if (ret < 0) - return ret; + if (ret < 0) + return ret; return 0; } @@ -994,7 +994,7 @@ static inline int pwc_get_contour(struct pwc_device *pdev, int *contour) { unsigned char buf; int ret; - + ret = RecvControlMsg(GET_LUM_CTL, AUTO_CONTOUR_FORMATTER, 1); if (ret < 0) return ret; @@ -1002,7 +1002,7 @@ static inline int pwc_get_contour(struct pwc_device *pdev, int *contour) if (buf == 0) { /* auto mode off, query current preset value */ ret = RecvControlMsg(GET_LUM_CTL, PRESET_CONTOUR_FORMATTER, 1); - if (ret < 0) + if (ret < 0) return ret; *contour = buf << 10; } @@ -1015,7 +1015,7 @@ static inline int pwc_get_contour(struct pwc_device *pdev, int *contour) static inline int pwc_set_backlight(struct pwc_device *pdev, int backlight) { unsigned char buf; - + if (backlight) buf = 0xff; else @@ -1027,7 +1027,7 @@ static inline int pwc_get_backlight(struct pwc_device *pdev, int *backlight) { int ret; unsigned char buf; - + ret = RecvControlMsg(GET_LUM_CTL, BACK_LIGHT_COMPENSATION_FORMATTER, 1); if (ret < 0) return ret; @@ -1039,7 +1039,7 @@ static inline int pwc_get_backlight(struct pwc_device *pdev, int *backlight) static inline int pwc_set_flicker(struct pwc_device *pdev, int flicker) { unsigned char buf; - + if (flicker) buf = 0xff; else @@ -1051,7 +1051,7 @@ static inline int pwc_get_flicker(struct pwc_device *pdev, int *flicker) { int ret; unsigned char buf; - + ret = RecvControlMsg(GET_LUM_CTL, FLICKERLESS_MODE_FORMATTER, 1); if (ret < 0) return ret; @@ -1076,7 +1076,7 @@ static inline int pwc_get_dynamic_noise(struct pwc_device *pdev, int *noise) { int ret; unsigned char buf; - + ret = RecvControlMsg(GET_LUM_CTL, DYNAMIC_NOISE_CONTROL_FORMATTER, 1); if (ret < 0) return ret; @@ -1087,7 +1087,7 @@ static inline int pwc_get_dynamic_noise(struct pwc_device *pdev, int *noise) static int pwc_mpt_reset(struct pwc_device *pdev, int flags) { unsigned char buf; - + buf = flags & 0x03; // only lower two bits are currently used return SendControlMsg(SET_MPT_CTL, PT_RESET_CONTROL_FORMATTER, 1); } @@ -1095,7 +1095,7 @@ static int pwc_mpt_reset(struct pwc_device *pdev, int flags) static inline int pwc_mpt_set_angle(struct pwc_device *pdev, int pan, int tilt) { unsigned char buf[4]; - + /* set new relative angle; angles are expressed in degrees * 100, but cam as .5 degree resolution, hence divide by 200. Also the angle must be multiplied by 64 before it's send to @@ -1114,7 +1114,7 @@ static inline int pwc_mpt_get_status(struct pwc_device *pdev, struct pwc_mpt_sta { int ret; unsigned char buf[5]; - + ret = RecvControlMsg(GET_MPT_CTL, PT_STATUS_FORMATTER, 5); if (ret < 0) return ret; @@ -1129,14 +1129,14 @@ int pwc_get_cmos_sensor(struct pwc_device *pdev, int *sensor) { unsigned char buf; int ret = -1, request; - + if (pdev->type < 675) request = SENSOR_TYPE_FORMATTER1; else if (pdev->type < 730) return -1; /* The Vesta series doesn't have this call */ else request = SENSOR_TYPE_FORMATTER2; - + ret = RecvControlMsg(GET_STATUS_CTL, request, 1); if (ret < 0) return ret; @@ -1163,23 +1163,23 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) ret = -EINVAL; break; } - + case VIDIOCPWCSUSER: { if (pwc_save_user(pdev)) ret = -EINVAL; break; } - + case VIDIOCPWCFACTORY: { if (pwc_restore_factory(pdev)) ret = -EINVAL; break; } - + case VIDIOCPWCSCQUAL: - { + { int *qual = arg; if (*qual < 0 || *qual > 3) @@ -1190,14 +1190,14 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) pdev->vcompression = *qual; break; } - + case VIDIOCPWCGCQUAL: { int *qual = arg; *qual = pdev->vcompression; break; } - + case VIDIOCPWCPROBE: { struct pwc_probe *probe = arg; @@ -1220,27 +1220,27 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) ret = -EINVAL; break; } - + case VIDIOCPWCGAGC: { int *agc = arg; - + if (pwc_get_agc(pdev, agc)) ret = -EINVAL; break; } - + case VIDIOCPWCSSHUTTER: { int *shutter_speed = arg; ret = pwc_set_shutter_speed(pdev, *shutter_speed < 0 ? 1 : 0, *shutter_speed); break; } - - case VIDIOCPWCSAWB: + + case VIDIOCPWCSAWB: { struct pwc_whitebalance *wb = arg; - + ret = pwc_set_awb(pdev, wb->mode); if (ret >= 0 && wb->mode == PWC_WB_MANUAL) { pwc_set_red_gain(pdev, wb->manual_red); @@ -1270,18 +1270,18 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) ret = pwc_read_red_gain(pdev, &wb->read_red); if (ret < 0) break; - ret = pwc_read_blue_gain(pdev, &wb->read_blue); - if (ret < 0) - break; + ret = pwc_read_blue_gain(pdev, &wb->read_blue); + if (ret < 0) + break; } } break; } - + case VIDIOCPWCSAWBSPEED: { struct pwc_wb_speed *wbs = arg; - + if (wbs->control_speed > 0) { ret = pwc_set_wb_speed(pdev, wbs->control_speed); } @@ -1290,11 +1290,11 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) } break; } - + case VIDIOCPWCGAWBSPEED: { struct pwc_wb_speed *wbs = arg; - + ret = pwc_get_wb_speed(pdev, &wbs->control_speed); if (ret < 0) break; @@ -1304,7 +1304,7 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) break; } - case VIDIOCPWCSLED: + case VIDIOCPWCSLED: { struct pwc_leds *leds = arg; ret = pwc_set_leds(pdev, leds->led_on, leds->led_off); @@ -1325,14 +1325,14 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) ret = pwc_set_contour(pdev, *contour); break; } - + case VIDIOCPWCGCONTOUR: { int *contour = arg; ret = pwc_get_contour(pdev, contour); break; } - + case VIDIOCPWCSBACKLIGHT: { int *backlight = arg; @@ -1346,7 +1346,7 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) ret = pwc_get_backlight(pdev, backlight); break; } - + case VIDIOCPWCSFLICKER: { int *flicker = arg; @@ -1360,14 +1360,14 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) ret = pwc_get_flicker(pdev, flicker); break; } - + case VIDIOCPWCSDYNNOISE: { int *dynnoise = arg; ret = pwc_set_dynamic_noise(pdev, *dynnoise); break; } - + case VIDIOCPWCGDYNNOISE: { int *dynnoise = arg; @@ -1381,61 +1381,61 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) size->width = pdev->image.x; size->height = pdev->image.y; break; - } - - case VIDIOCPWCMPTRESET: - { - if (pdev->features & FEATURE_MOTOR_PANTILT) - { - int *flags = arg; + } + + case VIDIOCPWCMPTRESET: + { + if (pdev->features & FEATURE_MOTOR_PANTILT) + { + int *flags = arg; ret = pwc_mpt_reset(pdev, *flags); - if (ret >= 0) - { - pdev->pan_angle = 0; - pdev->tilt_angle = 0; - } - } - else - { - ret = -ENXIO; - } - break; - } - - case VIDIOCPWCMPTGRANGE: - { - if (pdev->features & FEATURE_MOTOR_PANTILT) - { - struct pwc_mpt_range *range = arg; - *range = pdev->angle_range; - } - else - { - ret = -ENXIO; - } - break; - } - - case VIDIOCPWCMPTSANGLE: - { - int new_pan, new_tilt; - - if (pdev->features & FEATURE_MOTOR_PANTILT) - { - struct pwc_mpt_angles *angles = arg; + if (ret >= 0) + { + pdev->pan_angle = 0; + pdev->tilt_angle = 0; + } + } + else + { + ret = -ENXIO; + } + break; + } + + case VIDIOCPWCMPTGRANGE: + { + if (pdev->features & FEATURE_MOTOR_PANTILT) + { + struct pwc_mpt_range *range = arg; + *range = pdev->angle_range; + } + else + { + ret = -ENXIO; + } + break; + } + + case VIDIOCPWCMPTSANGLE: + { + int new_pan, new_tilt; + + if (pdev->features & FEATURE_MOTOR_PANTILT) + { + struct pwc_mpt_angles *angles = arg; /* The camera can only set relative angles, so do some calculations when getting an absolute angle . */ if (angles->absolute) { - new_pan = angles->pan; - new_tilt = angles->tilt; - } - else - { - new_pan = pdev->pan_angle + angles->pan; - new_tilt = pdev->tilt_angle + angles->tilt; + new_pan = angles->pan; + new_tilt = angles->tilt; + } + else + { + new_pan = pdev->pan_angle + angles->pan; + new_tilt = pdev->tilt_angle + angles->tilt; } /* check absolute ranges */ if (new_pan < pdev->angle_range.pan_min || @@ -1463,53 +1463,53 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) pdev->tilt_angle += new_tilt; } if (ret == -EPIPE) /* stall -> out of range */ - ret = -ERANGE; + ret = -ERANGE; } - } - else - { - ret = -ENXIO; - } - break; - } - - case VIDIOCPWCMPTGANGLE: - { - - if (pdev->features & FEATURE_MOTOR_PANTILT) - { - struct pwc_mpt_angles *angles = arg; - - angles->absolute = 1; - angles->pan = pdev->pan_angle; - angles->tilt = pdev->tilt_angle; - } - else - { - ret = -ENXIO; - } - break; - } - - case VIDIOCPWCMPTSTATUS: - { - if (pdev->features & FEATURE_MOTOR_PANTILT) - { - struct pwc_mpt_status *status = arg; - ret = pwc_mpt_get_status(pdev, status); - } - else - { - ret = -ENXIO; - } - break; + } + else + { + ret = -ENXIO; + } + break; + } + + case VIDIOCPWCMPTGANGLE: + { + + if (pdev->features & FEATURE_MOTOR_PANTILT) + { + struct pwc_mpt_angles *angles = arg; + + angles->absolute = 1; + angles->pan = pdev->pan_angle; + angles->tilt = pdev->tilt_angle; + } + else + { + ret = -ENXIO; + } + break; + } + + case VIDIOCPWCMPTSTATUS: + { + if (pdev->features & FEATURE_MOTOR_PANTILT) + { + struct pwc_mpt_status *status = arg; + ret = pwc_mpt_get_status(pdev, status); + } + else + { + ret = -ENXIO; + } + break; } case VIDIOCPWCGVIDCMD: { struct pwc_video_command *cmd = arg; - - cmd->type = pdev->type; + + cmd->type = pdev->type; cmd->release = pdev->release; cmd->command_len = pdev->cmd_len; memcpy(&cmd->command_buf, pdev->cmd_buf, pdev->cmd_len); @@ -1531,7 +1531,7 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) ret = -ENOIOCTLCMD; break; } - + if (ret > 0) return 0; return ret; diff --git a/drivers/usb/media/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c index 90eb26042817..41418294a32b 100644 --- a/drivers/usb/media/pwc/pwc-if.c +++ b/drivers/media/video/pwc/pwc-if.c @@ -25,18 +25,18 @@ */ -/* +/* This code forms the interface between the USB layers and the Philips specific stuff. Some adanved stuff of the driver falls under an NDA, signed between me and Philips B.V., Eindhoven, the Netherlands, and - is thus not distributed in source form. The binary pwcx.o module + is thus not distributed in source form. The binary pwcx.o module contains the code that falls under the NDA. - - In case you're wondering: 'pwc' stands for "Philips WebCam", but + + In case you're wondering: 'pwc' stands for "Philips WebCam", but I really didn't want to type 'philips_web_cam' every time (I'm lazy as any Linux kernel hacker, but I don't like uncomprehensible abbreviations without explanation). - + Oh yes, convention: to disctinguish between all the various pointers to device-structures, I use these names for the pointer variables: udev: struct usb_device * @@ -170,14 +170,14 @@ static struct video_device pwc_template = { /* Okay, this is some magic that I worked out and the reasoning behind it... - The biggest problem with any USB device is of course: "what to do + The biggest problem with any USB device is of course: "what to do when the user unplugs the device while it is in use by an application?" We have several options: 1) Curse them with the 7 plagues when they do (requires divine intervention) 2) Tell them not to (won't work: they'll do it anyway) 3) Oops the kernel (this will have a negative effect on a user's uptime) 4) Do something sensible. - + Of course, we go for option 4. It happens that this device will be linked to two times, once from @@ -185,15 +185,15 @@ static struct video_device pwc_template = { pointers. This is done when the device is probed() and all initialization succeeded. The pwc_device struct links back to both structures. - When a device is unplugged while in use it will be removed from the - list of known USB devices; I also de-register it as a V4L device, but + When a device is unplugged while in use it will be removed from the + list of known USB devices; I also de-register it as a V4L device, but unfortunately I can't free the memory since the struct is still in use by the file descriptor. This free-ing is then deferend until the first opportunity. Crude, but it works. - + A small 'advantage' is that if a user unplugs the cam and plugs it back in, it should get assigned the same video device minor, but unfortunately - it's non-trivial to re-link the cam back to the video device... (that + it's non-trivial to re-link the cam back to the video device... (that would surely be magic! :)) */ @@ -203,14 +203,14 @@ static struct video_device pwc_template = { /* Here we want the physical address of the memory. * This is used when initializing the contents of the area. */ -static inline unsigned long kvirt_to_pa(unsigned long adr) +static inline unsigned long kvirt_to_pa(unsigned long adr) { - unsigned long kva, ret; + unsigned long kva, ret; kva = (unsigned long) page_address(vmalloc_to_page((void *)adr)); kva |= adr & (PAGE_SIZE-1); /* restore the offset */ ret = __pa(kva); - return ret; + return ret; } static void * rvmalloc(unsigned long size) @@ -219,13 +219,13 @@ static void * rvmalloc(unsigned long size) unsigned long adr; size=PAGE_ALIGN(size); - mem=vmalloc_32(size); - if (mem) + mem=vmalloc_32(size); + if (mem) { memset(mem, 0, size); /* Clear the ram out, no junk to the user */ - adr=(unsigned long) mem; - while (size > 0) - { + adr=(unsigned long) mem; + while (size > 0) + { SetPageReserved(vmalloc_to_page((void *)adr)); adr+=PAGE_SIZE; size-=PAGE_SIZE; @@ -236,13 +236,13 @@ static void * rvmalloc(unsigned long size) static void rvfree(void * mem, unsigned long size) { - unsigned long adr; + unsigned long adr; - if (mem) + if (mem) { - adr=(unsigned long) mem; - while ((long) size > 0) - { + adr=(unsigned long) mem; + while ((long) size > 0) + { ClearPageReserved(vmalloc_to_page((void *)adr)); adr+=PAGE_SIZE; size-=PAGE_SIZE; @@ -263,13 +263,13 @@ static int pwc_allocate_buffers(struct pwc_device *pdev) if (pdev == NULL) return -ENXIO; - + #ifdef PWC_MAGIC if (pdev->magic != PWC_MAGIC) { Err("allocate_buffers(): magic failed.\n"); return -ENXIO; } -#endif +#endif /* Allocate Isochronous pipe buffers */ for (i = 0; i < MAX_ISO_BUFS; i++) { if (pdev->sbuf[i].data == NULL) { @@ -308,7 +308,7 @@ static int pwc_allocate_buffers(struct pwc_device *pdev) memset(kbuf, 128, PWC_FRAME_SIZE); } } - + /* Allocate decompressor table space */ kbuf = NULL; switch (pdev->type) @@ -320,7 +320,7 @@ static int pwc_allocate_buffers(struct pwc_device *pdev) case 730: case 740: case 750: -#if 0 +#if 0 Trace(TRACE_MEMORY,"private_data(%zu)\n",sizeof(struct pwc_dec23_private)); kbuf = kmalloc(sizeof(struct pwc_dec23_private), GFP_KERNEL); /* Timon & Kiara */ break; @@ -329,11 +329,11 @@ static int pwc_allocate_buffers(struct pwc_device *pdev) /* TODO & FIXME */ kbuf = kmalloc(sizeof(struct pwc_dec23_private), GFP_KERNEL); break; -#endif +#endif ; } pdev->decompress_data = kbuf; - + /* Allocate image buffer; double buffer for mmap() */ kbuf = rvmalloc(default_mbufs * pdev->len_per_image); if (kbuf == NULL) { @@ -348,7 +348,7 @@ static int pwc_allocate_buffers(struct pwc_device *pdev) pdev->image_ptr[i] = NULL; kbuf = NULL; - + Trace(TRACE_MEMORY, "<< pwc_allocate_buffers()\n"); return 0; } @@ -366,7 +366,7 @@ static void pwc_free_buffers(struct pwc_device *pdev) Err("free_buffers(): magic failed.\n"); return; } -#endif +#endif /* Release Iso-pipe buffers */ for (i = 0; i < MAX_ISO_BUFS; i++) @@ -403,17 +403,17 @@ static void pwc_free_buffers(struct pwc_device *pdev) rvfree(pdev->image_data, default_mbufs * pdev->len_per_image); } pdev->image_data = NULL; - + Trace(TRACE_MEMORY, "Leaving free_buffers().\n"); } -/* The frame & image buffer mess. +/* The frame & image buffer mess. Yes, this is a mess. Well, it used to be simple, but alas... In this module, 3 buffers schemes are used to get the data from the USB bus to the user program. The first scheme involves the ISO buffers (called thus since they transport ISO data from the USB controller), and not really - interesting. Suffices to say the data from this buffer is quickly + interesting. Suffices to say the data from this buffer is quickly gathered in an interrupt handler (pwc_isoc_handler) and placed into the frame buffer. @@ -443,8 +443,8 @@ static void pwc_free_buffers(struct pwc_device *pdev) and a 'full' frame list: * Initially, all frame buffers but one are on the 'empty' list; the one remaining buffer is our initial fill frame. - * If a frame is needed for filling, we try to take it from the 'empty' - list, unless that list is empty, in which case we take the buffer at + * If a frame is needed for filling, we try to take it from the 'empty' + list, unless that list is empty, in which case we take the buffer at the head of the 'full' list. * When our fill buffer has been filled, it is appended to the 'full' list. @@ -646,7 +646,7 @@ static void pwc_isoc_handler(struct urb *urb, struct pt_regs *regs) case -ETIMEDOUT: errmsg = "NAK (device does not respond)"; break; } Trace(TRACE_FLOW, "pwc_isoc_handler() called with status %d [%s].\n", urb->status, errmsg); - /* Give up after a number of contiguous errors on the USB bus. + /* Give up after a number of contiguous errors on the USB bus. Appearantly something is wrong so we simulate an unplug event. */ if (++pdev->visoc_errors > MAX_ISOC_ERRORS) @@ -673,8 +673,8 @@ static void pwc_isoc_handler(struct urb *urb, struct pt_regs *regs) pdev->visoc_errors = 0; /* vsync: 0 = don't copy data - 1 = sync-hunt - 2 = synched + 1 = sync-hunt + 2 = synched */ /* Compact data */ for (i = 0; i < urb->number_of_packets; i++) { @@ -701,18 +701,18 @@ static void pwc_isoc_handler(struct urb *urb, struct pt_regs *regs) } /* ..flen > 0 */ if (flen < pdev->vlast_packet_size) { - /* Shorter packet... We probably have the end of an image-frame; + /* Shorter packet... We probably have the end of an image-frame; wake up read() process and let select()/poll() do something. Decompression is done in user time over there. */ if (pdev->vsync == 2) { - /* The ToUCam Fun CMOS sensor causes the firmware to send 2 or 3 bogus - frames on the USB wire after an exposure change. This conditition is + /* The ToUCam Fun CMOS sensor causes the firmware to send 2 or 3 bogus + frames on the USB wire after an exposure change. This conditition is however detected in the cam and a bit is set in the header. */ if (pdev->type == 730) { unsigned char *ptr = (unsigned char *)fbuf->data; - + if (ptr[1] == 1 && ptr[0] & 0x10) { #if PWC_DEBUG Debug("Hyundai CMOS sensor bug. Dropping frame %d.\n", fbuf->sequence); @@ -733,13 +733,13 @@ static void pwc_isoc_handler(struct urb *urb, struct pt_regs *regs) Info("Image is normal.\n"); } pdev->vmirror = ptr[0] & 0x03; - /* Sometimes the trailer of the 730 is still sent as a 4 byte packet + /* Sometimes the trailer of the 730 is still sent as a 4 byte packet after a short frame; this condition is filtered out specifically. A 4 byte frame doesn't make sense anyway. - So we get either this sequence: - drop_bit set -> 4 byte frame -> short frame -> good frame + So we get either this sequence: + drop_bit set -> 4 byte frame -> short frame -> good frame Or this one: - drop_bit set -> short frame -> good frame + drop_bit set -> short frame -> good frame So we drop either 3 or 2 frames in all! */ if (fbuf->filled == 4) @@ -830,7 +830,7 @@ static int pwc_isoc_init(struct pwc_device *pdev) intf = usb_ifnum_to_if(udev, 0); if (intf) idesc = usb_altnum_to_altsetting(intf, pdev->valternate); - + if (!idesc) return -EFAULT; @@ -841,7 +841,7 @@ static int pwc_isoc_init(struct pwc_device *pdev) pdev->vmax_packet_size = le16_to_cpu(idesc->endpoint[i].desc.wMaxPacketSize); break; } - + if (pdev->vmax_packet_size < 0 || pdev->vmax_packet_size > ISO_MAX_FRAME_SIZE) { Err("Failed to find packet size for video endpoint in current alternate setting.\n"); return -ENFILE; /* Odd error, that should be noticeable */ @@ -875,18 +875,18 @@ static int pwc_isoc_init(struct pwc_device *pdev) return ret; } - /* init URB structure */ + /* init URB structure */ for (i = 0; i < MAX_ISO_BUFS; i++) { urb = pdev->sbuf[i].urb; urb->interval = 1; // devik urb->dev = udev; - urb->pipe = usb_rcvisocpipe(udev, pdev->vendpoint); + urb->pipe = usb_rcvisocpipe(udev, pdev->vendpoint); urb->transfer_flags = URB_ISO_ASAP; - urb->transfer_buffer = pdev->sbuf[i].data; - urb->transfer_buffer_length = ISO_BUFFER_SIZE; - urb->complete = pwc_isoc_handler; - urb->context = pdev; + urb->transfer_buffer = pdev->sbuf[i].data; + urb->transfer_buffer_length = ISO_BUFFER_SIZE; + urb->complete = pwc_isoc_handler; + urb->context = pdev; urb->start_frame = 0; urb->number_of_packets = ISO_FRAMES_PER_DESC; for (j = 0; j < ISO_FRAMES_PER_DESC; j++) { @@ -935,7 +935,7 @@ static void pwc_isoc_cleanup(struct pwc_device *pdev) } /* Stop camera, but only if we are sure the camera is still there (unplug - is signalled by EPIPE) + is signalled by EPIPE) */ if (pdev->error_status && pdev->error_status != EPIPE) { Trace(TRACE_OPEN, "Setting alternate interface 0.\n"); @@ -956,12 +956,12 @@ int pwc_try_video_mode(struct pwc_device *pdev, int width, int height, int new_f pwc_reset_buffers(pdev); /* Try to set video mode... */ start = ret = pwc_set_video_mode(pdev, width, height, new_fps, new_compression, new_snapshot); - if (ret) { - Trace(TRACE_FLOW, "pwc_set_video_mode attempt 1 failed.\n"); + if (ret) { + Trace(TRACE_FLOW, "pwc_set_video_mode attempt 1 failed.\n"); /* That failed... restore old mode (we know that worked) */ start = pwc_set_video_mode(pdev, pdev->view.x, pdev->view.y, pdev->vframes, pdev->vcompression, pdev->vsnapshot); if (start) { - Trace(TRACE_FLOW, "pwc_set_video_mode attempt 2 failed.\n"); + Trace(TRACE_FLOW, "pwc_set_video_mode attempt 2 failed.\n"); } } if (start == 0) @@ -987,18 +987,18 @@ static int pwc_video_open(struct inode *inode, struct file *file) struct pwc_device *pdev; Trace(TRACE_OPEN, ">> video_open called(vdev = 0x%p).\n", vdev); - + pdev = (struct pwc_device *)vdev->priv; if (pdev == NULL) BUG(); if (pdev->vopen) return -EBUSY; - + down(&pdev->modlock); if (!pdev->usb_init) { Trace(TRACE_OPEN, "Doing first time initialization.\n"); pdev->usb_init = 1; - + if (pwc_trace & TRACE_OPEN) { /* Query sensor type */ @@ -1036,7 +1036,7 @@ static int pwc_video_open(struct inode *inode, struct file *file) /* Set LED on/off time */ if (pwc_set_leds(pdev, led_on, led_off) < 0) Info("Failed to set LED on/off time.\n"); - + pwc_construct(pdev); /* set min/max sizes correct */ /* So far, so good. Allocate memory. */ @@ -1046,7 +1046,7 @@ static int pwc_video_open(struct inode *inode, struct file *file) up(&pdev->modlock); return i; } - + /* Reset buffers & parameters */ pwc_reset_buffers(pdev); for (i = 0; i < default_mbufs; i++) @@ -1081,7 +1081,7 @@ static int pwc_video_open(struct inode *inode, struct file *file) up(&pdev->modlock); return i; } - + i = pwc_isoc_init(pdev); if (i) { Trace(TRACE_OPEN, "Failed to init ISOC stuff = %d.\n", i); @@ -1155,13 +1155,13 @@ static int pwc_video_close(struct inode *inode, struct file *file) /* * FIXME: what about two parallel reads ???? * ANSWER: Not supported. You can't open the device more than once, - despite what the V4L1 interface says. First, I don't see - the need, second there's no mechanism of alerting the - 2nd/3rd/... process of events like changing image size. - And I don't see the point of blocking that for the - 2nd/3rd/... process. - In multi-threaded environments reading parallel from any - device is tricky anyhow. + despite what the V4L1 interface says. First, I don't see + the need, second there's no mechanism of alerting the + 2nd/3rd/... process of events like changing image size. + And I don't see the point of blocking that for the + 2nd/3rd/... process. + In multi-threaded environments reading parallel from any + device is tricky anyhow. */ static ssize_t pwc_video_read(struct file *file, char __user * buf, @@ -1171,7 +1171,7 @@ static ssize_t pwc_video_read(struct file *file, char __user * buf, struct pwc_device *pdev; int noblock = file->f_flags & O_NONBLOCK; DECLARE_WAITQUEUE(wait, current); - int bytes_to_read; + int bytes_to_read; Trace(TRACE_READ, "video_read(0x%p, %p, %zu) called.\n", vdev, buf, count); if (vdev == NULL) @@ -1193,22 +1193,22 @@ static ssize_t pwc_video_read(struct file *file, char __user * buf, set_current_state(TASK_RUNNING); return -pdev->error_status ; } - if (noblock) { - remove_wait_queue(&pdev->frameq, &wait); - set_current_state(TASK_RUNNING); - return -EWOULDBLOCK; - } - if (signal_pending(current)) { - remove_wait_queue(&pdev->frameq, &wait); - set_current_state(TASK_RUNNING); - return -ERESTARTSYS; - } - schedule(); - set_current_state(TASK_INTERRUPTIBLE); + if (noblock) { + remove_wait_queue(&pdev->frameq, &wait); + set_current_state(TASK_RUNNING); + return -EWOULDBLOCK; + } + if (signal_pending(current)) { + remove_wait_queue(&pdev->frameq, &wait); + set_current_state(TASK_RUNNING); + return -ERESTARTSYS; + } + schedule(); + set_current_state(TASK_INTERRUPTIBLE); } remove_wait_queue(&pdev->frameq, &wait); set_current_state(TASK_RUNNING); - + /* Decompress and release frame */ if (pwc_handle_frame(pdev)) return -EFAULT; @@ -1218,7 +1218,7 @@ static ssize_t pwc_video_read(struct file *file, char __user * buf, if (pdev->vpalette == VIDEO_PALETTE_RAW) bytes_to_read = pdev->frame_size; else - bytes_to_read = pdev->view.size; + bytes_to_read = pdev->view.size; /* copy bytes to user space; we allow for partial reads */ if (count + pdev->image_read_pos > bytes_to_read) @@ -1348,11 +1348,11 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file, struct video_picture *p = arg; /* * FIXME: Suppose we are mid read - ANSWER: No problem: the firmware of the camera - can handle brightness/contrast/etc - changes at _any_ time, and the palette - is used exactly once in the uncompress - routine. + ANSWER: No problem: the firmware of the camera + can handle brightness/contrast/etc + changes at _any_ time, and the palette + is used exactly once in the uncompress + routine. */ pwc_set_brightness(pdev, p->brightness); pwc_set_contrast(pdev, p->contrast); @@ -1373,21 +1373,21 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file, break; } - /* Window/size parameters */ + /* Window/size parameters */ case VIDIOCGWIN: { struct video_window *vw = arg; - + vw->x = 0; vw->y = 0; vw->width = pdev->view.x; vw->height = pdev->view.y; vw->chromakey = 0; - vw->flags = (pdev->vframes << PWC_FPS_SHIFT) | - (pdev->vsnapshot ? PWC_FPS_SNAPSHOT : 0); + vw->flags = (pdev->vframes << PWC_FPS_SHIFT) | + (pdev->vsnapshot ? PWC_FPS_SNAPSHOT : 0); break; } - + case VIDIOCSWIN: { struct video_window *vw = arg; @@ -1402,9 +1402,9 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file, ret = pwc_try_video_mode(pdev, vw->width, vw->height, fps, pdev->vcompression, snapshot); if (ret) return ret; - break; + break; } - + /* We don't have overlay support (yet) */ case VIDIOCGFBUF: { @@ -1471,8 +1471,8 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file, return -EBUSY; /* buffer wasn't available. Bummer */ pdev->image_used[vm->frame] = 1; - /* Okay, we're done here. In the SYNC call we wait until a - frame comes available, then expand image into the given + /* Okay, we're done here. In the SYNC call we wait until a + frame comes available, then expand image into the given buffer. In contrast to the CPiA cam the Philips cams deliver a constant stream, almost like a grabber card. Also, @@ -1487,16 +1487,16 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file, { /* The doc says: "Whenever a buffer is used it should call VIDIOCSYNC to free this frame up and continue." - - The only odd thing about this whole procedure is + + The only odd thing about this whole procedure is that MCAPTURE flags the buffer as "in use", and - SYNC immediately unmarks it, while it isn't + SYNC immediately unmarks it, while it isn't after SYNC that you know that the buffer actually got filled! So you better not start a CAPTURE in - the same frame immediately (use double buffering). - This is not a problem for this cam, since it has - extra intermediate buffers, but a hardware - grabber card will then overwrite the buffer + the same frame immediately (use double buffering). + This is not a problem for this cam, since it has + extra intermediate buffers, but a hardware + grabber card will then overwrite the buffer you're working on. */ int *mbuf = arg; @@ -1512,10 +1512,10 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file, return -EINVAL; /* Add ourselves to the frame wait-queue. - + FIXME: needs auditing for safety. QUESTION: In what respect? I think that using the - frameq is safe now. + frameq is safe now. */ add_wait_queue(&pdev->frameq, &wait); while (pdev->full_frames == NULL) { @@ -1524,21 +1524,21 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file, set_current_state(TASK_RUNNING); return -pdev->error_status; } - - if (signal_pending(current)) { - remove_wait_queue(&pdev->frameq, &wait); - set_current_state(TASK_RUNNING); - return -ERESTARTSYS; - } - schedule(); - set_current_state(TASK_INTERRUPTIBLE); + + if (signal_pending(current)) { + remove_wait_queue(&pdev->frameq, &wait); + set_current_state(TASK_RUNNING); + return -ERESTARTSYS; + } + schedule(); + set_current_state(TASK_INTERRUPTIBLE); } remove_wait_queue(&pdev->frameq, &wait); set_current_state(TASK_RUNNING); - - /* The frame is ready. Expand in the image buffer - requested by the user. I don't care if you - mmap() 5 buffers and request data in this order: + + /* The frame is ready. Expand in the image buffer + requested by the user. I don't care if you + mmap() 5 buffers and request data in this order: buffer 4 2 3 0 1 2 3 0 4 3 1 . . . Grabber hardware may not be so forgiving. */ @@ -1551,11 +1551,11 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file, return -EFAULT; break; } - + case VIDIOCGAUDIO: { struct video_audio *v = arg; - + strcpy(v->name, "Microphone"); v->audio = -1; /* unknown audio minor */ v->flags = 0; @@ -1565,19 +1565,19 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file, v->treble = 0; v->balance = 0x8000; v->step = 1; - break; + break; } - + case VIDIOCSAUDIO: { /* Dummy: nothing can be set */ break; } - + case VIDIOCGUNIT: { struct video_unit *vu = arg; - + vu->video = pdev->vdev->minor & 0x3F; vu->audio = -1; /* not known yet */ vu->vbi = -1; @@ -1589,7 +1589,7 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file, return pwc_ioctl(pdev, cmd, arg); } /* ..switch */ return 0; -} +} static int pwc_video_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) @@ -1605,10 +1605,10 @@ static int pwc_video_mmap(struct file *file, struct vm_area_struct *vma) unsigned long start = vma->vm_start; unsigned long size = vma->vm_end-vma->vm_start; unsigned long page, pos; - + Trace(TRACE_MEMORY, "mmap(0x%p, 0x%lx, %lu) called.\n", vdev, start, size); pdev = vdev->priv; - + vma->vm_flags |= VM_IO; pos = (unsigned long)pdev->image_data; @@ -1646,7 +1646,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id char serial_number[30], *name; /* Check if we can handle this device */ - Trace(TRACE_PROBE, "probe() called [%04X %04X], if %d\n", + Trace(TRACE_PROBE, "probe() called [%04X %04X], if %d\n", le16_to_cpu(udev->descriptor.idVendor), le16_to_cpu(udev->descriptor.idProduct), intf->altsetting->desc.bInterfaceNumber); @@ -1770,11 +1770,11 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id name = "Logitech QuickCam (res.)"; type_id = 730; /* Assuming CMOS */ break; - default: + default: return -ENODEV; - break; - } - } + break; + } + } else if (vendor_id == 0x055d) { /* I don't know the difference between the C10 and the C30; I suppose the difference is the sensor, but both cameras @@ -1837,7 +1837,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id return -ENODEV; break; } - + } else if (vendor_id == 0x0d81) { switch(product_id) { @@ -1856,7 +1856,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id break; } } - else + else return -ENODEV; /* Not any of the know types; but the list keeps growing. */ memset(serial_number, 0, 30); @@ -1880,9 +1880,9 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id if (vendor_id == 0x046D && product_id == 0x08B5) { /* Logitech QuickCam Orbit - The ranges have been determined experimentally; they may differ from cam to cam. - Also, the exact ranges left-right and up-down are different for my cam - */ + The ranges have been determined experimentally; they may differ from cam to cam. + Also, the exact ranges left-right and up-down are different for my cam + */ pdev->angle_range.pan_min = -7000; pdev->angle_range.pan_max = 7000; pdev->angle_range.tilt_min = -3000; @@ -1939,7 +1939,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id } /* occupy slot */ - if (hint < MAX_DEV_HINTS) + if (hint < MAX_DEV_HINTS) device_hint[hint].pdev = pdev; Trace(TRACE_PROBE, "probe() function returning struct at 0x%p.\n", pdev); @@ -1968,13 +1968,13 @@ static void usb_pwc_disconnect(struct usb_interface *intf) Err("pwc_disconnect() Woops: pointer mismatch udev/pdev.\n"); goto disconnect_out; } -#ifdef PWC_MAGIC +#ifdef PWC_MAGIC if (pdev->magic != PWC_MAGIC) { Err("pwc_disconnect() Magic number failed. Consult your scrolls and try again.\n"); goto disconnect_out; } #endif - + /* We got unplugged; this is signalled by an EPIPE error code */ if (pdev->vopen) { Info("Disconnected while webcam is in use!\n"); @@ -2017,8 +2017,8 @@ static int pwc_atoi(const char *s) } -/* - * Initialization code & module stuff +/* + * Initialization code & module stuff */ static char size[10]; @@ -2168,7 +2168,7 @@ static int __init usb_pwc_init(void) if (*dot != '\0') { /* There's a serial number as well */ int k; - + dot++; k = 0; while (*dot != ':' && k < 29) { @@ -2178,18 +2178,18 @@ static int __init usb_pwc_init(void) device_hint[i].serial_number[k] = '\0'; } } -#if PWC_DEBUG +#if PWC_DEBUG Debug("device_hint[%d]:\n", i); Debug(" type : %d\n", device_hint[i].type); Debug(" serial# : %s\n", device_hint[i].serial_number); Debug(" node : %d\n", device_hint[i].device_node); -#endif +#endif } else device_hint[i].type = 0; /* not filled */ } /* ..for MAX_DEV_HINTS */ - Trace(TRACE_PROBE, "Registering driver at address 0x%p.\n", &pwc_driver); + Trace(TRACE_PROBE, "Registering driver at address 0x%p.\n", &pwc_driver); return usb_register(&pwc_driver); } diff --git a/drivers/usb/media/pwc/pwc-ioctl.h b/drivers/media/video/pwc/pwc-ioctl.h index 5f9cb08bc02e..784bc72521fa 100644 --- a/drivers/usb/media/pwc/pwc-ioctl.h +++ b/drivers/media/video/pwc/pwc-ioctl.h @@ -33,10 +33,10 @@ /* Changes 2001/08/03 Alvarado Added ioctl constants to access methods for - changing white balance and red/blue gains + changing white balance and red/blue gains 2002/12/15 G. H. Fernandez-Toribio VIDIOCGREALSIZE 2003/12/13 Nemosft Unv. Some modifications to make interfacing to - PWCX easier + PWCX easier */ /* These are private ioctl() commands, specific for the Philips webcams. @@ -45,10 +45,10 @@ The #define names are built up like follows: VIDIOC VIDeo IOCtl prefix - PWC Philps WebCam - G optional: Get - S optional: Set - ... the function + PWC Philps WebCam + G optional: Get + S optional: Set + ... the function */ @@ -94,7 +94,7 @@ struct pwc_serial { char serial[30]; /* String with serial number. Contains terminating 0 */ }; - + /* pwc_whitebalance.mode values */ #define PWC_WB_INDOOR 0 #define PWC_WB_OUTDOOR 1 @@ -102,14 +102,14 @@ struct pwc_serial #define PWC_WB_MANUAL 3 #define PWC_WB_AUTO 4 -/* Used with VIDIOCPWC[SG]AWB (Auto White Balance). +/* Used with VIDIOCPWC[SG]AWB (Auto White Balance). Set mode to one of the PWC_WB_* values above. - *red and *blue are the respective gains of these colour components inside + *red and *blue are the respective gains of these colour components inside the camera; range 0..65535 - When 'mode' == PWC_WB_MANUAL, 'manual_red' and 'manual_blue' are set or read; + When 'mode' == PWC_WB_MANUAL, 'manual_red' and 'manual_blue' are set or read; otherwise undefined. 'read_red' and 'read_blue' are read-only. -*/ +*/ struct pwc_whitebalance { int mode; @@ -117,9 +117,9 @@ struct pwc_whitebalance int read_red, read_blue; /* R/O */ }; -/* +/* 'control_speed' and 'control_delay' are used in automatic whitebalance mode, - and tell the camera how fast it should react to changes in lighting, and + and tell the camera how fast it should react to changes in lighting, and with how much delay. Valid values are 0..65535. */ struct pwc_wb_speed @@ -148,11 +148,11 @@ struct pwc_imagesize #define PWC_MPT_TILT 0x02 #define PWC_MPT_TIMEOUT 0x04 /* for status */ -/* Set angles; when absolute != 0, the angle is absolute and the +/* Set angles; when absolute != 0, the angle is absolute and the driver calculates the relative offset for you. This can only be used with VIDIOCPWCSANGLE; VIDIOCPWCGANGLE always returns absolute angles. - */ + */ struct pwc_mpt_angles { int absolute; /* write-only */ @@ -179,14 +179,14 @@ struct pwc_mpt_status /* This is used for out-of-kernel decompression. With it, you can get all the necessary information to initialize and use the decompressor routines in standalone applications. - */ + */ struct pwc_video_command { int type; /* camera type (645, 675, 730, etc.) */ int release; /* release number */ - int size; /* one of PSZ_* */ - int alternate; + int size; /* one of PSZ_* */ + int alternate; int command_len; /* length of USB video command */ unsigned char command_buf[13]; /* Actual USB video command */ int bandlength; /* >0 = compressed */ @@ -264,7 +264,7 @@ struct pwc_video_command /* Flickerless mode; = 0 off, otherwise on */ #define VIDIOCPWCSFLICKER _IOW('v', 208, int) -#define VIDIOCPWCGFLICKER _IOR('v', 208, int) +#define VIDIOCPWCGFLICKER _IOR('v', 208, int) /* Dynamic noise reduction; 0 off, 3 = high noise reduction */ #define VIDIOCPWCSDYNNOISE _IOW('v', 209, int) @@ -273,7 +273,7 @@ struct pwc_video_command /* Real image size as used by the camera; tells you whether or not there's a gray border around the image */ #define VIDIOCPWCGREALSIZE _IOR('v', 210, struct pwc_imagesize) - /* Motorized pan & tilt functions */ + /* Motorized pan & tilt functions */ #define VIDIOCPWCMPTRESET _IOW('v', 211, int) #define VIDIOCPWCMPTGRANGE _IOR('v', 211, struct pwc_mpt_range) #define VIDIOCPWCMPTSANGLE _IOW('v', 212, struct pwc_mpt_angles) diff --git a/drivers/media/video/pwc/pwc-kiara.c b/drivers/media/video/pwc/pwc-kiara.c new file mode 100644 index 000000000000..4c96037f7be5 --- /dev/null +++ b/drivers/media/video/pwc/pwc-kiara.c @@ -0,0 +1,318 @@ +/* Linux driver for Philips webcam + (C) 2004 Luc Saillard (luc@saillard.org) + + NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx + driver and thus may have bugs that are not present in the original version. + Please send bug reports and support requests to <luc@saillard.org>. + The decompression routines have been implemented by reverse-engineering the + Nemosoft binary pwcx module. Caveat emptor. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + + +/* This tables contains entries for the 730/740/750 (Kiara) camera, with + 4 different qualities (no compression, low, medium, high). + It lists the bandwidth requirements for said mode by its alternate interface + number. An alternate of 0 means that the mode is unavailable. + + There are 6 * 4 * 4 entries: + 6 different resolutions subqcif, qsif, qcif, sif, cif, vga + 6 framerates: 5, 10, 15, 20, 25, 30 + 4 compression modi: none, low, medium, high + + When an uncompressed mode is not available, the next available compressed mode + will be chosen (unless the decompressor is absent). Sometimes there are only + 1 or 2 compressed modes available; in that case entries are duplicated. +*/ + + +#include "pwc-kiara.h" +#include "pwc-uncompress.h" + +const struct Kiara_table_entry Kiara_table[PSZ_MAX][6][4] = +{ + /* SQCIF */ + { + /* 5 fps */ + { + {0, }, + {0, }, + {0, }, + {0, }, + }, + /* 10 fps */ + { + {0, }, + {0, }, + {0, }, + {0, }, + }, + /* 15 fps */ + { + {0, }, + {0, }, + {0, }, + {0, }, + }, + /* 20 fps */ + { + {0, }, + {0, }, + {0, }, + {0, }, + }, + /* 25 fps */ + { + {0, }, + {0, }, + {0, }, + {0, }, + }, + /* 30 fps */ + { + {0, }, + {0, }, + {0, }, + {0, }, + }, + }, + /* QSIF */ + { + /* 5 fps */ + { + {1, 146, 0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}}, + {1, 146, 0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}}, + {1, 146, 0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}}, + {1, 146, 0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}}, + }, + /* 10 fps */ + { + {2, 291, 0, {0x1C, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x23, 0x01, 0x80}}, + {1, 192, 630, {0x14, 0xF4, 0x30, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xC0, 0x00, 0x80}}, + {1, 192, 630, {0x14, 0xF4, 0x30, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xC0, 0x00, 0x80}}, + {1, 192, 630, {0x14, 0xF4, 0x30, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xC0, 0x00, 0x80}}, + }, + /* 15 fps */ + { + {3, 437, 0, {0x1B, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xB5, 0x01, 0x80}}, + {2, 292, 640, {0x13, 0xF4, 0x30, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x20, 0x24, 0x01, 0x80}}, + {2, 292, 640, {0x13, 0xF4, 0x30, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x20, 0x24, 0x01, 0x80}}, + {1, 192, 420, {0x13, 0xF4, 0x30, 0x0D, 0x1B, 0x0C, 0x53, 0x1E, 0x18, 0xC0, 0x00, 0x80}}, + }, + /* 20 fps */ + { + {4, 589, 0, {0x1A, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x4D, 0x02, 0x80}}, + {3, 448, 730, {0x12, 0xF4, 0x30, 0x16, 0xC9, 0x16, 0x01, 0x0E, 0x18, 0xC0, 0x01, 0x80}}, + {2, 292, 476, {0x12, 0xF4, 0x30, 0x0E, 0xD8, 0x0E, 0x10, 0x19, 0x18, 0x24, 0x01, 0x80}}, + {1, 192, 312, {0x12, 0xF4, 0x50, 0x09, 0xB3, 0x08, 0xEB, 0x1E, 0x18, 0xC0, 0x00, 0x80}}, + }, + /* 25 fps */ + { + {5, 703, 0, {0x19, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xBF, 0x02, 0x80}}, + {3, 447, 610, {0x11, 0xF4, 0x30, 0x13, 0x0B, 0x12, 0x43, 0x14, 0x28, 0xBF, 0x01, 0x80}}, + {2, 292, 398, {0x11, 0xF4, 0x50, 0x0C, 0x6C, 0x0B, 0xA4, 0x1E, 0x28, 0x24, 0x01, 0x80}}, + {1, 193, 262, {0x11, 0xF4, 0x50, 0x08, 0x23, 0x07, 0x5B, 0x1E, 0x28, 0xC1, 0x00, 0x80}}, + }, + /* 30 fps */ + { + {8, 874, 0, {0x18, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x6A, 0x03, 0x80}}, + {5, 704, 730, {0x10, 0xF4, 0x30, 0x16, 0xC9, 0x16, 0x01, 0x0E, 0x28, 0xC0, 0x02, 0x80}}, + {3, 448, 492, {0x10, 0xF4, 0x30, 0x0F, 0x5D, 0x0E, 0x95, 0x15, 0x28, 0xC0, 0x01, 0x80}}, + {2, 292, 320, {0x10, 0xF4, 0x50, 0x09, 0xFB, 0x09, 0x33, 0x1E, 0x28, 0x24, 0x01, 0x80}}, + }, + }, + /* QCIF */ + { + /* 5 fps */ + { + {0, }, + {0, }, + {0, }, + {0, }, + }, + /* 10 fps */ + { + {0, }, + {0, }, + {0, }, + {0, }, + }, + /* 15 fps */ + { + {0, }, + {0, }, + {0, }, + {0, }, + }, + /* 20 fps */ + { + {0, }, + {0, }, + {0, }, + {0, }, + }, + /* 25 fps */ + { + {0, }, + {0, }, + {0, }, + {0, }, + }, + /* 30 fps */ + { + {0, }, + {0, }, + {0, }, + {0, }, + }, + }, + /* SIF */ + { + /* 5 fps */ + { + {4, 582, 0, {0x0D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x46, 0x02, 0x80}}, + {3, 387, 1276, {0x05, 0xF4, 0x30, 0x27, 0xD8, 0x26, 0x48, 0x03, 0x10, 0x83, 0x01, 0x80}}, + {2, 291, 960, {0x05, 0xF4, 0x30, 0x1D, 0xF2, 0x1C, 0x62, 0x04, 0x10, 0x23, 0x01, 0x80}}, + {1, 191, 630, {0x05, 0xF4, 0x50, 0x13, 0xA9, 0x12, 0x19, 0x05, 0x18, 0xBF, 0x00, 0x80}}, + }, + /* 10 fps */ + { + {0, }, + {6, 775, 1278, {0x04, 0xF4, 0x30, 0x27, 0xE8, 0x26, 0x58, 0x05, 0x30, 0x07, 0x03, 0x80}}, + {3, 447, 736, {0x04, 0xF4, 0x30, 0x16, 0xFB, 0x15, 0x6B, 0x05, 0x28, 0xBF, 0x01, 0x80}}, + {2, 292, 480, {0x04, 0xF4, 0x70, 0x0E, 0xF9, 0x0D, 0x69, 0x09, 0x28, 0x24, 0x01, 0x80}}, + }, + /* 15 fps */ + { + {0, }, + {9, 955, 1050, {0x03, 0xF4, 0x30, 0x20, 0xCF, 0x1F, 0x3F, 0x06, 0x48, 0xBB, 0x03, 0x80}}, + {4, 592, 650, {0x03, 0xF4, 0x30, 0x14, 0x44, 0x12, 0xB4, 0x08, 0x30, 0x50, 0x02, 0x80}}, + {3, 448, 492, {0x03, 0xF4, 0x50, 0x0F, 0x52, 0x0D, 0xC2, 0x09, 0x38, 0xC0, 0x01, 0x80}}, + }, + /* 20 fps */ + { + {0, }, + {9, 958, 782, {0x02, 0xF4, 0x30, 0x18, 0x6A, 0x16, 0xDA, 0x0B, 0x58, 0xBE, 0x03, 0x80}}, + {5, 703, 574, {0x02, 0xF4, 0x50, 0x11, 0xE7, 0x10, 0x57, 0x0B, 0x40, 0xBF, 0x02, 0x80}}, + {3, 446, 364, {0x02, 0xF4, 0x90, 0x0B, 0x5C, 0x09, 0xCC, 0x0E, 0x38, 0xBE, 0x01, 0x80}}, + }, + /* 25 fps */ + { + {0, }, + {9, 958, 654, {0x01, 0xF4, 0x30, 0x14, 0x66, 0x12, 0xD6, 0x0B, 0x50, 0xBE, 0x03, 0x80}}, + {6, 776, 530, {0x01, 0xF4, 0x50, 0x10, 0x8C, 0x0E, 0xFC, 0x0C, 0x48, 0x08, 0x03, 0x80}}, + {4, 592, 404, {0x01, 0xF4, 0x70, 0x0C, 0x96, 0x0B, 0x06, 0x0B, 0x48, 0x50, 0x02, 0x80}}, + }, + /* 30 fps */ + { + {0, }, + {9, 957, 526, {0x00, 0xF4, 0x50, 0x10, 0x68, 0x0E, 0xD8, 0x0D, 0x58, 0xBD, 0x03, 0x80}}, + {6, 775, 426, {0x00, 0xF4, 0x70, 0x0D, 0x48, 0x0B, 0xB8, 0x0F, 0x50, 0x07, 0x03, 0x80}}, + {4, 590, 324, {0x00, 0x7A, 0x88, 0x0A, 0x1C, 0x08, 0xB4, 0x0E, 0x50, 0x4E, 0x02, 0x80}}, + }, + }, + /* CIF */ + { + /* 5 fps */ + { + {0, }, + {0, }, + {0, }, + {0, }, + }, + /* 10 fps */ + { + {0, }, + {0, }, + {0, }, + {0, }, + }, + /* 15 fps */ + { + {0, }, + {0, }, + {0, }, + {0, }, + }, + /* 20 fps */ + { + {0, }, + {0, }, + {0, }, + {0, }, + }, + /* 25 fps */ + { + {0, }, + {0, }, + {0, }, + {0, }, + }, + /* 30 fps */ + { + {0, }, + {0, }, + {0, }, + {0, }, + }, + }, + /* VGA */ + { + /* 5 fps */ + { + {0, }, + {6, 773, 1272, {0x25, 0xF4, 0x30, 0x27, 0xB6, 0x24, 0x96, 0x02, 0x30, 0x05, 0x03, 0x80}}, + {4, 592, 976, {0x25, 0xF4, 0x50, 0x1E, 0x78, 0x1B, 0x58, 0x03, 0x30, 0x50, 0x02, 0x80}}, + {3, 448, 738, {0x25, 0xF4, 0x90, 0x17, 0x0C, 0x13, 0xEC, 0x04, 0x30, 0xC0, 0x01, 0x80}}, + }, + /* 10 fps */ + { + {0, }, + {9, 956, 788, {0x24, 0xF4, 0x70, 0x18, 0x9C, 0x15, 0x7C, 0x03, 0x48, 0xBC, 0x03, 0x80}}, + {6, 776, 640, {0x24, 0xF4, 0xB0, 0x13, 0xFC, 0x11, 0x2C, 0x04, 0x48, 0x08, 0x03, 0x80}}, + {4, 592, 488, {0x24, 0x7A, 0xE8, 0x0F, 0x3C, 0x0C, 0x6C, 0x06, 0x48, 0x50, 0x02, 0x80}}, + }, + /* 15 fps */ + { + {0, }, + {9, 957, 526, {0x23, 0x7A, 0xE8, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x03, 0x80}}, + {9, 957, 526, {0x23, 0x7A, 0xE8, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x03, 0x80}}, + {8, 895, 492, {0x23, 0x7A, 0xE8, 0x0F, 0x5D, 0x0C, 0x8D, 0x06, 0x58, 0x7F, 0x03, 0x80}}, + }, + /* 20 fps */ + { + {0, }, + {0, }, + {0, }, + {0, }, + }, + /* 25 fps */ + { + {0, }, + {0, }, + {0, }, + {0, }, + }, + /* 30 fps */ + { + {0, }, + {0, }, + {0, }, + {0, }, + }, + }, +}; + diff --git a/drivers/usb/media/pwc/pwc-kiara.h b/drivers/media/video/pwc/pwc-kiara.h index 12929abbb1f0..12929abbb1f0 100644 --- a/drivers/usb/media/pwc/pwc-kiara.h +++ b/drivers/media/video/pwc/pwc-kiara.h diff --git a/drivers/usb/media/pwc/pwc-misc.c b/drivers/media/video/pwc/pwc-misc.c index b7a4bd3524c7..58fe79747992 100644 --- a/drivers/usb/media/pwc/pwc-misc.c +++ b/drivers/media/video/pwc/pwc-misc.c @@ -1,4 +1,4 @@ -/* Linux driver for Philips webcam +/* Linux driver for Philips webcam Various miscellaneous functions and tables. (C) 1999-2003 Nemosoft Unv. (C) 2004 Luc Saillard (luc@saillard.org) @@ -44,17 +44,17 @@ int pwc_decode_size(struct pwc_device *pdev, int width, int height) int i, find; /* Make sure we don't go beyond our max size. - NB: we have different limits for RAW and normal modes. In case - you don't have the decompressor loaded or use RAW mode, - the maximum viewable size is smaller. - */ + NB: we have different limits for RAW and normal modes. In case + you don't have the decompressor loaded or use RAW mode, + the maximum viewable size is smaller. + */ if (pdev->vpalette == VIDEO_PALETTE_RAW) { if (width > pdev->abs_max.x || height > pdev->abs_max.y) { Debug("VIDEO_PALETTE_RAW: going beyond abs_max.\n"); - return -1; - } + return -1; + } } else { @@ -88,8 +88,8 @@ void pwc_construct(struct pwc_device *pdev) pdev->view_min.y = 96; pdev->view_max.x = 352; pdev->view_max.y = 288; - pdev->abs_max.x = 352; - pdev->abs_max.y = 288; + pdev->abs_max.x = 352; + pdev->abs_max.y = 288; pdev->image_mask = 1 << PSZ_SQCIF | 1 << PSZ_QCIF | 1 << PSZ_CIF; pdev->vcinterface = 2; pdev->vendpoint = 4; @@ -105,8 +105,8 @@ void pwc_construct(struct pwc_device *pdev) pdev->view_max.x = 640; pdev->view_max.y = 480; pdev->image_mask = 1 << PSZ_SQCIF | 1 << PSZ_QSIF | 1 << PSZ_QCIF | 1 << PSZ_SIF | 1 << PSZ_CIF | 1 << PSZ_VGA; - pdev->abs_max.x = 640; - pdev->abs_max.y = 480; + pdev->abs_max.x = 640; + pdev->abs_max.y = 480; pdev->vcinterface = 3; pdev->vendpoint = 4; pdev->frame_header_size = 0; @@ -121,8 +121,8 @@ void pwc_construct(struct pwc_device *pdev) pdev->view_max.x = 640; pdev->view_max.y = 480; pdev->image_mask = 1 << PSZ_QSIF | 1 << PSZ_SIF | 1 << PSZ_VGA; - pdev->abs_max.x = 640; - pdev->abs_max.y = 480; + pdev->abs_max.x = 640; + pdev->abs_max.y = 480; pdev->vcinterface = 3; pdev->vendpoint = 5; pdev->frame_header_size = TOUCAM_HEADER_SIZE; diff --git a/drivers/usb/media/pwc/pwc-nala.h b/drivers/media/video/pwc/pwc-nala.h index e6c5cb69d03b..168c73ef75d8 100644 --- a/drivers/usb/media/pwc/pwc-nala.h +++ b/drivers/media/video/pwc/pwc-nala.h @@ -54,7 +54,7 @@ {0}, }, /* VGA */ - { + { {0}, {0}, {0}, diff --git a/drivers/media/video/pwc/pwc-timon.c b/drivers/media/video/pwc/pwc-timon.c new file mode 100644 index 000000000000..175250d089cf --- /dev/null +++ b/drivers/media/video/pwc/pwc-timon.c @@ -0,0 +1,316 @@ +/* Linux driver for Philips webcam + (C) 2004 Luc Saillard (luc@saillard.org) + + NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx + driver and thus may have bugs that are not present in the original version. + Please send bug reports and support requests to <luc@saillard.org>. + The decompression routines have been implemented by reverse-engineering the + Nemosoft binary pwcx module. Caveat emptor. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + + +/* This tables contains entries for the 675/680/690 (Timon) camera, with + 4 different qualities (no compression, low, medium, high). + It lists the bandwidth requirements for said mode by its alternate interface + number. An alternate of 0 means that the mode is unavailable. + + There are 6 * 4 * 4 entries: + 6 different resolutions subqcif, qsif, qcif, sif, cif, vga + 6 framerates: 5, 10, 15, 20, 25, 30 + 4 compression modi: none, low, medium, high + + When an uncompressed mode is not available, the next available compressed mode + will be chosen (unless the decompressor is absent). Sometimes there are only + 1 or 2 compressed modes available; in that case entries are duplicated. +*/ + +#include "pwc-timon.h" + +const struct Timon_table_entry Timon_table[PSZ_MAX][6][4] = +{ + /* SQCIF */ + { + /* 5 fps */ + { + {1, 140, 0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}}, + {1, 140, 0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}}, + {1, 140, 0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}}, + {1, 140, 0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}}, + }, + /* 10 fps */ + { + {2, 280, 0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}}, + {2, 280, 0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}}, + {2, 280, 0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}}, + {2, 280, 0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}}, + }, + /* 15 fps */ + { + {3, 410, 0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}}, + {3, 410, 0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}}, + {3, 410, 0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}}, + {3, 410, 0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}}, + }, + /* 20 fps */ + { + {4, 559, 0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}}, + {4, 559, 0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}}, + {4, 559, 0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}}, + {4, 559, 0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}}, + }, + /* 25 fps */ + { + {5, 659, 0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}}, + {5, 659, 0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}}, + {5, 659, 0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}}, + {5, 659, 0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}}, + }, + /* 30 fps */ + { + {7, 838, 0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}}, + {7, 838, 0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}}, + {7, 838, 0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}}, + {7, 838, 0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}}, + }, + }, + /* QSIF */ + { + /* 5 fps */ + { + {1, 146, 0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}}, + {1, 146, 0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}}, + {1, 146, 0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}}, + {1, 146, 0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}}, + }, + /* 10 fps */ + { + {2, 291, 0, {0x2C, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x23, 0xA1, 0xC0, 0x02}}, + {1, 191, 630, {0x2C, 0xF4, 0x05, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xBF, 0xF4, 0xC0, 0x02}}, + {1, 191, 630, {0x2C, 0xF4, 0x05, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xBF, 0xF4, 0xC0, 0x02}}, + {1, 191, 630, {0x2C, 0xF4, 0x05, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xBF, 0xF4, 0xC0, 0x02}}, + }, + /* 15 fps */ + { + {3, 437, 0, {0x2B, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xB5, 0x6D, 0xC0, 0x02}}, + {2, 291, 640, {0x2B, 0xF4, 0x05, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x08, 0x23, 0xA1, 0xC0, 0x02}}, + {2, 291, 640, {0x2B, 0xF4, 0x05, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x08, 0x23, 0xA1, 0xC0, 0x02}}, + {1, 191, 420, {0x2B, 0xF4, 0x0D, 0x0D, 0x1B, 0x0C, 0x53, 0x1E, 0x08, 0xBF, 0xF4, 0xC0, 0x02}}, + }, + /* 20 fps */ + { + {4, 588, 0, {0x2A, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x4C, 0x52, 0xC0, 0x02}}, + {3, 447, 730, {0x2A, 0xF4, 0x05, 0x16, 0xC9, 0x16, 0x01, 0x0E, 0x18, 0xBF, 0x69, 0xC0, 0x02}}, + {2, 292, 476, {0x2A, 0xF4, 0x0D, 0x0E, 0xD8, 0x0E, 0x10, 0x19, 0x18, 0x24, 0xA1, 0xC0, 0x02}}, + {1, 192, 312, {0x2A, 0xF4, 0x1D, 0x09, 0xB3, 0x08, 0xEB, 0x1E, 0x18, 0xC0, 0xF4, 0xC0, 0x02}}, + }, + /* 25 fps */ + { + {5, 703, 0, {0x29, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xBF, 0x42, 0xC0, 0x02}}, + {3, 447, 610, {0x29, 0xF4, 0x05, 0x13, 0x0B, 0x12, 0x43, 0x14, 0x18, 0xBF, 0x69, 0xC0, 0x02}}, + {2, 292, 398, {0x29, 0xF4, 0x0D, 0x0C, 0x6C, 0x0B, 0xA4, 0x1E, 0x18, 0x24, 0xA1, 0xC0, 0x02}}, + {1, 192, 262, {0x29, 0xF4, 0x25, 0x08, 0x23, 0x07, 0x5B, 0x1E, 0x18, 0xC0, 0xF4, 0xC0, 0x02}}, + }, + /* 30 fps */ + { + {8, 873, 0, {0x28, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x69, 0x37, 0xC0, 0x02}}, + {5, 704, 774, {0x28, 0xF4, 0x05, 0x18, 0x21, 0x17, 0x59, 0x0F, 0x18, 0xC0, 0x42, 0xC0, 0x02}}, + {3, 448, 492, {0x28, 0xF4, 0x05, 0x0F, 0x5D, 0x0E, 0x95, 0x15, 0x18, 0xC0, 0x69, 0xC0, 0x02}}, + {2, 291, 320, {0x28, 0xF4, 0x1D, 0x09, 0xFB, 0x09, 0x33, 0x1E, 0x18, 0x23, 0xA1, 0xC0, 0x02}}, + }, + }, + /* QCIF */ + { + /* 5 fps */ + { + {1, 193, 0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}}, + {1, 193, 0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}}, + {1, 193, 0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}}, + {1, 193, 0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}}, + }, + /* 10 fps */ + { + {3, 385, 0, {0x0C, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x81, 0x79, 0xC0, 0x02}}, + {2, 291, 800, {0x0C, 0xF4, 0x05, 0x18, 0xF4, 0x18, 0x18, 0x11, 0x08, 0x23, 0xA1, 0xC0, 0x02}}, + {2, 291, 800, {0x0C, 0xF4, 0x05, 0x18, 0xF4, 0x18, 0x18, 0x11, 0x08, 0x23, 0xA1, 0xC0, 0x02}}, + {1, 194, 532, {0x0C, 0xF4, 0x05, 0x10, 0x9A, 0x0F, 0xBE, 0x1B, 0x08, 0xC2, 0xF0, 0xC0, 0x02}}, + }, + /* 15 fps */ + { + {4, 577, 0, {0x0B, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x41, 0x52, 0xC0, 0x02}}, + {3, 447, 818, {0x0B, 0xF4, 0x05, 0x19, 0x89, 0x18, 0xAD, 0x0F, 0x10, 0xBF, 0x69, 0xC0, 0x02}}, + {2, 292, 534, {0x0B, 0xF4, 0x05, 0x10, 0xA3, 0x0F, 0xC7, 0x19, 0x10, 0x24, 0xA1, 0xC0, 0x02}}, + {1, 195, 356, {0x0B, 0xF4, 0x15, 0x0B, 0x11, 0x0A, 0x35, 0x1E, 0x10, 0xC3, 0xF0, 0xC0, 0x02}}, + }, + /* 20 fps */ + { + {6, 776, 0, {0x0A, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x08, 0x3F, 0xC0, 0x02}}, + {4, 591, 804, {0x0A, 0xF4, 0x05, 0x19, 0x1E, 0x18, 0x42, 0x0F, 0x18, 0x4F, 0x4E, 0xC0, 0x02}}, + {3, 447, 608, {0x0A, 0xF4, 0x05, 0x12, 0xFD, 0x12, 0x21, 0x15, 0x18, 0xBF, 0x69, 0xC0, 0x02}}, + {2, 291, 396, {0x0A, 0xF4, 0x15, 0x0C, 0x5E, 0x0B, 0x82, 0x1E, 0x18, 0x23, 0xA1, 0xC0, 0x02}}, + }, + /* 25 fps */ + { + {9, 928, 0, {0x09, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xA0, 0x33, 0xC0, 0x02}}, + {5, 703, 800, {0x09, 0xF4, 0x05, 0x18, 0xF4, 0x18, 0x18, 0x10, 0x18, 0xBF, 0x42, 0xC0, 0x02}}, + {3, 447, 508, {0x09, 0xF4, 0x0D, 0x0F, 0xD2, 0x0E, 0xF6, 0x1B, 0x18, 0xBF, 0x69, 0xC0, 0x02}}, + {2, 292, 332, {0x09, 0xF4, 0x1D, 0x0A, 0x5A, 0x09, 0x7E, 0x1E, 0x18, 0x24, 0xA1, 0xC0, 0x02}}, + }, + /* 30 fps */ + { + {0, }, + {9, 956, 876, {0x08, 0xF4, 0x05, 0x1B, 0x58, 0x1A, 0x7C, 0x0E, 0x20, 0xBC, 0x33, 0x10, 0x02}}, + {4, 592, 542, {0x08, 0xF4, 0x05, 0x10, 0xE4, 0x10, 0x08, 0x17, 0x20, 0x50, 0x4E, 0x10, 0x02}}, + {2, 291, 266, {0x08, 0xF4, 0x25, 0x08, 0x48, 0x07, 0x6C, 0x1E, 0x20, 0x23, 0xA1, 0x10, 0x02}}, + }, + }, + /* SIF */ + { + /* 5 fps */ + { + {4, 582, 0, {0x35, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x46, 0x52, 0x60, 0x02}}, + {3, 387, 1276, {0x35, 0xF4, 0x05, 0x27, 0xD8, 0x26, 0x48, 0x03, 0x10, 0x83, 0x79, 0x60, 0x02}}, + {2, 291, 960, {0x35, 0xF4, 0x0D, 0x1D, 0xF2, 0x1C, 0x62, 0x04, 0x10, 0x23, 0xA1, 0x60, 0x02}}, + {1, 191, 630, {0x35, 0xF4, 0x1D, 0x13, 0xA9, 0x12, 0x19, 0x05, 0x08, 0xBF, 0xF4, 0x60, 0x02}}, + }, + /* 10 fps */ + { + {0, }, + {6, 775, 1278, {0x34, 0xF4, 0x05, 0x27, 0xE8, 0x26, 0x58, 0x05, 0x30, 0x07, 0x3F, 0x10, 0x02}}, + {3, 447, 736, {0x34, 0xF4, 0x15, 0x16, 0xFB, 0x15, 0x6B, 0x05, 0x18, 0xBF, 0x69, 0x10, 0x02}}, + {2, 291, 480, {0x34, 0xF4, 0x2D, 0x0E, 0xF9, 0x0D, 0x69, 0x09, 0x18, 0x23, 0xA1, 0x10, 0x02}}, + }, + /* 15 fps */ + { + {0, }, + {9, 955, 1050, {0x33, 0xF4, 0x05, 0x20, 0xCF, 0x1F, 0x3F, 0x06, 0x48, 0xBB, 0x33, 0x10, 0x02}}, + {4, 591, 650, {0x33, 0xF4, 0x15, 0x14, 0x44, 0x12, 0xB4, 0x08, 0x30, 0x4F, 0x4E, 0x10, 0x02}}, + {3, 448, 492, {0x33, 0xF4, 0x25, 0x0F, 0x52, 0x0D, 0xC2, 0x09, 0x28, 0xC0, 0x69, 0x10, 0x02}}, + }, + /* 20 fps */ + { + {0, }, + {9, 958, 782, {0x32, 0xF4, 0x0D, 0x18, 0x6A, 0x16, 0xDA, 0x0B, 0x58, 0xBE, 0x33, 0xD0, 0x02}}, + {5, 703, 574, {0x32, 0xF4, 0x1D, 0x11, 0xE7, 0x10, 0x57, 0x0B, 0x40, 0xBF, 0x42, 0xD0, 0x02}}, + {3, 446, 364, {0x32, 0xF4, 0x3D, 0x0B, 0x5C, 0x09, 0xCC, 0x0E, 0x30, 0xBE, 0x69, 0xD0, 0x02}}, + }, + /* 25 fps */ + { + {0, }, + {9, 958, 654, {0x31, 0xF4, 0x15, 0x14, 0x66, 0x12, 0xD6, 0x0B, 0x50, 0xBE, 0x33, 0x90, 0x02}}, + {6, 776, 530, {0x31, 0xF4, 0x25, 0x10, 0x8C, 0x0E, 0xFC, 0x0C, 0x48, 0x08, 0x3F, 0x90, 0x02}}, + {4, 592, 404, {0x31, 0xF4, 0x35, 0x0C, 0x96, 0x0B, 0x06, 0x0B, 0x38, 0x50, 0x4E, 0x90, 0x02}}, + }, + /* 30 fps */ + { + {0, }, + {9, 957, 526, {0x30, 0xF4, 0x25, 0x10, 0x68, 0x0E, 0xD8, 0x0D, 0x58, 0xBD, 0x33, 0x60, 0x02}}, + {6, 775, 426, {0x30, 0xF4, 0x35, 0x0D, 0x48, 0x0B, 0xB8, 0x0F, 0x50, 0x07, 0x3F, 0x60, 0x02}}, + {4, 590, 324, {0x30, 0x7A, 0x4B, 0x0A, 0x1C, 0x08, 0xB4, 0x0E, 0x40, 0x4E, 0x52, 0x60, 0x02}}, + }, + }, + /* CIF */ + { + /* 5 fps */ + { + {6, 771, 0, {0x15, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x3F, 0x80, 0x02}}, + {4, 465, 1278, {0x15, 0xF4, 0x05, 0x27, 0xEE, 0x26, 0x36, 0x03, 0x18, 0xD1, 0x65, 0x80, 0x02}}, + {2, 291, 800, {0x15, 0xF4, 0x15, 0x18, 0xF4, 0x17, 0x3C, 0x05, 0x18, 0x23, 0xA1, 0x80, 0x02}}, + {1, 193, 528, {0x15, 0xF4, 0x2D, 0x10, 0x7E, 0x0E, 0xC6, 0x0A, 0x18, 0xC1, 0xF4, 0x80, 0x02}}, + }, + /* 10 fps */ + { + {0, }, + {9, 932, 1278, {0x14, 0xF4, 0x05, 0x27, 0xEE, 0x26, 0x36, 0x04, 0x30, 0xA4, 0x33, 0x10, 0x02}}, + {4, 591, 812, {0x14, 0xF4, 0x15, 0x19, 0x56, 0x17, 0x9E, 0x06, 0x28, 0x4F, 0x4E, 0x10, 0x02}}, + {2, 291, 400, {0x14, 0xF4, 0x3D, 0x0C, 0x7A, 0x0A, 0xC2, 0x0E, 0x28, 0x23, 0xA1, 0x10, 0x02}}, + }, + /* 15 fps */ + { + {0, }, + {9, 956, 876, {0x13, 0xF4, 0x0D, 0x1B, 0x58, 0x19, 0xA0, 0x05, 0x38, 0xBC, 0x33, 0x60, 0x02}}, + {5, 703, 644, {0x13, 0xF4, 0x1D, 0x14, 0x1C, 0x12, 0x64, 0x08, 0x38, 0xBF, 0x42, 0x60, 0x02}}, + {3, 448, 410, {0x13, 0xF4, 0x3D, 0x0C, 0xC4, 0x0B, 0x0C, 0x0E, 0x38, 0xC0, 0x69, 0x60, 0x02}}, + }, + /* 20 fps */ + { + {0, }, + {9, 956, 650, {0x12, 0xF4, 0x1D, 0x14, 0x4A, 0x12, 0x92, 0x09, 0x48, 0xBC, 0x33, 0x10, 0x03}}, + {6, 776, 528, {0x12, 0xF4, 0x2D, 0x10, 0x7E, 0x0E, 0xC6, 0x0A, 0x40, 0x08, 0x3F, 0x10, 0x03}}, + {4, 591, 402, {0x12, 0xF4, 0x3D, 0x0C, 0x8F, 0x0A, 0xD7, 0x0E, 0x40, 0x4F, 0x4E, 0x10, 0x03}}, + }, + /* 25 fps */ + { + {0, }, + {9, 956, 544, {0x11, 0xF4, 0x25, 0x10, 0xF4, 0x0F, 0x3C, 0x0A, 0x48, 0xBC, 0x33, 0xC0, 0x02}}, + {7, 840, 478, {0x11, 0xF4, 0x2D, 0x0E, 0xEB, 0x0D, 0x33, 0x0B, 0x48, 0x48, 0x3B, 0xC0, 0x02}}, + {5, 703, 400, {0x11, 0xF4, 0x3D, 0x0C, 0x7A, 0x0A, 0xC2, 0x0E, 0x48, 0xBF, 0x42, 0xC0, 0x02}}, + }, + /* 30 fps */ + { + {0, }, + {9, 956, 438, {0x10, 0xF4, 0x35, 0x0D, 0xAC, 0x0B, 0xF4, 0x0D, 0x50, 0xBC, 0x33, 0x10, 0x02}}, + {7, 838, 384, {0x10, 0xF4, 0x45, 0x0B, 0xFD, 0x0A, 0x45, 0x0F, 0x50, 0x46, 0x3B, 0x10, 0x02}}, + {6, 773, 354, {0x10, 0x7A, 0x4B, 0x0B, 0x0C, 0x09, 0x80, 0x10, 0x50, 0x05, 0x3F, 0x10, 0x02}}, + }, + }, + /* VGA */ + { + /* 5 fps */ + { + {0, }, + {6, 773, 1272, {0x1D, 0xF4, 0x15, 0x27, 0xB6, 0x24, 0x96, 0x02, 0x30, 0x05, 0x3F, 0x10, 0x02}}, + {4, 592, 976, {0x1D, 0xF4, 0x25, 0x1E, 0x78, 0x1B, 0x58, 0x03, 0x30, 0x50, 0x4E, 0x10, 0x02}}, + {3, 448, 738, {0x1D, 0xF4, 0x3D, 0x17, 0x0C, 0x13, 0xEC, 0x04, 0x30, 0xC0, 0x69, 0x10, 0x02}}, + }, + /* 10 fps */ + { + {0, }, + {9, 956, 788, {0x1C, 0xF4, 0x35, 0x18, 0x9C, 0x15, 0x7C, 0x03, 0x48, 0xBC, 0x33, 0x10, 0x02}}, + {6, 776, 640, {0x1C, 0x7A, 0x53, 0x13, 0xFC, 0x11, 0x2C, 0x04, 0x48, 0x08, 0x3F, 0x10, 0x02}}, + {4, 592, 488, {0x1C, 0x7A, 0x6B, 0x0F, 0x3C, 0x0C, 0x6C, 0x06, 0x48, 0x50, 0x4E, 0x10, 0x02}}, + }, + /* 15 fps */ + { + {0, }, + {9, 957, 526, {0x1B, 0x7A, 0x63, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x33, 0x80, 0x02}}, + {9, 957, 526, {0x1B, 0x7A, 0x63, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x33, 0x80, 0x02}}, + {8, 895, 492, {0x1B, 0x7A, 0x6B, 0x0F, 0x5D, 0x0C, 0x8D, 0x06, 0x58, 0x7F, 0x37, 0x80, 0x02}}, + }, + /* 20 fps */ + { + {0, }, + {0, }, + {0, }, + {0, }, + }, + /* 25 fps */ + { + {0, }, + {0, }, + {0, }, + {0, }, + }, + /* 30 fps */ + { + {0, }, + {0, }, + {0, }, + {0, }, + }, + }, +}; + diff --git a/drivers/usb/media/pwc/pwc-timon.h b/drivers/media/video/pwc/pwc-timon.h index a86b3782a081..a86b3782a081 100644 --- a/drivers/usb/media/pwc/pwc-timon.h +++ b/drivers/media/video/pwc/pwc-timon.h diff --git a/drivers/usb/media/pwc/pwc-uncompress.c b/drivers/media/video/pwc/pwc-uncompress.c index ef4204eab6c4..b37a89a163f9 100644 --- a/drivers/usb/media/pwc/pwc-uncompress.c +++ b/drivers/media/video/pwc/pwc-uncompress.c @@ -109,9 +109,9 @@ int pwc_decompress(struct pwc_device *pdev) in planar format immediately. */ int flags; - - flags = PWCX_FLAG_PLANAR; - if (pdev->vsize == PSZ_VGA && pdev->vframes == 5 && pdev->vsnapshot) + + flags = PWCX_FLAG_PLANAR; + if (pdev->vsize == PSZ_VGA && pdev->vframes == 5 && pdev->vsnapshot) { printk(KERN_ERR "pwc: Mode Bayer is not supported for now\n"); flags |= PWCX_FLAG_BAYER; diff --git a/drivers/usb/media/pwc/pwc-uncompress.h b/drivers/media/video/pwc/pwc-uncompress.h index d3b9250e4ed3..f75e1b6cbe19 100644 --- a/drivers/usb/media/pwc/pwc-uncompress.h +++ b/drivers/media/video/pwc/pwc-uncompress.h @@ -24,7 +24,7 @@ /* This file is the bridge between the kernel module and the plugin; it describes the structures and datatypes used in both modules. Any - significant change should be reflected by increasing the + significant change should be reflected by increasing the pwc_decompressor_version major number. */ #ifndef PWC_UNCOMPRESS_H diff --git a/drivers/usb/media/pwc/pwc.h b/drivers/media/video/pwc/pwc.h index 6dd76bb3dff1..1b0ee0ced0ed 100644 --- a/drivers/usb/media/pwc/pwc.h +++ b/drivers/media/video/pwc/pwc.h @@ -123,7 +123,7 @@ struct pwc_device #endif /* Pointer to our usb_device */ struct usb_device *udev; - + int type; /* type of cam (645, 646, 675, 680, 690, 720, 730, 740, 750) */ int release; /* release number */ int features; /* feature bits */ @@ -149,7 +149,7 @@ struct pwc_device char vsnapshot; /* snapshot mode */ char vsync; /* used by isoc handler */ char vmirror; /* for ToUCaM series */ - + int cmd_len; unsigned char cmd_buf[13]; diff --git a/drivers/media/video/rds.h b/drivers/media/video/rds.h deleted file mode 100644 index 0d30eb744e61..000000000000 --- a/drivers/media/video/rds.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - - Types and defines needed for RDS. This is included by - saa6588.c and every driver (e.g. bttv-driver.c) that wants - to use the saa6588 module. - - Instead of having a seperate rds.h, I'd prefer to include - this stuff in one of the already existing files like tuner.h - - (c) 2005 by Hans J. Koch - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#ifndef _RDS_H -#define _RDS_H - -struct rds_command { - unsigned int block_count; - int result; - unsigned char __user *buffer; - struct file *instance; - poll_table *event_list; -}; - -#define RDS_CMD_OPEN _IOW('R',1,int) -#define RDS_CMD_CLOSE _IOW('R',2,int) -#define RDS_CMD_READ _IOR('R',3,int) -#define RDS_CMD_POLL _IOR('R',4,int) - -#endif - - - - diff --git a/drivers/media/video/saa5249.c b/drivers/media/video/saa5249.c index a9f3cf0b1e3c..531e9461cb66 100644 --- a/drivers/media/video/saa5249.c +++ b/drivers/media/video/saa5249.c @@ -71,7 +71,7 @@ #define NUM_BUFS 8 #define IF_NAME "SAA5249" -static const int disp_modes[8][3] = +static const int disp_modes[8][3] = { { 0x46, 0x03, 0x03 }, /* DISPOFF */ { 0x46, 0xcc, 0xcc }, /* DISPNORM */ @@ -150,8 +150,8 @@ static int saa5249_attach(struct i2c_adapter *adap, int addr, int kind) client=kmalloc(sizeof(*client), GFP_KERNEL); if(client==NULL) return -ENOMEM; - client_template.adapter = adap; - client_template.addr = addr; + client_template.adapter = adap; + client_template.addr = addr; memcpy(client, &client_template, sizeof(*client)); t = kzalloc(sizeof(*t), GFP_KERNEL); if(t==NULL) @@ -161,11 +161,11 @@ static int saa5249_attach(struct i2c_adapter *adap, int addr, int kind) } strlcpy(client->name, IF_NAME, I2C_NAME_SIZE); mutex_init(&t->lock); - + /* * Now create a video4linux device */ - + vd = kmalloc(sizeof(struct video_device), GFP_KERNEL); if(vd==NULL) { @@ -175,8 +175,8 @@ static int saa5249_attach(struct i2c_adapter *adap, int addr, int kind) } i2c_set_clientdata(client, vd); memcpy(vd, &saa_template, sizeof(*vd)); - - for (pgbuf = 0; pgbuf < NUM_DAUS; pgbuf++) + + for (pgbuf = 0; pgbuf < NUM_DAUS; pgbuf++) { memset(t->vdau[pgbuf].pgbuf, ' ', sizeof(t->vdau[0].pgbuf)); memset(t->vdau[pgbuf].sregs, 0, sizeof(t->vdau[0].sregs)); @@ -186,9 +186,9 @@ static int saa5249_attach(struct i2c_adapter *adap, int addr, int kind) t->vdau[pgbuf].stopped = TRUE; t->is_searching[pgbuf] = FALSE; } - vd->priv=t; - - + vd->priv=t; + + /* * Register it */ @@ -208,7 +208,7 @@ static int saa5249_attach(struct i2c_adapter *adap, int addr, int kind) /* * We do most of the hard work when we become a device on the i2c. */ - + static int saa5249_probe(struct i2c_adapter *adap) { if (adap->class & I2C_CLASS_TV_ANALOG) @@ -229,7 +229,7 @@ static int saa5249_detach(struct i2c_client *client) /* new I2C driver support */ -static struct i2c_driver i2c_driver_videotext = +static struct i2c_driver i2c_driver_videotext = { .driver = { .name = IF_NAME, /* name */ @@ -249,7 +249,7 @@ static struct i2c_client client_template = { * delay may be longer. */ -static void jdelay(unsigned long delay) +static void jdelay(unsigned long delay) { sigset_t oldblocked = current->blocked; @@ -269,14 +269,14 @@ static void jdelay(unsigned long delay) /* * I2C interfaces */ - -static int i2c_sendbuf(struct saa5249_device *t, int reg, int count, u8 *data) + +static int i2c_sendbuf(struct saa5249_device *t, int reg, int count, u8 *data) { char buf[64]; - + buf[0] = reg; memcpy(buf+1, data, count); - + if(i2c_master_send(t->client, buf, count+1)==count+1) return 0; return -1; @@ -289,7 +289,7 @@ static int i2c_senddata(struct saa5249_device *t, ...) int ct=0; va_list argp; va_start(argp,t); - + while((v=va_arg(argp,int))!=-1) buf[ct++]=v; return i2c_sendbuf(t, buf[0], ct-1, buf+1); @@ -301,7 +301,7 @@ static int i2c_senddata(struct saa5249_device *t, ...) * Returns -1 if I²C-device didn't send acknowledge, 0 otherwise */ -static int i2c_getdata(struct saa5249_device *t, int count, u8 *buf) +static int i2c_getdata(struct saa5249_device *t, int count, u8 *buf) { if(i2c_master_recv(t->client, buf, count)!=count) return -1; @@ -320,9 +320,9 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, struct video_device *vd = video_devdata(file); struct saa5249_device *t=vd->priv; - switch(cmd) + switch(cmd) { - case VTXIOCGETINFO: + case VTXIOCGETINFO: { vtx_info_t *info = arg; info->version_major = VTX_VER_MAJ; @@ -332,10 +332,10 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, return 0; } - case VTXIOCCLRPAGE: + case VTXIOCCLRPAGE: { vtx_pagereq_t *req = arg; - + if (req->pgbuf < 0 || req->pgbuf >= NUM_DAUS) return -EINVAL; memset(t->vdau[req->pgbuf].pgbuf, ' ', sizeof(t->vdau[0].pgbuf)); @@ -343,17 +343,17 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, return 0; } - case VTXIOCCLRFOUND: + case VTXIOCCLRFOUND: { vtx_pagereq_t *req = arg; - + if (req->pgbuf < 0 || req->pgbuf >= NUM_DAUS) return -EINVAL; t->vdau[req->pgbuf].clrfound = TRUE; return 0; } - case VTXIOCPAGEREQ: + case VTXIOCPAGEREQ: { vtx_pagereq_t *req = arg; if (!(req->pagemask & PGMASK_PAGE)) @@ -381,7 +381,7 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, return 0; } - case VTXIOCGETSTAT: + case VTXIOCGETSTAT: { vtx_pagereq_t *req = arg; u8 infobits[10]; @@ -390,7 +390,7 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, if (req->pgbuf < 0 || req->pgbuf >= NUM_DAUS) return -EINVAL; - if (!t->vdau[req->pgbuf].stopped) + if (!t->vdau[req->pgbuf].stopped) { if (i2c_senddata(t, 2, 0, -1) || i2c_sendbuf(t, 3, sizeof(t->vdau[0].sregs), t->vdau[req->pgbuf].sregs) || @@ -403,7 +403,7 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, return -EIO; if (!(infobits[8] & 0x10) && !(infobits[7] & 0xf0) && /* check FOUND-bit */ - (memcmp(infobits, t->vdau[req->pgbuf].laststat, sizeof(infobits)) || + (memcmp(infobits, t->vdau[req->pgbuf].laststat, sizeof(infobits)) || time_after_eq(jiffies, t->vdau[req->pgbuf].expire))) { /* check if new page arrived */ if (i2c_senddata(t, 8, 0, 0, 0, -1) || @@ -411,7 +411,7 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, return -EIO; t->vdau[req->pgbuf].expire = jiffies + PGBUF_EXPIRE; memset(t->vdau[req->pgbuf].pgbuf + VTX_PAGESIZE, ' ', VTX_VIRTUALSIZE - VTX_PAGESIZE); - if (t->virtual_mode) + if (t->virtual_mode) { /* Packet X/24 */ if (i2c_senddata(t, 8, 0, 0x20, 0, -1) || @@ -459,9 +459,9 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, info.notfound = !!(infobits[8] & 0x10); info.pblf = !!(infobits[9] & 0x20); info.hamming = 0; - for (a = 0; a <= 7; a++) + for (a = 0; a <= 7; a++) { - if (infobits[a] & 0xf0) + if (infobits[a] & 0xf0) { info.hamming = 1; break; @@ -471,14 +471,14 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, info.notfound = 1; if(copy_to_user(req->buffer, &info, sizeof(vtx_pageinfo_t))) return -EFAULT; - if (!info.hamming && !info.notfound) + if (!info.hamming && !info.notfound) { t->is_searching[req->pgbuf] = FALSE; } return 0; } - case VTXIOCGETPAGE: + case VTXIOCGETPAGE: { vtx_pagereq_t *req = arg; int start, end; @@ -488,15 +488,15 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, return -EINVAL; if(copy_to_user(req->buffer, &t->vdau[req->pgbuf].pgbuf[req->start], req->end - req->start + 1)) return -EFAULT; - - /* + + /* * Always read the time directly from SAA5249 */ - - if (req->start <= 39 && req->end >= 32) + + if (req->start <= 39 && req->end >= 32) { int len; - char buf[16]; + char buf[16]; start = max(req->start, 32); end = min(req->end, 39); len=end-start+1; @@ -507,7 +507,7 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, return -EFAULT; } /* Insert the current header if DAU is still searching for a page */ - if (req->start <= 31 && req->end >= 7 && t->is_searching[req->pgbuf]) + if (req->start <= 31 && req->end >= 7 && t->is_searching[req->pgbuf]) { char buf[32]; int len; @@ -523,7 +523,7 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, return 0; } - case VTXIOCSTOPDAU: + case VTXIOCSTOPDAU: { vtx_pagereq_t *req = arg; @@ -534,12 +534,12 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, return 0; } - case VTXIOCPUTPAGE: - case VTXIOCSETDISP: - case VTXIOCPUTSTAT: + case VTXIOCPUTPAGE: + case VTXIOCSETDISP: + case VTXIOCPUTSTAT: return 0; - - case VTXIOCCLRCACHE: + + case VTXIOCCLRCACHE: { if (i2c_senddata(t, 0, NUM_DAUS, 0, 8, -1) || i2c_senddata(t, 11, ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ', @@ -551,7 +551,7 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, return 0; } - case VTXIOCSETVIRT: + case VTXIOCSETVIRT: { /* The SAA5249 has virtual-row reception turned on always */ t->virtual_mode = (int)(long)arg; @@ -612,14 +612,14 @@ static inline unsigned int vtx_fix_command(unsigned int cmd) /* * Handle the locking */ - + static int saa5249_ioctl(struct inode *inode, struct file *file, - unsigned int cmd, unsigned long arg) + unsigned int cmd, unsigned long arg) { struct video_device *vd = video_devdata(file); struct saa5249_device *t=vd->priv; int err; - + cmd = vtx_fix_command(cmd); mutex_lock(&t->lock); err = video_usercopy(inode,file,cmd,arg,do_saa5249_ioctl); @@ -627,7 +627,7 @@ static int saa5249_ioctl(struct inode *inode, struct file *file, return err; } -static int saa5249_open(struct inode *inode, struct file *file) +static int saa5249_open(struct inode *inode, struct file *file) { struct video_device *vd = video_devdata(file); struct saa5249_device *t=vd->priv; @@ -636,7 +636,7 @@ static int saa5249_open(struct inode *inode, struct file *file) err = video_exclusive_open(inode,file); if (err < 0) return err; - + if (t->client==NULL) { err = -ENODEV; goto fail; @@ -647,13 +647,13 @@ static int saa5249_open(struct inode *inode, struct file *file) i2c_senddata(t, 1, disp_modes[t->disp_mode][0], 0, -1) || /* Display TV-picture, no virtual rows */ i2c_senddata(t, 4, NUM_DAUS, disp_modes[t->disp_mode][1], disp_modes[t->disp_mode][2], 7, -1)) /* Set display to page 4 */ - + { err = -EIO; goto fail; } - for (pgbuf = 0; pgbuf < NUM_DAUS; pgbuf++) + for (pgbuf = 0; pgbuf < NUM_DAUS; pgbuf++) { memset(t->vdau[pgbuf].pgbuf, ' ', sizeof(t->vdau[0].pgbuf)); memset(t->vdau[pgbuf].sregs, 0, sizeof(t->vdau[0].sregs)); @@ -673,7 +673,7 @@ static int saa5249_open(struct inode *inode, struct file *file) -static int saa5249_release(struct inode *inode, struct file *file) +static int saa5249_release(struct inode *inode, struct file *file) { struct video_device *vd = video_devdata(file); struct saa5249_device *t=vd->priv; @@ -690,7 +690,7 @@ static int __init init_saa_5249 (void) return i2c_add_driver(&i2c_driver_videotext); } -static void __exit cleanup_saa_5249 (void) +static void __exit cleanup_saa_5249 (void) { i2c_del_driver(&i2c_driver_videotext); } diff --git a/drivers/media/video/saa6588.c b/drivers/media/video/saa6588.c index d17395c4f55c..a81285ca7d5b 100644 --- a/drivers/media/video/saa6588.c +++ b/drivers/media/video/saa6588.c @@ -32,7 +32,7 @@ #include <asm/uaccess.h> -#include "rds.h" +#include <media/rds.h> /* Addresses to scan */ static unsigned short normal_i2c[] = { diff --git a/drivers/media/video/saa7110.c b/drivers/media/video/saa7110.c index e18ea268384b..41d951db6ec0 100644 --- a/drivers/media/video/saa7110.c +++ b/drivers/media/video/saa7110.c @@ -139,7 +139,7 @@ saa7110_read (struct i2c_client *client) static int saa7110_selmux (struct i2c_client *client, - int chan) + int chan) { static const unsigned char modes[9][8] = { /* mode 0 */ @@ -457,7 +457,7 @@ static unsigned short normal_i2c[] = { }; static unsigned short ignore = I2C_CLIENT_END; - + static struct i2c_client_address_data addr_data = { .normal_i2c = normal_i2c, .probe = &ignore, diff --git a/drivers/media/video/saa7111.c b/drivers/media/video/saa7111.c index f9ba0c943adf..686fd4746205 100644 --- a/drivers/media/video/saa7111.c +++ b/drivers/media/video/saa7111.c @@ -1,4 +1,4 @@ -/* +/* * saa7111 - Philips SAA7111A video decoder driver version 0.0.3 * * Copyright (C) 1998 Dave Perks <dperks@ibm.net> @@ -482,7 +482,7 @@ saa7111_command (struct i2c_client *client, static unsigned short normal_i2c[] = { I2C_SAA7111 >> 1, I2C_CLIENT_END }; static unsigned short ignore = I2C_CLIENT_END; - + static struct i2c_client_address_data addr_data = { .normal_i2c = normal_i2c, .probe = &ignore, diff --git a/drivers/media/video/saa7114.c b/drivers/media/video/saa7114.c index 4a1f841d0c77..90398ab8252e 100644 --- a/drivers/media/video/saa7114.c +++ b/drivers/media/video/saa7114.c @@ -1,4 +1,4 @@ -/* +/* * saa7114 - Philips SAA7114H video decoder driver version 0.0.1 * * Copyright (C) 2002 Maxim Yevtyushkin <max@linuxmedialabs.com> @@ -300,7 +300,7 @@ static const unsigned char init[] = { 0x55, 0xff, 0x56, 0xff, 0x57, 0xff, - 0x58, 0x40, // framing code + 0x58, 0x40, // framing code 0x59, 0x47, // horizontal offset 0x5a, 0x06, // vertical offset 0x5b, 0x83, // field offset @@ -345,7 +345,7 @@ static const unsigned char init[] = { 0x82, 0x00, 0x83, 0x00, 0x84, 0xc5, - 0x85, 0x0d, // hsync and vsync ? + 0x85, 0x0d, // hsync and vsync ? 0x86, 0x40, 0x87, 0x01, 0x88, 0x00, @@ -434,7 +434,7 @@ static const unsigned char init[] = { 0xd9, 0x04, 0xda, 0x00, // horizontal luminance phase offset 0xdb, 0x00, - 0xdc, 0x00, // horizontal chrominance scaling increment + 0xdc, 0x00, // horizontal chrominance scaling increment 0xdd, 0x02, 0xde, 0x00, // horizontal chrominance phase offset 0xdf, 0x00, @@ -754,7 +754,7 @@ saa7114_command (struct i2c_client *client, saa7114_write(client, 0x87, decoder->reg[REG_ADDR(0x87)]); saa7114_write(client, 0x88, 0xd8); // sw reset scaler - saa7114_write(client, 0x88, 0xf8); // sw reset scaler release + saa7114_write(client, 0x88, 0xf8); // sw reset scaler release saa7114_write(client, 0x80, 0x36); } @@ -813,7 +813,7 @@ static unsigned short normal_i2c[] = { I2C_SAA7114 >> 1, I2C_SAA7114A >> 1, I2C_CLIENT_END }; static unsigned short ignore = I2C_CLIENT_END; - + static struct i2c_client_address_data addr_data = { .normal_i2c = normal_i2c, .probe = &ignore, diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c index b184fd00b4e7..b05015282601 100644 --- a/drivers/media/video/saa7115.c +++ b/drivers/media/video/saa7115.c @@ -40,7 +40,6 @@ #include <linux/i2c.h> #include <linux/videodev2.h> #include <media/v4l2-common.h> -#include <media/audiochip.h> #include <asm/div64.h> MODULE_DESCRIPTION("Philips SAA7113/SAA7114/SAA7115 video decoder driver"); diff --git a/drivers/media/video/saa7121.h b/drivers/media/video/saa7121.h index 74e37d405208..66967ae37494 100644 --- a/drivers/media/video/saa7121.h +++ b/drivers/media/video/saa7121.h @@ -64,7 +64,7 @@ #define PAL_MSB_VERTICAL 0x40 /* 7c */ /* Initialization Sequence */ - + static __u8 init7121ntsc[] = { 0x26, 0x0, 0x27, 0x0, 0x28, NTSC_BURST_START, 0x29, NTSC_BURST_END, @@ -95,7 +95,7 @@ static __u8 init7121ntsc[] = { 0x78, 0x0, 0x79, 0x0, 0x7a, NTSC_FIRST_ACTIVE, 0x7b, NTSC_LAST_ACTIVE, 0x7c, NTSC_MSB_VERTICAL, 0x7d, 0x0, 0x7e, 0x0, 0x7f, 0x0 -}; +}; #define INIT7121LEN (sizeof(init7121ntsc)/2) static __u8 init7121pal[] = { @@ -128,5 +128,5 @@ static __u8 init7121pal[] = { 0x78, 0x0, 0x79, 0x0, 0x7a, PAL_FIRST_ACTIVE, 0x7b, PAL_LAST_ACTIVE, 0x7c, PAL_MSB_VERTICAL, 0x7d, 0x0, 0x7e, 0x0, 0x7f, 0x0 -}; +}; #endif diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c index aca84d2f9825..bb3e0ba946d3 100644 --- a/drivers/media/video/saa7134/saa7134-alsa.c +++ b/drivers/media/video/saa7134/saa7134-alsa.c @@ -507,7 +507,7 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream, /* release the old buffer */ if (substream->runtime->dma_area) { saa7134_pgtable_free(dev->pci, &dev->dmasound.pt); - videobuf_dma_pci_unmap(dev->pci, &dev->dmasound.dma); + videobuf_pci_dma_unmap(dev->pci, &dev->dmasound.dma); dsp_buffer_free(dev); substream->runtime->dma_area = NULL; } @@ -523,12 +523,12 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream, return err; } - if (0 != (err = videobuf_dma_pci_map(dev->pci, &dev->dmasound.dma))) { + if (0 != (err = videobuf_pci_dma_map(dev->pci, &dev->dmasound.dma))) { dsp_buffer_free(dev); return err; } if (0 != (err = saa7134_pgtable_alloc(dev->pci,&dev->dmasound.pt))) { - videobuf_dma_pci_unmap(dev->pci, &dev->dmasound.dma); + videobuf_pci_dma_unmap(dev->pci, &dev->dmasound.dma); dsp_buffer_free(dev); return err; } @@ -537,7 +537,7 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream, dev->dmasound.dma.sglen, 0))) { saa7134_pgtable_free(dev->pci, &dev->dmasound.pt); - videobuf_dma_pci_unmap(dev->pci, &dev->dmasound.dma); + videobuf_pci_dma_unmap(dev->pci, &dev->dmasound.dma); dsp_buffer_free(dev); return err; } @@ -571,7 +571,7 @@ static int snd_card_saa7134_hw_free(struct snd_pcm_substream * substream) if (substream->runtime->dma_area) { saa7134_pgtable_free(dev->pci, &dev->dmasound.pt); - videobuf_dma_pci_unmap(dev->pci, &dev->dmasound.dma); + videobuf_pci_dma_unmap(dev->pci, &dev->dmasound.dma); dsp_buffer_free(dev); substream->runtime->dma_area = NULL; } diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index 58e568d7d2ee..c98571c9d5a6 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c @@ -254,12 +254,12 @@ void saa7134_pgtable_free(struct pci_dev *pci, struct saa7134_pgtable *pt) /* ------------------------------------------------------------------ */ -void saa7134_dma_free(struct saa7134_dev *dev,struct saa7134_buf *buf) +void saa7134_dma_free(struct videobuf_queue *q,struct saa7134_buf *buf) { BUG_ON(in_interrupt()); videobuf_waiton(&buf->vb,0,0); - videobuf_dma_pci_unmap(dev->pci, &buf->vb.dma); + videobuf_dma_unmap(q, &buf->vb.dma); videobuf_dma_free(&buf->vb.dma); buf->vb.state = STATE_NEEDS_INIT; } @@ -960,7 +960,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, if (saa7134_no_overlay <= 0) { saa7134_video_template.type |= VID_TYPE_OVERLAY; } else { - printk("bttv: Overlay support disabled.\n"); + printk("%s: Overlay support disabled.\n",dev->name); } dev->video_dev = vdev_init(dev,&saa7134_video_template,"video"); err = video_register_device(dev->video_dev,VFL_TYPE_GRABBER, diff --git a/drivers/media/video/saa7134/saa7134-oss.c b/drivers/media/video/saa7134/saa7134-oss.c index d79d05f88705..7aa02b34e012 100644 --- a/drivers/media/video/saa7134/saa7134-oss.c +++ b/drivers/media/video/saa7134/saa7134-oss.c @@ -124,7 +124,7 @@ static int dsp_rec_start(struct saa7134_dev *dev) unsigned long flags; /* prepare buffer */ - if (0 != (err = videobuf_dma_pci_map(dev->pci,&dev->dmasound.dma))) + if (0 != (err = videobuf_pci_dma_map(dev->pci,&dev->dmasound.dma))) return err; if (0 != (err = saa7134_pgtable_alloc(dev->pci,&dev->dmasound.pt))) goto fail1; @@ -213,7 +213,7 @@ static int dsp_rec_start(struct saa7134_dev *dev) fail2: saa7134_pgtable_free(dev->pci,&dev->dmasound.pt); fail1: - videobuf_dma_pci_unmap(dev->pci,&dev->dmasound.dma); + videobuf_pci_dma_unmap(dev->pci,&dev->dmasound.dma); return err; } @@ -231,7 +231,7 @@ static int dsp_rec_stop(struct saa7134_dev *dev) /* unlock buffer */ saa7134_pgtable_free(dev->pci,&dev->dmasound.pt); - videobuf_dma_pci_unmap(dev->pci,&dev->dmasound.dma); + videobuf_pci_dma_unmap(dev->pci,&dev->dmasound.dma); return 0; } diff --git a/drivers/media/video/saa7134/saa7134-ts.c b/drivers/media/video/saa7134/saa7134-ts.c index 470903e2f5e5..60a90a2617ae 100644 --- a/drivers/media/video/saa7134/saa7134-ts.c +++ b/drivers/media/video/saa7134/saa7134-ts.c @@ -89,7 +89,7 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, return -EINVAL; if (buf->vb.size != size) { - saa7134_dma_free(dev,buf); + saa7134_dma_free(q,buf); } if (STATE_NEEDS_INIT == buf->vb.state) { @@ -98,7 +98,7 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, buf->vb.size = size; buf->pt = &dev->ts.pt_ts; - err = videobuf_iolock(dev->pci,&buf->vb,NULL); + err = videobuf_iolock(q,&buf->vb,NULL); if (err) goto oops; err = saa7134_pgtable_build(dev->pci,buf->pt, @@ -126,7 +126,7 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, return 0; oops: - saa7134_dma_free(dev,buf); + saa7134_dma_free(q,buf); return err; } @@ -152,10 +152,9 @@ static void buffer_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) { - struct saa7134_dev *dev = q->priv_data; struct saa7134_buf *buf = container_of(vb,struct saa7134_buf,vb); - saa7134_dma_free(dev,buf); + saa7134_dma_free(q,buf); } struct videobuf_queue_ops saa7134_ts_qops = { diff --git a/drivers/media/video/saa7134/saa7134-tvaudio.c b/drivers/media/video/saa7134/saa7134-tvaudio.c index 3043233a8b6e..0db53d192b2a 100644 --- a/drivers/media/video/saa7134/saa7134-tvaudio.c +++ b/drivers/media/video/saa7134/saa7134-tvaudio.c @@ -482,12 +482,14 @@ static int tvaudio_setstereo(struct saa7134_dev *dev, struct saa7134_tvaudio *au [ V4L2_TUNER_MODE_STEREO ] = "stereo", [ V4L2_TUNER_MODE_LANG1 ] = "lang1", [ V4L2_TUNER_MODE_LANG2 ] = "lang2", + [ V4L2_TUNER_MODE_LANG1_LANG2 ] = "lang1+lang2", }; static u32 fm[] = { [ V4L2_TUNER_MODE_MONO ] = 0x00, /* ch1 */ [ V4L2_TUNER_MODE_STEREO ] = 0x80, /* auto */ [ V4L2_TUNER_MODE_LANG1 ] = 0x00, /* ch1 */ [ V4L2_TUNER_MODE_LANG2 ] = 0x01, /* ch2 */ + [ V4L2_TUNER_MODE_LANG1_LANG2 ] = 0x80, /* auto */ }; u32 reg; diff --git a/drivers/media/video/saa7134/saa7134-vbi.c b/drivers/media/video/saa7134/saa7134-vbi.c index f4aee0af80e1..f38366a470fa 100644 --- a/drivers/media/video/saa7134/saa7134-vbi.c +++ b/drivers/media/video/saa7134/saa7134-vbi.c @@ -135,7 +135,7 @@ static int buffer_prepare(struct videobuf_queue *q, return -EINVAL; if (buf->vb.size != size) - saa7134_dma_free(dev,buf); + saa7134_dma_free(q,buf); if (STATE_NEEDS_INIT == buf->vb.state) { buf->vb.width = llength; @@ -143,7 +143,7 @@ static int buffer_prepare(struct videobuf_queue *q, buf->vb.size = size; buf->pt = &fh->pt_vbi; - err = videobuf_iolock(dev->pci,&buf->vb,NULL); + err = videobuf_iolock(q,&buf->vb,NULL); if (err) goto oops; err = saa7134_pgtable_build(dev->pci,buf->pt, @@ -159,7 +159,7 @@ static int buffer_prepare(struct videobuf_queue *q, return 0; oops: - saa7134_dma_free(dev,buf); + saa7134_dma_free(q,buf); return err; } @@ -190,11 +190,9 @@ static void buffer_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) { - struct saa7134_fh *fh = q->priv_data; - struct saa7134_dev *dev = fh->dev; struct saa7134_buf *buf = container_of(vb,struct saa7134_buf,vb); - saa7134_dma_free(dev,buf); + saa7134_dma_free(q,buf); } struct videobuf_queue_ops saa7134_vbi_qops = { diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index 57a11e71d996..aeef80f88a6b 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c @@ -993,7 +993,7 @@ static int buffer_prepare(struct videobuf_queue *q, buf->vb.size != size || buf->vb.field != field || buf->fmt != fh->fmt) { - saa7134_dma_free(dev,buf); + saa7134_dma_free(q,buf); } if (STATE_NEEDS_INIT == buf->vb.state) { @@ -1004,7 +1004,7 @@ static int buffer_prepare(struct videobuf_queue *q, buf->fmt = fh->fmt; buf->pt = &fh->pt_cap; - err = videobuf_iolock(dev->pci,&buf->vb,&dev->ovbuf); + err = videobuf_iolock(q,&buf->vb,&dev->ovbuf); if (err) goto oops; err = saa7134_pgtable_build(dev->pci,buf->pt, @@ -1019,7 +1019,7 @@ static int buffer_prepare(struct videobuf_queue *q, return 0; oops: - saa7134_dma_free(dev,buf); + saa7134_dma_free(q,buf); return err; } @@ -1045,10 +1045,9 @@ static void buffer_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) { - struct saa7134_fh *fh = q->priv_data; struct saa7134_buf *buf = container_of(vb,struct saa7134_buf,vb); - saa7134_dma_free(fh->dev,buf); + saa7134_dma_free(q,buf); } static struct videobuf_queue_ops video_qops = { diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index ce1c2e0b065e..31ba293854c1 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h @@ -34,7 +34,6 @@ #include <asm/io.h> #include <media/tuner.h> -#include <media/audiochip.h> #include <media/ir-common.h> #include <media/ir-kbd-i2c.h> #include <media/video-buf.h> @@ -579,7 +578,7 @@ void saa7134_buffer_finish(struct saa7134_dev *dev, struct saa7134_dmaqueue *q, unsigned int state); void saa7134_buffer_next(struct saa7134_dev *dev, struct saa7134_dmaqueue *q); void saa7134_buffer_timeout(unsigned long data); -void saa7134_dma_free(struct saa7134_dev *dev,struct saa7134_buf *buf); +void saa7134_dma_free(struct videobuf_queue *q,struct saa7134_buf *buf); int saa7134_set_dmabits(struct saa7134_dev *dev); diff --git a/drivers/media/video/saa7146.h b/drivers/media/video/saa7146.h index 756963f01bbd..2830b5e33aec 100644 --- a/drivers/media/video/saa7146.h +++ b/drivers/media/video/saa7146.h @@ -1,7 +1,7 @@ -/* +/* saa7146.h - definitions philips saa7146 based cards Copyright (C) 1999 Nathan Laredo (laredo@gnu.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 of the License, or @@ -27,7 +27,7 @@ #include <linux/videodev.h> -#ifndef O_NONCAP +#ifndef O_NONCAP #define O_NONCAP O_TRUNC #endif @@ -36,7 +36,7 @@ #ifdef __KERNEL__ -struct saa7146_window +struct saa7146_window { int x, y; ushort width, height; @@ -70,7 +70,7 @@ struct saa7146 int irqstate; /* irq routine is state driven */ int writemode; int playmode; - unsigned int nr; + unsigned int nr; unsigned long irq; /* IRQ used by SAA7146 card */ unsigned short id; unsigned char revision; diff --git a/drivers/media/video/saa7146reg.h b/drivers/media/video/saa7146reg.h index 6cc910f50a4b..80ec2c146b4c 100644 --- a/drivers/media/video/saa7146reg.h +++ b/drivers/media/video/saa7146reg.h @@ -1,7 +1,7 @@ -/* +/* saa7146.h - definitions philips saa7146 based cards Copyright (C) 1999 Nathan Laredo (laredo@gnu.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 of the License, or diff --git a/drivers/media/video/saa7185.c b/drivers/media/video/saa7185.c index 9f99ee1303e0..9c308410856d 100644 --- a/drivers/media/video/saa7185.c +++ b/drivers/media/video/saa7185.c @@ -1,4 +1,4 @@ -/* +/* * saa7185 - Philips SAA7185B video encoder driver version 0.0.3 * * Copyright (C) 1998 Dave Perks <dperks@ibm.net> @@ -377,7 +377,7 @@ saa7185_command (struct i2c_client *client, static unsigned short normal_i2c[] = { I2C_SAA7185 >> 1, I2C_CLIENT_END }; static unsigned short ignore = I2C_CLIENT_END; - + static struct i2c_client_address_data addr_data = { .normal_i2c = normal_i2c, .probe = &ignore, diff --git a/drivers/media/video/saa7196.h b/drivers/media/video/saa7196.h index f92f21cfbcac..cd4b6354a7b3 100644 --- a/drivers/media/video/saa7196.h +++ b/drivers/media/video/saa7196.h @@ -2,14 +2,14 @@ Definitions for the Philips SAA7196 digital video decoder, scaler, and clock generator circuit (DESCpro), as used in the PlanB video input of the Powermac 7x00/8x00 series. - + Copyright (C) 1998 Michel Lanners (mlan@cpu.lu) The register defines are shamelessly copied from the meteor driver out of NetBSD (with permission), and are copyrighted (c) 1995 Mark Tinguely and Jim Lowe (Thanks !) - + Additional debugging and coding by Takashi Oe (toe@unlinfo.unl.edu) The default values used for PlanB are my mistakes. diff --git a/drivers/usb/media/se401.c b/drivers/media/video/se401.c index f03ea7f89596..a846ebc78cd7 100644 --- a/drivers/usb/media/se401.c +++ b/drivers/media/video/se401.c @@ -4,7 +4,7 @@ * Copyright (c) 2000 Jeroen B. Vreeken (pe1rxq@amsat.org) * * Still somewhat based on the Linux ov511 driver. - * + * * 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 @@ -114,16 +114,16 @@ static int se401_sndctrl(int set, struct usb_se401 *se401, unsigned short req, unsigned short value, unsigned char *cp, int size) { return usb_control_msg ( - se401->dev, - set ? usb_sndctrlpipe(se401->dev, 0) : usb_rcvctrlpipe(se401->dev, 0), - req, - (set ? USB_DIR_OUT : USB_DIR_IN) | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - value, - 0, - cp, - size, - 1000 - ); + se401->dev, + set ? usb_sndctrlpipe(se401->dev, 0) : usb_rcvctrlpipe(se401->dev, 0), + req, + (set ? USB_DIR_OUT : USB_DIR_IN) | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + value, + 0, + cp, + size, + 1000 + ); } static int se401_set_feature(struct usb_se401 *se401, unsigned short selector, @@ -140,30 +140,30 @@ static int se401_set_feature(struct usb_se401 *se401, unsigned short selector, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, param, selector, - NULL, - 0, - 1000 - ); + NULL, + 0, + 1000 + ); } -static unsigned short se401_get_feature(struct usb_se401 *se401, - unsigned short selector) +static unsigned short se401_get_feature(struct usb_se401 *se401, + unsigned short selector) { /* For 'set' the selecetor should be in index, not sure if the spec is wrong here to.... */ unsigned char cp[2]; - usb_control_msg ( - se401->dev, - usb_rcvctrlpipe(se401->dev, 0), - SE401_REQ_GET_EXT_FEATURE, - USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - 0, - selector, - cp, - 2, - 1000 - ); + usb_control_msg ( + se401->dev, + usb_rcvctrlpipe(se401->dev, 0), + SE401_REQ_GET_EXT_FEATURE, + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + 0, + selector, + cp, + 2, + 1000 + ); return cp[0]+cp[1]*256; } @@ -183,14 +183,14 @@ static int se401_send_pict(struct usb_se401 *se401) se401_set_feature(se401, HV7131_REG_ARCG, se401->rgain);/* red color gain */ se401_set_feature(se401, HV7131_REG_AGCG, se401->ggain);/* green color gain */ se401_set_feature(se401, HV7131_REG_ABCG, se401->bgain);/* blue color gain */ - + return 0; } static void se401_set_exposure(struct usb_se401 *se401, int brightness) { int integration=brightness<<5; - + if (flickerless==50) { integration=integration-integration%106667; } @@ -255,11 +255,11 @@ static void se401_auto_resetlevel(struct usb_se401 *se401) /* For some reason this normally read-only register doesn't get reset to zero after reading them just once... */ - se401_get_feature(se401, HV7131_REG_HIREFNOH); + se401_get_feature(se401, HV7131_REG_HIREFNOH); se401_get_feature(se401, HV7131_REG_HIREFNOL); se401_get_feature(se401, HV7131_REG_LOREFNOH); se401_get_feature(se401, HV7131_REG_LOREFNOL); - ahrc=256*se401_get_feature(se401, HV7131_REG_HIREFNOH) + + ahrc=256*se401_get_feature(se401, HV7131_REG_HIREFNOH) + se401_get_feature(se401, HV7131_REG_HIREFNOL); alrc=256*se401_get_feature(se401, HV7131_REG_LOREFNOH) + se401_get_feature(se401, HV7131_REG_LOREFNOL); @@ -287,12 +287,12 @@ static void se401_button_irq(struct urb *urb, struct pt_regs *regs) { struct usb_se401 *se401 = urb->context; int status; - + if (!se401->dev) { info("ohoh: device vapourished"); return; } - + switch (urb->status) { case 0: /* success */ @@ -368,7 +368,7 @@ static void se401_video_irq(struct urb *urb, struct pt_regs *regs) if (se401->nullpackets > SE401_MAX_NULLPACKETS) { if (waitqueue_active(&se401->wq)) { wake_up_interruptible(&se401->wq); - } + } } } @@ -433,8 +433,8 @@ static int se401_start_stream(struct usb_se401 *se401) int err=0, i; se401->streaming=1; - se401_sndctrl(1, se401, SE401_REQ_CAMERA_POWER, 1, NULL, 0); - se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 1, NULL, 0); + se401_sndctrl(1, se401, SE401_REQ_CAMERA_POWER, 1, NULL, 0); + se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 1, NULL, 0); /* Set picture settings */ se401_set_feature(se401, HV7131_REG_MODE_B, 0x05);/*windowed + pix intg */ @@ -571,7 +571,7 @@ static inline void decode_JangGu_integrate(struct usb_se401 *se401, int data) } /* First three are absolute, all others relative. - * Format is rgb from right to left (mirrorred image), + * Format is rgb from right to left (mirrorred image), * we flip it to get bgr from left to right. */ if (frame->curlinepix < 3) { *(frame->curline-frame->curlinepix)=1+data*4; @@ -703,7 +703,7 @@ static inline void decode_bayer (struct usb_se401 *se401, struct se401_scratch * int width=se401->cwidth; int blineoffset=0, bline; int linelength=width*3, i; - + if (frame->curpix==0) { if (frame->grabstate==FRAME_READY) { @@ -831,7 +831,7 @@ static int se401_newframe(struct usb_se401 *se401, int framenr) se401->nullpackets=0; info("to many null length packets, restarting capture"); se401_stop_stream(se401); - se401_start_stream(se401); + se401_start_stream(se401); } else { if (se401->scratch[se401->scratch_use].state!=BUFFER_READY) { se401->frame[framenr].grabstate=FRAME_ERROR; @@ -866,7 +866,7 @@ static void usb_se401_remove_disconnected (struct usb_se401 *se401) { int i; - se401->dev = NULL; + se401->dev = NULL; for (i=0; i<SE401_NUMSBUF; i++) if (se401->urb[i]) { @@ -882,9 +882,9 @@ static void usb_se401_remove_disconnected (struct usb_se401 *se401) usb_kill_urb(se401->inturb); usb_free_urb(se401->inturb); } - info("%s disconnected", se401->camera_name); + info("%s disconnected", se401->camera_name); - /* Free the memory */ + /* Free the memory */ kfree(se401->width); kfree(se401->height); kfree(se401); @@ -910,7 +910,7 @@ static int se401_open(struct inode *inode, struct file *file) se401->fbuf = rvmalloc(se401->maxframesize * SE401_NUMFRAMES); if (se401->fbuf) file->private_data = dev; - else + else err = -ENOMEM; se401->user = !err; @@ -920,11 +920,11 @@ static int se401_open(struct inode *inode, struct file *file) static int se401_close(struct inode *inode, struct file *file) { struct video_device *dev = file->private_data; - struct usb_se401 *se401 = (struct usb_se401 *)dev; + struct usb_se401 *se401 = (struct usb_se401 *)dev; int i; rvfree(se401->fbuf, se401->maxframesize * SE401_NUMFRAMES); - if (se401->removed) { + if (se401->removed) { usb_se401_remove_disconnected(se401); info("device unregistered"); } else { @@ -942,12 +942,12 @@ static int se401_do_ioctl(struct inode *inode, struct file *file, unsigned int cmd, void *arg) { struct video_device *vdev = file->private_data; - struct usb_se401 *se401 = (struct usb_se401 *)vdev; + struct usb_se401 *se401 = (struct usb_se401 *)vdev; - if (!se401->dev) - return -EIO; + if (!se401->dev) + return -EIO; - switch (cmd) { + switch (cmd) { case VIDIOCGCAP: { struct video_capability *b = arg; @@ -981,8 +981,8 @@ static int se401_do_ioctl(struct inode *inode, struct file *file, return -EINVAL; return 0; } - case VIDIOCGPICT: - { + case VIDIOCGPICT: + { struct video_picture *p = arg; se401_get_pict(se401, p); @@ -1007,7 +1007,7 @@ static int se401_do_ioctl(struct inode *inode, struct file *file, if (se401_set_size(se401, vw->width, vw->height)) return -EINVAL; return 0; - } + } case VIDIOCGWIN: { struct video_window *vw = arg; @@ -1095,11 +1095,11 @@ static int se401_do_ioctl(struct inode *inode, struct file *file, case VIDIOCGAUDIO: case VIDIOCSAUDIO: return -EINVAL; - default: - return -ENOIOCTLCMD; - } /* end switch */ + default: + return -ENOIOCTLCMD; + } /* end switch */ - return 0; + return 0; } static int se401_ioctl(struct inode *inode, struct file *file, @@ -1142,7 +1142,7 @@ static ssize_t se401_read(struct file *file, char __user *buf, se401->frame[0].grabstate=FRAME_UNUSED; if (ret) - return ret; + return ret; if (copy_to_user(buf, se401->frame[0].data, realcount)) return -EFAULT; @@ -1183,24 +1183,24 @@ static int se401_mmap(struct file *file, struct vm_area_struct *vma) } mutex_unlock(&se401->lock); - return 0; + return 0; } static struct file_operations se401_fops = { .owner = THIS_MODULE, - .open = se401_open, - .release = se401_close, - .read = se401_read, - .mmap = se401_mmap, + .open = se401_open, + .release = se401_close, + .read = se401_read, + .mmap = se401_mmap, .ioctl = se401_ioctl, .compat_ioctl = v4l_compat_ioctl32, .llseek = no_llseek, }; static struct video_device se401_template = { .owner = THIS_MODULE, - .name = "se401 USB camera", - .type = VID_TYPE_CAPTURE, - .hardware = VID_HARDWARE_SE401, + .name = "se401 USB camera", + .type = VID_TYPE_CAPTURE, + .hardware = VID_HARDWARE_SE401, .fops = &se401_fops, }; @@ -1209,12 +1209,12 @@ static struct video_device se401_template = { /***************************/ static int se401_init(struct usb_se401 *se401, int button) { - int i=0, rc; - unsigned char cp[0x40]; + int i=0, rc; + unsigned char cp[0x40]; char temp[200]; /* led on */ - se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 1, NULL, 0); + se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 1, NULL, 0); /* get camera descriptor */ rc=se401_sndctrl(0, se401, SE401_REQ_GET_CAMERA_DESCRIPTOR, 0, cp, sizeof(cp)); @@ -1254,7 +1254,7 @@ static int se401_init(struct usb_se401 *se401, int button) return 1; } /* set output mode (BAYER) */ - se401_sndctrl(1, se401, SE401_REQ_SET_OUTPUT_MODE, SE401_FORMAT_BAYER, NULL, 0); + se401_sndctrl(1, se401, SE401_REQ_SET_OUTPUT_MODE, SE401_FORMAT_BAYER, NULL, 0); rc=se401_sndctrl(0, se401, SE401_REQ_GET_BRT, 0, cp, sizeof(cp)); se401->brightness=cp[0]+cp[1]*256; @@ -1292,71 +1292,71 @@ static int se401_init(struct usb_se401 *se401, int button) } else se401->inturb=NULL; - /* Flash the led */ - se401_sndctrl(1, se401, SE401_REQ_CAMERA_POWER, 1, NULL, 0); - se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 1, NULL, 0); - se401_sndctrl(1, se401, SE401_REQ_CAMERA_POWER, 0, NULL, 0); + /* Flash the led */ + se401_sndctrl(1, se401, SE401_REQ_CAMERA_POWER, 1, NULL, 0); + se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 1, NULL, 0); + se401_sndctrl(1, se401, SE401_REQ_CAMERA_POWER, 0, NULL, 0); se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 0, NULL, 0); - return 0; + return 0; } static int se401_probe(struct usb_interface *intf, const struct usb_device_id *id) { struct usb_device *dev = interface_to_usbdev(intf); - struct usb_interface_descriptor *interface; - struct usb_se401 *se401; - char *camera_name=NULL; + struct usb_interface_descriptor *interface; + struct usb_se401 *se401; + char *camera_name=NULL; int button=1; - /* We don't handle multi-config cameras */ - if (dev->descriptor.bNumConfigurations != 1) - return -ENODEV; + /* We don't handle multi-config cameras */ + if (dev->descriptor.bNumConfigurations != 1) + return -ENODEV; - interface = &intf->cur_altsetting->desc; + interface = &intf->cur_altsetting->desc; - /* Is it an se401? */ - if (le16_to_cpu(dev->descriptor.idVendor) == 0x03e8 && - le16_to_cpu(dev->descriptor.idProduct) == 0x0004) { - camera_name="Endpoints/Aox SE401"; - } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x0471 && - le16_to_cpu(dev->descriptor.idProduct) == 0x030b) { - camera_name="Philips PCVC665K"; - } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x047d && + /* Is it an se401? */ + if (le16_to_cpu(dev->descriptor.idVendor) == 0x03e8 && + le16_to_cpu(dev->descriptor.idProduct) == 0x0004) { + camera_name="Endpoints/Aox SE401"; + } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x0471 && + le16_to_cpu(dev->descriptor.idProduct) == 0x030b) { + camera_name="Philips PCVC665K"; + } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x047d && le16_to_cpu(dev->descriptor.idProduct) == 0x5001) { camera_name="Kensington VideoCAM 67014"; - } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x047d && + } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x047d && le16_to_cpu(dev->descriptor.idProduct) == 0x5002) { camera_name="Kensington VideoCAM 6701(5/7)"; - } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x047d && + } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x047d && le16_to_cpu(dev->descriptor.idProduct) == 0x5003) { camera_name="Kensington VideoCAM 67016"; button=0; } else return -ENODEV; - /* Checking vendor/product should be enough, but what the hell */ - if (interface->bInterfaceClass != 0x00) + /* Checking vendor/product should be enough, but what the hell */ + if (interface->bInterfaceClass != 0x00) return -ENODEV; - if (interface->bInterfaceSubClass != 0x00) + if (interface->bInterfaceSubClass != 0x00) return -ENODEV; - /* We found one */ - info("SE401 camera found: %s", camera_name); + /* We found one */ + info("SE401 camera found: %s", camera_name); - if ((se401 = kzalloc(sizeof(*se401), GFP_KERNEL)) == NULL) { - err("couldn't kmalloc se401 struct"); + if ((se401 = kzalloc(sizeof(*se401), GFP_KERNEL)) == NULL) { + err("couldn't kmalloc se401 struct"); return -ENOMEM; - } + } - se401->dev = dev; - se401->iface = interface->bInterfaceNumber; - se401->camera_name = camera_name; + se401->dev = dev; + se401->iface = interface->bInterfaceNumber; + se401->camera_name = camera_name; info("firmware version: %02x", le16_to_cpu(dev->descriptor.bcdDevice) & 255); - if (se401_init(se401, button)) { + if (se401_init(se401, button)) { kfree(se401); return -EIO; } @@ -1375,7 +1375,7 @@ static int se401_probe(struct usb_interface *intf, info("registered new video device: video%d", se401->vdev.minor); usb_set_intfdata (intf, se401); - return 0; + return 0; } static void se401_disconnect(struct usb_interface *intf) @@ -1400,10 +1400,10 @@ static void se401_disconnect(struct usb_interface *intf) } static struct usb_driver se401_driver = { - .name = "se401", - .id_table = device_table, + .name = "se401", + .id_table = device_table, .probe = se401_probe, - .disconnect = se401_disconnect, + .disconnect = se401_disconnect, }; diff --git a/drivers/usb/media/se401.h b/drivers/media/video/se401.h index e88a40d4c86a..a7a216bd4413 100644 --- a/drivers/usb/media/se401.h +++ b/drivers/media/video/se401.h @@ -177,7 +177,7 @@ struct usb_se401 { int expose_m; int expose_l; int resetlevel; - + int enhance; int format; @@ -200,12 +200,12 @@ struct usb_se401 { struct urb *urb[SE401_NUMSBUF]; struct urb *inturb; - + int button; int buttonpressed; int curframe; /* Current receiving frame */ - struct se401_frame frame[SE401_NUMFRAMES]; + struct se401_frame frame[SE401_NUMFRAMES]; int readcount; int framecount; int error; diff --git a/drivers/media/video/sn9c102/Makefile b/drivers/media/video/sn9c102/Makefile new file mode 100644 index 000000000000..536ad3098da4 --- /dev/null +++ b/drivers/media/video/sn9c102/Makefile @@ -0,0 +1,7 @@ +sn9c102-objs := sn9c102_core.o sn9c102_hv7131d.o sn9c102_mi0343.o \ + sn9c102_ov7630.o sn9c102_pas106b.o sn9c102_pas202bca.o \ + sn9c102_pas202bcb.o sn9c102_tas5110c1b.o \ + sn9c102_tas5130d1b.o + +obj-$(CONFIG_USB_SN9C102) += sn9c102.o + diff --git a/drivers/usb/media/sn9c102.h b/drivers/media/video/sn9c102/sn9c102.h index 1d70a62b9f23..2c6ff396dafc 100644 --- a/drivers/usb/media/sn9c102.h +++ b/drivers/media/video/sn9c102/sn9c102.h @@ -164,7 +164,7 @@ sn9c102_match_id(struct sn9c102_device* cam, const struct usb_device_id *id) void sn9c102_attach_sensor(struct sn9c102_device* cam, - struct sn9c102_sensor* sensor) + struct sn9c102_sensor* sensor) { memcpy(&cam->sensor, sensor, sizeof(struct sn9c102_sensor)); } @@ -183,7 +183,7 @@ do { \ dev_info(&cam->usbdev->dev, fmt "\n", ## args); \ else if ((level) >= 3) \ dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ - __FUNCTION__, __LINE__ , ## args); \ + __FUNCTION__, __LINE__ , ## args); \ } \ } while (0) # define V4LDBG(level, name, cmd) \ @@ -198,7 +198,7 @@ do { \ pr_info("sn9c102: " fmt "\n", ## args); \ else if ((level) == 3) \ pr_debug("sn9c102: [%s:%d] " fmt "\n", __FUNCTION__, \ - __LINE__ , ## args); \ + __LINE__ , ## args); \ } \ } while (0) #else @@ -210,7 +210,7 @@ do { \ #undef PDBG #define PDBG(fmt, args...) \ dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ - __FUNCTION__, __LINE__ , ## args) + __FUNCTION__, __LINE__ , ## args) #undef PDBGG #define PDBGG(fmt, args...) do {;} while(0) /* placeholder */ diff --git a/drivers/usb/media/sn9c102_core.c b/drivers/media/video/sn9c102/sn9c102_core.c index 4c6cc6395723..ea4394dc9415 100644 --- a/drivers/usb/media/sn9c102_core.c +++ b/drivers/media/video/sn9c102/sn9c102_core.c @@ -62,53 +62,53 @@ MODULE_LICENSE(SN9C102_MODULE_LICENSE); static short video_nr[] = {[0 ... SN9C102_MAX_DEVICES-1] = -1}; module_param_array(video_nr, short, NULL, 0444); MODULE_PARM_DESC(video_nr, - "\n<-1|n[,...]> Specify V4L2 minor mode number." - "\n -1 = use next available (default)" - "\n n = use minor number n (integer >= 0)" - "\nYou can specify up to "__MODULE_STRING(SN9C102_MAX_DEVICES) - " cameras this way." - "\nFor example:" - "\nvideo_nr=-1,2,-1 would assign minor number 2 to" - "\nthe second camera and use auto for the first" - "\none and for every other camera." - "\n"); - -static short force_munmap[] = {[0 ... SN9C102_MAX_DEVICES-1] = - SN9C102_FORCE_MUNMAP}; + "\n<-1|n[,...]> Specify V4L2 minor mode number." + "\n -1 = use next available (default)" + "\n n = use minor number n (integer >= 0)" + "\nYou can specify up to "__MODULE_STRING(SN9C102_MAX_DEVICES) + " cameras this way." + "\nFor example:" + "\nvideo_nr=-1,2,-1 would assign minor number 2 to" + "\nthe second camera and use auto for the first" + "\none and for every other camera." + "\n"); + +static short force_munmap[] = {[0 ... SN9C102_MAX_DEVICES-1] = + SN9C102_FORCE_MUNMAP}; module_param_array(force_munmap, bool, NULL, 0444); MODULE_PARM_DESC(force_munmap, - "\n<0|1[,...]> Force the application to unmap previously" - "\nmapped buffer memory before calling any VIDIOC_S_CROP or" - "\nVIDIOC_S_FMT ioctl's. Not all the applications support" - "\nthis feature. This parameter is specific for each" - "\ndetected camera." - "\n 0 = do not force memory unmapping" - "\n 1 = force memory unmapping (save memory)" - "\nDefault value is "__MODULE_STRING(SN9C102_FORCE_MUNMAP)"." - "\n"); + "\n<0|1[,...]> Force the application to unmap previously" + "\nmapped buffer memory before calling any VIDIOC_S_CROP or" + "\nVIDIOC_S_FMT ioctl's. Not all the applications support" + "\nthis feature. This parameter is specific for each" + "\ndetected camera." + "\n 0 = do not force memory unmapping" + "\n 1 = force memory unmapping (save memory)" + "\nDefault value is "__MODULE_STRING(SN9C102_FORCE_MUNMAP)"." + "\n"); static unsigned int frame_timeout[] = {[0 ... SN9C102_MAX_DEVICES-1] = - SN9C102_FRAME_TIMEOUT}; + SN9C102_FRAME_TIMEOUT}; module_param_array(frame_timeout, uint, NULL, 0644); MODULE_PARM_DESC(frame_timeout, - "\n<n[,...]> Timeout for a video frame in seconds." - "\nThis parameter is specific for each detected camera." - "\nDefault value is "__MODULE_STRING(SN9C102_FRAME_TIMEOUT)"." - "\n"); + "\n<n[,...]> Timeout for a video frame in seconds." + "\nThis parameter is specific for each detected camera." + "\nDefault value is "__MODULE_STRING(SN9C102_FRAME_TIMEOUT)"." + "\n"); #ifdef SN9C102_DEBUG static unsigned short debug = SN9C102_DEBUG_LEVEL; module_param(debug, ushort, 0644); MODULE_PARM_DESC(debug, - "\n<n> Debugging information level, from 0 to 3:" - "\n0 = none (use carefully)" - "\n1 = critical errors" - "\n2 = significant informations" - "\n3 = more verbose messages" - "\nLevel 3 is useful for testing only, when only " - "one device is used." - "\nDefault value is "__MODULE_STRING(SN9C102_DEBUG_LEVEL)"." - "\n"); + "\n<n> Debugging information level, from 0 to 3:" + "\n0 = none (use carefully)" + "\n1 = critical errors" + "\n2 = significant informations" + "\n3 = more verbose messages" + "\nLevel 3 is useful for testing only, when only " + "one device is used." + "\nDefault value is "__MODULE_STRING(SN9C102_DEBUG_LEVEL)"." + "\n"); #endif /*****************************************************************************/ @@ -131,16 +131,16 @@ static sn9c102_eof_header_t sn9c102_eof_header[] = { /*****************************************************************************/ -static u32 -sn9c102_request_buffers(struct sn9c102_device* cam, u32 count, - enum sn9c102_io_method io) +static u32 +sn9c102_request_buffers(struct sn9c102_device* cam, u32 count, + enum sn9c102_io_method io) { struct v4l2_pix_format* p = &(cam->sensor.pix_format); struct v4l2_rect* r = &(cam->sensor.cropcap.bounds); const size_t imagesize = cam->module_param.force_munmap || - io == IO_READ ? - (p->width * p->height * p->priv) / 8 : - (r->width * r->height * p->priv) / 8; + io == IO_READ ? + (p->width * p->height * p->priv) / 8 : + (r->width * r->height * p->priv) / 8; void* buff = NULL; u32 i; @@ -232,8 +232,8 @@ int sn9c102_write_regs(struct sn9c102_device* cam, u8* buff, u16 index) return -1; res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x08, 0x41, - index, 0, buff, sizeof(buff), - SN9C102_CTRL_TIMEOUT*sizeof(buff)); + index, 0, buff, sizeof(buff), + SN9C102_CTRL_TIMEOUT*sizeof(buff)); if (res < 0) { DBG(3, "Failed to write registers (index 0x%02X, error %d)", index, res); @@ -259,7 +259,7 @@ int sn9c102_write_reg(struct sn9c102_device* cam, u8 value, u16 index) *buff = value; res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x08, 0x41, - index, 0, buff, 1, SN9C102_CTRL_TIMEOUT); + index, 0, buff, 1, SN9C102_CTRL_TIMEOUT); if (res < 0) { DBG(3, "Failed to write a register (value 0x%02X, index " "0x%02X, error %d)", value, index, res); @@ -280,7 +280,7 @@ static int sn9c102_read_reg(struct sn9c102_device* cam, u16 index) int res; res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, 0xc1, - index, 0, buff, 1, SN9C102_CTRL_TIMEOUT); + index, 0, buff, 1, SN9C102_CTRL_TIMEOUT); if (res < 0) DBG(3, "Failed to read a register (index 0x%02X, error %d)", index, res); @@ -319,8 +319,8 @@ sn9c102_i2c_wait(struct sn9c102_device* cam, struct sn9c102_sensor* sensor) static int -sn9c102_i2c_detect_read_error(struct sn9c102_device* cam, - struct sn9c102_sensor* sensor) +sn9c102_i2c_detect_read_error(struct sn9c102_device* cam, + struct sn9c102_sensor* sensor) { int r; r = sn9c102_read_reg(cam, 0x08); @@ -329,8 +329,8 @@ sn9c102_i2c_detect_read_error(struct sn9c102_device* cam, static int -sn9c102_i2c_detect_write_error(struct sn9c102_device* cam, - struct sn9c102_sensor* sensor) +sn9c102_i2c_detect_write_error(struct sn9c102_device* cam, + struct sn9c102_sensor* sensor) { int r; r = sn9c102_read_reg(cam, 0x08); @@ -338,10 +338,10 @@ sn9c102_i2c_detect_write_error(struct sn9c102_device* cam, } -int +int sn9c102_i2c_try_raw_read(struct sn9c102_device* cam, - struct sn9c102_sensor* sensor, u8 data0, u8 data1, - u8 n, u8 buffer[]) + struct sn9c102_sensor* sensor, u8 data0, u8 data1, + u8 n, u8 buffer[]) { struct usb_device* udev = cam->usbdev; u8* data = cam->control_buffer; @@ -349,12 +349,12 @@ sn9c102_i2c_try_raw_read(struct sn9c102_device* cam, /* Write cycle */ data[0] = ((sensor->interface == SN9C102_I2C_2WIRES) ? 0x80 : 0) | - ((sensor->frequency & SN9C102_I2C_400KHZ) ? 0x01 : 0) | 0x10; + ((sensor->frequency & SN9C102_I2C_400KHZ) ? 0x01 : 0) | 0x10; data[1] = data0; /* I2C slave id */ data[2] = data1; /* address */ data[7] = 0x10; res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x08, 0x41, - 0x08, 0, data, 8, SN9C102_CTRL_TIMEOUT); + 0x08, 0, data, 8, SN9C102_CTRL_TIMEOUT); if (res < 0) err += res; @@ -362,12 +362,12 @@ sn9c102_i2c_try_raw_read(struct sn9c102_device* cam, /* Read cycle - n bytes */ data[0] = ((sensor->interface == SN9C102_I2C_2WIRES) ? 0x80 : 0) | - ((sensor->frequency & SN9C102_I2C_400KHZ) ? 0x01 : 0) | - (n << 4) | 0x02; + ((sensor->frequency & SN9C102_I2C_400KHZ) ? 0x01 : 0) | + (n << 4) | 0x02; data[1] = data0; data[7] = 0x10; res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x08, 0x41, - 0x08, 0, data, 8, SN9C102_CTRL_TIMEOUT); + 0x08, 0, data, 8, SN9C102_CTRL_TIMEOUT); if (res < 0) err += res; @@ -375,7 +375,7 @@ sn9c102_i2c_try_raw_read(struct sn9c102_device* cam, /* The first read byte will be placed in data[4] */ res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, 0xc1, - 0x0a, 0, data, 5, SN9C102_CTRL_TIMEOUT); + 0x0a, 0, data, 5, SN9C102_CTRL_TIMEOUT); if (res < 0) err += res; @@ -396,10 +396,10 @@ sn9c102_i2c_try_raw_read(struct sn9c102_device* cam, } -int +int sn9c102_i2c_try_raw_write(struct sn9c102_device* cam, - struct sn9c102_sensor* sensor, u8 n, u8 data0, - u8 data1, u8 data2, u8 data3, u8 data4, u8 data5) + struct sn9c102_sensor* sensor, u8 n, u8 data0, + u8 data1, u8 data2, u8 data3, u8 data4, u8 data5) { struct usb_device* udev = cam->usbdev; u8* data = cam->control_buffer; @@ -407,8 +407,8 @@ sn9c102_i2c_try_raw_write(struct sn9c102_device* cam, /* Write cycle. It usually is address + value */ data[0] = ((sensor->interface == SN9C102_I2C_2WIRES) ? 0x80 : 0) | - ((sensor->frequency & SN9C102_I2C_400KHZ) ? 0x01 : 0) - | ((n - 1) << 4); + ((sensor->frequency & SN9C102_I2C_400KHZ) ? 0x01 : 0) + | ((n - 1) << 4); data[1] = data0; data[2] = data1; data[3] = data2; @@ -417,7 +417,7 @@ sn9c102_i2c_try_raw_write(struct sn9c102_device* cam, data[6] = data5; data[7] = 0x14; res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x08, 0x41, - 0x08, 0, data, 8, SN9C102_CTRL_TIMEOUT); + 0x08, 0, data, 8, SN9C102_CTRL_TIMEOUT); if (res < 0) err += res; @@ -437,20 +437,20 @@ sn9c102_i2c_try_raw_write(struct sn9c102_device* cam, int sn9c102_i2c_try_read(struct sn9c102_device* cam, - struct sn9c102_sensor* sensor, u8 address) + struct sn9c102_sensor* sensor, u8 address) { return sn9c102_i2c_try_raw_read(cam, sensor, sensor->i2c_slave_id, - address, 1, NULL); + address, 1, NULL); } int sn9c102_i2c_try_write(struct sn9c102_device* cam, - struct sn9c102_sensor* sensor, u8 address, u8 value) + struct sn9c102_sensor* sensor, u8 address, u8 value) { - return sn9c102_i2c_try_raw_write(cam, sensor, 3, - sensor->i2c_slave_id, address, - value, 0, 0, 0); + return sn9c102_i2c_try_raw_write(cam, sensor, 3, + sensor->i2c_slave_id, address, + value, 0, 0, 0); } @@ -484,7 +484,7 @@ sn9c102_find_sof_header(struct sn9c102_device* cam, void* mem, size_t len) n = sizeof(sn9c103_sof_header) / soflen; } - for (i = 0; (len >= soflen) && (i <= len - soflen); i++) + for (i = 0; (len >= soflen) && (i <= len - soflen); i++) for (j = 0; j < n; j++) /* The invariable part of the header is 6 bytes long */ if ((cam->bridge != BRIDGE_SN9C103 && @@ -552,15 +552,15 @@ static void sn9c102_urb_complete(struct urb *urb, struct pt_regs* regs) if (!(*f)) (*f) = list_entry(cam->inqueue.next, struct sn9c102_frame_t, - frame); + frame); imagesize = (cam->sensor.pix_format.width * - cam->sensor.pix_format.height * - cam->sensor.pix_format.priv) / 8; + cam->sensor.pix_format.height * + cam->sensor.pix_format.priv) / 8; soflen = (cam->bridge) == BRIDGE_SN9C103 ? - sizeof(sn9c103_sof_header_t) : - sizeof(sn9c102_sof_header_t); + sizeof(sn9c103_sof_header_t) : + sizeof(sn9c102_sof_header_t); for (i = 0; i < urb->number_of_packets; i++) { unsigned int img, len, status; @@ -611,19 +611,19 @@ end_of_frame: if ((*f)->buf.bytesused == imagesize || (cam->sensor.pix_format.pixelformat == - V4L2_PIX_FMT_SN9C10X && eof)) { + V4L2_PIX_FMT_SN9C10X && eof)) { u32 b; b = (*f)->buf.bytesused; (*f)->state = F_DONE; (*f)->buf.sequence= ++cam->frame_count; spin_lock(&cam->queue_lock); list_move_tail(&(*f)->frame, - &cam->outqueue); + &cam->outqueue); if (!list_empty(&cam->inqueue)) (*f) = list_entry( - cam->inqueue.next, - struct sn9c102_frame_t, - frame ); + cam->inqueue.next, + struct sn9c102_frame_t, + frame ); else (*f) = NULL; spin_unlock(&cam->queue_lock); @@ -638,7 +638,7 @@ end_of_frame: } else if (eof) { (*f)->state = F_ERROR; DBG(3, "Not expected EOF after %lu " - "bytes of image data", + "bytes of image data", (unsigned long) ((*f)->buf.bytesused)); } @@ -676,7 +676,7 @@ start_of_frame: goto end_of_frame; } else { DBG(3, "SOF before expected EOF after " - "%lu bytes of image data", + "%lu bytes of image data", (unsigned long) ((*f)->buf.bytesused)); goto start_of_frame; @@ -702,18 +702,18 @@ static int sn9c102_start_transfer(struct sn9c102_device* cam) struct usb_device *udev = cam->usbdev; struct urb* urb; const unsigned int sn9c102_wMaxPacketSize[] = {0, 128, 256, 384, 512, - 680, 800, 900, 1023}; + 680, 800, 900, 1023}; const unsigned int sn9c103_wMaxPacketSize[] = {0, 128, 256, 384, 512, - 680, 800, 900, 1003}; + 680, 800, 900, 1003}; const unsigned int psz = (cam->bridge == BRIDGE_SN9C103) ? - sn9c103_wMaxPacketSize[SN9C102_ALTERNATE_SETTING] : - sn9c102_wMaxPacketSize[SN9C102_ALTERNATE_SETTING]; + sn9c103_wMaxPacketSize[SN9C102_ALTERNATE_SETTING] : + sn9c102_wMaxPacketSize[SN9C102_ALTERNATE_SETTING]; s8 i, j; int err = 0; for (i = 0; i < SN9C102_URBS; i++) { cam->transfer_buffer[i] = kzalloc(SN9C102_ISO_PACKETS * psz, - GFP_KERNEL); + GFP_KERNEL); if (!cam->transfer_buffer[i]) { err = -ENOMEM; DBG(1, "Not enough memory"); @@ -815,9 +815,9 @@ static int sn9c102_stream_interrupt(struct sn9c102_device* cam) cam->stream = STREAM_INTERRUPT; timeout = wait_event_timeout(cam->wait_stream, - (cam->stream == STREAM_OFF) || - (cam->state & DEV_DISCONNECTED), - SN9C102_URB_TIMEOUT); + (cam->stream == STREAM_OFF) || + (cam->state & DEV_DISCONNECTED), + SN9C102_URB_TIMEOUT); if (cam->state & DEV_DISCONNECTED) return -ENODEV; else if (cam->stream != STREAM_OFF) { @@ -861,7 +861,7 @@ static u8 sn9c102_strtou8(const char* buff, size_t len, ssize_t* count) /* NOTE 1: being inside one of the following methods implies that the v4l - device exists for sure (see kobjects and reference counters) + device exists for sure (see kobjects and reference counters) NOTE 2: buffers are PAGE_SIZE long */ @@ -884,10 +884,10 @@ static ssize_t sn9c102_show_reg(struct class_device* cd, char* buf) mutex_unlock(&sn9c102_sysfs_lock); return count; -} +} -static ssize_t +static ssize_t sn9c102_store_reg(struct class_device* cd, const char* buf, size_t len) { struct sn9c102_device* cam; @@ -947,7 +947,7 @@ static ssize_t sn9c102_show_val(struct class_device* cd, char* buf) mutex_unlock(&sn9c102_sysfs_lock); return count; -} +} static ssize_t @@ -1013,7 +1013,7 @@ static ssize_t sn9c102_show_i2c_reg(struct class_device* cd, char* buf) } -static ssize_t +static ssize_t sn9c102_store_i2c_reg(struct class_device* cd, const char* buf, size_t len) { struct sn9c102_device* cam; @@ -1078,7 +1078,7 @@ static ssize_t sn9c102_show_i2c_val(struct class_device* cd, char* buf) mutex_unlock(&sn9c102_sysfs_lock); return count; -} +} static ssize_t @@ -1222,22 +1222,22 @@ static ssize_t sn9c102_show_frame_header(struct class_device* cd, char* buf) DBG(3, "Frame header, read bytes: %zd", count); return count; -} +} static CLASS_DEVICE_ATTR(reg, S_IRUGO | S_IWUSR, - sn9c102_show_reg, sn9c102_store_reg); + sn9c102_show_reg, sn9c102_store_reg); static CLASS_DEVICE_ATTR(val, S_IRUGO | S_IWUSR, - sn9c102_show_val, sn9c102_store_val); + sn9c102_show_val, sn9c102_store_val); static CLASS_DEVICE_ATTR(i2c_reg, S_IRUGO | S_IWUSR, - sn9c102_show_i2c_reg, sn9c102_store_i2c_reg); + sn9c102_show_i2c_reg, sn9c102_store_i2c_reg); static CLASS_DEVICE_ATTR(i2c_val, S_IRUGO | S_IWUSR, - sn9c102_show_i2c_val, sn9c102_store_i2c_val); + sn9c102_show_i2c_val, sn9c102_store_i2c_val); static CLASS_DEVICE_ATTR(green, S_IWUGO, NULL, sn9c102_store_green); static CLASS_DEVICE_ATTR(blue, S_IWUGO, NULL, sn9c102_store_blue); static CLASS_DEVICE_ATTR(red, S_IWUGO, NULL, sn9c102_store_red); static CLASS_DEVICE_ATTR(frame_header, S_IRUGO, - sn9c102_show_frame_header, NULL); + sn9c102_show_frame_header, NULL); static void sn9c102_create_sysfs(struct sn9c102_device* cam) @@ -1278,7 +1278,7 @@ sn9c102_set_pix_format(struct sn9c102_device* cam, struct v4l2_pix_format* pix) static int sn9c102_set_compression(struct sn9c102_device* cam, - struct v4l2_jpegcompression* compression) + struct v4l2_jpegcompression* compression) { int err = 0; @@ -1469,8 +1469,8 @@ static int sn9c102_open(struct inode* inode, struct file* filp) } mutex_unlock(&cam->dev_mutex); err = wait_event_interruptible_exclusive(cam->open, - cam->state & DEV_DISCONNECTED - || !cam->users); + cam->state & DEV_DISCONNECTED + || !cam->users); if (err) { up_read(&sn9c102_disconnect); return err; @@ -1600,12 +1600,12 @@ sn9c102_read(struct file* filp, char __user * buf, size_t count, loff_t* f_pos) return -EAGAIN; } timeout = wait_event_interruptible_timeout - ( cam->wait_frame, - (!list_empty(&cam->outqueue)) || - (cam->state & DEV_DISCONNECTED) || - (cam->state & DEV_MISCONFIGURED), - cam->module_param.frame_timeout * - 1000 * msecs_to_jiffies(1) ); + ( cam->wait_frame, + (!list_empty(&cam->outqueue)) || + (cam->state & DEV_DISCONNECTED) || + (cam->state & DEV_MISCONFIGURED), + cam->module_param.frame_timeout * + 1000 * msecs_to_jiffies(1) ); if (timeout < 0) { mutex_unlock(&cam->fileop_mutex); return timeout; @@ -1672,7 +1672,7 @@ static unsigned int sn9c102_poll(struct file *filp, poll_table *wait) if (cam->io == IO_NONE) { if (!sn9c102_request_buffers(cam, cam->nreadbuffers, - IO_READ)) { + IO_READ)) { DBG(1, "poll() failed, not enough memory"); goto error; } @@ -1729,7 +1729,7 @@ static int sn9c102_mmap(struct file* filp, struct vm_area_struct *vma) { struct sn9c102_device* cam = video_get_drvdata(video_devdata(filp)); unsigned long size = vma->vm_end - vma->vm_start, - start = vma->vm_start; + start = vma->vm_start; void *pos; u32 i; @@ -1797,13 +1797,13 @@ sn9c102_vidioc_querycap(struct sn9c102_device* cam, void __user * arg) .driver = "sn9c102", .version = SN9C102_MODULE_VERSION_CODE, .capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | - V4L2_CAP_STREAMING, + V4L2_CAP_STREAMING, }; strlcpy(cap.card, cam->v4ldev->name, sizeof(cap.card)); if (usb_make_path(cam->usbdev, cap.bus_info, sizeof(cap.bus_info)) < 0) strlcpy(cap.bus_info, cam->usbdev->dev.bus_id, - sizeof(cap.bus_info)); + sizeof(cap.bus_info)); if (copy_to_user(arg, &cap, sizeof(cap))) return -EFAULT; @@ -2138,7 +2138,7 @@ sn9c102_vidioc_g_fmt(struct sn9c102_device* cam, void __user * arg) return -EINVAL; pfmt->bytesperline = (pfmt->pixelformat==V4L2_PIX_FMT_SN9C10X) - ? 0 : (pfmt->width * pfmt->priv) / 8; + ? 0 : (pfmt->width * pfmt->priv) / 8; pfmt->sizeimage = pfmt->height * ((pfmt->width*pfmt->priv)/8); pfmt->field = V4L2_FIELD_NONE; memcpy(&(format.fmt.pix), pfmt, sizeof(*pfmt)); @@ -2152,7 +2152,7 @@ sn9c102_vidioc_g_fmt(struct sn9c102_device* cam, void __user * arg) static int sn9c102_vidioc_try_s_fmt(struct sn9c102_device* cam, unsigned int cmd, - void __user * arg) + void __user * arg) { struct sn9c102_sensor* s = &cam->sensor; struct v4l2_format format; @@ -2214,7 +2214,7 @@ sn9c102_vidioc_try_s_fmt(struct sn9c102_device* cam, unsigned int cmd, pix->priv = pfmt->priv; /* bpp */ pix->colorspace = pfmt->colorspace; pix->bytesperline = (pix->pixelformat == V4L2_PIX_FMT_SN9C10X) - ? 0 : (pix->width * pix->priv) / 8; + ? 0 : (pix->width * pix->priv) / 8; pix->sizeimage = pix->height * ((pix->width * pix->priv) / 8); pix->field = V4L2_FIELD_NONE; @@ -2287,7 +2287,7 @@ static int sn9c102_vidioc_g_jpegcomp(struct sn9c102_device* cam, void __user * arg) { if (copy_to_user(arg, &cam->compression, - sizeof(cam->compression))) + sizeof(cam->compression))) return -EFAULT; return 0; @@ -2436,7 +2436,7 @@ sn9c102_vidioc_qbuf(struct sn9c102_device* cam, void __user * arg) static int sn9c102_vidioc_dqbuf(struct sn9c102_device* cam, struct file* filp, - void __user * arg) + void __user * arg) { struct v4l2_buffer b; struct sn9c102_frame_t *f; @@ -2455,12 +2455,12 @@ sn9c102_vidioc_dqbuf(struct sn9c102_device* cam, struct file* filp, if (filp->f_flags & O_NONBLOCK) return -EAGAIN; timeout = wait_event_interruptible_timeout - ( cam->wait_frame, - (!list_empty(&cam->outqueue)) || - (cam->state & DEV_DISCONNECTED) || - (cam->state & DEV_MISCONFIGURED), - cam->module_param.frame_timeout * - 1000 * msecs_to_jiffies(1) ); + ( cam->wait_frame, + (!list_empty(&cam->outqueue)) || + (cam->state & DEV_DISCONNECTED) || + (cam->state & DEV_MISCONFIGURED), + cam->module_param.frame_timeout * + 1000 * msecs_to_jiffies(1) ); if (timeout < 0) return timeout; if (cam->state & DEV_DISCONNECTED) @@ -2584,7 +2584,7 @@ sn9c102_vidioc_s_parm(struct sn9c102_device* cam, void __user * arg) static int sn9c102_ioctl_v4l2(struct inode* inode, struct file* filp, - unsigned int cmd, void __user * arg) + unsigned int cmd, void __user * arg) { struct sn9c102_device* cam = video_get_drvdata(video_devdata(filp)); @@ -2678,7 +2678,7 @@ static int sn9c102_ioctl_v4l2(struct inode* inode, struct file* filp, static int sn9c102_ioctl(struct inode* inode, struct file* filp, - unsigned int cmd, unsigned long arg) + unsigned int cmd, unsigned long arg) { struct sn9c102_device* cam = video_get_drvdata(video_devdata(filp)); int err = 0; @@ -2761,7 +2761,7 @@ sn9c102_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) } cam->bridge = (id->idProduct & 0xffc0) == 0x6080 ? - BRIDGE_SN9C103 : BRIDGE_SN9C102; + BRIDGE_SN9C103 : BRIDGE_SN9C102; switch (cam->bridge) { case BRIDGE_SN9C101: case BRIDGE_SN9C102: @@ -2807,7 +2807,7 @@ sn9c102_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) mutex_lock(&cam->dev_mutex); err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER, - video_nr[dev_nr]); + video_nr[dev_nr]); if (err) { DBG(1, "V4L2 device registration failed"); if (err == -ENFILE && video_nr[dev_nr] == -1) diff --git a/drivers/usb/media/sn9c102_hv7131d.c b/drivers/media/video/sn9c102/sn9c102_hv7131d.c index 46c12ec3ca62..c4117bf64b69 100644 --- a/drivers/usb/media/sn9c102_hv7131d.c +++ b/drivers/media/video/sn9c102/sn9c102_hv7131d.c @@ -44,8 +44,8 @@ static int hv7131d_init(struct sn9c102_device* cam) } -static int hv7131d_get_ctrl(struct sn9c102_device* cam, - struct v4l2_control* ctrl) +static int hv7131d_get_ctrl(struct sn9c102_device* cam, + struct v4l2_control* ctrl) { switch (ctrl->id) { case V4L2_CID_EXPOSURE: @@ -88,8 +88,8 @@ static int hv7131d_get_ctrl(struct sn9c102_device* cam, } -static int hv7131d_set_ctrl(struct sn9c102_device* cam, - const struct v4l2_control* ctrl) +static int hv7131d_set_ctrl(struct sn9c102_device* cam, + const struct v4l2_control* ctrl) { int err = 0; @@ -121,8 +121,8 @@ static int hv7131d_set_ctrl(struct sn9c102_device* cam, } -static int hv7131d_set_crop(struct sn9c102_device* cam, - const struct v4l2_rect* rect) +static int hv7131d_set_crop(struct sn9c102_device* cam, + const struct v4l2_rect* rect) { struct sn9c102_sensor* s = &hv7131d; int err = 0; @@ -136,8 +136,8 @@ static int hv7131d_set_crop(struct sn9c102_device* cam, } -static int hv7131d_set_pix_format(struct sn9c102_device* cam, - const struct v4l2_pix_format* pix) +static int hv7131d_set_pix_format(struct sn9c102_device* cam, + const struct v4l2_pix_format* pix) { int err = 0; diff --git a/drivers/usb/media/sn9c102_mi0343.c b/drivers/media/video/sn9c102/sn9c102_mi0343.c index d9aa7a61095d..4169ea4a2e20 100644 --- a/drivers/usb/media/sn9c102_mi0343.c +++ b/drivers/media/video/sn9c102/sn9c102_mi0343.c @@ -39,64 +39,64 @@ static int mi0343_init(struct sn9c102_device* cam) err += sn9c102_write_reg(cam, 0xa0, 0x19); err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id, - 0x0d, 0x00, 0x01, 0, 0); + 0x0d, 0x00, 0x01, 0, 0); err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id, - 0x0d, 0x00, 0x00, 0, 0); + 0x0d, 0x00, 0x00, 0, 0); err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id, - 0x03, 0x01, 0xe1, 0, 0); + 0x03, 0x01, 0xe1, 0, 0); err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id, - 0x04, 0x02, 0x81, 0, 0); + 0x04, 0x02, 0x81, 0, 0); err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id, - 0x05, 0x00, 0x17, 0, 0); + 0x05, 0x00, 0x17, 0, 0); err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id, - 0x06, 0x00, 0x11, 0, 0); + 0x06, 0x00, 0x11, 0, 0); err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id, - 0x62, 0x04, 0x9a, 0, 0); + 0x62, 0x04, 0x9a, 0, 0); return err; } -static int mi0343_get_ctrl(struct sn9c102_device* cam, - struct v4l2_control* ctrl) +static int mi0343_get_ctrl(struct sn9c102_device* cam, + struct v4l2_control* ctrl) { switch (ctrl->id) { case V4L2_CID_EXPOSURE: if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, - 0x09, 2+1, mi0343_i2c_data) < 0) + 0x09, 2+1, mi0343_i2c_data) < 0) return -EIO; ctrl->value = mi0343_i2c_data[2]; return 0; case V4L2_CID_GAIN: if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, - 0x35, 2+1, mi0343_i2c_data) < 0) + 0x35, 2+1, mi0343_i2c_data) < 0) return -EIO; break; case V4L2_CID_HFLIP: if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, - 0x20, 2+1, mi0343_i2c_data) < 0) + 0x20, 2+1, mi0343_i2c_data) < 0) return -EIO; ctrl->value = mi0343_i2c_data[3] & 0x20 ? 1 : 0; return 0; case V4L2_CID_VFLIP: if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, - 0x20, 2+1, mi0343_i2c_data) < 0) + 0x20, 2+1, mi0343_i2c_data) < 0) return -EIO; ctrl->value = mi0343_i2c_data[3] & 0x80 ? 1 : 0; return 0; case V4L2_CID_RED_BALANCE: if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, - 0x2d, 2+1, mi0343_i2c_data) < 0) + 0x2d, 2+1, mi0343_i2c_data) < 0) return -EIO; break; case V4L2_CID_BLUE_BALANCE: if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, - 0x2c, 2+1, mi0343_i2c_data) < 0) + 0x2c, 2+1, mi0343_i2c_data) < 0) return -EIO; break; case SN9C102_V4L2_CID_GREEN_BALANCE: if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, - 0x2e, 2+1, mi0343_i2c_data) < 0) + 0x2e, 2+1, mi0343_i2c_data) < 0) return -EIO; break; default: @@ -121,8 +121,8 @@ static int mi0343_get_ctrl(struct sn9c102_device* cam, } -static int mi0343_set_ctrl(struct sn9c102_device* cam, - const struct v4l2_control* ctrl) +static int mi0343_set_ctrl(struct sn9c102_device* cam, + const struct v4l2_control* ctrl) { u16 reg = 0; int err = 0; @@ -144,51 +144,51 @@ static int mi0343_set_ctrl(struct sn9c102_device* cam, switch (ctrl->id) { case V4L2_CID_EXPOSURE: err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, - mi0343.i2c_slave_id, - 0x09, ctrl->value, 0x00, - 0, 0); + mi0343.i2c_slave_id, + 0x09, ctrl->value, 0x00, + 0, 0); break; case V4L2_CID_GAIN: err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, - mi0343.i2c_slave_id, - 0x35, reg >> 8, reg & 0xff, - 0, 0); + mi0343.i2c_slave_id, + 0x35, reg >> 8, reg & 0xff, + 0, 0); break; case V4L2_CID_HFLIP: err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, - mi0343.i2c_slave_id, - 0x20, ctrl->value ? 0x40:0x00, - ctrl->value ? 0x20:0x00, - 0, 0); + mi0343.i2c_slave_id, + 0x20, ctrl->value ? 0x40:0x00, + ctrl->value ? 0x20:0x00, + 0, 0); break; case V4L2_CID_VFLIP: err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, - mi0343.i2c_slave_id, - 0x20, ctrl->value ? 0x80:0x00, - ctrl->value ? 0x80:0x00, - 0, 0); + mi0343.i2c_slave_id, + 0x20, ctrl->value ? 0x80:0x00, + ctrl->value ? 0x80:0x00, + 0, 0); break; case V4L2_CID_RED_BALANCE: err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, - mi0343.i2c_slave_id, - 0x2d, reg >> 8, reg & 0xff, - 0, 0); + mi0343.i2c_slave_id, + 0x2d, reg >> 8, reg & 0xff, + 0, 0); break; case V4L2_CID_BLUE_BALANCE: err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, - mi0343.i2c_slave_id, - 0x2c, reg >> 8, reg & 0xff, - 0, 0); + mi0343.i2c_slave_id, + 0x2c, reg >> 8, reg & 0xff, + 0, 0); break; case SN9C102_V4L2_CID_GREEN_BALANCE: err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, - mi0343.i2c_slave_id, - 0x2b, reg >> 8, reg & 0xff, - 0, 0); + mi0343.i2c_slave_id, + 0x2b, reg >> 8, reg & 0xff, + 0, 0); err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, - mi0343.i2c_slave_id, - 0x2e, reg >> 8, reg & 0xff, - 0, 0); + mi0343.i2c_slave_id, + 0x2e, reg >> 8, reg & 0xff, + 0, 0); break; default: return -EINVAL; @@ -198,8 +198,8 @@ static int mi0343_set_ctrl(struct sn9c102_device* cam, } -static int mi0343_set_crop(struct sn9c102_device* cam, - const struct v4l2_rect* rect) +static int mi0343_set_crop(struct sn9c102_device* cam, + const struct v4l2_rect* rect) { struct sn9c102_sensor* s = &mi0343; int err = 0; @@ -213,20 +213,20 @@ static int mi0343_set_crop(struct sn9c102_device* cam, } -static int mi0343_set_pix_format(struct sn9c102_device* cam, - const struct v4l2_pix_format* pix) +static int mi0343_set_pix_format(struct sn9c102_device* cam, + const struct v4l2_pix_format* pix) { int err = 0; if (pix->pixelformat == V4L2_PIX_FMT_SN9C10X) { err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, - mi0343.i2c_slave_id, - 0x0a, 0x00, 0x03, 0, 0); + mi0343.i2c_slave_id, + 0x0a, 0x00, 0x03, 0, 0); err += sn9c102_write_reg(cam, 0x20, 0x19); } else { err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, - mi0343.i2c_slave_id, - 0x0a, 0x00, 0x05, 0, 0); + mi0343.i2c_slave_id, + 0x0a, 0x00, 0x05, 0, 0); err += sn9c102_write_reg(cam, 0xa0, 0x19); } @@ -351,7 +351,7 @@ int sn9c102_probe_mi0343(struct sn9c102_device* cam) return -EIO; if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, 0x00, - 2, mi0343_i2c_data) < 0) + 2, mi0343_i2c_data) < 0) return -EIO; if (mi0343_i2c_data[4] != 0x32 && mi0343_i2c_data[3] != 0xe3) diff --git a/drivers/usb/media/sn9c102_ov7630.c b/drivers/media/video/sn9c102/sn9c102_ov7630.c index 42852b7cb042..3da042021787 100644 --- a/drivers/usb/media/sn9c102_ov7630.c +++ b/drivers/media/video/sn9c102/sn9c102_ov7630.c @@ -69,7 +69,7 @@ static int ov7630_init(struct sn9c102_device* cam) static int ov7630_set_ctrl(struct sn9c102_device* cam, - const struct v4l2_control* ctrl) + const struct v4l2_control* ctrl) { int err = 0; @@ -89,8 +89,8 @@ static int ov7630_set_ctrl(struct sn9c102_device* cam, break; case V4L2_CID_CONTRAST: err += ctrl->value ? sn9c102_i2c_write(cam, 0x05, - (ctrl->value-1) | 0x20) - : sn9c102_i2c_write(cam, 0x05, 0x00); + (ctrl->value-1) | 0x20) + : sn9c102_i2c_write(cam, 0x05, 0x00); break; case V4L2_CID_BRIGHTNESS: err += sn9c102_i2c_write(cam, 0x06, ctrl->value); @@ -100,8 +100,8 @@ static int ov7630_set_ctrl(struct sn9c102_device* cam, break; case V4L2_CID_HUE: err += ctrl->value ? sn9c102_i2c_write(cam, 0x04, - (ctrl->value-1) | 0x20) - : sn9c102_i2c_write(cam, 0x04, 0x00); + (ctrl->value-1) | 0x20) + : sn9c102_i2c_write(cam, 0x04, 0x00); break; case V4L2_CID_DO_WHITE_BALANCE: err += sn9c102_i2c_write(cam, 0x0c, ctrl->value); @@ -139,7 +139,7 @@ static int ov7630_set_ctrl(struct sn9c102_device* cam, static int ov7630_set_crop(struct sn9c102_device* cam, - const struct v4l2_rect* rect) + const struct v4l2_rect* rect) { struct sn9c102_sensor* s = &ov7630; int err = 0; @@ -152,7 +152,7 @@ static int ov7630_set_crop(struct sn9c102_device* cam, static int ov7630_set_pix_format(struct sn9c102_device* cam, - const struct v4l2_pix_format* pix) + const struct v4l2_pix_format* pix) { int err = 0; diff --git a/drivers/usb/media/sn9c102_pas106b.c b/drivers/media/video/sn9c102/sn9c102_pas106b.c index b1dee78abe04..9915944235e8 100644 --- a/drivers/usb/media/sn9c102_pas106b.c +++ b/drivers/media/video/sn9c102/sn9c102_pas106b.c @@ -53,8 +53,8 @@ static int pas106b_init(struct sn9c102_device* cam) } -static int pas106b_get_ctrl(struct sn9c102_device* cam, - struct v4l2_control* ctrl) +static int pas106b_get_ctrl(struct sn9c102_device* cam, + struct v4l2_control* ctrl) { switch (ctrl->id) { case V4L2_CID_EXPOSURE: @@ -102,8 +102,8 @@ static int pas106b_get_ctrl(struct sn9c102_device* cam, } -static int pas106b_set_ctrl(struct sn9c102_device* cam, - const struct v4l2_control* ctrl) +static int pas106b_set_ctrl(struct sn9c102_device* cam, + const struct v4l2_control* ctrl) { int err = 0; @@ -140,8 +140,8 @@ static int pas106b_set_ctrl(struct sn9c102_device* cam, } -static int pas106b_set_crop(struct sn9c102_device* cam, - const struct v4l2_rect* rect) +static int pas106b_set_crop(struct sn9c102_device* cam, + const struct v4l2_rect* rect) { struct sn9c102_sensor* s = &pas106b; int err = 0; @@ -155,8 +155,8 @@ static int pas106b_set_crop(struct sn9c102_device* cam, } -static int pas106b_set_pix_format(struct sn9c102_device* cam, - const struct v4l2_pix_format* pix) +static int pas106b_set_pix_format(struct sn9c102_device* cam, + const struct v4l2_pix_format* pix) { int err = 0; diff --git a/drivers/usb/media/sn9c102_pas202bca.c b/drivers/media/video/sn9c102/sn9c102_pas202bca.c index 3453237055bb..c8f1ae2152b8 100644 --- a/drivers/usb/media/sn9c102_pas202bca.c +++ b/drivers/media/video/sn9c102/sn9c102_pas202bca.c @@ -54,7 +54,7 @@ static int pas202bca_init(struct sn9c102_device* cam) static int pas202bca_set_pix_format(struct sn9c102_device* cam, - const struct v4l2_pix_format* pix) + const struct v4l2_pix_format* pix) { int err = 0; @@ -68,7 +68,7 @@ static int pas202bca_set_pix_format(struct sn9c102_device* cam, static int pas202bca_set_ctrl(struct sn9c102_device* cam, - const struct v4l2_control* ctrl) + const struct v4l2_control* ctrl) { int err = 0; @@ -102,7 +102,7 @@ static int pas202bca_set_ctrl(struct sn9c102_device* cam, static int pas202bca_set_crop(struct sn9c102_device* cam, - const struct v4l2_rect* rect) + const struct v4l2_rect* rect) { struct sn9c102_sensor* s = &pas202bca; int err = 0; diff --git a/drivers/usb/media/sn9c102_pas202bcb.c b/drivers/media/video/sn9c102/sn9c102_pas202bcb.c index d068616ab337..e3c1178e339c 100644 --- a/drivers/usb/media/sn9c102_pas202bcb.c +++ b/drivers/media/video/sn9c102/sn9c102_pas202bcb.c @@ -58,8 +58,8 @@ static int pas202bcb_init(struct sn9c102_device* cam) } -static int pas202bcb_get_ctrl(struct sn9c102_device* cam, - struct v4l2_control* ctrl) +static int pas202bcb_get_ctrl(struct sn9c102_device* cam, + struct v4l2_control* ctrl) { switch (ctrl->id) { case V4L2_CID_EXPOSURE: @@ -101,8 +101,8 @@ static int pas202bcb_get_ctrl(struct sn9c102_device* cam, } -static int pas202bcb_set_pix_format(struct sn9c102_device* cam, - const struct v4l2_pix_format* pix) +static int pas202bcb_set_pix_format(struct sn9c102_device* cam, + const struct v4l2_pix_format* pix) { int err = 0; @@ -115,8 +115,8 @@ static int pas202bcb_set_pix_format(struct sn9c102_device* cam, } -static int pas202bcb_set_ctrl(struct sn9c102_device* cam, - const struct v4l2_control* ctrl) +static int pas202bcb_set_ctrl(struct sn9c102_device* cam, + const struct v4l2_control* ctrl) { int err = 0; @@ -149,8 +149,8 @@ static int pas202bcb_set_ctrl(struct sn9c102_device* cam, } -static int pas202bcb_set_crop(struct sn9c102_device* cam, - const struct v4l2_rect* rect) +static int pas202bcb_set_crop(struct sn9c102_device* cam, + const struct v4l2_rect* rect) { struct sn9c102_sensor* s = &pas202bcb; int err = 0; @@ -167,7 +167,7 @@ static int pas202bcb_set_crop(struct sn9c102_device* cam, static struct sn9c102_sensor pas202bcb = { .name = "PAS202BCB", .maintainer = "Carlos Eduardo Medaglia Dyonisio " - "<medaglia@undl.org.br>", + "<medaglia@undl.org.br>", .sysfs_ops = SN9C102_I2C_READ | SN9C102_I2C_WRITE, .frequency = SN9C102_I2C_400KHZ | SN9C102_I2C_100KHZ, .interface = SN9C102_I2C_2WIRES, diff --git a/drivers/usb/media/sn9c102_sensor.h b/drivers/media/video/sn9c102/sn9c102_sensor.h index 2afd9e9d09bb..2a874ee6f9f5 100644 --- a/drivers/usb/media/sn9c102_sensor.h +++ b/drivers/media/video/sn9c102/sn9c102_sensor.h @@ -58,7 +58,7 @@ struct sn9c102_sensor; Probing functions: on success, you must attach the sensor to the camera by calling sn9c102_attach_sensor() provided below. To enable the I2C communication, you might need to perform a really basic - initialization of the SN9C10X chip by using the write function declared + initialization of the SN9C10X chip by using the write function declared ahead. Functions must return 0 on success, the appropriate error otherwise. */ @@ -73,7 +73,7 @@ extern int sn9c102_probe_tas5130d1b(struct sn9c102_device* cam); /* Add the above entries to this table. Be sure to add the entry in the right - place, since, on failure, the next probing routine is called according to + place, since, on failure, the next probing routine is called according to the order of the list below, from top to bottom. */ #define SN9C102_SENSOR_TABLE \ @@ -94,9 +94,9 @@ extern struct sn9c102_device* sn9c102_match_id(struct sn9c102_device* cam, const struct usb_device_id *id); /* Attach a probed sensor to the camera. */ -extern void +extern void sn9c102_attach_sensor(struct sn9c102_device* cam, - struct sn9c102_sensor* sensor); + struct sn9c102_sensor* sensor); /* Each SN9C10x camera has proper PID/VID identifiers. @@ -105,7 +105,7 @@ sn9c102_attach_sensor(struct sn9c102_device* cam, */ #define SN9C102_USB_DEVICE(vend, prod, intclass) \ .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \ - USB_DEVICE_ID_MATCH_INT_CLASS, \ + USB_DEVICE_ID_MATCH_INT_CLASS, \ .idVendor = (vend), \ .idProduct = (prod), \ .bInterfaceClass = (intclass) @@ -162,19 +162,19 @@ static const struct usb_device_id sn9c102_id_table[] = { \ Read/write routines: they always return -1 on error, 0 or the read value otherwise. NOTE that a real read operation is not supported by the SN9C10X chip for some of its registers. To work around this problem, a pseudo-read - call is provided instead: it returns the last successfully written value + call is provided instead: it returns the last successfully written value on the register (0 if it has never been written), the usual -1 on error. */ /* The "try" I2C I/O versions are used when probing the sensor */ extern int sn9c102_i2c_try_write(struct sn9c102_device*,struct sn9c102_sensor*, - u8 address, u8 value); + u8 address, u8 value); extern int sn9c102_i2c_try_read(struct sn9c102_device*,struct sn9c102_sensor*, - u8 address); + u8 address); /* These must be used if and only if the sensor doesn't implement the standard - I2C protocol. There are a number of good reasons why you must use the + I2C protocol. There are a number of good reasons why you must use the single-byte versions of these functions: do not abuse. The first function writes n bytes, from data0 to datan, to registers 0x09 - 0x09+n of SN9C10X chip. The second one programs the registers 0x09 and 0x10 with data0 and @@ -184,12 +184,12 @@ extern int sn9c102_i2c_try_read(struct sn9c102_device*,struct sn9c102_sensor*, byte. */ extern int sn9c102_i2c_try_raw_write(struct sn9c102_device* cam, - struct sn9c102_sensor* sensor, u8 n, - u8 data0, u8 data1, u8 data2, u8 data3, - u8 data4, u8 data5); + struct sn9c102_sensor* sensor, u8 n, + u8 data0, u8 data1, u8 data2, u8 data3, + u8 data4, u8 data5); extern int sn9c102_i2c_try_raw_read(struct sn9c102_device* cam, - struct sn9c102_sensor* sensor, u8 data0, - u8 data1, u8 n, u8 buffer[]); + struct sn9c102_sensor* sensor, u8 data0, + u8 data1, u8 n, u8 buffer[]); /* To be used after the sensor struct has been attached to the camera struct */ extern int sn9c102_i2c_write(struct sn9c102_device*, u8 address, u8 value); @@ -252,17 +252,17 @@ struct sn9c102_sensor { /* NOTE: Where not noted,most of the functions below are not mandatory. - Set to null if you do not implement them. If implemented, - they must return 0 on success, the proper error otherwise. + Set to null if you do not implement them. If implemented, + they must return 0 on success, the proper error otherwise. */ int (*init)(struct sn9c102_device* cam); /* - This function will be called after the sensor has been attached. + This function will be called after the sensor has been attached. It should be used to initialize the sensor only, but may also configure part of the SN9C10X chip if necessary. You don't need to setup picture settings like brightness, contrast, etc.. here, if - the corrisponding controls are implemented (see below), since + the corrisponding controls are implemented (see below), since they are adjusted in the core driver by calling the set_ctrl() method after init(), where the arguments are the default values specified in the v4l2_queryctrl list of supported controls; @@ -273,13 +273,13 @@ struct sn9c102_sensor { struct v4l2_queryctrl qctrl[SN9C102_MAX_CTRLS]; /* - Optional list of default controls, defined as indicated in the + Optional list of default controls, defined as indicated in the V4L2 API. Menu type controls are not handled by this interface. */ int (*get_ctrl)(struct sn9c102_device* cam, struct v4l2_control* ctrl); int (*set_ctrl)(struct sn9c102_device* cam, - const struct v4l2_control* ctrl); + const struct v4l2_control* ctrl); /* You must implement at least the set_ctrl method if you have defined the list above. The returned value must follow the V4L2 @@ -306,7 +306,7 @@ struct sn9c102_sensor { specified in the cropcap substructures 'bounds' and 'defrect'. By default, the source rectangle should cover the largest possible area. Again, it is not always true that the largest source rectangle - can cover the entire active window, although it is a rare case for + can cover the entire active window, although it is a rare case for the hardware we have. The bounds of the source rectangle _must_ be multiple of 16 and must use the same coordinate system as indicated before; their centers shall align initially. @@ -317,13 +317,13 @@ struct sn9c102_sensor { defined the correct default bounds in the structures. See the V4L2 API for further details. NOTE: once you have defined the bounds of the active window - (struct cropcap.bounds) you must not change them.anymore. + (struct cropcap.bounds) you must not change them.anymore. Only 'bounds' and 'defrect' fields are mandatory, other fields will be ignored. */ int (*set_crop)(struct sn9c102_device* cam, - const struct v4l2_rect* rect); + const struct v4l2_rect* rect); /* To be called on VIDIOC_C_SETCROP. The core module always calls a default routine which configures the appropriate SN9C10X regs (also @@ -332,12 +332,12 @@ struct sn9c102_sensor { case you override the default function, you always have to program the chip to match those values; on error return the corresponding error code without rolling back. - NOTE: in case, you must program the SN9C10X chip to get rid of - blank pixels or blank lines at the _start_ of each line or - frame after each HSYNC or VSYNC, so that the image starts with - real RGB data (see regs 0x12, 0x13) (having set H_SIZE and, - V_SIZE you don't have to care about blank pixels or blank - lines at the end of each line or frame). + NOTE: in case, you must program the SN9C10X chip to get rid of + blank pixels or blank lines at the _start_ of each line or + frame after each HSYNC or VSYNC, so that the image starts with + real RGB data (see regs 0x12, 0x13) (having set H_SIZE and, + V_SIZE you don't have to care about blank pixels or blank + lines at the end of each line or frame). */ struct v4l2_pix_format pix_format; @@ -349,17 +349,17 @@ struct sn9c102_sensor { number of bits per pixel for uncompressed video, 8 or 9 (despite the current value of 'pixelformat'). NOTE 1: both 'width' and 'height' _must_ be either 1/1 or 1/2 or 1/4 - of cropcap.defrect.width and cropcap.defrect.height. I - suggest 1/1. + of cropcap.defrect.width and cropcap.defrect.height. I + suggest 1/1. NOTE 2: The initial compression quality is defined by the first bit - of reg 0x17 during the initialization of the image sensor. + of reg 0x17 during the initialization of the image sensor. NOTE 3: as said above, you have to program the SN9C10X chip to get - rid of any blank pixels, so that the output of the sensor - matches the RGB bayer sequence (i.e. BGBGBG...GRGRGR). + rid of any blank pixels, so that the output of the sensor + matches the RGB bayer sequence (i.e. BGBGBG...GRGRGR). */ int (*set_pix_format)(struct sn9c102_device* cam, - const struct v4l2_pix_format* pix); + const struct v4l2_pix_format* pix); /* To be called on VIDIOC_S_FMT, when switching from the SBGGR8 to SN9C10X pixel format or viceversa. On error return the corresponding diff --git a/drivers/usb/media/sn9c102_tas5110c1b.c b/drivers/media/video/sn9c102/sn9c102_tas5110c1b.c index 2e08c552f40a..294eb02fbd88 100644 --- a/drivers/usb/media/sn9c102_tas5110c1b.c +++ b/drivers/media/video/sn9c102/sn9c102_tas5110c1b.c @@ -44,8 +44,8 @@ static int tas5110c1b_init(struct sn9c102_device* cam) } -static int tas5110c1b_set_ctrl(struct sn9c102_device* cam, - const struct v4l2_control* ctrl) +static int tas5110c1b_set_ctrl(struct sn9c102_device* cam, + const struct v4l2_control* ctrl) { int err = 0; @@ -61,8 +61,8 @@ static int tas5110c1b_set_ctrl(struct sn9c102_device* cam, } -static int tas5110c1b_set_crop(struct sn9c102_device* cam, - const struct v4l2_rect* rect) +static int tas5110c1b_set_crop(struct sn9c102_device* cam, + const struct v4l2_rect* rect) { struct sn9c102_sensor* s = &tas5110c1b; int err = 0; @@ -81,8 +81,8 @@ static int tas5110c1b_set_crop(struct sn9c102_device* cam, } -static int tas5110c1b_set_pix_format(struct sn9c102_device* cam, - const struct v4l2_pix_format* pix) +static int tas5110c1b_set_pix_format(struct sn9c102_device* cam, + const struct v4l2_pix_format* pix) { int err = 0; diff --git a/drivers/usb/media/sn9c102_tas5130d1b.c b/drivers/media/video/sn9c102/sn9c102_tas5130d1b.c index c7b339740bbf..9ecb09032b68 100644 --- a/drivers/usb/media/sn9c102_tas5130d1b.c +++ b/drivers/media/video/sn9c102/sn9c102_tas5130d1b.c @@ -42,8 +42,8 @@ static int tas5130d1b_init(struct sn9c102_device* cam) } -static int tas5130d1b_set_ctrl(struct sn9c102_device* cam, - const struct v4l2_control* ctrl) +static int tas5130d1b_set_ctrl(struct sn9c102_device* cam, + const struct v4l2_control* ctrl) { int err = 0; @@ -62,8 +62,8 @@ static int tas5130d1b_set_ctrl(struct sn9c102_device* cam, } -static int tas5130d1b_set_crop(struct sn9c102_device* cam, - const struct v4l2_rect* rect) +static int tas5130d1b_set_crop(struct sn9c102_device* cam, + const struct v4l2_rect* rect) { struct sn9c102_sensor* s = &tas5130d1b; u8 h_start = (u8)(rect->left - s->cropcap.bounds.left) + 104, @@ -82,8 +82,8 @@ static int tas5130d1b_set_crop(struct sn9c102_device* cam, } -static int tas5130d1b_set_pix_format(struct sn9c102_device* cam, - const struct v4l2_pix_format* pix) +static int tas5130d1b_set_pix_format(struct sn9c102_device* cam, + const struct v4l2_pix_format* pix) { int err = 0; diff --git a/drivers/media/video/stradis.c b/drivers/media/video/stradis.c index 9d769264a329..07476c71174a 100644 --- a/drivers/media/video/stradis.c +++ b/drivers/media/video/stradis.c @@ -1,4 +1,4 @@ -/* +/* * stradis.c - stradis 4:2:2 mpeg decoder driver * * Stradis 4:2:2 MPEG-2 Decoder Driver @@ -1191,9 +1191,9 @@ static void saa7146_set_winsize(struct saa7146 *saa) } /* clip_draw_rectangle(cm,x,y,w,h) -- handle clipping an area - * bitmap is fixed width, 128 bytes (1024 pixels represented) - * arranged most-sigificant-bit-left in 32-bit words - * based on saa7146 clipping hardware, it swaps bytes if LE + * bitmap is fixed width, 128 bytes (1024 pixels represented) + * arranged most-sigificant-bit-left in 32-bit words + * based on saa7146 clipping hardware, it swaps bytes if LE * much of this makes up for egcs brain damage -- so if you * are wondering "why did he do this?" it is because the C * was adjusted to generate the optimal asm output without @@ -1259,7 +1259,7 @@ static void make_clip_tab(struct saa7146 *saa, struct video_clip *cr, int ncr) clip_draw_rectangle(clipmap, cr[i].x, cr[i].y, cr[i].width, cr[i].height); } - /* clip against viewing window AND screen + /* clip against viewing window AND screen so we do not have to rely on the user program */ clip_draw_rectangle(clipmap, (saa->win.x + width > saa->win.swidth) ? diff --git a/drivers/usb/media/stv680.c b/drivers/media/video/stv680.c index 9636da20748d..b38bda83a7c5 100644 --- a/drivers/usb/media/stv680.c +++ b/drivers/media/video/stv680.c @@ -1,16 +1,16 @@ /* * STV0680 USB Camera Driver, by Kevin Sisson (kjsisson@bellsouth.net) - * - * Thanks to STMicroelectronics for information on the usb commands, and - * to Steve Miller at STM for his help and encouragement while I was + * + * Thanks to STMicroelectronics for information on the usb commands, and + * to Steve Miller at STM for his help and encouragement while I was * writing this driver. * - * This driver is based heavily on the + * This driver is based heavily on the * Endpoints (formerly known as AOX) se401 USB Camera Driver * Copyright (c) 2000 Jeroen B. Vreeken (pe1rxq@amsat.org) * * Still somewhat based on the Linux ov511 driver. - * + * * 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 @@ -25,18 +25,18 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * History: - * ver 0.1 October, 2001. Initial attempt. + * History: + * ver 0.1 October, 2001. Initial attempt. * * ver 0.2 November, 2001. Fixed asbility to resize, added brightness * function, made more stable (?) * - * ver 0.21 Nov, 2001. Added gamma correction and white balance, - * due to Alexander Schwartz. Still trying to + * ver 0.21 Nov, 2001. Added gamma correction and white balance, + * due to Alexander Schwartz. Still trying to * improve stablility. Moved stuff into stv680.h * - * ver 0.22 Nov, 2001. Added sharpen function (by Michael Sweet, - * mike@easysw.com) from GIMP, also used in pencam. + * ver 0.22 Nov, 2001. Added sharpen function (by Michael Sweet, + * mike@easysw.com) from GIMP, also used in pencam. * Simple, fast, good integer math routine. * * ver 0.23 Dec, 2001 (gkh) @@ -44,11 +44,11 @@ * Lindent, and did other minor tweaks to get * things to work properly with 2.5.1 * - * ver 0.24 Jan, 2002 (kjs) + * ver 0.24 Jan, 2002 (kjs) * Fixed the problem with webcam crashing after - * two pictures. Changed the way pic is halved to - * improve quality. Got rid of green line around - * frame. Fix brightness reset when changing size + * two pictures. Changed the way pic is halved to + * improve quality. Got rid of green line around + * frame. Fix brightness reset when changing size * bug. Adjusted gamma filters slightly. * * ver 0.25 Jan, 2002 (kjs) @@ -484,7 +484,7 @@ exit: PDEBUG (1, "STV(i): swapRGB is (forced) ON"); else if (swapRGB_on == -1) PDEBUG (1, "STV(i): swapRGB is (forced) OFF"); - + if (stv_set_video_mode (stv680) < 0) { PDEBUG (0, "STV(e): Could not set video mode in stv_init"); return -1; @@ -570,7 +570,7 @@ static int stv680_set_pict (struct usb_stv *stv680, struct video_picture *p) if (stv680->brightness != p->brightness) { stv680->chgbright = 1; stv680->brightness = p->brightness; - } + } stv680->whiteness = p->whiteness; /* greyscale */ stv680->colour = p->colour; @@ -612,7 +612,7 @@ static void stv680_video_irq (struct urb *urb, struct pt_regs *regs) case BUFFER_UNUSED: memcpy (stv680->scratch[stv680->scratch_next].data, - (unsigned char *) urb->transfer_buffer, length); + (unsigned char *) urb->transfer_buffer, length); stv680->scratch[stv680->scratch_next].state = BUFFER_READY; stv680->scratch[stv680->scratch_next].length = length; if (waitqueue_active (&stv680->wq)) { @@ -752,7 +752,7 @@ static int stv680_set_size (struct usb_stv *stv680, int width, int height) PDEBUG (1, "STV(e): request for non-supported size: request: v.width = %i, v.height = %i actual: stv.width = %i, stv.height = %i", width, height, stv680->vwidth, stv680->vheight); return 1; } - + /* Stop a current stream and start it again at the new size */ if (wasstreaming) stv680_stop_stream (stv680); @@ -773,7 +773,7 @@ static int stv680_set_size (struct usb_stv *stv680, int width, int height) /* * STV0680 Vision Camera Chipset Driver - * Copyright (C) 2000 Adam Harrison <adam@antispin.org> + * Copyright (C) 2000 Adam Harrison <adam@antispin.org> */ #define RED 0 @@ -842,7 +842,7 @@ static void bayer_unshuffle (struct usb_stv *stv680, struct stv680_scratch *buff colour = 2; break; } - i = (y * vw + x) * 3; + i = (y * vw + x) * 3; *(output + i + colour) = (unsigned char) p; } /* for x */ @@ -850,9 +850,9 @@ static void bayer_unshuffle (struct usb_stv *stv680, struct stv680_scratch *buff /****** gamma correction plus hardcoded white balance */ /* Thanks to Alexander Schwartx <alexander.schwartx@gmx.net> for this code. - Correction values red[], green[], blue[], are generated by - (pow(i/256.0, GAMMA)*255.0)*white balanceRGB where GAMMA=0.55, 1<i<255. - White balance (RGB)= 1.0, 1.17, 1.48. Values are calculated as double float and + Correction values red[], green[], blue[], are generated by + (pow(i/256.0, GAMMA)*255.0)*white balanceRGB where GAMMA=0.55, 1<i<255. + White balance (RGB)= 1.0, 1.17, 1.48. Values are calculated as double float and converted to unsigned char. Values are in stv680.h */ for (y = 0; y < vh; y++) { diff --git a/drivers/usb/media/stv680.h b/drivers/media/video/stv680.h index ea46e0001e6d..a08f1b08a4b0 100644 --- a/drivers/usb/media/stv680.h +++ b/drivers/media/video/stv680.h @@ -9,12 +9,12 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -152,76 +152,76 @@ struct usb_stv { static const unsigned char red[256] = { - 0, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 18, 25, 30, 35, 38, 42, - 44, 47, 50, 53, 54, 57, 59, 61, 63, 65, 67, 69, - 71, 71, 73, 75, 77, 78, 80, 81, 82, 84, 85, 87, - 88, 89, 90, 91, 93, 94, 95, 97, 98, 98, 99, 101, - 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, - 114, 115, 116, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 125, 126, 127, 128, 129, 129, 130, 131, 132, 133, 134, - 134, 135, 135, 136, 137, 138, 139, 140, 140, 141, 142, 143, - 143, 143, 144, 145, 146, 147, 147, 148, 149, 150, 150, 151, - 152, 152, 152, 153, 154, 154, 155, 156, 157, 157, 158, 159, - 159, 160, 161, 161, 161, 162, 163, 163, 164, 165, 165, 166, - 167, 167, 168, 168, 169, 170, 170, 170, 171, 171, 172, 173, - 173, 174, 174, 175, 176, 176, 177, 178, 178, 179, 179, 179, - 180, 180, 181, 181, 182, 183, 183, 184, 184, 185, 185, 186, - 187, 187, 188, 188, 188, 188, 189, 190, 190, 191, 191, 192, - 192, 193, 193, 194, 195, 195, 196, 196, 197, 197, 197, 197, - 198, 198, 199, 199, 200, 201, 201, 202, 202, 203, 203, 204, - 204, 205, 205, 206, 206, 206, 206, 207, 207, 208, 208, 209, - 209, 210, 210, 211, 211, 212, 212, 213, 213, 214, 214, 215, - 215, 215, 215, 216, 216, 217, 217, 218, 218, 218, 219, 219, - 220, 220, 221, 221 -}; + 0, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, + 18, 18, 18, 18, 18, 18, 18, 25, 30, 35, 38, 42, + 44, 47, 50, 53, 54, 57, 59, 61, 63, 65, 67, 69, + 71, 71, 73, 75, 77, 78, 80, 81, 82, 84, 85, 87, + 88, 89, 90, 91, 93, 94, 95, 97, 98, 98, 99, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, + 114, 115, 116, 116, 117, 118, 119, 120, 121, 122, 123, 124, + 125, 125, 126, 127, 128, 129, 129, 130, 131, 132, 133, 134, + 134, 135, 135, 136, 137, 138, 139, 140, 140, 141, 142, 143, + 143, 143, 144, 145, 146, 147, 147, 148, 149, 150, 150, 151, + 152, 152, 152, 153, 154, 154, 155, 156, 157, 157, 158, 159, + 159, 160, 161, 161, 161, 162, 163, 163, 164, 165, 165, 166, + 167, 167, 168, 168, 169, 170, 170, 170, 171, 171, 172, 173, + 173, 174, 174, 175, 176, 176, 177, 178, 178, 179, 179, 179, + 180, 180, 181, 181, 182, 183, 183, 184, 184, 185, 185, 186, + 187, 187, 188, 188, 188, 188, 189, 190, 190, 191, 191, 192, + 192, 193, 193, 194, 195, 195, 196, 196, 197, 197, 197, 197, + 198, 198, 199, 199, 200, 201, 201, 202, 202, 203, 203, 204, + 204, 205, 205, 206, 206, 206, 206, 207, 207, 208, 208, 209, + 209, 210, 210, 211, 211, 212, 212, 213, 213, 214, 214, 215, + 215, 215, 215, 216, 216, 217, 217, 218, 218, 218, 219, 219, + 220, 220, 221, 221 +}; static const unsigned char green[256] = { - 0, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 28, 34, 39, 43, 47, - 50, 53, 56, 59, 61, 64, 66, 68, 71, 73, 75, 77, - 79, 80, 82, 84, 86, 87, 89, 91, 92, 94, 95, 97, - 98, 100, 101, 102, 104, 105, 106, 108, 109, 110, 111, 113, - 114, 115, 116, 117, 118, 120, 121, 122, 123, 124, 125, 126, - 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, - 139, 140, 141, 142, 143, 144, 144, 145, 146, 147, 148, 149, - 150, 151, 151, 152, 153, 154, 155, 156, 156, 157, 158, 159, - 160, 160, 161, 162, 163, 164, 164, 165, 166, 167, 167, 168, - 169, 170, 170, 171, 172, 172, 173, 174, 175, 175, 176, 177, - 177, 178, 179, 179, 180, 181, 182, 182, 183, 184, 184, 185, - 186, 186, 187, 187, 188, 189, 189, 190, 191, 191, 192, 193, - 193, 194, 194, 195, 196, 196, 197, 198, 198, 199, 199, 200, - 201, 201, 202, 202, 203, 204, 204, 205, 205, 206, 206, 207, - 208, 208, 209, 209, 210, 210, 211, 212, 212, 213, 213, 214, - 214, 215, 215, 216, 217, 217, 218, 218, 219, 219, 220, 220, - 221, 221, 222, 222, 223, 224, 224, 225, 225, 226, 226, 227, - 227, 228, 228, 229, 229, 230, 230, 231, 231, 232, 232, 233, - 233, 234, 234, 235, 235, 236, 236, 237, 237, 238, 238, 239, - 239, 240, 240, 241, 241, 242, 242, 243, 243, 243, 244, 244, - 245, 245, 246, 246 -}; + 0, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, + 21, 21, 21, 21, 21, 21, 21, 28, 34, 39, 43, 47, + 50, 53, 56, 59, 61, 64, 66, 68, 71, 73, 75, 77, + 79, 80, 82, 84, 86, 87, 89, 91, 92, 94, 95, 97, + 98, 100, 101, 102, 104, 105, 106, 108, 109, 110, 111, 113, + 114, 115, 116, 117, 118, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, + 139, 140, 141, 142, 143, 144, 144, 145, 146, 147, 148, 149, + 150, 151, 151, 152, 153, 154, 155, 156, 156, 157, 158, 159, + 160, 160, 161, 162, 163, 164, 164, 165, 166, 167, 167, 168, + 169, 170, 170, 171, 172, 172, 173, 174, 175, 175, 176, 177, + 177, 178, 179, 179, 180, 181, 182, 182, 183, 184, 184, 185, + 186, 186, 187, 187, 188, 189, 189, 190, 191, 191, 192, 193, + 193, 194, 194, 195, 196, 196, 197, 198, 198, 199, 199, 200, + 201, 201, 202, 202, 203, 204, 204, 205, 205, 206, 206, 207, + 208, 208, 209, 209, 210, 210, 211, 212, 212, 213, 213, 214, + 214, 215, 215, 216, 217, 217, 218, 218, 219, 219, 220, 220, + 221, 221, 222, 222, 223, 224, 224, 225, 225, 226, 226, 227, + 227, 228, 228, 229, 229, 230, 230, 231, 231, 232, 232, 233, + 233, 234, 234, 235, 235, 236, 236, 237, 237, 238, 238, 239, + 239, 240, 240, 241, 241, 242, 242, 243, 243, 243, 244, 244, + 245, 245, 246, 246 +}; static const unsigned char blue[256] = { - 0, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, - 23, 23, 23, 23, 23, 23, 23, 30, 37, 42, 47, 51, - 55, 58, 61, 64, 67, 70, 72, 74, 78, 80, 82, 84, - 86, 88, 90, 92, 94, 95, 97, 100, 101, 103, 104, 106, - 107, 110, 111, 112, 114, 115, 116, 118, 119, 121, 122, 124, - 125, 126, 127, 128, 129, 132, 133, 134, 135, 136, 137, 138, - 139, 140, 141, 143, 144, 145, 146, 147, 148, 149, 150, 151, - 152, 154, 155, 156, 157, 158, 158, 159, 160, 161, 162, 163, - 165, 166, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174, - 176, 176, 177, 178, 179, 180, 180, 181, 182, 183, 183, 184, - 185, 187, 187, 188, 189, 189, 190, 191, 192, 192, 193, 194, - 194, 195, 196, 196, 198, 199, 200, 200, 201, 202, 202, 203, - 204, 204, 205, 205, 206, 207, 207, 209, 210, 210, 211, 212, - 212, 213, 213, 214, 215, 215, 216, 217, 217, 218, 218, 220, - 221, 221, 222, 222, 223, 224, 224, 225, 225, 226, 226, 227, - 228, 228, 229, 229, 231, 231, 232, 233, 233, 234, 234, 235, - 235, 236, 236, 237, 238, 238, 239, 239, 240, 240, 242, 242, - 243, 243, 244, 244, 245, 246, 246, 247, 247, 248, 248, 249, - 249, 250, 250, 251, 251, 253, 253, 254, 254, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, - 255, 255, 255, 255 -}; + 0, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, + 23, 23, 23, 23, 23, 23, 23, 30, 37, 42, 47, 51, + 55, 58, 61, 64, 67, 70, 72, 74, 78, 80, 82, 84, + 86, 88, 90, 92, 94, 95, 97, 100, 101, 103, 104, 106, + 107, 110, 111, 112, 114, 115, 116, 118, 119, 121, 122, 124, + 125, 126, 127, 128, 129, 132, 133, 134, 135, 136, 137, 138, + 139, 140, 141, 143, 144, 145, 146, 147, 148, 149, 150, 151, + 152, 154, 155, 156, 157, 158, 158, 159, 160, 161, 162, 163, + 165, 166, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174, + 176, 176, 177, 178, 179, 180, 180, 181, 182, 183, 183, 184, + 185, 187, 187, 188, 189, 189, 190, 191, 192, 192, 193, 194, + 194, 195, 196, 196, 198, 199, 200, 200, 201, 202, 202, 203, + 204, 204, 205, 205, 206, 207, 207, 209, 210, 210, 211, 212, + 212, 213, 213, 214, 215, 215, 216, 217, 217, 218, 218, 220, + 221, 221, 222, 222, 223, 224, 224, 225, 225, 226, 226, 227, + 228, 228, 229, 229, 231, 231, 232, 233, 233, 234, 234, 235, + 235, 236, 236, 237, 238, 238, 239, 239, 240, 240, 242, 242, + 243, 243, 244, 244, 245, 246, 246, 247, 247, 248, 248, 249, + 249, 250, 250, 251, 251, 253, 253, 254, 254, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, + 255, 255, 255, 255 +}; diff --git a/drivers/media/video/tda7432.c b/drivers/media/video/tda7432.c index fc3d5824efff..78e043ac9ea0 100644 --- a/drivers/media/video/tda7432.c +++ b/drivers/media/video/tda7432.c @@ -48,9 +48,8 @@ #include <linux/i2c.h> #include <linux/i2c-algo-bit.h> -#include "bttv.h" -#include <media/audiochip.h> #include <media/v4l2-common.h> +#include <media/i2c-addr.h> #ifndef VIDEO_AUDIO_BALANCE # define VIDEO_AUDIO_BALANCE 32 @@ -71,7 +70,7 @@ module_param(maxvol, int, S_IRUGO | S_IWUSR); /* Address to scan (I2C address of this chip) */ static unsigned short normal_i2c[] = { - I2C_TDA7432 >> 1, + I2C_ADDR_TDA7432 >> 1, I2C_CLIENT_END, }; I2C_CLIENT_INSMOD; diff --git a/drivers/media/video/tda9840.c b/drivers/media/video/tda9840.c index 0243700f58ae..ef494febb5e4 100644 --- a/drivers/media/video/tda9840.c +++ b/drivers/media/video/tda9840.c @@ -35,7 +35,7 @@ static int debug = 0; /* insmod parameter */ module_param(debug, int, 0644); MODULE_PARM_DESC(debug, "Turn on/off device debugging (default:off)."); #define dprintk(args...) \ - do { if (debug) { printk("%s: %s()[%d]: ", KBUILD_MODNAME, __FUNCTION__, __LINE__); printk(args); } } while (0) + do { if (debug) { printk("%s: %s()[%d]: ", KBUILD_MODNAME, __FUNCTION__, __LINE__); printk(args); } } while (0) #define SWITCH 0x00 #define LEVEL_ADJUST 0x02 @@ -43,7 +43,7 @@ MODULE_PARM_DESC(debug, "Turn on/off device debugging (default:off)."); #define TEST 0x04 /* addresses to scan, found only at 0x42 (7-Bit) */ -static unsigned short normal_i2c[] = { I2C_TDA9840, I2C_CLIENT_END }; +static unsigned short normal_i2c[] = { I2C_ADDR_TDA9840, I2C_CLIENT_END }; /* magic definition of all other variables and things */ I2C_CLIENT_INSMOD; diff --git a/drivers/media/video/tda9840.h b/drivers/media/video/tda9840.h index 28021053bd09..7da8432cdca7 100644 --- a/drivers/media/video/tda9840.h +++ b/drivers/media/video/tda9840.h @@ -1,7 +1,7 @@ #ifndef __INCLUDED_TDA9840__ #define __INCLUDED_TDA9840__ -#define I2C_TDA9840 0x42 +#define I2C_ADDR_TDA9840 0x42 #define TDA9840_DETECT _IOR('v',1,int) /* return values for TDA9840_DETCT */ diff --git a/drivers/media/video/tda9875.c b/drivers/media/video/tda9875.c index ef98c4982250..103ccb919292 100644 --- a/drivers/media/video/tda9875.c +++ b/drivers/media/video/tda9875.c @@ -30,24 +30,22 @@ #include <linux/i2c-algo-bit.h> #include <linux/init.h> -#include "bttv.h" -#include <media/audiochip.h> + +#include <media/i2c-addr.h> static int debug; /* insmod parameter */ module_param(debug, int, S_IRUGO | S_IWUSR); MODULE_LICENSE("GPL"); - /* Addresses to scan */ static unsigned short normal_i2c[] = { - I2C_TDA9875 >> 1, + I2C_ADDR_TDA9875 >> 1, I2C_CLIENT_END }; I2C_CLIENT_INSMOD; /* This is a superset of the TDA9875 */ struct tda9875 { - int mode; int rvol, lvol; int bass, treble; struct i2c_client c; @@ -197,7 +195,6 @@ static void do_tda9875_init(struct i2c_client *client) tda9875_write(client, TDA9875_MUT, 0xcc ); /* General mute */ - t->mode=AUDIO_UNMUTE; t->lvol=t->rvol =0; /* 0dB */ t->bass=0; /* 0dB */ t->treble=0; /* 0dB */ diff --git a/drivers/media/video/tea6415c.c b/drivers/media/video/tea6415c.c index 774ed0dbc56d..523df0b8cc63 100644 --- a/drivers/media/video/tea6415c.c +++ b/drivers/media/video/tea6415c.c @@ -37,7 +37,7 @@ static int debug = 0; /* insmod parameter */ module_param(debug, int, 0644); MODULE_PARM_DESC(debug, "Turn on/off device debugging (default:off)."); #define dprintk(args...) \ - do { if (debug) { printk("%s: %s()[%d]: ", KBUILD_MODNAME, __FUNCTION__, __LINE__); printk(args); } } while (0) + do { if (debug) { printk("%s: %s()[%d]: ", KBUILD_MODNAME, __FUNCTION__, __LINE__); printk(args); } } while (0) #define TEA6415C_NUM_INPUTS 8 #define TEA6415C_NUM_OUTPUTS 6 diff --git a/drivers/media/video/tea6420.c b/drivers/media/video/tea6420.c index ad7d2872cfbf..e0ff811fab6f 100644 --- a/drivers/media/video/tea6420.c +++ b/drivers/media/video/tea6420.c @@ -37,10 +37,10 @@ static int debug = 0; /* insmod parameter */ module_param(debug, int, 0644); MODULE_PARM_DESC(debug, "Turn on/off device debugging (default:off)."); #define dprintk(args...) \ - do { if (debug) { printk("%s: %s()[%d]: ", KBUILD_MODNAME, __FUNCTION__, __LINE__); printk(args); } } while (0) + do { if (debug) { printk("%s: %s()[%d]: ", KBUILD_MODNAME, __FUNCTION__, __LINE__); printk(args); } } while (0) /* addresses to scan, found only at 0x4c and/or 0x4d (7-Bit) */ -static unsigned short normal_i2c[] = { I2C_TEA6420_1, I2C_TEA6420_2, I2C_CLIENT_END }; +static unsigned short normal_i2c[] = { I2C_ADDR_TEA6420_1, I2C_ADDR_TEA6420_2, I2C_CLIENT_END }; /* magic definition of all other variables and things */ I2C_CLIENT_INSMOD; diff --git a/drivers/media/video/tea6420.h b/drivers/media/video/tea6420.h index ea664df15ad4..5ef7c18e0c54 100644 --- a/drivers/media/video/tea6420.h +++ b/drivers/media/video/tea6420.h @@ -2,8 +2,8 @@ #define __INCLUDED_TEA6420__ /* possible addresses */ -#define I2C_TEA6420_1 0x4c -#define I2C_TEA6420_2 0x4d +#define I2C_ADDR_TEA6420_1 0x4c +#define I2C_ADDR_TEA6420_2 0x4d struct tea6420_multiplex { diff --git a/drivers/media/video/tuner-3036.c b/drivers/media/video/tuner-3036.c index c4a78e7a5a58..74ab48c09c6a 100644 --- a/drivers/media/video/tuner-3036.c +++ b/drivers/media/video/tuner-3036.c @@ -5,7 +5,7 @@ * * The SAB3036 is just about different enough from the chips that * tuner.c copes with to make it not worth the effort to crowbar - * the support into that file. So instead we have a separate driver. + * the support into that file. So instead we have a separate driver. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -56,15 +56,15 @@ tuner_getstatus (struct i2c_client *c) #define TUNER_FL 0x80 -static int +static int tuner_islocked (struct i2c_client *c) { - return (tuner_getstatus(c) & TUNER_FL); + return (tuner_getstatus(c) & TUNER_FL); } /* ---------------------------------------------------------------------- */ -static void +static void set_tv_freq(struct i2c_client *c, int freq) { u16 div = ((freq * 20) / 16); @@ -73,26 +73,26 @@ set_tv_freq(struct i2c_client *c, int freq) if (debug) printk(KERN_DEBUG "tuner: setting frequency %dMHz, divisor %x\n", freq / 16, div); - + /* Select high tuning current */ buffer[0] = 0x29; buffer[1] = 0x3e; if (i2c_master_send(c, buffer, 2) != 2) printk("tuner: i2c i/o error 1\n"); - + buffer[0] = 0x80 | ((div>>8) & 0x7f); buffer[1] = div & 0xff; if (i2c_master_send(c, buffer, 2) != 2) printk("tuner: i2c i/o error 2\n"); - + while (!tuner_islocked(c) && time_before(jiffies, give_up)) schedule(); - + if (!tuner_islocked(c)) printk(KERN_WARNING "tuner: failed to achieve PLL lock\n"); - + /* Select low tuning current and engage AFC */ buffer[0] = 0x29; buffer[1] = 0xb2; @@ -106,7 +106,7 @@ set_tv_freq(struct i2c_client *c, int freq) /* ---------------------------------------------------------------------- */ -static int +static int tuner_attach(struct i2c_adapter *adap, int addr, int kind) { static unsigned char buffer[] = { 0x29, 0x32, 0x2a, 0, 0x2b, 0 }; @@ -116,18 +116,18 @@ tuner_attach(struct i2c_adapter *adap, int addr, int kind) if (this_adap > 0) return -1; this_adap++; - - client_template.adapter = adap; - client_template.addr = addr; + + client_template.adapter = adap; + client_template.addr = addr; client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); - if (client == NULL) - return -ENOMEM; - memcpy(client, &client_template, sizeof(struct i2c_client)); + if (client == NULL) + return -ENOMEM; + memcpy(client, &client_template, sizeof(struct i2c_client)); printk("tuner: SAB3036 found, status %02x\n", tuner_getstatus(client)); - i2c_attach_client(client); + i2c_attach_client(client); if (i2c_master_send(client, buffer, 2) != 2) printk("tuner: i2c i/o error 1\n"); @@ -138,30 +138,30 @@ tuner_attach(struct i2c_adapter *adap, int addr, int kind) return 0; } -static int +static int tuner_detach(struct i2c_client *c) { return 0; } -static int +static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) { int *iarg = (int*)arg; - switch (cmd) + switch (cmd) { case VIDIOCSFREQ: set_tv_freq(client, *iarg); break; - + default: return -EINVAL; } return 0; } -static int +static int tuner_probe(struct i2c_adapter *adap) { this_adap = 0; @@ -172,8 +172,8 @@ tuner_probe(struct i2c_adapter *adap) /* ----------------------------------------------------------------------- */ -static struct i2c_driver -i2c_driver_tuner = +static struct i2c_driver +i2c_driver_tuner = { .driver = { .name = "sab3036", @@ -186,7 +186,7 @@ i2c_driver_tuner = static struct i2c_client client_template = { - .driver = &i2c_driver_tuner, + .driver = &i2c_driver_tuner, .name = "SAB3036", }; diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index 32e1849441fb..df195c905366 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c @@ -21,7 +21,6 @@ #include <media/tuner.h> #include <media/v4l2-common.h> -#include <media/audiochip.h> #define UNSET (-1U) diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c index 4efb01bb44ac..356bff455ad1 100644 --- a/drivers/media/video/tvaudio.c +++ b/drivers/media/video/tvaudio.c @@ -30,10 +30,10 @@ #include <linux/init.h> #include <linux/smp_lock.h> -#include <media/audiochip.h> +#include <media/tvaudio.h> #include <media/v4l2-common.h> -#include "tvaudio.h" +#include <media/i2c-addr.h> /* ---------------------------------------------------------------------- */ /* insmod args */ @@ -102,7 +102,7 @@ struct CHIPDESC { /* input switch register + values for v4l inputs */ int inputreg; - int inputmap[8]; + int inputmap[4]; int inputmute; int inputmask; }; @@ -119,9 +119,10 @@ struct CHIPSTATE { audiocmd shadow; /* current settings */ - __u16 left,right,treble,bass,mode; + __u16 left,right,treble,bass,muted,mode; int prevmode; int radio; + int input; /* thread */ pid_t tpid; @@ -137,14 +138,14 @@ struct CHIPSTATE { /* i2c addresses */ static unsigned short normal_i2c[] = { - I2C_TDA8425 >> 1, - I2C_TEA6300 >> 1, - I2C_TEA6420 >> 1, - I2C_TDA9840 >> 1, - I2C_TDA985x_L >> 1, - I2C_TDA985x_H >> 1, - I2C_TDA9874 >> 1, - I2C_PIC16C54 >> 1, + I2C_ADDR_TDA8425 >> 1, + I2C_ADDR_TEA6300 >> 1, + I2C_ADDR_TEA6420 >> 1, + I2C_ADDR_TDA9840 >> 1, + I2C_ADDR_TDA985x_L >> 1, + I2C_ADDR_TDA985x_H >> 1, + I2C_ADDR_TDA9874 >> 1, + I2C_ADDR_PIC16C54 >> 1, I2C_CLIENT_END }; I2C_CLIENT_INSMOD; @@ -1101,9 +1102,8 @@ static int tda8425_shift12(int val) { return (val >> 12) | 0xf0; } static int tda8425_initialize(struct CHIPSTATE *chip) { struct CHIPDESC *desc = chiplist + chip->type; - int inputmap[8] = { /* tuner */ TDA8425_S1_CH2, /* radio */ TDA8425_S1_CH1, - /* extern */ TDA8425_S1_CH1, /* intern */ TDA8425_S1_OFF, - /* off */ TDA8425_S1_OFF, /* on */ TDA8425_S1_CH2}; + int inputmap[4] = { /* tuner */ TDA8425_S1_CH2, /* radio */ TDA8425_S1_CH1, + /* extern */ TDA8425_S1_CH1, /* intern */ TDA8425_S1_OFF}; if (chip->c.adapter->id == I2C_HW_B_RIVA) { memcpy (desc->inputmap, inputmap, sizeof (inputmap)); @@ -1269,8 +1269,8 @@ static struct CHIPDESC chiplist[] = { .name = "tda9840", .id = I2C_DRIVERID_TDA9840, .insmodopt = &tda9840, - .addr_lo = I2C_TDA9840 >> 1, - .addr_hi = I2C_TDA9840 >> 1, + .addr_lo = I2C_ADDR_TDA9840 >> 1, + .addr_hi = I2C_ADDR_TDA9840 >> 1, .registers = 5, .checkit = tda9840_checkit, @@ -1286,8 +1286,8 @@ static struct CHIPDESC chiplist[] = { .id = I2C_DRIVERID_TDA9873, .checkit = tda9873_checkit, .insmodopt = &tda9873, - .addr_lo = I2C_TDA985x_L >> 1, - .addr_hi = I2C_TDA985x_H >> 1, + .addr_lo = I2C_ADDR_TDA985x_L >> 1, + .addr_hi = I2C_ADDR_TDA985x_H >> 1, .registers = 3, .flags = CHIP_HAS_INPUTSEL, @@ -1298,7 +1298,7 @@ static struct CHIPDESC chiplist[] = { .init = { 4, { TDA9873_SW, 0xa4, 0x06, 0x03 } }, .inputreg = TDA9873_SW, .inputmute = TDA9873_MUTE | TDA9873_AUTOMUTE, - .inputmap = {0xa0, 0xa2, 0xa0, 0xa0, 0xc0}, + .inputmap = {0xa0, 0xa2, 0xa0, 0xa0}, .inputmask = TDA9873_INP_MASK|TDA9873_MUTE|TDA9873_AUTOMUTE, }, @@ -1308,8 +1308,8 @@ static struct CHIPDESC chiplist[] = { .checkit = tda9874a_checkit, .initialize = tda9874a_initialize, .insmodopt = &tda9874a, - .addr_lo = I2C_TDA9874 >> 1, - .addr_hi = I2C_TDA9874 >> 1, + .addr_lo = I2C_ADDR_TDA9874 >> 1, + .addr_hi = I2C_ADDR_TDA9874 >> 1, .getmode = tda9874a_getmode, .setmode = tda9874a_setmode, @@ -1319,8 +1319,8 @@ static struct CHIPDESC chiplist[] = { .name = "tda9850", .id = I2C_DRIVERID_TDA9850, .insmodopt = &tda9850, - .addr_lo = I2C_TDA985x_L >> 1, - .addr_hi = I2C_TDA985x_H >> 1, + .addr_lo = I2C_ADDR_TDA985x_L >> 1, + .addr_hi = I2C_ADDR_TDA985x_H >> 1, .registers = 11, .getmode = tda985x_getmode, @@ -1332,8 +1332,8 @@ static struct CHIPDESC chiplist[] = { .name = "tda9855", .id = I2C_DRIVERID_TDA9855, .insmodopt = &tda9855, - .addr_lo = I2C_TDA985x_L >> 1, - .addr_hi = I2C_TDA985x_H >> 1, + .addr_lo = I2C_ADDR_TDA985x_L >> 1, + .addr_hi = I2C_ADDR_TDA985x_H >> 1, .registers = 11, .flags = CHIP_HAS_VOLUME | CHIP_HAS_BASSTREBLE, @@ -1357,8 +1357,8 @@ static struct CHIPDESC chiplist[] = { .name = "tea6300", .id = I2C_DRIVERID_TEA6300, .insmodopt = &tea6300, - .addr_lo = I2C_TEA6300 >> 1, - .addr_hi = I2C_TEA6300 >> 1, + .addr_lo = I2C_ADDR_TEA6300 >> 1, + .addr_hi = I2C_ADDR_TEA6300 >> 1, .registers = 6, .flags = CHIP_HAS_VOLUME | CHIP_HAS_BASSTREBLE | CHIP_HAS_INPUTSEL, @@ -1379,8 +1379,8 @@ static struct CHIPDESC chiplist[] = { .id = I2C_DRIVERID_TEA6300, .initialize = tea6320_initialize, .insmodopt = &tea6320, - .addr_lo = I2C_TEA6300 >> 1, - .addr_hi = I2C_TEA6300 >> 1, + .addr_lo = I2C_ADDR_TEA6300 >> 1, + .addr_hi = I2C_ADDR_TEA6300 >> 1, .registers = 8, .flags = CHIP_HAS_VOLUME | CHIP_HAS_BASSTREBLE | CHIP_HAS_INPUTSEL, @@ -1400,8 +1400,8 @@ static struct CHIPDESC chiplist[] = { .name = "tea6420", .id = I2C_DRIVERID_TEA6420, .insmodopt = &tea6420, - .addr_lo = I2C_TEA6420 >> 1, - .addr_hi = I2C_TEA6420 >> 1, + .addr_lo = I2C_ADDR_TEA6420 >> 1, + .addr_hi = I2C_ADDR_TEA6420 >> 1, .registers = 1, .flags = CHIP_HAS_INPUTSEL, @@ -1413,8 +1413,8 @@ static struct CHIPDESC chiplist[] = { .name = "tda8425", .id = I2C_DRIVERID_TDA8425, .insmodopt = &tda8425, - .addr_lo = I2C_TDA8425 >> 1, - .addr_hi = I2C_TDA8425 >> 1, + .addr_lo = I2C_ADDR_TDA8425 >> 1, + .addr_hi = I2C_ADDR_TDA8425 >> 1, .registers = 9, .flags = CHIP_HAS_VOLUME | CHIP_HAS_BASSTREBLE | CHIP_HAS_INPUTSEL, @@ -1437,8 +1437,8 @@ static struct CHIPDESC chiplist[] = { .name = "pic16c54 (PV951)", .id = I2C_DRIVERID_PIC16C54_PV9, .insmodopt = &pic16c54, - .addr_lo = I2C_PIC16C54 >> 1, - .addr_hi = I2C_PIC16C54>> 1, + .addr_lo = I2C_ADDR_PIC16C54 >> 1, + .addr_hi = I2C_ADDR_PIC16C54>> 1, .registers = 2, .flags = CHIP_HAS_INPUTSEL, @@ -1446,8 +1446,7 @@ static struct CHIPDESC chiplist[] = { .inputmap = {PIC16C54_MISC_SND_NOTMUTE|PIC16C54_MISC_SWITCH_TUNER, PIC16C54_MISC_SND_NOTMUTE|PIC16C54_MISC_SWITCH_LINE, PIC16C54_MISC_SND_NOTMUTE|PIC16C54_MISC_SWITCH_LINE, - PIC16C54_MISC_SND_MUTE,PIC16C54_MISC_SND_MUTE, - PIC16C54_MISC_SND_NOTMUTE}, + PIC16C54_MISC_SND_MUTE}, .inputmute = PIC16C54_MISC_SND_MUTE, }, { @@ -1456,8 +1455,8 @@ static struct CHIPDESC chiplist[] = { /*.id = I2C_DRIVERID_TA8874Z, */ .checkit = ta8874z_checkit, .insmodopt = &ta8874z, - .addr_lo = I2C_TDA9840 >> 1, - .addr_hi = I2C_TDA9840 >> 1, + .addr_lo = I2C_ADDR_TDA9840 >> 1, + .addr_hi = I2C_ADDR_TDA9840 >> 1, .registers = 2, .getmode = ta8874z_getmode, @@ -1583,28 +1582,40 @@ static int chip_detach(struct i2c_client *client) return 0; } +static int tvaudio_set_ctrl(struct CHIPSTATE *chip, struct v4l2_control *ctrl) +{ + struct CHIPDESC *desc = chiplist + chip->type; + + switch (ctrl->id) { + case V4L2_CID_AUDIO_MUTE: + if (ctrl->value < 0 || ctrl->value >= 2) + return -ERANGE; + chip->muted = ctrl->value; + if (chip->muted) + chip_write_masked(chip,desc->inputreg,desc->inputmute,desc->inputmask); + else + chip_write_masked(chip,desc->inputreg, + desc->inputmap[chip->input],desc->inputmask); + break; + default: + return -EINVAL; + } + return 0; +} + + /* ---------------------------------------------------------------------- */ /* video4linux interface */ static int chip_command(struct i2c_client *client, unsigned int cmd, void *arg) { - __u16 *sarg = arg; struct CHIPSTATE *chip = i2c_get_clientdata(client); struct CHIPDESC *desc = chiplist + chip->type; v4l_dbg(1, debug, &chip->c, "%s: chip_command 0x%x\n", chip->c.name, cmd); switch (cmd) { - case AUDC_SET_INPUT: - if (desc->flags & CHIP_HAS_INPUTSEL) { - if (*sarg & 0x80) - chip_write_masked(chip,desc->inputreg,desc->inputmute,desc->inputmask); - else - chip_write_masked(chip,desc->inputreg,desc->inputmap[*sarg],desc->inputmask); - } - break; - case AUDC_SET_RADIO: chip->radio = 1; chip->watch_stereo = 0; @@ -1668,6 +1679,48 @@ static int chip_command(struct i2c_client *client, break; } + case VIDIOC_S_CTRL: + return tvaudio_set_ctrl(chip, arg); + + case VIDIOC_INT_G_AUDIO_ROUTING: + { + struct v4l2_routing *rt = arg; + + rt->input = chip->input; + rt->output = 0; + break; + } + + case VIDIOC_INT_S_AUDIO_ROUTING: + { + struct v4l2_routing *rt = arg; + + if (!(desc->flags & CHIP_HAS_INPUTSEL) || rt->input >= 4) + return -EINVAL; + /* There are four inputs: tuner, radio, extern and intern. */ + chip->input = rt->input; + if (chip->muted) + break; + chip_write_masked(chip, desc->inputreg, + desc->inputmap[chip->input], desc->inputmask); + break; + } + + case VIDIOC_S_AUDIO: + { + struct v4l2_audio *sarg = arg; + + if (!(desc->flags & CHIP_HAS_INPUTSEL) || sarg->index >= 4) + return -EINVAL; + /* There are four inputs: tuner, radio, extern and intern. */ + chip->input = sarg->index; + if (chip->muted) + break; + chip_write_masked(chip, desc->inputreg, + desc->inputmap[chip->input], desc->inputmask); + break; + } + case VIDIOC_S_TUNER: { struct v4l2_tuner *vt = arg; @@ -1680,6 +1733,7 @@ static int chip_command(struct i2c_client *client, mode = VIDEO_SOUND_MONO; break; case V4L2_TUNER_MODE_STEREO: + case V4L2_TUNER_MODE_LANG1_LANG2: mode = VIDEO_SOUND_STEREO; break; case V4L2_TUNER_MODE_LANG1: diff --git a/drivers/media/video/tvaudio.h b/drivers/media/video/tvaudio.h deleted file mode 100644 index af7e116af9a9..000000000000 --- a/drivers/media/video/tvaudio.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * i2c bus addresses for the chips supported by tvaudio.c - */ - -#define I2C_TDA8425 0x82 -#define I2C_TDA9840 0x84 /* also used by TA8874Z */ -#define I2C_TDA985x_L 0xb4 /* also used by 9873 */ -#define I2C_TDA985x_H 0xb6 -#define I2C_TDA9874 0xb0 /* also used by 9875 */ - -#define I2C_TEA6300 0x80 /* also used by 6320 */ -#define I2C_TEA6420 0x98 - -#define I2C_PIC16C54 0x96 /* PV951 */ diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c index 582551b0969b..e0d2ff83fc91 100644 --- a/drivers/media/video/tveeprom.c +++ b/drivers/media/video/tveeprom.c @@ -248,32 +248,32 @@ audioIC[] = {AUDIO_CHIP_MSP34XX, "MSP3410D"}, {AUDIO_CHIP_MSP34XX, "MSP3415"}, {AUDIO_CHIP_MSP34XX, "MSP3430"}, - {AUDIO_CHIP_UNKNOWN, "MSP3438"}, + {AUDIO_CHIP_MSP34XX, "MSP3438"}, {AUDIO_CHIP_UNKNOWN, "CS5331"}, /* 10-14 */ {AUDIO_CHIP_MSP34XX, "MSP3435"}, {AUDIO_CHIP_MSP34XX, "MSP3440"}, {AUDIO_CHIP_MSP34XX, "MSP3445"}, - {AUDIO_CHIP_UNKNOWN, "MSP3411"}, - {AUDIO_CHIP_UNKNOWN, "MSP3416"}, + {AUDIO_CHIP_MSP34XX, "MSP3411"}, + {AUDIO_CHIP_MSP34XX, "MSP3416"}, /* 15-19 */ {AUDIO_CHIP_MSP34XX, "MSP3425"}, - {AUDIO_CHIP_UNKNOWN, "MSP3451"}, - {AUDIO_CHIP_UNKNOWN, "MSP3418"}, + {AUDIO_CHIP_MSP34XX, "MSP3451"}, + {AUDIO_CHIP_MSP34XX, "MSP3418"}, {AUDIO_CHIP_UNKNOWN, "Type 0x12"}, {AUDIO_CHIP_UNKNOWN, "OKI7716"}, /* 20-24 */ - {AUDIO_CHIP_UNKNOWN, "MSP4410"}, - {AUDIO_CHIP_UNKNOWN, "MSP4420"}, - {AUDIO_CHIP_UNKNOWN, "MSP4440"}, - {AUDIO_CHIP_UNKNOWN, "MSP4450"}, - {AUDIO_CHIP_UNKNOWN, "MSP4408"}, + {AUDIO_CHIP_MSP34XX, "MSP4410"}, + {AUDIO_CHIP_MSP34XX, "MSP4420"}, + {AUDIO_CHIP_MSP34XX, "MSP4440"}, + {AUDIO_CHIP_MSP34XX, "MSP4450"}, + {AUDIO_CHIP_MSP34XX, "MSP4408"}, /* 25-29 */ - {AUDIO_CHIP_UNKNOWN, "MSP4418"}, - {AUDIO_CHIP_UNKNOWN, "MSP4428"}, - {AUDIO_CHIP_UNKNOWN, "MSP4448"}, - {AUDIO_CHIP_UNKNOWN, "MSP4458"}, - {AUDIO_CHIP_UNKNOWN, "Type 0x1d"}, + {AUDIO_CHIP_MSP34XX, "MSP4418"}, + {AUDIO_CHIP_MSP34XX, "MSP4428"}, + {AUDIO_CHIP_MSP34XX, "MSP4448"}, + {AUDIO_CHIP_MSP34XX, "MSP4458"}, + {AUDIO_CHIP_MSP34XX, "Type 0x1d"}, /* 30-34 */ {AUDIO_CHIP_INTERNAL, "CX880"}, {AUDIO_CHIP_INTERNAL, "CX881"}, diff --git a/drivers/media/video/usbvideo/Makefile b/drivers/media/video/usbvideo/Makefile new file mode 100644 index 000000000000..ed410a5ee8c9 --- /dev/null +++ b/drivers/media/video/usbvideo/Makefile @@ -0,0 +1,4 @@ +obj-$(CONFIG_USB_IBMCAM) += ibmcam.o usbvideo.o ultracam.o +obj-$(CONFIG_USB_KONICAWC) += konicawc.o usbvideo.o +obj-$(CONFIG_USB_VICAM) += vicam.o usbvideo.o + diff --git a/drivers/usb/media/ibmcam.c b/drivers/media/video/usbvideo/ibmcam.c index a42c22294124..76f771b6a32f 100644 --- a/drivers/usb/media/ibmcam.c +++ b/drivers/media/video/usbvideo/ibmcam.c @@ -1300,11 +1300,11 @@ static void ibmcam_model2_Packet1(struct uvd *uvd, unsigned short v1, unsigned s /* * ibmcam_model3_Packet1() * - * 00_0078_012d + * 00_0078_012d * 00_0097_012f - * 00_d141_0124 + * 00_d141_0124 * 00_0096_0127 - * 00_fea8_0124 + * 00_fea8_0124 */ static void ibmcam_model3_Packet1(struct uvd *uvd, unsigned short v1, unsigned short v2) { @@ -2687,7 +2687,7 @@ static void ibmcam_model4_setup_after_video_if(struct uvd *uvd) ibmcam_veio(uvd, 0, 0x0004, 0x0127); ibmcam_veio(uvd, 0, 0xfea8, 0x0124); ibmcam_veio(uvd, 0, 0x00c0, 0x010c); - break; + break; } usb_clear_halt(uvd->dev, usb_rcvisocpipe(uvd->dev, uvd->video_endp)); } @@ -3238,7 +3238,7 @@ static void ibmcam_model3_setup_after_video_if(struct uvd *uvd) {0, 0x0062, 0x0107}, {0, 0x0003, 0x0111}, }; -#define NUM_INIT_DATA +#define NUM_INIT_DATA unsigned short compression = 0; /* 0=none, 7=best frame rate */ int f_rate; /* 0=Fastest 7=slowest */ diff --git a/drivers/usb/media/konicawc.c b/drivers/media/video/usbvideo/konicawc.c index e2ede583518f..c11f5d46b114 100644 --- a/drivers/usb/media/konicawc.c +++ b/drivers/media/video/usbvideo/konicawc.c @@ -36,7 +36,7 @@ enum ctrl_req { SetWhitebal = 0x01, SetBrightness = 0x02, - SetSharpness = 0x03, + SetSharpness = 0x03, SetContrast = 0x04, SetSaturation = 0x05, }; @@ -47,7 +47,7 @@ enum frame_sizes { SIZE_160X136 = 1, SIZE_176X144 = 2, SIZE_320X240 = 3, - + }; #define MAX_FRAME_SIZE SIZE_320X240 @@ -69,7 +69,7 @@ static const int debug = 0; /* Some default values for initial camera settings, can be set by modprobe */ -static int size; +static int size; static int speed = 6; /* Speed (fps) 0 (slowest) to 6 (fastest) */ static int brightness = MAX_BRIGHTNESS/2; static int contrast = MAX_CONTRAST/2; @@ -132,24 +132,24 @@ struct konicawc { static int konicawc_ctrl_msg(struct uvd *uvd, u8 dir, u8 request, u16 value, u16 index, void *buf, int len) { - int retval = usb_control_msg(uvd->dev, + int retval = usb_control_msg(uvd->dev, dir ? usb_rcvctrlpipe(uvd->dev, 0) : usb_sndctrlpipe(uvd->dev, 0), request, 0x40 | dir, value, index, buf, len, 1000); - return retval < 0 ? retval : 0; + return retval < 0 ? retval : 0; } static inline void konicawc_camera_on(struct uvd *uvd) { - DEBUG(0, "camera on"); - konicawc_set_misc(uvd, 0x2, 1, 0x0b); + DEBUG(0, "camera on"); + konicawc_set_misc(uvd, 0x2, 1, 0x0b); } static inline void konicawc_camera_off(struct uvd *uvd) { - DEBUG(0, "camera off"); - konicawc_set_misc(uvd, 0x2, 0, 0x0b); + DEBUG(0, "camera off"); + konicawc_set_misc(uvd, 0x2, 0, 0x0b); } @@ -317,7 +317,7 @@ static int konicawc_compress_iso(struct uvd *uvd, struct urb *dataurb, struct ur button = !!(sts & 0x40); sts &= ~0x40; } - + /* work out the button status, but don't do anything with it for now */ @@ -331,7 +331,7 @@ static int konicawc_compress_iso(struct uvd *uvd, struct urb *dataurb, struct ur discard++; continue; } - + if((sts > 0x01) && (sts < 0x80)) { info("unknown status %2.2x", sts); bad++; @@ -350,7 +350,7 @@ static int konicawc_compress_iso(struct uvd *uvd, struct urb *dataurb, struct ur DEBUG(2, "found initial image"); cam->lastframe = -1; } - + marker[3] = sts & 0x7F; RingQueue_Enqueue(&uvd->dp, marker, 4); totlen += 4; @@ -367,16 +367,16 @@ static int konicawc_compress_iso(struct uvd *uvd, struct urb *dataurb, struct ur static void resubmit_urb(struct uvd *uvd, struct urb *urb) { - int i, ret; - for (i = 0; i < FRAMES_PER_DESC; i++) { - urb->iso_frame_desc[i].status = 0; - } - urb->dev = uvd->dev; - urb->status = 0; + int i, ret; + for (i = 0; i < FRAMES_PER_DESC; i++) { + urb->iso_frame_desc[i].status = 0; + } + urb->dev = uvd->dev; + urb->status = 0; ret = usb_submit_urb(urb, GFP_ATOMIC); DEBUG(3, "submitting urb of length %d", urb->transfer_buffer_length); - if(ret) - err("usb_submit_urb error (%d)", ret); + if(ret) + err("usb_submit_urb error (%d)", ret); } @@ -490,7 +490,7 @@ static int konicawc_start_data(struct uvd *uvd) } cam->last_data_urb = NULL; - + /* Submit all URBs */ for (i=0; i < USBVIDEO_NUMSBUF; i++) { errFlag = usb_submit_urb(cam->sts_urb[i], GFP_KERNEL); @@ -539,7 +539,7 @@ static void konicawc_stop_data(struct uvd *uvd) static void konicawc_process_isoc(struct uvd *uvd, struct usbvideo_frame *frame) -{ +{ struct konicawc *cam = (struct konicawc *)uvd->user_data; int maxline = cam->maxline; int yplanesz = cam->yplanesz; @@ -583,13 +583,13 @@ static void konicawc_process_isoc(struct uvd *uvd, struct usbvideo_frame *frame) if(frame->scanstate == ScanState_Scanning) return; - + /* Try to move data from queue into frame buffer * We get data in blocks of 384 bytes made up of: * 256 Y, 64 U, 64 V. * This needs to be written out as a Y plane, a U plane and a V plane. */ - + while ( frame->curline < maxline && (RingQueue_GetLength(&uvd->dp) >= 384)) { /* Y */ RingQueue_Dequeue(&uvd->dp, frame->data + (frame->curline * 256), 256); diff --git a/drivers/usb/media/ultracam.c b/drivers/media/video/usbvideo/ultracam.c index 75ff755224df..10c58b4a2e5b 100644 --- a/drivers/usb/media/ultracam.c +++ b/drivers/media/video/usbvideo/ultracam.c @@ -23,7 +23,7 @@ typedef struct { int initialized; /* Had we already sent init sequence? */ int camera_model; /* What type of IBM camera we got? */ - int has_hdr; + int has_hdr; } ultracam_t; #define ULTRACAM_T(uvd) ((ultracam_t *)((uvd)->user_data)) diff --git a/drivers/usb/media/usbvideo.c b/drivers/media/video/usbvideo/usbvideo.c index 0b51fae720a9..13b37c8c0d56 100644 --- a/drivers/usb/media/usbvideo.c +++ b/drivers/media/video/usbvideo/usbvideo.c @@ -574,7 +574,7 @@ void usbvideo_TestPattern(struct uvd *uvd, int fullframe, int pmode) } else { /* Just the blue screen */ } - + *f++ = cb; *f++ = cg; *f++ = cr; @@ -1243,7 +1243,7 @@ static int usbvideo_v4l_close(struct inode *inode, struct file *file) #if USBVIDEO_REPORT_STATS usbvideo_ReportStatistics(uvd); -#endif +#endif uvd->user--; if (uvd->remove_pending) { @@ -1290,7 +1290,7 @@ static int usbvideo_v4l_do_ioctl(struct inode *inode, struct file *file, return 0; } case VIDIOCSCHAN: - { + { struct video_channel *v = arg; if (v->channel != 0) return -EINVAL; @@ -1347,7 +1347,7 @@ static int usbvideo_v4l_do_ioctl(struct inode *inode, struct file *file, vw->chromakey = 0; if (VALID_CALLBACK(uvd, getFPS)) vw->flags = GET_CALLBACK(uvd, getFPS)(uvd); - else + else vw->flags = 10; /* FIXME: do better! */ return 0; } @@ -1359,7 +1359,7 @@ static int usbvideo_v4l_do_ioctl(struct inode *inode, struct file *file, memset(vm, 0, sizeof(*vm)); vm->size = uvd->max_frame_size * USBVIDEO_NUMFRAMES; vm->frames = USBVIDEO_NUMFRAMES; - for(i = 0; i < USBVIDEO_NUMFRAMES; i++) + for(i = 0; i < USBVIDEO_NUMFRAMES; i++) vm->offsets[i] = i * uvd->max_frame_size; return 0; @@ -1425,7 +1425,7 @@ static int usbvideo_v4l_do_ioctl(struct inode *inode, struct file *file, if (*frameNum < 0 || *frameNum >= USBVIDEO_NUMFRAMES) return -EINVAL; - + if (uvd->debug >= 1) info("VIDIOCSYNC: syncing to frame %d.", *frameNum); if (uvd->flags & FLAGS_NO_DECODING) @@ -1454,8 +1454,8 @@ static int usbvideo_v4l_do_ioctl(struct inode *inode, struct file *file, struct video_buffer *vb = arg; memset(vb, 0, sizeof(*vb)); - return 0; - } + return 0; + } case VIDIOCKEY: return 0; @@ -1704,7 +1704,7 @@ static void usbvideo_IsocIrq(struct urb *urb, struct pt_regs *regs) info("Not streaming, but interrupt!"); return; } - + uvd->stats.urb_count++; if (urb->actual_length <= 0) goto urb_done_with; @@ -1763,7 +1763,7 @@ static int usbvideo_StartDataPump(struct uvd *uvd) } if (VALID_CALLBACK(uvd, videoStart)) GET_CALLBACK(uvd, videoStart)(uvd); - else + else err("%s: videoStart not set", __FUNCTION__); /* We double buffer the Iso lists */ @@ -1830,7 +1830,7 @@ static void usbvideo_StopDataPump(struct uvd *uvd) /* Invoke minidriver's magic to stop the camera */ if (VALID_CALLBACK(uvd, videoStop)) GET_CALLBACK(uvd, videoStop)(uvd); - else + else err("%s: videoStop not set", __FUNCTION__); /* Set packet size to 0 */ @@ -1963,14 +1963,14 @@ static int usbvideo_GetFrame(struct uvd *uvd, int frameNum) info("%s($%p,%d.)", __FUNCTION__, uvd, frameNum); switch (frame->frameState) { - case FrameState_Unused: + case FrameState_Unused: if (uvd->debug >= 2) info("%s: FrameState_Unused", __FUNCTION__); return -EINVAL; - case FrameState_Ready: - case FrameState_Grabbing: - case FrameState_Error: - { + case FrameState_Ready: + case FrameState_Grabbing: + case FrameState_Error: + { int ntries, signalPending; redo: if (!CAMERA_IS_OPERATIONAL(uvd)) { @@ -1978,7 +1978,7 @@ static int usbvideo_GetFrame(struct uvd *uvd, int frameNum) info("%s: Camera is not operational (1)", __FUNCTION__); return -EIO; } - ntries = 0; + ntries = 0; do { RingQueue_InterruptibleSleepOn(&uvd->dp); signalPending = signal_pending(current); @@ -2010,7 +2010,7 @@ static int usbvideo_GetFrame(struct uvd *uvd, int frameNum) usbvideo_CollectRawData(uvd, frame); else if (VALID_CALLBACK(uvd, processData)) GET_CALLBACK(uvd, processData)(uvd, frame); - else + else err("%s: processData not set", __FUNCTION__); } } while (frame->frameState == FrameState_Grabbing); @@ -2027,8 +2027,8 @@ static int usbvideo_GetFrame(struct uvd *uvd, int frameNum) goto redo; } /* Note that we fall through to meet our destiny below */ - } - case FrameState_Done: + } + case FrameState_Done: /* * Do all necessary postprocessing of data prepared in * "interrupt" code and the collecting code above. The @@ -2157,7 +2157,7 @@ EXPORT_SYMBOL(usbvideo_DeinterlaceFrame); * History: * 09-Feb-2001 Created. */ -static void usbvideo_SoftwareContrastAdjustment(struct uvd *uvd, +static void usbvideo_SoftwareContrastAdjustment(struct uvd *uvd, struct usbvideo_frame *frame) { int i, j, v4l_linesize; diff --git a/drivers/usb/media/usbvideo.h b/drivers/media/video/usbvideo/usbvideo.h index 135433c2680a..3cbf4fc499a3 100644 --- a/drivers/usb/media/usbvideo.h +++ b/drivers/media/video/usbvideo/usbvideo.h @@ -189,11 +189,11 @@ struct usbvideo_frame { /* Statistics that can be overlaid on screen */ struct usbvideo_statistics { - unsigned long frame_num; /* Sequential number of the frame */ - unsigned long urb_count; /* How many URBs we received so far */ - unsigned long urb_length; /* Length of last URB */ - unsigned long data_count; /* How many bytes we received */ - unsigned long header_count; /* How many frame headers we found */ + unsigned long frame_num; /* Sequential number of the frame */ + unsigned long urb_count; /* How many URBs we received so far */ + unsigned long urb_length; /* Length of last URB */ + unsigned long data_count; /* How many bytes we received */ + unsigned long header_count; /* How many frame headers we found */ unsigned long iso_skip_count; /* How many empty ISO packets received */ unsigned long iso_err_count; /* How many bad ISO packets received */ }; diff --git a/drivers/usb/media/vicam.c b/drivers/media/video/usbvideo/vicam.c index 1d06e53ec7c5..90d48e8510ba 100644 --- a/drivers/usb/media/vicam.c +++ b/drivers/media/video/usbvideo/vicam.c @@ -69,10 +69,10 @@ #define VICAM_HEADER_SIZE 64 #define clamp( x, l, h ) max_t( __typeof__( x ), \ - ( l ), \ - min_t( __typeof__( x ), \ - ( h ), \ - ( x ) ) ) + ( l ), \ + min_t( __typeof__( x ), \ + ( h ), \ + ( x ) ) ) /* Not sure what all the bytes in these char * arrays do, but they're necessary to make @@ -357,7 +357,7 @@ static unsigned char setup5[] = { * Not sure why these are not yet non-statics which I can reference through * usbvideo.h the same as it is in 2.4.20. I bet this will get fixed sometime * in the future. - * + * */ static void *rvmalloc(unsigned long size) { @@ -603,12 +603,12 @@ vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsign case VIDIOCSPICT: { struct video_picture vp; - + if (copy_from_user(&vp, user_arg, sizeof(vp))) { retval = -EFAULT; break; } - + DBG("VIDIOCSPICT depth = %d, pal = %d\n", vp.depth, vp.palette); @@ -655,7 +655,7 @@ vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsign } DBG("VIDIOCSWIN %d x %d\n", vw.width, vw.height); - + if ( vw.width != 320 || vw.height != 240 ) retval = -EFAULT; @@ -809,12 +809,12 @@ vicam_open(struct inode *inode, struct file *file) cam->needsDummyRead = 1; cam->open_count++; - file->private_data = cam; - + file->private_data = cam; + return 0; } -static int +static int vicam_close(struct inode *inode, struct file *file) { struct vicam_camera *cam = file->private_data; @@ -1187,7 +1187,7 @@ vicam_create_proc_entry(struct vicam_camera *cam) if ( !cam->proc_dir ) return; // FIXME: We should probably return an error here - + ent = create_proc_entry("shutter", S_IFREG | S_IRUGO | S_IWUSR, cam->proc_dir); if (ent) { @@ -1282,7 +1282,7 @@ vicam_probe( struct usb_interface *intf, const struct usb_device_id *id) const struct usb_host_interface *interface; const struct usb_endpoint_descriptor *endpoint; struct vicam_camera *cam; - + printk(KERN_INFO "ViCam based webcam connected\n"); interface = intf->cur_altsetting; @@ -1331,7 +1331,7 @@ vicam_probe( struct usb_interface *intf, const struct usb_device_id *id) printk(KERN_INFO "ViCam webcam driver now controlling video device %d\n",cam->vdev.minor); usb_set_intfdata (intf, cam); - + return 0; } diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c index 95a6e47c99f1..11a97f30b876 100644 --- a/drivers/media/video/v4l2-common.c +++ b/drivers/media/video/v4l2-common.c @@ -312,8 +312,6 @@ static const char *v4l2_int_ioctls[] = { [_IOC_NR(DECODER_DUMP)] = "DECODER_DUMP", #endif [_IOC_NR(AUDC_SET_RADIO)] = "AUDC_SET_RADIO", - [_IOC_NR(AUDC_SET_INPUT)] = "AUDC_SET_INPUT", - [_IOC_NR(MSP_SET_MATRIX)] = "MSP_SET_MATRIX", [_IOC_NR(TUNER_SET_TYPE_ADDR)] = "TUNER_SET_TYPE_ADDR", [_IOC_NR(TUNER_SET_STANDBY)] = "TUNER_SET_STANDBY", @@ -419,7 +417,6 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) case TUNER_SET_TYPE_ADDR: case TUNER_SET_STANDBY: case TDA9887_SET_CONFIG: - case AUDC_SET_INPUT: case VIDIOC_OVERLAY_OLD: case VIDIOC_STREAMOFF: case VIDIOC_G_OUTPUT: @@ -433,12 +430,6 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) printk ("%s: value=%d\n", s, *p); break; } - case MSP_SET_MATRIX: - { - struct msp_matrix *p=arg; - printk ("%s: input=%d, output=%d\n", s, p->input, p->output); - break; - } case VIDIOC_G_AUDIO: case VIDIOC_S_AUDIO: case VIDIOC_ENUMAUDIO: @@ -467,7 +458,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) struct v4l2_buffer *p=arg; struct v4l2_timecode *tc=&p->timecode; printk ("%s: %02ld:%02d:%02d.%08ld index=%d, type=%s, " - "bytesused=%d, flags=0x%08d, " + "bytesused=%d, flags=0x%08x, " "field=%0d, sequence=%d, memory=%s, offset/userptr=0x%08lx\n", s, (p->timestamp.tv_sec/3600), @@ -481,16 +472,16 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) prt_names(p->memory,v4l2_memory_names), p->m.userptr); printk ("%s: timecode= %02d:%02d:%02d type=%d, " - "flags=0x%08d, frames=%d, userbits=0x%08x", + "flags=0x%08x, frames=%d, userbits=0x%p\n", s,tc->hours,tc->minutes,tc->seconds, - tc->type, tc->flags, tc->frames, (__u32) tc->userbits); + tc->type, tc->flags, tc->frames, tc->userbits); break; } case VIDIOC_QUERYCAP: { struct v4l2_capability *p=arg; - printk ("%s: driver=%s, card=%s, bus=%s, version=%d, " - "capabilities=%d\n", s, + printk ("%s: driver=%s, card=%s, bus=%s, version=0x%08x, " + "capabilities=0x%08x\n", s, p->driver,p->card,p->bus_info, p->version, p->capabilities); @@ -574,9 +565,10 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) { struct v4l2_input *p=arg; printk ("%s: index=%d, name=%s, type=%d, audioset=%d, " - "tuner=%d, std=%lld, status=%d\n", s, + "tuner=%d, std=%Ld, status=%d\n", s, p->index,p->name,p->type,p->audioset, - p->tuner,p->std, + p->tuner, + (unsigned long long)p->std, p->status); break; } @@ -620,9 +612,10 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) { struct v4l2_output *p=arg; printk ("%s: index=%d, name=%s,type=%d, audioset=%d, " - "modulator=%d, std=%lld\n", + "modulator=%d, std=%Ld\n", s,p->index,p->name,p->type,p->audioset, - p->modulator,p->std); + p->modulator, + (unsigned long long)p->std); break; } case VIDIOC_QUERYCTRL: @@ -665,7 +658,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) case VIDIOC_INT_G_VIDEO_ROUTING: { struct v4l2_routing *p=arg; - printk ("%s: input=%d, output=%d\n", s, p->input, p->output); + printk ("%s: input=0x%x, output=0x%x\n", s, p->input, p->output); break; } case VIDIOC_G_SLICED_VBI_CAP: @@ -686,8 +679,9 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) case VIDIOC_ENUMSTD: { struct v4l2_standard *p=arg; - printk ("%s: index=%d, id=%lld, name=%s, fps=%d/%d, framelines=%d\n", s, - p->index, p->id, p->name, + printk ("%s: index=%d, id=%Ld, name=%s, fps=%d/%d, " + "framelines=%d\n", s, p->index, + (unsigned long long)p->id, p->name, p->frameperiod.numerator, p->frameperiod.denominator, p->framelines); @@ -907,7 +901,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) { v4l2_std_id *p=arg; - printk ("%s: value=%llu\n", s, *p); + printk ("%s: value=%Lu\n", s, (unsigned long long)*p); break; } } diff --git a/drivers/media/video/video-buf.c b/drivers/media/video/video-buf.c index 87e937581d5a..d2ca0f08d0df 100644 --- a/drivers/media/video/video-buf.c +++ b/drivers/media/video/video-buf.c @@ -1,15 +1,20 @@ /* * * generic helper functions for video4linux capture buffers, to handle - * memory management and PCI DMA. Right now bttv + saa7134 use it. + * memory management and PCI DMA. + * Right now, bttv, saa7134, saa7146 and cx88 use it. * * The functions expect the hardware being able to scatter gatter * (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 (thus it is probably not useful for USB 1.1 - * as data often must be uncompressed by the drivers). + * to touch the video data. + * + * device specific map/unmap/sync stuff now are mapped as operations + * to allow its usage by USB and virtual devices. * * (c) 2001-2004 Gerd Knorr <kraxel@bytesex.org> [SUSE Labs] + * (c) 2006 Mauro Carvalho Chehab <mchehab@infradead.org> + * (c) 2006 Ted Walther and John Sokol * * 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 @@ -167,6 +172,9 @@ int videobuf_dma_init_kernel(struct videobuf_dmabuf *dma, int direction, dprintk(1,"vmalloc_32(%d pages) failed\n",nr_pages); return -ENOMEM; } + dprintk(1,"vmalloc is at addr 0x%08lx, size=%d\n", + (unsigned long)dma->vmalloc, + nr_pages << PAGE_SHIFT); memset(dma->vmalloc,0,nr_pages << PAGE_SHIFT); dma->nr_pages = nr_pages; return 0; @@ -186,8 +194,10 @@ int videobuf_dma_init_overlay(struct videobuf_dmabuf *dma, int direction, return 0; } -int videobuf_dma_pci_map(struct pci_dev *dev, struct videobuf_dmabuf *dma) +int videobuf_dma_map(struct videobuf_queue* q,struct videobuf_dmabuf *dma) { + void *dev=q->dev; + MAGIC_CHECK(dma->magic,MAGIC_DMABUF); BUG_ON(0 == dma->nr_pages); @@ -197,7 +207,7 @@ int videobuf_dma_pci_map(struct pci_dev *dev, struct videobuf_dmabuf *dma) } if (dma->vmalloc) { dma->sglist = videobuf_vmalloc_to_sg - (dma->vmalloc,dma->nr_pages); + (dma->vmalloc,dma->nr_pages); } if (dma->bus_addr) { dma->sglist = kmalloc(sizeof(struct scatterlist), GFP_KERNEL); @@ -212,13 +222,14 @@ int videobuf_dma_pci_map(struct pci_dev *dev, struct videobuf_dmabuf *dma) dprintk(1,"scatterlist is NULL\n"); return -ENOMEM; } - if (!dma->bus_addr) { - dma->sglen = pci_map_sg(dev,dma->sglist,dma->nr_pages, - dma->direction); + if (q->ops->vb_map_sg) { + dma->sglen = q->ops->vb_map_sg(dev,dma->sglist, + dma->nr_pages, dma->direction); + } if (0 == dma->sglen) { printk(KERN_WARNING - "%s: pci_map_sg failed\n",__FUNCTION__); + "%s: videobuf_map_sg failed\n",__FUNCTION__); kfree(dma->sglist); dma->sglist = NULL; dma->sglen = 0; @@ -228,24 +239,31 @@ int videobuf_dma_pci_map(struct pci_dev *dev, struct videobuf_dmabuf *dma) return 0; } -int videobuf_dma_pci_sync(struct pci_dev *dev, struct videobuf_dmabuf *dma) +int videobuf_dma_sync(struct videobuf_queue* q,struct videobuf_dmabuf *dma) { + void *dev=q->dev; + MAGIC_CHECK(dma->magic,MAGIC_DMABUF); BUG_ON(!dma->sglen); - if (!dma->bus_addr) - pci_dma_sync_sg_for_cpu(dev,dma->sglist,dma->nr_pages,dma->direction); + if (!dma->bus_addr && q->ops->vb_dma_sync_sg) + q->ops->vb_dma_sync_sg(dev,dma->sglist,dma->nr_pages, + dma->direction); + return 0; } -int videobuf_dma_pci_unmap(struct pci_dev *dev, struct videobuf_dmabuf *dma) +int videobuf_dma_unmap(struct videobuf_queue* q,struct videobuf_dmabuf *dma) { + void *dev=q->dev; + MAGIC_CHECK(dma->magic,MAGIC_DMABUF); if (!dma->sglen) return 0; - if (!dma->bus_addr) - pci_unmap_sg(dev,dma->sglist,dma->nr_pages,dma->direction); + if (!dma->bus_addr && q->ops->vb_unmap_sg) + q->ops->vb_unmap_sg(dev,dma->sglist,dma->nr_pages, + dma->direction); kfree(dma->sglist); dma->sglist = NULL; dma->sglen = 0; @@ -318,7 +336,7 @@ int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr) } int -videobuf_iolock(struct pci_dev *pci, struct videobuf_buffer *vb, +videobuf_iolock(struct videobuf_queue* q, struct videobuf_buffer *vb, struct v4l2_framebuffer *fbuf) { int err,pages; @@ -357,7 +375,7 @@ videobuf_iolock(struct pci_dev *pci, struct videobuf_buffer *vb, default: BUG(); } - err = videobuf_dma_pci_map(pci,&vb->dma); + err = videobuf_dma_map(q,&vb->dma); if (0 != err) return err; @@ -366,9 +384,41 @@ videobuf_iolock(struct pci_dev *pci, struct videobuf_buffer *vb, /* --------------------------------------------------------------------- */ +void videobuf_queue_pci(struct videobuf_queue* q) +{ + /* If not specified, defaults to PCI map sg */ + if (!q->ops->vb_map_sg) + q->ops->vb_map_sg=(vb_map_sg_t *)pci_map_sg; + + if (!q->ops->vb_dma_sync_sg) + q->ops->vb_dma_sync_sg=(vb_map_sg_t *)pci_dma_sync_sg_for_cpu; + if (!q->ops->vb_unmap_sg) + q->ops->vb_unmap_sg=(vb_map_sg_t *)pci_unmap_sg; +} + +int videobuf_pci_dma_map(struct pci_dev *pci,struct videobuf_dmabuf *dma) +{ + struct videobuf_queue q; + + q.dev=pci; + q.ops->vb_map_sg=(vb_map_sg_t *)pci_unmap_sg; + + return (videobuf_dma_unmap(&q,dma)); +} + +int videobuf_pci_dma_unmap(struct pci_dev *pci,struct videobuf_dmabuf *dma) +{ + struct videobuf_queue q; + + q.dev=pci; + q.ops->vb_map_sg=(vb_map_sg_t *)pci_unmap_sg; + + return (videobuf_dma_unmap(&q,dma)); +} + void videobuf_queue_init(struct videobuf_queue* q, struct videobuf_queue_ops *ops, - struct pci_dev *pci, + void *dev, spinlock_t *irqlock, enum v4l2_buf_type type, enum v4l2_field field, @@ -377,13 +427,15 @@ void videobuf_queue_init(struct videobuf_queue* q, { memset(q,0,sizeof(*q)); q->irqlock = irqlock; - q->pci = pci; + q->dev = dev; q->type = type; q->field = field; q->msize = msize; q->ops = ops; q->priv_data = priv; + videobuf_queue_pci(q); + mutex_init(&q->lock); INIT_LIST_HEAD(&q->stream); } @@ -431,7 +483,8 @@ videobuf_queue_cancel(struct videobuf_queue *q) int i; /* remove queued buffers from list */ - spin_lock_irqsave(q->irqlock,flags); + if (q->irqlock) + spin_lock_irqsave(q->irqlock,flags); for (i = 0; i < VIDEO_MAX_FRAME; i++) { if (NULL == q->bufs[i]) continue; @@ -440,7 +493,8 @@ videobuf_queue_cancel(struct videobuf_queue *q) q->bufs[i]->state = STATE_ERROR; } } - spin_unlock_irqrestore(q->irqlock,flags); + if (q->irqlock) + spin_unlock_irqrestore(q->irqlock,flags); /* free all buffers + clear queue */ for (i = 0; i < VIDEO_MAX_FRAME; i++) { @@ -534,19 +588,29 @@ videobuf_reqbufs(struct videobuf_queue *q, unsigned int size,count; int retval; - if (req->type != q->type) + if (req->type != q->type) { + dprintk(1,"reqbufs: queue type invalid\n"); return -EINVAL; - if (req->count < 1) + } + if (req->count < 1) { + dprintk(1,"reqbufs: count invalid (%d)\n",req->count); return -EINVAL; + } if (req->memory != V4L2_MEMORY_MMAP && req->memory != V4L2_MEMORY_USERPTR && - req->memory != V4L2_MEMORY_OVERLAY) + req->memory != V4L2_MEMORY_OVERLAY) { + dprintk(1,"reqbufs: memory type invalid\n"); return -EINVAL; + } - if (q->streaming) + if (q->streaming) { + dprintk(1,"reqbufs: streaming already exists\n"); return -EBUSY; - if (!list_empty(&q->stream)) + } + if (!list_empty(&q->stream)) { + dprintk(1,"reqbufs: stream running\n"); return -EBUSY; + } mutex_lock(&q->lock); count = req->count; @@ -559,8 +623,10 @@ videobuf_reqbufs(struct videobuf_queue *q, count, size, (count*size)>>PAGE_SHIFT); retval = videobuf_mmap_setup(q,count,size,req->memory); - if (retval < 0) + if (retval < 0) { + dprintk(1,"reqbufs: mmap setup returned %d\n",retval); goto done; + } req->count = count; @@ -572,12 +638,18 @@ videobuf_reqbufs(struct videobuf_queue *q, int videobuf_querybuf(struct videobuf_queue *q, struct v4l2_buffer *b) { - if (unlikely(b->type != q->type)) + if (unlikely(b->type != q->type)) { + dprintk(1,"querybuf: Wrong type.\n"); return -EINVAL; - if (unlikely(b->index < 0 || b->index >= VIDEO_MAX_FRAME)) + } + if (unlikely(b->index < 0 || b->index >= VIDEO_MAX_FRAME)) { + dprintk(1,"querybuf: index out of range.\n"); return -EINVAL; - if (unlikely(NULL == q->bufs[b->index])) + } + if (unlikely(NULL == q->bufs[b->index])) { + dprintk(1,"querybuf: buffer is null.\n"); return -EINVAL; + } videobuf_status(b,q->bufs[b->index],q->type); return 0; } @@ -593,26 +665,40 @@ videobuf_qbuf(struct videobuf_queue *q, mutex_lock(&q->lock); retval = -EBUSY; - if (q->reading) + if (q->reading) { + dprintk(1,"qbuf: Reading running...\n"); goto done; + } retval = -EINVAL; - if (b->type != q->type) + if (b->type != q->type) { + dprintk(1,"qbuf: Wrong type.\n"); goto done; - if (b->index < 0 || b->index >= VIDEO_MAX_FRAME) + } + if (b->index < 0 || b->index >= VIDEO_MAX_FRAME) { + dprintk(1,"qbuf: index out of range.\n"); goto done; + } buf = q->bufs[b->index]; - if (NULL == buf) + if (NULL == buf) { + dprintk(1,"qbuf: buffer is null.\n"); goto done; + } MAGIC_CHECK(buf->magic,MAGIC_BUFFER); - if (buf->memory != b->memory) + if (buf->memory != b->memory) { + dprintk(1,"qbuf: memory type is wrong.\n"); goto done; + } if (buf->state == STATE_QUEUED || - buf->state == STATE_ACTIVE) + buf->state == STATE_ACTIVE) { + dprintk(1,"qbuf: buffer is already queued or active.\n"); goto done; + } if (b->flags & V4L2_BUF_FLAG_INPUT) { - if (b->input >= q->inputs) + if (b->input >= q->inputs) { + dprintk(1,"qbuf: wrong input.\n"); goto done; + } buf->input = b->input; } else { buf->input = UNSET; @@ -620,12 +706,16 @@ videobuf_qbuf(struct videobuf_queue *q, switch (b->memory) { case V4L2_MEMORY_MMAP: - if (0 == buf->baddr) + if (0 == buf->baddr) { + dprintk(1,"qbuf: mmap requested but buffer addr is zero!\n"); goto done; + } break; case V4L2_MEMORY_USERPTR: - if (b->length < buf->bsize) + if (b->length < buf->bsize) { + dprintk(1,"qbuf: buffer length is not enough\n"); goto done; + } if (STATE_NEEDS_INIT != buf->state && buf->baddr != b->m.userptr) q->ops->buf_release(q,buf); buf->baddr = b->m.userptr; @@ -634,20 +724,27 @@ videobuf_qbuf(struct videobuf_queue *q, buf->boff = b->m.offset; break; default: + dprintk(1,"qbuf: wrong memory type\n"); goto done; } + dprintk(1,"qbuf: requesting next field\n"); field = videobuf_next_field(q); retval = q->ops->buf_prepare(q,buf,field); - if (0 != retval) + if (0 != retval) { + dprintk(1,"qbuf: buffer_prepare returned %d\n",retval); goto done; + } list_add_tail(&buf->stream,&q->stream); if (q->streaming) { - spin_lock_irqsave(q->irqlock,flags); + if (q->irqlock) + spin_lock_irqsave(q->irqlock,flags); q->ops->buf_queue(q,buf); - spin_unlock_irqrestore(q->irqlock,flags); + if (q->irqlock) + spin_unlock_irqrestore(q->irqlock,flags); } + dprintk(1,"qbuf: succeded\n"); retval = 0; done: @@ -664,26 +761,39 @@ videobuf_dqbuf(struct videobuf_queue *q, mutex_lock(&q->lock); retval = -EBUSY; - if (q->reading) + if (q->reading) { + dprintk(1,"dqbuf: Reading running...\n"); goto done; + } retval = -EINVAL; - if (b->type != q->type) + if (b->type != q->type) { + dprintk(1,"dqbuf: Wrong type.\n"); goto done; - if (list_empty(&q->stream)) + } + if (list_empty(&q->stream)) { + dprintk(1,"dqbuf: stream running\n"); goto done; + } buf = list_entry(q->stream.next, struct videobuf_buffer, stream); retval = videobuf_waiton(buf, nonblocking, 1); - if (retval < 0) + if (retval < 0) { + dprintk(1,"dqbuf: waiton returned %d\n",retval); goto done; + } switch (buf->state) { case STATE_ERROR: + dprintk(1,"dqbuf: state is error\n"); retval = -EIO; - /* fall through */ + videobuf_dma_sync(q,&buf->dma); + buf->state = STATE_IDLE; + break; case STATE_DONE: - videobuf_dma_pci_sync(q->pci,&buf->dma); + dprintk(1,"dqbuf: state is done\n"); + videobuf_dma_sync(q,&buf->dma); buf->state = STATE_IDLE; break; default: + dprintk(1,"dqbuf: state invalid\n"); retval = -EINVAL; goto done; } @@ -711,13 +821,15 @@ int videobuf_streamon(struct videobuf_queue *q) if (q->streaming) goto done; q->streaming = 1; - spin_lock_irqsave(q->irqlock,flags); + if (q->irqlock) + spin_lock_irqsave(q->irqlock,flags); list_for_each(list,&q->stream) { buf = list_entry(list, struct videobuf_buffer, stream); if (buf->state == STATE_PREPARED) q->ops->buf_queue(q,buf); } - spin_unlock_irqrestore(q->irqlock,flags); + if (q->irqlock) + spin_unlock_irqrestore(q->irqlock,flags); done: mutex_unlock(&q->lock); @@ -762,12 +874,14 @@ videobuf_read_zerocopy(struct videobuf_queue *q, char __user *data, goto done; /* start capture & wait */ - spin_lock_irqsave(q->irqlock,flags); + if (q->irqlock) + spin_lock_irqsave(q->irqlock,flags); q->ops->buf_queue(q,q->read_buf); - spin_unlock_irqrestore(q->irqlock,flags); + if (q->irqlock) + spin_unlock_irqrestore(q->irqlock,flags); retval = videobuf_waiton(q->read_buf,0,0); if (0 == retval) { - videobuf_dma_pci_sync(q->pci,&q->read_buf->dma); + videobuf_dma_sync(q,&q->read_buf->dma); if (STATE_ERROR == q->read_buf->state) retval = -EIO; else @@ -809,6 +923,7 @@ ssize_t videobuf_read_one(struct videobuf_queue *q, /* need to capture a new frame */ retval = -ENOMEM; q->read_buf = videobuf_alloc(q->msize); + dprintk(1,"video alloc=0x%08x\n",(unsigned int) q->read_buf); if (NULL == q->read_buf) goto done; q->read_buf->memory = V4L2_MEMORY_USERPTR; @@ -820,9 +935,11 @@ ssize_t videobuf_read_one(struct videobuf_queue *q, q->read_buf = NULL; goto done; } - spin_lock_irqsave(q->irqlock,flags); + if (q->irqlock) + spin_lock_irqsave(q->irqlock,flags); q->ops->buf_queue(q,q->read_buf); - spin_unlock_irqrestore(q->irqlock,flags); + if (q->irqlock) + spin_unlock_irqrestore(q->irqlock,flags); q->read_off = 0; } @@ -830,7 +947,7 @@ ssize_t videobuf_read_one(struct videobuf_queue *q, retval = videobuf_waiton(q->read_buf, nonblocking, 1); if (0 != retval) goto done; - videobuf_dma_pci_sync(q->pci,&q->read_buf->dma); + videobuf_dma_sync(q,&q->read_buf->dma); if (STATE_ERROR == q->read_buf->state) { /* catch I/O errors */ @@ -887,10 +1004,12 @@ int videobuf_read_start(struct videobuf_queue *q) return err; list_add_tail(&q->bufs[i]->stream, &q->stream); } - spin_lock_irqsave(q->irqlock,flags); + if (q->irqlock) + spin_lock_irqsave(q->irqlock,flags); for (i = 0; i < count; i++) q->ops->buf_queue(q,q->bufs[i]); - spin_unlock_irqrestore(q->irqlock,flags); + if (q->irqlock) + spin_unlock_irqrestore(q->irqlock,flags); q->reading = 1; return 0; } @@ -985,9 +1104,11 @@ ssize_t videobuf_read_stream(struct videobuf_queue *q, if (q->read_off == q->read_buf->size) { list_add_tail(&q->read_buf->stream, &q->stream); - spin_lock_irqsave(q->irqlock,flags); + if (q->irqlock) + spin_lock_irqsave(q->irqlock,flags); q->ops->buf_queue(q,q->read_buf); - spin_unlock_irqrestore(q->irqlock,flags); + if (q->irqlock) + spin_unlock_irqrestore(q->irqlock,flags); q->read_buf = NULL; } if (retval < 0) @@ -1249,11 +1370,14 @@ EXPORT_SYMBOL_GPL(videobuf_dma_init); EXPORT_SYMBOL_GPL(videobuf_dma_init_user); EXPORT_SYMBOL_GPL(videobuf_dma_init_kernel); EXPORT_SYMBOL_GPL(videobuf_dma_init_overlay); -EXPORT_SYMBOL_GPL(videobuf_dma_pci_map); -EXPORT_SYMBOL_GPL(videobuf_dma_pci_sync); -EXPORT_SYMBOL_GPL(videobuf_dma_pci_unmap); +EXPORT_SYMBOL_GPL(videobuf_dma_map); +EXPORT_SYMBOL_GPL(videobuf_dma_sync); +EXPORT_SYMBOL_GPL(videobuf_dma_unmap); EXPORT_SYMBOL_GPL(videobuf_dma_free); +EXPORT_SYMBOL_GPL(videobuf_pci_dma_map); +EXPORT_SYMBOL_GPL(videobuf_pci_dma_unmap); + EXPORT_SYMBOL_GPL(videobuf_alloc); EXPORT_SYMBOL_GPL(videobuf_waiton); EXPORT_SYMBOL_GPL(videobuf_iolock); diff --git a/drivers/media/video/videocodec.h b/drivers/media/video/videocodec.h index b1239ac7f371..8c233720b6a5 100644 --- a/drivers/media/video/videocodec.h +++ b/drivers/media/video/videocodec.h @@ -57,7 +57,7 @@ therfor they may not be initialized. The other fuctions are just for convenience, as they are for sure used by - most/all of the codecs. The last ones may be ommited, too. + most/all of the codecs. The last ones may be ommited, too. See the structure declaration below for more information and which data has to be set up for the master and the slave. @@ -75,52 +75,52 @@ /* ========================================== */ /* - ==== master setup ==== + ==== master setup ==== name -> name of the device structure for reference and debugging master_data -> data ref. for the master (e.g. the zr36055,57,67) readreg -> ref. to read-fn from register (setup by master, used by slave) writereg -> ref. to write-fn to register (setup by master, used by slave) - this two functions do the lowlevel I/O job + this two functions do the lowlevel I/O job - ==== slave functionality setup ==== - slave_data -> data ref. for the slave (e.g. the zr36050,60) + ==== slave functionality setup ==== + slave_data -> data ref. for the slave (e.g. the zr36050,60) check -> fn-ref. checks availability of an device, returns -EIO on failure or - the type on success - this makes espcecially sense if a driver module supports more than - one codec which may be quite similar to access, nevertheless it - is good for a first functionality check + the type on success + this makes espcecially sense if a driver module supports more than + one codec which may be quite similar to access, nevertheless it + is good for a first functionality check - -- main functions you always need for compression/decompression -- + -- main functions you always need for compression/decompression -- set_mode -> this fn-ref. resets the entire codec, and sets up the mode - with the last defined norm/size (or device default if not - available) - it returns 0 if the mode is possible + with the last defined norm/size (or device default if not + available) - it returns 0 if the mode is possible set_size -> this fn-ref. sets the norm and image size for - compression/decompression (returns 0 on success) - the norm param is defined in videodev.h (VIDEO_MODE_*) + compression/decompression (returns 0 on success) + the norm param is defined in videodev.h (VIDEO_MODE_*) additional setup may be available, too - but the codec should work with - some default values even without this + some default values even without this - set_data -> sets device-specific data (tables, quality etc.) - get_data -> query device-specific data (tables, quality etc.) + set_data -> sets device-specific data (tables, quality etc.) + get_data -> query device-specific data (tables, quality etc.) - if the device delivers interrupts, they may be setup/handled here - setup_interrupt -> codec irq setup (not needed for 36050/60) - handle_interrupt -> codec irq handling (not needed for 36050/60) + if the device delivers interrupts, they may be setup/handled here + setup_interrupt -> codec irq setup (not needed for 36050/60) + handle_interrupt -> codec irq handling (not needed for 36050/60) - if the device delivers pictures, they may be handled here - put_image -> puts image data to the codec (not needed for 36050/60) - get_image -> gets image data from the codec (not needed for 36050/60) - the calls include frame numbers and flags (even/odd/...) - if needed and a flag which allows blocking until its ready + if the device delivers pictures, they may be handled here + put_image -> puts image data to the codec (not needed for 36050/60) + get_image -> gets image data from the codec (not needed for 36050/60) + the calls include frame numbers and flags (even/odd/...) + if needed and a flag which allows blocking until its ready */ /* ============== */ /* user interface */ /* ============== */ -/* +/* Currently there is only a information display planned, as the layer is not visible for the user space at all. diff --git a/drivers/media/video/vino.c b/drivers/media/video/vino.c index 0229819d0aac..a8c101494cf5 100644 --- a/drivers/media/video/vino.c +++ b/drivers/media/video/vino.c @@ -1555,12 +1555,12 @@ static void vino_update_line_size(struct vino_channel_settings *vcs) unsigned int w = vcs->clipping.right - vcs->clipping.left; unsigned int d = vcs->decimation; unsigned int bpp = vino_data_formats[vcs->data_format].bpp; - unsigned int lsize; + unsigned int lsize; dprintk("update_line_size(): before: w = %d, d = %d, " "line_size = %d\n", w, d, vcs->line_size); - /* line size must be multiple of 8 bytes */ + /* line size must be multiple of 8 bytes */ lsize = (bpp * (w / d)) & ~7; w = (lsize / bpp) * d; diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c new file mode 100644 index 000000000000..5e813404d068 --- /dev/null +++ b/drivers/media/video/vivi.c @@ -0,0 +1,1454 @@ +/* + * Virtual Video driver - This code emulates a real video device with v4l2 api + * + * Copyright (c) 2006 by: + * Mauro Carvalho Chehab <mchehab--a.t--infradead.org> + * Ted Walther <ted--a.t--enumera.com> + * John Sokol <sokol--a.t--videotechnology.com> + * http://v4l.videotechnology.com/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the BSD Licence, 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/module.h> +#include <linux/delay.h> +#include <linux/errno.h> +#include <linux/fs.h> +#include <linux/kernel.h> +#include <linux/slab.h> +#include <linux/mm.h> +#include <linux/ioport.h> +#include <linux/init.h> +#include <linux/sched.h> +#include <linux/pci.h> +#include <linux/random.h> +#include <linux/version.h> +#include <linux/videodev2.h> +#include <linux/interrupt.h> +#include <media/video-buf.h> +#include <media/v4l2-common.h> +#include <linux/kthread.h> +#include <linux/highmem.h> + +/* Wake up at about 30 fps */ +#define WAKE_NUMERATOR 30 +#define WAKE_DENOMINATOR 1001 +#define BUFFER_TIMEOUT msecs_to_jiffies(500) /* 0.5 seconds */ + +/* These timers are for 1 fps - used only for testing */ +//#define WAKE_DENOMINATOR 30 /* hack for testing purposes */ +//#define BUFFER_TIMEOUT msecs_to_jiffies(5000) /* 5 seconds */ + +#include "font.h" + +#ifndef kzalloc +#define kzalloc(size, flags) \ +({ \ + void *__ret = kmalloc(size, flags); \ + if (__ret) \ + memset(__ret, 0, size); \ + __ret; \ +}) +#endif + +MODULE_DESCRIPTION("Video Technology Magazine Virtual Video Capture Board"); +MODULE_AUTHOR("Mauro Carvalho Chehab, Ted Walther and John Sokol"); +MODULE_LICENSE("Dual BSD/GPL"); + +#define VIVI_MAJOR_VERSION 0 +#define VIVI_MINOR_VERSION 4 +#define VIVI_RELEASE 0 +#define VIVI_VERSION KERNEL_VERSION(VIVI_MAJOR_VERSION, VIVI_MINOR_VERSION, VIVI_RELEASE) + +static int video_nr = -1; /* /dev/videoN, -1 for autodetect */ +module_param(video_nr, int, 0); + +static int debug = 0; +module_param(debug, int, 0); + +static unsigned int vid_limit = 16; +module_param(vid_limit,int,0644); +MODULE_PARM_DESC(vid_limit,"capture memory limit in megabytes"); + +/* supported controls */ +static struct v4l2_queryctrl vivi_qctrl[] = { + { + .id = V4L2_CID_AUDIO_VOLUME, + .name = "Volume", + .minimum = 0, + .maximum = 65535, + .step = 65535/100, + .default_value = 65535, + .flags = 0, + .type = V4L2_CTRL_TYPE_INTEGER, + },{ + .id = V4L2_CID_BRIGHTNESS, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Brightness", + .minimum = 0, + .maximum = 255, + .step = 1, + .default_value = 127, + .flags = 0, + }, { + .id = V4L2_CID_CONTRAST, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Contrast", + .minimum = 0, + .maximum = 255, + .step = 0x1, + .default_value = 0x10, + .flags = 0, + }, { + .id = V4L2_CID_SATURATION, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Saturation", + .minimum = 0, + .maximum = 255, + .step = 0x1, + .default_value = 127, + .flags = 0, + }, { + .id = V4L2_CID_HUE, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "Hue", + .minimum = -128, + .maximum = 127, + .step = 0x1, + .default_value = 0, + .flags = 0, + } +}; + +static int qctl_regs[ARRAY_SIZE(vivi_qctrl)]; + +#define dprintk(level,fmt, arg...) \ + do { \ + if (debug >= (level)) \ + printk(KERN_DEBUG "vivi: " fmt , ## arg); \ + } while (0) + +/* ------------------------------------------------------------------ + Basic structures + ------------------------------------------------------------------*/ + +struct vivi_fmt { + char *name; + u32 fourcc; /* v4l2 format id */ + int depth; +}; + +static struct vivi_fmt format = { + .name = "4:2:2, packed, YUYV", + .fourcc = V4L2_PIX_FMT_YUYV, + .depth = 16, +}; + +struct sg_to_addr { + int pos; + struct scatterlist *sg; +}; + +/* buffer for one video frame */ +struct vivi_buffer { + /* common v4l buffer stuff -- must be first */ + struct videobuf_buffer vb; + + struct vivi_fmt *fmt; + + struct sg_to_addr *to_addr; +}; + +struct vivi_dmaqueue { + struct list_head active; + struct list_head queued; + struct timer_list timeout; + + /* thread for generating video stream*/ + struct task_struct *kthread; + wait_queue_head_t wq; + /* Counters to control fps rate */ + int frame; + int ini_jiffies; +}; + +static LIST_HEAD(vivi_devlist); + +struct vivi_dev { + struct list_head vivi_devlist; + + struct semaphore lock; + + int users; + + /* various device info */ + unsigned int resources; + struct video_device video_dev; + + struct vivi_dmaqueue vidq; + + /* Several counters */ + int h,m,s,us,jiffies; + char timestr[13]; +}; + +struct vivi_fh { + struct vivi_dev *dev; + + /* video capture */ + struct vivi_fmt *fmt; + unsigned int width,height; + struct videobuf_queue vb_vidq; + + enum v4l2_buf_type type; +}; + +/* ------------------------------------------------------------------ + DMA and thread functions + ------------------------------------------------------------------*/ + +/* Bars and Colors should match positions */ + +enum colors { + WHITE, + AMBAR, + CYAN, + GREEN, + MAGENTA, + RED, + BLUE +}; + +static u8 bars[8][3] = { + /* R G B */ + {204,204,204}, /* white */ + {208,208, 0}, /* ambar */ + { 0,206,206}, /* cyan */ + { 0,239, 0}, /* green */ + {239, 0,239}, /* magenta */ + {205, 0, 0}, /* red */ + { 0, 0,255}, /* blue */ + { 0, 0, 0} +}; + +#define TO_Y(r,g,b) (((16829*r +33039*g +6416*b + 32768)>>16)+16) +/* RGB to V(Cr) Color transform */ +#define TO_V(r,g,b) (((28784*r -24103*g -4681*b + 32768)>>16)+128) +/* RGB to U(Cb) Color transform */ +#define TO_U(r,g,b) (((-9714*r -19070*g +28784*b + 32768)>>16)+128) + +#define TSTAMP_MIN_Y 24 +#define TSTAMP_MAX_Y TSTAMP_MIN_Y+15 +#define TSTAMP_MIN_X 64 + +void prep_to_addr(struct sg_to_addr to_addr[],struct videobuf_buffer *vb) +{ + int i, pos=0; + + for (i=0;i<vb->dma.nr_pages;i++) { + to_addr[i].sg=&vb->dma.sglist[i]; + to_addr[i].pos=pos; + pos += vb->dma.sglist[i].length; + } +} + +inline int get_addr_pos(int pos, int pages, struct sg_to_addr to_addr[]) +{ + int p1=0,p2=pages-1,p3=pages/2; + + /* Sanity test */ + BUG_ON (pos>=to_addr[p2].pos+to_addr[p2].sg->length); + + while (p1+1<p2) { + if (pos < to_addr[p3].pos) { + p2=p3; + } else { + p1=p3; + } + p3=(p1+p2)/2; + } + if (pos >= to_addr[p2].pos) + p1=p2; + + return (p1); +} + +void gen_line(struct sg_to_addr to_addr[],int inipos,int pages,int wmax, + int hmax, int line, char *timestr) +{ + int w,i,j,pos=inipos,pgpos,oldpg,y; + char *p,*s,*basep; + struct page *pg; + u8 chr,r,g,b,color; + + /* Get first addr pointed to pixel position */ + oldpg=get_addr_pos(pos,pages,to_addr); + pg=pfn_to_page(to_addr[oldpg].sg->dma_address >> PAGE_SHIFT); + basep = kmap_atomic(pg, KM_BOUNCE_READ)+to_addr[oldpg].sg->offset; + + /* We will just duplicate the second pixel at the packet */ + wmax/=2; + + /* Generate a standard color bar pattern */ + for (w=0;w<wmax;w++) { + r=bars[w*7/wmax][0]; + g=bars[w*7/wmax][1]; + b=bars[w*7/wmax][2]; + + for (color=0;color<4;color++) { + pgpos=get_addr_pos(pos,pages,to_addr); + if (pgpos!=oldpg) { + pg=pfn_to_page(to_addr[pgpos].sg->dma_address >> PAGE_SHIFT); + kunmap_atomic(basep, KM_BOUNCE_READ); + basep= kmap_atomic(pg, KM_BOUNCE_READ)+to_addr[pgpos].sg->offset; + oldpg=pgpos; + } + p=basep+pos-to_addr[pgpos].pos; + + switch (color) { + case 0: + case 2: + *p=TO_Y(r,g,b); /* Luminance */ + break; + case 1: + *p=TO_U(r,g,b); /* Cb */ + break; + case 3: + *p=TO_V(r,g,b); /* Cr */ + break; + } + pos++; + } + } + + /* Checks if it is possible to show timestamp */ + if (TSTAMP_MAX_Y>=hmax) + goto end; + if (TSTAMP_MIN_X+strlen(timestr)>=wmax) + goto end; + + /* Print stream time */ + if (line>=TSTAMP_MIN_Y && line<=TSTAMP_MAX_Y) { + j=TSTAMP_MIN_X; + for (s=timestr;*s;s++) { + chr=rom8x16_bits[(*s-0x30)*16+line-TSTAMP_MIN_Y]; + for (i=0;i<7;i++) { + if (chr&1<<(7-i)) { /* Font color*/ + r=bars[BLUE][0]; + g=bars[BLUE][1]; + b=bars[BLUE][2]; + r=g=b=0; + g=198; + } else { /* Background color */ + r=bars[WHITE][0]; + g=bars[WHITE][1]; + b=bars[WHITE][2]; + r=g=b=0; + } + + pos=inipos+j*2; + for (color=0;color<4;color++) { + pgpos=get_addr_pos(pos,pages,to_addr); + if (pgpos!=oldpg) { + pg=pfn_to_page(to_addr[pgpos]. + sg->dma_address + >> PAGE_SHIFT); + kunmap_atomic(basep, + KM_BOUNCE_READ); + basep= kmap_atomic(pg, + KM_BOUNCE_READ)+ + to_addr[pgpos].sg->offset; + oldpg=pgpos; + } + p=basep+pos-to_addr[pgpos].pos; + + y=TO_Y(r,g,b); + + switch (color) { + case 0: + case 2: + *p=TO_Y(r,g,b); /* Luminance */ + break; + case 1: + *p=TO_U(r,g,b); /* Cb */ + break; + case 3: + *p=TO_V(r,g,b); /* Cr */ + break; + } + pos++; + } + j++; + } + } + } + + +end: + kunmap_atomic(basep, KM_BOUNCE_READ); +} +static void vivi_fillbuff(struct vivi_dev *dev,struct vivi_buffer *buf) +{ + int h,pos=0; + int hmax = buf->vb.height; + int wmax = buf->vb.width; + struct videobuf_buffer *vb=&buf->vb; + struct sg_to_addr *to_addr=buf->to_addr; + struct timeval ts; + + /* Test if DMA mapping is ready */ + if (!vb->dma.sglist[0].dma_address) + return; + + prep_to_addr(to_addr,vb); + + /* Check if there is enough memory */ + BUG_ON(buf->vb.dma.nr_pages << PAGE_SHIFT < (buf->vb.width*buf->vb.height)*2); + + for (h=0;h<hmax;h++) { + gen_line(to_addr,pos,vb->dma.nr_pages,wmax,hmax,h,dev->timestr); + pos += wmax*2; + } + + /* Updates stream time */ + + dev->us+=jiffies_to_usecs(jiffies-dev->jiffies); + dev->jiffies=jiffies; + if (dev->us>=1000000) { + dev->us-=1000000; + dev->s++; + if (dev->s>=60) { + dev->s-=60; + dev->m++; + if (dev->m>60) { + dev->m-=60; + dev->h++; + if (dev->h>24) + dev->h-=24; + } + } + } + sprintf(dev->timestr,"%02d:%02d:%02d:%03d", + dev->h,dev->m,dev->s,(dev->us+500)/1000); + + dprintk(2,"vivifill at %s: Buffer 0x%08lx size= %d\n",dev->timestr, + (unsigned long)buf->vb.dma.vmalloc,pos); + + /* Advice that buffer was filled */ + buf->vb.state = STATE_DONE; + buf->vb.field_count++; + do_gettimeofday(&ts); + buf->vb.ts = ts; + + list_del(&buf->vb.queue); + wake_up(&buf->vb.done); +} + +static int restart_video_queue(struct vivi_dmaqueue *dma_q); + +static void vivi_thread_tick(struct vivi_dmaqueue *dma_q) +{ + struct vivi_buffer *buf; + struct vivi_dev *dev= container_of(dma_q,struct vivi_dev,vidq); + + int bc; + + /* Announces videobuf that all went ok */ + for (bc = 0;; bc++) { + if (list_empty(&dma_q->active)) { + dprintk(1,"No active queue to serve\n"); + break; + } + + buf = list_entry(dma_q->active.next, + struct vivi_buffer, vb.queue); + + /* Nobody is waiting something to be done, just return */ + if (!waitqueue_active(&buf->vb.done)) { + mod_timer(&dma_q->timeout, jiffies+BUFFER_TIMEOUT); + return; + } + + do_gettimeofday(&buf->vb.ts); + dprintk(2,"[%p/%d] wakeup\n",buf,buf->vb.i); + + /* Fill buffer */ + vivi_fillbuff(dev,buf); + } + if (list_empty(&dma_q->active)) { + del_timer(&dma_q->timeout); + } else { + mod_timer(&dma_q->timeout, jiffies+BUFFER_TIMEOUT); + } + if (bc != 1) + dprintk(1,"%s: %d buffers handled (should be 1)\n",__FUNCTION__,bc); +} + +void vivi_sleep(struct vivi_dmaqueue *dma_q) +{ + int timeout; + DECLARE_WAITQUEUE(wait, current); + + dprintk(1,"%s dma_q=0x%08lx\n",__FUNCTION__,(unsigned long)dma_q); + + add_wait_queue(&dma_q->wq, &wait); + if (!kthread_should_stop()) { + dma_q->frame++; + + /* Calculate time to wake up */ + timeout=dma_q->ini_jiffies+msecs_to_jiffies((dma_q->frame*WAKE_NUMERATOR*1000)/WAKE_DENOMINATOR)-jiffies; + + if (timeout <= 0) { + int old=dma_q->frame; + dma_q->frame=(jiffies_to_msecs(jiffies-dma_q->ini_jiffies)*WAKE_DENOMINATOR)/(WAKE_NUMERATOR*1000)+1; + + timeout=dma_q->ini_jiffies+msecs_to_jiffies((dma_q->frame*WAKE_NUMERATOR*1000)/WAKE_DENOMINATOR)-jiffies; + + dprintk(1,"underrun, losed %d frames. " + "Now, frame is %d. Waking on %d jiffies\n", + dma_q->frame-old,dma_q->frame,timeout); + } else + dprintk(1,"will sleep for %i jiffies\n",timeout); + + vivi_thread_tick(dma_q); + + schedule_timeout_interruptible (timeout); + } + + remove_wait_queue(&dma_q->wq, &wait); + try_to_freeze(); +} + +int vivi_thread(void *data) +{ + struct vivi_dmaqueue *dma_q=data; + + dprintk(1,"thread started\n"); + + for (;;) { + vivi_sleep(dma_q); + + if (kthread_should_stop()) + break; + } + dprintk(1, "thread: exit\n"); + return 0; +} + +int vivi_start_thread(struct vivi_dmaqueue *dma_q) +{ + dma_q->frame=0; + dma_q->ini_jiffies=jiffies; + + dprintk(1,"%s\n",__FUNCTION__); + init_waitqueue_head(&dma_q->wq); + + dma_q->kthread = kthread_run(vivi_thread, dma_q, "vivi"); + + if (dma_q->kthread == NULL) { + printk(KERN_ERR "vivi: kernel_thread() failed\n"); + return -EINVAL; + } + dprintk(1,"returning from %s\n",__FUNCTION__); + return 0; +} + +void vivi_stop_thread(struct vivi_dmaqueue *dma_q) +{ + dprintk(1,"%s\n",__FUNCTION__); + /* shutdown control thread */ + if (dma_q->kthread) { + kthread_stop(dma_q->kthread); + dma_q->kthread=NULL; + } +} + +static int restart_video_queue(struct vivi_dmaqueue *dma_q) +{ + struct vivi_buffer *buf, *prev; + struct list_head *item; + + dprintk(1,"%s dma_q=0x%08lx\n",__FUNCTION__,(unsigned long)dma_q); + + if (!list_empty(&dma_q->active)) { + buf = list_entry(dma_q->active.next, struct vivi_buffer, vb.queue); + dprintk(2,"restart_queue [%p/%d]: restart dma\n", + buf, buf->vb.i); + + dprintk(1,"Restarting video dma\n"); + vivi_stop_thread(dma_q); +// vivi_start_thread(dma_q); + + /* cancel all outstanding capture / vbi requests */ + list_for_each(item,&dma_q->active) { + buf = list_entry(item, struct vivi_buffer, vb.queue); + + list_del(&buf->vb.queue); + buf->vb.state = STATE_ERROR; + wake_up(&buf->vb.done); + } + mod_timer(&dma_q->timeout, jiffies+BUFFER_TIMEOUT); + + return 0; + } + + prev = NULL; + for (;;) { + if (list_empty(&dma_q->queued)) + return 0; + buf = list_entry(dma_q->queued.next, struct vivi_buffer, vb.queue); + if (NULL == prev) { + list_del(&buf->vb.queue); + list_add_tail(&buf->vb.queue,&dma_q->active); + + dprintk(1,"Restarting video dma\n"); + vivi_stop_thread(dma_q); + vivi_start_thread(dma_q); + + buf->vb.state = STATE_ACTIVE; + mod_timer(&dma_q->timeout, jiffies+BUFFER_TIMEOUT); + dprintk(2,"[%p/%d] restart_queue - first active\n", + buf,buf->vb.i); + + } else if (prev->vb.width == buf->vb.width && + prev->vb.height == buf->vb.height && + prev->fmt == buf->fmt) { + list_del(&buf->vb.queue); + list_add_tail(&buf->vb.queue,&dma_q->active); + buf->vb.state = STATE_ACTIVE; + dprintk(2,"[%p/%d] restart_queue - move to active\n", + buf,buf->vb.i); + } else { + return 0; + } + prev = buf; + } +} + +static void vivi_vid_timeout(unsigned long data) +{ + struct vivi_dev *dev = (struct vivi_dev*)data; + struct vivi_dmaqueue *vidq = &dev->vidq; + struct vivi_buffer *buf; + + while (!list_empty(&vidq->active)) { + buf = list_entry(vidq->active.next, struct vivi_buffer, vb.queue); + list_del(&buf->vb.queue); + buf->vb.state = STATE_ERROR; + wake_up(&buf->vb.done); + printk("vivi/0: [%p/%d] timeout\n", buf, buf->vb.i); + } + + restart_video_queue(vidq); +} + +/* ------------------------------------------------------------------ + Videobuf operations + ------------------------------------------------------------------*/ +static int +buffer_setup(struct videobuf_queue *vq, unsigned int *count, unsigned int *size) +{ + struct vivi_fh *fh = vq->priv_data; + + *size = fh->width*fh->height*2; + + if (0 == *count) + *count = 32; + while (*size * *count > vid_limit * 1024 * 1024) + (*count)--; + return 0; +} + +void +free_buffer(struct videobuf_queue *vq, struct vivi_buffer *buf) +{ + dprintk(1,"%s\n",__FUNCTION__); + + if (in_interrupt()) + BUG(); + + /*FIXME: Maybe a spinlock is required here */ + kfree(buf->to_addr); + buf->to_addr=NULL; + + videobuf_waiton(&buf->vb,0,0); + videobuf_dma_unmap(vq, &buf->vb.dma); + videobuf_dma_free(&buf->vb.dma); + buf->vb.state = STATE_NEEDS_INIT; +} + +#define norm_maxw() 1024 +#define norm_maxh() 768 +static int +buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb, + enum v4l2_field field) +{ + struct vivi_fh *fh = vq->priv_data; + struct vivi_buffer *buf = container_of(vb,struct vivi_buffer,vb); + int rc, init_buffer = 0; + +// dprintk(1,"%s, field=%d\n",__FUNCTION__,field); + + BUG_ON(NULL == fh->fmt); + if (fh->width < 48 || fh->width > norm_maxw() || + fh->height < 32 || fh->height > norm_maxh()) + return -EINVAL; + buf->vb.size = fh->width*fh->height*2; + if (0 != buf->vb.baddr && buf->vb.bsize < buf->vb.size) + return -EINVAL; + + if (buf->fmt != fh->fmt || + buf->vb.width != fh->width || + buf->vb.height != fh->height || + buf->vb.field != field) { + buf->fmt = fh->fmt; + buf->vb.width = fh->width; + buf->vb.height = fh->height; + buf->vb.field = field; + init_buffer = 1; + } + + if (STATE_NEEDS_INIT == buf->vb.state) { + if (0 != (rc = videobuf_iolock(vq,&buf->vb,NULL))) + goto fail; + } + + buf->vb.state = STATE_PREPARED; + + if (NULL == (buf->to_addr = kmalloc(sizeof(*buf->to_addr) * vb->dma.nr_pages,GFP_KERNEL))) { + rc=-ENOMEM; + goto fail; + } + + return 0; + +fail: + free_buffer(vq,buf); + return rc; +} + +static void +buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) +{ + struct vivi_buffer *buf = container_of(vb,struct vivi_buffer,vb); + struct vivi_fh *fh = vq->priv_data; + struct vivi_dev *dev = fh->dev; + struct vivi_dmaqueue *vidq = &dev->vidq; + struct vivi_buffer *prev; + + if (!list_empty(&vidq->queued)) { + dprintk(1,"adding vb queue=0x%08lx\n",(unsigned long)&buf->vb.queue); + list_add_tail(&buf->vb.queue,&vidq->queued); + buf->vb.state = STATE_QUEUED; + dprintk(2,"[%p/%d] buffer_queue - append to queued\n", + buf, buf->vb.i); + } else if (list_empty(&vidq->active)) { + list_add_tail(&buf->vb.queue,&vidq->active); + + buf->vb.state = STATE_ACTIVE; + mod_timer(&vidq->timeout, jiffies+BUFFER_TIMEOUT); + dprintk(2,"[%p/%d] buffer_queue - first active\n", + buf, buf->vb.i); + + vivi_start_thread(vidq); + } else { + prev = list_entry(vidq->active.prev, struct vivi_buffer, vb.queue); + if (prev->vb.width == buf->vb.width && + prev->vb.height == buf->vb.height && + prev->fmt == buf->fmt) { + list_add_tail(&buf->vb.queue,&vidq->active); + buf->vb.state = STATE_ACTIVE; + dprintk(2,"[%p/%d] buffer_queue - append to active\n", + buf, buf->vb.i); + + } else { + list_add_tail(&buf->vb.queue,&vidq->queued); + buf->vb.state = STATE_QUEUED; + dprintk(2,"[%p/%d] buffer_queue - first queued\n", + buf, buf->vb.i); + } + } +} + +static void buffer_release(struct videobuf_queue *vq, struct videobuf_buffer *vb) +{ + struct vivi_buffer *buf = container_of(vb,struct vivi_buffer,vb); + struct vivi_fh *fh = vq->priv_data; + struct vivi_dev *dev = (struct vivi_dev*)fh->dev; + struct vivi_dmaqueue *vidq = &dev->vidq; + + dprintk(1,"%s\n",__FUNCTION__); + + vivi_stop_thread(vidq); + + free_buffer(vq,buf); +} + +int vivi_map_sg (void *dev, struct scatterlist *sg, int nents, + int direction) +{ + int i; + + dprintk(1,"%s, number of pages=%d\n",__FUNCTION__,nents); + BUG_ON(direction == DMA_NONE); + + for (i = 0; i < nents; i++ ) { + BUG_ON(!sg[i].page); + + sg[i].dma_address = page_to_phys(sg[i].page) + sg[i].offset; + } + + return nents; +} + +int vivi_unmap_sg(void *dev,struct scatterlist *sglist,int nr_pages, + int direction) +{ + dprintk(1,"%s\n",__FUNCTION__); + return 0; +} + +int vivi_dma_sync_sg(void *dev,struct scatterlist *sglist,int nr_pages, + int direction) +{ +// dprintk(1,"%s\n",__FUNCTION__); + +// flush_write_buffers(); + return 0; +} + +static struct videobuf_queue_ops vivi_video_qops = { + .buf_setup = buffer_setup, + .buf_prepare = buffer_prepare, + .buf_queue = buffer_queue, + .buf_release = buffer_release, + + /* Non-pci handling routines */ + .vb_map_sg = vivi_map_sg, + .vb_dma_sync_sg = vivi_dma_sync_sg, + .vb_unmap_sg = vivi_unmap_sg, +}; + +/* ------------------------------------------------------------------ + IOCTL handling + ------------------------------------------------------------------*/ + +static int vivi_try_fmt(struct vivi_dev *dev, struct vivi_fh *fh, + struct v4l2_format *f) +{ + struct vivi_fmt *fmt; + enum v4l2_field field; + unsigned int maxw, maxh; + + if (format.fourcc != f->fmt.pix.pixelformat) { + dprintk(1,"Fourcc format invalid.\n"); + return -EINVAL; + } + fmt=&format; + + field = f->fmt.pix.field; + + if (field == V4L2_FIELD_ANY) { +// field=V4L2_FIELD_INTERLACED; + field=V4L2_FIELD_SEQ_TB; + } else if (V4L2_FIELD_INTERLACED != field) { + dprintk(1,"Field type invalid.\n"); + return -EINVAL; + } + + maxw = norm_maxw(); + maxh = norm_maxh(); + + f->fmt.pix.field = field; + if (f->fmt.pix.height < 32) + f->fmt.pix.height = 32; + if (f->fmt.pix.height > maxh) + f->fmt.pix.height = maxh; + if (f->fmt.pix.width < 48) + f->fmt.pix.width = 48; + if (f->fmt.pix.width > maxw) + f->fmt.pix.width = maxw; + f->fmt.pix.width &= ~0x03; + f->fmt.pix.bytesperline = + (f->fmt.pix.width * fmt->depth) >> 3; + f->fmt.pix.sizeimage = + f->fmt.pix.height * f->fmt.pix.bytesperline; + + return 0; +} + +static int res_get(struct vivi_dev *dev, struct vivi_fh *fh) +{ + /* is it free? */ + down(&dev->lock); + if (dev->resources) { + /* no, someone else uses it */ + up(&dev->lock); + return 0; + } + /* it's free, grab it */ + dev->resources =1; + dprintk(1,"res: get\n"); + up(&dev->lock); + return 1; +} + +static inline int res_locked(struct vivi_dev *dev) +{ + return (dev->resources); +} + +static void res_free(struct vivi_dev *dev, struct vivi_fh *fh) +{ + down(&dev->lock); + dev->resources = 0; + dprintk(1,"res: put\n"); + up(&dev->lock); +} + +static int vivi_do_ioctl(struct inode *inode, struct file *file, unsigned int cmd, void *arg) +{ + struct vivi_fh *fh = file->private_data; + struct vivi_dev *dev = fh->dev; + int ret=0; + + if (debug) { + if (_IOC_DIR(cmd) & _IOC_WRITE) + v4l_printk_ioctl_arg("vivi(w)",cmd, arg); + else if (!_IOC_DIR(cmd) & _IOC_READ) { + v4l_print_ioctl("vivi", cmd); + } + } + + switch(cmd) { + /* --- capabilities ------------------------------------------ */ + case VIDIOC_QUERYCAP: + { + struct v4l2_capability *cap = (struct v4l2_capability*)arg; + + memset(cap, 0, sizeof(*cap)); + + strcpy(cap->driver, "vivi"); + strcpy(cap->card, "vivi"); + cap->version = VIVI_VERSION; + cap->capabilities = + V4L2_CAP_VIDEO_CAPTURE | + V4L2_CAP_STREAMING | + V4L2_CAP_READWRITE; + break; + } + /* --- capture ioctls ---------------------------------------- */ + case VIDIOC_ENUM_FMT: + { + struct v4l2_fmtdesc *f = arg; + enum v4l2_buf_type type; + unsigned int index; + + index = f->index; + type = f->type; + + if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { + ret=-EINVAL; + break; + } + + switch (type) { + case V4L2_BUF_TYPE_VIDEO_CAPTURE: + if (index > 0){ + ret=-EINVAL; + break; + } + memset(f,0,sizeof(*f)); + + f->index = index; + f->type = type; + strlcpy(f->description,format.name,sizeof(f->description)); + f->pixelformat = format.fourcc; + break; + default: + ret=-EINVAL; + } + break; + } + case VIDIOC_G_FMT: + { + struct v4l2_format *f = (struct v4l2_format *)arg; + + if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { + ret=-EINVAL; + break; + } + + memset(&f->fmt.pix,0,sizeof(f->fmt.pix)); + f->fmt.pix.width = fh->width; + f->fmt.pix.height = fh->height; + f->fmt.pix.field = fh->vb_vidq.field; + 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; + break; + } + case VIDIOC_S_FMT: + { + struct v4l2_format *f = arg; + + if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { + dprintk(1,"Only capture supported.\n"); + ret=-EINVAL; + break; + } + + ret = vivi_try_fmt(dev,fh,f); + if (ret < 0) + break; + + fh->fmt = &format; + fh->width = f->fmt.pix.width; + fh->height = f->fmt.pix.height; + fh->vb_vidq.field = f->fmt.pix.field; + fh->type = f->type; + + break; + } + case VIDIOC_TRY_FMT: + { + struct v4l2_format *f = arg; + if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { + ret=-EINVAL; + break; + } + + ret=vivi_try_fmt(dev,fh,f); + break; + } + case VIDIOC_REQBUFS: + if (fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { + ret=-EINVAL; + break; + } + ret=videobuf_reqbufs(&fh->vb_vidq, arg); + break; + case VIDIOC_QUERYBUF: + if (fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { + ret=-EINVAL; + break; + } + ret=videobuf_querybuf(&fh->vb_vidq, arg); + break; + case VIDIOC_QBUF: + if (fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { + ret=-EINVAL; + break; + } + ret=videobuf_qbuf(&fh->vb_vidq, arg); + break; + case VIDIOC_DQBUF: + if (fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { + ret=-EINVAL; + break; + } + ret=videobuf_dqbuf(&fh->vb_vidq, arg, + file->f_flags & O_NONBLOCK); + break; +#ifdef HAVE_V4L1 + /* --- streaming capture ------------------------------------- */ + case VIDIOCGMBUF: + { + struct video_mbuf *mbuf = arg; + struct videobuf_queue *q=&fh->vb_vidq; + struct v4l2_requestbuffers req; + unsigned int i; + + memset(&req,0,sizeof(req)); + req.type = q->type; + req.count = 8; + req.memory = V4L2_MEMORY_MMAP; + ret = videobuf_reqbufs(q,&req); + if (ret < 0) + break; + memset(mbuf,0,sizeof(*mbuf)); + mbuf->frames = req.count; + mbuf->size = 0; + for (i = 0; i < mbuf->frames; i++) { + mbuf->offsets[i] = q->bufs[i]->boff; + mbuf->size += q->bufs[i]->bsize; + } + break; + } +#endif + case VIDIOC_STREAMON: + { + if (fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + if (!res_get(dev,fh)) + return -EBUSY; + ret=videobuf_streamon(&fh->vb_vidq); + break; + } + case VIDIOC_STREAMOFF: + { + if (fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { + ret=-EINVAL; + break; + } + ret = videobuf_streamoff(&fh->vb_vidq); + if (ret < 0) + break; + res_free(dev,fh); + break; + } + /* ---------- tv norms ---------- */ + case VIDIOC_ENUMSTD: + { + struct v4l2_standard *e = arg; + + if (e->index>0) { + ret=-EINVAL; + break; + } + ret = v4l2_video_std_construct(e, V4L2_STD_NTSC_M, "NTSC-M"); + + /* Allows vivi to use different fps from video std */ + e->frameperiod.numerator = WAKE_NUMERATOR; + e->frameperiod.denominator = WAKE_DENOMINATOR; + + break; + } + case VIDIOC_G_STD: + { + v4l2_std_id *id = arg; + + *id = V4L2_STD_NTSC_M; + break; + } + case VIDIOC_S_STD: + { + break; + } + /* ------ input switching ---------- */ + case VIDIOC_ENUMINPUT: + { /* only one input in this sample driver */ + struct v4l2_input *inp = arg; + + if (inp->index != 0) { + ret=-EINVAL; + break; + } + memset(inp, 0, sizeof(*inp)); + + inp->index = 0; + inp->type = V4L2_INPUT_TYPE_CAMERA; + inp->std = V4L2_STD_NTSC_M; + strcpy(inp->name,"Camera"); + break; + } + case VIDIOC_G_INPUT: + { + unsigned int *i = arg; + + *i = 0; + break; + } + case VIDIOC_S_INPUT: + { + unsigned int *i = arg; + + if (*i > 0) + ret=-EINVAL; + break; + } + + /* --- controls ---------------------------------------------- */ + case VIDIOC_QUERYCTRL: + { + struct v4l2_queryctrl *qc = arg; + int i; + + for (i = 0; i < ARRAY_SIZE(vivi_qctrl); i++) + if (qc->id && qc->id == vivi_qctrl[i].id) { + memcpy(qc, &(vivi_qctrl[i]), + sizeof(*qc)); + break; + } + + ret=-EINVAL; + break; + } + case VIDIOC_G_CTRL: + { + struct v4l2_control *ctrl = arg; + int i; + + for (i = 0; i < ARRAY_SIZE(vivi_qctrl); i++) + if (ctrl->id == vivi_qctrl[i].id) { + ctrl->value=qctl_regs[i]; + break; + } + + ret=-EINVAL; + break; + } + case VIDIOC_S_CTRL: + { + struct v4l2_control *ctrl = arg; + int i; + for (i = 0; i < ARRAY_SIZE(vivi_qctrl); i++) + if (ctrl->id == vivi_qctrl[i].id) { + if (ctrl->value < + vivi_qctrl[i].minimum + || ctrl->value > + vivi_qctrl[i].maximum) { + ret=-ERANGE; + break; + } + qctl_regs[i]=ctrl->value; + break; + } + ret=-EINVAL; + break; + } + default: + ret=v4l_compat_translate_ioctl(inode,file,cmd,arg,vivi_do_ioctl); + } + + if (debug) { + if (ret<0) { + v4l_print_ioctl("vivi(err)", cmd); + dprintk(1,"errcode=%d\n",ret); + } else if (_IOC_DIR(cmd) & _IOC_READ) + v4l_printk_ioctl_arg("vivi(r)",cmd, arg); + } + + return ret; +} + +static int vivi_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) +{ + return video_usercopy(inode, file, cmd, arg, vivi_do_ioctl); +} + +/* ------------------------------------------------------------------ + File operations for the device + ------------------------------------------------------------------*/ + +#define line_buf_size(norm) (norm_maxw(norm)*(format.depth+7)/8) + +static int vivi_open(struct inode *inode, struct file *file) +{ + int minor = iminor(inode); + struct vivi_dev *h,*dev = NULL; + struct vivi_fh *fh; + struct list_head *list; + enum v4l2_buf_type type = 0; + int i; + + printk(KERN_DEBUG "vivi: open called (minor=%d)\n",minor); + + list_for_each(list,&vivi_devlist) { + h = list_entry(list, struct vivi_dev, vivi_devlist); + if (h->video_dev.minor == minor) { + dev = h; + type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + } + } + if (NULL == dev) + return -ENODEV; + + + /* If more than one user, mutex should be added */ + dev->users++; + + dprintk(1,"open minor=%d type=%s users=%d\n", + minor,v4l2_type_names[type],dev->users); + + /* allocate + initialize per filehandle data */ + fh = kzalloc(sizeof(*fh),GFP_KERNEL); + if (NULL == fh) { + dev->users--; + return -ENOMEM; + } + + file->private_data = fh; + fh->dev = dev; + fh->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + fh->fmt = &format; + fh->width = 640; + fh->height = 480; + + /* Put all controls at a sane state */ + for (i = 0; i < ARRAY_SIZE(vivi_qctrl); i++) + qctl_regs[i] =vivi_qctrl[i].default_value; + + dprintk(1,"Open: fh=0x%08lx, dev=0x%08lx, dev->vidq=0x%08lx\n", + (unsigned long)fh,(unsigned long)dev,(unsigned long)&dev->vidq); + dprintk(1,"Open: list_empty queued=%d\n",list_empty(&dev->vidq.queued)); + dprintk(1,"Open: list_empty active=%d\n",list_empty(&dev->vidq.active)); + + /* Resets frame counters */ + dev->h=0; + dev->m=0; + dev->s=0; + dev->us=0; + dev->jiffies=jiffies; + sprintf(dev->timestr,"%02d:%02d:%02d:%03d", + dev->h,dev->m,dev->s,(dev->us+500)/1000); + + videobuf_queue_init(&fh->vb_vidq, &vivi_video_qops, + NULL, NULL, + fh->type, + V4L2_FIELD_INTERLACED, + sizeof(struct vivi_buffer),fh); + + return 0; +} + +static ssize_t +vivi_read(struct file *file, char __user *data, size_t count, loff_t *ppos) +{ + struct vivi_fh *fh = file->private_data; + + if (fh->type==V4L2_BUF_TYPE_VIDEO_CAPTURE) { + if (res_locked(fh->dev)) + return -EBUSY; + return videobuf_read_one(&fh->vb_vidq, data, count, ppos, + file->f_flags & O_NONBLOCK); + } + return 0; +} + +static unsigned int +vivi_poll(struct file *file, struct poll_table_struct *wait) +{ + struct vivi_fh *fh = file->private_data; + struct vivi_buffer *buf; + + dprintk(1,"%s\n",__FUNCTION__); + + if (V4L2_BUF_TYPE_VIDEO_CAPTURE != fh->type) + return POLLERR; + + if (res_get(fh->dev,fh)) { + dprintk(1,"poll: mmap interface\n"); + /* streaming capture */ + if (list_empty(&fh->vb_vidq.stream)) + return POLLERR; + buf = list_entry(fh->vb_vidq.stream.next,struct vivi_buffer,vb.stream); + } else { + dprintk(1,"poll: read() interface\n"); + /* read() capture */ + buf = (struct vivi_buffer*)fh->vb_vidq.read_buf; + if (NULL == buf) + return POLLERR; + } + poll_wait(file, &buf->vb.done, wait); + if (buf->vb.state == STATE_DONE || + buf->vb.state == STATE_ERROR) + return POLLIN|POLLRDNORM; + return 0; +} + +static int vivi_release(struct inode *inode, struct file *file) +{ + struct vivi_fh *fh = file->private_data; + struct vivi_dev *dev = fh->dev; + struct vivi_dmaqueue *vidq = &dev->vidq; + + int minor = iminor(inode); + + vivi_stop_thread(vidq); + videobuf_mmap_free(&fh->vb_vidq); + + kfree (fh); + + dev->users--; + + printk(KERN_DEBUG "vivi: close called (minor=%d, users=%d)\n",minor,dev->users); + + return 0; +} + +static int +vivi_mmap(struct file *file, struct vm_area_struct * vma) +{ + struct vivi_fh *fh = file->private_data; + int ret; + + dprintk (1,"mmap called, vma=0x%08lx\n",(unsigned long)vma); + + ret=videobuf_mmap_mapper(&fh->vb_vidq, vma); + + dprintk (1,"vma start=0x%08lx, size=%ld, ret=%d\n", + (unsigned long)vma->vm_start, + (unsigned long)vma->vm_end-(unsigned long)vma->vm_start, + ret); + + return ret; +} + +static struct file_operations vivi_fops = { + .owner = THIS_MODULE, + .open = vivi_open, + .release = vivi_release, + .read = vivi_read, + .poll = vivi_poll, + .ioctl = vivi_ioctl, + .mmap = vivi_mmap, + .llseek = no_llseek, +}; + +static struct video_device vivi = { + .name = "VTM Virtual Video Capture Board", + .type = VID_TYPE_CAPTURE, + .hardware = 0, + .fops = &vivi_fops, + .minor = -1, +// .release = video_device_release, +}; +/* ------------------------------------------------------------------ + Initialization and module stuff + ------------------------------------------------------------------*/ + +static int __init vivi_init(void) +{ + int ret; + struct vivi_dev *dev; + + dev = kzalloc(sizeof(*dev),GFP_KERNEL); + if (NULL == dev) + return -ENOMEM; + list_add_tail(&dev->vivi_devlist,&vivi_devlist); + + /* init video dma queues */ + INIT_LIST_HEAD(&dev->vidq.active); + INIT_LIST_HEAD(&dev->vidq.queued); + + /* initialize locks */ + init_MUTEX(&dev->lock); + + dev->vidq.timeout.function = vivi_vid_timeout; + dev->vidq.timeout.data = (unsigned long)dev; + init_timer(&dev->vidq.timeout); + + ret = video_register_device(&vivi, VFL_TYPE_GRABBER, video_nr); + printk(KERN_INFO "Video Technology Magazine Virtual Video Capture Board (Load status: %d)\n", ret); + return ret; +} + +static void __exit vivi_exit(void) +{ + struct vivi_dev *h; + struct list_head *list; + + list_for_each(list,&vivi_devlist) { + h = list_entry(list, struct vivi_dev, vivi_devlist); + kfree (h); + } + video_unregister_device(&vivi); +} + +module_init(vivi_init); +module_exit(vivi_exit); diff --git a/drivers/media/video/vpx3220.c b/drivers/media/video/vpx3220.c index 4cd579967487..40b205b91481 100644 --- a/drivers/media/video/vpx3220.c +++ b/drivers/media/video/vpx3220.c @@ -1,4 +1,4 @@ -/* +/* * vpx3220a, vpx3216b & vpx3214c video decoder driver version 0.0.1 * * Copyright (C) 2001 Laurent Pinchart <lpinchart@freegates.be> @@ -176,8 +176,8 @@ vpx3220_write_block (struct i2c_client *client, static int vpx3220_write_fp_block (struct i2c_client *client, - const u16 *data, - unsigned int len) + const u16 *data, + unsigned int len) { u8 reg; int ret = 0; @@ -316,7 +316,7 @@ vpx3220_command (struct i2c_client *client, vpx3220_write_fp_block(client, init_fp, sizeof(init_fp) >> 1); switch (decoder->norm) { - + case VIDEO_MODE_NTSC: vpx3220_write_fp_block(client, init_ntsc, sizeof(init_ntsc) >> 1); @@ -324,7 +324,7 @@ vpx3220_command (struct i2c_client *client, case VIDEO_MODE_PAL: vpx3220_write_fp_block(client, init_pal, - sizeof(init_pal) >> 1); + sizeof(init_pal) >> 1); break; case VIDEO_MODE_SECAM: vpx3220_write_fp_block(client, init_secam, @@ -332,10 +332,10 @@ vpx3220_command (struct i2c_client *client, break; default: vpx3220_write_fp_block(client, init_pal, - sizeof(init_pal) >> 1); + sizeof(init_pal) >> 1); break; } - } + } break; case DECODER_DUMP: @@ -411,7 +411,7 @@ vpx3220_command (struct i2c_client *client, /* Here we back up the input selection because it gets overwritten when we fill the registers with the - choosen video norm */ + choosen video norm */ temp_input = vpx3220_fp_read(client, 0xf2); dprintk(1, KERN_DEBUG "%s: DECODER_SET_NORM %d\n", @@ -578,7 +578,7 @@ static unsigned short normal_i2c[] = }; static unsigned short ignore = I2C_CLIENT_END; - + static struct i2c_client_address_data addr_data = { .normal_i2c = normal_i2c, .probe = &ignore, @@ -661,7 +661,7 @@ vpx3220_detect_client (struct i2c_adapter *adapter, break; default: dprintk(1, - KERN_INFO + KERN_INFO "%s: Wrong part number (0x%04x)\n", __func__, pn); kfree(client); diff --git a/drivers/media/video/w9966.c b/drivers/media/video/w9966.c index b7b0afffd214..80ef8a1b8f63 100644 --- a/drivers/media/video/w9966.c +++ b/drivers/media/video/w9966.c @@ -26,7 +26,7 @@ Does any other model using the w9966 interface chip exist ? Todo: - + *Add a working EPP mode, since DMA ECP read isn't implemented in the parport drivers. (That's why it's so sloow) @@ -47,9 +47,9 @@ *Probably some bugs that I don't know of Please support me by sending feedback! - + Changes: - + Alan Cox: Removed RGB mode for kernel merge, added THIS_MODULE and owner support for newer module locks */ @@ -204,7 +204,7 @@ static struct video_device w9966_template = { */ -// Set camera phase flags, so we know what to uninit when terminating +// Set camera phase flags, so we know what to uninit when terminating static inline void w9966_setState(struct w9966_dev* cam, int mask, int val) { cam->dev_state = (cam->dev_state & ~mask) ^ val; @@ -233,7 +233,7 @@ static inline void w9966_pdev_release(struct w9966_dev* cam) parport_release(cam->pdev); w9966_setState(cam, W9966_STATE_CLAIMED, 0); } - + // Read register from W9966 interface-chip // Expects a claimed pdev // -1 on error, else register data (byte) @@ -242,7 +242,7 @@ static int w9966_rReg(struct w9966_dev* cam, int reg) // ECP, read, regtransfer, REG, REG, REG, REG, REG const unsigned char addr = 0x80 | (reg & 0x1f); unsigned char val; - + if (parport_negotiate(cam->pport, cam->ppmode | IEEE1284_ADDR) != 0) return -1; if (parport_write(cam->pport, &addr, 1) != 1) @@ -263,7 +263,7 @@ static int w9966_wReg(struct w9966_dev* cam, int reg, int data) // ECP, write, regtransfer, REG, REG, REG, REG, REG const unsigned char addr = 0xc0 | (reg & 0x1f); const unsigned char val = data; - + if (parport_negotiate(cam->pport, cam->ppmode | IEEE1284_ADDR) != 0) return -1; if (parport_write(cam->pport, &addr, 1) != 1) @@ -284,7 +284,7 @@ static int w9966_init(struct w9966_dev* cam, struct parport* port) { if (cam->dev_state != 0) return -1; - + cam->pport = port; cam->brightness = 128; cam->contrast = 64; @@ -302,7 +302,7 @@ static int w9966_init(struct w9966_dev* cam, struct parport* port) cam->ppmode = IEEE1284_MODE_EPP; else cam->ppmode = IEEE1284_MODE_ECP; - break; + break; case 1: // hw- or sw-ecp cam->ppmode = IEEE1284_MODE_ECP; break; @@ -310,7 +310,7 @@ static int w9966_init(struct w9966_dev* cam, struct parport* port) cam->ppmode = IEEE1284_MODE_EPP; break; } - + // Tell the parport driver that we exists cam->pdev = parport_register_device(port, "w9966", NULL, NULL, NULL, 0, NULL); if (cam->pdev == NULL) { @@ -320,7 +320,7 @@ static int w9966_init(struct w9966_dev* cam, struct parport* port) w9966_setState(cam, W9966_STATE_PDEV, W9966_STATE_PDEV); w9966_pdev_claim(cam); - + // Setup a default capture mode if (w9966_setup(cam, 0, 0, 1023, 1023, 200, 160) != 0) { DPRINTF("w9966_setup() failed.\n"); @@ -333,11 +333,11 @@ static int w9966_init(struct w9966_dev* cam, struct parport* port) memcpy(&cam->vdev, &w9966_template, sizeof(struct video_device)); cam->vdev.priv = cam; - if (video_register_device(&cam->vdev, VFL_TYPE_GRABBER, video_nr) == -1) + if (video_register_device(&cam->vdev, VFL_TYPE_GRABBER, video_nr) == -1) return -1; - + w9966_setState(cam, W9966_STATE_VDEV, W9966_STATE_VDEV); - + // All ok printk( "w9966cf: Found and initialized a webcam on %s.\n", @@ -391,7 +391,7 @@ static int w9966_findlen(int near, int size, int maxlen) // Only continue as long as we keep getting better values if (err > besterr) break; - + besterr = err; bestlen = len; } @@ -399,7 +399,7 @@ static int w9966_findlen(int near, int size, int maxlen) return bestlen; } -// Modify capture window (if necessary) +// Modify capture window (if necessary) // and calculate downscaling // Return -1 on error static int w9966_calcscale(int size, int min, int max, int* beg, int* end, unsigned char* factor) @@ -407,7 +407,7 @@ static int w9966_calcscale(int size, int min, int max, int* beg, int* end, unsig int maxlen = max - min; int len = *end - *beg + 1; int newlen = w9966_findlen(len, size, maxlen); - int err = newlen - len; + int err = newlen - len; // Check for bad format if (newlen > maxlen || newlen < size) @@ -452,8 +452,8 @@ static int w9966_setup(struct w9966_dev* cam, int x1, int y1, int x2, int y2, in 0x48, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71, 0xe7, 0x00, 0x00, 0xc0 }; - - + + if (w*h*2 > W9966_SRAMSIZE) { DPRINTF("capture window exceeds SRAM size!.\n"); @@ -469,9 +469,9 @@ static int w9966_setup(struct w9966_dev* cam, int x1, int y1, int x2, int y2, in cam->width = w; cam->height = h; - enh_s = 0; + enh_s = 0; enh_e = w*h*2; - + // Modify capture window if necessary and calculate downscaling if ( w9966_calcscale(w, W9966_WND_MIN_X, W9966_WND_MAX_X, &x1, &x2, &scale_x) != 0 || @@ -482,14 +482,14 @@ static int w9966_setup(struct w9966_dev* cam, int x1, int y1, int x2, int y2, in "%dx%d, x: %d<->%d, y: %d<->%d, sx: %d/64, sy: %d/64.\n", w, h, x1, x2, y1, y2, scale_x&~0x80, scale_y&~0x80 ); - + // Setup registers regs[0x00] = 0x00; // Set normal operation regs[0x01] = 0x18; // Capture mode regs[0x02] = scale_y; // V-scaling regs[0x03] = scale_x; // H-scaling - - // Capture window + + // Capture window regs[0x04] = (x1 & 0x0ff); // X-start (8 low bits) regs[0x05] = (x1 & 0x300)>>8; // X-start (2 high bits) regs[0x06] = (y1 & 0x0ff); // Y-start (8 low bits) @@ -499,7 +499,7 @@ static int w9966_setup(struct w9966_dev* cam, int x1, int y1, int x2, int y2, in regs[0x0a] = (y2 & 0x0ff); // Y-end (8 low bits) regs[0x0c] = W9966_SRAMID; // SRAM-banks (1x 128kb) - + // Enhancement layer regs[0x0d] = (enh_s& 0x000ff); // Enh. start (0-7) regs[0x0e] = (enh_s& 0x0ff00)>>8; // Enh. start (8-15) @@ -515,7 +515,7 @@ static int w9966_setup(struct w9966_dev* cam, int x1, int y1, int x2, int y2, in regs[0x19] = 0xff; // I/O port direction control regs[0x1a] = 0xff; // I/O port data register regs[0x1b] = 0x10; // ??? - + // SAA7111 chip settings saa7111_regs[0x0a] = cam->brightness; saa7111_regs[0x0b] = cam->contrast; @@ -551,7 +551,7 @@ static inline void w9966_i2c_setsda(struct w9966_dev* cam, int state) cam->i2c_state |= W9966_I2C_W_DATA; else cam->i2c_state &= ~W9966_I2C_W_DATA; - + w9966_wReg(cam, 0x18, cam->i2c_state); udelay(5); } @@ -577,7 +577,7 @@ static inline int w9966_i2c_setscl(struct w9966_dev* cam, int state) w9966_wReg(cam, 0x18, cam->i2c_state); udelay(5); - + // we go to high, we also expect the peripheral to ack. if (state) { timeout = jiffies + 100; @@ -607,16 +607,16 @@ static int w9966_i2c_wbyte(struct w9966_dev* cam, int data) w9966_i2c_setsda(cam, (data >> i) & 0x01); if (w9966_i2c_setscl(cam, 1) == -1) - return -1; + return -1; w9966_i2c_setscl(cam, 0); } w9966_i2c_setsda(cam, 1); - + if (w9966_i2c_setscl(cam, 1) == -1) return -1; w9966_i2c_setscl(cam, 0); - + return 0; } @@ -626,8 +626,8 @@ static int w9966_i2c_wbyte(struct w9966_dev* cam, int data) static int w9966_i2c_rbyte(struct w9966_dev* cam) { unsigned char data = 0x00; - int i; - + int i; + w9966_i2c_setsda(cam, 1); for (i = 0; i < 8; i++) @@ -637,7 +637,7 @@ static int w9966_i2c_rbyte(struct w9966_dev* cam) data = data << 1; if (w9966_i2c_getsda(cam)) data |= 0x01; - + w9966_i2c_setscl(cam, 0); } return data; @@ -673,11 +673,11 @@ static int w9966_rReg_i2c(struct w9966_dev* cam, int reg) return -1; w9966_i2c_setsda(cam, 0); - + if (w9966_i2c_setscl(cam, 1) == -1) return -1; w9966_i2c_setsda(cam, 1); - + return data; } #endif @@ -699,7 +699,7 @@ static int w9966_wReg_i2c(struct w9966_dev* cam, int reg, int data) w9966_i2c_setsda(cam, 0); if (w9966_i2c_setscl(cam, 1) == -1) return -1; - + w9966_i2c_setsda(cam, 1); return 0; @@ -714,7 +714,7 @@ static int w9966_v4l_do_ioctl(struct inode *inode, struct file *file, { struct video_device *vdev = video_devdata(file); struct w9966_dev *cam = vdev->priv; - + switch(cmd) { case VIDIOCGCAP: @@ -790,14 +790,14 @@ static int w9966_v4l_do_ioctl(struct inode *inode, struct file *file, struct video_picture *vpic = arg; if (vpic->depth != 16 || vpic->palette != VIDEO_PALETTE_YUV422) return -EINVAL; - + cam->brightness = vpic->brightness >> 8; cam->hue = (vpic->hue >> 8) - 128; cam->color = vpic->colour >> 9; cam->contrast = vpic->contrast >> 9; w9966_pdev_claim(cam); - + if ( w9966_wReg_i2c(cam, 0x0a, cam->brightness) == -1 || w9966_wReg_i2c(cam, 0x0b, cam->contrast) == -1 || @@ -807,7 +807,7 @@ static int w9966_v4l_do_ioctl(struct inode *inode, struct file *file, w9966_pdev_release(cam); return -EIO; } - + w9966_pdev_release(cam); return 0; } @@ -815,13 +815,13 @@ static int w9966_v4l_do_ioctl(struct inode *inode, struct file *file, { int ret; struct video_window *vwin = arg; - + if (vwin->flags != 0) return -EINVAL; if (vwin->clipcount != 0) return -EINVAL; if (vwin->width < 2 || vwin->width > W9966_WND_MAX_W) - return -EINVAL; + return -EINVAL; if (vwin->height < 1 || vwin->height > W9966_WND_MAX_H) return -EINVAL; @@ -829,12 +829,12 @@ static int w9966_v4l_do_ioctl(struct inode *inode, struct file *file, w9966_pdev_claim(cam); ret = w9966_setup(cam, 0, 0, 1023, 1023, vwin->width, vwin->height); w9966_pdev_release(cam); - + if (ret != 0) { DPRINTF("VIDIOCSWIN: w9966_setup() failed.\n"); return -EIO; } - + return 0; } case VIDIOCGWIN: @@ -846,7 +846,7 @@ static int w9966_v4l_do_ioctl(struct inode *inode, struct file *file, return 0; } // Unimplemented - case VIDIOCCAPTURE: + case VIDIOCCAPTURE: case VIDIOCGFBUF: case VIDIOCSFBUF: case VIDIOCKEY: @@ -877,17 +877,17 @@ static ssize_t w9966_v4l_read(struct file *file, char __user *buf, unsigned char __user *dest = (unsigned char __user *)buf; unsigned long dleft = count; unsigned char *tbuf; - + // Why would anyone want more than this?? if (count > cam->width * cam->height * 2) return -EINVAL; - + w9966_pdev_claim(cam); w9966_wReg(cam, 0x00, 0x02); // Reset ECP-FIFO buffer w9966_wReg(cam, 0x00, 0x00); // Return to normal operation w9966_wReg(cam, 0x01, 0x98); // Enable capture - // write special capture-addr and negotiate into data transfer + // write special capture-addr and negotiate into data transfer if ( (parport_negotiate(cam->pport, cam->ppmode|IEEE1284_ADDR) != 0 )|| (parport_write(cam->pport, &addr, 1) != 1 )|| @@ -906,7 +906,7 @@ static ssize_t w9966_v4l_read(struct file *file, char __user *buf, while(dleft > 0) { unsigned long tsize = (dleft > W9966_RBUFFER) ? W9966_RBUFFER : dleft; - + if (parport_read(cam->pport, tbuf, tsize) < tsize) { count = -EFAULT; goto out; @@ -933,7 +933,7 @@ out: static void w9966_attach(struct parport *port) { int i; - + for (i = 0; i < W9966_MAXCAMS; i++) { if (w9966_cams[i].dev_state != 0) // Cam is already assigned diff --git a/drivers/usb/media/w9968cf.c b/drivers/media/video/w9968cf.c index b57dec3782e0..20f211b55ad4 100644 --- a/drivers/usb/media/w9968cf.c +++ b/drivers/media/video/w9968cf.c @@ -71,39 +71,39 @@ MODULE_SUPPORTED_DEVICE("Video"); static int ovmod_load = W9968CF_OVMOD_LOAD; static unsigned short simcams = W9968CF_SIMCAMS; static short video_nr[]={[0 ... W9968CF_MAX_DEVICES-1] = -1}; /*-1=first free*/ -static unsigned int packet_size[] = {[0 ... W9968CF_MAX_DEVICES-1] = - W9968CF_PACKET_SIZE}; -static unsigned short max_buffers[] = {[0 ... W9968CF_MAX_DEVICES-1] = - W9968CF_BUFFERS}; -static int double_buffer[] = {[0 ... W9968CF_MAX_DEVICES-1] = - W9968CF_DOUBLE_BUFFER}; +static unsigned int packet_size[] = {[0 ... W9968CF_MAX_DEVICES-1] = + W9968CF_PACKET_SIZE}; +static unsigned short max_buffers[] = {[0 ... W9968CF_MAX_DEVICES-1] = + W9968CF_BUFFERS}; +static int double_buffer[] = {[0 ... W9968CF_MAX_DEVICES-1] = + W9968CF_DOUBLE_BUFFER}; static int clamping[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_CLAMPING}; -static unsigned short filter_type[]= {[0 ... W9968CF_MAX_DEVICES-1] = - W9968CF_FILTER_TYPE}; +static unsigned short filter_type[]= {[0 ... W9968CF_MAX_DEVICES-1] = + W9968CF_FILTER_TYPE}; static int largeview[]= {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_LARGEVIEW}; -static unsigned short decompression[] = {[0 ... W9968CF_MAX_DEVICES-1] = - W9968CF_DECOMPRESSION}; +static unsigned short decompression[] = {[0 ... W9968CF_MAX_DEVICES-1] = + W9968CF_DECOMPRESSION}; static int upscaling[]= {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_UPSCALING}; static unsigned short force_palette[] = {[0 ... W9968CF_MAX_DEVICES-1] = 0}; static int force_rgb[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_FORCE_RGB}; static int autobright[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_AUTOBRIGHT}; static int autoexp[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_AUTOEXP}; -static unsigned short lightfreq[] = {[0 ... W9968CF_MAX_DEVICES-1] = - W9968CF_LIGHTFREQ}; +static unsigned short lightfreq[] = {[0 ... W9968CF_MAX_DEVICES-1] = + W9968CF_LIGHTFREQ}; static int bandingfilter[] = {[0 ... W9968CF_MAX_DEVICES-1]= - W9968CF_BANDINGFILTER}; + W9968CF_BANDINGFILTER}; static short clockdiv[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_CLOCKDIV}; static int backlight[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_BACKLIGHT}; static int mirror[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_MIRROR}; static int monochrome[] = {[0 ... W9968CF_MAX_DEVICES-1]=W9968CF_MONOCHROME}; -static unsigned int brightness[] = {[0 ... W9968CF_MAX_DEVICES-1] = - W9968CF_BRIGHTNESS}; +static unsigned int brightness[] = {[0 ... W9968CF_MAX_DEVICES-1] = + W9968CF_BRIGHTNESS}; static unsigned int hue[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_HUE}; static unsigned int colour[]={[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_COLOUR}; -static unsigned int contrast[] = {[0 ... W9968CF_MAX_DEVICES-1] = - W9968CF_CONTRAST}; -static unsigned int whiteness[] = {[0 ... W9968CF_MAX_DEVICES-1] = - W9968CF_WHITENESS}; +static unsigned int contrast[] = {[0 ... W9968CF_MAX_DEVICES-1] = + W9968CF_CONTRAST}; +static unsigned int whiteness[] = {[0 ... W9968CF_MAX_DEVICES-1] = + W9968CF_WHITENESS}; #ifdef W9968CF_DEBUG static unsigned short debug = W9968CF_DEBUG_LEVEL; static int specific_debug = W9968CF_SPECIFIC_DEBUG; @@ -145,251 +145,251 @@ module_param(specific_debug, bool, 0644); #endif #ifdef CONFIG_KMOD -MODULE_PARM_DESC(ovmod_load, - "\n<0|1> Automatic 'ovcamchip' module loading." - "\n0 disabled, 1 enabled." - "\nIf enabled,'insmod' searches for the required 'ovcamchip'" - "\nmodule in the system, according to its configuration, and" - "\nattempts to load that module automatically. This action is" - "\nperformed once as soon as the 'w9968cf' module is loaded" - "\ninto memory." - "\nDefault value is "__MODULE_STRING(W9968CF_OVMOD_LOAD)"." - "\n"); +MODULE_PARM_DESC(ovmod_load, + "\n<0|1> Automatic 'ovcamchip' module loading." + "\n0 disabled, 1 enabled." + "\nIf enabled,'insmod' searches for the required 'ovcamchip'" + "\nmodule in the system, according to its configuration, and" + "\nattempts to load that module automatically. This action is" + "\nperformed once as soon as the 'w9968cf' module is loaded" + "\ninto memory." + "\nDefault value is "__MODULE_STRING(W9968CF_OVMOD_LOAD)"." + "\n"); #endif -MODULE_PARM_DESC(simcams, - "\n<n> Number of cameras allowed to stream simultaneously." - "\nn may vary from 0 to " - __MODULE_STRING(W9968CF_MAX_DEVICES)"." - "\nDefault value is "__MODULE_STRING(W9968CF_SIMCAMS)"." - "\n"); +MODULE_PARM_DESC(simcams, + "\n<n> Number of cameras allowed to stream simultaneously." + "\nn may vary from 0 to " + __MODULE_STRING(W9968CF_MAX_DEVICES)"." + "\nDefault value is "__MODULE_STRING(W9968CF_SIMCAMS)"." + "\n"); MODULE_PARM_DESC(video_nr, - "\n<-1|n[,...]> Specify V4L minor mode number." - "\n -1 = use next available (default)" - "\n n = use minor number n (integer >= 0)" - "\nYou can specify up to "__MODULE_STRING(W9968CF_MAX_DEVICES) - " cameras this way." - "\nFor example:" - "\nvideo_nr=-1,2,-1 would assign minor number 2 to" - "\nthe second camera and use auto for the first" - "\none and for every other camera." - "\n"); + "\n<-1|n[,...]> Specify V4L minor mode number." + "\n -1 = use next available (default)" + "\n n = use minor number n (integer >= 0)" + "\nYou can specify up to "__MODULE_STRING(W9968CF_MAX_DEVICES) + " cameras this way." + "\nFor example:" + "\nvideo_nr=-1,2,-1 would assign minor number 2 to" + "\nthe second camera and use auto for the first" + "\none and for every other camera." + "\n"); MODULE_PARM_DESC(packet_size, - "\n<n[,...]> Specify the maximum data payload" - "\nsize in bytes for alternate settings, for each device." - "\nn is scaled between 63 and 1023 " - "(default is "__MODULE_STRING(W9968CF_PACKET_SIZE)")." - "\n"); + "\n<n[,...]> Specify the maximum data payload" + "\nsize in bytes for alternate settings, for each device." + "\nn is scaled between 63 and 1023 " + "(default is "__MODULE_STRING(W9968CF_PACKET_SIZE)")." + "\n"); MODULE_PARM_DESC(max_buffers, - "\n<n[,...]> For advanced users." - "\nSpecify the maximum number of video frame buffers" - "\nto allocate for each device, from 2 to " - __MODULE_STRING(W9968CF_MAX_BUFFERS) - ". (default is "__MODULE_STRING(W9968CF_BUFFERS)")." - "\n"); -MODULE_PARM_DESC(double_buffer, - "\n<0|1[,...]> " - "Hardware double buffering: 0 disabled, 1 enabled." - "\nIt should be enabled if you want smooth video output: if" - "\nyou obtain out of sync. video, disable it, or try to" - "\ndecrease the 'clockdiv' module parameter value." - "\nDefault value is "__MODULE_STRING(W9968CF_DOUBLE_BUFFER) - " for every device." - "\n"); -MODULE_PARM_DESC(clamping, - "\n<0|1[,...]> Video data clamping: 0 disabled, 1 enabled." - "\nDefault value is "__MODULE_STRING(W9968CF_CLAMPING) - " for every device." - "\n"); -MODULE_PARM_DESC(filter_type, - "\n<0|1|2[,...]> Video filter type." - "\n0 none, 1 (1-2-1) 3-tap filter, " - "2 (2-3-6-3-2) 5-tap filter." - "\nDefault value is "__MODULE_STRING(W9968CF_FILTER_TYPE) - " for every device." - "\nThe filter is used to reduce noise and aliasing artifacts" - "\nproduced by the CCD or CMOS image sensor, and the scaling" - " process." - "\n"); -MODULE_PARM_DESC(largeview, - "\n<0|1[,...]> Large view: 0 disabled, 1 enabled." - "\nDefault value is "__MODULE_STRING(W9968CF_LARGEVIEW) - " for every device." - "\n"); -MODULE_PARM_DESC(upscaling, - "\n<0|1[,...]> Software scaling (for non-compressed video):" - "\n0 disabled, 1 enabled." - "\nDisable it if you have a slow CPU or you don't have" - " enough memory." - "\nDefault value is "__MODULE_STRING(W9968CF_UPSCALING) - " for every device." - "\nIf 'w9968cf-vpp' is not present, this parameter is" - " set to 0." - "\n"); + "\n<n[,...]> For advanced users." + "\nSpecify the maximum number of video frame buffers" + "\nto allocate for each device, from 2 to " + __MODULE_STRING(W9968CF_MAX_BUFFERS) + ". (default is "__MODULE_STRING(W9968CF_BUFFERS)")." + "\n"); +MODULE_PARM_DESC(double_buffer, + "\n<0|1[,...]> " + "Hardware double buffering: 0 disabled, 1 enabled." + "\nIt should be enabled if you want smooth video output: if" + "\nyou obtain out of sync. video, disable it, or try to" + "\ndecrease the 'clockdiv' module parameter value." + "\nDefault value is "__MODULE_STRING(W9968CF_DOUBLE_BUFFER) + " for every device." + "\n"); +MODULE_PARM_DESC(clamping, + "\n<0|1[,...]> Video data clamping: 0 disabled, 1 enabled." + "\nDefault value is "__MODULE_STRING(W9968CF_CLAMPING) + " for every device." + "\n"); +MODULE_PARM_DESC(filter_type, + "\n<0|1|2[,...]> Video filter type." + "\n0 none, 1 (1-2-1) 3-tap filter, " + "2 (2-3-6-3-2) 5-tap filter." + "\nDefault value is "__MODULE_STRING(W9968CF_FILTER_TYPE) + " for every device." + "\nThe filter is used to reduce noise and aliasing artifacts" + "\nproduced by the CCD or CMOS image sensor, and the scaling" + " process." + "\n"); +MODULE_PARM_DESC(largeview, + "\n<0|1[,...]> Large view: 0 disabled, 1 enabled." + "\nDefault value is "__MODULE_STRING(W9968CF_LARGEVIEW) + " for every device." + "\n"); +MODULE_PARM_DESC(upscaling, + "\n<0|1[,...]> Software scaling (for non-compressed video):" + "\n0 disabled, 1 enabled." + "\nDisable it if you have a slow CPU or you don't have" + " enough memory." + "\nDefault value is "__MODULE_STRING(W9968CF_UPSCALING) + " for every device." + "\nIf 'w9968cf-vpp' is not present, this parameter is" + " set to 0." + "\n"); MODULE_PARM_DESC(decompression, - "\n<0|1|2[,...]> Software video decompression:" - "\n- 0 disables decompression (doesn't allow formats needing" - " decompression)" - "\n- 1 forces decompression (allows formats needing" - " decompression only);" - "\n- 2 allows any permitted formats." - "\nFormats supporting compressed video are YUV422P and" - " YUV420P/YUV420 " - "\nin any resolutions where both width and height are " - "a multiple of 16." - "\nDefault value is "__MODULE_STRING(W9968CF_DECOMPRESSION) - " for every device." - "\nIf 'w9968cf-vpp' is not present, forcing decompression is " - "\nnot allowed; in this case this parameter is set to 2." - "\n"); + "\n<0|1|2[,...]> Software video decompression:" + "\n- 0 disables decompression (doesn't allow formats needing" + " decompression)" + "\n- 1 forces decompression (allows formats needing" + " decompression only);" + "\n- 2 allows any permitted formats." + "\nFormats supporting compressed video are YUV422P and" + " YUV420P/YUV420 " + "\nin any resolutions where both width and height are " + "a multiple of 16." + "\nDefault value is "__MODULE_STRING(W9968CF_DECOMPRESSION) + " for every device." + "\nIf 'w9968cf-vpp' is not present, forcing decompression is " + "\nnot allowed; in this case this parameter is set to 2." + "\n"); MODULE_PARM_DESC(force_palette, - "\n<0" - "|" __MODULE_STRING(VIDEO_PALETTE_UYVY) - "|" __MODULE_STRING(VIDEO_PALETTE_YUV420) - "|" __MODULE_STRING(VIDEO_PALETTE_YUV422P) - "|" __MODULE_STRING(VIDEO_PALETTE_YUV420P) - "|" __MODULE_STRING(VIDEO_PALETTE_YUYV) - "|" __MODULE_STRING(VIDEO_PALETTE_YUV422) - "|" __MODULE_STRING(VIDEO_PALETTE_GREY) - "|" __MODULE_STRING(VIDEO_PALETTE_RGB555) - "|" __MODULE_STRING(VIDEO_PALETTE_RGB565) - "|" __MODULE_STRING(VIDEO_PALETTE_RGB24) - "|" __MODULE_STRING(VIDEO_PALETTE_RGB32) - "[,...]>" - " Force picture palette." - "\nIn order:" - "\n- 0 allows any of the following formats:" - "\n- UYVY 16 bpp - Original video, compression disabled" - "\n- YUV420 12 bpp - Original video, compression enabled" - "\n- YUV422P 16 bpp - Original video, compression enabled" - "\n- YUV420P 12 bpp - Original video, compression enabled" - "\n- YUVY 16 bpp - Software conversion from UYVY" - "\n- YUV422 16 bpp - Software conversion from UYVY" - "\n- GREY 8 bpp - Software conversion from UYVY" - "\n- RGB555 16 bpp - Software conversion from UYVY" - "\n- RGB565 16 bpp - Software conversion from UYVY" - "\n- RGB24 24 bpp - Software conversion from UYVY" - "\n- RGB32 32 bpp - Software conversion from UYVY" - "\nWhen not 0, this parameter will override 'decompression'." - "\nDefault value is 0 for every device." - "\nInitial palette is " - __MODULE_STRING(W9968CF_PALETTE_DECOMP_ON)"." - "\nIf 'w9968cf-vpp' is not present, this parameter is" - " set to 9 (UYVY)." - "\n"); -MODULE_PARM_DESC(force_rgb, - "\n<0|1[,...]> Read RGB video data instead of BGR:" - "\n 1 = use RGB component ordering." - "\n 0 = use BGR component ordering." - "\nThis parameter has effect when using RGBX palettes only." - "\nDefault value is "__MODULE_STRING(W9968CF_FORCE_RGB) - " for every device." - "\n"); + "\n<0" + "|" __MODULE_STRING(VIDEO_PALETTE_UYVY) + "|" __MODULE_STRING(VIDEO_PALETTE_YUV420) + "|" __MODULE_STRING(VIDEO_PALETTE_YUV422P) + "|" __MODULE_STRING(VIDEO_PALETTE_YUV420P) + "|" __MODULE_STRING(VIDEO_PALETTE_YUYV) + "|" __MODULE_STRING(VIDEO_PALETTE_YUV422) + "|" __MODULE_STRING(VIDEO_PALETTE_GREY) + "|" __MODULE_STRING(VIDEO_PALETTE_RGB555) + "|" __MODULE_STRING(VIDEO_PALETTE_RGB565) + "|" __MODULE_STRING(VIDEO_PALETTE_RGB24) + "|" __MODULE_STRING(VIDEO_PALETTE_RGB32) + "[,...]>" + " Force picture palette." + "\nIn order:" + "\n- 0 allows any of the following formats:" + "\n- UYVY 16 bpp - Original video, compression disabled" + "\n- YUV420 12 bpp - Original video, compression enabled" + "\n- YUV422P 16 bpp - Original video, compression enabled" + "\n- YUV420P 12 bpp - Original video, compression enabled" + "\n- YUVY 16 bpp - Software conversion from UYVY" + "\n- YUV422 16 bpp - Software conversion from UYVY" + "\n- GREY 8 bpp - Software conversion from UYVY" + "\n- RGB555 16 bpp - Software conversion from UYVY" + "\n- RGB565 16 bpp - Software conversion from UYVY" + "\n- RGB24 24 bpp - Software conversion from UYVY" + "\n- RGB32 32 bpp - Software conversion from UYVY" + "\nWhen not 0, this parameter will override 'decompression'." + "\nDefault value is 0 for every device." + "\nInitial palette is " + __MODULE_STRING(W9968CF_PALETTE_DECOMP_ON)"." + "\nIf 'w9968cf-vpp' is not present, this parameter is" + " set to 9 (UYVY)." + "\n"); +MODULE_PARM_DESC(force_rgb, + "\n<0|1[,...]> Read RGB video data instead of BGR:" + "\n 1 = use RGB component ordering." + "\n 0 = use BGR component ordering." + "\nThis parameter has effect when using RGBX palettes only." + "\nDefault value is "__MODULE_STRING(W9968CF_FORCE_RGB) + " for every device." + "\n"); MODULE_PARM_DESC(autobright, - "\n<0|1[,...]> Image sensor automatically changes brightness:" - "\n 0 = no, 1 = yes" - "\nDefault value is "__MODULE_STRING(W9968CF_AUTOBRIGHT) - " for every device." - "\n"); + "\n<0|1[,...]> Image sensor automatically changes brightness:" + "\n 0 = no, 1 = yes" + "\nDefault value is "__MODULE_STRING(W9968CF_AUTOBRIGHT) + " for every device." + "\n"); MODULE_PARM_DESC(autoexp, - "\n<0|1[,...]> Image sensor automatically changes exposure:" - "\n 0 = no, 1 = yes" - "\nDefault value is "__MODULE_STRING(W9968CF_AUTOEXP) - " for every device." - "\n"); + "\n<0|1[,...]> Image sensor automatically changes exposure:" + "\n 0 = no, 1 = yes" + "\nDefault value is "__MODULE_STRING(W9968CF_AUTOEXP) + " for every device." + "\n"); MODULE_PARM_DESC(lightfreq, - "\n<50|60[,...]> Light frequency in Hz:" - "\n 50 for European and Asian lighting," - " 60 for American lighting." - "\nDefault value is "__MODULE_STRING(W9968CF_LIGHTFREQ) - " for every device." - "\n"); + "\n<50|60[,...]> Light frequency in Hz:" + "\n 50 for European and Asian lighting," + " 60 for American lighting." + "\nDefault value is "__MODULE_STRING(W9968CF_LIGHTFREQ) + " for every device." + "\n"); MODULE_PARM_DESC(bandingfilter, - "\n<0|1[,...]> Banding filter to reduce effects of" - " fluorescent lighting:" - "\n 0 disabled, 1 enabled." - "\nThis filter tries to reduce the pattern of horizontal" - "\nlight/dark bands caused by some (usually fluorescent)" - " lighting." - "\nDefault value is "__MODULE_STRING(W9968CF_BANDINGFILTER) - " for every device." - "\n"); + "\n<0|1[,...]> Banding filter to reduce effects of" + " fluorescent lighting:" + "\n 0 disabled, 1 enabled." + "\nThis filter tries to reduce the pattern of horizontal" + "\nlight/dark bands caused by some (usually fluorescent)" + " lighting." + "\nDefault value is "__MODULE_STRING(W9968CF_BANDINGFILTER) + " for every device." + "\n"); MODULE_PARM_DESC(clockdiv, - "\n<-1|n[,...]> " - "Force pixel clock divisor to a specific value (for experts):" - "\n n may vary from 0 to 127." - "\n -1 for automatic value." - "\nSee also the 'double_buffer' module parameter." - "\nDefault value is "__MODULE_STRING(W9968CF_CLOCKDIV) - " for every device." - "\n"); + "\n<-1|n[,...]> " + "Force pixel clock divisor to a specific value (for experts):" + "\n n may vary from 0 to 127." + "\n -1 for automatic value." + "\nSee also the 'double_buffer' module parameter." + "\nDefault value is "__MODULE_STRING(W9968CF_CLOCKDIV) + " for every device." + "\n"); MODULE_PARM_DESC(backlight, - "\n<0|1[,...]> Objects are lit from behind:" - "\n 0 = no, 1 = yes" - "\nDefault value is "__MODULE_STRING(W9968CF_BACKLIGHT) - " for every device." - "\n"); + "\n<0|1[,...]> Objects are lit from behind:" + "\n 0 = no, 1 = yes" + "\nDefault value is "__MODULE_STRING(W9968CF_BACKLIGHT) + " for every device." + "\n"); MODULE_PARM_DESC(mirror, - "\n<0|1[,...]> Reverse image horizontally:" - "\n 0 = no, 1 = yes" - "\nDefault value is "__MODULE_STRING(W9968CF_MIRROR) - " for every device." - "\n"); + "\n<0|1[,...]> Reverse image horizontally:" + "\n 0 = no, 1 = yes" + "\nDefault value is "__MODULE_STRING(W9968CF_MIRROR) + " for every device." + "\n"); MODULE_PARM_DESC(monochrome, - "\n<0|1[,...]> Use image sensor as monochrome sensor:" - "\n 0 = no, 1 = yes" - "\nNot all the sensors support monochrome color." - "\nDefault value is "__MODULE_STRING(W9968CF_MONOCHROME) - " for every device." - "\n"); -MODULE_PARM_DESC(brightness, - "\n<n[,...]> Set picture brightness (0-65535)." - "\nDefault value is "__MODULE_STRING(W9968CF_BRIGHTNESS) - " for every device." - "\nThis parameter has no effect if 'autobright' is enabled." - "\n"); -MODULE_PARM_DESC(hue, - "\n<n[,...]> Set picture hue (0-65535)." - "\nDefault value is "__MODULE_STRING(W9968CF_HUE) - " for every device." - "\n"); -MODULE_PARM_DESC(colour, - "\n<n[,...]> Set picture saturation (0-65535)." - "\nDefault value is "__MODULE_STRING(W9968CF_COLOUR) - " for every device." - "\n"); -MODULE_PARM_DESC(contrast, - "\n<n[,...]> Set picture contrast (0-65535)." - "\nDefault value is "__MODULE_STRING(W9968CF_CONTRAST) - " for every device." - "\n"); -MODULE_PARM_DESC(whiteness, - "\n<n[,...]> Set picture whiteness (0-65535)." - "\nDefault value is "__MODULE_STRING(W9968CF_WHITENESS) - " for every device." - "\n"); + "\n<0|1[,...]> Use image sensor as monochrome sensor:" + "\n 0 = no, 1 = yes" + "\nNot all the sensors support monochrome color." + "\nDefault value is "__MODULE_STRING(W9968CF_MONOCHROME) + " for every device." + "\n"); +MODULE_PARM_DESC(brightness, + "\n<n[,...]> Set picture brightness (0-65535)." + "\nDefault value is "__MODULE_STRING(W9968CF_BRIGHTNESS) + " for every device." + "\nThis parameter has no effect if 'autobright' is enabled." + "\n"); +MODULE_PARM_DESC(hue, + "\n<n[,...]> Set picture hue (0-65535)." + "\nDefault value is "__MODULE_STRING(W9968CF_HUE) + " for every device." + "\n"); +MODULE_PARM_DESC(colour, + "\n<n[,...]> Set picture saturation (0-65535)." + "\nDefault value is "__MODULE_STRING(W9968CF_COLOUR) + " for every device." + "\n"); +MODULE_PARM_DESC(contrast, + "\n<n[,...]> Set picture contrast (0-65535)." + "\nDefault value is "__MODULE_STRING(W9968CF_CONTRAST) + " for every device." + "\n"); +MODULE_PARM_DESC(whiteness, + "\n<n[,...]> Set picture whiteness (0-65535)." + "\nDefault value is "__MODULE_STRING(W9968CF_WHITENESS) + " for every device." + "\n"); #ifdef W9968CF_DEBUG MODULE_PARM_DESC(debug, - "\n<n> Debugging information level, from 0 to 6:" - "\n0 = none (use carefully)" - "\n1 = critical errors" - "\n2 = significant informations" - "\n3 = configuration or general messages" - "\n4 = warnings" - "\n5 = called functions" - "\n6 = function internals" - "\nLevel 5 and 6 are useful for testing only, when only " - "one device is used." - "\nDefault value is "__MODULE_STRING(W9968CF_DEBUG_LEVEL)"." - "\n"); + "\n<n> Debugging information level, from 0 to 6:" + "\n0 = none (use carefully)" + "\n1 = critical errors" + "\n2 = significant informations" + "\n3 = configuration or general messages" + "\n4 = warnings" + "\n5 = called functions" + "\n6 = function internals" + "\nLevel 5 and 6 are useful for testing only, when only " + "one device is used." + "\nDefault value is "__MODULE_STRING(W9968CF_DEBUG_LEVEL)"." + "\n"); MODULE_PARM_DESC(specific_debug, - "\n<0|1> Enable or disable specific debugging messages:" - "\n0 = print messages concerning every level" - " <= 'debug' level." - "\n1 = print messages concerning the level" - " indicated by 'debug'." - "\nDefault value is " - __MODULE_STRING(W9968CF_SPECIFIC_DEBUG)"." - "\n"); + "\n<0|1> Enable or disable specific debugging messages:" + "\n0 = print messages concerning every level" + " <= 'debug' level." + "\n1 = print messages concerning the level" + " indicated by 'debug'." + "\nDefault value is " + __MODULE_STRING(W9968CF_SPECIFIC_DEBUG)"." + "\n"); #endif /* W9968CF_DEBUG */ @@ -406,7 +406,7 @@ static int w9968cf_mmap(struct file*, struct vm_area_struct*); static int w9968cf_ioctl(struct inode*, struct file*, unsigned, unsigned long); static ssize_t w9968cf_read(struct file*, char __user *, size_t, loff_t*); static int w9968cf_v4l_ioctl(struct inode*, struct file*, unsigned int, - void __user *); + void __user *); /* USB-specific */ static int w9968cf_start_transfer(struct w9968cf_device*); @@ -428,25 +428,25 @@ static int w9968cf_smbus_write_ack(struct w9968cf_device*); static int w9968cf_smbus_read_ack(struct w9968cf_device*); static int w9968cf_smbus_refresh_bus(struct w9968cf_device*); static int w9968cf_i2c_adap_read_byte(struct w9968cf_device* cam, - u16 address, u8* value); -static int w9968cf_i2c_adap_read_byte_data(struct w9968cf_device*, u16 address, - u8 subaddress, u8* value); + u16 address, u8* value); +static int w9968cf_i2c_adap_read_byte_data(struct w9968cf_device*, u16 address, + u8 subaddress, u8* value); static int w9968cf_i2c_adap_write_byte(struct w9968cf_device*, - u16 address, u8 subaddress); + u16 address, u8 subaddress); static int w9968cf_i2c_adap_fastwrite_byte_data(struct w9968cf_device*, - u16 address, u8 subaddress, - u8 value); + u16 address, u8 subaddress, + u8 value); /* I2C interface to kernel */ static int w9968cf_i2c_init(struct w9968cf_device*); -static int w9968cf_i2c_smbus_xfer(struct i2c_adapter*, u16 addr, - unsigned short flags, char read_write, - u8 command, int size, union i2c_smbus_data*); +static int w9968cf_i2c_smbus_xfer(struct i2c_adapter*, u16 addr, + unsigned short flags, char read_write, + u8 command, int size, union i2c_smbus_data*); static u32 w9968cf_i2c_func(struct i2c_adapter*); static int w9968cf_i2c_attach_inform(struct i2c_client*); static int w9968cf_i2c_detach_inform(struct i2c_client*); static int w9968cf_i2c_control(struct i2c_adapter*, unsigned int cmd, - unsigned long arg); + unsigned long arg); /* Memory management */ static void* rvmalloc(unsigned long size); @@ -458,17 +458,17 @@ static int w9968cf_allocate_memory(struct w9968cf_device*); static int w9968cf_sensor_set_control(struct w9968cf_device*,int cid,int val); static int w9968cf_sensor_get_control(struct w9968cf_device*,int cid,int *val); static int w9968cf_sensor_cmd(struct w9968cf_device*, - unsigned int cmd, void *arg); + unsigned int cmd, void *arg); static int w9968cf_sensor_init(struct w9968cf_device*); static int w9968cf_sensor_update_settings(struct w9968cf_device*); static int w9968cf_sensor_get_picture(struct w9968cf_device*); -static int w9968cf_sensor_update_picture(struct w9968cf_device*, - struct video_picture pict); +static int w9968cf_sensor_update_picture(struct w9968cf_device*, + struct video_picture pict); /* Other helper functions */ static void w9968cf_configure_camera(struct w9968cf_device*,struct usb_device*, - enum w9968cf_model_id, - const unsigned short dev_nr); + enum w9968cf_model_id, + const unsigned short dev_nr); static void w9968cf_adjust_configuration(struct w9968cf_device*); static int w9968cf_turn_on_led(struct w9968cf_device*); static int w9968cf_init_chip(struct w9968cf_device*); @@ -477,8 +477,8 @@ static inline u16 w9968cf_valid_depth(u16 palette); static inline u8 w9968cf_need_decompression(u16 palette); static int w9968cf_set_picture(struct w9968cf_device*, struct video_picture); static int w9968cf_set_window(struct w9968cf_device*, struct video_window); -static int w9968cf_postprocess_frame(struct w9968cf_device*, - struct w9968cf_frame_t*); +static int w9968cf_postprocess_frame(struct w9968cf_device*, + struct w9968cf_frame_t*); static int w9968cf_adjust_window_size(struct w9968cf_device*, u16* w, u16* h); static void w9968cf_init_framelist(struct w9968cf_device*); static void w9968cf_push_frame(struct w9968cf_device*, u8 f_num); @@ -497,11 +497,11 @@ struct w9968cf_symbolic_list { const char *name; }; -/*-------------------------------------------------------------------------- +/*-------------------------------------------------------------------------- Returns the name of the matching element in the symbolic_list array. The end of the list must be marked with an element that has a NULL name. --------------------------------------------------------------------------*/ -static inline const char * +static inline const char * symbolic(struct w9968cf_symbolic_list list[], const int num) { int i; @@ -568,7 +568,7 @@ static struct w9968cf_symbolic_list v4l1_plist[] = { static struct w9968cf_symbolic_list decoder_errlist[] = { { W9968CF_DEC_ERR_CORRUPTED_DATA, "Corrupted data" }, { W9968CF_DEC_ERR_BUF_OVERFLOW, "Buffer overflow" }, - { W9968CF_DEC_ERR_NO_SOI, "SOI marker not found" }, + { W9968CF_DEC_ERR_NO_SOI, "SOI marker not found" }, { W9968CF_DEC_ERR_NO_SOF0, "SOF0 marker not found" }, { W9968CF_DEC_ERR_NO_SOS, "SOS marker not found" }, { W9968CF_DEC_ERR_NO_EOI, "EOI marker not found" }, @@ -695,7 +695,7 @@ static int w9968cf_allocate_memory(struct w9968cf_device* cam) bpp = (w9968cf_vpp) ? 4 : 2; if (cam->upscaling) vpp_bufsize = max(W9968CF_MAX_WIDTH*W9968CF_MAX_HEIGHT*bpp, - cam->maxwidth*cam->maxheight*bpp); + cam->maxwidth*cam->maxheight*bpp); else vpp_bufsize = cam->maxwidth*cam->maxheight*bpp; @@ -704,7 +704,7 @@ static int w9968cf_allocate_memory(struct w9968cf_device* cam) if (!(cam->transfer_buffer[i] = kzalloc(W9968CF_ISO_PACKETS*p_size, GFP_KERNEL))) { DBG(1, "Couldn't allocate memory for the isochronous " - "transfer buffers (%u bytes)", + "transfer buffers (%u bytes)", p_size * W9968CF_ISO_PACKETS) return -ENOMEM; } @@ -780,7 +780,7 @@ static int w9968cf_allocate_memory(struct w9968cf_device* cam) of the next video frame; if an error is encountered in a packet, the entire video frame is discarded and grabbed again. If there are no requested frames in the FIFO list, packets are collected into - a temporary buffer. + a temporary buffer. --------------------------------------------------------------------------*/ static void w9968cf_urb_complete(struct urb *urb, struct pt_regs *regs) { @@ -799,7 +799,7 @@ static void w9968cf_urb_complete(struct urb *urb, struct pt_regs *regs) /* "(*f)" will be used instead of "cam->frame_current" */ f = &cam->frame_current; - /* If a frame has been requested and we are grabbing into + /* If a frame has been requested and we are grabbing into the temporary frame, we'll switch to that requested frame */ if ((*f) == &cam->frame_tmp && *cam->requested_frame) { if (cam->frame_tmp.status == F_GRABBING) { @@ -808,7 +808,7 @@ static void w9968cf_urb_complete(struct urb *urb, struct pt_regs *regs) (*f)->length = cam->frame_tmp.length; memcpy((*f)->buffer, cam->frame_tmp.buffer, (*f)->length); - DBG(6, "Switched from temp. frame to frame #%d", + DBG(6, "Switched from temp. frame to frame #%d", (*f)->number) } } @@ -850,7 +850,7 @@ static void w9968cf_urb_complete(struct urb *urb, struct pt_regs *regs) if (cam->vpp_flag & VPP_DECOMPRESSION) { err = w9968cf_vpp->check_headers((*f)->buffer, - (*f)->length); + (*f)->length); if (err) { DBG(4, "Skip corrupted frame: %s", symbolic(decoder_errlist, err)) @@ -975,7 +975,7 @@ static int w9968cf_start_transfer(struct w9968cf_device* cam) cam->frame_current = &cam->frame_tmp; if (!(cam->vpp_flag & VPP_DECOMPRESSION)) - DBG(5, "Isochronous transfer size: %lu bytes/frame", + DBG(5, "Isochronous transfer size: %lu bytes/frame", (unsigned long)t_size*2) DBG(5, "Starting the isochronous transfer...") @@ -992,7 +992,7 @@ static int w9968cf_start_transfer(struct w9968cf_device* cam) usb_free_urb(cam->urb[j]); } DBG(1, "Couldn't send a transfer request to the " - "USB core (error #%d, %s)", err, + "USB core (error #%d, %s)", err, symbolic(urb_errlist, err)) return err; } @@ -1016,7 +1016,7 @@ static int w9968cf_stop_transfer(struct w9968cf_device* cam) if (!cam->streaming) return 0; - /* This avoids race conditions with usb_submit_urb() + /* This avoids race conditions with usb_submit_urb() in the URB completition handler */ spin_lock_irqsave(&cam->urb_lock, lock_flags); cam->streaming = 0; @@ -1050,7 +1050,7 @@ exit: /*-------------------------------------------------------------------------- - Write a W9968CF register. + Write a W9968CF register. Return 0 on success, -1 otherwise. --------------------------------------------------------------------------*/ static int w9968cf_write_reg(struct w9968cf_device* cam, u16 value, u16 index) @@ -1059,8 +1059,8 @@ static int w9968cf_write_reg(struct w9968cf_device* cam, u16 value, u16 index) int res; res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0, - USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_DEVICE, - value, index, NULL, 0, W9968CF_USB_CTRL_TIMEOUT); + USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_DEVICE, + value, index, NULL, 0, W9968CF_USB_CTRL_TIMEOUT); if (res < 0) DBG(4, "Failed to write a register " @@ -1072,7 +1072,7 @@ static int w9968cf_write_reg(struct w9968cf_device* cam, u16 value, u16 index) /*-------------------------------------------------------------------------- - Read a W9968CF register. + Read a W9968CF register. Return the register value on success, -1 otherwise. --------------------------------------------------------------------------*/ static int w9968cf_read_reg(struct w9968cf_device* cam, u16 index) @@ -1082,8 +1082,8 @@ static int w9968cf_read_reg(struct w9968cf_device* cam, u16 index) int res; res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 1, - USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - 0, index, buff, 2, W9968CF_USB_CTRL_TIMEOUT); + USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + 0, index, buff, 2, W9968CF_USB_CTRL_TIMEOUT); if (res < 0) DBG(4, "Failed to read a register " @@ -1107,8 +1107,8 @@ static int w9968cf_write_fsb(struct w9968cf_device* cam, u16* data) value = *data++; res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0, - USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_DEVICE, - value, 0x06, data, 6, W9968CF_USB_CTRL_TIMEOUT); + USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_DEVICE, + value, 0x06, data, 6, W9968CF_USB_CTRL_TIMEOUT); if (res < 0) DBG(4, "Failed to write the FSB registers " @@ -1287,9 +1287,9 @@ static int w9968cf_smbus_refresh_bus(struct w9968cf_device* cam) /* SMBus protocol: S Addr Wr [A] Subaddr [A] Value [A] P */ -static int -w9968cf_i2c_adap_fastwrite_byte_data(struct w9968cf_device* cam, - u16 address, u8 subaddress,u8 value) +static int +w9968cf_i2c_adap_fastwrite_byte_data(struct w9968cf_device* cam, + u16 address, u8 subaddress,u8 value) { u16* data = cam->data_buffer; int err = 0; @@ -1348,7 +1348,7 @@ w9968cf_i2c_adap_fastwrite_byte_data(struct w9968cf_device* cam, "value 0x%02X", address, subaddress, value) else DBG(5, "I2C write byte data failed, addr.0x%04X, " - "subaddr.0x%02X, value 0x%02X", + "subaddr.0x%02X, value 0x%02X", address, subaddress, value) return err; @@ -1356,10 +1356,10 @@ w9968cf_i2c_adap_fastwrite_byte_data(struct w9968cf_device* cam, /* SMBus protocol: S Addr Wr [A] Subaddr [A] P S Addr+1 Rd [A] [Value] NA P */ -static int -w9968cf_i2c_adap_read_byte_data(struct w9968cf_device* cam, - u16 address, u8 subaddress, - u8* value) +static int +w9968cf_i2c_adap_read_byte_data(struct w9968cf_device* cam, + u16 address, u8 subaddress, + u8* value) { int err = 0; @@ -1384,7 +1384,7 @@ w9968cf_i2c_adap_read_byte_data(struct w9968cf_device* cam, if (!err) DBG(5, "I2C read byte data done, addr.0x%04X, " - "subaddr.0x%02X, value 0x%02X", + "subaddr.0x%02X, value 0x%02X", address, subaddress, *value) else DBG(5, "I2C read byte data failed, addr.0x%04X, " @@ -1396,9 +1396,9 @@ w9968cf_i2c_adap_read_byte_data(struct w9968cf_device* cam, /* SMBus protocol: S Addr+1 Rd [A] [Value] NA P */ -static int +static int w9968cf_i2c_adap_read_byte(struct w9968cf_device* cam, - u16 address, u8* value) + u16 address, u8* value) { int err = 0; @@ -1411,7 +1411,7 @@ w9968cf_i2c_adap_read_byte(struct w9968cf_device* cam, err += w9968cf_smbus_read_byte(cam, value); err += w9968cf_smbus_write_ack(cam); err += w9968cf_smbus_stop(cam); - + /* Serial data disable */ err += w9968cf_write_sb(cam, 0x0000); @@ -1427,9 +1427,9 @@ w9968cf_i2c_adap_read_byte(struct w9968cf_device* cam, /* SMBus protocol: S Addr Wr [A] Value [A] P */ -static int +static int w9968cf_i2c_adap_write_byte(struct w9968cf_device* cam, - u16 address, u8 value) + u16 address, u8 value) { DBG(4, "i2c_write_byte() is an unsupported transfer mode") return -EINVAL; @@ -1442,13 +1442,13 @@ w9968cf_i2c_adap_write_byte(struct w9968cf_device* cam, ****************************************************************************/ static int -w9968cf_i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr, - unsigned short flags, char read_write, u8 command, - int size, union i2c_smbus_data *data) +w9968cf_i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr, + unsigned short flags, char read_write, u8 command, + int size, union i2c_smbus_data *data) { struct w9968cf_device* cam = i2c_get_adapdata(adapter); u8 i; - int err = 0; + int err = 0; switch (addr) { case OV6xx0_SID: @@ -1464,20 +1464,20 @@ w9968cf_i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr, addr <<= 1; if (read_write == I2C_SMBUS_WRITE) - err = w9968cf_i2c_adap_write_byte(cam, addr, command); - else if (read_write == I2C_SMBUS_READ) + err = w9968cf_i2c_adap_write_byte(cam, addr, command); + else if (read_write == I2C_SMBUS_READ) err = w9968cf_i2c_adap_read_byte(cam,addr,&data->byte); } else if (size == I2C_SMBUS_BYTE_DATA) { addr <<= 1; if (read_write == I2C_SMBUS_WRITE) - err = w9968cf_i2c_adap_fastwrite_byte_data(cam, addr, - command, data->byte); + err = w9968cf_i2c_adap_fastwrite_byte_data(cam, addr, + command, data->byte); else if (read_write == I2C_SMBUS_READ) { for (i = 1; i <= W9968CF_I2C_RW_RETRIES; i++) { err = w9968cf_i2c_adap_read_byte_data(cam,addr, - command, &data->byte); + command, &data->byte); if (err) { if (w9968cf_smbus_refresh_bus(cam)) { err = -EIO; @@ -1520,7 +1520,7 @@ static int w9968cf_i2c_attach_inform(struct i2c_client* client) return err; } } else { - DBG(4, "Rejected client [%s] with driver [%s]", + DBG(4, "Rejected client [%s] with driver [%s]", client->name, client->driver->driver.name) return -EINVAL; } @@ -1545,9 +1545,9 @@ static int w9968cf_i2c_detach_inform(struct i2c_client* client) } -static int +static int w9968cf_i2c_control(struct i2c_adapter* adapter, unsigned int cmd, - unsigned long arg) + unsigned long arg) { return 0; } @@ -1625,12 +1625,12 @@ static int w9968cf_turn_on_led(struct w9968cf_device* cam) static int w9968cf_init_chip(struct w9968cf_device* cam) { unsigned long hw_bufsize = cam->maxwidth*cam->maxheight*2, - y0 = 0x0000, - u0 = y0 + hw_bufsize/2, - v0 = u0 + hw_bufsize/4, - y1 = v0 + hw_bufsize/4, - u1 = y1 + hw_bufsize/2, - v1 = u1 + hw_bufsize/4; + y0 = 0x0000, + u0 = y0 + hw_bufsize/2, + v0 = u0 + hw_bufsize/4, + y1 = v0 + hw_bufsize/4, + u1 = y1 + hw_bufsize/2, + v1 = u1 + hw_bufsize/4; int err = 0; err += w9968cf_write_reg(cam, 0xff00, 0x00); /* power off */ @@ -1762,7 +1762,7 @@ w9968cf_set_picture(struct w9968cf_device* cam, struct video_picture pict) cam->vpp_flag = VPP_SWAP_YUV_BYTES; hw_palette = VIDEO_PALETTE_UYVY; break; - /* Original video is used instead of RGBX palettes. + /* Original video is used instead of RGBX palettes. Software conversion later. */ case VIDEO_PALETTE_GREY: case VIDEO_PALETTE_RGB555: @@ -1777,7 +1777,7 @@ w9968cf_set_picture(struct w9968cf_device* cam, struct video_picture pict) } /* NOTE: due to memory issues, it is better to disable the hardware - double buffering during compression */ + double buffering during compression */ if (cam->double_buffer && !(cam->vpp_flag & VPP_DECOMPRESSION)) reg_v |= 0x0080; @@ -1832,8 +1832,8 @@ w9968cf_set_window(struct w9968cf_device* cam, struct video_window win) #define __UNSC(x) ((x) >> 10) /* Make sure we are using a supported resolution */ - if ((err = w9968cf_adjust_window_size(cam, (u16*)&win.width, - (u16*)&win.height))) + if ((err = w9968cf_adjust_window_size(cam, (u16*)&win.width, + (u16*)&win.height))) goto error; /* Scaling factors */ @@ -1962,7 +1962,7 @@ w9968cf_set_window(struct w9968cf_device* cam, struct video_window win) /* Settings changed, so we clear the frame buffers */ memset(cam->frame[0].buffer, 0, cam->nbuffers*cam->frame[0].size); - DBG(4, "The capture area is %dx%d, Offset (x,y)=(%u,%u)", + DBG(4, "The capture area is %dx%d, Offset (x,y)=(%u,%u)", win.width, win.height, win.x, win.y) PDBGG("x=%u ,y=%u, w=%u, h=%u, ax=%u, ay=%u, s_win.x=%u, s_win.y=%u, " @@ -1978,11 +1978,11 @@ error: } -/*-------------------------------------------------------------------------- +/*-------------------------------------------------------------------------- Adjust the asked values for window width and height. Return 0 on success, -1 otherwise. --------------------------------------------------------------------------*/ -static int +static int w9968cf_adjust_window_size(struct w9968cf_device* cam, u16* width, u16* height) { u16 maxw, maxh; @@ -1992,10 +1992,10 @@ w9968cf_adjust_window_size(struct w9968cf_device* cam, u16* width, u16* height) maxw = cam->upscaling && !(cam->vpp_flag & VPP_DECOMPRESSION) && w9968cf_vpp ? max((u16)W9968CF_MAX_WIDTH, cam->maxwidth) - : cam->maxwidth; + : cam->maxwidth; maxh = cam->upscaling && !(cam->vpp_flag & VPP_DECOMPRESSION) && w9968cf_vpp ? max((u16)W9968CF_MAX_HEIGHT, cam->maxheight) - : cam->maxheight; + : cam->maxheight; if (*width > maxw) *width = maxw; @@ -2054,7 +2054,7 @@ static void w9968cf_push_frame(struct w9968cf_device* cam, u8 f_num) Read, store and remove the first pointer in the FIFO list of requested frames. This function is called in interrupt context. --------------------------------------------------------------------------*/ -static void +static void w9968cf_pop_frame(struct w9968cf_device* cam, struct w9968cf_frame_t** framep) { u8 i; @@ -2078,9 +2078,9 @@ w9968cf_pop_frame(struct w9968cf_device* cam, struct w9968cf_frame_t** framep) High-level video post-processing routine on grabbed frames. Return 0 on success, a negative number otherwise. --------------------------------------------------------------------------*/ -static int -w9968cf_postprocess_frame(struct w9968cf_device* cam, - struct w9968cf_frame_t* fr) +static int +w9968cf_postprocess_frame(struct w9968cf_device* cam, + struct w9968cf_frame_t* fr) { void *pIn = fr->buffer, *pOut = cam->frame_vpp.buffer, *tmp; u16 w = cam->window.width, @@ -2127,7 +2127,7 @@ w9968cf_postprocess_frame(struct w9968cf_device* cam, w9968cf_vpp->uyvy_to_rgbx(pIn, fr->length, pOut, fmt, rgb); fr->length = (w*h*d)/8; _PSWAP(pIn, pOut) - DBG(6, "UYVY-16bit to %s conversion done", + DBG(6, "UYVY-16bit to %s conversion done", symbolic(v4l1_plist, fmt)) } @@ -2143,7 +2143,7 @@ w9968cf_postprocess_frame(struct w9968cf_device* cam, * Image sensor control routines * ****************************************************************************/ -static int +static int w9968cf_sensor_set_control(struct w9968cf_device* cam, int cid, int val) { struct ovcamchip_control ctl; @@ -2158,7 +2158,7 @@ w9968cf_sensor_set_control(struct w9968cf_device* cam, int cid, int val) } -static int +static int w9968cf_sensor_get_control(struct w9968cf_device* cam, int cid, int* val) { struct ovcamchip_control ctl; @@ -2198,38 +2198,38 @@ static int w9968cf_sensor_update_settings(struct w9968cf_device* cam) int err = 0; /* Auto brightness */ - err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_AUTOBRIGHT, - cam->auto_brt); + err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_AUTOBRIGHT, + cam->auto_brt); if (err) return err; /* Auto exposure */ - err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_AUTOEXP, - cam->auto_exp); + err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_AUTOEXP, + cam->auto_exp); if (err) return err; /* Banding filter */ - err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_BANDFILT, - cam->bandfilt); + err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_BANDFILT, + cam->bandfilt); if (err) return err; /* Light frequency */ err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_FREQ, - cam->lightfreq); + cam->lightfreq); if (err) return err; /* Back light */ err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_BACKLIGHT, - cam->backlight); + cam->backlight); if (err) return err; /* Mirror */ err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_MIRROR, - cam->mirror); + cam->mirror); if (err) return err; @@ -2281,15 +2281,15 @@ static int w9968cf_sensor_get_picture(struct w9968cf_device* cam) Returns: 0 on success, a negative number otherwise. --------------------------------------------------------------------------*/ static int -w9968cf_sensor_update_picture(struct w9968cf_device* cam, - struct video_picture pict) +w9968cf_sensor_update_picture(struct w9968cf_device* cam, + struct video_picture pict) { int err = 0; if ((!cam->sensor_initialized) || pict.contrast != cam->picture.contrast) { err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_CONT, - pict.contrast); + pict.contrast); if (err) goto fail; DBG(4, "Contrast changed from %u to %u", @@ -2297,10 +2297,10 @@ w9968cf_sensor_update_picture(struct w9968cf_device* cam, cam->picture.contrast = pict.contrast; } - if (((!cam->sensor_initialized) || + if (((!cam->sensor_initialized) || pict.brightness != cam->picture.brightness) && (!cam->auto_brt)) { - err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_BRIGHT, - pict.brightness); + err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_BRIGHT, + pict.brightness); if (err) goto fail; DBG(4, "Brightness changed from %u to %u", @@ -2309,8 +2309,8 @@ w9968cf_sensor_update_picture(struct w9968cf_device* cam, } if ((!cam->sensor_initialized) || pict.colour != cam->picture.colour) { - err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_SAT, - pict.colour); + err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_SAT, + pict.colour); if (err) goto fail; DBG(4, "Colour changed from %u to %u", @@ -2319,8 +2319,8 @@ w9968cf_sensor_update_picture(struct w9968cf_device* cam, } if ((!cam->sensor_initialized) || pict.hue != cam->picture.hue) { - err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_HUE, - pict.hue); + err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_HUE, + pict.hue); if (err) goto fail; DBG(4, "Hue changed from %u to %u", @@ -2349,12 +2349,12 @@ static int w9968cf_sensor_init(struct w9968cf_device* cam) { int err = 0; - if ((err = w9968cf_sensor_cmd(cam, OVCAMCHIP_CMD_INITIALIZE, - &cam->monochrome))) + if ((err = w9968cf_sensor_cmd(cam, OVCAMCHIP_CMD_INITIALIZE, + &cam->monochrome))) goto error; - if ((err = w9968cf_sensor_cmd(cam, OVCAMCHIP_CMD_Q_SUBTYPE, - &cam->sensor))) + if ((err = w9968cf_sensor_cmd(cam, OVCAMCHIP_CMD_Q_SUBTYPE, + &cam->sensor))) goto error; /* NOTE: Make sure width and height are a multiple of 16 */ @@ -2416,14 +2416,14 @@ error: /*-------------------------------------------------------------------------- Fill some basic fields in the main device data structure. - This function is called once on w9968cf_usb_probe() for each recognized + This function is called once on w9968cf_usb_probe() for each recognized camera. --------------------------------------------------------------------------*/ static void w9968cf_configure_camera(struct w9968cf_device* cam, - struct usb_device* udev, - enum w9968cf_model_id mod_id, - const unsigned short dev_nr) + struct usb_device* udev, + enum w9968cf_model_id mod_id, + const unsigned short dev_nr) { mutex_init(&cam->fileop_mutex); init_waitqueue_head(&cam->open); @@ -2444,60 +2444,60 @@ w9968cf_configure_camera(struct w9968cf_device* cam, packet_size[dev_nr] < wMaxPacketSize[cam->altsetting-1]; cam->altsetting++); - cam->max_buffers = (max_buffers[dev_nr] < 2 || - max_buffers[dev_nr] > W9968CF_MAX_BUFFERS) - ? W9968CF_BUFFERS : (u8)max_buffers[dev_nr]; + cam->max_buffers = (max_buffers[dev_nr] < 2 || + max_buffers[dev_nr] > W9968CF_MAX_BUFFERS) + ? W9968CF_BUFFERS : (u8)max_buffers[dev_nr]; - cam->double_buffer = (double_buffer[dev_nr] == 0 || - double_buffer[dev_nr] == 1) - ? (u8)double_buffer[dev_nr]:W9968CF_DOUBLE_BUFFER; + cam->double_buffer = (double_buffer[dev_nr] == 0 || + double_buffer[dev_nr] == 1) + ? (u8)double_buffer[dev_nr]:W9968CF_DOUBLE_BUFFER; cam->clamping = (clamping[dev_nr] == 0 || clamping[dev_nr] == 1) - ? (u8)clamping[dev_nr] : W9968CF_CLAMPING; - + ? (u8)clamping[dev_nr] : W9968CF_CLAMPING; + cam->filter_type = (filter_type[dev_nr] == 0 || - filter_type[dev_nr] == 1 || - filter_type[dev_nr] == 2) - ? (u8)filter_type[dev_nr] : W9968CF_FILTER_TYPE; + filter_type[dev_nr] == 1 || + filter_type[dev_nr] == 2) + ? (u8)filter_type[dev_nr] : W9968CF_FILTER_TYPE; cam->capture = 1; cam->largeview = (largeview[dev_nr] == 0 || largeview[dev_nr] == 1) - ? (u8)largeview[dev_nr] : W9968CF_LARGEVIEW; + ? (u8)largeview[dev_nr] : W9968CF_LARGEVIEW; - cam->decompression = (decompression[dev_nr] == 0 || - decompression[dev_nr] == 1 || - decompression[dev_nr] == 2) - ? (u8)decompression[dev_nr]:W9968CF_DECOMPRESSION; + cam->decompression = (decompression[dev_nr] == 0 || + decompression[dev_nr] == 1 || + decompression[dev_nr] == 2) + ? (u8)decompression[dev_nr]:W9968CF_DECOMPRESSION; - cam->upscaling = (upscaling[dev_nr] == 0 || - upscaling[dev_nr] == 1) - ? (u8)upscaling[dev_nr] : W9968CF_UPSCALING; + cam->upscaling = (upscaling[dev_nr] == 0 || + upscaling[dev_nr] == 1) + ? (u8)upscaling[dev_nr] : W9968CF_UPSCALING; cam->auto_brt = (autobright[dev_nr] == 0 || autobright[dev_nr] == 1) - ? (u8)autobright[dev_nr] : W9968CF_AUTOBRIGHT; + ? (u8)autobright[dev_nr] : W9968CF_AUTOBRIGHT; cam->auto_exp = (autoexp[dev_nr] == 0 || autoexp[dev_nr] == 1) - ? (u8)autoexp[dev_nr] : W9968CF_AUTOEXP; + ? (u8)autoexp[dev_nr] : W9968CF_AUTOEXP; cam->lightfreq = (lightfreq[dev_nr] == 50 || lightfreq[dev_nr] == 60) - ? (u8)lightfreq[dev_nr] : W9968CF_LIGHTFREQ; + ? (u8)lightfreq[dev_nr] : W9968CF_LIGHTFREQ; - cam->bandfilt = (bandingfilter[dev_nr] == 0 || - bandingfilter[dev_nr] == 1) - ? (u8)bandingfilter[dev_nr] : W9968CF_BANDINGFILTER; + cam->bandfilt = (bandingfilter[dev_nr] == 0 || + bandingfilter[dev_nr] == 1) + ? (u8)bandingfilter[dev_nr] : W9968CF_BANDINGFILTER; cam->backlight = (backlight[dev_nr] == 0 || backlight[dev_nr] == 1) - ? (u8)backlight[dev_nr] : W9968CF_BACKLIGHT; + ? (u8)backlight[dev_nr] : W9968CF_BACKLIGHT; cam->clockdiv = (clockdiv[dev_nr] == -1 || clockdiv[dev_nr] >= 0) - ? (s8)clockdiv[dev_nr] : W9968CF_CLOCKDIV; + ? (s8)clockdiv[dev_nr] : W9968CF_CLOCKDIV; cam->mirror = (mirror[dev_nr] == 0 || mirror[dev_nr] == 1) - ? (u8)mirror[dev_nr] : W9968CF_MIRROR; + ? (u8)mirror[dev_nr] : W9968CF_MIRROR; cam->monochrome = (monochrome[dev_nr] == 0 || monochrome[dev_nr] == 1) - ? monochrome[dev_nr] : W9968CF_MONOCHROME; + ? monochrome[dev_nr] : W9968CF_MONOCHROME; cam->picture.brightness = (u16)brightness[dev_nr]; cam->picture.hue = (u16)hue[dev_nr]; @@ -2519,7 +2519,7 @@ w9968cf_configure_camera(struct w9968cf_device* cam, cam->picture.depth = w9968cf_valid_depth(cam->picture.palette); cam->force_rgb = (force_rgb[dev_nr] == 0 || force_rgb[dev_nr] == 1) - ? (u8)force_rgb[dev_nr] : W9968CF_FORCE_RGB; + ? (u8)force_rgb[dev_nr] : W9968CF_FORCE_RGB; cam->window.x = 0; cam->window.y = 0; @@ -2531,16 +2531,16 @@ w9968cf_configure_camera(struct w9968cf_device* cam, DBG(3, "%s configured with settings #%u:", symbolic(camlist, cam->id), dev_nr) - + DBG(3, "- Data packet size for USB isochrnous transfer: %u bytes", wMaxPacketSize[cam->altsetting-1]) - + DBG(3, "- Number of requested video frame buffers: %u", cam->max_buffers) if (cam->double_buffer) DBG(3, "- Hardware double buffering enabled") - else + else DBG(3, "- Hardware double buffering disabled") if (cam->filter_type == 0) @@ -2648,7 +2648,7 @@ static void w9968cf_adjust_configuration(struct w9968cf_device* cam) /*-------------------------------------------------------------------------- Release the resources used by the driver. - This function is called on disconnect + This function is called on disconnect (or on close if deallocation has been deferred) --------------------------------------------------------------------------*/ static void w9968cf_release_resources(struct w9968cf_device* cam) @@ -2706,8 +2706,8 @@ static int w9968cf_open(struct inode* inode, struct file* filp) } mutex_unlock(&cam->dev_mutex); err = wait_event_interruptible_exclusive(cam->open, - cam->disconnected || - !cam->users); + cam->disconnected || + !cam->users); if (err) { up_read(&w9968cf_disconnect); return err; @@ -2820,9 +2820,9 @@ w9968cf_read(struct file* filp, char __user * buf, size_t count, loff_t* f_pos) w9968cf_push_frame(cam, 1); err = wait_event_interruptible(cam->wait_queue, - cam->frame[0].status == F_READY || - cam->frame[1].status == F_READY || - cam->disconnected); + cam->frame[0].status == F_READY || + cam->frame[1].status == F_READY || + cam->disconnected); if (err) { mutex_unlock(&cam->fileop_mutex); return err; @@ -2859,12 +2859,12 @@ w9968cf_read(struct file* filp, char __user * buf, size_t count, loff_t* f_pos) static int w9968cf_mmap(struct file* filp, struct vm_area_struct *vma) { struct w9968cf_device* cam = (struct w9968cf_device*) - video_get_drvdata(video_devdata(filp)); + video_get_drvdata(video_devdata(filp)); unsigned long vsize = vma->vm_end - vma->vm_start, - psize = cam->nbuffers * cam->frame[0].size, - start = vma->vm_start, - pos = (unsigned long)cam->frame[0].buffer, - page; + psize = cam->nbuffers * cam->frame[0].size, + start = vma->vm_start, + pos = (unsigned long)cam->frame[0].buffer, + page; if (cam->disconnected) { DBG(2, "Device not present") @@ -2898,7 +2898,7 @@ static int w9968cf_mmap(struct file* filp, struct vm_area_struct *vma) static int w9968cf_ioctl(struct inode* inode, struct file* filp, - unsigned int cmd, unsigned long arg) + unsigned int cmd, unsigned long arg) { struct w9968cf_device* cam; int err; @@ -2928,21 +2928,21 @@ w9968cf_ioctl(struct inode* inode, struct file* filp, static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, - unsigned int cmd, void __user * arg) + unsigned int cmd, void __user * arg) { struct w9968cf_device* cam; const char* v4l1_ioctls[] = { - "?", "CGAP", "GCHAN", "SCHAN", "GTUNER", "STUNER", + "?", "CGAP", "GCHAN", "SCHAN", "GTUNER", "STUNER", "GPICT", "SPICT", "CCAPTURE", "GWIN", "SWIN", "GFBUF", "SFBUF", "KEY", "GFREQ", "SFREQ", "GAUDIO", "SAUDIO", "SYNC", "MCAPTURE", "GMBUF", "GUNIT", "GCAPTURE", "SCAPTURE", - "SPLAYMODE", "SWRITEMODE", "GPLAYINFO", "SMICROCODE", - "GVBIFMT", "SVBIFMT" + "SPLAYMODE", "SWRITEMODE", "GPLAYINFO", "SMICROCODE", + "GVBIFMT", "SVBIFMT" }; #define V4L1_IOCTL(cmd) \ - ((_IOC_NR((cmd)) < ARRAY_SIZE(v4l1_ioctls)) ? \ - v4l1_ioctls[_IOC_NR((cmd))] : "?") + ((_IOC_NR((cmd)) < ARRAY_SIZE(v4l1_ioctls)) ? \ + v4l1_ioctls[_IOC_NR((cmd))] : "?") cam = (struct w9968cf_device*)video_get_drvdata(video_devdata(filp)); @@ -2957,14 +2957,14 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, .minwidth = cam->minwidth, .minheight = cam->minheight, }; - sprintf(cap.name, "W996[87]CF USB Camera #%d", - cam->v4ldev->minor); + sprintf(cap.name, "W996[87]CF USB Camera #%d", + cam->v4ldev->minor); cap.maxwidth = (cam->upscaling && w9968cf_vpp) - ? max((u16)W9968CF_MAX_WIDTH, cam->maxwidth) - : cam->maxwidth; + ? max((u16)W9968CF_MAX_WIDTH, cam->maxwidth) + : cam->maxwidth; cap.maxheight = (cam->upscaling && w9968cf_vpp) - ? max((u16)W9968CF_MAX_HEIGHT, cam->maxheight) - : cam->maxheight; + ? max((u16)W9968CF_MAX_HEIGHT, cam->maxheight) + : cam->maxheight; if (copy_to_user(arg, &cap, sizeof(cap))) return -EFAULT; @@ -3029,7 +3029,7 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, if (copy_from_user(&pict, arg, sizeof(pict))) return -EFAULT; - if ( (cam->force_palette || !w9968cf_vpp) + if ( (cam->force_palette || !w9968cf_vpp) && pict.palette != cam->picture.palette ) { DBG(4, "Palette %s rejected: only %s is allowed", symbolic(v4l1_plist, pict.palette), @@ -3046,24 +3046,24 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, if (!cam->force_palette) { if (cam->decompression == 0) { if (w9968cf_need_decompression(pict.palette)) { - DBG(4, "Decompression disabled: palette %s is not " - "allowed. VIDIOCSPICT failed", - symbolic(v4l1_plist, pict.palette)) - return -EINVAL; + DBG(4, "Decompression disabled: palette %s is not " + "allowed. VIDIOCSPICT failed", + symbolic(v4l1_plist, pict.palette)) + return -EINVAL; } } else if (cam->decompression == 1) { if (!w9968cf_need_decompression(pict.palette)) { - DBG(4, "Decompression forced: palette %s is not " - "allowed. VIDIOCSPICT failed", - symbolic(v4l1_plist, pict.palette)) - return -EINVAL; + DBG(4, "Decompression forced: palette %s is not " + "allowed. VIDIOCSPICT failed", + symbolic(v4l1_plist, pict.palette)) + return -EINVAL; } } } if (pict.depth != w9968cf_valid_depth(pict.palette)) { DBG(4, "Requested depth %u bpp is not valid for %s " - "palette: ignored and changed to %u bpp", + "palette: ignored and changed to %u bpp", pict.depth, symbolic(v4l1_plist, pict.palette), w9968cf_valid_depth(pict.palette)) pict.depth = w9968cf_valid_depth(pict.palette); @@ -3074,9 +3074,9 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, || cam->frame_current->queued) { err = wait_event_interruptible ( cam->wait_queue, - cam->disconnected || - (!*cam->requested_frame && - !cam->frame_current->queued) ); + cam->disconnected || + (!*cam->requested_frame && + !cam->frame_current->queued) ); if (err) return err; if (cam->disconnected) @@ -3116,7 +3116,7 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, return -EINVAL; if ((err = w9968cf_adjust_window_size(cam, (u16*)&win.width, - (u16*)&win.height))) { + (u16*)&win.height))) { DBG(4, "Resolution not supported (%ux%u). " "VIDIOCSWIN failed", win.width, win.height) return err; @@ -3130,9 +3130,9 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, || cam->frame_current->queued) { err = wait_event_interruptible ( cam->wait_queue, - cam->disconnected || - (!*cam->requested_frame && - !cam->frame_current->queued) ); + cam->disconnected || + (!*cam->requested_frame && + !cam->frame_current->queued) ); if (err) return err; if (cam->disconnected) @@ -3175,7 +3175,7 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, mbuf.frames = cam->nbuffers; for (i = 0; i < cam->nbuffers; i++) mbuf.offsets[i] = (unsigned long)cam->frame[i].buffer - - (unsigned long)cam->frame[0].buffer; + (unsigned long)cam->frame[0].buffer; if (copy_to_user(arg, &mbuf, sizeof(mbuf))) return -EFAULT; @@ -3194,7 +3194,7 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, return -EFAULT; DBG(6, "VIDIOCMCAPTURE called: frame #%u, format=%s, %dx%d", - mmap.frame, symbolic(v4l1_plist, mmap.format), + mmap.frame, symbolic(v4l1_plist, mmap.format), mmap.width, mmap.height) if (mmap.frame >= cam->nbuffers) { @@ -3203,7 +3203,7 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, return -EINVAL; } - if (mmap.format!=cam->picture.palette && + if (mmap.format!=cam->picture.palette && (cam->force_palette || !w9968cf_vpp)) { DBG(4, "Palette %s rejected: only %s is allowed", symbolic(v4l1_plist, mmap.format), @@ -3213,7 +3213,7 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, if (!w9968cf_valid_palette(mmap.format)) { DBG(4, "Palette %s not supported. " - "VIDIOCMCAPTURE failed", + "VIDIOCMCAPTURE failed", symbolic(v4l1_plist, mmap.format)) return -EINVAL; } @@ -3221,23 +3221,23 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, if (!cam->force_palette) { if (cam->decompression == 0) { if (w9968cf_need_decompression(mmap.format)) { - DBG(4, "Decompression disabled: palette %s is not " - "allowed. VIDIOCSPICT failed", - symbolic(v4l1_plist, mmap.format)) - return -EINVAL; + DBG(4, "Decompression disabled: palette %s is not " + "allowed. VIDIOCSPICT failed", + symbolic(v4l1_plist, mmap.format)) + return -EINVAL; } } else if (cam->decompression == 1) { if (!w9968cf_need_decompression(mmap.format)) { - DBG(4, "Decompression forced: palette %s is not " - "allowed. VIDIOCSPICT failed", - symbolic(v4l1_plist, mmap.format)) - return -EINVAL; + DBG(4, "Decompression forced: palette %s is not " + "allowed. VIDIOCSPICT failed", + symbolic(v4l1_plist, mmap.format)) + return -EINVAL; } } } - if ((err = w9968cf_adjust_window_size(cam, (u16*)&mmap.width, - (u16*)&mmap.height))) { + if ((err = w9968cf_adjust_window_size(cam, (u16*)&mmap.width, + (u16*)&mmap.height))) { DBG(4, "Resolution not supported (%dx%d). " "VIDIOCMCAPTURE failed", mmap.width, mmap.height) @@ -3258,12 +3258,12 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, DBG(6, "VIDIOCMCAPTURE. Change settings for " "frame #%u: %dx%d, format %s. Wait...", mmap.frame, mmap.width, mmap.height, - symbolic(v4l1_plist, mmap.format)) + symbolic(v4l1_plist, mmap.format)) err = wait_event_interruptible ( cam->wait_queue, - cam->disconnected || - (!*cam->requested_frame && - !cam->frame_current->queued) ); + cam->disconnected || + (!*cam->requested_frame && + !cam->frame_current->queued) ); if (err) return err; if (cam->disconnected) @@ -3280,7 +3280,7 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, goto ioctl_fail; /* This before set_window */ - if (w9968cf_set_picture(cam, pict)) + if (w9968cf_set_picture(cam, pict)) goto ioctl_fail; if (w9968cf_set_window(cam, win)) @@ -3292,10 +3292,10 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, } else if (fr->queued) { DBG(6, "Wait until frame #%u is free", mmap.frame) - - err = wait_event_interruptible(cam->wait_queue, - cam->disconnected || - (!fr->queued)); + + err = wait_event_interruptible(cam->wait_queue, + cam->disconnected || + (!fr->queued)); if (err) return err; if (cam->disconnected) @@ -3335,9 +3335,9 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, } case F_ERROR: case F_GRABBING: - err = wait_event_interruptible(cam->wait_queue, - (fr->status == F_READY) - || cam->disconnected); + err = wait_event_interruptible(cam->wait_queue, + (fr->status == F_READY) + || cam->disconnected); if (err) return err; if (cam->disconnected) @@ -3439,7 +3439,7 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, DBG(4, "Unsupported V4L1 IOCtl: VIDIOC%s " "(type 0x%01X, " "n. 0x%01X, " - "dir. 0x%01X, " + "dir. 0x%01X, " "size 0x%02X)", V4L1_IOCTL(cmd), _IOC_TYPE(cmd),_IOC_NR(cmd),_IOC_DIR(cmd),_IOC_SIZE(cmd)) @@ -3499,13 +3499,13 @@ w9968cf_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) le16_to_cpu(udev->descriptor.idProduct) == winbond_id_table[0].idProduct) mod_id = W9968CF_MOD_CLVBWGP; /* see camlist[] table */ else if (le16_to_cpu(udev->descriptor.idVendor) == winbond_id_table[1].idVendor && - le16_to_cpu(udev->descriptor.idProduct) == winbond_id_table[1].idProduct) + le16_to_cpu(udev->descriptor.idProduct) == winbond_id_table[1].idProduct) mod_id = W9968CF_MOD_GENERIC; /* see camlist[] table */ else return -ENODEV; cam = (struct w9968cf_device*) - kzalloc(sizeof(struct w9968cf_device), GFP_KERNEL); + kzalloc(sizeof(struct w9968cf_device), GFP_KERNEL); if (!cam) return -ENOMEM; @@ -3569,7 +3569,7 @@ w9968cf_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) cam->v4ldev->dev = &cam->dev; err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER, - video_nr[dev_nr]); + video_nr[dev_nr]); if (err) { DBG(1, "V4L device registration failed") if (err == -ENFILE && video_nr[dev_nr] == -1) @@ -3611,7 +3611,7 @@ fail: /* Free unused memory */ static void w9968cf_usb_disconnect(struct usb_interface* intf) { - struct w9968cf_device* cam = + struct w9968cf_device* cam = (struct w9968cf_device*)usb_get_intfdata(intf); down_write(&w9968cf_disconnect); diff --git a/drivers/usb/media/w9968cf.h b/drivers/media/video/w9968cf.h index a87be719a281..2836b45ec206 100644 --- a/drivers/usb/media/w9968cf.h +++ b/drivers/media/video/w9968cf.h @@ -61,7 +61,7 @@ /* Maximum data payload sizes in bytes for alternate settings */ static const u16 wMaxPacketSize[] = {1023, 959, 895, 831, 767, 703, 639, 575, - 511, 447, 383, 319, 255, 191, 127, 63}; + 511, 447, 383, 319, 255, 191, 127, 63}; #define W9968CF_PACKET_SIZE 1023 /* according to wMaxPacketSizes[] */ #define W9968CF_MIN_PACKET_SIZE 63 /* minimum value */ #define W9968CF_ISO_PACKETS 5 /* n.of packets for isochronous transfers */ @@ -134,7 +134,7 @@ static const struct w9968cf_format w9968cf_formatlist[] = { ****************************************************************************/ #define W9968CF_MODULE_NAME "V4L driver for W996[87]CF JPEG USB " \ - "Dual Mode Camera Chip" + "Dual Mode Camera Chip" #define W9968CF_MODULE_VERSION "1:1.33-basic" #define W9968CF_MODULE_AUTHOR "(C) 2002-2004 Luca Risolia" #define W9968CF_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>" @@ -270,9 +270,9 @@ struct w9968cf_device { /* Locks */ struct mutex dev_mutex, /* for probe, disconnect,open and close */ - fileop_mutex; /* for read and ioctl */ + fileop_mutex; /* for read and ioctl */ spinlock_t urb_lock, /* for submit_urb() and unlink_urb() */ - flist_lock; /* for requested frame list accesses */ + flist_lock; /* for requested frame list accesses */ wait_queue_head_t open, wait_queue; char command[16]; /* name of the program holding the device */ @@ -299,7 +299,7 @@ struct w9968cf_device { dev_warn(&cam->dev, fmt "\n", ## args); \ else if ((level) >= 5) \ dev_info(&cam->dev, "[%s:%d] " fmt "\n", \ - __FUNCTION__, __LINE__ , ## args); \ + __FUNCTION__, __LINE__ , ## args); \ } \ } /* For generic kernel (not device specific) messages */ @@ -311,7 +311,7 @@ struct w9968cf_device { pr_info("w9968cf: " fmt "\n", ## args); \ else if ((level) >= 5) \ pr_debug("w9968cf: [%s:%d] " fmt "\n", __FUNCTION__, \ - __LINE__ , ## args); \ + __LINE__ , ## args); \ } \ } #else diff --git a/drivers/usb/media/w9968cf_decoder.h b/drivers/media/video/w9968cf_decoder.h index 31faccbe8f03..59decbfc540a 100644 --- a/drivers/usb/media/w9968cf_decoder.h +++ b/drivers/media/video/w9968cf_decoder.h @@ -78,9 +78,9 @@ static const unsigned char UV_QUANTABLE[64] = { #define W9968CF_DEC_ERR_NO_EOI -6 extern void w9968cf_init_decoder(void); -extern int w9968cf_check_headers(const unsigned char* Pin, - const unsigned long BUF_SIZE); -extern int w9968cf_decode(const char* Pin, const unsigned long BUF_SIZE, - const unsigned W, const unsigned H, char* Pout); +extern int w9968cf_check_headers(const unsigned char* Pin, + const unsigned long BUF_SIZE); +extern int w9968cf_decode(const char* Pin, const unsigned long BUF_SIZE, + const unsigned W, const unsigned H, char* Pout); #endif /* _W9968CF_DECODER_H_ */ diff --git a/drivers/usb/media/w9968cf_vpp.h b/drivers/media/video/w9968cf_vpp.h index f3b91b782671..88c9b6c0cc36 100644 --- a/drivers/usb/media/w9968cf_vpp.h +++ b/drivers/media/video/w9968cf_vpp.h @@ -29,7 +29,7 @@ struct w9968cf_vpp_t { struct module* owner; int (*check_headers)(const unsigned char*, const unsigned long); int (*decode)(const char*, const unsigned long, const unsigned, - const unsigned, char*); + const unsigned, char*); void (*swap_yuvbytes)(void*, unsigned long); void (*uyvy_to_rgbx)(u8*, unsigned long, u8*, u16, u8); void (*scale_up)(u8*, u8*, u16, u16, u16, u16, u16); diff --git a/drivers/media/video/wm8775.c b/drivers/media/video/wm8775.c index 8cb64f8a8a91..d81a88bbe43d 100644 --- a/drivers/media/video/wm8775.c +++ b/drivers/media/video/wm8775.c @@ -79,21 +79,26 @@ static int wm8775_command(struct i2c_client *client, unsigned int cmd, void *arg) { struct wm8775_state *state = i2c_get_clientdata(client); - struct v4l2_audio *input = arg; + struct v4l2_routing *route = arg; struct v4l2_control *ctrl = arg; switch (cmd) { - case VIDIOC_S_AUDIO: + case VIDIOC_INT_G_AUDIO_ROUTING: + route->input = state->input; + route->output = 0; + break; + + case VIDIOC_INT_S_AUDIO_ROUTING: /* There are 4 inputs and one output. Zero or more inputs are multiplexed together to the output. Hence there are 16 combinations. If only one input is active (the normal case) then the input values 1, 2, 4 or 8 should be used. */ - if (input->index > 15) { - v4l_err(client, "Invalid input %d.\n", input->index); + if (route->input > 15) { + v4l_err(client, "Invalid input %d.\n", route->input); return -EINVAL; } - state->input = input->index; + state->input = route->input; if (state->muted) break; wm8775_write(client, R21, 0x0c0); @@ -102,11 +107,6 @@ static int wm8775_command(struct i2c_client *client, unsigned int cmd, wm8775_write(client, R21, 0x100 + state->input); break; - case VIDIOC_G_AUDIO: - memset(input, 0, sizeof(*input)); - input->index = state->input; - break; - case VIDIOC_G_CTRL: if (ctrl->id != V4L2_CID_AUDIO_MUTE) return -EINVAL; diff --git a/drivers/media/video/zc0301/Makefile b/drivers/media/video/zc0301/Makefile new file mode 100644 index 000000000000..d749199d8f06 --- /dev/null +++ b/drivers/media/video/zc0301/Makefile @@ -0,0 +1,3 @@ +zc0301-objs := zc0301_core.o zc0301_pas202bcb.o + +obj-$(CONFIG_USB_ZC0301) += zc0301.o diff --git a/drivers/usb/media/zc0301.h b/drivers/media/video/zc0301/zc0301.h index 8e0655140e60..b9c93b8c16f7 100644 --- a/drivers/usb/media/zc0301.h +++ b/drivers/media/video/zc0301/zc0301.h @@ -157,7 +157,7 @@ do { \ dev_info(&cam->usbdev->dev, fmt "\n", ## args); \ else if ((level) >= 3) \ dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ - __FUNCTION__, __LINE__ , ## args); \ + __FUNCTION__, __LINE__ , ## args); \ } \ } while (0) # define KDBG(level, fmt, args...) \ @@ -167,7 +167,7 @@ do { \ pr_info("zc0301: " fmt "\n", ## args); \ else if ((level) == 3) \ pr_debug("zc0301: [%s:%d] " fmt "\n", __FUNCTION__, \ - __LINE__ , ## args); \ + __LINE__ , ## args); \ } \ } while (0) # define V4LDBG(level, name, cmd) \ @@ -184,7 +184,7 @@ do { \ #undef PDBG #define PDBG(fmt, args...) \ dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ - __FUNCTION__, __LINE__ , ## args) + __FUNCTION__, __LINE__ , ## args) #undef PDBGG #define PDBGG(fmt, args...) do {;} while(0) /* placeholder */ diff --git a/drivers/usb/media/zc0301_core.c b/drivers/media/video/zc0301/zc0301_core.c index 4036c6268bff..0fad39754f7a 100644 --- a/drivers/usb/media/zc0301_core.c +++ b/drivers/media/video/zc0301/zc0301_core.c @@ -48,7 +48,7 @@ /*****************************************************************************/ #define ZC0301_MODULE_NAME "V4L2 driver for ZC0301 " \ - "Image Processor and Control Chip" + "Image Processor and Control Chip" #define ZC0301_MODULE_AUTHOR "(C) 2006 Luca Risolia" #define ZC0301_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>" #define ZC0301_MODULE_LICENSE "GPL" @@ -67,67 +67,67 @@ MODULE_LICENSE(ZC0301_MODULE_LICENSE); static short video_nr[] = {[0 ... ZC0301_MAX_DEVICES-1] = -1}; module_param_array(video_nr, short, NULL, 0444); MODULE_PARM_DESC(video_nr, - "\n<-1|n[,...]> Specify V4L2 minor mode number." - "\n -1 = use next available (default)" - "\n n = use minor number n (integer >= 0)" - "\nYou can specify up to " - __MODULE_STRING(ZC0301_MAX_DEVICES) " cameras this way." - "\nFor example:" - "\nvideo_nr=-1,2,-1 would assign minor number 2 to" - "\nthe second registered camera and use auto for the first" - "\none and for every other camera." - "\n"); + "\n<-1|n[,...]> Specify V4L2 minor mode number." + "\n -1 = use next available (default)" + "\n n = use minor number n (integer >= 0)" + "\nYou can specify up to " + __MODULE_STRING(ZC0301_MAX_DEVICES) " cameras this way." + "\nFor example:" + "\nvideo_nr=-1,2,-1 would assign minor number 2 to" + "\nthe second registered camera and use auto for the first" + "\none and for every other camera." + "\n"); static short force_munmap[] = {[0 ... ZC0301_MAX_DEVICES-1] = - ZC0301_FORCE_MUNMAP}; + ZC0301_FORCE_MUNMAP}; module_param_array(force_munmap, bool, NULL, 0444); MODULE_PARM_DESC(force_munmap, - "\n<0|1[,...]> Force the application to unmap previously" - "\nmapped buffer memory before calling any VIDIOC_S_CROP or" - "\nVIDIOC_S_FMT ioctl's. Not all the applications support" - "\nthis feature. This parameter is specific for each" - "\ndetected camera." - "\n 0 = do not force memory unmapping" - "\n 1 = force memory unmapping (save memory)" - "\nDefault value is "__MODULE_STRING(SN9C102_FORCE_MUNMAP)"." - "\n"); + "\n<0|1[,...]> Force the application to unmap previously" + "\nmapped buffer memory before calling any VIDIOC_S_CROP or" + "\nVIDIOC_S_FMT ioctl's. Not all the applications support" + "\nthis feature. This parameter is specific for each" + "\ndetected camera." + "\n 0 = do not force memory unmapping" + "\n 1 = force memory unmapping (save memory)" + "\nDefault value is "__MODULE_STRING(SN9C102_FORCE_MUNMAP)"." + "\n"); static unsigned int frame_timeout[] = {[0 ... ZC0301_MAX_DEVICES-1] = - ZC0301_FRAME_TIMEOUT}; + ZC0301_FRAME_TIMEOUT}; module_param_array(frame_timeout, uint, NULL, 0644); MODULE_PARM_DESC(frame_timeout, - "\n<n[,...]> Timeout for a video frame in seconds." - "\nThis parameter is specific for each detected camera." - "\nDefault value is "__MODULE_STRING(ZC0301_FRAME_TIMEOUT)"." - "\n"); + "\n<n[,...]> Timeout for a video frame in seconds." + "\nThis parameter is specific for each detected camera." + "\nDefault value is "__MODULE_STRING(ZC0301_FRAME_TIMEOUT)"." + "\n"); #ifdef ZC0301_DEBUG static unsigned short debug = ZC0301_DEBUG_LEVEL; module_param(debug, ushort, 0644); MODULE_PARM_DESC(debug, - "\n<n> Debugging information level, from 0 to 3:" - "\n0 = none (use carefully)" - "\n1 = critical errors" - "\n2 = significant informations" - "\n3 = more verbose messages" - "\nLevel 3 is useful for testing only, when only " - "one device is used." - "\nDefault value is "__MODULE_STRING(ZC0301_DEBUG_LEVEL)"." - "\n"); + "\n<n> Debugging information level, from 0 to 3:" + "\n0 = none (use carefully)" + "\n1 = critical errors" + "\n2 = significant informations" + "\n3 = more verbose messages" + "\nLevel 3 is useful for testing only, when only " + "one device is used." + "\nDefault value is "__MODULE_STRING(ZC0301_DEBUG_LEVEL)"." + "\n"); #endif /*****************************************************************************/ static u32 zc0301_request_buffers(struct zc0301_device* cam, u32 count, - enum zc0301_io_method io) + enum zc0301_io_method io) { struct v4l2_pix_format* p = &(cam->sensor.pix_format); struct v4l2_rect* r = &(cam->sensor.cropcap.bounds); const size_t imagesize = cam->module_param.force_munmap || - io == IO_READ ? - (p->width * p->height * p->priv) / 8 : - (r->width * r->height * p->priv) / 8; + io == IO_READ ? + (p->width * p->height * p->priv) / 8 : + (r->width * r->height * p->priv) / 8; void* buff = NULL; u32 i; @@ -216,7 +216,7 @@ int zc0301_write_reg(struct zc0301_device* cam, u16 index, u16 value) int res; res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0xa0, 0x40, - value, index, NULL, 0, ZC0301_CTRL_TIMEOUT); + value, index, NULL, 0, ZC0301_CTRL_TIMEOUT); if (res < 0) { DBG(3, "Failed to write a register (index 0x%04X, " "value 0x%02X, error %d)",index, value, res); @@ -234,7 +234,7 @@ int zc0301_read_reg(struct zc0301_device* cam, u16 index) int res; res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0xa1, 0xc0, - 0x0001, index, buff, 1, ZC0301_CTRL_TIMEOUT); + 0x0001, index, buff, 1, ZC0301_CTRL_TIMEOUT); if (res < 0) DBG(3, "Failed to read a register (index 0x%04X, error %d)", index, res); @@ -337,11 +337,11 @@ static void zc0301_urb_complete(struct urb *urb, struct pt_regs* regs) if (!(*f)) (*f) = list_entry(cam->inqueue.next, struct zc0301_frame_t, - frame); + frame); imagesize = (cam->sensor.pix_format.width * - cam->sensor.pix_format.height * - cam->sensor.pix_format.priv) / 8; + cam->sensor.pix_format.height * + cam->sensor.pix_format.priv) / 8; for (i = 0; i < urb->number_of_packets; i++) { unsigned int len, status; @@ -395,8 +395,8 @@ end_of_frame: list_move_tail(&(*f)->frame, &cam->outqueue); if (!list_empty(&cam->inqueue)) (*f) = list_entry(cam->inqueue.next, - struct zc0301_frame_t, - frame); + struct zc0301_frame_t, + frame); else (*f) = NULL; spin_unlock(&cam->queue_lock); @@ -429,14 +429,14 @@ static int zc0301_start_transfer(struct zc0301_device* cam) struct usb_device *udev = cam->usbdev; struct urb* urb; const unsigned int wMaxPacketSize[] = {0, 128, 192, 256, 384, - 512, 768, 1023}; + 512, 768, 1023}; const unsigned int psz = wMaxPacketSize[ZC0301_ALTERNATE_SETTING]; s8 i, j; int err = 0; for (i = 0; i < ZC0301_URBS; i++) { cam->transfer_buffer[i] = kzalloc(ZC0301_ISO_PACKETS * psz, - GFP_KERNEL); + GFP_KERNEL); if (!cam->transfer_buffer[i]) { err = -ENOMEM; DBG(1, "Not enough memory"); @@ -528,9 +528,9 @@ static int zc0301_stream_interrupt(struct zc0301_device* cam) cam->stream = STREAM_INTERRUPT; timeout = wait_event_timeout(cam->wait_stream, - (cam->stream == STREAM_OFF) || - (cam->state & DEV_DISCONNECTED), - ZC0301_URB_TIMEOUT); + (cam->stream == STREAM_OFF) || + (cam->state & DEV_DISCONNECTED), + ZC0301_URB_TIMEOUT); if (cam->state & DEV_DISCONNECTED) return -ENODEV; else if (cam->stream != STREAM_OFF) { @@ -548,7 +548,7 @@ static int zc0301_stream_interrupt(struct zc0301_device* cam) static int zc0301_set_compression(struct zc0301_device* cam, - struct v4l2_jpegcompression* compression) + struct v4l2_jpegcompression* compression) { int r, err = 0; @@ -670,8 +670,8 @@ static int zc0301_open(struct inode* inode, struct file* filp) } mutex_unlock(&cam->dev_mutex); err = wait_event_interruptible_exclusive(cam->open, - cam->state & DEV_DISCONNECTED - || !cam->users); + cam->state & DEV_DISCONNECTED + || !cam->users); if (err) { up_read(&zc0301_disconnect); return err; @@ -802,12 +802,12 @@ zc0301_read(struct file* filp, char __user * buf, size_t count, loff_t* f_pos) return -EAGAIN; } timeout = wait_event_interruptible_timeout - ( cam->wait_frame, - (!list_empty(&cam->outqueue)) || - (cam->state & DEV_DISCONNECTED) || - (cam->state & DEV_MISCONFIGURED), - cam->module_param.frame_timeout * - 1000 * msecs_to_jiffies(1) ); + ( cam->wait_frame, + (!list_empty(&cam->outqueue)) || + (cam->state & DEV_DISCONNECTED) || + (cam->state & DEV_MISCONFIGURED), + cam->module_param.frame_timeout * + 1000 * msecs_to_jiffies(1) ); if (timeout < 0) { mutex_unlock(&cam->fileop_mutex); return timeout; @@ -930,7 +930,7 @@ static int zc0301_mmap(struct file* filp, struct vm_area_struct *vma) { struct zc0301_device* cam = video_get_drvdata(video_devdata(filp)); unsigned long size = vma->vm_end - vma->vm_start, - start = vma->vm_start; + start = vma->vm_start; void *pos; u32 i; @@ -998,13 +998,13 @@ zc0301_vidioc_querycap(struct zc0301_device* cam, void __user * arg) .driver = "zc0301", .version = ZC0301_MODULE_VERSION_CODE, .capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | - V4L2_CAP_STREAMING, + V4L2_CAP_STREAMING, }; strlcpy(cap.card, cam->v4ldev->name, sizeof(cap.card)); if (usb_make_path(cam->usbdev, cap.bus_info, sizeof(cap.bus_info)) < 0) strlcpy(cap.bus_info, cam->usbdev->dev.bus_id, - sizeof(cap.bus_info)); + sizeof(cap.bus_info)); if (copy_to_user(arg, &cap, sizeof(cap))) return -EFAULT; @@ -1337,7 +1337,7 @@ zc0301_vidioc_g_fmt(struct zc0301_device* cam, void __user * arg) static int zc0301_vidioc_try_s_fmt(struct zc0301_device* cam, unsigned int cmd, - void __user * arg) + void __user * arg) { struct zc0301_sensor* s = &cam->sensor; struct v4l2_format format; @@ -1600,7 +1600,7 @@ zc0301_vidioc_qbuf(struct zc0301_device* cam, void __user * arg) static int zc0301_vidioc_dqbuf(struct zc0301_device* cam, struct file* filp, - void __user * arg) + void __user * arg) { struct v4l2_buffer b; struct zc0301_frame_t *f; @@ -1619,12 +1619,12 @@ zc0301_vidioc_dqbuf(struct zc0301_device* cam, struct file* filp, if (filp->f_flags & O_NONBLOCK) return -EAGAIN; timeout = wait_event_interruptible_timeout - ( cam->wait_frame, - (!list_empty(&cam->outqueue)) || - (cam->state & DEV_DISCONNECTED) || - (cam->state & DEV_MISCONFIGURED), - cam->module_param.frame_timeout * - 1000 * msecs_to_jiffies(1) ); + ( cam->wait_frame, + (!list_empty(&cam->outqueue)) || + (cam->state & DEV_DISCONNECTED) || + (cam->state & DEV_MISCONFIGURED), + cam->module_param.frame_timeout * + 1000 * msecs_to_jiffies(1) ); if (timeout < 0) return timeout; if (cam->state & DEV_DISCONNECTED) @@ -1748,7 +1748,7 @@ zc0301_vidioc_s_parm(struct zc0301_device* cam, void __user * arg) static int zc0301_ioctl_v4l2(struct inode* inode, struct file* filp, - unsigned int cmd, void __user * arg) + unsigned int cmd, void __user * arg) { struct zc0301_device* cam = video_get_drvdata(video_devdata(filp)); @@ -1842,7 +1842,7 @@ static int zc0301_ioctl_v4l2(struct inode* inode, struct file* filp, static int zc0301_ioctl(struct inode* inode, struct file* filp, - unsigned int cmd, unsigned long arg) + unsigned int cmd, unsigned long arg) { struct zc0301_device* cam = video_get_drvdata(video_devdata(filp)); int err = 0; @@ -1948,7 +1948,7 @@ zc0301_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) mutex_lock(&cam->dev_mutex); err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER, - video_nr[dev_nr]); + video_nr[dev_nr]); if (err) { DBG(1, "V4L2 device registration failed"); if (err == -ENFILE && video_nr[dev_nr] == -1) diff --git a/drivers/usb/media/zc0301_pas202bcb.c b/drivers/media/video/zc0301/zc0301_pas202bcb.c index 9d282a22c15f..eaadf0252049 100644 --- a/drivers/usb/media/zc0301_pas202bcb.c +++ b/drivers/media/video/zc0301/zc0301_pas202bcb.c @@ -24,10 +24,10 @@ /* NOTE: Sensor controls are disabled for now, becouse changing them while - streaming sometimes results in out-of-sync video frames. We'll use - the default initialization, until we know how to stop and start video - in the chip. However, the image quality still looks good under various - light conditions. + streaming sometimes results in out-of-sync video frames. We'll use + the default initialization, until we know how to stop and start video + in the chip. However, the image quality still looks good under various + light conditions. */ #include <linux/delay.h> @@ -165,7 +165,7 @@ static int pas202bcb_init(struct zc0301_device* cam) static int pas202bcb_get_ctrl(struct zc0301_device* cam, - struct v4l2_control* ctrl) + struct v4l2_control* ctrl) { switch (ctrl->id) { case V4L2_CID_EXPOSURE: @@ -208,7 +208,7 @@ static int pas202bcb_get_ctrl(struct zc0301_device* cam, static int pas202bcb_set_ctrl(struct zc0301_device* cam, - const struct v4l2_control* ctrl) + const struct v4l2_control* ctrl) { int err = 0; diff --git a/drivers/usb/media/zc0301_sensor.h b/drivers/media/video/zc0301/zc0301_sensor.h index cf0965a81d01..1f95c28b1015 100644 --- a/drivers/usb/media/zc0301_sensor.h +++ b/drivers/media/video/zc0301/zc0301_sensor.h @@ -51,7 +51,7 @@ zc0301_attach_sensor(struct zc0301_device* cam, struct zc0301_sensor* sensor); #define ZC0301_USB_DEVICE(vend, prod, intclass) \ .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \ - USB_DEVICE_ID_MATCH_INT_CLASS, \ + USB_DEVICE_ID_MATCH_INT_CLASS, \ .idVendor = (vend), \ .idProduct = (prod), \ .bInterfaceClass = (intclass) @@ -92,7 +92,7 @@ struct zc0301_sensor { int (*init)(struct zc0301_device*); int (*get_ctrl)(struct zc0301_device*, struct v4l2_control* ctrl); int (*set_ctrl)(struct zc0301_device*, - const struct v4l2_control* ctrl); + const struct v4l2_control* ctrl); int (*set_crop)(struct zc0301_device*, const struct v4l2_rect* rect); /* Private */ diff --git a/drivers/media/video/zoran.h b/drivers/media/video/zoran.h index ad04a129499d..0166f555a5ca 100644 --- a/drivers/media/video/zoran.h +++ b/drivers/media/video/zoran.h @@ -1,4 +1,4 @@ -/* +/* * zoran - Iomega Buz driver * * Copyright (C) 1999 Rainer Johanni <Rainer@Johanni.de> diff --git a/drivers/media/video/zoran_card.c b/drivers/media/video/zoran_card.c index b22dbb6d18f6..0a85c9e7fb48 100644 --- a/drivers/media/video/zoran_card.c +++ b/drivers/media/video/zoran_card.c @@ -4,7 +4,7 @@ * Media Labs LML33/LML33R10. * * This part handles card-specific data and detection - * + * * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx> * * Currently maintained by: diff --git a/drivers/media/video/zoran_card.h b/drivers/media/video/zoran_card.h index e5b6acd3eedc..ad997c30bee5 100644 --- a/drivers/media/video/zoran_card.h +++ b/drivers/media/video/zoran_card.h @@ -4,7 +4,7 @@ * Media Labs LML33/LML33R10. * * This part handles card-specific data and detection - * + * * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx> * * Currently maintained by: diff --git a/drivers/media/video/zoran_device.c b/drivers/media/video/zoran_device.c index 4e15afdec4c9..c690b2ee880a 100644 --- a/drivers/media/video/zoran_device.c +++ b/drivers/media/video/zoran_device.c @@ -4,7 +4,7 @@ * Media Labs LML33/LML33R10. * * This part handles device access (PCI/I2C/codec/...) - * + * * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx> * * Currently maintained by: @@ -492,7 +492,7 @@ zr36057_set_vfe (struct zoran *zr, /* (Ronald) don't write this if overlay_mask = NULL */ if (zr->overlay_mask) { /* Write overlay clipping mask data, but don't enable overlay clipping */ - /* RJ: since this makes only sense on the screen, we use + /* RJ: since this makes only sense on the screen, we use * zr->overlay_settings.width instead of video_width */ mask_line_size = (BUZ_MAX_WIDTH + 31) / 32; @@ -819,12 +819,12 @@ zr36057_set_jpg (struct zoran *zr, if (zr->card.vfe_pol.hsync_pol) btor(ZR36057_VFEHCR_HSPol, ZR36057_VFEHCR); else - btand(~ZR36057_VFEHCR_HSPol, ZR36057_VFEHCR); + btand(~ZR36057_VFEHCR_HSPol, ZR36057_VFEHCR); reg = ((tvn->HSyncStart) << ZR36057_HSP_HsyncStart) | (tvn->Wt << ZR36057_HSP_LineTot); btwrite(reg, ZR36057_HSP); reg = ((zr->jpg_settings.img_x + - tvn->HStart + 4) << ZR36057_FHAP_NAX) | + tvn->HStart + 4) << ZR36057_FHAP_NAX) | (zr->jpg_settings.img_width << ZR36057_FHAP_PAX); btwrite(reg, ZR36057_FHAP); @@ -1272,15 +1272,15 @@ error_handler (struct zoran *zr, if (zr->JPEG_error != 1) { /* * First entry: error just happened during normal operation - * + * * In BUZ_MODE_MOTION_COMPRESS: - * + * * Possible glitch in TV signal. In this case we should * stop the codec and wait for good quality signal before * restarting it to avoid further problems - * + * * In BUZ_MODE_MOTION_DECOMPRESS: - * + * * Bad JPEG frame: we have to mark it as processed (codec crashed * and was not able to do it itself), and to remove it from queue. */ diff --git a/drivers/media/video/zoran_device.h b/drivers/media/video/zoran_device.h index f315203d7105..f19705cbdb39 100644 --- a/drivers/media/video/zoran_device.h +++ b/drivers/media/video/zoran_device.h @@ -4,7 +4,7 @@ * Media Labs LML33/LML33R10. * * This part handles card-specific data and detection - * + * * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx> * * Currently maintained by: diff --git a/drivers/media/video/zoran_driver.c b/drivers/media/video/zoran_driver.c index b2c6e01e3923..b5a576a37fd2 100644 --- a/drivers/media/video/zoran_driver.c +++ b/drivers/media/video/zoran_driver.c @@ -94,7 +94,7 @@ V4L2_CAP_VIDEO_CAPTURE |\ V4L2_CAP_VIDEO_OUTPUT |\ V4L2_CAP_VIDEO_OVERLAY \ - ) + ) #endif #include <asm/byteorder.h> @@ -165,7 +165,7 @@ const struct zoran_format zoran_formats[] = { #endif .depth = 16, .flags = ZORAN_FORMAT_CAPTURE | - ZORAN_FORMAT_OVERLAY, + ZORAN_FORMAT_OVERLAY, }, { .name = "Hardware-encoded Motion-JPEG", .palette = -1, @@ -670,7 +670,7 @@ jpg_fbuffer_free (struct file *file) j])))); free_page((unsigned long) bus_to_virt - (le32_to_cpu + (le32_to_cpu (fh->jpg_buffers. buffer[i]. frag_tab[2 * j]))); @@ -1871,7 +1871,7 @@ zoran_v4l2_buffer_status (struct file *file, static int zoran_set_norm (struct zoran *zr, - int norm) /* VIDEO_MODE_* */ + int norm) /* VIDEO_MODE_* */ { int norm_encoder, on; @@ -2006,9 +2006,9 @@ zoran_set_input (struct zoran *zr, static int zoran_do_ioctl (struct inode *inode, - struct file *file, - unsigned int cmd, - void *arg) + struct file *file, + unsigned int cmd, + void *arg) { struct zoran_fh *fh = file->private_data; struct zoran *zr = fh->zr; @@ -2095,7 +2095,7 @@ zoran_do_ioctl (struct inode *inode, break; /* RJ: the documentation at http://roadrunner.swansea.linux.org.uk/v4lapi.shtml says: - * + * * * "The VIDIOCSCHAN ioctl takes an integer argument and switches the capture to this input." * * ^^^^^^^ * * The famos BTTV driver has it implemented with a struct video_channel argument diff --git a/drivers/media/video/zoran_procfs.c b/drivers/media/video/zoran_procfs.c index f0d9b13c3c6c..a00fae90229a 100644 --- a/drivers/media/video/zoran_procfs.c +++ b/drivers/media/video/zoran_procfs.c @@ -4,7 +4,7 @@ * Media Labs LML33/LML33R10. * * This part handles the procFS entries (/proc/ZORAN[%d]) - * + * * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx> * * Currently maintained by: diff --git a/drivers/media/video/zoran_procfs.h b/drivers/media/video/zoran_procfs.h index 8904fc959555..f2d5b1ba448f 100644 --- a/drivers/media/video/zoran_procfs.h +++ b/drivers/media/video/zoran_procfs.h @@ -4,7 +4,7 @@ * Media Labs LML33/LML33R10. * * This part handles card-specific data and detection - * + * * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx> * * Currently maintained by: diff --git a/drivers/media/video/zr36016.c b/drivers/media/video/zr36016.c index 10130ef67ea7..62f77584fb85 100644 --- a/drivers/media/video/zr36016.c +++ b/drivers/media/video/zr36016.c @@ -34,7 +34,7 @@ #include <linux/types.h> #include <linux/wait.h> -/* includes for structures and defines regarding video +/* includes for structures and defines regarding video #include<linux/videodev.h> */ /* I/O commands, error codes */ @@ -143,8 +143,8 @@ zr36016_readi (struct zr36016 *ptr, static void zr36016_writei (struct zr36016 *ptr, - u16 reg, - u8 value) + u16 reg, + u8 value) { dprintk(4, "%s: writing indirect 0x%02x to 0x%04x\n", ptr->name, value, reg); @@ -192,7 +192,7 @@ zr36016_basic_test (struct zr36016 *ptr) dprintk(1, "\n"); } // for testing just write 0, then the default value to a register and read - // it back in both cases + // it back in both cases zr36016_writei(ptr, ZR016I_PAX_LO, 0x00); if (zr36016_readi(ptr, ZR016I_PAX_LO) != 0x0) { dprintk(1, @@ -232,17 +232,17 @@ zr36016_basic_test (struct zr36016 *ptr) static int zr36016_pushit (struct zr36016 *ptr, u16 startreg, u16 len, - const char *data) + const char *data) { - int i=0; + int i=0; - dprintk(4, "%s: write data block to 0x%04x (len=%d)\n", + dprintk(4, "%s: write data block to 0x%04x (len=%d)\n", ptr->name, startreg,len); - while (i<len) { - zr36016_writei(ptr, startreg++, data[i++]); - } + while (i<len) { + zr36016_writei(ptr, startreg++, data[i++]); + } - return i; + return i; } #endif diff --git a/drivers/media/video/zr36050.c b/drivers/media/video/zr36050.c index 6699725be605..a6bbd125631c 100644 --- a/drivers/media/video/zr36050.c +++ b/drivers/media/video/zr36050.c @@ -34,7 +34,7 @@ #include <linux/types.h> #include <linux/wait.h> -/* includes for structures and defines regarding video +/* includes for structures and defines regarding video #include<linux/videodev.h> */ /* I/O commands, error codes */ @@ -171,7 +171,7 @@ zr36050_wait_end (struct zr36050 *ptr) /* ========================================================================= Local helper function: - basic test of "connectivity", writes/reads to/from memory the SOF marker + basic test of "connectivity", writes/reads to/from memory the SOF marker ========================================================================= */ static int @@ -218,9 +218,9 @@ zr36050_basic_test (struct zr36050 *ptr) static int zr36050_pushit (struct zr36050 *ptr, - u16 startreg, - u16 len, - const char *data) + u16 startreg, + u16 len, + const char *data) { int i = 0; @@ -345,7 +345,7 @@ static const char zr36050_decimation_v[8] = { 1, 1, 1, 0, 0, 0, 0, 0 }; /* ------------------------------------------------------------------------- */ /* SOF (start of frame) segment depends on width, height and sampling ratio - of each color component */ + of each color component */ static int zr36050_set_sof (struct zr36050 *ptr) @@ -376,8 +376,8 @@ zr36050_set_sof (struct zr36050 *ptr) /* ------------------------------------------------------------------------- */ -/* SOS (start of scan) segment depends on the used scan components - of each color component */ +/* SOS (start of scan) segment depends on the used scan components + of each color component */ static int zr36050_set_sos (struct zr36050 *ptr) diff --git a/drivers/media/video/zr36057.h b/drivers/media/video/zr36057.h index 159abfa034d9..54c9362aa980 100644 --- a/drivers/media/video/zr36057.h +++ b/drivers/media/video/zr36057.h @@ -1,4 +1,4 @@ -/* +/* * zr36057.h - zr36057 register offsets * * Copyright (C) 1998 Dave Perks <dperks@ibm.net> @@ -27,14 +27,14 @@ #define ZR36057_VFEHCR 0x000 /* Video Front End, Horizontal Configuration Register */ #define ZR36057_VFEHCR_HSPol (1<<30) #define ZR36057_VFEHCR_HStart 10 -#define ZR36057_VFEHCR_HEnd 0 -#define ZR36057_VFEHCR_Hmask 0x3ff +#define ZR36057_VFEHCR_HEnd 0 +#define ZR36057_VFEHCR_Hmask 0x3ff #define ZR36057_VFEVCR 0x004 /* Video Front End, Vertical Configuration Register */ #define ZR36057_VFEVCR_VSPol (1<<30) #define ZR36057_VFEVCR_VStart 10 -#define ZR36057_VFEVCR_VEnd 0 -#define ZR36057_VFEVCR_Vmask 0x3ff +#define ZR36057_VFEVCR_VEnd 0 +#define ZR36057_VFEVCR_Vmask 0x3ff #define ZR36057_VFESPFR 0x008 /* Video Front End, Scaler and Pixel Format Register */ #define ZR36057_VFESPFR_ExtFl (1<<26) diff --git a/drivers/media/video/zr36060.c b/drivers/media/video/zr36060.c index d8dd003a7aad..97c8f9b9dc12 100644 --- a/drivers/media/video/zr36060.c +++ b/drivers/media/video/zr36060.c @@ -34,7 +34,7 @@ #include <linux/types.h> #include <linux/wait.h> -/* includes for structures and defines regarding video +/* includes for structures and defines regarding video #include<linux/videodev.h> */ /* I/O commands, error codes */ @@ -173,7 +173,7 @@ zr36060_wait_end (struct zr36060 *ptr) /* ========================================================================= Local helper function: - basic test of "connectivity", writes/reads to/from memory the SOF marker + basic test of "connectivity", writes/reads to/from memory the SOF marker ========================================================================= */ static int @@ -208,9 +208,9 @@ zr36060_basic_test (struct zr36060 *ptr) static int zr36060_pushit (struct zr36060 *ptr, - u16 startreg, - u16 len, - const char *data) + u16 startreg, + u16 len, + const char *data) { int i = 0; @@ -335,7 +335,7 @@ static const char zr36060_decimation_v[8] = { 1, 1, 1, 0, 0, 0, 0, 0 }; /* ------------------------------------------------------------------------- */ /* SOF (start of frame) segment depends on width, height and sampling ratio - of each color component */ + of each color component */ static int zr36060_set_sof (struct zr36060 *ptr) @@ -367,8 +367,8 @@ zr36060_set_sof (struct zr36060 *ptr) /* ------------------------------------------------------------------------- */ -/* SOS (start of scan) segment depends on the used scan components - of each color component */ +/* SOS (start of scan) segment depends on the used scan components + of each color component */ static int zr36060_set_sos (struct zr36060 *ptr) @@ -385,7 +385,7 @@ zr36060_set_sos (struct zr36060 *ptr) for (i = 0; i < NO_OF_COMPONENTS; i++) { sos_data[5 + (i * 2)] = i; // index sos_data[6 + (i * 2)] = (zr36060_td[i] << 4) | - zr36060_ta[i]; // AC/DC tbl.sel. + zr36060_ta[i]; // AC/DC tbl.sel. } sos_data[2 + 1 + (2 * NO_OF_COMPONENTS) + 2] = 00; // scan start sos_data[2 + 1 + (2 * NO_OF_COMPONENTS) + 3] = 0x3f; @@ -999,7 +999,7 @@ zr36060_cleanup_module (void) dprintk(1, "zr36060: something's wrong - %d codecs left somehow.\n", zr36060_codecs); - } + } /* however, we can't just stay alive */ videocodec_unregister(&zr36060_codec); diff --git a/drivers/media/video/zr36120.c b/drivers/media/video/zr36120.c index d4c633b8a7f5..6ac3b6740089 100644 --- a/drivers/media/video/zr36120.c +++ b/drivers/media/video/zr36120.c @@ -70,10 +70,10 @@ MODULE_AUTHOR("Pauline Middelink <middelin@polyware.nl>"); MODULE_DESCRIPTION("Zoran ZR36120 based framegrabber"); MODULE_LICENSE("GPL"); -MODULE_PARM(triton1,"i"); -MODULE_PARM(cardtype,"1-" __MODULE_STRING(ZORAN_MAX) "i"); -MODULE_PARM(video_nr,"i"); -MODULE_PARM(vbi_nr,"i"); +module_param(triton1, uint, 0); +module_param_array(cardtype, uint, NULL, 0); +module_param(video_nr, int, 0); +module_param(vbi_nr, int, 0); static int zoran_cards; static struct zoran zorans[ZORAN_MAX]; @@ -316,7 +316,7 @@ DEBUG(printk(CARD_DEBUG "%p added to queue\n",CARD,item)); item->status = FBUFFER_BUSY; if (!lastitem) ztv->workqueue = item; - else + else lastitem->next = item; lastitem = item; } @@ -516,7 +516,7 @@ DEBUG(printk(KERN_DEBUG " %d: clip(%d,%d,%d,%d)\n", i,vp->x,vp->y,vp->widt zraor((ztv->vidInterlace*ystep)<<0,~ZORAN_OCR_MASKSTRIDE,ZORAN_OCR); } -struct tvnorm +struct tvnorm { u16 Wt, Wa, Ht, Ha, HStart, VStart; }; @@ -660,7 +660,7 @@ DEBUG(printk(KERN_DEBUG " Y: scale=0, start=%d, end=%d\n", Hstart, Hend)); int HorDcm = 64-X; int hcrop1 = 2*(Wa-We)/4; /* - * BUGFIX: Juha Nurmela <junki@qn-lpr2-165.quicknet.inet.fi> + * BUGFIX: Juha Nurmela <junki@qn-lpr2-165.quicknet.inet.fi> * found the solution to the color phase shift. * See ChangeLog for the full explanation) */ @@ -812,12 +812,12 @@ void zoran_close(struct video_device* dev) zoran_common_close(ztv); - /* - * This is sucky but right now I can't find a good way to - * be sure its safe to free the buffer. We wait 5-6 fields - * which is more than sufficient to be sure. - */ - msleep(100); /* Wait 1/10th of a second */ + /* + * This is sucky but right now I can't find a good way to + * be sure its safe to free the buffer. We wait 5-6 fields + * which is more than sufficient to be sure. + */ + msleep(100); /* Wait 1/10th of a second */ /* free the allocated framebuffer */ bfree(ztv->fbuffer, ZORAN_MAX_FBUFSIZE); @@ -1436,7 +1436,7 @@ int zoran_ioctl(struct video_device* dev, unsigned int cmd, void *arg) /* Why isn't this in the API? * And why doesn't it take a buffer number? - case BTTV_FIELDNR: + case BTTV_FIELDNR: { unsigned long v = ztv->lastfieldnr; if (copy_to_user(arg,&v,sizeof(v))) @@ -1557,12 +1557,12 @@ void vbi_close(struct video_device *dev) zoran_common_close(ztv); - /* - * This is sucky but right now I can't find a good way to - * be sure its safe to free the buffer. We wait 5-6 fields - * which is more than sufficient to be sure. - */ - msleep(100); /* Wait 1/10th of a second */ + /* + * This is sucky but right now I can't find a good way to + * be sure its safe to free the buffer. We wait 5-6 fields + * which is more than sufficient to be sure. + */ + msleep(100); /* Wait 1/10th of a second */ for (item=ztv->readinfo; item!=ztv->readinfo+ZORAN_VBI_BUFFERS; item++) { @@ -1620,7 +1620,7 @@ long vbi_read(struct video_device* dev, char* buf, unsigned long count, int nonb write_unlock_irq(&ztv->lock); return -EWOULDBLOCK; } - + /* mark the unused buffer as wanted */ unused->status = FBUFFER_BUSY; unused->next = 0; @@ -1671,7 +1671,7 @@ long vbi_read(struct video_device* dev, char* buf, unsigned long count, int nonb if (count == 2*19*2048) { /* * Extreme HACK, old VBI programs expect 2048 points - * of data, and we only got 864 orso. Double each + * of data, and we only got 864 orso. Double each * datapoint and clear the rest of the line. * This way we have appear to have a * sample_frequency of 29.5 Mc. @@ -1956,7 +1956,7 @@ int __init init_zoran(int card) zrand(~ZORAN_VDC_TRICOM, ZORAN_VDC); /* external FL determines TOP frame */ - zror(ZORAN_VFEC_EXTFL, ZORAN_VFEC); + zror(ZORAN_VFEC_EXTFL, ZORAN_VFEC); /* set HSpol */ if (ztv->card->hsync_pos) @@ -2012,7 +2012,7 @@ void release_zoran(int max) struct zoran *ztv; int i; - for (i=0;i<max; i++) + for (i=0;i<max; i++) { ztv = &zorans[i]; @@ -2029,7 +2029,7 @@ void release_zoran(int max) /* free it */ free_irq(ztv->dev->irq,ztv); - + /* unregister i2c_bus */ i2c_unregister_bus((&ztv->i2c)); @@ -2050,7 +2050,7 @@ void __exit zr36120_exit(void) int __init zr36120_init(void) { int card; - + handle_chipset(); zoran_cards = find_zoran(); if (zoran_cards<0) @@ -2063,7 +2063,7 @@ int __init zr36120_init(void) /* only release the zorans we have registered */ release_zoran(card); return -EIO; - } + } } return 0; } diff --git a/drivers/media/video/zr36120.h b/drivers/media/video/zr36120.h index 571f8e84b58a..a71e485b0f98 100644 --- a/drivers/media/video/zr36120.h +++ b/drivers/media/video/zr36120.h @@ -1,4 +1,4 @@ -/* +/* zr36120.h - Zoran 36120/36125 based framegrabbers Copyright (C) 1998-1999 Pauline Middelink (middelin@polyware.nl) @@ -89,7 +89,7 @@ struct vidinfo { ulong* overlay; /* kernel addr of overlay mask */ }; -struct zoran +struct zoran { struct video_device video_dev; #define CARD_DEBUG KERN_DEBUG "%s(%lu): " @@ -106,7 +106,7 @@ struct zoran uint norm; /* 0=PAL, 1=NTSC, 2=SECAM */ uint tuner_freq; /* Current freq in kHz */ struct video_picture picture; /* Current picture params */ - + /* videocard details */ uint swidth; /* screen width */ uint sheight; /* screen height */ diff --git a/drivers/message/i2o/debug.c b/drivers/message/i2o/debug.c index 40d4ea898dbc..5a6cca8e8c45 100644 --- a/drivers/message/i2o/debug.c +++ b/drivers/message/i2o/debug.c @@ -419,58 +419,53 @@ void i2o_dump_hrt(struct i2o_controller *c) d = (u8 *) (rows + 2); state = p[1] << 8 | p[0]; - printk(KERN_DEBUG "TID %04X:[", state & 0xFFF); + printk("TID %04X:[", state & 0xFFF); state >>= 12; if (state & (1 << 0)) - printk(KERN_DEBUG "H"); /* Hidden */ + printk("H"); /* Hidden */ if (state & (1 << 2)) { - printk(KERN_DEBUG "P"); /* Present */ + printk("P"); /* Present */ if (state & (1 << 1)) - printk(KERN_DEBUG "C"); /* Controlled */ + printk("C"); /* Controlled */ } if (state > 9) - printk(KERN_DEBUG "*"); /* Hard */ + printk("*"); /* Hard */ - printk(KERN_DEBUG "]:"); + printk("]:"); switch (p[3] & 0xFFFF) { case 0: /* Adapter private bus - easy */ - printk(KERN_DEBUG - "Local bus %d: I/O at 0x%04X Mem 0x%08X", p[2], + printk("Local bus %d: I/O at 0x%04X Mem 0x%08X", p[2], d[1] << 8 | d[0], *(u32 *) (d + 4)); break; case 1: /* ISA bus */ - printk(KERN_DEBUG - "ISA %d: CSN %d I/O at 0x%04X Mem 0x%08X", p[2], + printk("ISA %d: CSN %d I/O at 0x%04X Mem 0x%08X", p[2], d[2], d[1] << 8 | d[0], *(u32 *) (d + 4)); break; case 2: /* EISA bus */ - printk(KERN_DEBUG - "EISA %d: Slot %d I/O at 0x%04X Mem 0x%08X", + printk("EISA %d: Slot %d I/O at 0x%04X Mem 0x%08X", p[2], d[3], d[1] << 8 | d[0], *(u32 *) (d + 4)); break; case 3: /* MCA bus */ - printk(KERN_DEBUG - "MCA %d: Slot %d I/O at 0x%04X Mem 0x%08X", p[2], + printk("MCA %d: Slot %d I/O at 0x%04X Mem 0x%08X", p[2], d[3], d[1] << 8 | d[0], *(u32 *) (d + 4)); break; case 4: /* PCI bus */ - printk(KERN_DEBUG - "PCI %d: Bus %d Device %d Function %d", p[2], + printk("PCI %d: Bus %d Device %d Function %d", p[2], d[2], d[1], d[0]); break; case 0x80: /* Other */ default: - printk(KERN_DEBUG "Unsupported bus type."); + printk("Unsupported bus type."); break; } - printk(KERN_DEBUG "\n"); + printk("\n"); rows += length; } } diff --git a/drivers/mmc/au1xmmc.c b/drivers/mmc/au1xmmc.c index 8d84b045bc83..85e89c77bdea 100644 --- a/drivers/mmc/au1xmmc.c +++ b/drivers/mmc/au1xmmc.c @@ -87,7 +87,7 @@ struct au1xmmc_host *au1xmmc_hosts[AU1XMMC_CONTROLLER_COUNT]; static int dma = 1; #ifdef MODULE -MODULE_PARM(dma, "i"); +module_param(dma, bool, 0); MODULE_PARM_DESC(dma, "Use DMA engine for data transfers (0 = disabled)"); #endif diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c index f0f8916da7ad..f988c817e196 100644 --- a/drivers/mtd/maps/pcmciamtd.c +++ b/drivers/mtd/maps/pcmciamtd.c @@ -28,7 +28,7 @@ #ifdef CONFIG_MTD_DEBUG static int debug = CONFIG_MTD_DEBUG_VERBOSE; -MODULE_PARM(debug, "i"); +module_param(debug, int, 0); MODULE_PARM_DESC(debug, "Set Debug Level 0=quiet, 5=noisy"); #undef DEBUG #define DEBUG(n, format, arg...) \ @@ -89,17 +89,17 @@ static int mem_type; MODULE_LICENSE("GPL"); MODULE_AUTHOR("Simon Evans <spse@secret.org.uk>"); MODULE_DESCRIPTION(DRIVER_DESC); -MODULE_PARM(bankwidth, "i"); +module_param(bankwidth, int, 0); MODULE_PARM_DESC(bankwidth, "Set bankwidth (1=8 bit, 2=16 bit, default=2)"); -MODULE_PARM(mem_speed, "i"); +module_param(mem_speed, int, 0); MODULE_PARM_DESC(mem_speed, "Set memory access speed in ns"); -MODULE_PARM(force_size, "i"); +module_param(force_size, int, 0); MODULE_PARM_DESC(force_size, "Force size of card in MiB (1-64)"); -MODULE_PARM(setvpp, "i"); +module_param(setvpp, int, 0); MODULE_PARM_DESC(setvpp, "Set Vpp (0=Never, 1=On writes, 2=Always on, default=0)"); -MODULE_PARM(vpp, "i"); +module_param(vpp, int, 0); MODULE_PARM_DESC(vpp, "Vpp value in 1/10ths eg 33=3.3V 120=12V (Dangerous)"); -MODULE_PARM(mem_type, "i"); +module_param(mem_type, int, 0); MODULE_PARM_DESC(mem_type, "Set Memory type (0=Flash, 1=RAM, 2=ROM, default=0)"); diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c index 5d11a06ecb2c..d339308539fa 100644 --- a/drivers/net/3c59x.c +++ b/drivers/net/3c59x.c @@ -1096,14 +1096,18 @@ static int __init vortex_eisa_init (void) int orig_cards_found = vortex_cards_found; #ifdef CONFIG_EISA - if (eisa_driver_register (&vortex_eisa_driver) >= 0) { - /* Because of the way EISA bus is probed, we cannot assume - * any device have been found when we exit from - * eisa_driver_register (the bus root driver may not be - * initialized yet). So we blindly assume something was - * found, and let the sysfs magic happend... */ - - eisa_found = 1; + int err; + + err = eisa_driver_register (&vortex_eisa_driver); + if (!err) { + /* + * Because of the way EISA bus is probed, we cannot assume + * any device have been found when we exit from + * eisa_driver_register (the bus root driver may not be + * initialized yet). So we blindly assume something was + * found, and let the sysfs magic happend... + */ + eisa_found = 1; } #endif diff --git a/drivers/net/a2065.c b/drivers/net/a2065.c index 8e538a6d7d97..79bb56b8dcef 100644 --- a/drivers/net/a2065.c +++ b/drivers/net/a2065.c @@ -829,7 +829,7 @@ static void __devexit a2065_remove_one(struct zorro_dev *z) static int __init a2065_init_module(void) { - return zorro_module_init(&a2065_driver); + return zorro_register_driver(&a2065_driver); } static void __exit a2065_cleanup_module(void) diff --git a/drivers/net/ariadne.c b/drivers/net/ariadne.c index 9fe93acfc8ef..d1b6b1f794e2 100644 --- a/drivers/net/ariadne.c +++ b/drivers/net/ariadne.c @@ -864,7 +864,7 @@ static void __devexit ariadne_remove_one(struct zorro_dev *z) static int __init ariadne_init_module(void) { - return zorro_module_init(&ariadne_driver); + return zorro_register_driver(&ariadne_driver); } static void __exit ariadne_cleanup_module(void) diff --git a/drivers/net/arm/Kconfig b/drivers/net/arm/Kconfig index 625184b65e38..77fe20dbea35 100644 --- a/drivers/net/arm/Kconfig +++ b/drivers/net/arm/Kconfig @@ -31,3 +31,11 @@ config ARM_ETHERH help If you have an Acorn system with one of these network cards, you should say Y to this option if you wish to use it with Linux. + +config ARM_AT91_ETHER + tristate "AT91RM9200 Ethernet support" + depends on NET_ETHERNET && ARM && ARCH_AT91RM9200 + select MII + help + If you wish to compile a kernel for the AT91RM9200 and enable + ethernet support, then you should always answer Y to this. diff --git a/drivers/net/arm/Makefile b/drivers/net/arm/Makefile index bc263edf06a7..42c95b79c261 100644 --- a/drivers/net/arm/Makefile +++ b/drivers/net/arm/Makefile @@ -7,3 +7,4 @@ obj-$(CONFIG_ARM_AM79C961A) += am79c961a.o obj-$(CONFIG_ARM_ETHERH) += etherh.o obj-$(CONFIG_ARM_ETHER3) += ether3.o obj-$(CONFIG_ARM_ETHER1) += ether1.o +obj-$(CONFIG_ARM_AT91_ETHER) += at91_ether.o diff --git a/drivers/net/arm/at91_ether.c b/drivers/net/arm/at91_ether.c new file mode 100644 index 000000000000..5503dc8a66e4 --- /dev/null +++ b/drivers/net/arm/at91_ether.c @@ -0,0 +1,1110 @@ +/* + * Ethernet driver for the Atmel AT91RM9200 (Thunder) + * + * Copyright (C) 2003 SAN People (Pty) Ltd + * + * Based on an earlier Atmel EMAC macrocell driver by Atmel and Lineo Inc. + * Initial version by Rick Bronson 01/11/2003 + * + * Intel LXT971A PHY support by Christopher Bahns & David Knickerbocker + * (Polaroid Corporation) + * + * Realtek RTL8201(B)L PHY support by Roman Avramenko <roman@imsystems.ru> + * + * 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/module.h> +#include <linux/init.h> +#include <linux/config.h> +#include <linux/mii.h> +#include <linux/netdevice.h> +#include <linux/etherdevice.h> +#include <linux/skbuff.h> +#include <linux/dma-mapping.h> +#include <linux/ethtool.h> +#include <linux/platform_device.h> +#include <linux/clk.h> + +#include <asm/io.h> +#include <asm/uaccess.h> +#include <asm/mach-types.h> + +#include <asm/arch/at91rm9200_emac.h> +#include <asm/arch/gpio.h> +#include <asm/arch/board.h> + +#include "at91_ether.h" + +#define DRV_NAME "at91_ether" +#define DRV_VERSION "1.0" + +static struct net_device *at91_dev; +static struct clk *ether_clk; + +/* ..................................................................... */ + +/* + * Read from a EMAC register. + */ +static inline unsigned long at91_emac_read(unsigned int reg) +{ + void __iomem *emac_base = (void __iomem *)AT91_VA_BASE_EMAC; + + return __raw_readl(emac_base + reg); +} + +/* + * Write to a EMAC register. + */ +static inline void at91_emac_write(unsigned int reg, unsigned long value) +{ + void __iomem *emac_base = (void __iomem *)AT91_VA_BASE_EMAC; + + __raw_writel(value, emac_base + reg); +} + +/* ........................... PHY INTERFACE ........................... */ + +/* + * Enable the MDIO bit in MAC control register + * When not called from an interrupt-handler, access to the PHY must be + * protected by a spinlock. + */ +static void enable_mdi(void) +{ + unsigned long ctl; + + ctl = at91_emac_read(AT91_EMAC_CTL); + at91_emac_write(AT91_EMAC_CTL, ctl | AT91_EMAC_MPE); /* enable management port */ +} + +/* + * Disable the MDIO bit in the MAC control register + */ +static void disable_mdi(void) +{ + unsigned long ctl; + + ctl = at91_emac_read(AT91_EMAC_CTL); + at91_emac_write(AT91_EMAC_CTL, ctl & ~AT91_EMAC_MPE); /* disable management port */ +} + +/* + * Wait until the PHY operation is complete. + */ +static inline void at91_phy_wait(void) { + unsigned long timeout = jiffies + 2; + + while (!(at91_emac_read(AT91_EMAC_SR) & AT91_EMAC_SR_IDLE)) { + if (time_after(jiffies, timeout)) { + printk("at91_ether: MIO timeout\n"); + break; + } + cpu_relax(); + } +} + +/* + * Write value to the a PHY register + * Note: MDI interface is assumed to already have been enabled. + */ +static void write_phy(unsigned char phy_addr, unsigned char address, unsigned int value) +{ + at91_emac_write(AT91_EMAC_MAN, AT91_EMAC_MAN_802_3 | AT91_EMAC_RW_W + | ((phy_addr & 0x1f) << 23) | (address << 18) | (value & AT91_EMAC_DATA)); + + /* Wait until IDLE bit in Network Status register is cleared */ + at91_phy_wait(); +} + +/* + * Read value stored in a PHY register. + * Note: MDI interface is assumed to already have been enabled. + */ +static void read_phy(unsigned char phy_addr, unsigned char address, unsigned int *value) +{ + at91_emac_write(AT91_EMAC_MAN, AT91_EMAC_MAN_802_3 | AT91_EMAC_RW_R + | ((phy_addr & 0x1f) << 23) | (address << 18)); + + /* Wait until IDLE bit in Network Status register is cleared */ + at91_phy_wait(); + + *value = at91_emac_read(AT91_EMAC_MAN) & AT91_EMAC_DATA; +} + +/* ........................... PHY MANAGEMENT .......................... */ + +/* + * Access the PHY to determine the current link speed and mode, and update the + * MAC accordingly. + * If no link or auto-negotiation is busy, then no changes are made. + */ +static void update_linkspeed(struct net_device *dev) +{ + struct at91_private *lp = (struct at91_private *) dev->priv; + unsigned int bmsr, bmcr, lpa, mac_cfg; + unsigned int speed, duplex; + + if (!mii_link_ok(&lp->mii)) { /* no link */ + netif_carrier_off(dev); + printk(KERN_INFO "%s: Link down.\n", dev->name); + return; + } + + /* Link up, or auto-negotiation still in progress */ + read_phy(lp->phy_address, MII_BMSR, &bmsr); + read_phy(lp->phy_address, MII_BMCR, &bmcr); + if (bmcr & BMCR_ANENABLE) { /* AutoNegotiation is enabled */ + if (!(bmsr & BMSR_ANEGCOMPLETE)) + return; /* Do nothing - another interrupt generated when negotiation complete */ + + read_phy(lp->phy_address, MII_LPA, &lpa); + if ((lpa & LPA_100FULL) || (lpa & LPA_100HALF)) speed = SPEED_100; + else speed = SPEED_10; + if ((lpa & LPA_100FULL) || (lpa & LPA_10FULL)) duplex = DUPLEX_FULL; + else duplex = DUPLEX_HALF; + } else { + speed = (bmcr & BMCR_SPEED100) ? SPEED_100 : SPEED_10; + duplex = (bmcr & BMCR_FULLDPLX) ? DUPLEX_FULL : DUPLEX_HALF; + } + + /* Update the MAC */ + mac_cfg = at91_emac_read(AT91_EMAC_CFG) & ~(AT91_EMAC_SPD | AT91_EMAC_FD); + if (speed == SPEED_100) { + if (duplex == DUPLEX_FULL) /* 100 Full Duplex */ + mac_cfg |= AT91_EMAC_SPD | AT91_EMAC_FD; + else /* 100 Half Duplex */ + mac_cfg |= AT91_EMAC_SPD; + } else { + if (duplex == DUPLEX_FULL) /* 10 Full Duplex */ + mac_cfg |= AT91_EMAC_FD; + else {} /* 10 Half Duplex */ + } + at91_emac_write(AT91_EMAC_CFG, mac_cfg); + + printk(KERN_INFO "%s: Link now %i-%s\n", dev->name, speed, (duplex == DUPLEX_FULL) ? "FullDuplex" : "HalfDuplex"); + netif_carrier_on(dev); +} + +/* + * Handle interrupts from the PHY + */ +static irqreturn_t at91ether_phy_interrupt(int irq, void *dev_id, struct pt_regs *regs) +{ + struct net_device *dev = (struct net_device *) dev_id; + struct at91_private *lp = (struct at91_private *) dev->priv; + unsigned int phy; + + /* + * This hander is triggered on both edges, but the PHY chips expect + * level-triggering. We therefore have to check if the PHY actually has + * an IRQ pending. + */ + enable_mdi(); + if ((lp->phy_type == MII_DM9161_ID) || (lp->phy_type == MII_DM9161A_ID)) { + read_phy(lp->phy_address, MII_DSINTR_REG, &phy); /* ack interrupt in Davicom PHY */ + if (!(phy & (1 << 0))) + goto done; + } + else if (lp->phy_type == MII_LXT971A_ID) { + read_phy(lp->phy_address, MII_ISINTS_REG, &phy); /* ack interrupt in Intel PHY */ + if (!(phy & (1 << 2))) + goto done; + } + else if (lp->phy_type == MII_BCM5221_ID) { + read_phy(lp->phy_address, MII_BCMINTR_REG, &phy); /* ack interrupt in Broadcom PHY */ + if (!(phy & (1 << 0))) + goto done; + } + else if (lp->phy_type == MII_KS8721_ID) { + read_phy(lp->phy_address, MII_TPISTATUS, &phy); /* ack interrupt in Micrel PHY */ + if (!(phy & ((1 << 2) | 1))) + goto done; + } + + update_linkspeed(dev); + +done: + disable_mdi(); + + return IRQ_HANDLED; +} + +/* + * Initialize and enable the PHY interrupt for link-state changes + */ +static void enable_phyirq(struct net_device *dev) +{ + struct at91_private *lp = (struct at91_private *) dev->priv; + unsigned int dsintr, irq_number; + int status; + + if (lp->phy_type == MII_RTL8201_ID) /* RTL8201 does not have an interrupt */ + return; + if (lp->phy_type == MII_DP83847_ID) /* DP83847 does not have an interrupt */ + return; + if (lp->phy_type == MII_AC101L_ID) /* AC101L interrupt not supported yet */ + return; + + irq_number = lp->board_data.phy_irq_pin; + status = request_irq(irq_number, at91ether_phy_interrupt, 0, dev->name, dev); + if (status) { + printk(KERN_ERR "at91_ether: PHY IRQ %d request failed - status %d!\n", irq_number, status); + return; + } + + spin_lock_irq(&lp->lock); + enable_mdi(); + + if ((lp->phy_type == MII_DM9161_ID) || (lp->phy_type == MII_DM9161A_ID)) { /* for Davicom PHY */ + read_phy(lp->phy_address, MII_DSINTR_REG, &dsintr); + dsintr = dsintr & ~0xf00; /* clear bits 8..11 */ + write_phy(lp->phy_address, MII_DSINTR_REG, dsintr); + } + else if (lp->phy_type == MII_LXT971A_ID) { /* for Intel PHY */ + read_phy(lp->phy_address, MII_ISINTE_REG, &dsintr); + dsintr = dsintr | 0xf2; /* set bits 1, 4..7 */ + write_phy(lp->phy_address, MII_ISINTE_REG, dsintr); + } + else if (lp->phy_type == MII_BCM5221_ID) { /* for Broadcom PHY */ + dsintr = (1 << 15) | ( 1 << 14); + write_phy(lp->phy_address, MII_BCMINTR_REG, dsintr); + } + else if (lp->phy_type == MII_KS8721_ID) { /* for Micrel PHY */ + dsintr = (1 << 10) | ( 1 << 8); + write_phy(lp->phy_address, MII_TPISTATUS, dsintr); + } + + disable_mdi(); + spin_unlock_irq(&lp->lock); +} + +/* + * Disable the PHY interrupt + */ +static void disable_phyirq(struct net_device *dev) +{ + struct at91_private *lp = (struct at91_private *) dev->priv; + unsigned int dsintr; + unsigned int irq_number; + + if (lp->phy_type == MII_RTL8201_ID) /* RTL8201 does not have an interrupt */ + return; + if (lp->phy_type == MII_DP83847_ID) /* DP83847 does not have an interrupt */ + return; + if (lp->phy_type == MII_AC101L_ID) /* AC101L interrupt not supported yet */ + return; + + spin_lock_irq(&lp->lock); + enable_mdi(); + + if ((lp->phy_type == MII_DM9161_ID) || (lp->phy_type == MII_DM9161A_ID)) { /* for Davicom PHY */ + read_phy(lp->phy_address, MII_DSINTR_REG, &dsintr); + dsintr = dsintr | 0xf00; /* set bits 8..11 */ + write_phy(lp->phy_address, MII_DSINTR_REG, dsintr); + } + else if (lp->phy_type == MII_LXT971A_ID) { /* for Intel PHY */ + read_phy(lp->phy_address, MII_ISINTE_REG, &dsintr); + dsintr = dsintr & ~0xf2; /* clear bits 1, 4..7 */ + write_phy(lp->phy_address, MII_ISINTE_REG, dsintr); + } + else if (lp->phy_type == MII_BCM5221_ID) { /* for Broadcom PHY */ + read_phy(lp->phy_address, MII_BCMINTR_REG, &dsintr); + dsintr = ~(1 << 14); + write_phy(lp->phy_address, MII_BCMINTR_REG, dsintr); + } + else if (lp->phy_type == MII_KS8721_ID) { /* for Micrel PHY */ + read_phy(lp->phy_address, MII_TPISTATUS, &dsintr); + dsintr = ~((1 << 10) | (1 << 8)); + write_phy(lp->phy_address, MII_TPISTATUS, dsintr); + } + + disable_mdi(); + spin_unlock_irq(&lp->lock); + + irq_number = lp->board_data.phy_irq_pin; + free_irq(irq_number, dev); /* Free interrupt handler */ +} + +/* + * Perform a software reset of the PHY. + */ +#if 0 +static void reset_phy(struct net_device *dev) +{ + struct at91_private *lp = (struct at91_private *) dev->priv; + unsigned int bmcr; + + spin_lock_irq(&lp->lock); + enable_mdi(); + + /* Perform PHY reset */ + write_phy(lp->phy_address, MII_BMCR, BMCR_RESET); + + /* Wait until PHY reset is complete */ + do { + read_phy(lp->phy_address, MII_BMCR, &bmcr); + } while (!(bmcr && BMCR_RESET)); + + disable_mdi(); + spin_unlock_irq(&lp->lock); +} +#endif + +/* ......................... ADDRESS MANAGEMENT ........................ */ + +/* + * NOTE: Your bootloader must always set the MAC address correctly before + * booting into Linux. + * + * - It must always set the MAC address after reset, even if it doesn't + * happen to access the Ethernet while it's booting. Some versions of + * U-Boot on the AT91RM9200-DK do not do this. + * + * - Likewise it must store the addresses in the correct byte order. + * MicroMonitor (uMon) on the CSB337 does this incorrectly (and + * continues to do so, for bug-compatibility). + */ + +static short __init unpack_mac_address(struct net_device *dev, unsigned int hi, unsigned int lo) +{ + char addr[6]; + + if (machine_is_csb337()) { + addr[5] = (lo & 0xff); /* The CSB337 bootloader stores the MAC the wrong-way around */ + addr[4] = (lo & 0xff00) >> 8; + addr[3] = (lo & 0xff0000) >> 16; + addr[2] = (lo & 0xff000000) >> 24; + addr[1] = (hi & 0xff); + addr[0] = (hi & 0xff00) >> 8; + } + else { + addr[0] = (lo & 0xff); + addr[1] = (lo & 0xff00) >> 8; + addr[2] = (lo & 0xff0000) >> 16; + addr[3] = (lo & 0xff000000) >> 24; + addr[4] = (hi & 0xff); + addr[5] = (hi & 0xff00) >> 8; + } + + if (is_valid_ether_addr(addr)) { + memcpy(dev->dev_addr, &addr, 6); + return 1; + } + return 0; +} + +/* + * Set the ethernet MAC address in dev->dev_addr + */ +static void __init get_mac_address(struct net_device *dev) +{ + /* Check Specific-Address 1 */ + if (unpack_mac_address(dev, at91_emac_read(AT91_EMAC_SA1H), at91_emac_read(AT91_EMAC_SA1L))) + return; + /* Check Specific-Address 2 */ + if (unpack_mac_address(dev, at91_emac_read(AT91_EMAC_SA2H), at91_emac_read(AT91_EMAC_SA2L))) + return; + /* Check Specific-Address 3 */ + if (unpack_mac_address(dev, at91_emac_read(AT91_EMAC_SA3H), at91_emac_read(AT91_EMAC_SA3L))) + return; + /* Check Specific-Address 4 */ + if (unpack_mac_address(dev, at91_emac_read(AT91_EMAC_SA4H), at91_emac_read(AT91_EMAC_SA4L))) + return; + + printk(KERN_ERR "at91_ether: Your bootloader did not configure a MAC address.\n"); +} + +/* + * Program the hardware MAC address from dev->dev_addr. + */ +static void update_mac_address(struct net_device *dev) +{ + at91_emac_write(AT91_EMAC_SA1L, (dev->dev_addr[3] << 24) | (dev->dev_addr[2] << 16) | (dev->dev_addr[1] << 8) | (dev->dev_addr[0])); + at91_emac_write(AT91_EMAC_SA1H, (dev->dev_addr[5] << 8) | (dev->dev_addr[4])); + + at91_emac_write(AT91_EMAC_SA2L, 0); + at91_emac_write(AT91_EMAC_SA2H, 0); +} + +/* + * Store the new hardware address in dev->dev_addr, and update the MAC. + */ +static int set_mac_address(struct net_device *dev, void* addr) +{ + struct sockaddr *address = addr; + + if (!is_valid_ether_addr(address->sa_data)) + return -EADDRNOTAVAIL; + + memcpy(dev->dev_addr, address->sa_data, dev->addr_len); + update_mac_address(dev); + + printk("%s: Setting MAC address to %02x:%02x:%02x:%02x:%02x:%02x\n", dev->name, + dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2], + dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5]); + + return 0; +} + +static int inline hash_bit_value(int bitnr, __u8 *addr) +{ + if (addr[bitnr / 8] & (1 << (bitnr % 8))) + return 1; + return 0; +} + +/* + * The hash address register is 64 bits long and takes up two locations in the memory map. + * The least significant bits are stored in EMAC_HSL and the most significant + * bits in EMAC_HSH. + * + * The unicast hash enable and the multicast hash enable bits in the network configuration + * register enable the reception of hash matched frames. The destination address is + * reduced to a 6 bit index into the 64 bit hash register using the following hash function. + * The hash function is an exclusive or of every sixth bit of the destination address. + * hash_index[5] = da[5] ^ da[11] ^ da[17] ^ da[23] ^ da[29] ^ da[35] ^ da[41] ^ da[47] + * hash_index[4] = da[4] ^ da[10] ^ da[16] ^ da[22] ^ da[28] ^ da[34] ^ da[40] ^ da[46] + * hash_index[3] = da[3] ^ da[09] ^ da[15] ^ da[21] ^ da[27] ^ da[33] ^ da[39] ^ da[45] + * hash_index[2] = da[2] ^ da[08] ^ da[14] ^ da[20] ^ da[26] ^ da[32] ^ da[38] ^ da[44] + * hash_index[1] = da[1] ^ da[07] ^ da[13] ^ da[19] ^ da[25] ^ da[31] ^ da[37] ^ da[43] + * hash_index[0] = da[0] ^ da[06] ^ da[12] ^ da[18] ^ da[24] ^ da[30] ^ da[36] ^ da[42] + * da[0] represents the least significant bit of the first byte received, that is, the multicast/ + * unicast indicator, and da[47] represents the most significant bit of the last byte + * received. + * If the hash index points to a bit that is set in the hash register then the frame will be + * matched according to whether the frame is multicast or unicast. + * A multicast match will be signalled if the multicast hash enable bit is set, da[0] is 1 and + * the hash index points to a bit set in the hash register. + * A unicast match will be signalled if the unicast hash enable bit is set, da[0] is 0 and the + * hash index points to a bit set in the hash register. + * To receive all multicast frames, the hash register should be set with all ones and the + * multicast hash enable bit should be set in the network configuration register. + */ + +/* + * Return the hash index value for the specified address. + */ +static int hash_get_index(__u8 *addr) +{ + int i, j, bitval; + int hash_index = 0; + + for (j = 0; j < 6; j++) { + for (i = 0, bitval = 0; i < 8; i++) + bitval ^= hash_bit_value(i*6 + j, addr); + + hash_index |= (bitval << j); + } + + return hash_index; +} + +/* + * Add multicast addresses to the internal multicast-hash table. + */ +static void at91ether_sethashtable(struct net_device *dev) +{ + struct dev_mc_list *curr; + unsigned long mc_filter[2]; + unsigned int i, bitnr; + + mc_filter[0] = mc_filter[1] = 0; + + curr = dev->mc_list; + for (i = 0; i < dev->mc_count; i++, curr = curr->next) { + if (!curr) break; /* unexpected end of list */ + + bitnr = hash_get_index(curr->dmi_addr); + mc_filter[bitnr >> 5] |= 1 << (bitnr & 31); + } + + at91_emac_write(AT91_EMAC_HSH, mc_filter[0]); + at91_emac_write(AT91_EMAC_HSL, mc_filter[1]); +} + +/* + * Enable/Disable promiscuous and multicast modes. + */ +static void at91ether_set_rx_mode(struct net_device *dev) +{ + unsigned long cfg; + + cfg = at91_emac_read(AT91_EMAC_CFG); + + if (dev->flags & IFF_PROMISC) /* Enable promiscuous mode */ + cfg |= AT91_EMAC_CAF; + else if (dev->flags & (~IFF_PROMISC)) /* Disable promiscuous mode */ + cfg &= ~AT91_EMAC_CAF; + + if (dev->flags & IFF_ALLMULTI) { /* Enable all multicast mode */ + at91_emac_write(AT91_EMAC_HSH, -1); + at91_emac_write(AT91_EMAC_HSL, -1); + cfg |= AT91_EMAC_MTI; + } else if (dev->mc_count > 0) { /* Enable specific multicasts */ + at91ether_sethashtable(dev); + cfg |= AT91_EMAC_MTI; + } else if (dev->flags & (~IFF_ALLMULTI)) { /* Disable all multicast mode */ + at91_emac_write(AT91_EMAC_HSH, 0); + at91_emac_write(AT91_EMAC_HSL, 0); + cfg &= ~AT91_EMAC_MTI; + } + + at91_emac_write(AT91_EMAC_CFG, cfg); +} + + +/* ......................... ETHTOOL SUPPORT ........................... */ + + +static int mdio_read(struct net_device *dev, int phy_id, int location) +{ + unsigned int value; + + read_phy(phy_id, location, &value); + return value; +} + +static void mdio_write(struct net_device *dev, int phy_id, int location, int value) +{ + write_phy(phy_id, location, value); +} + +static int at91ether_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) +{ + struct at91_private *lp = (struct at91_private *) dev->priv; + int ret; + + spin_lock_irq(&lp->lock); + enable_mdi(); + + ret = mii_ethtool_gset(&lp->mii, cmd); + + disable_mdi(); + spin_unlock_irq(&lp->lock); + + if (lp->phy_media == PORT_FIBRE) { /* override media type since mii.c doesn't know */ + cmd->supported = SUPPORTED_FIBRE; + cmd->port = PORT_FIBRE; + } + + return ret; +} + +static int at91ether_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) +{ + struct at91_private *lp = (struct at91_private *) dev->priv; + int ret; + + spin_lock_irq(&lp->lock); + enable_mdi(); + + ret = mii_ethtool_sset(&lp->mii, cmd); + + disable_mdi(); + spin_unlock_irq(&lp->lock); + + return ret; +} + +static int at91ether_nwayreset(struct net_device *dev) +{ + struct at91_private *lp = (struct at91_private *) dev->priv; + int ret; + + spin_lock_irq(&lp->lock); + enable_mdi(); + + ret = mii_nway_restart(&lp->mii); + + disable_mdi(); + spin_unlock_irq(&lp->lock); + + return ret; +} + +static void at91ether_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) +{ + strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); + strlcpy(info->version, DRV_VERSION, sizeof(info->version)); + strlcpy(info->bus_info, dev->class_dev.dev->bus_id, sizeof(info->bus_info)); +} + +static struct ethtool_ops at91ether_ethtool_ops = { + .get_settings = at91ether_get_settings, + .set_settings = at91ether_set_settings, + .get_drvinfo = at91ether_get_drvinfo, + .nway_reset = at91ether_nwayreset, + .get_link = ethtool_op_get_link, +}; + + +/* ................................ MAC ................................ */ + +/* + * Initialize and start the Receiver and Transmit subsystems + */ +static void at91ether_start(struct net_device *dev) +{ + struct at91_private *lp = (struct at91_private *) dev->priv; + struct recv_desc_bufs *dlist, *dlist_phys; + int i; + unsigned long ctl; + + dlist = lp->dlist; + dlist_phys = lp->dlist_phys; + + for (i = 0; i < MAX_RX_DESCR; i++) { + dlist->descriptors[i].addr = (unsigned int) &dlist_phys->recv_buf[i][0]; + dlist->descriptors[i].size = 0; + } + + /* Set the Wrap bit on the last descriptor */ + dlist->descriptors[i-1].addr |= EMAC_DESC_WRAP; + + /* Reset buffer index */ + lp->rxBuffIndex = 0; + + /* Program address of descriptor list in Rx Buffer Queue register */ + at91_emac_write(AT91_EMAC_RBQP, (unsigned long) dlist_phys); + + /* Enable Receive and Transmit */ + ctl = at91_emac_read(AT91_EMAC_CTL); + at91_emac_write(AT91_EMAC_CTL, ctl | AT91_EMAC_RE | AT91_EMAC_TE); +} + +/* + * Open the ethernet interface + */ +static int at91ether_open(struct net_device *dev) +{ + struct at91_private *lp = (struct at91_private *) dev->priv; + unsigned long ctl; + + if (!is_valid_ether_addr(dev->dev_addr)) + return -EADDRNOTAVAIL; + + clk_enable(ether_clk); /* Re-enable Peripheral clock */ + + /* Clear internal statistics */ + ctl = at91_emac_read(AT91_EMAC_CTL); + at91_emac_write(AT91_EMAC_CTL, ctl | AT91_EMAC_CSR); + + /* Update the MAC address (incase user has changed it) */ + update_mac_address(dev); + + /* Enable PHY interrupt */ + enable_phyirq(dev); + + /* Enable MAC interrupts */ + at91_emac_write(AT91_EMAC_IER, AT91_EMAC_RCOM | AT91_EMAC_RBNA + | AT91_EMAC_TUND | AT91_EMAC_RTRY | AT91_EMAC_TCOM + | AT91_EMAC_ROVR | AT91_EMAC_ABT); + + /* Determine current link speed */ + spin_lock_irq(&lp->lock); + enable_mdi(); + update_linkspeed(dev); + disable_mdi(); + spin_unlock_irq(&lp->lock); + + at91ether_start(dev); + netif_start_queue(dev); + return 0; +} + +/* + * Close the interface + */ +static int at91ether_close(struct net_device *dev) +{ + unsigned long ctl; + + /* Disable Receiver and Transmitter */ + ctl = at91_emac_read(AT91_EMAC_CTL); + at91_emac_write(AT91_EMAC_CTL, ctl & ~(AT91_EMAC_TE | AT91_EMAC_RE)); + + /* Disable PHY interrupt */ + disable_phyirq(dev); + + /* Disable MAC interrupts */ + at91_emac_write(AT91_EMAC_IDR, AT91_EMAC_RCOM | AT91_EMAC_RBNA + | AT91_EMAC_TUND | AT91_EMAC_RTRY | AT91_EMAC_TCOM + | AT91_EMAC_ROVR | AT91_EMAC_ABT); + + netif_stop_queue(dev); + + clk_disable(ether_clk); /* Disable Peripheral clock */ + + return 0; +} + +/* + * Transmit packet. + */ +static int at91ether_tx(struct sk_buff *skb, struct net_device *dev) +{ + struct at91_private *lp = (struct at91_private *) dev->priv; + + if (at91_emac_read(AT91_EMAC_TSR) & AT91_EMAC_TSR_BNQ) { + netif_stop_queue(dev); + + /* Store packet information (to free when Tx completed) */ + lp->skb = skb; + lp->skb_length = skb->len; + lp->skb_physaddr = dma_map_single(NULL, skb->data, skb->len, DMA_TO_DEVICE); + lp->stats.tx_bytes += skb->len; + + /* Set address of the data in the Transmit Address register */ + at91_emac_write(AT91_EMAC_TAR, lp->skb_physaddr); + /* Set length of the packet in the Transmit Control register */ + at91_emac_write(AT91_EMAC_TCR, skb->len); + + dev->trans_start = jiffies; + } else { + printk(KERN_ERR "at91_ether.c: at91ether_tx() called, but device is busy!\n"); + return 1; /* if we return anything but zero, dev.c:1055 calls kfree_skb(skb) + on this skb, he also reports -ENETDOWN and printk's, so either + we free and return(0) or don't free and return 1 */ + } + + return 0; +} + +/* + * Update the current statistics from the internal statistics registers. + */ +static struct net_device_stats *at91ether_stats(struct net_device *dev) +{ + struct at91_private *lp = (struct at91_private *) dev->priv; + int ale, lenerr, seqe, lcol, ecol; + + if (netif_running(dev)) { + lp->stats.rx_packets += at91_emac_read(AT91_EMAC_OK); /* Good frames received */ + ale = at91_emac_read(AT91_EMAC_ALE); + lp->stats.rx_frame_errors += ale; /* Alignment errors */ + lenerr = at91_emac_read(AT91_EMAC_ELR) + at91_emac_read(AT91_EMAC_USF); + lp->stats.rx_length_errors += lenerr; /* Excessive Length or Undersize Frame error */ + seqe = at91_emac_read(AT91_EMAC_SEQE); + lp->stats.rx_crc_errors += seqe; /* CRC error */ + lp->stats.rx_fifo_errors += at91_emac_read(AT91_EMAC_DRFC); /* Receive buffer not available */ + lp->stats.rx_errors += (ale + lenerr + seqe + + at91_emac_read(AT91_EMAC_CDE) + at91_emac_read(AT91_EMAC_RJB)); + + lp->stats.tx_packets += at91_emac_read(AT91_EMAC_FRA); /* Frames successfully transmitted */ + lp->stats.tx_fifo_errors += at91_emac_read(AT91_EMAC_TUE); /* Transmit FIFO underruns */ + lp->stats.tx_carrier_errors += at91_emac_read(AT91_EMAC_CSE); /* Carrier Sense errors */ + lp->stats.tx_heartbeat_errors += at91_emac_read(AT91_EMAC_SQEE);/* Heartbeat error */ + + lcol = at91_emac_read(AT91_EMAC_LCOL); + ecol = at91_emac_read(AT91_EMAC_ECOL); + lp->stats.tx_window_errors += lcol; /* Late collisions */ + lp->stats.tx_aborted_errors += ecol; /* 16 collisions */ + + lp->stats.collisions += (at91_emac_read(AT91_EMAC_SCOL) + at91_emac_read(AT91_EMAC_MCOL) + lcol + ecol); + } + return &lp->stats; +} + +/* + * Extract received frame from buffer descriptors and sent to upper layers. + * (Called from interrupt context) + */ +static void at91ether_rx(struct net_device *dev) +{ + struct at91_private *lp = (struct at91_private *) dev->priv; + struct recv_desc_bufs *dlist; + unsigned char *p_recv; + struct sk_buff *skb; + unsigned int pktlen; + + dlist = lp->dlist; + while (dlist->descriptors[lp->rxBuffIndex].addr & EMAC_DESC_DONE) { + p_recv = dlist->recv_buf[lp->rxBuffIndex]; + pktlen = dlist->descriptors[lp->rxBuffIndex].size & 0x7ff; /* Length of frame including FCS */ + skb = alloc_skb(pktlen + 2, GFP_ATOMIC); + if (skb != NULL) { + skb_reserve(skb, 2); + memcpy(skb_put(skb, pktlen), p_recv, pktlen); + + skb->dev = dev; + skb->protocol = eth_type_trans(skb, dev); + skb->len = pktlen; + dev->last_rx = jiffies; + lp->stats.rx_bytes += pktlen; + netif_rx(skb); + } + else { + lp->stats.rx_dropped += 1; + printk(KERN_NOTICE "%s: Memory squeeze, dropping packet.\n", dev->name); + } + + if (dlist->descriptors[lp->rxBuffIndex].size & EMAC_MULTICAST) + lp->stats.multicast++; + + dlist->descriptors[lp->rxBuffIndex].addr &= ~EMAC_DESC_DONE; /* reset ownership bit */ + if (lp->rxBuffIndex == MAX_RX_DESCR-1) /* wrap after last buffer */ + lp->rxBuffIndex = 0; + else + lp->rxBuffIndex++; + } +} + +/* + * MAC interrupt handler + */ +static irqreturn_t at91ether_interrupt(int irq, void *dev_id, struct pt_regs *regs) +{ + struct net_device *dev = (struct net_device *) dev_id; + struct at91_private *lp = (struct at91_private *) dev->priv; + unsigned long intstatus, ctl; + + /* MAC Interrupt Status register indicates what interrupts are pending. + It is automatically cleared once read. */ + intstatus = at91_emac_read(AT91_EMAC_ISR); + + if (intstatus & AT91_EMAC_RCOM) /* Receive complete */ + at91ether_rx(dev); + + if (intstatus & AT91_EMAC_TCOM) { /* Transmit complete */ + /* The TCOM bit is set even if the transmission failed. */ + if (intstatus & (AT91_EMAC_TUND | AT91_EMAC_RTRY)) + lp->stats.tx_errors += 1; + + if (lp->skb) { + dev_kfree_skb_irq(lp->skb); + lp->skb = NULL; + dma_unmap_single(NULL, lp->skb_physaddr, lp->skb_length, DMA_TO_DEVICE); + } + netif_wake_queue(dev); + } + + /* Work-around for Errata #11 */ + if (intstatus & AT91_EMAC_RBNA) { + ctl = at91_emac_read(AT91_EMAC_CTL); + at91_emac_write(AT91_EMAC_CTL, ctl & ~AT91_EMAC_RE); + at91_emac_write(AT91_EMAC_CTL, ctl | AT91_EMAC_RE); + } + + if (intstatus & AT91_EMAC_ROVR) + printk("%s: ROVR error\n", dev->name); + + return IRQ_HANDLED; +} + +/* + * Initialize the ethernet interface + */ +static int __init at91ether_setup(unsigned long phy_type, unsigned short phy_address, struct platform_device *pdev) +{ + struct at91_eth_data *board_data = pdev->dev.platform_data; + struct net_device *dev; + struct at91_private *lp; + unsigned int val; + int res; + + if (at91_dev) /* already initialized */ + return 0; + + dev = alloc_etherdev(sizeof(struct at91_private)); + if (!dev) + return -ENOMEM; + + dev->base_addr = AT91_VA_BASE_EMAC; + dev->irq = AT91_ID_EMAC; + SET_MODULE_OWNER(dev); + + /* Install the interrupt handler */ + if (request_irq(dev->irq, at91ether_interrupt, 0, dev->name, dev)) { + free_netdev(dev); + return -EBUSY; + } + + /* Allocate memory for DMA Receive descriptors */ + lp = (struct at91_private *)dev->priv; + lp->dlist = (struct recv_desc_bufs *) dma_alloc_coherent(NULL, sizeof(struct recv_desc_bufs), (dma_addr_t *) &lp->dlist_phys, GFP_KERNEL); + if (lp->dlist == NULL) { + free_irq(dev->irq, dev); + free_netdev(dev); + return -ENOMEM; + } + lp->board_data = *board_data; + platform_set_drvdata(pdev, dev); + + spin_lock_init(&lp->lock); + + ether_setup(dev); + dev->open = at91ether_open; + dev->stop = at91ether_close; + dev->hard_start_xmit = at91ether_tx; + dev->get_stats = at91ether_stats; + dev->set_multicast_list = at91ether_set_rx_mode; + dev->set_mac_address = set_mac_address; + dev->ethtool_ops = &at91ether_ethtool_ops; + + SET_NETDEV_DEV(dev, &pdev->dev); + + get_mac_address(dev); /* Get ethernet address and store it in dev->dev_addr */ + update_mac_address(dev); /* Program ethernet address into MAC */ + + at91_emac_write(AT91_EMAC_CTL, 0); + + if (lp->board_data.is_rmii) + at91_emac_write(AT91_EMAC_CFG, AT91_EMAC_CLK_DIV32 | AT91_EMAC_BIG | AT91_EMAC_RMII); + else + at91_emac_write(AT91_EMAC_CFG, AT91_EMAC_CLK_DIV32 | AT91_EMAC_BIG); + + /* Perform PHY-specific initialization */ + spin_lock_irq(&lp->lock); + enable_mdi(); + if ((phy_type == MII_DM9161_ID) || (lp->phy_type == MII_DM9161A_ID)) { + read_phy(phy_address, MII_DSCR_REG, &val); + if ((val & (1 << 10)) == 0) /* DSCR bit 10 is 0 -- fiber mode */ + lp->phy_media = PORT_FIBRE; + } else if (machine_is_csb337()) { + /* mix link activity status into LED2 link state */ + write_phy(phy_address, MII_LEDCTRL_REG, 0x0d22); + } + disable_mdi(); + spin_unlock_irq(&lp->lock); + + lp->mii.dev = dev; /* Support for ethtool */ + lp->mii.mdio_read = mdio_read; + lp->mii.mdio_write = mdio_write; + + lp->phy_type = phy_type; /* Type of PHY connected */ + lp->phy_address = phy_address; /* MDI address of PHY */ + + /* Register the network interface */ + res = register_netdev(dev); + if (res) { + free_irq(dev->irq, dev); + free_netdev(dev); + dma_free_coherent(NULL, sizeof(struct recv_desc_bufs), lp->dlist, (dma_addr_t)lp->dlist_phys); + return res; + } + at91_dev = dev; + + /* Determine current link speed */ + spin_lock_irq(&lp->lock); + enable_mdi(); + update_linkspeed(dev); + disable_mdi(); + spin_unlock_irq(&lp->lock); + netif_carrier_off(dev); /* will be enabled in open() */ + + /* Display ethernet banner */ + printk(KERN_INFO "%s: AT91 ethernet at 0x%08x int=%d %s%s (%02x:%02x:%02x:%02x:%02x:%02x)\n", + dev->name, (uint) dev->base_addr, dev->irq, + at91_emac_read(AT91_EMAC_CFG) & AT91_EMAC_SPD ? "100-" : "10-", + at91_emac_read(AT91_EMAC_CFG) & AT91_EMAC_FD ? "FullDuplex" : "HalfDuplex", + dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2], + dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5]); + if ((phy_type == MII_DM9161_ID) || (lp->phy_type == MII_DM9161A_ID)) + printk(KERN_INFO "%s: Davicom 9196 PHY %s\n", dev->name, (lp->phy_media == PORT_FIBRE) ? "(Fiber)" : "(Copper)"); + else if (phy_type == MII_LXT971A_ID) + printk(KERN_INFO "%s: Intel LXT971A PHY\n", dev->name); + else if (phy_type == MII_RTL8201_ID) + printk(KERN_INFO "%s: Realtek RTL8201(B)L PHY\n", dev->name); + else if (phy_type == MII_BCM5221_ID) + printk(KERN_INFO "%s: Broadcom BCM5221 PHY\n", dev->name); + else if (phy_type == MII_DP83847_ID) + printk(KERN_INFO "%s: National Semiconductor DP83847 PHY\n", dev->name); + else if (phy_type == MII_AC101L_ID) + printk(KERN_INFO "%s: Altima AC101L PHY\n", dev->name); + else if (phy_type == MII_KS8721_ID) + printk(KERN_INFO "%s: Micrel KS8721 PHY\n", dev->name); + + return 0; +} + +/* + * Detect MAC and PHY and perform initialization + */ +static int __init at91ether_probe(struct platform_device *pdev) +{ + unsigned int phyid1, phyid2; + int detected = -1; + unsigned long phy_id; + unsigned short phy_address = 0; + + ether_clk = clk_get(&pdev->dev, "ether_clk"); + if (!ether_clk) { + printk(KERN_ERR "at91_ether: no clock defined\n"); + return -ENODEV; + } + clk_enable(ether_clk); /* Enable Peripheral clock */ + + while ((detected != 0) && (phy_address < 32)) { + /* Read the PHY ID registers */ + enable_mdi(); + read_phy(phy_address, MII_PHYSID1, &phyid1); + read_phy(phy_address, MII_PHYSID2, &phyid2); + disable_mdi(); + + phy_id = (phyid1 << 16) | (phyid2 & 0xfff0); + switch (phy_id) { + case MII_DM9161_ID: /* Davicom 9161: PHY_ID1 = 0x181, PHY_ID2 = B881 */ + case MII_DM9161A_ID: /* Davicom 9161A: PHY_ID1 = 0x181, PHY_ID2 = B8A0 */ + case MII_LXT971A_ID: /* Intel LXT971A: PHY_ID1 = 0x13, PHY_ID2 = 78E0 */ + case MII_RTL8201_ID: /* Realtek RTL8201: PHY_ID1 = 0, PHY_ID2 = 0x8201 */ + case MII_BCM5221_ID: /* Broadcom BCM5221: PHY_ID1 = 0x40, PHY_ID2 = 0x61e0 */ + case MII_DP83847_ID: /* National Semiconductor DP83847: */ + case MII_AC101L_ID: /* Altima AC101L: PHY_ID1 = 0x22, PHY_ID2 = 0x5520 */ + case MII_KS8721_ID: /* Micrel KS8721: PHY_ID1 = 0x22, PHY_ID2 = 0x1610 */ + detected = at91ether_setup(phy_id, phy_address, pdev); + break; + } + + phy_address++; + } + + clk_disable(ether_clk); /* Disable Peripheral clock */ + + return detected; +} + +static int __devexit at91ether_remove(struct platform_device *pdev) +{ + struct at91_private *lp = (struct at91_private *) at91_dev->priv; + + unregister_netdev(at91_dev); + free_irq(at91_dev->irq, at91_dev); + dma_free_coherent(NULL, sizeof(struct recv_desc_bufs), lp->dlist, (dma_addr_t)lp->dlist_phys); + clk_put(ether_clk); + + free_netdev(at91_dev); + at91_dev = NULL; + return 0; +} + +static struct platform_driver at91ether_driver = { + .probe = at91ether_probe, + .remove = __devexit_p(at91ether_remove), + /* FIXME: support suspend and resume */ + .driver = { + .name = DRV_NAME, + .owner = THIS_MODULE, + }, +}; + +static int __init at91ether_init(void) +{ + return platform_driver_register(&at91ether_driver); +} + +static void __exit at91ether_exit(void) +{ + platform_driver_unregister(&at91ether_driver); +} + +module_init(at91ether_init) +module_exit(at91ether_exit) + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("AT91RM9200 EMAC Ethernet driver"); +MODULE_AUTHOR("Andrew Victor"); diff --git a/drivers/net/arm/at91_ether.h b/drivers/net/arm/at91_ether.h new file mode 100644 index 000000000000..9885735c9c8a --- /dev/null +++ b/drivers/net/arm/at91_ether.h @@ -0,0 +1,101 @@ +/* + * Ethernet driver for the Atmel AT91RM9200 (Thunder) + * + * Copyright (C) SAN People (Pty) Ltd + * + * Based on an earlier Atmel EMAC macrocell driver by Atmel and Lineo Inc. + * Initial version by Rick Bronson. + * + * 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. + */ + +#ifndef AT91_ETHERNET +#define AT91_ETHERNET + + +/* Davicom 9161 PHY */ +#define MII_DM9161_ID 0x0181b880 +#define MII_DM9161A_ID 0x0181b8a0 + +/* Davicom specific registers */ +#define MII_DSCR_REG 16 +#define MII_DSCSR_REG 17 +#define MII_DSINTR_REG 21 + +/* Intel LXT971A PHY */ +#define MII_LXT971A_ID 0x001378E0 + +/* Intel specific registers */ +#define MII_ISINTE_REG 18 +#define MII_ISINTS_REG 19 +#define MII_LEDCTRL_REG 20 + +/* Realtek RTL8201 PHY */ +#define MII_RTL8201_ID 0x00008200 + +/* Broadcom BCM5221 PHY */ +#define MII_BCM5221_ID 0x004061e0 + +/* Broadcom specific registers */ +#define MII_BCMINTR_REG 26 + +/* National Semiconductor DP83847 */ +#define MII_DP83847_ID 0x20005c30 + +/* Altima AC101L PHY */ +#define MII_AC101L_ID 0x00225520 + +/* Micrel KS8721 PHY */ +#define MII_KS8721_ID 0x00221610 + +/* ........................................................................ */ + +#define MAX_RBUFF_SZ 0x600 /* 1518 rounded up */ +#define MAX_RX_DESCR 9 /* max number of receive buffers */ + +#define EMAC_DESC_DONE 0x00000001 /* bit for if DMA is done */ +#define EMAC_DESC_WRAP 0x00000002 /* bit for wrap */ + +#define EMAC_BROADCAST 0x80000000 /* broadcast address */ +#define EMAC_MULTICAST 0x40000000 /* multicast address */ +#define EMAC_UNICAST 0x20000000 /* unicast address */ + +struct rbf_t +{ + unsigned int addr; + unsigned long size; +}; + +struct recv_desc_bufs +{ + struct rbf_t descriptors[MAX_RX_DESCR]; /* must be on sizeof (rbf_t) boundary */ + char recv_buf[MAX_RX_DESCR][MAX_RBUFF_SZ]; /* must be on long boundary */ +}; + +struct at91_private +{ + struct net_device_stats stats; + struct mii_if_info mii; /* ethtool support */ + struct at91_eth_data board_data; /* board-specific configuration */ + + /* PHY */ + unsigned long phy_type; /* type of PHY (PHY_ID) */ + spinlock_t lock; /* lock for MDI interface */ + short phy_media; /* media interface type */ + unsigned short phy_address; /* 5-bit MDI address of PHY (0..31) */ + + /* Transmit */ + struct sk_buff *skb; /* holds skb until xmit interrupt completes */ + dma_addr_t skb_physaddr; /* phys addr from pci_map_single */ + int skb_length; /* saved skb length for pci_unmap_single */ + + /* Receive */ + int rxBuffIndex; /* index into receive descriptor list */ + struct recv_desc_bufs *dlist; /* descriptor list address */ + struct recv_desc_bufs *dlist_phys; /* descriptor list physical address */ +}; + +#endif diff --git a/drivers/net/atari_bionet.c b/drivers/net/atari_bionet.c index 0095384ff454..5e5f80b99b9e 100644 --- a/drivers/net/atari_bionet.c +++ b/drivers/net/atari_bionet.c @@ -123,7 +123,7 @@ static char version[] = * Global variable 'bionet_debug'. Can be set at load time by 'insmod' */ unsigned int bionet_debug = NET_DEBUG; -MODULE_PARM(bionet_debug, "i"); +module_param(bionet_debug, int, 0); MODULE_PARM_DESC(bionet_debug, "bionet debug level (0-2)"); MODULE_LICENSE("GPL"); diff --git a/drivers/net/atari_pamsnet.c b/drivers/net/atari_pamsnet.c index 8b997809f9de..d6039e62d832 100644 --- a/drivers/net/atari_pamsnet.c +++ b/drivers/net/atari_pamsnet.c @@ -119,7 +119,7 @@ static char *version = * Global variable 'pamsnet_debug'. Can be set at load time by 'insmod' */ unsigned int pamsnet_debug = NET_DEBUG; -MODULE_PARM(pamsnet_debug, "i"); +module_param(pamsnet_debug, int, 0); MODULE_PARM_DESC(pamsnet_debug, "pamsnet debug enable (0-1)"); MODULE_LICENSE("GPL"); diff --git a/drivers/net/atarilance.c b/drivers/net/atarilance.c index e01b6a78ec63..442b2cbeb58a 100644 --- a/drivers/net/atarilance.c +++ b/drivers/net/atarilance.c @@ -78,7 +78,7 @@ static int lance_debug = LANCE_DEBUG; #else static int lance_debug = 1; #endif -MODULE_PARM(lance_debug, "i"); +module_param(lance_debug, int, 0); MODULE_PARM_DESC(lance_debug, "atarilance debug level (0-3)"); MODULE_LICENSE("GPL"); diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c index 8f1573e658a5..ac48f7543500 100644 --- a/drivers/net/cassini.c +++ b/drivers/net/cassini.c @@ -192,12 +192,15 @@ static char version[] __devinitdata = DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; +static int cassini_debug = -1; /* -1 == use CAS_DEF_MSG_ENABLE as value */ +static int link_mode; + MODULE_AUTHOR("Adrian Sun (asun@darksunrising.com)"); MODULE_DESCRIPTION("Sun Cassini(+) ethernet driver"); MODULE_LICENSE("GPL"); -MODULE_PARM(cassini_debug, "i"); +module_param(cassini_debug, int, 0); MODULE_PARM_DESC(cassini_debug, "Cassini bitmapped debugging message enable value"); -MODULE_PARM(link_mode, "i"); +module_param(link_mode, int, 0); MODULE_PARM_DESC(link_mode, "default link mode"); /* @@ -209,7 +212,7 @@ MODULE_PARM_DESC(link_mode, "default link mode"); * Value in seconds, for user input. */ static int linkdown_timeout = DEFAULT_LINKDOWN_TIMEOUT; -MODULE_PARM(linkdown_timeout, "i"); +module_param(linkdown_timeout, int, 0); MODULE_PARM_DESC(linkdown_timeout, "min reset interval in sec. for PCS linkdown issue; disabled if not positive"); @@ -221,8 +224,6 @@ MODULE_PARM_DESC(linkdown_timeout, static int link_transition_timeout; -static int cassini_debug = -1; /* -1 == use CAS_DEF_MSG_ENABLE as value */ -static int link_mode; static u16 link_modes[] __devinitdata = { BMCR_ANENABLE, /* 0 : autoneg */ diff --git a/drivers/net/chelsio/cxgb2.c b/drivers/net/chelsio/cxgb2.c index 349ebe783ed6..7fe2638ae06d 100644 --- a/drivers/net/chelsio/cxgb2.c +++ b/drivers/net/chelsio/cxgb2.c @@ -124,7 +124,7 @@ MODULE_LICENSE("GPL"); static int dflt_msg_enable = DFLT_MSG_ENABLE; -MODULE_PARM(dflt_msg_enable, "i"); +module_param(dflt_msg_enable, int, 0); MODULE_PARM_DESC(dflt_msg_enable, "Chelsio T1 message enable bitmap"); diff --git a/drivers/net/dgrs.c b/drivers/net/dgrs.c index 32d13166c6e8..e175d4876682 100644 --- a/drivers/net/dgrs.c +++ b/drivers/net/dgrs.c @@ -1551,7 +1551,7 @@ MODULE_PARM_DESC(nicmode, "Digi RightSwitch operating mode (1: switch, 2: multi- static int __init dgrs_init_module (void) { int i; - int cardcount = 0; + int err; /* * Command line variable overrides @@ -1593,13 +1593,13 @@ static int __init dgrs_init_module (void) * Find and configure all the cards */ #ifdef CONFIG_EISA - cardcount = eisa_driver_register(&dgrs_eisa_driver); - if (cardcount < 0) - return cardcount; + err = eisa_driver_register(&dgrs_eisa_driver); + if (err) + return err; #endif - cardcount = pci_register_driver(&dgrs_pci_driver); - if (cardcount) - return cardcount; + err = pci_register_driver(&dgrs_pci_driver); + if (err) + return err; return 0; } diff --git a/drivers/net/fec_8xx/fec_main.c b/drivers/net/fec_8xx/fec_main.c index b4f3a9f8a535..7e4338097139 100644 --- a/drivers/net/fec_8xx/fec_main.c +++ b/drivers/net/fec_8xx/fec_main.c @@ -55,11 +55,11 @@ MODULE_AUTHOR("Pantelis Antoniou <panto@intracom.gr>"); MODULE_DESCRIPTION("Motorola 8xx FEC ethernet driver"); MODULE_LICENSE("GPL"); -MODULE_PARM(fec_8xx_debug, "i"); +int fec_8xx_debug = -1; /* -1 == use FEC_8XX_DEF_MSG_ENABLE as value */ +module_param(fec_8xx_debug, int, 0); MODULE_PARM_DESC(fec_8xx_debug, "FEC 8xx bitmapped debugging message enable value"); -int fec_8xx_debug = -1; /* -1 == use FEC_8XX_DEF_MSG_ENABLE as value */ /*************************************************/ diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c index f5d49a110654..196298f33db8 100644 --- a/drivers/net/fs_enet/fs_enet-main.c +++ b/drivers/net/fs_enet/fs_enet-main.c @@ -58,11 +58,11 @@ MODULE_DESCRIPTION("Freescale Ethernet Driver"); MODULE_LICENSE("GPL"); MODULE_VERSION(DRV_MODULE_VERSION); -MODULE_PARM(fs_enet_debug, "i"); +int fs_enet_debug = -1; /* -1 == use FS_ENET_DEF_MSG_ENABLE as value */ +module_param(fs_enet_debug, int, 0); MODULE_PARM_DESC(fs_enet_debug, "Freescale bitmapped debugging message enable value"); -int fs_enet_debug = -1; /* -1 == use FS_ENET_DEF_MSG_ENABLE as value */ static void fs_set_multicast_list(struct net_device *dev) { diff --git a/drivers/net/gt96100eth.c b/drivers/net/gt96100eth.c index 5958a6314723..2d2435404614 100644 --- a/drivers/net/gt96100eth.c +++ b/drivers/net/gt96100eth.c @@ -114,8 +114,8 @@ static int max_interrupt_work = 32; static char mac0[18] = "00.02.03.04.05.06"; static char mac1[18] = "00.01.02.03.04.05"; -MODULE_PARM(mac0, "c18"); -MODULE_PARM(mac1, "c18"); +module_param_string(mac0, mac0, 18, 0); +module_param_string(mac1, mac0, 18, 0); MODULE_PARM_DESC(mac0, "MAC address for GT96100 ethernet port 0"); MODULE_PARM_DESC(mac1, "MAC address for GT96100 ethernet port 1"); diff --git a/drivers/net/hamradio/dmascc.c b/drivers/net/hamradio/dmascc.c index c8dc40214a08..79a8fbcf5f93 100644 --- a/drivers/net/hamradio/dmascc.c +++ b/drivers/net/hamradio/dmascc.c @@ -280,7 +280,7 @@ static unsigned long rand; MODULE_AUTHOR("Klaus Kudielka"); MODULE_DESCRIPTION("Driver for high-speed SCC boards"); -MODULE_PARM(io, "1-" __MODULE_STRING(MAX_NUM_DEVS) "i"); +module_param_array(io, int, NULL, 0); MODULE_LICENSE("GPL"); static void __exit dmascc_exit(void) diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c index dc5e9d59deed..d81a8e1eeb8d 100644 --- a/drivers/net/hamradio/mkiss.c +++ b/drivers/net/hamradio/mkiss.c @@ -1012,7 +1012,7 @@ static void __exit mkiss_exit_driver(void) MODULE_AUTHOR("Ralf Baechle DL5RB <ralf@linux-mips.org>"); MODULE_DESCRIPTION("KISS driver for AX.25 over TTYs"); -MODULE_PARM(crc_force, "i"); +module_param(crc_force, int, 0); MODULE_PARM_DESC(crc_force, "crc [0 = auto | 1 = none | 2 = flexnet | 3 = smack]"); MODULE_LICENSE("GPL"); MODULE_ALIAS_LDISC(N_AX25); diff --git a/drivers/net/hplance.c b/drivers/net/hplance.c index d8410634bcaf..685693464605 100644 --- a/drivers/net/hplance.c +++ b/drivers/net/hplance.c @@ -217,7 +217,7 @@ static int hplance_close(struct net_device *dev) int __init hplance_init_module(void) { - return dio_module_init(&hplance_driver); + return dio_register_driver(&hplance_driver); } void __exit hplance_cleanup_module(void) diff --git a/drivers/net/hydra.c b/drivers/net/hydra.c index 6e0ca7340a8f..d9fb8e74e631 100644 --- a/drivers/net/hydra.c +++ b/drivers/net/hydra.c @@ -242,7 +242,7 @@ static void __devexit hydra_remove_one(struct zorro_dev *z) static int __init hydra_init_module(void) { - return zorro_module_init(&hydra_driver); + return zorro_register_driver(&hydra_driver); } static void __exit hydra_cleanup_module(void) diff --git a/drivers/net/irda/irport.c b/drivers/net/irda/irport.c index 6070195b87bd..98fa5319e5cc 100644 --- a/drivers/net/irda/irport.c +++ b/drivers/net/irda/irport.c @@ -1118,9 +1118,9 @@ static void __exit irport_cleanup(void) } } -MODULE_PARM(io, "1-4i"); +module_param_array(io, int, NULL, 0); MODULE_PARM_DESC(io, "Base I/O addresses"); -MODULE_PARM(irq, "1-4i"); +module_param_array(irq, int, NULL, 0); MODULE_PARM_DESC(irq, "IRQ lines"); MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>"); diff --git a/drivers/net/lasi_82596.c b/drivers/net/lasi_82596.c index f7b7238d8352..957888de3d7e 100644 --- a/drivers/net/lasi_82596.c +++ b/drivers/net/lasi_82596.c @@ -177,7 +177,7 @@ static int i596_debug = (DEB_SERIOUS|DEB_PROBE); MODULE_AUTHOR("Richard Hirst"); MODULE_DESCRIPTION("i82596 driver"); MODULE_LICENSE("GPL"); -MODULE_PARM(i596_debug, "i"); +module_param(i596_debug, int, 0); MODULE_PARM_DESC(i596_debug, "lasi_82596 debug mask"); /* Copy frames shorter than rx_copybreak, otherwise pass on up in @@ -1520,9 +1520,9 @@ static void set_multicast_list(struct net_device *dev) } } -MODULE_PARM(debug, "i"); -MODULE_PARM_DESC(debug, "lasi_82596 debug mask"); static int debug = -1; +module_param(debug, int, 0); +MODULE_PARM_DESC(debug, "lasi_82596 debug mask"); static int num_drivers; static struct net_device *netdevs[MAX_DRIVERS]; diff --git a/drivers/net/mac89x0.c b/drivers/net/mac89x0.c index f65b0db111b8..cd3c9a5a98b2 100644 --- a/drivers/net/mac89x0.c +++ b/drivers/net/mac89x0.c @@ -629,7 +629,7 @@ static int set_mac_address(struct net_device *dev, void *addr) static struct net_device *dev_cs89x0; static int debug; -MODULE_PARM(debug, "i"); +module_param(debug, int, 0); MODULE_PARM_DESC(debug, "CS89[02]0 debug level (0-5)"); MODULE_LICENSE("GPL"); diff --git a/drivers/net/mace.c b/drivers/net/mace.c index 2a5add257b8f..77792b286027 100644 --- a/drivers/net/mace.c +++ b/drivers/net/mace.c @@ -1042,7 +1042,7 @@ static void __exit mace_cleanup(void) MODULE_AUTHOR("Paul Mackerras"); MODULE_DESCRIPTION("PowerMac MACE driver."); -MODULE_PARM(port_aaui, "i"); +module_param(port_aaui, int, 0); MODULE_PARM_DESC(port_aaui, "MACE uses AAUI port (0-1)"); MODULE_LICENSE("GPL"); diff --git a/drivers/net/meth.c b/drivers/net/meth.c index e23655f5049f..d644bf3a933c 100644 --- a/drivers/net/meth.c +++ b/drivers/net/meth.c @@ -62,7 +62,7 @@ MODULE_DESCRIPTION("SGI O2 Builtin Fast Ethernet driver"); #ifdef HAVE_TX_TIMEOUT static int timeout = TX_TIMEOUT; -MODULE_PARM(timeout, "i"); +module_param(timeout, int, 0); #endif /* diff --git a/drivers/net/ne-h8300.c b/drivers/net/ne-h8300.c index aaebd28a1920..7ea3d596ac3b 100644 --- a/drivers/net/ne-h8300.c +++ b/drivers/net/ne-h8300.c @@ -601,9 +601,9 @@ static int io[MAX_NE_CARDS]; static int irq[MAX_NE_CARDS]; static int bad[MAX_NE_CARDS]; /* 0xbad = bad sig or no reset ack */ -MODULE_PARM(io, "1-" __MODULE_STRING(MAX_NE_CARDS) "i"); -MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_NE_CARDS) "i"); -MODULE_PARM(bad, "1-" __MODULE_STRING(MAX_NE_CARDS) "i"); +module_param_array(io, int, NULL, 0); +module_param_array(irq, int, NULL, 0); +module_param_array(bad, int, NULL, 0); MODULE_PARM_DESC(io, "I/O base address(es)"); MODULE_PARM_DESC(irq, "IRQ number(s)"); MODULE_DESCRIPTION("H8/300 NE2000 Ethernet driver"); diff --git a/drivers/net/ne2k-pci.c b/drivers/net/ne2k-pci.c index e3ebb5803b02..d11821dd86ed 100644 --- a/drivers/net/ne2k-pci.c +++ b/drivers/net/ne2k-pci.c @@ -117,7 +117,7 @@ enum ne2k_pci_chipsets { }; -static const struct { +static struct { char *name; int flags; } pci_clone_list[] __devinitdata = { diff --git a/drivers/net/ni5010.c b/drivers/net/ni5010.c index 2ab01a5d1d22..a68bf474f6ed 100644 --- a/drivers/net/ni5010.c +++ b/drivers/net/ni5010.c @@ -766,8 +766,8 @@ static void ni5010_show_registers(struct net_device *dev) #ifdef MODULE static struct net_device *dev_ni5010; -MODULE_PARM(io, "i"); -MODULE_PARM(irq, "i"); +module_param(io, int, 0); +module_param(irq, int, 0); MODULE_PARM_DESC(io, "ni5010 I/O base address"); MODULE_PARM_DESC(irq, "ni5010 IRQ number"); diff --git a/drivers/net/sun3lance.c b/drivers/net/sun3lance.c index 01bdb2334058..d4c0002b43db 100644 --- a/drivers/net/sun3lance.c +++ b/drivers/net/sun3lance.c @@ -71,7 +71,7 @@ static int lance_debug = LANCE_DEBUG; #else static int lance_debug = 1; #endif -MODULE_PARM(lance_debug, "i"); +module_param(lance_debug, int, 0); MODULE_PARM_DESC(lance_debug, "SUN3 Lance debug level (0-3)"); MODULE_LICENSE("GPL"); diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig index 6a1033ec06cf..fd17aa8491b6 100644 --- a/drivers/net/wireless/Kconfig +++ b/drivers/net/wireless/Kconfig @@ -27,6 +27,7 @@ config NET_RADIO config NET_WIRELESS_RTNETLINK bool "Wireless Extension API over RtNetlink" + depends on NET_RADIO ---help--- Support the Wireless Extension API over the RtNetlink socket in addition to the traditional ioctl interface (selected above). diff --git a/drivers/net/zorro8390.c b/drivers/net/zorro8390.c index 761021603597..8037e5806d0a 100644 --- a/drivers/net/zorro8390.c +++ b/drivers/net/zorro8390.c @@ -426,7 +426,7 @@ static void __devexit zorro8390_remove_one(struct zorro_dev *z) static int __init zorro8390_init_module(void) { - return zorro_module_init(&zorro8390_driver); + return zorro_register_driver(&zorro8390_driver); } static void __exit zorro8390_cleanup_module(void) diff --git a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c index 57fd60314d59..b1b4b683cbdd 100644 --- a/drivers/pnp/isapnp/core.c +++ b/drivers/pnp/isapnp/core.c @@ -646,8 +646,10 @@ static int __init isapnp_create_device(struct pnp_card *card, size = 0; skip = 0; option = pnp_register_independent_option(dev); - if (!option) + if (!option) { + kfree(dev); return 1; + } pnp_add_card_device(card,dev); } else { skip = 1; diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index 0eab05a37e65..0a9f12c4e911 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c @@ -43,7 +43,6 @@ MODULE_AUTHOR("Holger Smolinski <Holger.Smolinski@de.ibm.com>"); MODULE_DESCRIPTION("Linux on S/390 DASD device driver," " Copyright 2000 IBM Corporation"); MODULE_SUPPORTED_DEVICE("dasd"); -MODULE_PARM(dasd, "1-" __MODULE_STRING(256) "s"); MODULE_LICENSE("GPL"); /* diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c index f576f243cd93..2f720108a7e0 100644 --- a/drivers/s390/block/dasd_devmap.c +++ b/drivers/s390/block/dasd_devmap.c @@ -16,6 +16,7 @@ #include <linux/config.h> #include <linux/ctype.h> #include <linux/init.h> +#include <linux/module.h> #include <asm/debug.h> #include <asm/uaccess.h> @@ -69,6 +70,8 @@ int dasd_autodetect = 0; /* is true, when autodetection is active */ * strings when running as a module. */ static char *dasd[256]; +module_param_array(dasd, charp, NULL, 0); + /* * Single spinlock to protect devmap structures and lists. */ diff --git a/drivers/scsi/arm/cumana_2.c b/drivers/scsi/arm/cumana_2.c index 583d2d8c8335..fad2109268bb 100644 --- a/drivers/scsi/arm/cumana_2.c +++ b/drivers/scsi/arm/cumana_2.c @@ -550,6 +550,6 @@ module_exit(cumanascsi2_exit); MODULE_AUTHOR("Russell King"); MODULE_DESCRIPTION("Cumana SCSI-2 driver for Acorn machines"); -MODULE_PARM(term, "1-8i"); +module_param_array(term, int, NULL, 0); MODULE_PARM_DESC(term, "SCSI bus termination"); MODULE_LICENSE("GPL"); diff --git a/drivers/scsi/arm/eesox.c b/drivers/scsi/arm/eesox.c index 3ffec7efc9d5..dcbb4b2b3fe0 100644 --- a/drivers/scsi/arm/eesox.c +++ b/drivers/scsi/arm/eesox.c @@ -674,6 +674,6 @@ module_exit(eesox_exit); MODULE_AUTHOR("Russell King"); MODULE_DESCRIPTION("EESOX 'Fast' SCSI driver for Acorn machines"); -MODULE_PARM(term, "1-8i"); +module_param_array(term, int, NULL, 0); MODULE_PARM_DESC(term, "SCSI bus termination"); MODULE_LICENSE("GPL"); diff --git a/drivers/scsi/arm/powertec.c b/drivers/scsi/arm/powertec.c index 3113bdcedb13..3d69f6c45a6b 100644 --- a/drivers/scsi/arm/powertec.c +++ b/drivers/scsi/arm/powertec.c @@ -466,6 +466,6 @@ module_exit(powertecscsi_exit); MODULE_AUTHOR("Russell King"); MODULE_DESCRIPTION("Powertec SCSI driver"); -MODULE_PARM(term, "1-8i"); +module_param_array(term, int, NULL, 0); MODULE_PARM_DESC(term, "SCSI bus termination"); MODULE_LICENSE("GPL"); diff --git a/drivers/scsi/atari_scsi.c b/drivers/scsi/atari_scsi.c index f4c1ca7c1572..f677c5a32a68 100644 --- a/drivers/scsi/atari_scsi.c +++ b/drivers/scsi/atari_scsi.c @@ -239,17 +239,17 @@ static int atari_read_overruns = 0; #endif static int setup_can_queue = -1; -MODULE_PARM(setup_can_queue, "i"); +module_param(setup_can_queue, int, 0); static int setup_cmd_per_lun = -1; -MODULE_PARM(setup_cmd_per_lun, "i"); +module_param(setup_cmd_per_lun, int, 0); static int setup_sg_tablesize = -1; -MODULE_PARM(setup_sg_tablesize, "i"); +module_param(setup_sg_tablesize, int, 0); #ifdef SUPPORT_TAGS static int setup_use_tagged_queuing = -1; -MODULE_PARM(setup_use_tagged_queuing, "i"); +module_param(setup_use_tagged_queuing, int, 0); #endif static int setup_hostid = -1; -MODULE_PARM(setup_hostid, "i"); +module_param(setup_hostid, int, 0); #if defined(CONFIG_TT_DMA_EMUL) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 024ef86c5242..c647d85d97d1 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -190,7 +190,7 @@ static ssize_t sd_store_cache_type(struct class_device *cdev, const char *buf, if (scsi_mode_sense(sdp, 0x08, 8, buffer, sizeof(buffer), SD_TIMEOUT, SD_MAX_RETRIES, &data, NULL)) return -EINVAL; - len = min(sizeof(buffer), data.length - data.header_length - + len = min_t(size_t, sizeof(buffer), data.length - data.header_length - data.block_descriptor_length); buffer_data = buffer + data.header_length + data.block_descriptor_length; diff --git a/drivers/serial/8250_hp300.c b/drivers/serial/8250_hp300.c index 4315afe9c080..53e81a44c1a3 100644 --- a/drivers/serial/8250_hp300.c +++ b/drivers/serial/8250_hp300.c @@ -55,6 +55,8 @@ static struct dio_driver hpdca_driver = { #endif +static unsigned int num_ports; + extern int hp300_uart_scode; /* Offset to UART registers from base of DCA */ @@ -199,6 +201,8 @@ static int __devinit hpdca_init_one(struct dio_dev *d, out_8(d->resource.start + DIO_VIRADDRBASE + DCA_ID, 0xff); udelay(100); + num_ports++; + return 0; } #endif @@ -206,7 +210,6 @@ static int __devinit hpdca_init_one(struct dio_dev *d, static int __init hp300_8250_init(void) { static int called = 0; - int num_ports; #ifdef CONFIG_HPAPCI int line; unsigned long base; @@ -221,11 +224,8 @@ static int __init hp300_8250_init(void) if (!MACH_IS_HP300) return -ENODEV; - num_ports = 0; - #ifdef CONFIG_HPDCA - if (dio_module_init(&hpdca_driver) == 0) - num_ports++; + dio_register_driver(&hpdca_driver); #endif #ifdef CONFIG_HPAPCI if (hp300_model < HP_400) { diff --git a/drivers/serial/ioc4_serial.c b/drivers/serial/ioc4_serial.c index a37579ce6d76..c620209d7b9a 100644 --- a/drivers/serial/ioc4_serial.c +++ b/drivers/serial/ioc4_serial.c @@ -3,7 +3,7 @@ * License. See the file "COPYING" in the main directory of this archive * for more details. * - * Copyright (C) 2003-2005 Silicon Graphics, Inc. All Rights Reserved. + * Copyright (C) 2003-2006 Silicon Graphics, Inc. All Rights Reserved. */ @@ -323,9 +323,12 @@ static unsigned int Num_of_ioc4_cards; #define IOC4_FIFO_CHARS 255 /* Device name we're using */ -#define DEVICE_NAME "ttyIOC" -#define DEVICE_MAJOR 204 -#define DEVICE_MINOR 50 +#define DEVICE_NAME_RS232 "ttyIOC" +#define DEVICE_NAME_RS422 "ttyAIOC" +#define DEVICE_MAJOR 204 +#define DEVICE_MINOR_RS232 50 +#define DEVICE_MINOR_RS422 84 + /* register offsets */ #define IOC4_SERIAL_OFFSET 0x300 @@ -341,10 +344,8 @@ static unsigned int Num_of_ioc4_cards; #define MAX_BAUD_SUPPORTED 115200 /* protocol types supported */ -enum sio_proto { - PROTO_RS232, - PROTO_RS422 -}; +#define PROTO_RS232 3 +#define PROTO_RS422 7 /* Notification types */ #define N_DATA_READY 0x01 @@ -395,11 +396,17 @@ enum sio_proto { /* * This is the entry saved by the driver - one per card */ + +#define UART_PORT_MIN 0 +#define UART_PORT_RS232 UART_PORT_MIN +#define UART_PORT_RS422 1 +#define UART_PORT_COUNT 2 /* one for each mode */ + struct ioc4_control { int ic_irq; struct { - /* uart ports are allocated here */ - struct uart_port icp_uart_port; + /* uart ports are allocated here - 1 for rs232, 1 for rs422 */ + struct uart_port icp_uart_port[UART_PORT_COUNT]; /* Handy reference material */ struct ioc4_port *icp_port; } ic_port[IOC4_NUM_SERIAL_PORTS]; @@ -443,7 +450,9 @@ struct ioc4_soft { /* Local port info for each IOC4 serial ports */ struct ioc4_port { - struct uart_port *ip_port; + struct uart_port *ip_port; /* current active port ptr */ + /* Ptrs for all ports */ + struct uart_port *ip_all_ports[UART_PORT_COUNT]; /* Back ptrs for this port */ struct ioc4_control *ip_control; struct pci_dev *ip_pdev; @@ -502,6 +511,9 @@ struct ioc4_port { #define DCD_ON 0x02 #define LOWAT_WRITTEN 0x04 #define READ_ABORTED 0x08 +#define PORT_ACTIVE 0x10 +#define PORT_INACTIVE 0 /* This is the value when "off" */ + /* Since each port has different register offsets and bitmasks * for everything, we'll store those that we need in tables so we @@ -623,6 +635,23 @@ struct ring_buffer { static void receive_chars(struct uart_port *); static void handle_intr(void *arg, uint32_t sio_ir); +/* + * port_is_active - determines if this port is currently active + * @port: ptr to soft struct for this port + * @uart_port: uart port to test for + */ +static inline int port_is_active(struct ioc4_port *port, + struct uart_port *uart_port) +{ + if (port) { + if ((port->ip_flags & PORT_ACTIVE) + && (port->ip_port == uart_port)) + return 1; + } + return 0; +} + + /** * write_ireg - write the interrupt regs * @ioc4_soft: ptr to soft struct for this port @@ -708,19 +737,33 @@ static int set_baud(struct ioc4_port *port, int baud) /** * get_ioc4_port - given a uart port, return the control structure * @port: uart port + * @set: set this port as current */ -static struct ioc4_port *get_ioc4_port(struct uart_port *the_port) +static struct ioc4_port *get_ioc4_port(struct uart_port *the_port, int set) { struct ioc4_driver_data *idd = dev_get_drvdata(the_port->dev); struct ioc4_control *control = idd->idd_serial_data; - int ii; + struct ioc4_port *port; + int port_num, port_type; if (control) { - for ( ii = 0; ii < IOC4_NUM_SERIAL_PORTS; ii++ ) { - if (!control->ic_port[ii].icp_port) + for ( port_num = 0; port_num < IOC4_NUM_SERIAL_PORTS; + port_num++ ) { + port = control->ic_port[port_num].icp_port; + if (!port) continue; - if (the_port == control->ic_port[ii].icp_port->ip_port) - return control->ic_port[ii].icp_port; + for (port_type = UART_PORT_MIN; + port_type < UART_PORT_COUNT; + port_type++) { + if (the_port == port->ip_all_ports + [port_type]) { + /* set local copy */ + if (set) { + port->ip_port = the_port; + } + return port; + } + } } } return NULL; @@ -946,6 +989,7 @@ intr_connect(struct ioc4_soft *soft, int type, * @arg: handler arg * @regs: registers */ + static irqreturn_t ioc4_intr(int irq, void *arg, struct pt_regs *regs) { struct ioc4_soft *soft; @@ -953,7 +997,7 @@ static irqreturn_t ioc4_intr(int irq, void *arg, struct pt_regs *regs) int xx, num_intrs = 0; int intr_type; int handled = 0; - struct ioc4_intr_info *ii; + struct ioc4_intr_info *intr_info; soft = arg; for (intr_type = 0; intr_type < IOC4_NUM_INTR_TYPES; intr_type++) { @@ -966,13 +1010,13 @@ static irqreturn_t ioc4_intr(int irq, void *arg, struct pt_regs *regs) * which interrupt bits are set. */ for (xx = 0; xx < num_intrs; xx++) { - ii = &soft->is_intr_type[intr_type].is_intr_info[xx]; - if ((this_mir = this_ir & ii->sd_bits)) { + intr_info = &soft->is_intr_type[intr_type].is_intr_info[xx]; + if ((this_mir = this_ir & intr_info->sd_bits)) { /* Disable owned interrupts, call handler */ handled++; - write_ireg(soft, ii->sd_bits, IOC4_W_IEC, + write_ireg(soft, intr_info->sd_bits, IOC4_W_IEC, intr_type); - ii->sd_intr(ii->sd_info, this_mir); + intr_info->sd_intr(intr_info->sd_info, this_mir); this_ir &= ~this_mir; } } @@ -980,7 +1024,6 @@ static irqreturn_t ioc4_intr(int irq, void *arg, struct pt_regs *regs) #ifdef DEBUG_INTERRUPTS { struct ioc4_misc_regs __iomem *mem = soft->is_ioc4_misc_addr; - spinlock_t *lp = &soft->is_ir_lock; unsigned long flag; spin_lock_irqsave(&soft->is_ir_lock, flag); @@ -1177,7 +1220,7 @@ static inline int local_open(struct ioc4_port *port) { int spiniter = 0; - port->ip_flags = 0; + port->ip_flags = PORT_ACTIVE; /* Pause the DMA interface if necessary */ if (port->ip_sscr & IOC4_SSCR_DMA_EN) { @@ -1187,6 +1230,7 @@ static inline int local_open(struct ioc4_port *port) & IOC4_SSCR_PAUSE_STATE) == 0) { spiniter++; if (spiniter > MAXITER) { + port->ip_flags = PORT_INACTIVE; return -1; } } @@ -1506,14 +1550,13 @@ static int set_notification(struct ioc4_port *port, int mask, int set_on) /** * set_mcr - set the master control reg * @the_port: port to use - * @set: set ? * @mask1: mcr mask * @mask2: shadow mask */ -static inline int set_mcr(struct uart_port *the_port, int set, +static inline int set_mcr(struct uart_port *the_port, int mask1, int mask2) { - struct ioc4_port *port = get_ioc4_port(the_port); + struct ioc4_port *port = get_ioc4_port(the_port, 0); uint32_t shadow; int spiniter = 0; char mcr; @@ -1536,13 +1579,9 @@ static inline int set_mcr(struct uart_port *the_port, int set, mcr = (shadow & 0xff000000) >> 24; /* Set new value */ - if (set) { - mcr |= mask1; - shadow |= mask2; - } else { - mcr &= ~mask1; - shadow &= ~mask2; - } + mcr |= mask1; + shadow |= mask2; + writeb(mcr, &port->ip_uart_regs->i4u_mcr); writel(shadow, &port->ip_serial_regs->shadow); @@ -1558,7 +1597,7 @@ static inline int set_mcr(struct uart_port *the_port, int set, * @port: port to use * @proto: protocol to use */ -static int ioc4_set_proto(struct ioc4_port *port, enum sio_proto proto) +static int ioc4_set_proto(struct ioc4_port *port, int proto) { struct hooks *hooks = port->ip_hooks; @@ -1589,7 +1628,7 @@ static void transmit_chars(struct uart_port *the_port) int result; char *start; struct tty_struct *tty; - struct ioc4_port *port = get_ioc4_port(the_port); + struct ioc4_port *port = get_ioc4_port(the_port, 0); struct uart_info *info; if (!the_port) @@ -1645,7 +1684,7 @@ static void ioc4_change_speed(struct uart_port *the_port, struct termios *new_termios, struct termios *old_termios) { - struct ioc4_port *port = get_ioc4_port(the_port); + struct ioc4_port *port = get_ioc4_port(the_port, 0); int baud, bits; unsigned cflag; int new_parity = 0, new_parity_enable = 0, new_stop = 0, new_data = 8; @@ -1752,7 +1791,7 @@ static inline int ic4_startup_local(struct uart_port *the_port) if (!the_port) return -1; - port = get_ioc4_port(the_port); + port = get_ioc4_port(the_port, 0); if (!port) return -1; @@ -1760,6 +1799,9 @@ static inline int ic4_startup_local(struct uart_port *the_port) local_open(port); + /* set the protocol - mapbase has the port type */ + ioc4_set_proto(port, the_port->mapbase); + /* set the speed of the serial port */ ioc4_change_speed(the_port, info->tty->termios, (struct termios *)0); @@ -1768,17 +1810,17 @@ static inline int ic4_startup_local(struct uart_port *the_port) /* * ioc4_cb_output_lowat - called when the output low water mark is hit - * @port: port to output + * @the_port: port to output */ -static void ioc4_cb_output_lowat(struct ioc4_port *port) +static void ioc4_cb_output_lowat(struct uart_port *the_port) { unsigned long pflags; /* ip_lock is set on the call here */ - if (port->ip_port) { - spin_lock_irqsave(&port->ip_port->lock, pflags); - transmit_chars(port->ip_port); - spin_unlock_irqrestore(&port->ip_port->lock, pflags); + if (the_port) { + spin_lock_irqsave(&the_port->lock, pflags); + transmit_chars(the_port); + spin_unlock_irqrestore(&the_port->lock, pflags); } } @@ -1923,7 +1965,7 @@ static void handle_intr(void *arg, uint32_t sio_ir) &port->ip_mem->sio_ir.raw); if (port->ip_notify & N_OUTPUT_LOWAT) - ioc4_cb_output_lowat(port); + ioc4_cb_output_lowat(port->ip_port); } /* Handle tx_mt. Must come after tx_explicit. */ @@ -1936,7 +1978,7 @@ static void handle_intr(void *arg, uint32_t sio_ir) * So send the notification now. */ if (port->ip_notify & N_OUTPUT_LOWAT) { - ioc4_cb_output_lowat(port); + ioc4_cb_output_lowat(port->ip_port); /* We need to reload the sio_ir since the lowat * call may have caused another write to occur, @@ -2023,7 +2065,7 @@ static inline int do_read(struct uart_port *the_port, unsigned char *buf, int len) { int prod_ptr, cons_ptr, total; - struct ioc4_port *port = get_ioc4_port(the_port); + struct ioc4_port *port = get_ioc4_port(the_port, 0); struct ring *inring; struct ring_entry *entry; struct hooks *hooks = port->ip_hooks; @@ -2335,17 +2377,27 @@ static void receive_chars(struct uart_port *the_port) */ static const char *ic4_type(struct uart_port *the_port) { - return "SGI IOC4 Serial"; + if (the_port->mapbase == PROTO_RS232) + return "SGI IOC4 Serial [rs232]"; + else + return "SGI IOC4 Serial [rs422]"; } /** - * ic4_tx_empty - Is the transmitter empty? We pretend we're always empty - * @port: Port to operate on (we ignore since we always return 1) + * ic4_tx_empty - Is the transmitter empty? + * @port: Port to operate on * */ static unsigned int ic4_tx_empty(struct uart_port *the_port) { - return 1; + struct ioc4_port *port = get_ioc4_port(the_port, 0); + unsigned int ret = 0; + + if (port_is_active(port, the_port)) { + if (readl(&port->ip_serial_regs->shadow) & IOC4_SHADOW_TEMT) + ret = TIOCSER_TEMT; + } + return ret; } /** @@ -2355,6 +2407,10 @@ static unsigned int ic4_tx_empty(struct uart_port *the_port) */ static void ic4_stop_tx(struct uart_port *the_port) { + struct ioc4_port *port = get_ioc4_port(the_port, 0); + + if (port_is_active(port, the_port)) + set_notification(port, N_OUTPUT_LOWAT, 0); } /** @@ -2377,11 +2433,12 @@ static void ic4_shutdown(struct uart_port *the_port) struct ioc4_port *port; struct uart_info *info; - port = get_ioc4_port(the_port); + port = get_ioc4_port(the_port, 0); if (!port) return; info = the_port->info; + port->ip_port = NULL; wake_up_interruptible(&info->delta_msr_wait); @@ -2390,6 +2447,7 @@ static void ic4_shutdown(struct uart_port *the_port) spin_lock_irqsave(&the_port->lock, port_flags); set_notification(port, N_ALL, 0); + port->ip_flags = PORT_INACTIVE; spin_unlock_irqrestore(&the_port->lock, port_flags); } @@ -2402,6 +2460,11 @@ static void ic4_shutdown(struct uart_port *the_port) static void ic4_set_mctrl(struct uart_port *the_port, unsigned int mctrl) { unsigned char mcr = 0; + struct ioc4_port *port; + + port = get_ioc4_port(the_port, 0); + if (!port_is_active(port, the_port)) + return; if (mctrl & TIOCM_RTS) mcr |= UART_MCR_RTS; @@ -2414,7 +2477,7 @@ static void ic4_set_mctrl(struct uart_port *the_port, unsigned int mctrl) if (mctrl & TIOCM_LOOP) mcr |= UART_MCR_LOOP; - set_mcr(the_port, 1, mcr, IOC4_SHADOW_DTR); + set_mcr(the_port, mcr, IOC4_SHADOW_DTR); } /** @@ -2424,11 +2487,11 @@ static void ic4_set_mctrl(struct uart_port *the_port, unsigned int mctrl) */ static unsigned int ic4_get_mctrl(struct uart_port *the_port) { - struct ioc4_port *port = get_ioc4_port(the_port); + struct ioc4_port *port = get_ioc4_port(the_port, 0); uint32_t shadow; unsigned int ret = 0; - if (!port) + if (!port_is_active(port, the_port)) return 0; shadow = readl(&port->ip_serial_regs->shadow); @@ -2448,9 +2511,9 @@ static unsigned int ic4_get_mctrl(struct uart_port *the_port) */ static void ic4_start_tx(struct uart_port *the_port) { - struct ioc4_port *port = get_ioc4_port(the_port); + struct ioc4_port *port = get_ioc4_port(the_port, 0); - if (port) { + if (port_is_active(port, the_port)) { set_notification(port, N_OUTPUT_LOWAT, 1); enable_intrs(port, port->ip_hooks->intr_tx_mt); } @@ -2467,7 +2530,7 @@ static void ic4_break_ctl(struct uart_port *the_port, int break_state) } /** - * ic4_startup - Start up the serial port - always return 0 (We're always on) + * ic4_startup - Start up the serial port * @port: Port to operate on * */ @@ -2479,17 +2542,16 @@ static int ic4_startup(struct uart_port *the_port) struct uart_info *info; unsigned long port_flags; - if (!the_port) { + if (!the_port) return -ENODEV; - } - port = get_ioc4_port(the_port); - if (!port) { + port = get_ioc4_port(the_port, 1); + if (!port) return -ENODEV; - } info = the_port->info; control = port->ip_control; if (!control) { + port->ip_port = NULL; return -ENODEV; } @@ -2551,28 +2613,104 @@ static struct uart_ops ioc4_ops = { * Boot-time initialization code */ -static struct uart_driver ioc4_uart = { +static struct uart_driver ioc4_uart_rs232 = { .owner = THIS_MODULE, - .driver_name = "ioc4_serial", - .dev_name = DEVICE_NAME, + .driver_name = "ioc4_serial_rs232", + .dev_name = DEVICE_NAME_RS232, .major = DEVICE_MAJOR, - .minor = DEVICE_MINOR, + .minor = DEVICE_MINOR_RS232, .nr = IOC4_NUM_CARDS * IOC4_NUM_SERIAL_PORTS, }; +static struct uart_driver ioc4_uart_rs422 = { + .owner = THIS_MODULE, + .driver_name = "ioc4_serial_rs422", + .dev_name = DEVICE_NAME_RS422, + .major = DEVICE_MAJOR, + .minor = DEVICE_MINOR_RS422, + .nr = IOC4_NUM_CARDS * IOC4_NUM_SERIAL_PORTS, +}; + + /** - * ioc4_serial_core_attach - register with serial core + * ioc4_serial_remove_one - detach function + * + * @idd: IOC4 master module data for this IOC4 + */ + +static int ioc4_serial_remove_one(struct ioc4_driver_data *idd) +{ + int port_num, port_type; + struct ioc4_control *control; + struct uart_port *the_port; + struct ioc4_port *port; + struct ioc4_soft *soft; + + control = idd->idd_serial_data; + + for (port_num = 0; port_num < IOC4_NUM_SERIAL_PORTS; port_num++) { + for (port_type = UART_PORT_MIN; + port_type < UART_PORT_COUNT; + port_type++) { + the_port = &control->ic_port[port_num].icp_uart_port + [port_type]; + if (the_port) { + switch (port_type) { + case UART_PORT_RS422: + uart_remove_one_port(&ioc4_uart_rs422, + the_port); + break; + default: + case UART_PORT_RS232: + uart_remove_one_port(&ioc4_uart_rs232, + the_port); + break; + } + } + } + port = control->ic_port[port_num].icp_port; + /* we allocate in pairs */ + if (!(port_num & 1) && port) { + pci_free_consistent(port->ip_pdev, + TOTAL_RING_BUF_SIZE, + port->ip_cpu_ringbuf, + port->ip_dma_ringbuf); + kfree(port); + } + } + soft = control->ic_soft; + if (soft) { + free_irq(control->ic_irq, soft); + if (soft->is_ioc4_serial_addr) { + release_region((unsigned long) + soft->is_ioc4_serial_addr, + sizeof(struct ioc4_serial)); + } + kfree(soft); + } + kfree(control); + idd->idd_serial_data = NULL; + + return 0; +} + + +/** + * ioc4_serial_core_attach_rs232 - register with serial core * This is done during pci probing * @pdev: handle for this card */ static inline int -ioc4_serial_core_attach(struct pci_dev *pdev) +ioc4_serial_core_attach(struct pci_dev *pdev, int port_type) { struct ioc4_port *port; struct uart_port *the_port; struct ioc4_driver_data *idd = pci_get_drvdata(pdev); struct ioc4_control *control = idd->idd_serial_data; - int ii; + int port_num; + int port_type_idx; + struct uart_driver *u_driver; + DPRINT_CONFIG(("%s: attach pdev 0x%p - control 0x%p\n", __FUNCTION__, pdev, (void *)control)); @@ -2580,28 +2718,36 @@ ioc4_serial_core_attach(struct pci_dev *pdev) if (!control) return -ENODEV; + port_type_idx = (port_type == PROTO_RS232) ? UART_PORT_RS232 + : UART_PORT_RS422; + + u_driver = (port_type == PROTO_RS232) ? &ioc4_uart_rs232 + : &ioc4_uart_rs422; + /* once around for each port on this card */ - for (ii = 0; ii < IOC4_NUM_SERIAL_PORTS; ii++) { - the_port = &control->ic_port[ii].icp_uart_port; - port = control->ic_port[ii].icp_port; - port->ip_port = the_port; + for (port_num = 0; port_num < IOC4_NUM_SERIAL_PORTS; port_num++) { + the_port = &control->ic_port[port_num].icp_uart_port + [port_type_idx]; + port = control->ic_port[port_num].icp_port; + port->ip_all_ports[port_type_idx] = the_port; - DPRINT_CONFIG(("%s: attach the_port 0x%p / port 0x%p\n", + DPRINT_CONFIG(("%s: attach the_port 0x%p / port 0x%p : type %s\n", __FUNCTION__, (void *)the_port, - (void *)port)); + (void *)port, + port_type == PROTO_RS232 ? "rs232" : "rs422")); /* membase, iobase and mapbase just need to be non-0 */ the_port->membase = (unsigned char __iomem *)1; - the_port->iobase = (pdev->bus->number << 16) | ii; - the_port->line = (Num_of_ioc4_cards << 2) | ii; - the_port->mapbase = 1; + the_port->iobase = (pdev->bus->number << 16) | port_num; + the_port->line = (Num_of_ioc4_cards << 2) | port_num; + the_port->mapbase = port_type; the_port->type = PORT_16550A; the_port->fifosize = IOC4_FIFO_CHARS; the_port->ops = &ioc4_ops; the_port->irq = control->ic_irq; the_port->dev = &pdev->dev; spin_lock_init(&the_port->lock); - if (uart_add_one_port(&ioc4_uart, the_port) < 0) { + if (uart_add_one_port(u_driver, the_port) < 0) { printk(KERN_WARNING "%s: unable to add port %d bus %d\n", __FUNCTION__, the_port->line, pdev->bus->number); @@ -2610,8 +2756,6 @@ ioc4_serial_core_attach(struct pci_dev *pdev) ("IOC4 serial port %d irq = %d, bus %d\n", the_port->line, the_port->irq, pdev->bus->number)); } - /* all ports are rs232 for now */ - ioc4_set_proto(port, PROTO_RS232); } return 0; } @@ -2631,7 +2775,8 @@ ioc4_serial_attach_one(struct ioc4_driver_data *idd) int ret = 0; - DPRINT_CONFIG(("%s (0x%p, 0x%p)\n", __FUNCTION__, idd->idd_pdev, idd->idd_pci_id)); + DPRINT_CONFIG(("%s (0x%p, 0x%p)\n", __FUNCTION__, idd->idd_pdev, + idd->idd_pci_id)); /* request serial registers */ tmp_addr1 = idd->idd_bar0 + IOC4_SERIAL_OFFSET; @@ -2653,11 +2798,11 @@ ioc4_serial_attach_one(struct ioc4_driver_data *idd) goto out2; } DPRINT_CONFIG(("%s : mem 0x%p, serial 0x%p\n", - __FUNCTION__, (void *)idd->idd_misc_regs, (void *)serial)); + __FUNCTION__, (void *)idd->idd_misc_regs, + (void *)serial)); /* Get memory for the new card */ - control = kmalloc(sizeof(struct ioc4_control) * IOC4_NUM_SERIAL_PORTS, - GFP_KERNEL); + control = kmalloc(sizeof(struct ioc4_control), GFP_KERNEL); if (!control) { printk(KERN_WARNING "ioc4_attach_one" @@ -2702,7 +2847,7 @@ ioc4_serial_attach_one(struct ioc4_driver_data *idd) /* Hook up interrupt handler */ if (!request_irq(idd->idd_pdev->irq, ioc4_intr, SA_SHIRQ, - "sgi-ioc4serial", (void *)soft)) { + "sgi-ioc4serial", soft)) { control->ic_irq = idd->idd_pdev->irq; } else { printk(KERN_WARNING @@ -2713,16 +2858,21 @@ ioc4_serial_attach_one(struct ioc4_driver_data *idd) if (ret) goto out4; - /* register port with the serial core */ + /* register port with the serial core - 1 rs232, 1 rs422 */ - if ((ret = ioc4_serial_core_attach(idd->idd_pdev))) + if ((ret = ioc4_serial_core_attach(idd->idd_pdev, PROTO_RS232))) goto out4; + if ((ret = ioc4_serial_core_attach(idd->idd_pdev, PROTO_RS422))) + goto out5; + Num_of_ioc4_cards++; return ret; /* error exits that give back resources */ +out5: + ioc4_serial_remove_one(idd); out4: kfree(soft); out3: @@ -2735,52 +2885,6 @@ out1: } -/** - * ioc4_serial_remove_one - detach function - * - * @idd: IOC4 master module data for this IOC4 - */ - -int ioc4_serial_remove_one(struct ioc4_driver_data *idd) -{ - int ii; - struct ioc4_control *control; - struct uart_port *the_port; - struct ioc4_port *port; - struct ioc4_soft *soft; - - control = idd->idd_serial_data; - - for (ii = 0; ii < IOC4_NUM_SERIAL_PORTS; ii++) { - the_port = &control->ic_port[ii].icp_uart_port; - if (the_port) { - uart_remove_one_port(&ioc4_uart, the_port); - } - port = control->ic_port[ii].icp_port; - if (!(ii & 1) && port) { - pci_free_consistent(port->ip_pdev, - TOTAL_RING_BUF_SIZE, - (void *)port->ip_cpu_ringbuf, - port->ip_dma_ringbuf); - kfree(port); - } - } - soft = control->ic_soft; - if (soft) { - free_irq(control->ic_irq, (void *)soft); - if (soft->is_ioc4_serial_addr) { - release_region((unsigned long) - soft->is_ioc4_serial_addr, - sizeof(struct ioc4_serial)); - } - kfree(soft); - } - kfree(control); - idd->idd_serial_data = NULL; - - return 0; -} - static struct ioc4_submodule ioc4_serial_submodule = { .is_name = "IOC4_serial", .is_owner = THIS_MODULE, @@ -2796,9 +2900,15 @@ int ioc4_serial_init(void) int ret; /* register with serial core */ - if ((ret = uart_register_driver(&ioc4_uart)) < 0) { + if ((ret = uart_register_driver(&ioc4_uart_rs232)) < 0) { + printk(KERN_WARNING + "%s: Couldn't register rs232 IOC4 serial driver\n", + __FUNCTION__); + return ret; + } + if ((ret = uart_register_driver(&ioc4_uart_rs422)) < 0) { printk(KERN_WARNING - "%s: Couldn't register IOC4 serial driver\n", + "%s: Couldn't register rs422 IOC4 serial driver\n", __FUNCTION__); return ret; } @@ -2810,7 +2920,8 @@ int ioc4_serial_init(void) static void __devexit ioc4_serial_exit(void) { ioc4_unregister_submodule(&ioc4_serial_submodule); - uart_unregister_driver(&ioc4_uart); + uart_unregister_driver(&ioc4_uart_rs232); + uart_unregister_driver(&ioc4_uart_rs422); } module_init(ioc4_serial_init); diff --git a/drivers/serial/mpsc.c b/drivers/serial/mpsc.c index 0ca83ac31d07..94681922ea0a 100644 --- a/drivers/serial/mpsc.c +++ b/drivers/serial/mpsc.c @@ -1,6 +1,4 @@ /* - * drivers/serial/mpsc.c - * * Generic driver for the MPSC (UART mode) on Marvell parts (e.g., GT64240, * GT64260, MV64340, MV64360, GT96100, ... ). * @@ -52,9 +50,263 @@ * 4) AFAICT, hardware flow control isn't supported by the controller --MAG. */ +#include <linux/config.h> + +#if defined(CONFIG_SERIAL_MPSC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) +#define SUPPORT_SYSRQ +#endif + +#include <linux/module.h> +#include <linux/moduleparam.h> +#include <linux/tty.h> +#include <linux/tty_flip.h> +#include <linux/ioport.h> +#include <linux/init.h> +#include <linux/console.h> +#include <linux/sysrq.h> +#include <linux/serial.h> +#include <linux/serial_core.h> +#include <linux/delay.h> +#include <linux/device.h> +#include <linux/dma-mapping.h> +#include <linux/mv643xx.h> #include <linux/platform_device.h> -#include "mpsc.h" +#include <asm/io.h> +#include <asm/irq.h> + +#if defined(CONFIG_SERIAL_MPSC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) +#define SUPPORT_SYSRQ +#endif + +#define MPSC_NUM_CTLRS 2 + +/* + * Descriptors and buffers must be cache line aligned. + * Buffers lengths must be multiple of cache line size. + * Number of Tx & Rx descriptors must be powers of 2. + */ +#define MPSC_RXR_ENTRIES 32 +#define MPSC_RXRE_SIZE dma_get_cache_alignment() +#define MPSC_RXR_SIZE (MPSC_RXR_ENTRIES * MPSC_RXRE_SIZE) +#define MPSC_RXBE_SIZE dma_get_cache_alignment() +#define MPSC_RXB_SIZE (MPSC_RXR_ENTRIES * MPSC_RXBE_SIZE) + +#define MPSC_TXR_ENTRIES 32 +#define MPSC_TXRE_SIZE dma_get_cache_alignment() +#define MPSC_TXR_SIZE (MPSC_TXR_ENTRIES * MPSC_TXRE_SIZE) +#define MPSC_TXBE_SIZE dma_get_cache_alignment() +#define MPSC_TXB_SIZE (MPSC_TXR_ENTRIES * MPSC_TXBE_SIZE) + +#define MPSC_DMA_ALLOC_SIZE (MPSC_RXR_SIZE + MPSC_RXB_SIZE + \ + MPSC_TXR_SIZE + MPSC_TXB_SIZE + \ + dma_get_cache_alignment() /* for alignment */) + +/* Rx and Tx Ring entry descriptors -- assume entry size is <= cacheline size */ +struct mpsc_rx_desc { + u16 bufsize; + u16 bytecnt; + u32 cmdstat; + u32 link; + u32 buf_ptr; +} __attribute((packed)); + +struct mpsc_tx_desc { + u16 bytecnt; + u16 shadow; + u32 cmdstat; + u32 link; + u32 buf_ptr; +} __attribute((packed)); + +/* + * Some regs that have the erratum that you can't read them are are shared + * between the two MPSC controllers. This struct contains those shared regs. + */ +struct mpsc_shared_regs { + phys_addr_t mpsc_routing_base_p; + phys_addr_t sdma_intr_base_p; + + void __iomem *mpsc_routing_base; + void __iomem *sdma_intr_base; + + u32 MPSC_MRR_m; + u32 MPSC_RCRR_m; + u32 MPSC_TCRR_m; + u32 SDMA_INTR_CAUSE_m; + u32 SDMA_INTR_MASK_m; +}; + +/* The main driver data structure */ +struct mpsc_port_info { + struct uart_port port; /* Overlay uart_port structure */ + + /* Internal driver state for this ctlr */ + u8 ready; + u8 rcv_data; + tcflag_t c_iflag; /* save termios->c_iflag */ + tcflag_t c_cflag; /* save termios->c_cflag */ + + /* Info passed in from platform */ + u8 mirror_regs; /* Need to mirror regs? */ + u8 cache_mgmt; /* Need manual cache mgmt? */ + u8 brg_can_tune; /* BRG has baud tuning? */ + u32 brg_clk_src; + u16 mpsc_max_idle; + int default_baud; + int default_bits; + int default_parity; + int default_flow; + + /* Physical addresses of various blocks of registers (from platform) */ + phys_addr_t mpsc_base_p; + phys_addr_t sdma_base_p; + phys_addr_t brg_base_p; + + /* Virtual addresses of various blocks of registers (from platform) */ + void __iomem *mpsc_base; + void __iomem *sdma_base; + void __iomem *brg_base; + + /* Descriptor ring and buffer allocations */ + void *dma_region; + dma_addr_t dma_region_p; + + dma_addr_t rxr; /* Rx descriptor ring */ + dma_addr_t rxr_p; /* Phys addr of rxr */ + u8 *rxb; /* Rx Ring I/O buf */ + u8 *rxb_p; /* Phys addr of rxb */ + u32 rxr_posn; /* First desc w/ Rx data */ + + dma_addr_t txr; /* Tx descriptor ring */ + dma_addr_t txr_p; /* Phys addr of txr */ + u8 *txb; /* Tx Ring I/O buf */ + u8 *txb_p; /* Phys addr of txb */ + int txr_head; /* Where new data goes */ + int txr_tail; /* Where sent data comes off */ + + /* Mirrored values of regs we can't read (if 'mirror_regs' set) */ + u32 MPSC_MPCR_m; + u32 MPSC_CHR_1_m; + u32 MPSC_CHR_2_m; + u32 MPSC_CHR_10_m; + u32 BRG_BCR_m; + struct mpsc_shared_regs *shared_regs; +}; + +/* Hooks to platform-specific code */ +int mpsc_platform_register_driver(void); +void mpsc_platform_unregister_driver(void); + +/* Hooks back in to mpsc common to be called by platform-specific code */ +struct mpsc_port_info *mpsc_device_probe(int index); +struct mpsc_port_info *mpsc_device_remove(int index); + +/* Main MPSC Configuration Register Offsets */ +#define MPSC_MMCRL 0x0000 +#define MPSC_MMCRH 0x0004 +#define MPSC_MPCR 0x0008 +#define MPSC_CHR_1 0x000c +#define MPSC_CHR_2 0x0010 +#define MPSC_CHR_3 0x0014 +#define MPSC_CHR_4 0x0018 +#define MPSC_CHR_5 0x001c +#define MPSC_CHR_6 0x0020 +#define MPSC_CHR_7 0x0024 +#define MPSC_CHR_8 0x0028 +#define MPSC_CHR_9 0x002c +#define MPSC_CHR_10 0x0030 +#define MPSC_CHR_11 0x0034 + +#define MPSC_MPCR_FRZ (1 << 9) +#define MPSC_MPCR_CL_5 0 +#define MPSC_MPCR_CL_6 1 +#define MPSC_MPCR_CL_7 2 +#define MPSC_MPCR_CL_8 3 +#define MPSC_MPCR_SBL_1 0 +#define MPSC_MPCR_SBL_2 1 + +#define MPSC_CHR_2_TEV (1<<1) +#define MPSC_CHR_2_TA (1<<7) +#define MPSC_CHR_2_TTCS (1<<9) +#define MPSC_CHR_2_REV (1<<17) +#define MPSC_CHR_2_RA (1<<23) +#define MPSC_CHR_2_CRD (1<<25) +#define MPSC_CHR_2_EH (1<<31) +#define MPSC_CHR_2_PAR_ODD 0 +#define MPSC_CHR_2_PAR_SPACE 1 +#define MPSC_CHR_2_PAR_EVEN 2 +#define MPSC_CHR_2_PAR_MARK 3 + +/* MPSC Signal Routing */ +#define MPSC_MRR 0x0000 +#define MPSC_RCRR 0x0004 +#define MPSC_TCRR 0x0008 + +/* Serial DMA Controller Interface Registers */ +#define SDMA_SDC 0x0000 +#define SDMA_SDCM 0x0008 +#define SDMA_RX_DESC 0x0800 +#define SDMA_RX_BUF_PTR 0x0808 +#define SDMA_SCRDP 0x0810 +#define SDMA_TX_DESC 0x0c00 +#define SDMA_SCTDP 0x0c10 +#define SDMA_SFTDP 0x0c14 + +#define SDMA_DESC_CMDSTAT_PE (1<<0) +#define SDMA_DESC_CMDSTAT_CDL (1<<1) +#define SDMA_DESC_CMDSTAT_FR (1<<3) +#define SDMA_DESC_CMDSTAT_OR (1<<6) +#define SDMA_DESC_CMDSTAT_BR (1<<9) +#define SDMA_DESC_CMDSTAT_MI (1<<10) +#define SDMA_DESC_CMDSTAT_A (1<<11) +#define SDMA_DESC_CMDSTAT_AM (1<<12) +#define SDMA_DESC_CMDSTAT_CT (1<<13) +#define SDMA_DESC_CMDSTAT_C (1<<14) +#define SDMA_DESC_CMDSTAT_ES (1<<15) +#define SDMA_DESC_CMDSTAT_L (1<<16) +#define SDMA_DESC_CMDSTAT_F (1<<17) +#define SDMA_DESC_CMDSTAT_P (1<<18) +#define SDMA_DESC_CMDSTAT_EI (1<<23) +#define SDMA_DESC_CMDSTAT_O (1<<31) + +#define SDMA_DESC_DFLT (SDMA_DESC_CMDSTAT_O | \ + SDMA_DESC_CMDSTAT_EI) + +#define SDMA_SDC_RFT (1<<0) +#define SDMA_SDC_SFM (1<<1) +#define SDMA_SDC_BLMR (1<<6) +#define SDMA_SDC_BLMT (1<<7) +#define SDMA_SDC_POVR (1<<8) +#define SDMA_SDC_RIFB (1<<9) + +#define SDMA_SDCM_ERD (1<<7) +#define SDMA_SDCM_AR (1<<15) +#define SDMA_SDCM_STD (1<<16) +#define SDMA_SDCM_TXD (1<<23) +#define SDMA_SDCM_AT (1<<31) + +#define SDMA_0_CAUSE_RXBUF (1<<0) +#define SDMA_0_CAUSE_RXERR (1<<1) +#define SDMA_0_CAUSE_TXBUF (1<<2) +#define SDMA_0_CAUSE_TXEND (1<<3) +#define SDMA_1_CAUSE_RXBUF (1<<8) +#define SDMA_1_CAUSE_RXERR (1<<9) +#define SDMA_1_CAUSE_TXBUF (1<<10) +#define SDMA_1_CAUSE_TXEND (1<<11) + +#define SDMA_CAUSE_RX_MASK (SDMA_0_CAUSE_RXBUF | SDMA_0_CAUSE_RXERR | \ + SDMA_1_CAUSE_RXBUF | SDMA_1_CAUSE_RXERR) +#define SDMA_CAUSE_TX_MASK (SDMA_0_CAUSE_TXBUF | SDMA_0_CAUSE_TXEND | \ + SDMA_1_CAUSE_TXBUF | SDMA_1_CAUSE_TXEND) + +/* SDMA Interrupt registers */ +#define SDMA_INTR_CAUSE 0x0000 +#define SDMA_INTR_MASK 0x0080 + +/* Baud Rate Generator Interface Registers */ +#define BRG_BCR 0x0000 +#define BRG_BTR 0x0004 /* * Define how this driver is known to the outside (we've been assigned a @@ -1165,7 +1417,7 @@ mpsc_startup(struct uart_port *port) flag = SA_SHIRQ; if (request_irq(pi->port.irq, mpsc_sdma_intr, flag, - "mpsc/sdma", pi)) + "mpsc-sdma", pi)) printk(KERN_ERR "MPSC: Can't get SDMA IRQ %d\n", pi->port.irq); diff --git a/drivers/serial/mpsc.h b/drivers/serial/mpsc.h deleted file mode 100644 index 678dbcf06c8f..000000000000 --- a/drivers/serial/mpsc.h +++ /dev/null @@ -1,289 +0,0 @@ -/* - * drivers/serial/mpsc.h - * - * Author: Mark A. Greer <mgreer@mvista.com> - * - * 2004 (c) MontaVista, Software, Inc. This file is licensed under - * the terms of the GNU General Public License version 2. This program - * is licensed "as is" without any warranty of any kind, whether express - * or implied. - */ - -#ifndef __MPSC_H__ -#define __MPSC_H__ - -#include <linux/config.h> -#include <linux/module.h> -#include <linux/moduleparam.h> -#include <linux/tty.h> -#include <linux/tty_flip.h> -#include <linux/ioport.h> -#include <linux/init.h> -#include <linux/console.h> -#include <linux/sysrq.h> -#include <linux/serial.h> -#include <linux/serial_core.h> -#include <linux/delay.h> -#include <linux/device.h> -#include <linux/dma-mapping.h> -#include <linux/mv643xx.h> - -#include <asm/io.h> -#include <asm/irq.h> - -#if defined(CONFIG_SERIAL_MPSC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) -#define SUPPORT_SYSRQ -#endif - -#define MPSC_NUM_CTLRS 2 - -/* - * Descriptors and buffers must be cache line aligned. - * Buffers lengths must be multiple of cache line size. - * Number of Tx & Rx descriptors must be powers of 2. - */ -#define MPSC_RXR_ENTRIES 32 -#define MPSC_RXRE_SIZE dma_get_cache_alignment() -#define MPSC_RXR_SIZE (MPSC_RXR_ENTRIES * MPSC_RXRE_SIZE) -#define MPSC_RXBE_SIZE dma_get_cache_alignment() -#define MPSC_RXB_SIZE (MPSC_RXR_ENTRIES * MPSC_RXBE_SIZE) - -#define MPSC_TXR_ENTRIES 32 -#define MPSC_TXRE_SIZE dma_get_cache_alignment() -#define MPSC_TXR_SIZE (MPSC_TXR_ENTRIES * MPSC_TXRE_SIZE) -#define MPSC_TXBE_SIZE dma_get_cache_alignment() -#define MPSC_TXB_SIZE (MPSC_TXR_ENTRIES * MPSC_TXBE_SIZE) - -#define MPSC_DMA_ALLOC_SIZE (MPSC_RXR_SIZE + MPSC_RXB_SIZE + \ - MPSC_TXR_SIZE + MPSC_TXB_SIZE + \ - dma_get_cache_alignment() /* for alignment */) - -/* Rx and Tx Ring entry descriptors -- assume entry size is <= cacheline size */ -struct mpsc_rx_desc { - u16 bufsize; - u16 bytecnt; - u32 cmdstat; - u32 link; - u32 buf_ptr; -} __attribute((packed)); - -struct mpsc_tx_desc { - u16 bytecnt; - u16 shadow; - u32 cmdstat; - u32 link; - u32 buf_ptr; -} __attribute((packed)); - -/* - * Some regs that have the erratum that you can't read them are are shared - * between the two MPSC controllers. This struct contains those shared regs. - */ -struct mpsc_shared_regs { - phys_addr_t mpsc_routing_base_p; - phys_addr_t sdma_intr_base_p; - - void __iomem *mpsc_routing_base; - void __iomem *sdma_intr_base; - - u32 MPSC_MRR_m; - u32 MPSC_RCRR_m; - u32 MPSC_TCRR_m; - u32 SDMA_INTR_CAUSE_m; - u32 SDMA_INTR_MASK_m; -}; - -/* The main driver data structure */ -struct mpsc_port_info { - struct uart_port port; /* Overlay uart_port structure */ - - /* Internal driver state for this ctlr */ - u8 ready; - u8 rcv_data; - tcflag_t c_iflag; /* save termios->c_iflag */ - tcflag_t c_cflag; /* save termios->c_cflag */ - - /* Info passed in from platform */ - u8 mirror_regs; /* Need to mirror regs? */ - u8 cache_mgmt; /* Need manual cache mgmt? */ - u8 brg_can_tune; /* BRG has baud tuning? */ - u32 brg_clk_src; - u16 mpsc_max_idle; - int default_baud; - int default_bits; - int default_parity; - int default_flow; - - /* Physical addresses of various blocks of registers (from platform) */ - phys_addr_t mpsc_base_p; - phys_addr_t sdma_base_p; - phys_addr_t brg_base_p; - - /* Virtual addresses of various blocks of registers (from platform) */ - void __iomem *mpsc_base; - void __iomem *sdma_base; - void __iomem *brg_base; - - /* Descriptor ring and buffer allocations */ - void *dma_region; - dma_addr_t dma_region_p; - - dma_addr_t rxr; /* Rx descriptor ring */ - dma_addr_t rxr_p; /* Phys addr of rxr */ - u8 *rxb; /* Rx Ring I/O buf */ - u8 *rxb_p; /* Phys addr of rxb */ - u32 rxr_posn; /* First desc w/ Rx data */ - - dma_addr_t txr; /* Tx descriptor ring */ - dma_addr_t txr_p; /* Phys addr of txr */ - u8 *txb; /* Tx Ring I/O buf */ - u8 *txb_p; /* Phys addr of txb */ - int txr_head; /* Where new data goes */ - int txr_tail; /* Where sent data comes off */ - - /* Mirrored values of regs we can't read (if 'mirror_regs' set) */ - u32 MPSC_MPCR_m; - u32 MPSC_CHR_1_m; - u32 MPSC_CHR_2_m; - u32 MPSC_CHR_10_m; - u32 BRG_BCR_m; - struct mpsc_shared_regs *shared_regs; -}; - -/* Hooks to platform-specific code */ -int mpsc_platform_register_driver(void); -void mpsc_platform_unregister_driver(void); - -/* Hooks back in to mpsc common to be called by platform-specific code */ -struct mpsc_port_info *mpsc_device_probe(int index); -struct mpsc_port_info *mpsc_device_remove(int index); - -/* - ***************************************************************************** - * - * Multi-Protocol Serial Controller Interface Registers - * - ***************************************************************************** - */ - -/* Main Configuratino Register Offsets */ -#define MPSC_MMCRL 0x0000 -#define MPSC_MMCRH 0x0004 -#define MPSC_MPCR 0x0008 -#define MPSC_CHR_1 0x000c -#define MPSC_CHR_2 0x0010 -#define MPSC_CHR_3 0x0014 -#define MPSC_CHR_4 0x0018 -#define MPSC_CHR_5 0x001c -#define MPSC_CHR_6 0x0020 -#define MPSC_CHR_7 0x0024 -#define MPSC_CHR_8 0x0028 -#define MPSC_CHR_9 0x002c -#define MPSC_CHR_10 0x0030 -#define MPSC_CHR_11 0x0034 - -#define MPSC_MPCR_FRZ (1 << 9) -#define MPSC_MPCR_CL_5 0 -#define MPSC_MPCR_CL_6 1 -#define MPSC_MPCR_CL_7 2 -#define MPSC_MPCR_CL_8 3 -#define MPSC_MPCR_SBL_1 0 -#define MPSC_MPCR_SBL_2 1 - -#define MPSC_CHR_2_TEV (1<<1) -#define MPSC_CHR_2_TA (1<<7) -#define MPSC_CHR_2_TTCS (1<<9) -#define MPSC_CHR_2_REV (1<<17) -#define MPSC_CHR_2_RA (1<<23) -#define MPSC_CHR_2_CRD (1<<25) -#define MPSC_CHR_2_EH (1<<31) -#define MPSC_CHR_2_PAR_ODD 0 -#define MPSC_CHR_2_PAR_SPACE 1 -#define MPSC_CHR_2_PAR_EVEN 2 -#define MPSC_CHR_2_PAR_MARK 3 - -/* MPSC Signal Routing */ -#define MPSC_MRR 0x0000 -#define MPSC_RCRR 0x0004 -#define MPSC_TCRR 0x0008 - -/* - ***************************************************************************** - * - * Serial DMA Controller Interface Registers - * - ***************************************************************************** - */ - -#define SDMA_SDC 0x0000 -#define SDMA_SDCM 0x0008 -#define SDMA_RX_DESC 0x0800 -#define SDMA_RX_BUF_PTR 0x0808 -#define SDMA_SCRDP 0x0810 -#define SDMA_TX_DESC 0x0c00 -#define SDMA_SCTDP 0x0c10 -#define SDMA_SFTDP 0x0c14 - -#define SDMA_DESC_CMDSTAT_PE (1<<0) -#define SDMA_DESC_CMDSTAT_CDL (1<<1) -#define SDMA_DESC_CMDSTAT_FR (1<<3) -#define SDMA_DESC_CMDSTAT_OR (1<<6) -#define SDMA_DESC_CMDSTAT_BR (1<<9) -#define SDMA_DESC_CMDSTAT_MI (1<<10) -#define SDMA_DESC_CMDSTAT_A (1<<11) -#define SDMA_DESC_CMDSTAT_AM (1<<12) -#define SDMA_DESC_CMDSTAT_CT (1<<13) -#define SDMA_DESC_CMDSTAT_C (1<<14) -#define SDMA_DESC_CMDSTAT_ES (1<<15) -#define SDMA_DESC_CMDSTAT_L (1<<16) -#define SDMA_DESC_CMDSTAT_F (1<<17) -#define SDMA_DESC_CMDSTAT_P (1<<18) -#define SDMA_DESC_CMDSTAT_EI (1<<23) -#define SDMA_DESC_CMDSTAT_O (1<<31) - -#define SDMA_DESC_DFLT (SDMA_DESC_CMDSTAT_O | \ - SDMA_DESC_CMDSTAT_EI) - -#define SDMA_SDC_RFT (1<<0) -#define SDMA_SDC_SFM (1<<1) -#define SDMA_SDC_BLMR (1<<6) -#define SDMA_SDC_BLMT (1<<7) -#define SDMA_SDC_POVR (1<<8) -#define SDMA_SDC_RIFB (1<<9) - -#define SDMA_SDCM_ERD (1<<7) -#define SDMA_SDCM_AR (1<<15) -#define SDMA_SDCM_STD (1<<16) -#define SDMA_SDCM_TXD (1<<23) -#define SDMA_SDCM_AT (1<<31) - -#define SDMA_0_CAUSE_RXBUF (1<<0) -#define SDMA_0_CAUSE_RXERR (1<<1) -#define SDMA_0_CAUSE_TXBUF (1<<2) -#define SDMA_0_CAUSE_TXEND (1<<3) -#define SDMA_1_CAUSE_RXBUF (1<<8) -#define SDMA_1_CAUSE_RXERR (1<<9) -#define SDMA_1_CAUSE_TXBUF (1<<10) -#define SDMA_1_CAUSE_TXEND (1<<11) - -#define SDMA_CAUSE_RX_MASK (SDMA_0_CAUSE_RXBUF | SDMA_0_CAUSE_RXERR | \ - SDMA_1_CAUSE_RXBUF | SDMA_1_CAUSE_RXERR) -#define SDMA_CAUSE_TX_MASK (SDMA_0_CAUSE_TXBUF | SDMA_0_CAUSE_TXEND | \ - SDMA_1_CAUSE_TXBUF | SDMA_1_CAUSE_TXEND) - -/* SDMA Interrupt registers */ -#define SDMA_INTR_CAUSE 0x0000 -#define SDMA_INTR_MASK 0x0080 - -/* - ***************************************************************************** - * - * Baud Rate Generator Interface Registers - * - ***************************************************************************** - */ - -#define BRG_BCR 0x0000 -#define BRG_BTR 0x0004 - -#endif /* __MPSC_H__ */ diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig index b1222cd4aa46..7fdbc5dad5fd 100644 --- a/drivers/usb/Kconfig +++ b/drivers/usb/Kconfig @@ -87,8 +87,6 @@ source "drivers/usb/input/Kconfig" source "drivers/usb/image/Kconfig" -source "drivers/usb/media/Kconfig" - source "drivers/usb/net/Kconfig" source "drivers/usb/mon/Kconfig" diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile index bb36a1c1dbb3..9b7d9769fdcc 100644 --- a/drivers/usb/Makefile +++ b/drivers/usb/Makefile @@ -35,20 +35,6 @@ obj-$(CONFIG_USB_WACOM) += input/ obj-$(CONFIG_USB_ACECAD) += input/ obj-$(CONFIG_USB_XPAD) += input/ -obj-$(CONFIG_USB_DABUSB) += media/ -obj-$(CONFIG_USB_DSBR) += media/ -obj-$(CONFIG_USB_ET61X251) += media/ -obj-$(CONFIG_USB_IBMCAM) += media/ -obj-$(CONFIG_USB_KONICAWC) += media/ -obj-$(CONFIG_USB_OV511) += media/ -obj-$(CONFIG_USB_PWC) += media/ -obj-$(CONFIG_USB_SE401) += media/ -obj-$(CONFIG_USB_SN9C102) += media/ -obj-$(CONFIG_USB_STV680) += media/ -obj-$(CONFIG_USB_VICAM) += media/ -obj-$(CONFIG_USB_W9968CF) += media/ -obj-$(CONFIG_USB_ZC0301) += media/ - obj-$(CONFIG_USB_CATC) += net/ obj-$(CONFIG_USB_KAWETH) += net/ obj-$(CONFIG_USB_PEGASUS) += net/ diff --git a/drivers/usb/media/Kconfig b/drivers/usb/media/Kconfig deleted file mode 100644 index 189d40f96be5..000000000000 --- a/drivers/usb/media/Kconfig +++ /dev/null @@ -1,241 +0,0 @@ -# -# USB Multimedia device configuration -# -comment "USB Multimedia devices" - depends on USB - -config USB_DABUSB - tristate "DABUSB driver" - depends on USB - ---help--- - A Digital Audio Broadcasting (DAB) Receiver for USB and Linux - brought to you by the DAB-Team - <http://wwwbode.cs.tum.edu/Par/arch/dab/>. This driver can be taken - as an example for URB-based bulk, control, and isochronous - transactions. URB's are explained in - <file:Documentation/usb/URB.txt>. - - To compile this driver as a module, choose M here: the - module will be called dabusb. - -comment "Video4Linux support is needed for USB Multimedia device support" - depends on USB && VIDEO_DEV=n - -config USB_VICAM - tristate "USB 3com HomeConnect (aka vicam) support (EXPERIMENTAL)" - depends on USB && VIDEO_DEV && EXPERIMENTAL - ---help--- - Say Y here if you have 3com homeconnect camera (vicam). - - This driver uses the Video For Linux API. You must say Y or M to - "Video For Linux" (under Multimedia Devices) to use this driver. - Information on this API and pointers to "v4l" programs may be found - at <file:Documentation/video4linux/API.html>. - - To compile this driver as a module, choose M here: the - module will be called vicam. - -config USB_DSBR - tristate "D-Link USB FM radio support (EXPERIMENTAL)" - depends on USB && VIDEO_DEV && EXPERIMENTAL - ---help--- - Say Y here if you want to connect this type of radio to your - computer's USB port. Note that the audio is not digital, and - you must connect the line out connector to a sound card or a - set of speakers. - - This driver uses the Video For Linux API. You must enable - (Y or M in config) Video For Linux (under Character Devices) - to use this driver. Information on this API and pointers to - "v4l" programs may be found at - <file:Documentation/video4linux/API.html>. - - To compile this driver as a module, choose M here: the - module will be called dsbr100. - -config USB_ET61X251 - tristate "USB ET61X[12]51 PC Camera Controller support" - depends on USB && VIDEO_DEV - ---help--- - Say Y here if you want support for cameras based on Etoms ET61X151 - or ET61X251 PC Camera Controllers. - - See <file:Documentation/usb/et61x251.txt> for more informations. - - This driver uses the Video For Linux API. You must say Y or M to - "Video For Linux" to use this driver. - - To compile this driver as a module, choose M here: the - module will be called et61x251. - -config USB_IBMCAM - tristate "USB IBM (Xirlink) C-it Camera support" - depends on USB && VIDEO_DEV - ---help--- - Say Y here if you want to connect a IBM "C-It" camera, also known as - "Xirlink PC Camera" to your computer's USB port. For more - information, read <file:Documentation/usb/ibmcam.txt>. - - This driver uses the Video For Linux API. You must enable - (Y or M in config) Video For Linux (under Character Devices) - to use this driver. Information on this API and pointers to - "v4l" programs may be found at - <file:Documentation/video4linux/API.html>. - - To compile this driver as a module, choose M here: the - module will be called ibmcam. - - This camera has several configuration options which - can be specified when you load the module. Read - <file:Documentation/usb/ibmcam.txt> to learn more. - -config USB_KONICAWC - tristate "USB Konica Webcam support" - depends on USB && VIDEO_DEV - ---help--- - Say Y here if you want support for webcams based on a Konica - chipset. This is known to work with the Intel YC76 webcam. - - This driver uses the Video For Linux API. You must enable - (Y or M in config) Video For Linux (under Character Devices) - to use this driver. Information on this API and pointers to - "v4l" programs may be found at - <file:Documentation/video4linux/API.html>. - - To compile this driver as a module, choose M here: the - module will be called konicawc. - -config USB_OV511 - tristate "USB OV511 Camera support" - depends on USB && VIDEO_DEV - ---help--- - Say Y here if you want to connect this type of camera to your - computer's USB port. See <file:Documentation/usb/ov511.txt> for more - information and for a list of supported cameras. - - This driver uses the Video For Linux API. You must say Y or M to - "Video For Linux" (under Character Devices) to use this driver. - Information on this API and pointers to "v4l" programs may be found - at <file:Documentation/video4linux/API.html>. - - To compile this driver as a module, choose M here: the - module will be called ov511. - -config USB_SE401 - tristate "USB SE401 Camera support" - depends on USB && VIDEO_DEV - ---help--- - Say Y here if you want to connect this type of camera to your - computer's USB port. See <file:Documentation/usb/se401.txt> for more - information and for a list of supported cameras. - - This driver uses the Video For Linux API. You must say Y or M to - "Video For Linux" (under Multimedia Devices) to use this driver. - Information on this API and pointers to "v4l" programs may be found - at <file:Documentation/video4linux/API.html>. - - To compile this driver as a module, choose M here: the - module will be called se401. - -config USB_SN9C102 - tristate "USB SN9C10x PC Camera Controller support" - depends on USB && VIDEO_DEV - ---help--- - Say Y here if you want support for cameras based on SONiX SN9C101, - SN9C102 or SN9C103 PC Camera Controllers. - - See <file:Documentation/usb/sn9c102.txt> for more informations. - - This driver uses the Video For Linux API. You must say Y or M to - "Video For Linux" to use this driver. - - To compile this driver as a module, choose M here: the - module will be called sn9c102. - -config USB_STV680 - tristate "USB STV680 (Pencam) Camera support" - depends on USB && VIDEO_DEV - ---help--- - Say Y here if you want to connect this type of camera to your - computer's USB port. This includes the Pencam line of cameras. - See <file:Documentation/usb/stv680.txt> for more information and for - a list of supported cameras. - - This driver uses the Video For Linux API. You must say Y or M to - "Video For Linux" (under Multimedia Devices) to use this driver. - Information on this API and pointers to "v4l" programs may be found - at <file:Documentation/video4linux/API.html>. - - To compile this driver as a module, choose M here: the - module will be called stv680. - -config USB_W9968CF - tristate "USB W996[87]CF JPEG Dual Mode Camera support" - depends on USB && VIDEO_DEV && I2C && VIDEO_OVCAMCHIP - ---help--- - Say Y here if you want support for cameras based on OV681 or - Winbond W9967CF/W9968CF JPEG USB Dual Mode Camera Chips. - - This driver has an optional plugin, which is distributed as a - separate module only (released under GPL). It allows to use higher - resolutions and framerates, but cannot be included in the official - Linux kernel for performance purposes. - - See <file:Documentation/usb/w9968cf.txt> for more informations. - - This driver uses the Video For Linux and the I2C APIs. It needs the - OmniVision Camera Chip support as well. You must say Y or M to - "Video For Linux", "I2C Support" and "OmniVision Camera Chip - support" to use this driver. - - To compile this driver as a module, choose M here: the - module will be called w9968cf. - -config USB_ZC0301 - tristate "USB ZC0301 Image Processor and Control Chip support" - depends on USB && VIDEO_DEV - ---help--- - Say Y here if you want support for cameras based on the ZC0301 - Image Processor and Control Chip. - - See <file:Documentation/usb/zc0301.txt> for more informations. - - This driver uses the Video For Linux API. You must say Y or M to - "Video For Linux" to use this driver. - - To compile this driver as a module, choose M here: the - module will be called zc0301. - -config USB_PWC - tristate "USB Philips Cameras" - depends on USB && VIDEO_DEV - ---help--- - Say Y or M here if you want to use one of these Philips & OEM - webcams: - * Philips PCA645, PCA646 - * Philips PCVC675, PCVC680, PCVC690 - * Philips PCVC720/40, PCVC730, PCVC740, PCVC750 - * Askey VC010 - * Logitech QuickCam Pro 3000, 4000, 'Zoom', 'Notebook Pro' - and 'Orbit'/'Sphere' - * Samsung MPC-C10, MPC-C30 - * Creative Webcam 5, Pro Ex - * SOTEC Afina Eye - * Visionite VCS-UC300, VCS-UM100 - - The PCA635, PCVC665 and PCVC720/20 are not supported by this driver - and never will be, but the 665 and 720/20 are supported by other - drivers. - - See <file:Documentation/usb/philips.txt> for more information and - installation instructions. - - The built-in microphone is enabled by selecting USB Audio support. - - This driver uses the Video For Linux API. You must say Y or M to - "Video For Linux" (under Character Devices) to use this driver. - Information on this API and pointers to "v4l" programs may be found - at <file:Documentation/video4linux/API.html>. - - To compile this driver as a module, choose M here: the - module will be called pwc. diff --git a/drivers/usb/media/Makefile b/drivers/usb/media/Makefile deleted file mode 100644 index 50e89a33b85e..000000000000 --- a/drivers/usb/media/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -# -# Makefile for USB Media drivers -# - -sn9c102-objs := sn9c102_core.o sn9c102_hv7131d.o sn9c102_mi0343.o \ - sn9c102_ov7630.o sn9c102_pas106b.o sn9c102_pas202bca.o \ - sn9c102_pas202bcb.o sn9c102_tas5110c1b.o \ - sn9c102_tas5130d1b.o -et61x251-objs := et61x251_core.o et61x251_tas5130d1b.o -zc0301-objs := zc0301_core.o zc0301_pas202bcb.o - -obj-$(CONFIG_USB_DABUSB) += dabusb.o -obj-$(CONFIG_USB_DSBR) += dsbr100.o -obj-$(CONFIG_USB_ET61X251) += et61x251.o -obj-$(CONFIG_USB_IBMCAM) += ibmcam.o usbvideo.o ultracam.o -obj-$(CONFIG_USB_KONICAWC) += konicawc.o usbvideo.o -obj-$(CONFIG_USB_OV511) += ov511.o -obj-$(CONFIG_USB_SE401) += se401.o -obj-$(CONFIG_USB_SN9C102) += sn9c102.o -obj-$(CONFIG_USB_STV680) += stv680.o -obj-$(CONFIG_USB_VICAM) += vicam.o usbvideo.o -obj-$(CONFIG_USB_W9968CF) += w9968cf.o -obj-$(CONFIG_USB_ZC0301) += zc0301.o -obj-$(CONFIG_USB_PWC) += pwc/ diff --git a/drivers/usb/media/pwc/pwc-kiara.c b/drivers/usb/media/pwc/pwc-kiara.c deleted file mode 100644 index c498c68bace1..000000000000 --- a/drivers/usb/media/pwc/pwc-kiara.c +++ /dev/null @@ -1,318 +0,0 @@ -/* Linux driver for Philips webcam - (C) 2004 Luc Saillard (luc@saillard.org) - - NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx - driver and thus may have bugs that are not present in the original version. - Please send bug reports and support requests to <luc@saillard.org>. - The decompression routines have been implemented by reverse-engineering the - Nemosoft binary pwcx module. Caveat emptor. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - - -/* This tables contains entries for the 730/740/750 (Kiara) camera, with - 4 different qualities (no compression, low, medium, high). - It lists the bandwidth requirements for said mode by its alternate interface - number. An alternate of 0 means that the mode is unavailable. - - There are 6 * 4 * 4 entries: - 6 different resolutions subqcif, qsif, qcif, sif, cif, vga - 6 framerates: 5, 10, 15, 20, 25, 30 - 4 compression modi: none, low, medium, high - - When an uncompressed mode is not available, the next available compressed mode - will be chosen (unless the decompressor is absent). Sometimes there are only - 1 or 2 compressed modes available; in that case entries are duplicated. -*/ - - -#include "pwc-kiara.h" -#include "pwc-uncompress.h" - -const struct Kiara_table_entry Kiara_table[PSZ_MAX][6][4] = -{ - /* SQCIF */ - { - /* 5 fps */ - { - {0, }, - {0, }, - {0, }, - {0, }, - }, - /* 10 fps */ - { - {0, }, - {0, }, - {0, }, - {0, }, - }, - /* 15 fps */ - { - {0, }, - {0, }, - {0, }, - {0, }, - }, - /* 20 fps */ - { - {0, }, - {0, }, - {0, }, - {0, }, - }, - /* 25 fps */ - { - {0, }, - {0, }, - {0, }, - {0, }, - }, - /* 30 fps */ - { - {0, }, - {0, }, - {0, }, - {0, }, - }, - }, - /* QSIF */ - { - /* 5 fps */ - { - {1, 146, 0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}}, - {1, 146, 0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}}, - {1, 146, 0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}}, - {1, 146, 0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}}, - }, - /* 10 fps */ - { - {2, 291, 0, {0x1C, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x23, 0x01, 0x80}}, - {1, 192, 630, {0x14, 0xF4, 0x30, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xC0, 0x00, 0x80}}, - {1, 192, 630, {0x14, 0xF4, 0x30, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xC0, 0x00, 0x80}}, - {1, 192, 630, {0x14, 0xF4, 0x30, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xC0, 0x00, 0x80}}, - }, - /* 15 fps */ - { - {3, 437, 0, {0x1B, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xB5, 0x01, 0x80}}, - {2, 292, 640, {0x13, 0xF4, 0x30, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x20, 0x24, 0x01, 0x80}}, - {2, 292, 640, {0x13, 0xF4, 0x30, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x20, 0x24, 0x01, 0x80}}, - {1, 192, 420, {0x13, 0xF4, 0x30, 0x0D, 0x1B, 0x0C, 0x53, 0x1E, 0x18, 0xC0, 0x00, 0x80}}, - }, - /* 20 fps */ - { - {4, 589, 0, {0x1A, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x4D, 0x02, 0x80}}, - {3, 448, 730, {0x12, 0xF4, 0x30, 0x16, 0xC9, 0x16, 0x01, 0x0E, 0x18, 0xC0, 0x01, 0x80}}, - {2, 292, 476, {0x12, 0xF4, 0x30, 0x0E, 0xD8, 0x0E, 0x10, 0x19, 0x18, 0x24, 0x01, 0x80}}, - {1, 192, 312, {0x12, 0xF4, 0x50, 0x09, 0xB3, 0x08, 0xEB, 0x1E, 0x18, 0xC0, 0x00, 0x80}}, - }, - /* 25 fps */ - { - {5, 703, 0, {0x19, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xBF, 0x02, 0x80}}, - {3, 447, 610, {0x11, 0xF4, 0x30, 0x13, 0x0B, 0x12, 0x43, 0x14, 0x28, 0xBF, 0x01, 0x80}}, - {2, 292, 398, {0x11, 0xF4, 0x50, 0x0C, 0x6C, 0x0B, 0xA4, 0x1E, 0x28, 0x24, 0x01, 0x80}}, - {1, 193, 262, {0x11, 0xF4, 0x50, 0x08, 0x23, 0x07, 0x5B, 0x1E, 0x28, 0xC1, 0x00, 0x80}}, - }, - /* 30 fps */ - { - {8, 874, 0, {0x18, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x6A, 0x03, 0x80}}, - {5, 704, 730, {0x10, 0xF4, 0x30, 0x16, 0xC9, 0x16, 0x01, 0x0E, 0x28, 0xC0, 0x02, 0x80}}, - {3, 448, 492, {0x10, 0xF4, 0x30, 0x0F, 0x5D, 0x0E, 0x95, 0x15, 0x28, 0xC0, 0x01, 0x80}}, - {2, 292, 320, {0x10, 0xF4, 0x50, 0x09, 0xFB, 0x09, 0x33, 0x1E, 0x28, 0x24, 0x01, 0x80}}, - }, - }, - /* QCIF */ - { - /* 5 fps */ - { - {0, }, - {0, }, - {0, }, - {0, }, - }, - /* 10 fps */ - { - {0, }, - {0, }, - {0, }, - {0, }, - }, - /* 15 fps */ - { - {0, }, - {0, }, - {0, }, - {0, }, - }, - /* 20 fps */ - { - {0, }, - {0, }, - {0, }, - {0, }, - }, - /* 25 fps */ - { - {0, }, - {0, }, - {0, }, - {0, }, - }, - /* 30 fps */ - { - {0, }, - {0, }, - {0, }, - {0, }, - }, - }, - /* SIF */ - { - /* 5 fps */ - { - {4, 582, 0, {0x0D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x46, 0x02, 0x80}}, - {3, 387, 1276, {0x05, 0xF4, 0x30, 0x27, 0xD8, 0x26, 0x48, 0x03, 0x10, 0x83, 0x01, 0x80}}, - {2, 291, 960, {0x05, 0xF4, 0x30, 0x1D, 0xF2, 0x1C, 0x62, 0x04, 0x10, 0x23, 0x01, 0x80}}, - {1, 191, 630, {0x05, 0xF4, 0x50, 0x13, 0xA9, 0x12, 0x19, 0x05, 0x18, 0xBF, 0x00, 0x80}}, - }, - /* 10 fps */ - { - {0, }, - {6, 775, 1278, {0x04, 0xF4, 0x30, 0x27, 0xE8, 0x26, 0x58, 0x05, 0x30, 0x07, 0x03, 0x80}}, - {3, 447, 736, {0x04, 0xF4, 0x30, 0x16, 0xFB, 0x15, 0x6B, 0x05, 0x28, 0xBF, 0x01, 0x80}}, - {2, 292, 480, {0x04, 0xF4, 0x70, 0x0E, 0xF9, 0x0D, 0x69, 0x09, 0x28, 0x24, 0x01, 0x80}}, - }, - /* 15 fps */ - { - {0, }, - {9, 955, 1050, {0x03, 0xF4, 0x30, 0x20, 0xCF, 0x1F, 0x3F, 0x06, 0x48, 0xBB, 0x03, 0x80}}, - {4, 592, 650, {0x03, 0xF4, 0x30, 0x14, 0x44, 0x12, 0xB4, 0x08, 0x30, 0x50, 0x02, 0x80}}, - {3, 448, 492, {0x03, 0xF4, 0x50, 0x0F, 0x52, 0x0D, 0xC2, 0x09, 0x38, 0xC0, 0x01, 0x80}}, - }, - /* 20 fps */ - { - {0, }, - {9, 958, 782, {0x02, 0xF4, 0x30, 0x18, 0x6A, 0x16, 0xDA, 0x0B, 0x58, 0xBE, 0x03, 0x80}}, - {5, 703, 574, {0x02, 0xF4, 0x50, 0x11, 0xE7, 0x10, 0x57, 0x0B, 0x40, 0xBF, 0x02, 0x80}}, - {3, 446, 364, {0x02, 0xF4, 0x90, 0x0B, 0x5C, 0x09, 0xCC, 0x0E, 0x38, 0xBE, 0x01, 0x80}}, - }, - /* 25 fps */ - { - {0, }, - {9, 958, 654, {0x01, 0xF4, 0x30, 0x14, 0x66, 0x12, 0xD6, 0x0B, 0x50, 0xBE, 0x03, 0x80}}, - {6, 776, 530, {0x01, 0xF4, 0x50, 0x10, 0x8C, 0x0E, 0xFC, 0x0C, 0x48, 0x08, 0x03, 0x80}}, - {4, 592, 404, {0x01, 0xF4, 0x70, 0x0C, 0x96, 0x0B, 0x06, 0x0B, 0x48, 0x50, 0x02, 0x80}}, - }, - /* 30 fps */ - { - {0, }, - {9, 957, 526, {0x00, 0xF4, 0x50, 0x10, 0x68, 0x0E, 0xD8, 0x0D, 0x58, 0xBD, 0x03, 0x80}}, - {6, 775, 426, {0x00, 0xF4, 0x70, 0x0D, 0x48, 0x0B, 0xB8, 0x0F, 0x50, 0x07, 0x03, 0x80}}, - {4, 590, 324, {0x00, 0x7A, 0x88, 0x0A, 0x1C, 0x08, 0xB4, 0x0E, 0x50, 0x4E, 0x02, 0x80}}, - }, - }, - /* CIF */ - { - /* 5 fps */ - { - {0, }, - {0, }, - {0, }, - {0, }, - }, - /* 10 fps */ - { - {0, }, - {0, }, - {0, }, - {0, }, - }, - /* 15 fps */ - { - {0, }, - {0, }, - {0, }, - {0, }, - }, - /* 20 fps */ - { - {0, }, - {0, }, - {0, }, - {0, }, - }, - /* 25 fps */ - { - {0, }, - {0, }, - {0, }, - {0, }, - }, - /* 30 fps */ - { - {0, }, - {0, }, - {0, }, - {0, }, - }, - }, - /* VGA */ - { - /* 5 fps */ - { - {0, }, - {6, 773, 1272, {0x25, 0xF4, 0x30, 0x27, 0xB6, 0x24, 0x96, 0x02, 0x30, 0x05, 0x03, 0x80}}, - {4, 592, 976, {0x25, 0xF4, 0x50, 0x1E, 0x78, 0x1B, 0x58, 0x03, 0x30, 0x50, 0x02, 0x80}}, - {3, 448, 738, {0x25, 0xF4, 0x90, 0x17, 0x0C, 0x13, 0xEC, 0x04, 0x30, 0xC0, 0x01, 0x80}}, - }, - /* 10 fps */ - { - {0, }, - {9, 956, 788, {0x24, 0xF4, 0x70, 0x18, 0x9C, 0x15, 0x7C, 0x03, 0x48, 0xBC, 0x03, 0x80}}, - {6, 776, 640, {0x24, 0xF4, 0xB0, 0x13, 0xFC, 0x11, 0x2C, 0x04, 0x48, 0x08, 0x03, 0x80}}, - {4, 592, 488, {0x24, 0x7A, 0xE8, 0x0F, 0x3C, 0x0C, 0x6C, 0x06, 0x48, 0x50, 0x02, 0x80}}, - }, - /* 15 fps */ - { - {0, }, - {9, 957, 526, {0x23, 0x7A, 0xE8, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x03, 0x80}}, - {9, 957, 526, {0x23, 0x7A, 0xE8, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x03, 0x80}}, - {8, 895, 492, {0x23, 0x7A, 0xE8, 0x0F, 0x5D, 0x0C, 0x8D, 0x06, 0x58, 0x7F, 0x03, 0x80}}, - }, - /* 20 fps */ - { - {0, }, - {0, }, - {0, }, - {0, }, - }, - /* 25 fps */ - { - {0, }, - {0, }, - {0, }, - {0, }, - }, - /* 30 fps */ - { - {0, }, - {0, }, - {0, }, - {0, }, - }, - }, -}; - diff --git a/drivers/usb/media/pwc/pwc-timon.c b/drivers/usb/media/pwc/pwc-timon.c deleted file mode 100644 index dee967173d6c..000000000000 --- a/drivers/usb/media/pwc/pwc-timon.c +++ /dev/null @@ -1,316 +0,0 @@ -/* Linux driver for Philips webcam - (C) 2004 Luc Saillard (luc@saillard.org) - - NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx - driver and thus may have bugs that are not present in the original version. - Please send bug reports and support requests to <luc@saillard.org>. - The decompression routines have been implemented by reverse-engineering the - Nemosoft binary pwcx module. Caveat emptor. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - - -/* This tables contains entries for the 675/680/690 (Timon) camera, with - 4 different qualities (no compression, low, medium, high). - It lists the bandwidth requirements for said mode by its alternate interface - number. An alternate of 0 means that the mode is unavailable. - - There are 6 * 4 * 4 entries: - 6 different resolutions subqcif, qsif, qcif, sif, cif, vga - 6 framerates: 5, 10, 15, 20, 25, 30 - 4 compression modi: none, low, medium, high - - When an uncompressed mode is not available, the next available compressed mode - will be chosen (unless the decompressor is absent). Sometimes there are only - 1 or 2 compressed modes available; in that case entries are duplicated. -*/ - -#include "pwc-timon.h" - -const struct Timon_table_entry Timon_table[PSZ_MAX][6][4] = -{ - /* SQCIF */ - { - /* 5 fps */ - { - {1, 140, 0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}}, - {1, 140, 0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}}, - {1, 140, 0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}}, - {1, 140, 0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}}, - }, - /* 10 fps */ - { - {2, 280, 0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}}, - {2, 280, 0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}}, - {2, 280, 0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}}, - {2, 280, 0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}}, - }, - /* 15 fps */ - { - {3, 410, 0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}}, - {3, 410, 0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}}, - {3, 410, 0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}}, - {3, 410, 0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}}, - }, - /* 20 fps */ - { - {4, 559, 0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}}, - {4, 559, 0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}}, - {4, 559, 0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}}, - {4, 559, 0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}}, - }, - /* 25 fps */ - { - {5, 659, 0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}}, - {5, 659, 0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}}, - {5, 659, 0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}}, - {5, 659, 0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}}, - }, - /* 30 fps */ - { - {7, 838, 0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}}, - {7, 838, 0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}}, - {7, 838, 0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}}, - {7, 838, 0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}}, - }, - }, - /* QSIF */ - { - /* 5 fps */ - { - {1, 146, 0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}}, - {1, 146, 0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}}, - {1, 146, 0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}}, - {1, 146, 0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}}, - }, - /* 10 fps */ - { - {2, 291, 0, {0x2C, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x23, 0xA1, 0xC0, 0x02}}, - {1, 191, 630, {0x2C, 0xF4, 0x05, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xBF, 0xF4, 0xC0, 0x02}}, - {1, 191, 630, {0x2C, 0xF4, 0x05, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xBF, 0xF4, 0xC0, 0x02}}, - {1, 191, 630, {0x2C, 0xF4, 0x05, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xBF, 0xF4, 0xC0, 0x02}}, - }, - /* 15 fps */ - { - {3, 437, 0, {0x2B, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xB5, 0x6D, 0xC0, 0x02}}, - {2, 291, 640, {0x2B, 0xF4, 0x05, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x08, 0x23, 0xA1, 0xC0, 0x02}}, - {2, 291, 640, {0x2B, 0xF4, 0x05, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x08, 0x23, 0xA1, 0xC0, 0x02}}, - {1, 191, 420, {0x2B, 0xF4, 0x0D, 0x0D, 0x1B, 0x0C, 0x53, 0x1E, 0x08, 0xBF, 0xF4, 0xC0, 0x02}}, - }, - /* 20 fps */ - { - {4, 588, 0, {0x2A, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x4C, 0x52, 0xC0, 0x02}}, - {3, 447, 730, {0x2A, 0xF4, 0x05, 0x16, 0xC9, 0x16, 0x01, 0x0E, 0x18, 0xBF, 0x69, 0xC0, 0x02}}, - {2, 292, 476, {0x2A, 0xF4, 0x0D, 0x0E, 0xD8, 0x0E, 0x10, 0x19, 0x18, 0x24, 0xA1, 0xC0, 0x02}}, - {1, 192, 312, {0x2A, 0xF4, 0x1D, 0x09, 0xB3, 0x08, 0xEB, 0x1E, 0x18, 0xC0, 0xF4, 0xC0, 0x02}}, - }, - /* 25 fps */ - { - {5, 703, 0, {0x29, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xBF, 0x42, 0xC0, 0x02}}, - {3, 447, 610, {0x29, 0xF4, 0x05, 0x13, 0x0B, 0x12, 0x43, 0x14, 0x18, 0xBF, 0x69, 0xC0, 0x02}}, - {2, 292, 398, {0x29, 0xF4, 0x0D, 0x0C, 0x6C, 0x0B, 0xA4, 0x1E, 0x18, 0x24, 0xA1, 0xC0, 0x02}}, - {1, 192, 262, {0x29, 0xF4, 0x25, 0x08, 0x23, 0x07, 0x5B, 0x1E, 0x18, 0xC0, 0xF4, 0xC0, 0x02}}, - }, - /* 30 fps */ - { - {8, 873, 0, {0x28, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x69, 0x37, 0xC0, 0x02}}, - {5, 704, 774, {0x28, 0xF4, 0x05, 0x18, 0x21, 0x17, 0x59, 0x0F, 0x18, 0xC0, 0x42, 0xC0, 0x02}}, - {3, 448, 492, {0x28, 0xF4, 0x05, 0x0F, 0x5D, 0x0E, 0x95, 0x15, 0x18, 0xC0, 0x69, 0xC0, 0x02}}, - {2, 291, 320, {0x28, 0xF4, 0x1D, 0x09, 0xFB, 0x09, 0x33, 0x1E, 0x18, 0x23, 0xA1, 0xC0, 0x02}}, - }, - }, - /* QCIF */ - { - /* 5 fps */ - { - {1, 193, 0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}}, - {1, 193, 0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}}, - {1, 193, 0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}}, - {1, 193, 0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}}, - }, - /* 10 fps */ - { - {3, 385, 0, {0x0C, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x81, 0x79, 0xC0, 0x02}}, - {2, 291, 800, {0x0C, 0xF4, 0x05, 0x18, 0xF4, 0x18, 0x18, 0x11, 0x08, 0x23, 0xA1, 0xC0, 0x02}}, - {2, 291, 800, {0x0C, 0xF4, 0x05, 0x18, 0xF4, 0x18, 0x18, 0x11, 0x08, 0x23, 0xA1, 0xC0, 0x02}}, - {1, 194, 532, {0x0C, 0xF4, 0x05, 0x10, 0x9A, 0x0F, 0xBE, 0x1B, 0x08, 0xC2, 0xF0, 0xC0, 0x02}}, - }, - /* 15 fps */ - { - {4, 577, 0, {0x0B, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x41, 0x52, 0xC0, 0x02}}, - {3, 447, 818, {0x0B, 0xF4, 0x05, 0x19, 0x89, 0x18, 0xAD, 0x0F, 0x10, 0xBF, 0x69, 0xC0, 0x02}}, - {2, 292, 534, {0x0B, 0xF4, 0x05, 0x10, 0xA3, 0x0F, 0xC7, 0x19, 0x10, 0x24, 0xA1, 0xC0, 0x02}}, - {1, 195, 356, {0x0B, 0xF4, 0x15, 0x0B, 0x11, 0x0A, 0x35, 0x1E, 0x10, 0xC3, 0xF0, 0xC0, 0x02}}, - }, - /* 20 fps */ - { - {6, 776, 0, {0x0A, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x08, 0x3F, 0xC0, 0x02}}, - {4, 591, 804, {0x0A, 0xF4, 0x05, 0x19, 0x1E, 0x18, 0x42, 0x0F, 0x18, 0x4F, 0x4E, 0xC0, 0x02}}, - {3, 447, 608, {0x0A, 0xF4, 0x05, 0x12, 0xFD, 0x12, 0x21, 0x15, 0x18, 0xBF, 0x69, 0xC0, 0x02}}, - {2, 291, 396, {0x0A, 0xF4, 0x15, 0x0C, 0x5E, 0x0B, 0x82, 0x1E, 0x18, 0x23, 0xA1, 0xC0, 0x02}}, - }, - /* 25 fps */ - { - {9, 928, 0, {0x09, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xA0, 0x33, 0xC0, 0x02}}, - {5, 703, 800, {0x09, 0xF4, 0x05, 0x18, 0xF4, 0x18, 0x18, 0x10, 0x18, 0xBF, 0x42, 0xC0, 0x02}}, - {3, 447, 508, {0x09, 0xF4, 0x0D, 0x0F, 0xD2, 0x0E, 0xF6, 0x1B, 0x18, 0xBF, 0x69, 0xC0, 0x02}}, - {2, 292, 332, {0x09, 0xF4, 0x1D, 0x0A, 0x5A, 0x09, 0x7E, 0x1E, 0x18, 0x24, 0xA1, 0xC0, 0x02}}, - }, - /* 30 fps */ - { - {0, }, - {9, 956, 876, {0x08, 0xF4, 0x05, 0x1B, 0x58, 0x1A, 0x7C, 0x0E, 0x20, 0xBC, 0x33, 0x10, 0x02}}, - {4, 592, 542, {0x08, 0xF4, 0x05, 0x10, 0xE4, 0x10, 0x08, 0x17, 0x20, 0x50, 0x4E, 0x10, 0x02}}, - {2, 291, 266, {0x08, 0xF4, 0x25, 0x08, 0x48, 0x07, 0x6C, 0x1E, 0x20, 0x23, 0xA1, 0x10, 0x02}}, - }, - }, - /* SIF */ - { - /* 5 fps */ - { - {4, 582, 0, {0x35, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x46, 0x52, 0x60, 0x02}}, - {3, 387, 1276, {0x35, 0xF4, 0x05, 0x27, 0xD8, 0x26, 0x48, 0x03, 0x10, 0x83, 0x79, 0x60, 0x02}}, - {2, 291, 960, {0x35, 0xF4, 0x0D, 0x1D, 0xF2, 0x1C, 0x62, 0x04, 0x10, 0x23, 0xA1, 0x60, 0x02}}, - {1, 191, 630, {0x35, 0xF4, 0x1D, 0x13, 0xA9, 0x12, 0x19, 0x05, 0x08, 0xBF, 0xF4, 0x60, 0x02}}, - }, - /* 10 fps */ - { - {0, }, - {6, 775, 1278, {0x34, 0xF4, 0x05, 0x27, 0xE8, 0x26, 0x58, 0x05, 0x30, 0x07, 0x3F, 0x10, 0x02}}, - {3, 447, 736, {0x34, 0xF4, 0x15, 0x16, 0xFB, 0x15, 0x6B, 0x05, 0x18, 0xBF, 0x69, 0x10, 0x02}}, - {2, 291, 480, {0x34, 0xF4, 0x2D, 0x0E, 0xF9, 0x0D, 0x69, 0x09, 0x18, 0x23, 0xA1, 0x10, 0x02}}, - }, - /* 15 fps */ - { - {0, }, - {9, 955, 1050, {0x33, 0xF4, 0x05, 0x20, 0xCF, 0x1F, 0x3F, 0x06, 0x48, 0xBB, 0x33, 0x10, 0x02}}, - {4, 591, 650, {0x33, 0xF4, 0x15, 0x14, 0x44, 0x12, 0xB4, 0x08, 0x30, 0x4F, 0x4E, 0x10, 0x02}}, - {3, 448, 492, {0x33, 0xF4, 0x25, 0x0F, 0x52, 0x0D, 0xC2, 0x09, 0x28, 0xC0, 0x69, 0x10, 0x02}}, - }, - /* 20 fps */ - { - {0, }, - {9, 958, 782, {0x32, 0xF4, 0x0D, 0x18, 0x6A, 0x16, 0xDA, 0x0B, 0x58, 0xBE, 0x33, 0xD0, 0x02}}, - {5, 703, 574, {0x32, 0xF4, 0x1D, 0x11, 0xE7, 0x10, 0x57, 0x0B, 0x40, 0xBF, 0x42, 0xD0, 0x02}}, - {3, 446, 364, {0x32, 0xF4, 0x3D, 0x0B, 0x5C, 0x09, 0xCC, 0x0E, 0x30, 0xBE, 0x69, 0xD0, 0x02}}, - }, - /* 25 fps */ - { - {0, }, - {9, 958, 654, {0x31, 0xF4, 0x15, 0x14, 0x66, 0x12, 0xD6, 0x0B, 0x50, 0xBE, 0x33, 0x90, 0x02}}, - {6, 776, 530, {0x31, 0xF4, 0x25, 0x10, 0x8C, 0x0E, 0xFC, 0x0C, 0x48, 0x08, 0x3F, 0x90, 0x02}}, - {4, 592, 404, {0x31, 0xF4, 0x35, 0x0C, 0x96, 0x0B, 0x06, 0x0B, 0x38, 0x50, 0x4E, 0x90, 0x02}}, - }, - /* 30 fps */ - { - {0, }, - {9, 957, 526, {0x30, 0xF4, 0x25, 0x10, 0x68, 0x0E, 0xD8, 0x0D, 0x58, 0xBD, 0x33, 0x60, 0x02}}, - {6, 775, 426, {0x30, 0xF4, 0x35, 0x0D, 0x48, 0x0B, 0xB8, 0x0F, 0x50, 0x07, 0x3F, 0x60, 0x02}}, - {4, 590, 324, {0x30, 0x7A, 0x4B, 0x0A, 0x1C, 0x08, 0xB4, 0x0E, 0x40, 0x4E, 0x52, 0x60, 0x02}}, - }, - }, - /* CIF */ - { - /* 5 fps */ - { - {6, 771, 0, {0x15, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x3F, 0x80, 0x02}}, - {4, 465, 1278, {0x15, 0xF4, 0x05, 0x27, 0xEE, 0x26, 0x36, 0x03, 0x18, 0xD1, 0x65, 0x80, 0x02}}, - {2, 291, 800, {0x15, 0xF4, 0x15, 0x18, 0xF4, 0x17, 0x3C, 0x05, 0x18, 0x23, 0xA1, 0x80, 0x02}}, - {1, 193, 528, {0x15, 0xF4, 0x2D, 0x10, 0x7E, 0x0E, 0xC6, 0x0A, 0x18, 0xC1, 0xF4, 0x80, 0x02}}, - }, - /* 10 fps */ - { - {0, }, - {9, 932, 1278, {0x14, 0xF4, 0x05, 0x27, 0xEE, 0x26, 0x36, 0x04, 0x30, 0xA4, 0x33, 0x10, 0x02}}, - {4, 591, 812, {0x14, 0xF4, 0x15, 0x19, 0x56, 0x17, 0x9E, 0x06, 0x28, 0x4F, 0x4E, 0x10, 0x02}}, - {2, 291, 400, {0x14, 0xF4, 0x3D, 0x0C, 0x7A, 0x0A, 0xC2, 0x0E, 0x28, 0x23, 0xA1, 0x10, 0x02}}, - }, - /* 15 fps */ - { - {0, }, - {9, 956, 876, {0x13, 0xF4, 0x0D, 0x1B, 0x58, 0x19, 0xA0, 0x05, 0x38, 0xBC, 0x33, 0x60, 0x02}}, - {5, 703, 644, {0x13, 0xF4, 0x1D, 0x14, 0x1C, 0x12, 0x64, 0x08, 0x38, 0xBF, 0x42, 0x60, 0x02}}, - {3, 448, 410, {0x13, 0xF4, 0x3D, 0x0C, 0xC4, 0x0B, 0x0C, 0x0E, 0x38, 0xC0, 0x69, 0x60, 0x02}}, - }, - /* 20 fps */ - { - {0, }, - {9, 956, 650, {0x12, 0xF4, 0x1D, 0x14, 0x4A, 0x12, 0x92, 0x09, 0x48, 0xBC, 0x33, 0x10, 0x03}}, - {6, 776, 528, {0x12, 0xF4, 0x2D, 0x10, 0x7E, 0x0E, 0xC6, 0x0A, 0x40, 0x08, 0x3F, 0x10, 0x03}}, - {4, 591, 402, {0x12, 0xF4, 0x3D, 0x0C, 0x8F, 0x0A, 0xD7, 0x0E, 0x40, 0x4F, 0x4E, 0x10, 0x03}}, - }, - /* 25 fps */ - { - {0, }, - {9, 956, 544, {0x11, 0xF4, 0x25, 0x10, 0xF4, 0x0F, 0x3C, 0x0A, 0x48, 0xBC, 0x33, 0xC0, 0x02}}, - {7, 840, 478, {0x11, 0xF4, 0x2D, 0x0E, 0xEB, 0x0D, 0x33, 0x0B, 0x48, 0x48, 0x3B, 0xC0, 0x02}}, - {5, 703, 400, {0x11, 0xF4, 0x3D, 0x0C, 0x7A, 0x0A, 0xC2, 0x0E, 0x48, 0xBF, 0x42, 0xC0, 0x02}}, - }, - /* 30 fps */ - { - {0, }, - {9, 956, 438, {0x10, 0xF4, 0x35, 0x0D, 0xAC, 0x0B, 0xF4, 0x0D, 0x50, 0xBC, 0x33, 0x10, 0x02}}, - {7, 838, 384, {0x10, 0xF4, 0x45, 0x0B, 0xFD, 0x0A, 0x45, 0x0F, 0x50, 0x46, 0x3B, 0x10, 0x02}}, - {6, 773, 354, {0x10, 0x7A, 0x4B, 0x0B, 0x0C, 0x09, 0x80, 0x10, 0x50, 0x05, 0x3F, 0x10, 0x02}}, - }, - }, - /* VGA */ - { - /* 5 fps */ - { - {0, }, - {6, 773, 1272, {0x1D, 0xF4, 0x15, 0x27, 0xB6, 0x24, 0x96, 0x02, 0x30, 0x05, 0x3F, 0x10, 0x02}}, - {4, 592, 976, {0x1D, 0xF4, 0x25, 0x1E, 0x78, 0x1B, 0x58, 0x03, 0x30, 0x50, 0x4E, 0x10, 0x02}}, - {3, 448, 738, {0x1D, 0xF4, 0x3D, 0x17, 0x0C, 0x13, 0xEC, 0x04, 0x30, 0xC0, 0x69, 0x10, 0x02}}, - }, - /* 10 fps */ - { - {0, }, - {9, 956, 788, {0x1C, 0xF4, 0x35, 0x18, 0x9C, 0x15, 0x7C, 0x03, 0x48, 0xBC, 0x33, 0x10, 0x02}}, - {6, 776, 640, {0x1C, 0x7A, 0x53, 0x13, 0xFC, 0x11, 0x2C, 0x04, 0x48, 0x08, 0x3F, 0x10, 0x02}}, - {4, 592, 488, {0x1C, 0x7A, 0x6B, 0x0F, 0x3C, 0x0C, 0x6C, 0x06, 0x48, 0x50, 0x4E, 0x10, 0x02}}, - }, - /* 15 fps */ - { - {0, }, - {9, 957, 526, {0x1B, 0x7A, 0x63, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x33, 0x80, 0x02}}, - {9, 957, 526, {0x1B, 0x7A, 0x63, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x33, 0x80, 0x02}}, - {8, 895, 492, {0x1B, 0x7A, 0x6B, 0x0F, 0x5D, 0x0C, 0x8D, 0x06, 0x58, 0x7F, 0x37, 0x80, 0x02}}, - }, - /* 20 fps */ - { - {0, }, - {0, }, - {0, }, - {0, }, - }, - /* 25 fps */ - { - {0, }, - {0, }, - {0, }, - {0, }, - }, - /* 30 fps */ - { - {0, }, - {0, }, - {0, }, - {0, }, - }, - }, -}; - diff --git a/drivers/video/backlight/locomolcd.c b/drivers/video/backlight/locomolcd.c index ada6e75eb048..60831bb23685 100644 --- a/drivers/video/backlight/locomolcd.c +++ b/drivers/video/backlight/locomolcd.c @@ -20,14 +20,10 @@ #include <asm/hardware/locomo.h> #include <asm/irq.h> +#include <asm/mach/sharpsl_param.h> +#include <asm/mach-types.h> -#ifdef CONFIG_SA1100_COLLIE -#include <asm/arch/collie.h> -#else -#include <asm/arch/poodle.h> -#endif - -extern void (*sa1100fb_lcd_power)(int on); +#include "../../../arch/arm/mach-sa1100/generic.h" static struct locomo_dev *locomolcd_dev; @@ -82,7 +78,7 @@ static void locomolcd_off(int comadj) void locomolcd_power(int on) { - int comadj = 118; + int comadj = sharpsl_param.comadj; unsigned long flags; local_irq_save(flags); @@ -93,11 +89,12 @@ void locomolcd_power(int on) } /* read comadj */ -#ifdef CONFIG_MACH_POODLE - comadj = 118; -#else - comadj = 128; -#endif + if (comadj == -1) { + if (machine_is_poodle()) + comadj = 118; + if (machine_is_collie()) + comadj = 128; + } if (on) locomolcd_on(comadj); diff --git a/drivers/video/cirrusfb.c b/drivers/video/cirrusfb.c index e0dbdfc0c8b4..66d6f2f0a219 100644 --- a/drivers/video/cirrusfb.c +++ b/drivers/video/cirrusfb.c @@ -2622,7 +2622,7 @@ static int __init cirrusfb_init(void) #endif #ifdef CONFIG_ZORRO - error |= zorro_module_init(&cirrusfb_zorro_driver); + error |= zorro_register_driver(&cirrusfb_zorro_driver); #endif #ifdef CONFIG_PCI error |= pci_register_driver(&cirrusfb_pci_driver); diff --git a/drivers/video/hpfb.c b/drivers/video/hpfb.c index bebdac59d231..abd920a663a0 100644 --- a/drivers/video/hpfb.c +++ b/drivers/video/hpfb.c @@ -386,7 +386,9 @@ int __init hpfb_init(void) if (fb_get_options("hpfb", NULL)) return -ENODEV; - dio_module_init(&hpfb_driver); + err = dio_register_driver(&hpfb_driver); + if (err) + return err; fs = get_fs(); set_fs(KERNEL_DS); diff --git a/drivers/video/pm3fb.c b/drivers/video/pm3fb.c index 0e78ddc81583..52c18a35fb41 100644 --- a/drivers/video/pm3fb.c +++ b/drivers/video/pm3fb.c @@ -3532,26 +3532,26 @@ int __init pm3fb_init(void) MODULE_AUTHOR("Romain Dolbeau"); MODULE_DESCRIPTION("Permedia3 framebuffer device driver"); static char *mode[PM3_MAX_BOARD]; -MODULE_PARM(mode,PM3_MAX_BOARD_MODULE_ARRAY_STRING); +module_param_array(mode, charp, NULL, 0); MODULE_PARM_DESC(mode,"video mode"); -MODULE_PARM(disable,PM3_MAX_BOARD_MODULE_ARRAY_SHORT); +module_param_array(disable, short, NULL, 0); MODULE_PARM_DESC(disable,"disable board"); static short off[PM3_MAX_BOARD]; -MODULE_PARM(off,PM3_MAX_BOARD_MODULE_ARRAY_SHORT); +module_param_array(off, short, NULL, 0); MODULE_PARM_DESC(off,"disable board"); static char *pciid[PM3_MAX_BOARD]; -MODULE_PARM(pciid,PM3_MAX_BOARD_MODULE_ARRAY_STRING); +module_param_array(pciid, charp, NULL, 0); MODULE_PARM_DESC(pciid,"board PCI Id"); -MODULE_PARM(noaccel,PM3_MAX_BOARD_MODULE_ARRAY_SHORT); +module_param_array(noaccel, short, NULL, 0); MODULE_PARM_DESC(noaccel,"disable accel"); static char *font[PM3_MAX_BOARD]; -MODULE_PARM(font,PM3_MAX_BOARD_MODULE_ARRAY_STRING); +module_param_array(font, charp, NULL, 0); MODULE_PARM_DESC(font,"choose font"); -MODULE_PARM(depth,PM3_MAX_BOARD_MODULE_ARRAY_SHORT); +module_param(depth, short, NULL, 0); MODULE_PARM_DESC(depth,"boot-time depth"); -MODULE_PARM(printtimings, "h"); +module_param(printtimings, short, NULL, 0); MODULE_PARM_DESC(printtimings, "print the memory timings of the card(s)"); -MODULE_PARM(forcesize, PM3_MAX_BOARD_MODULE_ARRAY_SHORT); +module_param(forcesize, short, NULL, 0); MODULE_PARM_DESC(forcesize, "force specified memory size"); /* MODULE_SUPPORTED_DEVICE("Permedia3 PCI boards") diff --git a/drivers/zorro/zorro-driver.c b/drivers/zorro/zorro-driver.c index fcbee748c592..067c07be928c 100644 --- a/drivers/zorro/zorro-driver.c +++ b/drivers/zorro/zorro-driver.c @@ -65,22 +65,17 @@ static int zorro_device_probe(struct device *dev) * @drv: the driver structure to register * * Adds the driver structure to the list of registered drivers - * Returns the number of Zorro devices which were claimed by the driver - * during registration. The driver remains registered even if the - * return value is zero. + * Returns zero or a negative error value. */ int zorro_register_driver(struct zorro_driver *drv) { - int count = 0; - /* initialize common driver fields */ drv->driver.name = drv->name; drv->driver.bus = &zorro_bus_type; /* register with core */ - count = driver_register(&drv->driver); - return count ? count : 1; + return driver_register(&drv->driver); } |