diff options
-rw-r--r-- | linux/drivers/media/video/bttv-driver.c | 48 | ||||
-rw-r--r-- | linux/drivers/media/video/bttv-i2c.c | 31 | ||||
-rw-r--r-- | linux/drivers/media/video/bttv-risc.c | 30 | ||||
-rw-r--r-- | linux/drivers/media/video/bttv-vbi.c | 6 | ||||
-rw-r--r-- | linux/drivers/media/video/bttvp.h | 10 | ||||
-rw-r--r-- | linux/drivers/media/video/cx88/cx88-i2c.c | 36 | ||||
-rw-r--r-- | linux/drivers/media/video/saa7134/saa7134-i2c.c | 25 | ||||
-rw-r--r-- | v4l/scripts/update | 12 |
8 files changed, 137 insertions, 61 deletions
diff --git a/linux/drivers/media/video/bttv-driver.c b/linux/drivers/media/video/bttv-driver.c index 9e907b251..7bb08705a 100644 --- a/linux/drivers/media/video/bttv-driver.c +++ b/linux/drivers/media/video/bttv-driver.c @@ -1,5 +1,5 @@ /* - $Id: bttv-driver.c,v 1.17 2004/09/30 12:21:15 kraxel Exp $ + $Id: bttv-driver.c,v 1.18 2004/10/06 17:30:51 kraxel Exp $ bttv - Bt848 frame grabber driver @@ -982,7 +982,7 @@ set_input(struct bttv *btv, unsigned int input) btv->input = input; if (irq_iswitch) { spin_lock_irqsave(&btv->s_lock,flags); - if (btv->curr.irqflags) { + if (btv->curr.frame_irq) { /* active capture -> delayed input switch */ btv->new_input = input; } else { @@ -1079,7 +1079,7 @@ void bttv_reinit_bt848(struct bttv *btv) printk(KERN_INFO "bttv%d: reset, reinitialize\n",btv->c.nr); spin_lock_irqsave(&btv->s_lock,flags); btv->errors=0; - bttv_set_dma(btv,0,0); + bttv_set_dma(btv,0); spin_unlock_irqrestore(&btv->s_lock,flags); init_bt848(btv); @@ -1337,8 +1337,8 @@ bttv_switch_overlay(struct bttv *btv, struct bttv_fh *fh, spin_lock_irqsave(&btv->s_lock,flags); old = btv->screen; btv->screen = new; - btv->curr.irqflags |= 1; - bttv_set_dma(btv, 0x03, btv->curr.irqflags); + btv->loop_irq |= 1; + bttv_set_dma(btv, 0x03); spin_unlock_irqrestore(&btv->s_lock,flags); if (NULL == new) free_btres(btv,fh,RESOURCE_OVERLAY); @@ -1442,11 +1442,14 @@ buffer_queue(void *priv, struct videobuf_buffer *vb) { struct bttv_buffer *buf = (struct bttv_buffer*)vb; struct bttv_fh *fh = priv; + struct bttv *btv = fh->btv; buf->vb.state = STATE_QUEUED; - list_add_tail(&buf->vb.queue,&fh->btv->capture); - fh->btv->curr.irqflags |= 1; - bttv_set_dma(fh->btv, 0x03, fh->btv->curr.irqflags); + list_add_tail(&buf->vb.queue,&btv->capture); + if (NULL == btv->curr.top && NULL == btv->curr.bottom) { + btv->loop_irq |= 1; + bttv_set_dma(btv, 0x03); + } } static void buffer_release(void *priv, struct videobuf_buffer *vb) @@ -3258,7 +3261,7 @@ bttv_irq_next_video(struct bttv *btv, struct bttv_buffer_set *set) /* capture request ? */ if (!list_empty(&btv->capture)) { - set->irqflags = 1; + set->frame_irq = 1; item = list_entry(btv->capture.next, struct bttv_buffer, vb.queue); if (V4L2_FIELD_HAS_TOP(item->vb.field)) set->top = item; @@ -3279,7 +3282,7 @@ bttv_irq_next_video(struct bttv *btv, struct bttv_buffer_set *set) set->bottom = item; } if (NULL != set->top && NULL != set->bottom) - set->topirq = 2; + set->top_irq = 2; } } } @@ -3305,7 +3308,7 @@ bttv_irq_next_video(struct bttv *btv, struct bttv_buffer_set *set) dprintk("bttv%d: next set: top=%p bottom=%p [screen=%p,irq=%d,%d]\n", btv->c.nr,set->top, set->bottom, - btv->screen,set->irqflags,set->topirq); + btv->screen,set->frame_irq,set->top_irq); return 0; } @@ -3386,9 +3389,10 @@ static void bttv_irq_timeout(unsigned long data) ovbi = btv->cvbi; btv->curr = new; btv->cvbi = NULL; + btv->loop_irq = 0; bttv_buffer_activate_video(btv, &new); bttv_buffer_activate_vbi(btv, NULL); - bttv_set_dma(btv, 0, 0); + bttv_set_dma(btv, 0); /* wake up */ bttv_irq_wakeup_video(btv, &old, &new, STATE_ERROR); @@ -3421,7 +3425,7 @@ bttv_irq_wakeup_top(struct bttv *btv) return; spin_lock(&btv->s_lock); - btv->curr.topirq = 0; + btv->curr.top_irq = 0; btv->curr.top = NULL; bttv_risc_hook(btv, RISC_SLOT_O_FIELD, NULL, 0); @@ -3465,8 +3469,9 @@ bttv_irq_switch_video(struct bttv *btv) /* switch over */ old = btv->curr; btv->curr = new; + btv->loop_irq &= ~1; bttv_buffer_activate_video(btv, &new); - bttv_set_dma(btv, 0, new.irqflags); + bttv_set_dma(btv, 0); /* switch input */ if (UNSET != btv->new_input) { @@ -3504,8 +3509,9 @@ bttv_irq_switch_vbi(struct bttv *btv) /* switch */ btv->cvbi = new; + btv->loop_irq &= ~4; bttv_buffer_activate_vbi(btv, new); - bttv_set_dma(btv, 0, btv->curr.irqflags); + bttv_set_dma(btv, 0); bttv_irq_wakeup_vbi(btv, old, STATE_DONE); spin_unlock(&btv->s_lock); @@ -3951,10 +3957,12 @@ static int bttv_suspend(struct pci_dev *pci_dev, u32 state) memset(&idle, 0, sizeof(idle)); btv->state.video = btv->curr; btv->state.vbi = btv->cvbi; + btv->state.loop_irq = btv->loop_irq; btv->curr = idle; + btv->loop_irq = 0; bttv_buffer_activate_video(btv, &idle); bttv_buffer_activate_vbi(btv, NULL); - bttv_set_dma(btv, 0, 0); + bttv_set_dma(btv, 0); btwrite(0, BT848_INT_MASK); spin_unlock_irqrestore(&btv->s_lock,flags); @@ -3995,9 +4003,10 @@ static int bttv_resume(struct pci_dev *pci_dev) spin_lock_irqsave(&btv->s_lock,flags); btv->curr = btv->state.video; btv->cvbi = btv->state.vbi; + btv->loop_irq = btv->state.loop_irq; bttv_buffer_activate_video(btv, &btv->curr); bttv_buffer_activate_vbi(btv, btv->cvbi); - bttv_set_dma(btv, 0, btv->curr.irqflags); + bttv_set_dma(btv, 0); spin_unlock_irqrestore(&btv->s_lock,flags); return 0; } @@ -4021,9 +4030,8 @@ static struct pci_driver bttv_pci_driver = { .id_table = bttv_pci_tbl, .probe = bttv_probe, .remove = __devexit_p(bttv_remove), - - .suspend = bttv_suspend, - .resume = bttv_resume, + .suspend = bttv_suspend, + .resume = bttv_resume, }; static int bttv_init_module(void) diff --git a/linux/drivers/media/video/bttv-i2c.c b/linux/drivers/media/video/bttv-i2c.c index 8880d872f..7b1d07ef3 100644 --- a/linux/drivers/media/video/bttv-i2c.c +++ b/linux/drivers/media/video/bttv-i2c.c @@ -1,5 +1,5 @@ /* - $Id: bttv-i2c.c,v 1.9 2004/10/05 12:57:08 kraxel Exp $ + $Id: bttv-i2c.c,v 1.10 2004/10/06 17:30:51 kraxel Exp $ bttv-i2c.c -- all the i2c code is here @@ -46,8 +46,11 @@ static int detach_inform(struct i2c_client *client); static int i2c_debug = 0; static int i2c_hw = 0; +static int i2c_scan = 0; MODULE_PARM(i2c_debug,"i"); MODULE_PARM(i2c_hw,"i"); +MODULE_PARM(i2c_scan,"i"); +MODULE_PARM_DESC(i2c_scan,"scan i2c bus at insmod time"); /* ----------------------------------------------------------------------- */ /* I2C functions - bitbanging adapter (software i2c) */ @@ -427,6 +430,30 @@ void __devinit bttv_readee(struct bttv *btv, unsigned char *eedata, int addr) } } +static char *i2c_devs[128] = { + [ 0x30 >> 1 ] = "IR (hauppauge)", + [ 0x80 >> 1 ] = "msp34xx", + [ 0x86 >> 1 ] = "tda9887", + [ 0xa0 >> 1 ] = "eeprom", + [ 0xc0 >> 1 ] = "tuner (analog)", + [ 0xc2 >> 1 ] = "tuner (analog)", +}; + +static void do_i2c_scan(char *name, struct i2c_client *c) +{ + unsigned char buf; + int i,rc; + + for (i = 0; i < 128; i++) { + c->addr = i; + rc = i2c_master_recv(c,&buf,0); + if (rc < 0) + continue; + printk("%s: i2c scan: found device @ 0x%x [%s]\n", + name, i << 1, i2c_devs[i] ? i2c_devs[i] : "???"); + } +} + /* init + register i2c algo-bit adapter */ int __devinit init_bttv_i2c(struct bttv *btv) { @@ -473,6 +500,8 @@ int __devinit init_bttv_i2c(struct bttv *btv) bttv_bit_setsda(btv,1); btv->i2c_rc = i2c_bit_add_bus(&btv->c.i2c_adap); } + if (0 == btv->i2c_rc && i2c_scan) + do_i2c_scan(btv->c.name,&btv->i2c_client); return btv->i2c_rc; } diff --git a/linux/drivers/media/video/bttv-risc.c b/linux/drivers/media/video/bttv-risc.c index fd0cf227e..a9206afcd 100644 --- a/linux/drivers/media/video/bttv-risc.c +++ b/linux/drivers/media/video/bttv-risc.c @@ -1,5 +1,5 @@ /* - $Id: bttv-risc.c,v 1.7 2004/09/16 07:05:48 kraxel Exp $ + $Id: bttv-risc.c,v 1.8 2004/10/06 17:30:51 kraxel Exp $ bttv-risc.c -- interfaces to other kernel modules @@ -391,7 +391,7 @@ bttv_apply_geo(struct bttv *btv, struct bttv_geometry *geo, int odd) /* risc group / risc main loop / dma management */ void -bttv_set_dma(struct bttv *btv, int override, int irqflags) +bttv_set_dma(struct bttv *btv, int override) { unsigned long cmd; int capctl; @@ -407,20 +407,20 @@ bttv_set_dma(struct bttv *btv, int override, int irqflags) capctl |= override; d2printk(KERN_DEBUG - "bttv%d: capctl=%x irq=%d top=%08Lx/%08Lx even=%08Lx/%08Lx\n", - btv->c.nr,capctl,irqflags, + "bttv%d: capctl=%x lirq=%d top=%08Lx/%08Lx even=%08Lx/%08Lx\n", + btv->c.nr,capctl,btv->loop_irq, btv->cvbi ? (unsigned long long)btv->cvbi->top.dma : 0, btv->curr.top ? (unsigned long long)btv->curr.top->top.dma : 0, btv->cvbi ? (unsigned long long)btv->cvbi->bottom.dma : 0, btv->curr.bottom ? (unsigned long long)btv->curr.bottom->bottom.dma : 0); cmd = BT848_RISC_JUMP; - if (irqflags) { + if (btv->loop_irq) { cmd |= BT848_RISC_IRQ; - cmd |= (irqflags & 0x0f) << 16; - cmd |= (~irqflags & 0x0f) << 20; + cmd |= (btv->loop_irq & 0x0f) << 16; + cmd |= (~btv->loop_irq & 0x0f) << 20; } - if (irqflags || btv->cvbi) { + if (btv->curr.frame_irq || btv->loop_irq || btv->cvbi) { mod_timer(&btv->timeout, jiffies+BTTV_TIMEOUT); } else { del_timer(&btv->timeout); @@ -559,8 +559,10 @@ bttv_buffer_activate_video(struct bttv *btv, } bttv_apply_geo(btv, &set->top->geo, 1); bttv_apply_geo(btv, &set->bottom->geo,0); - bttv_risc_hook(btv, RISC_SLOT_O_FIELD, &set->top->top, set->topirq); - bttv_risc_hook(btv, RISC_SLOT_E_FIELD, &set->bottom->bottom, 0); + bttv_risc_hook(btv, RISC_SLOT_O_FIELD, &set->top->top, + set->top_irq); + bttv_risc_hook(btv, RISC_SLOT_E_FIELD, &set->bottom->bottom, + set->frame_irq); btaor((set->top->btformat & 0xf0) | (set->bottom->btformat & 0x0f), ~0xff, BT848_COLOR_FMT); btaor((set->top->btswap & 0x0a) | (set->bottom->btswap & 0x05), @@ -571,7 +573,8 @@ bttv_buffer_activate_video(struct bttv *btv, list_del(&set->top->vb.queue); bttv_apply_geo(btv, &set->top->geo,1); bttv_apply_geo(btv, &set->top->geo,0); - bttv_risc_hook(btv, RISC_SLOT_O_FIELD, &set->top->top, 0); + bttv_risc_hook(btv, RISC_SLOT_O_FIELD, &set->top->top, + set->frame_irq); bttv_risc_hook(btv, RISC_SLOT_E_FIELD, NULL, 0); btaor(set->top->btformat & 0xff, ~0xff, BT848_COLOR_FMT); btaor(set->top->btswap & 0x0f, ~0x0f, BT848_COLOR_CTL); @@ -581,8 +584,9 @@ bttv_buffer_activate_video(struct bttv *btv, list_del(&set->bottom->vb.queue); bttv_apply_geo(btv, &set->bottom->geo,1); bttv_apply_geo(btv, &set->bottom->geo,0); - bttv_risc_hook(btv, RISC_SLOT_O_FIELD, NULL, 0); - bttv_risc_hook(btv, RISC_SLOT_E_FIELD, &set->bottom->bottom, 0); + bttv_risc_hook(btv, RISC_SLOT_O_FIELD, NULL, 0); + bttv_risc_hook(btv, RISC_SLOT_E_FIELD, &set->bottom->bottom, + set->frame_irq); btaor(set->bottom->btformat & 0xff, ~0xff, BT848_COLOR_FMT); btaor(set->bottom->btswap & 0x0f, ~0x0f, BT848_COLOR_CTL); } else { diff --git a/linux/drivers/media/video/bttv-vbi.c b/linux/drivers/media/video/bttv-vbi.c index 5dcbfd854..77365b45f 100644 --- a/linux/drivers/media/video/bttv-vbi.c +++ b/linux/drivers/media/video/bttv-vbi.c @@ -1,5 +1,5 @@ /* - $Id: bttv-vbi.c,v 1.4 2004/09/23 13:58:19 kraxel Exp $ + $Id: bttv-vbi.c,v 1.5 2004/10/06 17:30:51 kraxel Exp $ bttv - Bt848 frame grabber driver vbi interface @@ -117,8 +117,8 @@ vbi_buffer_queue(void *priv, struct videobuf_buffer *vb) buf->vb.state = STATE_QUEUED; list_add_tail(&buf->vb.queue,&btv->vcapture); if (NULL == btv->cvbi) { - fh->btv->curr.irqflags |= 4; - bttv_set_dma(btv,0x0c,fh->btv->curr.irqflags); + fh->btv->loop_irq |= 4; + bttv_set_dma(btv,0x0c); } } diff --git a/linux/drivers/media/video/bttvp.h b/linux/drivers/media/video/bttvp.h index 0e5152d7e..d7f6a26b7 100644 --- a/linux/drivers/media/video/bttvp.h +++ b/linux/drivers/media/video/bttvp.h @@ -1,5 +1,5 @@ /* - $Id: bttvp.h,v 1.9 2004/09/15 16:15:24 kraxel Exp $ + $Id: bttvp.h,v 1.10 2004/10/06 17:30:51 kraxel Exp $ bttv - Bt848 frame grabber driver @@ -139,8 +139,8 @@ struct bttv_buffer { struct bttv_buffer_set { struct bttv_buffer *top; /* top field buffer */ struct bttv_buffer *bottom; /* bottom field buffer */ - unsigned int irqflags; - unsigned int topirq; + unsigned int top_irq; + unsigned int frame_irq; }; struct bttv_overlay { @@ -201,7 +201,7 @@ void bttv_calc_geo(struct bttv *btv, struct bttv_geometry *geo, void bttv_apply_geo(struct bttv *btv, struct bttv_geometry *geo, int top); /* control dma register + risc main loop */ -void bttv_set_dma(struct bttv *btv, int override, int irqflags); +void bttv_set_dma(struct bttv *btv, int override); int bttv_risc_init_main(struct bttv *btv); int bttv_risc_hook(struct bttv *btv, int slot, struct btcx_riscmem *risc, int irqflags); @@ -295,6 +295,7 @@ struct bttv_suspend_state { u32 gpio_enable; u32 gpio_data; int disabled; + int loop_irq; struct bttv_buffer_set video; struct bttv_buffer *vbi; }; @@ -395,6 +396,7 @@ struct bttv { struct list_head vcapture; /* vbi capture queue */ struct bttv_buffer_set curr; /* active buffers */ struct bttv_buffer *cvbi; /* active vbi buffer */ + int loop_irq; int new_input; unsigned long cap_ctl; diff --git a/linux/drivers/media/video/cx88/cx88-i2c.c b/linux/drivers/media/video/cx88/cx88-i2c.c index da49619c0..7d2c0f00e 100644 --- a/linux/drivers/media/video/cx88/cx88-i2c.c +++ b/linux/drivers/media/video/cx88/cx88-i2c.c @@ -1,5 +1,5 @@ /* - $Id: cx88-i2c.c,v 1.14 2004/09/23 13:58:19 kraxel Exp $ + $Id: cx88-i2c.c,v 1.15 2004/10/06 17:30:51 kraxel Exp $ cx88-i2c.c -- all the i2c code is here @@ -35,6 +35,10 @@ static unsigned int i2c_debug = 0; MODULE_PARM(i2c_debug,"i"); MODULE_PARM_DESC(i2c_debug,"enable debug messages [i2c]"); +static unsigned int i2c_scan = 0; +MODULE_PARM(i2c_scan,"i"); +MODULE_PARM_DESC(i2c_scan,"scan i2c bus at insmod time"); + #define dprintk(level,fmt, arg...) if (i2c_debug >= level) \ printk(KERN_DEBUG "%s: " fmt, core->name , ## arg) @@ -140,6 +144,28 @@ static struct i2c_client cx8800_i2c_client_template = { .id = -1, }; +static char *i2c_devs[128] = { + [ 0x86 >> 1 ] = "tda9887/cx22702", + [ 0xa0 >> 1 ] = "eeprom", + [ 0xc0 >> 1 ] = "tuner (analog)", + [ 0xc2 >> 1 ] = "tuner (analog/dvb)", +}; + +static void do_i2c_scan(char *name, struct i2c_client *c) +{ + unsigned char buf; + int i,rc; + + for (i = 0; i < 128; i++) { + c->addr = i; + rc = i2c_master_recv(c,&buf,0); + if (rc < 0) + continue; + printk("%s: i2c scan: found device @ 0x%x [%s]\n", + name, i << 1, i2c_devs[i] ? i2c_devs[i] : "???"); + } +} + /* init + register i2c algo-bit adapter */ int cx88_i2c_init(struct cx88_core *core, struct pci_dev *pci) { @@ -166,10 +192,12 @@ int cx88_i2c_init(struct cx88_core *core, struct pci_dev *pci) cx8800_bit_setsda(core,1); core->i2c_rc = i2c_bit_add_bus(&core->i2c_adap); - if (0 != core->i2c_rc) - printk("%s: i2c register FAILED\n", core->name); - else + if (0 == core->i2c_rc) { dprintk(1, "i2c register ok\n"); + if (i2c_scan) + do_i2c_scan(core->name,&core->i2c_client); + } else + printk("%s: i2c register FAILED\n", core->name); return core->i2c_rc; } diff --git a/linux/drivers/media/video/saa7134/saa7134-i2c.c b/linux/drivers/media/video/saa7134/saa7134-i2c.c index 05fa0bb67..7a7ed31ee 100644 --- a/linux/drivers/media/video/saa7134/saa7134-i2c.c +++ b/linux/drivers/media/video/saa7134/saa7134-i2c.c @@ -1,5 +1,5 @@ /* - * $Id: saa7134-i2c.c,v 1.4 2004/09/15 16:15:24 kraxel Exp $ + * $Id: saa7134-i2c.c,v 1.5 2004/10/06 17:30:51 kraxel Exp $ * * device driver for philips saa7134 based TV cards * i2c interface support @@ -395,21 +395,26 @@ saa7134_i2c_eeprom(struct saa7134_dev *dev, unsigned char *eedata, int len) return 0; } -static int -saa7134_i2c_scan(struct saa7134_dev *dev) +static char *i2c_devs[128] = { + [ 0x20 ] = "mpeg encoder (saa6752hs)", + [ 0xa0 >> 1 ] = "eeprom", + [ 0xc0 >> 1 ] = "tuner (analog)", + [ 0x86 >> 1 ] = "tda9887", +}; + +static void do_i2c_scan(char *name, struct i2c_client *c) { unsigned char buf; int i,rc; - for (i = 0; i < 256; i+= 2) { - dev->i2c_client.addr = i >> 1; - rc = i2c_master_recv(&dev->i2c_client,&buf,0); + for (i = 0; i < 128; i++) { + c->addr = i; + rc = i2c_master_recv(c,&buf,0); if (rc < 0) continue; - printk("%s: i2c scan: found device @ %x%s\n", - dev->name, i, (i == 0xa0) ? " [eeprom]" : ""); + printk("%s: i2c scan: found device @ 0x%x [%s]\n", + name, i << 1, i2c_devs[i] ? i2c_devs[i] : "???"); } - return 0; } void saa7134_i2c_call_clients(struct saa7134_dev *dev, @@ -434,7 +439,7 @@ int saa7134_i2c_register(struct saa7134_dev *dev) saa7134_i2c_eeprom(dev,dev->eedata,sizeof(dev->eedata)); if (i2c_scan) - saa7134_i2c_scan(dev); + do_i2c_scan(dev->name,&dev->i2c_client); return 0; } diff --git a/v4l/scripts/update b/v4l/scripts/update index 2b7e5cc99..a79a46fe2 100644 --- a/v4l/scripts/update +++ b/v4l/scripts/update @@ -54,22 +54,22 @@ xrmmod tda9887 # common v4l2basic -xinsmod video-buf debug=2 +xinsmod video-buf debug=0 xinsmod btcx-risc debug=0 xinsmod ir-common debug=0 repeat=0 -xinsmod tuner debug=1 -xinsmod tda9887 debug=1 +xinsmod tuner debug=0 +xinsmod tda9887 debug=0 xinsmod msp3400 debug=0 # bttv xinsmod bttv bttv_debug=0 vbi_debug=0 irq_debug=0 \ - fdsr=0 chroma_agc=1 vbibufs=4 irq_iswitch=0 $btopt + fdsr=0 chroma_agc=1 vbibufs=4 irq_iswitch=0 i2c_scan=1 $btopt test -f ir-kbd-i2c.ko && xinsmod ir-kbd-i2c debug=0 test -f ir-kbd-gpio.ko && xinsmod ir-kbd-gpio debug=0 # cx88 xinsmod cx22702 debug=0 -xinsmod cx88xx core_debug=0 audio_debug=0 i2c_debug=0 +xinsmod cx88xx core_debug=0 audio_debug=0 i2c_debug=0 i2c_scan=1 xinsmod cx8800 video_debug=0 xinsmod cx8801 xinsmod cx8802 @@ -77,4 +77,4 @@ xinsmod cx88-blackbird xinsmod cx88-dvb # saa7134 -xinsmod saa7134 audio_debug=1 $saopt +xinsmod saa7134 audio_debug=1 i2c_scan=1 $saopt |