diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-03-10 12:29:15 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-03-24 16:26:49 -0300 |
commit | c7b0ac0546985fc6361a8d92cf808d46da797677 (patch) | |
tree | 2147eb2f6dd7b2b82e0d7b4b9a26e12ef5193252 /drivers/media/video/saa7134 | |
parent | b2fd16b4ff2508ac16ae994f4bcd941f97754c00 (diff) | |
download | talos-op-linux-c7b0ac0546985fc6361a8d92cf808d46da797677.tar.gz talos-op-linux-c7b0ac0546985fc6361a8d92cf808d46da797677.zip |
V4L/DVB (3516): Make video_buf more generic
Video_buf were concerned to allow PCI devices to be used as
video capture devices. This patch extends video_buf features
by virtualizing pci-dependent functions and allowing other
type of devices to use it.
It is still DMA centric, although it may be used also by
devices that emulates scatter/gather behavior or a DMA device
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/saa7134')
-rw-r--r-- | drivers/media/video/saa7134/saa7134-alsa.c | 10 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-core.c | 4 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-oss.c | 6 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-ts.c | 9 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-vbi.c | 10 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-video.c | 9 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134.h | 2 |
7 files changed, 23 insertions, 27 deletions
diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c index aca84d2f9825..bb3e0ba946d3 100644 --- a/drivers/media/video/saa7134/saa7134-alsa.c +++ b/drivers/media/video/saa7134/saa7134-alsa.c @@ -507,7 +507,7 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream, /* release the old buffer */ if (substream->runtime->dma_area) { saa7134_pgtable_free(dev->pci, &dev->dmasound.pt); - videobuf_dma_pci_unmap(dev->pci, &dev->dmasound.dma); + videobuf_pci_dma_unmap(dev->pci, &dev->dmasound.dma); dsp_buffer_free(dev); substream->runtime->dma_area = NULL; } @@ -523,12 +523,12 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream, return err; } - if (0 != (err = videobuf_dma_pci_map(dev->pci, &dev->dmasound.dma))) { + if (0 != (err = videobuf_pci_dma_map(dev->pci, &dev->dmasound.dma))) { dsp_buffer_free(dev); return err; } if (0 != (err = saa7134_pgtable_alloc(dev->pci,&dev->dmasound.pt))) { - videobuf_dma_pci_unmap(dev->pci, &dev->dmasound.dma); + videobuf_pci_dma_unmap(dev->pci, &dev->dmasound.dma); dsp_buffer_free(dev); return err; } @@ -537,7 +537,7 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream, dev->dmasound.dma.sglen, 0))) { saa7134_pgtable_free(dev->pci, &dev->dmasound.pt); - videobuf_dma_pci_unmap(dev->pci, &dev->dmasound.dma); + videobuf_pci_dma_unmap(dev->pci, &dev->dmasound.dma); dsp_buffer_free(dev); return err; } @@ -571,7 +571,7 @@ static int snd_card_saa7134_hw_free(struct snd_pcm_substream * substream) if (substream->runtime->dma_area) { saa7134_pgtable_free(dev->pci, &dev->dmasound.pt); - videobuf_dma_pci_unmap(dev->pci, &dev->dmasound.dma); + videobuf_pci_dma_unmap(dev->pci, &dev->dmasound.dma); dsp_buffer_free(dev); substream->runtime->dma_area = NULL; } diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index 58e568d7d2ee..15405d1e1675 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c @@ -254,12 +254,12 @@ void saa7134_pgtable_free(struct pci_dev *pci, struct saa7134_pgtable *pt) /* ------------------------------------------------------------------ */ -void saa7134_dma_free(struct saa7134_dev *dev,struct saa7134_buf *buf) +void saa7134_dma_free(struct videobuf_queue *q,struct saa7134_buf *buf) { BUG_ON(in_interrupt()); videobuf_waiton(&buf->vb,0,0); - videobuf_dma_pci_unmap(dev->pci, &buf->vb.dma); + videobuf_dma_unmap(q, &buf->vb.dma); videobuf_dma_free(&buf->vb.dma); buf->vb.state = STATE_NEEDS_INIT; } diff --git a/drivers/media/video/saa7134/saa7134-oss.c b/drivers/media/video/saa7134/saa7134-oss.c index d79d05f88705..7aa02b34e012 100644 --- a/drivers/media/video/saa7134/saa7134-oss.c +++ b/drivers/media/video/saa7134/saa7134-oss.c @@ -124,7 +124,7 @@ static int dsp_rec_start(struct saa7134_dev *dev) unsigned long flags; /* prepare buffer */ - if (0 != (err = videobuf_dma_pci_map(dev->pci,&dev->dmasound.dma))) + if (0 != (err = videobuf_pci_dma_map(dev->pci,&dev->dmasound.dma))) return err; if (0 != (err = saa7134_pgtable_alloc(dev->pci,&dev->dmasound.pt))) goto fail1; @@ -213,7 +213,7 @@ static int dsp_rec_start(struct saa7134_dev *dev) fail2: saa7134_pgtable_free(dev->pci,&dev->dmasound.pt); fail1: - videobuf_dma_pci_unmap(dev->pci,&dev->dmasound.dma); + videobuf_pci_dma_unmap(dev->pci,&dev->dmasound.dma); return err; } @@ -231,7 +231,7 @@ static int dsp_rec_stop(struct saa7134_dev *dev) /* unlock buffer */ saa7134_pgtable_free(dev->pci,&dev->dmasound.pt); - videobuf_dma_pci_unmap(dev->pci,&dev->dmasound.dma); + videobuf_pci_dma_unmap(dev->pci,&dev->dmasound.dma); return 0; } diff --git a/drivers/media/video/saa7134/saa7134-ts.c b/drivers/media/video/saa7134/saa7134-ts.c index 470903e2f5e5..60a90a2617ae 100644 --- a/drivers/media/video/saa7134/saa7134-ts.c +++ b/drivers/media/video/saa7134/saa7134-ts.c @@ -89,7 +89,7 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, return -EINVAL; if (buf->vb.size != size) { - saa7134_dma_free(dev,buf); + saa7134_dma_free(q,buf); } if (STATE_NEEDS_INIT == buf->vb.state) { @@ -98,7 +98,7 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, buf->vb.size = size; buf->pt = &dev->ts.pt_ts; - err = videobuf_iolock(dev->pci,&buf->vb,NULL); + err = videobuf_iolock(q,&buf->vb,NULL); if (err) goto oops; err = saa7134_pgtable_build(dev->pci,buf->pt, @@ -126,7 +126,7 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, return 0; oops: - saa7134_dma_free(dev,buf); + saa7134_dma_free(q,buf); return err; } @@ -152,10 +152,9 @@ static void buffer_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) { - struct saa7134_dev *dev = q->priv_data; struct saa7134_buf *buf = container_of(vb,struct saa7134_buf,vb); - saa7134_dma_free(dev,buf); + saa7134_dma_free(q,buf); } struct videobuf_queue_ops saa7134_ts_qops = { diff --git a/drivers/media/video/saa7134/saa7134-vbi.c b/drivers/media/video/saa7134/saa7134-vbi.c index f4aee0af80e1..f38366a470fa 100644 --- a/drivers/media/video/saa7134/saa7134-vbi.c +++ b/drivers/media/video/saa7134/saa7134-vbi.c @@ -135,7 +135,7 @@ static int buffer_prepare(struct videobuf_queue *q, return -EINVAL; if (buf->vb.size != size) - saa7134_dma_free(dev,buf); + saa7134_dma_free(q,buf); if (STATE_NEEDS_INIT == buf->vb.state) { buf->vb.width = llength; @@ -143,7 +143,7 @@ static int buffer_prepare(struct videobuf_queue *q, buf->vb.size = size; buf->pt = &fh->pt_vbi; - err = videobuf_iolock(dev->pci,&buf->vb,NULL); + err = videobuf_iolock(q,&buf->vb,NULL); if (err) goto oops; err = saa7134_pgtable_build(dev->pci,buf->pt, @@ -159,7 +159,7 @@ static int buffer_prepare(struct videobuf_queue *q, return 0; oops: - saa7134_dma_free(dev,buf); + saa7134_dma_free(q,buf); return err; } @@ -190,11 +190,9 @@ static void buffer_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) { - struct saa7134_fh *fh = q->priv_data; - struct saa7134_dev *dev = fh->dev; struct saa7134_buf *buf = container_of(vb,struct saa7134_buf,vb); - saa7134_dma_free(dev,buf); + saa7134_dma_free(q,buf); } struct videobuf_queue_ops saa7134_vbi_qops = { diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index 57a11e71d996..aeef80f88a6b 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c @@ -993,7 +993,7 @@ static int buffer_prepare(struct videobuf_queue *q, buf->vb.size != size || buf->vb.field != field || buf->fmt != fh->fmt) { - saa7134_dma_free(dev,buf); + saa7134_dma_free(q,buf); } if (STATE_NEEDS_INIT == buf->vb.state) { @@ -1004,7 +1004,7 @@ static int buffer_prepare(struct videobuf_queue *q, buf->fmt = fh->fmt; buf->pt = &fh->pt_cap; - err = videobuf_iolock(dev->pci,&buf->vb,&dev->ovbuf); + err = videobuf_iolock(q,&buf->vb,&dev->ovbuf); if (err) goto oops; err = saa7134_pgtable_build(dev->pci,buf->pt, @@ -1019,7 +1019,7 @@ static int buffer_prepare(struct videobuf_queue *q, return 0; oops: - saa7134_dma_free(dev,buf); + saa7134_dma_free(q,buf); return err; } @@ -1045,10 +1045,9 @@ static void buffer_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) { - struct saa7134_fh *fh = q->priv_data; struct saa7134_buf *buf = container_of(vb,struct saa7134_buf,vb); - saa7134_dma_free(fh->dev,buf); + saa7134_dma_free(q,buf); } static struct videobuf_queue_ops video_qops = { diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index ce1c2e0b065e..104bd2e054e5 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h @@ -579,7 +579,7 @@ void saa7134_buffer_finish(struct saa7134_dev *dev, struct saa7134_dmaqueue *q, unsigned int state); void saa7134_buffer_next(struct saa7134_dev *dev, struct saa7134_dmaqueue *q); void saa7134_buffer_timeout(unsigned long data); -void saa7134_dma_free(struct saa7134_dev *dev,struct saa7134_buf *buf); +void saa7134_dma_free(struct videobuf_queue *q,struct saa7134_buf *buf); int saa7134_set_dmabits(struct saa7134_dev *dev); |