diff options
author | Gerd Knorr <devnull@localhost> | 2004-04-13 17:00:41 +0000 |
---|---|---|
committer | Gerd Knorr <devnull@localhost> | 2004-04-13 17:00:41 +0000 |
commit | e5af0c3968caf20aa8270ba0ec5b9d1e447b4f61 (patch) | |
tree | f3854a9505c4a8b8beebd281de429baa1637b374 /linux/drivers/media | |
parent | 8c41c763f28ab70519fc5eb562d590693fa92446 (diff) | |
download | mediapointer-dvb-s2-e5af0c3968caf20aa8270ba0ec5b9d1e447b4f61.tar.gz mediapointer-dvb-s2-e5af0c3968caf20aa8270ba0ec5b9d1e447b4f61.tar.bz2 |
- bttv: splitted video + vbi buffer switching, that should make bttv
less sensitive to IRQ latencies.
- saa7134: new card added, minor saa7133 fixes (by toshii@netbsd.org).
Diffstat (limited to 'linux/drivers/media')
-rw-r--r-- | linux/drivers/media/video/bttv-driver.c | 129 | ||||
-rw-r--r-- | linux/drivers/media/video/bttv-risc.c | 28 | ||||
-rw-r--r-- | linux/drivers/media/video/bttv-vbi.c | 5 | ||||
-rw-r--r-- | linux/drivers/media/video/bttvp.h | 11 | ||||
-rw-r--r-- | linux/drivers/media/video/saa7134/saa7134-cards.c | 20 | ||||
-rw-r--r-- | linux/drivers/media/video/saa7134/saa7134-oss.c | 2 | ||||
-rw-r--r-- | linux/drivers/media/video/saa7134/saa7134-tvaudio.c | 9 | ||||
-rw-r--r-- | linux/drivers/media/video/saa7134/saa7134.h | 1 |
8 files changed, 151 insertions, 54 deletions
diff --git a/linux/drivers/media/video/bttv-driver.c b/linux/drivers/media/video/bttv-driver.c index 476f0d096..3e5c3a7b5 100644 --- a/linux/drivers/media/video/bttv-driver.c +++ b/linux/drivers/media/video/bttv-driver.c @@ -1336,7 +1336,8 @@ bttv_switch_overlay(struct bttv *btv, struct bttv_fh *fh, spin_lock_irqsave(&btv->s_lock,flags); old = btv->screen; btv->screen = new; - bttv_set_dma(btv, 0x03, 1); + btv->curr.irqflags |= 1; + bttv_set_dma(btv, 0x03, btv->curr.irqflags); spin_unlock_irqrestore(&btv->s_lock,flags); if (NULL == new) free_btres(btv,fh,RESOURCE_OVERLAY); @@ -1443,7 +1444,8 @@ buffer_queue(struct file *file, struct videobuf_buffer *vb) buf->vb.state = STATE_QUEUED; list_add_tail(&buf->vb.queue,&fh->btv->capture); - bttv_set_dma(fh->btv, 0x03, 1); + fh->btv->curr.irqflags |= 1; + bttv_set_dma(fh->btv, 0x03, fh->btv->curr.irqflags); } static void buffer_release(struct file *file, struct videobuf_buffer *vb) @@ -3205,8 +3207,8 @@ static void bttv_print_riscaddr(struct bttv *btv) printk(" main: %08Lx\n", (unsigned long long)btv->main.dma); printk(" vbi : o=%08Lx e=%08Lx\n", - btv->curr.vbi ? (unsigned long long)btv->curr.vbi->top.dma : 0, - btv->curr.vbi ? (unsigned long long)btv->curr.vbi->bottom.dma : 0); + btv->cvbi ? (unsigned long long)btv->cvbi->top.dma : 0, + btv->cvbi ? (unsigned long long)btv->cvbi->bottom.dma : 0); printk(" cap : o=%08Lx e=%08Lx\n", btv->curr.top ? (unsigned long long)btv->curr.top->top.dma : 0, btv->curr.bottom ? (unsigned long long)btv->curr.bottom->bottom.dma : 0); @@ -3238,18 +3240,12 @@ static void bttv_irq_debug_low_latency(struct bttv *btv, u32 rc) } static int -bttv_irq_next_set(struct bttv *btv, struct bttv_buffer_set *set) +bttv_irq_next_video(struct bttv *btv, struct bttv_buffer_set *set) { struct bttv_buffer *item; memset(set,0,sizeof(*set)); - /* vbi request ? */ - if (!list_empty(&btv->vcapture)) { - set->irqflags = 1; - set->vbi = list_entry(btv->vcapture.next, struct bttv_buffer, vb.queue); - } - /* capture request ? */ if (!list_empty(&btv->capture)) { set->irqflags = 1; @@ -3297,27 +3293,20 @@ bttv_irq_next_set(struct bttv *btv, struct bttv_buffer_set *set) } } - dprintk("bttv%d: next set: top=%p bottom=%p vbi=%p " - "[screen=%p,irq=%d,%d]\n", - btv->c.nr,set->top, set->bottom, set->vbi, + 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); return 0; } static void -bttv_irq_wakeup_set(struct bttv *btv, struct bttv_buffer_set *wakeup, - struct bttv_buffer_set *curr, unsigned int state) +bttv_irq_wakeup_video(struct bttv *btv, struct bttv_buffer_set *wakeup, + struct bttv_buffer_set *curr, unsigned int state) { struct timeval ts; do_gettimeofday(&ts); - if (NULL != wakeup->vbi) { - wakeup->vbi->vb.ts = ts; - wakeup->vbi->vb.field_count = btv->field_count; - wakeup->vbi->vb.state = state; - wake_up(&wakeup->vbi->vb.done); - } if (wakeup->top == wakeup->bottom) { if (NULL != wakeup->top && curr->top != wakeup->top) { if (irq_debug > 1) @@ -3347,10 +3336,27 @@ bttv_irq_wakeup_set(struct bttv *btv, struct bttv_buffer_set *wakeup, } } +static void +bttv_irq_wakeup_vbi(struct bttv *btv, struct bttv_buffer *wakeup, + unsigned int state) +{ + struct timeval ts; + + if (NULL == wakeup) + return; + + do_gettimeofday(&ts); + wakeup->vb.ts = ts; + wakeup->vb.field_count = btv->field_count; + wakeup->vb.state = state; + wake_up(&wakeup->vb.done); +} + static void bttv_irq_timeout(unsigned long data) { struct bttv *btv = (struct bttv *)data; struct bttv_buffer_set old,new; + struct bttv_buffer *ovbi; struct bttv_buffer *item; unsigned long flags; @@ -3366,13 +3372,17 @@ static void bttv_irq_timeout(unsigned long data) /* deactivate stuff */ memset(&new,0,sizeof(new)); - old = btv->curr; + old = btv->curr; + ovbi = btv->cvbi; btv->curr = new; - bttv_buffer_set_activate(btv, &new); + btv->cvbi = NULL; + bttv_buffer_activate_video(btv, &new); + bttv_buffer_activate_vbi(btv, NULL); bttv_set_dma(btv, 0, 0); /* wake up */ - bttv_irq_wakeup_set(btv, &old, &new, STATE_ERROR); + bttv_irq_wakeup_video(btv, &old, &new, STATE_ERROR); + bttv_irq_wakeup_vbi(btv, ovbi, STATE_ERROR); /* cancel all outstanding capture / vbi requests */ while (!list_empty(&btv->capture)) { @@ -3412,8 +3422,17 @@ bttv_irq_wakeup_top(struct bttv *btv) spin_unlock(&btv->s_lock); } +static inline int is_active(struct btcx_riscmem *risc, u32 rc) +{ + if (rc < risc->dma) + return 0; + if (rc > risc->dma + risc->size) + return 0; + return 1; +} + static void -bttv_irq_switch_fields(struct bttv *btv) +bttv_irq_switch_video(struct bttv *btv) { struct bttv_buffer_set new; struct bttv_buffer_set old; @@ -3422,9 +3441,10 @@ bttv_irq_switch_fields(struct bttv *btv) spin_lock(&btv->s_lock); /* new buffer set */ - bttv_irq_next_set(btv, &new); + bttv_irq_next_video(btv, &new); rc = btread(BT848_RISC_COUNT); - if (rc < btv->main.dma || rc > btv->main.dma + 0x100) { + if ((btv->curr.top && is_active(&btv->curr.top->top, rc)) || + (btv->curr.bottom && is_active(&btv->curr.bottom->bottom, rc))) { btv->framedrop++; if (debug_latency) bttv_irq_debug_low_latency(btv, rc); @@ -3435,7 +3455,7 @@ bttv_irq_switch_fields(struct bttv *btv) /* switch over */ old = btv->curr; btv->curr = new; - bttv_buffer_set_activate(btv, &new); + bttv_buffer_activate_video(btv, &new); bttv_set_dma(btv, 0, new.irqflags); /* switch input */ @@ -3445,7 +3465,39 @@ bttv_irq_switch_fields(struct bttv *btv) } /* wake up finished buffers */ - bttv_irq_wakeup_set(btv, &old, &new, STATE_DONE); + bttv_irq_wakeup_video(btv, &old, &new, STATE_DONE); + spin_unlock(&btv->s_lock); +} + +static void +bttv_irq_switch_vbi(struct bttv *btv) +{ + struct bttv_buffer *new = NULL; + struct bttv_buffer *old; + u32 rc; + + spin_lock(&btv->s_lock); + + if (!list_empty(&btv->vcapture)) + new = list_entry(btv->vcapture.next, struct bttv_buffer, vb.queue); + old = btv->cvbi; + + rc = btread(BT848_RISC_COUNT); + if (NULL != old && (is_active(&old->top, rc) || + is_active(&old->bottom, rc))) { + btv->framedrop++; + if (debug_latency) + bttv_irq_debug_low_latency(btv, rc); + spin_unlock(&btv->s_lock); + return; + } + + /* switch */ + btv->cvbi = new; + bttv_buffer_activate_vbi(btv, new); + bttv_set_dma(btv, 0, btv->curr.irqflags); + + bttv_irq_wakeup_vbi(btv, old, STATE_DONE); spin_unlock(&btv->s_lock); } @@ -3504,11 +3556,14 @@ static irqreturn_t bttv_irq(int irq, void *dev_id, struct pt_regs * regs) wake_up(&btv->i2c_queue); } + if ((astat & BT848_INT_RISCI) && (stat & (4<<28))) + bttv_irq_switch_vbi(btv); + if ((astat & BT848_INT_RISCI) && (stat & (2<<28))) bttv_irq_wakeup_top(btv); if ((astat & BT848_INT_RISCI) && (stat & (1<<28))) - bttv_irq_switch_fields(btv); + bttv_irq_switch_video(btv); if ((astat & BT848_INT_HLOCK) && btv->opt_automute) audio_mux(btv, -1); @@ -3884,9 +3939,11 @@ static int bttv_suspend(struct pci_dev *pci_dev, u32 state) /* stop dma + irqs */ spin_lock_irqsave(&btv->s_lock,flags); memset(&idle, 0, sizeof(idle)); - btv->state.set = btv->curr; + btv->state.video = btv->curr; + btv->state.vbi = btv->cvbi; btv->curr = idle; - bttv_buffer_set_activate(btv, &idle); + bttv_buffer_activate_video(btv, &idle); + bttv_buffer_activate_vbi(btv, NULL); bttv_set_dma(btv, 0, 0); btwrite(0, BT848_INT_MASK); spin_unlock_irqrestore(&btv->s_lock,flags); @@ -3926,8 +3983,10 @@ static int bttv_resume(struct pci_dev *pci_dev) /* restart dma */ spin_lock_irqsave(&btv->s_lock,flags); - btv->curr = btv->state.set; - bttv_buffer_set_activate(btv, &btv->curr); + btv->curr = btv->state.video; + btv->cvbi = btv->state.vbi; + bttv_buffer_activate_video(btv, &btv->curr); + bttv_buffer_activate_vbi(btv, btv->cvbi); bttv_set_dma(btv, 0, btv->curr.irqflags); spin_unlock_irqrestore(&btv->s_lock,flags); return 0; diff --git a/linux/drivers/media/video/bttv-risc.c b/linux/drivers/media/video/bttv-risc.c index c512416a0..769c7e365 100644 --- a/linux/drivers/media/video/bttv-risc.c +++ b/linux/drivers/media/video/bttv-risc.c @@ -379,7 +379,7 @@ bttv_set_dma(struct bttv *btv, int override, int irqflags) btv->cap_ctl = 0; if (NULL != btv->curr.top) btv->cap_ctl |= 0x02; if (NULL != btv->curr.bottom) btv->cap_ctl |= 0x01; - if (NULL != btv->curr.vbi) btv->cap_ctl |= 0x0c; + if (NULL != btv->cvbi) btv->cap_ctl |= 0x0c; capctl = 0; capctl |= (btv->cap_ctl & 0x03) ? 0x03 : 0x00; /* capture */ @@ -389,9 +389,9 @@ bttv_set_dma(struct bttv *btv, int override, int irqflags) d2printk(KERN_DEBUG "bttv%d: capctl=%x irq=%d top=%08Lx/%08Lx even=%08Lx/%08Lx\n", btv->c.nr,capctl,irqflags, - btv->curr.vbi ? (unsigned long long)btv->curr.vbi->top.dma : 0, + btv->cvbi ? (unsigned long long)btv->cvbi->top.dma : 0, btv->curr.top ? (unsigned long long)btv->curr.top->top.dma : 0, - btv->curr.vbi ? (unsigned long long)btv->curr.vbi->bottom.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; @@ -399,6 +399,8 @@ bttv_set_dma(struct bttv *btv, int override, int irqflags) cmd |= BT848_RISC_IRQ; cmd |= (irqflags & 0x0f) << 16; cmd |= (~irqflags & 0x0f) << 20; + } + if (irqflags || btv->cvbi) { mod_timer(&btv->timeout, jiffies+BTTV_TIMEOUT); } else { del_timer(&btv->timeout); @@ -501,20 +503,26 @@ bttv_dma_free(struct bttv *btv, struct bttv_buffer *buf) } int -bttv_buffer_set_activate(struct bttv *btv, - struct bttv_buffer_set *set) +bttv_buffer_activate_vbi(struct bttv *btv, + struct bttv_buffer *vbi) { /* vbi capture */ - if (set->vbi) { - set->vbi->vb.state = STATE_ACTIVE; - list_del(&set->vbi->vb.queue); - bttv_risc_hook(btv, RISC_SLOT_O_VBI, &set->vbi->top, 0); - bttv_risc_hook(btv, RISC_SLOT_E_VBI, &set->vbi->bottom, 0); + if (vbi) { + vbi->vb.state = STATE_ACTIVE; + list_del(&vbi->vb.queue); + bttv_risc_hook(btv, RISC_SLOT_O_VBI, &vbi->top, 0); + bttv_risc_hook(btv, RISC_SLOT_E_VBI, &vbi->bottom, 4); } else { bttv_risc_hook(btv, RISC_SLOT_O_VBI, NULL, 0); bttv_risc_hook(btv, RISC_SLOT_E_VBI, NULL, 0); } + return 0; +} +int +bttv_buffer_activate_video(struct bttv *btv, + struct bttv_buffer_set *set) +{ /* video capture */ if (NULL != set->top && NULL != set->bottom) { if (set->top == set->bottom) { diff --git a/linux/drivers/media/video/bttv-vbi.c b/linux/drivers/media/video/bttv-vbi.c index f3d12cde0..ad655c8aa 100644 --- a/linux/drivers/media/video/bttv-vbi.c +++ b/linux/drivers/media/video/bttv-vbi.c @@ -114,7 +114,10 @@ vbi_buffer_queue(struct file *file, struct videobuf_buffer *vb) dprintk("queue %p\n",vb); buf->vb.state = STATE_QUEUED; list_add_tail(&buf->vb.queue,&btv->vcapture); - bttv_set_dma(btv,0x0c,1); + if (NULL == btv->cvbi) { + fh->btv->curr.irqflags |= 4; + bttv_set_dma(btv,0x0c,fh->btv->curr.irqflags); + } } static void vbi_buffer_release(struct file *file, struct videobuf_buffer *vb) diff --git a/linux/drivers/media/video/bttvp.h b/linux/drivers/media/video/bttvp.h index 8312421ed..cfa52c1b0 100644 --- a/linux/drivers/media/video/bttvp.h +++ b/linux/drivers/media/video/bttvp.h @@ -143,7 +143,6 @@ struct bttv_buffer { struct bttv_buffer_set { struct bttv_buffer *top; /* top field buffer */ struct bttv_buffer *bottom; /* bottom field buffer */ - struct bttv_buffer *vbi; /* vbi buffer */ unsigned int irqflags; unsigned int topirq; }; @@ -213,8 +212,10 @@ int bttv_risc_hook(struct bttv *btv, int slot, struct btcx_riscmem *risc, /* capture buffer handling */ int bttv_buffer_risc(struct bttv *btv, struct bttv_buffer *buf); -int bttv_buffer_set_activate(struct bttv *btv, - struct bttv_buffer_set *set); +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); /* overlay handling */ @@ -297,7 +298,8 @@ struct bttv_suspend_state { u32 gpio_enable; u32 gpio_data; int disabled; - struct bttv_buffer_set set; + struct bttv_buffer_set video; + struct bttv_buffer *vbi; }; struct bttv { @@ -395,6 +397,7 @@ struct bttv { struct list_head capture; /* video capture queue */ struct list_head vcapture; /* vbi capture queue */ struct bttv_buffer_set curr; /* active buffers */ + struct bttv_buffer *cvbi; /* active vbi buffer */ int new_input; unsigned long cap_ctl; diff --git a/linux/drivers/media/video/saa7134/saa7134-cards.c b/linux/drivers/media/video/saa7134/saa7134-cards.c index f6db11574..809339c1e 100644 --- a/linux/drivers/media/video/saa7134/saa7134-cards.c +++ b/linux/drivers/media/video/saa7134/saa7134-cards.c @@ -945,6 +945,24 @@ struct saa7134_board saa7134_boards[] = { .vmux = 3, }}, }, + [SAA7134_BOARD_NOVAC_PRIMETV7133] = { + /* toshii@netbsd.org */ + .name = "Noval Prime TV 7133", + .audio_clock = 0x00200000, + .tuner_type = TUNER_ALPS_TSBH1_NTSC, + .inputs = {{ + .name = name_comp1, + .vmux = 3, + },{ + .name = name_tv, + .vmux = 1, + .amux = TV, + .tv = 1, + },{ + .name = name_svideo, + .vmux = 8, + }}, + }, }; const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards); @@ -1099,7 +1117,7 @@ struct pci_device_id saa7134_pci_tbl[] = { },{ /* AverMedia Studio 305, using AverMedia M156 entry for now */ .vendor = PCI_VENDOR_ID_PHILIPS, - .device = PCI_DEVICE_ID_PHILIPS_SAA7134, + .device = PCI_DEVICE_ID_PHILIPS_SAA7130, .subvendor = 0x1461, /* Avermedia Technologies Inc */ .subdevice = 0x2115, .driver_data = SAA7134_BOARD_MD2819, diff --git a/linux/drivers/media/video/saa7134/saa7134-oss.c b/linux/drivers/media/video/saa7134/saa7134-oss.c index 4b60c7877..4df45c67b 100644 --- a/linux/drivers/media/video/saa7134/saa7134-oss.c +++ b/linux/drivers/media/video/saa7134/saa7134-oss.c @@ -50,7 +50,7 @@ static int dsp_buffer_conf(struct saa7134_dev *dev, int blksize, int blocks) if (blksize < 0x100) blksize = 0x100; if (blksize > 0x10000) - blksize = 0x100; + blksize = 0x10000; if (blocks < 2) blocks = 2; diff --git a/linux/drivers/media/video/saa7134/saa7134-tvaudio.c b/linux/drivers/media/video/saa7134/saa7134-tvaudio.c index 14756822e..a300717ea 100644 --- a/linux/drivers/media/video/saa7134/saa7134-tvaudio.c +++ b/linux/drivers/media/video/saa7134/saa7134-tvaudio.c @@ -736,7 +736,7 @@ static int mute_input_7133(struct saa7134_dev *dev) static int tvaudio_thread_ddep(void *data) { struct saa7134_dev *dev = data; - u32 value, norms; + u32 value, norms, clock; #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,61) lock_kernel(); @@ -749,10 +749,15 @@ static int tvaudio_thread_ddep(void *data) allow_signal(SIGTERM); #endif + clock = saa7134_boards[dev->board].audio_clock; + if (UNSET != audio_clock_override) + clock = audio_clock_override; + saa_writel(0x598 >> 2, clock); + /* unmute */ saa_dsp_writel(dev, 0x474 >> 2, 0x00); saa_dsp_writel(dev, 0x450 >> 2, 0x00); - + for (;;) { tvaudio_sleep(dev,-1); if (dev->thread.shutdown || signal_pending(current)) diff --git a/linux/drivers/media/video/saa7134/saa7134.h b/linux/drivers/media/video/saa7134/saa7134.h index ed83bb44e..b237d98d8 100644 --- a/linux/drivers/media/video/saa7134/saa7134.h +++ b/linux/drivers/media/video/saa7134/saa7134.h @@ -180,6 +180,7 @@ struct saa7134_format { #define SAA7134_BOARD_ECS_TVP3XP_4CB5 31 #define SAA7134_BOARD_AVACSSMARTTV 32 #define SAA7134_BOARD_AVERMEDIA_DVD_EZMAKER 33 +#define SAA7134_BOARD_NOVAC_PRIMETV7133 34 #define SAA7134_INPUT_MAX 8 |