diff options
Diffstat (limited to 'linux/drivers/media/video/bttv-driver.c')
-rw-r--r-- | linux/drivers/media/video/bttv-driver.c | 48 |
1 files changed, 28 insertions, 20 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) |