diff options
author | Michael Hunold <devnull@localhost> | 2002-12-30 21:10:58 +0000 |
---|---|---|
committer | Michael Hunold <devnull@localhost> | 2002-12-30 21:10:58 +0000 |
commit | d425bfb33eedb26e9878187a4f8506db80cee364 (patch) | |
tree | d85c70f34dcb9829043d9b22248a9b2693a1a361 /linux/drivers/media/common/saa7146_vbi.c | |
parent | 4ac441dd0b30a80cdcf026cc2952cc547bf5dbad (diff) | |
download | mediapointer-dvb-s2-d425bfb33eedb26e9878187a4f8506db80cee364.tar.gz mediapointer-dvb-s2-d425bfb33eedb26e9878187a4f8506db80cee364.tar.bz2 |
Next chunk of big splitup / cleanup:
(tested on 2.4.18 and 2.5.53 -- the budget driver is
untested, Holger will test it the next week)
saa7146:
- completely separated the saa7146 driver into a core-driver (saa7146.o) and
a video/vbi part (saa7146_vv.o). this allows you to build the budget driver
without av7110 and videodev bloat (see below)
The following thinks have been approved by Holger Waechtler:
av7110 (now ttpci):
- for 2.5.x: removed the av7110 directory and put everything into ttpci.
- removed all budget card support from this driver
- compile and build fixes for the saa7146 changes
ttpci-budget (new):
- for 2.5.x: created a new ttpci-budget directory, added a new driver for
the budget cards
mxb:
- compile and build fixes for the saa7146 changes
Changed the build and compile files for both 2.5.x and build-2.4 of course...
Diffstat (limited to 'linux/drivers/media/common/saa7146_vbi.c')
-rw-r--r-- | linux/drivers/media/common/saa7146_vbi.c | 69 |
1 files changed, 43 insertions, 26 deletions
diff --git a/linux/drivers/media/common/saa7146_vbi.c b/linux/drivers/media/common/saa7146_vbi.c index 1b880ff9c..96ab61028 100644 --- a/linux/drivers/media/common/saa7146_vbi.c +++ b/linux/drivers/media/common/saa7146_vbi.c @@ -1,4 +1,5 @@ -#include "saa7146.h" +#include "saa7146_vv.h" + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,51) #define KBUILD_MODNAME saa7146 #endif @@ -8,6 +9,8 @@ static int vbi_pixel_to_capture = 720 * 2; static int vbi_workaround(struct saa7146_dev *dev) { + struct saa7146_vv *vv = dev->vv_data; + u32 *cpu; dma_addr_t dma_addr; @@ -88,7 +91,7 @@ int vbi_workaround(struct saa7146_dev *dev) IER_ENABLE(dev,MASK_28); /* prepare to wait to be woken up by the irq-handler */ - add_wait_queue(&dev->vbi_wq, &wait); + add_wait_queue(&vv->vbi_wq, &wait); current->state = TASK_INTERRUPTIBLE; /* start rps1 to enable workaround */ @@ -99,7 +102,7 @@ int vbi_workaround(struct saa7146_dev *dev) DEB_VBI(("brs bug workaround %d/1.\n",i)); - remove_wait_queue(&dev->vbi_wq, &wait); + remove_wait_queue(&vv->vbi_wq, &wait); current->state = TASK_RUNNING; /* disable rps1 irqs */ @@ -126,11 +129,13 @@ int vbi_workaround(struct saa7146_dev *dev) void saa7146_set_vbi_capture(struct saa7146_dev *dev, struct saa7146_buf *buf, struct saa7146_buf *next) { + struct saa7146_vv *vv = dev->vv_data; + struct saa7146_video_dma vdma3; int count = 0; - unsigned long e_wait = dev->current_hps_sync == SAA7146_HPS_SYNC_PORT_A ? CMD_E_FID_A : CMD_E_FID_B; - unsigned long o_wait = dev->current_hps_sync == SAA7146_HPS_SYNC_PORT_A ? CMD_O_FID_A : CMD_O_FID_B; + unsigned long e_wait = vv->current_hps_sync == SAA7146_HPS_SYNC_PORT_A ? CMD_E_FID_A : CMD_E_FID_B; + 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; @@ -196,12 +201,13 @@ int buffer_activate(struct saa7146_dev *dev, struct saa7146_buf *buf, struct saa7146_buf *next) { + struct saa7146_vv *vv = dev->vv_data; buf->vb.state = STATE_ACTIVE; DEB_VBI(("dev:%p, buf:%p, next:%p\n",dev,buf,next)); saa7146_set_vbi_capture(dev,buf,next); - mod_timer(&dev->vbi_q.timeout, jiffies+BUFFER_TIMEOUT); + mod_timer(&vv->vbi_q.timeout, jiffies+BUFFER_TIMEOUT); return 0; } @@ -277,10 +283,11 @@ void buffer_queue(struct file *file, struct videobuf_buffer *vb) { struct saa7146_fh *fh = file->private_data; struct saa7146_dev *dev = fh->dev; + struct saa7146_vv *vv = dev->vv_data; struct saa7146_buf *buf = (struct saa7146_buf *)vb; DEB_VBI(("vb:%p\n",vb)); - saa7146_buffer_queue(dev,&dev->vbi_q,buf); + saa7146_buffer_queue(dev,&vv->vbi_q,buf); } static @@ -308,6 +315,7 @@ static void vbi_stop(struct saa7146_fh *fh) { struct saa7146_dev *dev = fh->dev; + struct saa7146_vv *vv = dev->vv_data; unsigned long flags; DEB_VBI(("dev:%p, fh:%p\n",dev, fh)); @@ -322,7 +330,7 @@ void vbi_stop(struct saa7146_fh *fh) /* shut down dma 3 transfers */ saa7146_write(dev, MC1, MASK_20); - dev->vbi_streaming = NULL; + vv->vbi_streaming = NULL; spin_unlock_irqrestore(&dev->slock, flags); } @@ -338,21 +346,25 @@ void vbi_read_timeout(unsigned long data) } static -void vbi_init(struct saa7146_dev *dev) +void vbi_init(struct saa7146_dev *dev, struct saa7146_vv *vv) { - INIT_LIST_HEAD(&dev->vbi_q.queue); + DEB_VBI(("dev:%p\n",dev)); + + INIT_LIST_HEAD(&vv->vbi_q.queue); - init_timer(&dev->vbi_q.timeout); - dev->vbi_q.timeout.function = saa7146_buffer_timeout; - dev->vbi_q.timeout.data = (unsigned long)(&dev->vbi_q); - dev->vbi_q.dev = dev; + init_timer(&vv->vbi_q.timeout); + vv->vbi_q.timeout.function = saa7146_buffer_timeout; + vv->vbi_q.timeout.data = (unsigned long)(&vv->vbi_q); + vv->vbi_q.dev = dev; - init_waitqueue_head(&dev->vbi_wq); + init_waitqueue_head(&vv->vbi_wq); } static void vbi_open(struct saa7146_dev *dev, struct saa7146_fh *fh) { + DEB_VBI(("dev:%p, fh:%p\n",dev,fh)); + memset(&fh->vbi_fmt,0,sizeof(fh->vbi_fmt)); fh->vbi_fmt.sampling_rate = 27000000; @@ -382,7 +394,10 @@ void vbi_open(struct saa7146_dev *dev, struct saa7146_fh *fh) static void vbi_close(struct saa7146_dev *dev, struct saa7146_fh *fh, struct file *file) { - if( fh == dev->vbi_streaming ) { + struct saa7146_vv *vv = dev->vv_data; + DEB_VBI(("dev:%p, fh:%p\n",dev,fh)); + + if( fh == vv->vbi_streaming ) { vbi_stop(fh); } } @@ -390,18 +405,19 @@ void vbi_close(struct saa7146_dev *dev, struct saa7146_fh *fh, struct file *file static void vbi_irq_done(struct saa7146_dev *dev, unsigned long status) { + struct saa7146_vv *vv = dev->vv_data; spin_lock(&dev->slock); - if (dev->vbi_q.curr) { - DEB_VBI(("dev:%p, curr:%p\n",dev,dev->vbi_q.curr)); + if (vv->vbi_q.curr) { + DEB_VBI(("dev:%p, curr:%p\n",dev,vv->vbi_q.curr)); /* this must be += 2, one count for each field */ - dev->vbi_fieldcount+=2; - dev->vbi_q.curr->vb.field_count = dev->vbi_fieldcount; - saa7146_buffer_finish(dev,&dev->vbi_q,STATE_DONE); + vv->vbi_fieldcount+=2; + vv->vbi_q.curr->vb.field_count = vv->vbi_fieldcount; + saa7146_buffer_finish(dev,&vv->vbi_q,STATE_DONE); } else { DEB_VBI(("dev:%p\n",dev)); } - saa7146_buffer_next(dev,&dev->vbi_q,1); + saa7146_buffer_next(dev,&vv->vbi_q,1); spin_unlock(&dev->slock); } @@ -411,18 +427,19 @@ ssize_t vbi_read(struct file *file, char *data, size_t count, loff_t *ppos) { struct saa7146_fh *fh = file->private_data; struct saa7146_dev *dev = fh->dev; + struct saa7146_vv *vv = dev->vv_data; ssize_t ret = 0; DEB_VBI(("dev:%p, fh:%p\n",dev,fh)); - if( NULL == dev->vbi_streaming ) { + if( NULL == vv->vbi_streaming ) { // fixme: check if dma3 is available // fixme: activate vbi engine here if necessary. (really?) - dev->vbi_streaming = fh; + vv->vbi_streaming = fh; } - if( fh != dev->vbi_streaming ) { - DEB_VBI(("open %p is already using vbi capture.",dev->vbi_streaming)); + if( fh != vv->vbi_streaming ) { + DEB_VBI(("open %p is already using vbi capture.",vv->vbi_streaming)); return -EBUSY; } |