diff options
author | Michael Hunold <devnull@localhost> | 2003-10-14 12:45:38 +0000 |
---|---|---|
committer | Michael Hunold <devnull@localhost> | 2003-10-14 12:45:38 +0000 |
commit | 22419514199a8b5a60fed1a80d13143ec42740e6 (patch) | |
tree | 1aeb9ab1b8234074461715a9b5c6922eaa02b53c /linux/drivers/media/common/saa7146_vbi.c | |
parent | f1df770e561227ea59ede871c9452f13c2e3a1a0 (diff) | |
download | mediapointer-dvb-s2-22419514199a8b5a60fed1a80d13143ec42740e6.tar.gz mediapointer-dvb-s2-22419514199a8b5a60fed1a80d13143ec42740e6.tar.bz2 |
- disable vbi workaround for dvb-c cards which use port b
- set up arbitrition control for video dma3 correctly
- clean up vbi capture queue properly on device close
Diffstat (limited to 'linux/drivers/media/common/saa7146_vbi.c')
-rw-r--r-- | linux/drivers/media/common/saa7146_vbi.c | 51 |
1 files changed, 42 insertions, 9 deletions
diff --git a/linux/drivers/media/common/saa7146_vbi.c b/linux/drivers/media/common/saa7146_vbi.c index 5538ad633..ee8c974d4 100644 --- a/linux/drivers/media/common/saa7146_vbi.c +++ b/linux/drivers/media/common/saa7146_vbi.c @@ -41,7 +41,11 @@ static int vbi_workaround(struct saa7146_dev *dev) /* wait for vbi_a or vbi_b*/ if ( 0 != (SAA7146_USE_PORT_B_FOR_VBI & dev->ext_vv_data->flags)) { DEB_D(("...using port b\n")); + WRITE_RPS1(CMD_PAUSE | CMD_OAN | CMD_SIG1 | CMD_E_FID_B); + WRITE_RPS1(CMD_PAUSE | CMD_OAN | CMD_SIG1 | CMD_O_FID_B); +/* WRITE_RPS1(CMD_PAUSE | MASK_09); +*/ } else { DEB_D(("...using port a\n")); WRITE_RPS1(CMD_PAUSE | MASK_10); @@ -137,10 +141,10 @@ void saa7146_set_vbi_capture(struct saa7146_dev *dev, struct saa7146_buf *buf, s unsigned long o_wait = vv->current_hps_sync == SAA7146_HPS_SYNC_PORT_A ? CMD_O_FID_A : CMD_O_FID_B; /* - vdma3.base_even = (u32)dev->ov_fb.base+2048*70; - vdma3.base_odd = (u32)dev->ov_fb.base; - vdma3.prot_addr = (u32)dev->ov_fb.base+2048*164; - vdma3.pitch = 2048; + vdma3.base_even = 0xc8000000+2560*70; + vdma3.base_odd = 0xc8000000; + vdma3.prot_addr = 0xc8000000+2560*164; + vdma3.pitch = 2560; vdma3.base_page = 0; vdma3.num_line_byte = (64<<16)|((vbi_pixel_to_capture)<<0); // set above! */ @@ -150,6 +154,7 @@ void saa7146_set_vbi_capture(struct saa7146_dev *dev, struct saa7146_buf *buf, s vdma3.pitch = vbi_pixel_to_capture; vdma3.base_page = buf->pt[2].dma | ME1; vdma3.num_line_byte = (16 << 16) | vbi_pixel_to_capture; + saa7146_write_out_dma(dev, 3, &vdma3); /* write beginning of rps-program */ @@ -356,8 +361,17 @@ static void vbi_init(struct saa7146_dev *dev, struct saa7146_vv *vv) static void vbi_open(struct saa7146_dev *dev, struct saa7146_fh *fh) { + u32 arbtr_ctrl = saa7146_read(dev, PCI_BT_V1); + int ret = 0; + DEB_VBI(("dev:%p, fh:%p\n",dev,fh)); + /* adjust arbitrition control for video dma 3 */ + arbtr_ctrl &= ~0x1f0000; + arbtr_ctrl |= 0x1d0000; + saa7146_write(dev, PCI_BT_V1, arbtr_ctrl); + saa7146_write(dev, MC2, (MASK_04|MASK_20)); + memset(&fh->vbi_fmt,0,sizeof(fh->vbi_fmt)); fh->vbi_fmt.sampling_rate = 27000000; @@ -382,20 +396,39 @@ static void vbi_open(struct saa7146_dev *dev, struct saa7146_fh *fh) fh->vbi_read_timeout.function = vbi_read_timeout; fh->vbi_read_timeout.data = (unsigned long)fh; - /* fixme! */ -/* - vbi_workaround(dev); -*/ + /* initialize the brs */ + if ( 0 != (SAA7146_USE_PORT_B_FOR_VBI & dev->ext_vv_data->flags)) { + saa7146_write(dev, BRS_CTRL, MASK_30|MASK_29 | (7 << 19)); + } else { + saa7146_write(dev, BRS_CTRL, 0x00000001); + + if (0 != (ret = vbi_workaround(dev))) { + DEB_VBI(("vbi workaround failed!\n")); + /* return ret;*/ + } + } + + /* upload brs register */ + saa7146_write(dev, MC2, (MASK_08|MASK_24)); } static void vbi_close(struct saa7146_dev *dev, struct saa7146_fh *fh, struct file *file) { struct saa7146_vv *vv = dev->vv_data; + unsigned long flags; DEB_VBI(("dev:%p, fh:%p\n",dev,fh)); + spin_lock_irqsave(&dev->slock,flags); + + videobuf_queue_cancel(file,&fh->vbi_q); + if (vv->vbi_q.curr) { + saa7146_buffer_finish(dev,&vv->vbi_q,STATE_DONE); + } + if( fh == vv->vbi_streaming ) { vbi_stop(fh); } + spin_unlock_irqrestore(&dev->slock,flags); } static void vbi_irq_done(struct saa7146_dev *dev, unsigned long status) @@ -424,7 +457,7 @@ static ssize_t vbi_read(struct file *file, char *data, size_t count, loff_t *ppo struct saa7146_vv *vv = dev->vv_data; ssize_t ret = 0; -// DEB_VBI(("dev:%p, fh:%p\n",dev,fh)); + DEB_VBI(("dev:%p, fh:%p\n",dev,fh)); if( NULL == vv->vbi_streaming ) { // fixme: check if dma3 is available |