v4l: bttv update
PATCH 1/1 v4l: bttv update
- some cleanups merged.
- use new tveeprom module to configure Hauppauge cards.
- add new tv cards.
Signed-off-by Gerd Knorr <[email protected]>
--- drivers/media/video/Kconfig | 1 drivers/media/video/btcx-risc.c | 3 drivers/media/video/bttv-cards.c | 203 +++++++++++++++--------------- drivers/media/video/bttv-driver.c | 21 ++- drivers/media/video/bttv-i2c.c | 23 --- drivers/media/video/bttv-if.c | 14 +- drivers/media/video/bttv-risc.c | 2 drivers/media/video/bttv-vbi.c | 5 drivers/media/video/bttv.h | 5 drivers/media/video/bttvp.h | 8 - 10 files changed, 147 insertions(+), 138 deletions(-)
drivers/media/video/bttv.h +3 -2
@@ -1,5 +1,5 @@/* -* $Id: bttv.h,v 1.10 2004/10/13 10:39:00 kraxel Exp $ +* $Id: bttv.h,v 1.14 2005/01/07 13:11:19 kraxel Exp $ * * bttv - Bt848 frame grabber driver *
@@ -133,6 +133,7 @@#define BTTV_MATRIX_VISIONSLC 0x7e#define BTTV_APAC_VIEWCOMP 0x7f#define BTTV_DVICO_DVBT_LITE 0x80 +#define BTTV_TIBET_CS16 0x83/* i2c address list */ #define I2C_TSA5522 0xc2
@@ -149,7 +150,7 @@#define I2C_VHX 0xc0#define I2C_MSP3400 0x80#define I2C_MSP3400_ALT 0x88 -#define I2C_TEA6300 0x80 +#define I2C_TEA6300 0x80/* also used by 6320 */ #define I2C_DPL3518 0x84#define I2C_TDA9887 0x86
drivers/media/video/bttvp.h +2 -6
@@ -1,5 +1,5 @@/* -$Id: bttvp.h,v 1.12 2004/10/25 11:26:36 kraxel Exp $ +$Id: bttvp.h,v 1.15 2004/12/14 15:33:30 kraxel Exp $ bttv - Bt848 frame grabber driver
@@ -43,6 +43,7 @@#include <media/video-buf.h> #include <media/audiochip.h> #include <media/tuner.h> +#include <media/tveeprom.h> #include <media/ir-common.h> #include "bt848.h"
@@ -224,11 +225,6 @@ extern unsigned int bttv_gpio;extern void bttv_gpio_tracking (struct bttv *btv,char *comment);extern int init_bttv_i2c (struct bttv *btv);extern int fini_bttv_i2c (struct bttv *btv); -extern int pvr_boot (struct bttv *btv); - -extern int bttv_common_ioctls (struct bttv *btv,unsigned int cmd,void *arg); -extern void bttv_reinit_bt848 (struct bttv *btv); -extern void bttv_field_count (struct bttv *btv);#define vprintk if (bttv_verbose) printk#define dprintk if (bttv_debug >= 1) printk
drivers/media/video/bttv-driver.c +14 -7
@@ -1,5 +1,5 @@/* -$Id: bttv-driver.c,v 1.27 2004/11/07 14:44:59 kraxel Exp $ +$Id: bttv-driver.c,v 1.34 2005/01/07 13:11:19 kraxel Exp $ bttv - Bt848 frame grabber driver
@@ -27,6 +27,7 @@#include <linux/init.h> #include <linux/module.h> +#include <linux/moduleparam.h> #include <linux/delay.h> #include <linux/errno.h> #include <linux/fs.h>
@@ -105,6 +106,7 @@ module_param(adc_crush, int, 044module_param (whitecrush_upper, int,0444 );module_param (whitecrush_lower, int,0444 );module_param (vcr_hack, int,0444 ); +module_param_array (radio, int,NULL ,0444 );MODULE_PARM_DESC (radio,"The TV card supports radio, default is 0 (no)" );
@@ -1063,7 +1065,7 @@ static void init_bt848(struct bttv *btv)init_irqreg (btv); } -void bttv_reinit_bt848 (struct bttv *btv) +static void bttv_reinit_bt848 (struct bttv *btv) {unsigned long flags;
@@ -1267,7 +1269,7 @@ void bttv_gpio_tracking(struct bttv *btv btv->c.nr,outbits,data & outbits, data & ~outbits, comment); } -void bttv_field_count (struct bttv *btv) +static void bttv_field_count (struct bttv *btv) {int need_count =0 ;
@@ -1467,7 +1469,7 @@ static const char *v4l1_ioctls[] = { "SMICROCODE", "GVBIFMT", "SVBIFMT" };#define V4L1_IOCTLS ARRAY_SIZE(v4l1_ioctls) -int bttv_common_ioctls (struct bttv *btv,unsigned int cmd,void *arg) +static int bttv_common_ioctls (struct bttv *btv,unsigned int cmd,void *arg) {switch (cmd) {case BTTV_VERSION :
@@ -2531,9 +2533,11 @@ static int bttv_do_ioctl(struct inode *iV4L2_CAP_VIDEO_CAPTURE |V4L2_CAP_VIDEO_OVERLAY |V4L2_CAP_VBI_CAPTURE | -V4L2_CAP_TUNER |V4L2_CAP_READWRITE |V4L2_CAP_STREAMING ; +if (bttv_tvcards[btv->c.type].tuner !=UNSET && + bttv_tvcards[btv->c.type].tuner !=TUNER_ABSENT ) + cap->capabilities |=V4L2_CAP_TUNER ;return 0 ; }
@@ -2988,6 +2992,9 @@ static int bttv_release(struct inode *infree_btres (btv,fh,RESOURCE_VBI ); } +/* free stuff */ +videobuf_mmap_free (&fh->cap); +videobuf_mmap_free (&fh->vbi);v4l2_prio_close (&btv->prio,&fh->prio); file->private_data =NULL ;kfree (fh);
@@ -3717,8 +3724,8 @@ static int __devinit bttv_probe(struct p/* initialize structs / fill in defaults */ init_MUTEX (&btv->lock);init_MUTEX (&btv->reslock); - btv->s_lock =SPIN_LOCK_UNLOCKED ; - btv->gpio_lock =SPIN_LOCK_UNLOCKED ; +spin_lock_init (&btv->s_lock); +spin_lock_init (&btv->gpio_lock);init_waitqueue_head (&btv->gpioq);init_waitqueue_head (&btv->i2c_queue);INIT_LIST_HEAD (&btv->c.subs);
drivers/media/video/bttv-cards.c +106 -97
339 lines not on this page · raw message
drivers/media/video/bttv-if.c +12 -2
@@ -1,5 +1,5 @@/* -$Id: bttv-if.c,v 1.3 2004/10/13 10:39:00 kraxel Exp $ +$Id: bttv-if.c,v 1.4 2004/11/17 18:47:47 kraxel Exp $ bttv-if.c -- old gpio interface to other kernel modules don't use in new code, will go away in 2.7
@@ -50,6 +50,8 @@ EXPORT_SYMBOL(bttv_i2c_call);int bttv_get_cardinfo (unsigned int card,int *type,unsigned *cardid) { +printk ("The bttv_* interface is obsolete and will go away,\n" +"please use the new, sysfs based interface instead.\n" );if (card >= bttv_num) {return -1 ; }
@@ -67,7 +69,8 @@ struct pci_dev* bttv_get_pcidev(unsignedint bttv_get_id (unsigned int card) { -printk ("bttv_get_id is obsolete, use bttv_get_cardinfo instead\n" ); +printk ("The bttv_* interface is obsolete and will go away,\n" +"please use the new, sysfs based interface instead.\n" );if (card >= bttv_num) {return -1 ; }
@@ -143,6 +146,13 @@ wait_queue_head_t* bttv_get_gpio_queue(ureturn &btv->gpioq; } +void bttv_i2c_call (unsigned int card,unsigned int cmd,void *arg) +{ +if (card >= bttv_num) +return ; +bttv_call_i2c_clients (&bttvs[card], cmd, arg); +} +/* * Local variables: * c-basic-offset: 8
drivers/media/video/bttv-risc.c +1 -1
@@ -1,5 +1,5 @@/* -$Id: bttv-risc.c,v 1.9 2004/10/13 10:39:00 kraxel Exp $ +$Id: bttv-risc.c,v 1.10 2004/11/19 18:07:12 kraxel Exp $ bttv-risc.c -- interfaces to other kernel modules
drivers/media/video/bttv-i2c.c +3 -20
@@ -1,5 +1,5 @@/* -$Id: bttv-i2c.c,v 1.13 2004/11/07 13:17:15 kraxel Exp $ +$Id: bttv-i2c.c,v 1.17 2004/12/14 15:33:30 kraxel Exp $ bttv-i2c.c -- all the i2c code is here
@@ -26,6 +26,7 @@*/ #include <linux/module.h> +#include <linux/moduleparam.h> #include <linux/init.h> #include <linux/delay.h> #include <asm/io.h>
@@ -327,13 +328,6 @@ void bttv_call_i2c_clients(struct bttv *i2c_clients_command (&btv->c.i2c_adap, cmd, arg); } -void bttv_i2c_call (unsigned int card,unsigned int cmd,void *arg) -{ -if (card >= bttv_num) -return ; -bttv_call_i2c_clients (&bttvs[card], cmd, arg); -} -static struct i2c_client bttv_i2c_client_template = {I2C_DEVNAME ("bttv internal" ), .id =-1 ,
@@ -385,19 +379,8 @@ int bttv_I2CWrite(struct bttv *btv, unsi/* read EEPROM content */ void __devinit bttv_readee (struct bttv *btv,unsigned char *eedata,int addr) { -int i; - -if (bttv_I2CWrite (btv, addr,0 ,-1 ,0 )<0 ) { -printk (KERN_WARNING "bttv: readee error\n" ); -return ; - } btv->i2c_client.addr = addr >>1 ; -for (i=0 ; i<256 ; i+=16 ) { -if (16 !=i2c_master_recv (&btv->i2c_client,eedata+i,16 )) { -printk (KERN_WARNING "bttv: readee error\n" ); -break ; - } - } +tveeprom_read (&btv->i2c_client, eedata,256 ); }static char *i2c_devs[128 ] = {
drivers/media/video/bttv-vbi.c +3 -2
@@ -1,5 +1,5 @@/* -$Id: bttv-vbi.c,v 1.7 2004/11/07 13:17:15 kraxel Exp $ +$Id: bttv-vbi.c,v 1.9 2005/01/13 17:22:33 kraxel Exp $ bttv - Bt848 frame grabber driver vbi interface
@@ -22,6 +22,7 @@*/ #include <linux/module.h> +#include <linux/moduleparam.h> #include <linux/errno.h> #include <linux/fs.h> #include <linux/kernel.h>
@@ -182,7 +183,7 @@ void bttv_vbi_try_fmt(struct bttv_fh *fhcase 2 :/* SECAM */ default : start0 =7 ; - start1 =319 ; + start1 =320 ; } count0 = (f->fmt.vbi.start[0 ] + f->fmt.vbi.count[0 ]) - start0;
drivers/media/video/btcx-risc.c +2 -1
@@ -1,5 +1,5 @@/* -$Id: btcx-risc.c,v 1.4 2004/11/07 13:17:14 kraxel Exp $ +$Id: btcx-risc.c,v 1.5 2004/12/10 12:33:39 kraxel Exp $ btcx-risc.c
@@ -24,6 +24,7 @@*/ #include <linux/module.h> +#include <linux/moduleparam.h> #include <linux/init.h> #include <linux/pci.h> #include <linux/interrupt.h>
drivers/media/video/Kconfig +1 -0
@@ -16,6 +16,7 @@ config VIDEO_BT848 select VIDEO_BUF select VIDEO_IR select VIDEO_TUNER + select VIDEO_TVEEPROM ---help--- Support for BT848 based frame grabber/overlay boards. This includes the Miro, Hauppauge and STB boards. Please read the material in
Signature · 1 line
#define printk(args...) fprintf(stderr, ## args)