diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-03-10 10:29:15 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-03-24 14:26:49 -0500 |
commit | c7b0ac0546985fc6361a8d92cf808d46da797677 (patch) | |
tree | 2147eb2f6dd7b2b82e0d7b4b9a26e12ef5193252 /drivers/media/common | |
parent | b2fd16b4ff2508ac16ae994f4bcd941f97754c00 (diff) |
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/common')
-rw-r--r-- | drivers/media/common/saa7146_fops.c | 5 | ||||
-rw-r--r-- | drivers/media/common/saa7146_vbi.c | 8 | ||||
-rw-r--r-- | drivers/media/common/saa7146_video.c | 8 |
3 files changed, 11 insertions, 10 deletions
diff --git a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146_fops.c index 3870fa948cc0..523ab3851c7b 100644 --- a/drivers/media/common/saa7146_fops.c +++ b/drivers/media/common/saa7146_fops.c | |||
@@ -50,14 +50,15 @@ void saa7146_res_free(struct saa7146_fh *fh, unsigned int bits) | |||
50 | /********************************************************************************/ | 50 | /********************************************************************************/ |
51 | /* common dma functions */ | 51 | /* common dma functions */ |
52 | 52 | ||
53 | void saa7146_dma_free(struct saa7146_dev *dev,struct saa7146_buf *buf) | 53 | void saa7146_dma_free(struct saa7146_dev *dev,struct videobuf_queue *q, |
54 | struct saa7146_buf *buf) | ||
54 | { | 55 | { |
55 | DEB_EE(("dev:%p, buf:%p\n",dev,buf)); | 56 | DEB_EE(("dev:%p, buf:%p\n",dev,buf)); |
56 | 57 | ||
57 | BUG_ON(in_interrupt()); | 58 | BUG_ON(in_interrupt()); |
58 | 59 | ||
59 | videobuf_waiton(&buf->vb,0,0); | 60 | videobuf_waiton(&buf->vb,0,0); |
60 | videobuf_dma_pci_unmap(dev->pci, &buf->vb.dma); | 61 | videobuf_dma_unmap(q, &buf->vb.dma); |
61 | videobuf_dma_free(&buf->vb.dma); | 62 | videobuf_dma_free(&buf->vb.dma); |
62 | buf->vb.state = STATE_NEEDS_INIT; | 63 | buf->vb.state = STATE_NEEDS_INIT; |
63 | } | 64 | } |
diff --git a/drivers/media/common/saa7146_vbi.c b/drivers/media/common/saa7146_vbi.c index 500bd3f05e16..063608462ebe 100644 --- a/drivers/media/common/saa7146_vbi.c +++ b/drivers/media/common/saa7146_vbi.c | |||
@@ -236,7 +236,7 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,e | |||
236 | } | 236 | } |
237 | 237 | ||
238 | if (buf->vb.size != size) | 238 | if (buf->vb.size != size) |
239 | saa7146_dma_free(dev,buf); | 239 | saa7146_dma_free(dev,q,buf); |
240 | 240 | ||
241 | if (STATE_NEEDS_INIT == buf->vb.state) { | 241 | if (STATE_NEEDS_INIT == buf->vb.state) { |
242 | buf->vb.width = llength; | 242 | buf->vb.width = llength; |
@@ -247,7 +247,7 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,e | |||
247 | saa7146_pgtable_free(dev->pci, &buf->pt[2]); | 247 | saa7146_pgtable_free(dev->pci, &buf->pt[2]); |
248 | saa7146_pgtable_alloc(dev->pci, &buf->pt[2]); | 248 | saa7146_pgtable_alloc(dev->pci, &buf->pt[2]); |
249 | 249 | ||
250 | err = videobuf_iolock(dev->pci,&buf->vb, NULL); | 250 | err = videobuf_iolock(q,&buf->vb, NULL); |
251 | if (err) | 251 | if (err) |
252 | goto oops; | 252 | goto oops; |
253 | err = saa7146_pgtable_build_single(dev->pci, &buf->pt[2], buf->vb.dma.sglist, buf->vb.dma.sglen); | 253 | err = saa7146_pgtable_build_single(dev->pci, &buf->pt[2], buf->vb.dma.sglist, buf->vb.dma.sglen); |
@@ -261,7 +261,7 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,e | |||
261 | 261 | ||
262 | oops: | 262 | oops: |
263 | DEB_VBI(("error out.\n")); | 263 | DEB_VBI(("error out.\n")); |
264 | saa7146_dma_free(dev,buf); | 264 | saa7146_dma_free(dev,q,buf); |
265 | 265 | ||
266 | return err; | 266 | return err; |
267 | } | 267 | } |
@@ -301,7 +301,7 @@ static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) | |||
301 | struct saa7146_buf *buf = (struct saa7146_buf *)vb; | 301 | struct saa7146_buf *buf = (struct saa7146_buf *)vb; |
302 | 302 | ||
303 | DEB_VBI(("vb:%p\n",vb)); | 303 | DEB_VBI(("vb:%p\n",vb)); |
304 | saa7146_dma_free(dev,buf); | 304 | saa7146_dma_free(dev,q,buf); |
305 | } | 305 | } |
306 | 306 | ||
307 | static struct videobuf_queue_ops vbi_qops = { | 307 | static struct videobuf_queue_ops vbi_qops = { |
diff --git a/drivers/media/common/saa7146_video.c b/drivers/media/common/saa7146_video.c index 6b42713d97f4..e7079d1bd537 100644 --- a/drivers/media/common/saa7146_video.c +++ b/drivers/media/common/saa7146_video.c | |||
@@ -1275,7 +1275,7 @@ static int buffer_prepare(struct videobuf_queue *q, | |||
1275 | buf->vb.field != field || | 1275 | buf->vb.field != field || |
1276 | buf->vb.field != fh->video_fmt.field || | 1276 | buf->vb.field != fh->video_fmt.field || |
1277 | buf->fmt != &fh->video_fmt) { | 1277 | buf->fmt != &fh->video_fmt) { |
1278 | saa7146_dma_free(dev,buf); | 1278 | saa7146_dma_free(dev,q,buf); |
1279 | } | 1279 | } |
1280 | 1280 | ||
1281 | if (STATE_NEEDS_INIT == buf->vb.state) { | 1281 | if (STATE_NEEDS_INIT == buf->vb.state) { |
@@ -1304,7 +1304,7 @@ static int buffer_prepare(struct videobuf_queue *q, | |||
1304 | saa7146_pgtable_alloc(dev->pci, &buf->pt[0]); | 1304 | saa7146_pgtable_alloc(dev->pci, &buf->pt[0]); |
1305 | } | 1305 | } |
1306 | 1306 | ||
1307 | err = videobuf_iolock(dev->pci,&buf->vb, &vv->ov_fb); | 1307 | err = videobuf_iolock(q,&buf->vb, &vv->ov_fb); |
1308 | if (err) | 1308 | if (err) |
1309 | goto oops; | 1309 | goto oops; |
1310 | err = saa7146_pgtable_build(dev,buf); | 1310 | err = saa7146_pgtable_build(dev,buf); |
@@ -1318,7 +1318,7 @@ static int buffer_prepare(struct videobuf_queue *q, | |||
1318 | 1318 | ||
1319 | oops: | 1319 | oops: |
1320 | DEB_D(("error out.\n")); | 1320 | DEB_D(("error out.\n")); |
1321 | saa7146_dma_free(dev,buf); | 1321 | saa7146_dma_free(dev,q,buf); |
1322 | 1322 | ||
1323 | return err; | 1323 | return err; |
1324 | } | 1324 | } |
@@ -1363,7 +1363,7 @@ static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) | |||
1363 | struct saa7146_buf *buf = (struct saa7146_buf *)vb; | 1363 | struct saa7146_buf *buf = (struct saa7146_buf *)vb; |
1364 | 1364 | ||
1365 | DEB_CAP(("vbuf:%p\n",vb)); | 1365 | DEB_CAP(("vbuf:%p\n",vb)); |
1366 | saa7146_dma_free(dev,buf); | 1366 | saa7146_dma_free(dev,q,buf); |
1367 | } | 1367 | } |
1368 | 1368 | ||
1369 | static struct videobuf_queue_ops video_qops = { | 1369 | static struct videobuf_queue_ops video_qops = { |