aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/common/saa7146_fops.c2
-rw-r--r--drivers/media/video/bt8xx/bttv-risc.c2
-rw-r--r--drivers/media/video/cx23885/cx23885-core.c2
-rw-r--r--drivers/media/video/cx88/cx88-alsa.c4
-rw-r--r--drivers/media/video/cx88/cx88-core.c2
-rw-r--r--drivers/media/video/omap24xxcam.c2
-rw-r--r--drivers/media/video/pxa_camera.c2
-rw-r--r--drivers/media/video/saa7134/saa7134-alsa.c10
-rw-r--r--drivers/media/video/saa7134/saa7134-core.c2
-rw-r--r--drivers/media/video/videobuf-dma-sg.c32
-rw-r--r--drivers/staging/cx25821/cx25821-alsa.c4
-rw-r--r--drivers/staging/cx25821/cx25821-core.c2
-rw-r--r--include/media/videobuf-dma-sg.h20
13 files changed, 34 insertions, 52 deletions
diff --git a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146_fops.c
index 7364b9642d00..4da2a54cb8bd 100644
--- a/drivers/media/common/saa7146_fops.c
+++ b/drivers/media/common/saa7146_fops.c
@@ -57,7 +57,7 @@ void saa7146_dma_free(struct saa7146_dev *dev,struct videobuf_queue *q,
57 BUG_ON(in_interrupt()); 57 BUG_ON(in_interrupt());
58 58
59 videobuf_waiton(&buf->vb,0,0); 59 videobuf_waiton(&buf->vb,0,0);
60 videobuf_dma_unmap(q, dma); 60 videobuf_dma_unmap(q->dev, dma);
61 videobuf_dma_free(dma); 61 videobuf_dma_free(dma);
62 buf->vb.state = VIDEOBUF_NEEDS_INIT; 62 buf->vb.state = VIDEOBUF_NEEDS_INIT;
63} 63}
diff --git a/drivers/media/video/bt8xx/bttv-risc.c b/drivers/media/video/bt8xx/bttv-risc.c
index c24b1c100e13..0fa9f39f37a3 100644
--- a/drivers/media/video/bt8xx/bttv-risc.c
+++ b/drivers/media/video/bt8xx/bttv-risc.c
@@ -583,7 +583,7 @@ bttv_dma_free(struct videobuf_queue *q,struct bttv *btv, struct bttv_buffer *buf
583 583
584 BUG_ON(in_interrupt()); 584 BUG_ON(in_interrupt());
585 videobuf_waiton(&buf->vb,0,0); 585 videobuf_waiton(&buf->vb,0,0);
586 videobuf_dma_unmap(q, dma); 586 videobuf_dma_unmap(q->dev, dma);
587 videobuf_dma_free(dma); 587 videobuf_dma_free(dma);
588 btcx_riscmem_free(btv->c.pci,&buf->bottom); 588 btcx_riscmem_free(btv->c.pci,&buf->bottom);
589 btcx_riscmem_free(btv->c.pci,&buf->top); 589 btcx_riscmem_free(btv->c.pci,&buf->top);
diff --git a/drivers/media/video/cx23885/cx23885-core.c b/drivers/media/video/cx23885/cx23885-core.c
index 0dde57e96d30..161ae7316c95 100644
--- a/drivers/media/video/cx23885/cx23885-core.c
+++ b/drivers/media/video/cx23885/cx23885-core.c
@@ -1142,7 +1142,7 @@ void cx23885_free_buffer(struct videobuf_queue *q, struct cx23885_buffer *buf)
1142 1142
1143 BUG_ON(in_interrupt()); 1143 BUG_ON(in_interrupt());
1144 videobuf_waiton(&buf->vb, 0, 0); 1144 videobuf_waiton(&buf->vb, 0, 0);
1145 videobuf_dma_unmap(q, dma); 1145 videobuf_dma_unmap(q->dev, dma);
1146 videobuf_dma_free(dma); 1146 videobuf_dma_free(dma);
1147 btcx_riscmem_free(to_pci_dev(q->dev), &buf->risc); 1147 btcx_riscmem_free(to_pci_dev(q->dev), &buf->risc);
1148 buf->vb.state = VIDEOBUF_NEEDS_INIT; 1148 buf->vb.state = VIDEOBUF_NEEDS_INIT;
diff --git a/drivers/media/video/cx88/cx88-alsa.c b/drivers/media/video/cx88/cx88-alsa.c
index 33082c96745e..07fe905f6575 100644
--- a/drivers/media/video/cx88/cx88-alsa.c
+++ b/drivers/media/video/cx88/cx88-alsa.c
@@ -283,7 +283,7 @@ static int dsp_buffer_free(snd_cx88_card_t *chip)
283 BUG_ON(!chip->dma_size); 283 BUG_ON(!chip->dma_size);
284 284
285 dprintk(2,"Freeing buffer\n"); 285 dprintk(2,"Freeing buffer\n");
286 videobuf_sg_dma_unmap(&chip->pci->dev, chip->dma_risc); 286 videobuf_dma_unmap(&chip->pci->dev, chip->dma_risc);
287 videobuf_dma_free(chip->dma_risc); 287 videobuf_dma_free(chip->dma_risc);
288 btcx_riscmem_free(chip->pci,&chip->buf->risc); 288 btcx_riscmem_free(chip->pci,&chip->buf->risc);
289 kfree(chip->buf); 289 kfree(chip->buf);
@@ -409,7 +409,7 @@ static int snd_cx88_hw_params(struct snd_pcm_substream * substream,
409 if (ret < 0) 409 if (ret < 0)
410 goto error; 410 goto error;
411 411
412 ret = videobuf_sg_dma_map(&chip->pci->dev, dma); 412 ret = videobuf_dma_map(&chip->pci->dev, dma);
413 if (ret < 0) 413 if (ret < 0)
414 goto error; 414 goto error;
415 415
diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c
index 8b21457111b1..85eb266fb351 100644
--- a/drivers/media/video/cx88/cx88-core.c
+++ b/drivers/media/video/cx88/cx88-core.c
@@ -218,7 +218,7 @@ cx88_free_buffer(struct videobuf_queue *q, struct cx88_buffer *buf)
218 218
219 BUG_ON(in_interrupt()); 219 BUG_ON(in_interrupt());
220 videobuf_waiton(&buf->vb,0,0); 220 videobuf_waiton(&buf->vb,0,0);
221 videobuf_dma_unmap(q, dma); 221 videobuf_dma_unmap(q->dev, dma);
222 videobuf_dma_free(dma); 222 videobuf_dma_free(dma);
223 btcx_riscmem_free(to_pci_dev(q->dev), &buf->risc); 223 btcx_riscmem_free(to_pci_dev(q->dev), &buf->risc);
224 buf->vb.state = VIDEOBUF_NEEDS_INIT; 224 buf->vb.state = VIDEOBUF_NEEDS_INIT;
diff --git a/drivers/media/video/omap24xxcam.c b/drivers/media/video/omap24xxcam.c
index f85b2ed8a2d8..926a5aa6f7f8 100644
--- a/drivers/media/video/omap24xxcam.c
+++ b/drivers/media/video/omap24xxcam.c
@@ -426,7 +426,7 @@ static void omap24xxcam_vbq_release(struct videobuf_queue *vbq,
426 dma->direction); 426 dma->direction);
427 dma->direction = DMA_NONE; 427 dma->direction = DMA_NONE;
428 } else { 428 } else {
429 videobuf_dma_unmap(vbq, videobuf_to_dma(vb)); 429 videobuf_dma_unmap(vbq->dev, videobuf_to_dma(vb));
430 videobuf_dma_free(videobuf_to_dma(vb)); 430 videobuf_dma_free(videobuf_to_dma(vb));
431 } 431 }
432 432
diff --git a/drivers/media/video/pxa_camera.c b/drivers/media/video/pxa_camera.c
index fb242f6cfb1f..5835acf7fa7a 100644
--- a/drivers/media/video/pxa_camera.c
+++ b/drivers/media/video/pxa_camera.c
@@ -276,7 +276,7 @@ static void free_buffer(struct videobuf_queue *vq, struct pxa_buffer *buf)
276 * longer in STATE_QUEUED or STATE_ACTIVE 276 * longer in STATE_QUEUED or STATE_ACTIVE
277 */ 277 */
278 videobuf_waiton(&buf->vb, 0, 0); 278 videobuf_waiton(&buf->vb, 0, 0);
279 videobuf_dma_unmap(vq, dma); 279 videobuf_dma_unmap(vq->dev, dma);
280 videobuf_dma_free(dma); 280 videobuf_dma_free(dma);
281 281
282 for (i = 0; i < ARRAY_SIZE(buf->dmas); i++) { 282 for (i = 0; i < ARRAY_SIZE(buf->dmas); i++) {
diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c
index d3bd82ad010a..5bca2abb31e6 100644
--- a/drivers/media/video/saa7134/saa7134-alsa.c
+++ b/drivers/media/video/saa7134/saa7134-alsa.c
@@ -630,7 +630,7 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream,
630 /* release the old buffer */ 630 /* release the old buffer */
631 if (substream->runtime->dma_area) { 631 if (substream->runtime->dma_area) {
632 saa7134_pgtable_free(dev->pci, &dev->dmasound.pt); 632 saa7134_pgtable_free(dev->pci, &dev->dmasound.pt);
633 videobuf_sg_dma_unmap(&dev->pci->dev, &dev->dmasound.dma); 633 videobuf_dma_unmap(&dev->pci->dev, &dev->dmasound.dma);
634 dsp_buffer_free(dev); 634 dsp_buffer_free(dev);
635 substream->runtime->dma_area = NULL; 635 substream->runtime->dma_area = NULL;
636 } 636 }
@@ -646,12 +646,12 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream,
646 return err; 646 return err;
647 } 647 }
648 648
649 if (0 != (err = videobuf_sg_dma_map(&dev->pci->dev, &dev->dmasound.dma))) { 649 if (0 != (err = videobuf_dma_map(&dev->pci->dev, &dev->dmasound.dma))) {
650 dsp_buffer_free(dev); 650 dsp_buffer_free(dev);
651 return err; 651 return err;
652 } 652 }
653 if (0 != (err = saa7134_pgtable_alloc(dev->pci,&dev->dmasound.pt))) { 653 if (0 != (err = saa7134_pgtable_alloc(dev->pci,&dev->dmasound.pt))) {
654 videobuf_sg_dma_unmap(&dev->pci->dev, &dev->dmasound.dma); 654 videobuf_dma_unmap(&dev->pci->dev, &dev->dmasound.dma);
655 dsp_buffer_free(dev); 655 dsp_buffer_free(dev);
656 return err; 656 return err;
657 } 657 }
@@ -660,7 +660,7 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream,
660 dev->dmasound.dma.sglen, 660 dev->dmasound.dma.sglen,
661 0))) { 661 0))) {
662 saa7134_pgtable_free(dev->pci, &dev->dmasound.pt); 662 saa7134_pgtable_free(dev->pci, &dev->dmasound.pt);
663 videobuf_sg_dma_unmap(&dev->pci->dev, &dev->dmasound.dma); 663 videobuf_dma_unmap(&dev->pci->dev, &dev->dmasound.dma);
664 dsp_buffer_free(dev); 664 dsp_buffer_free(dev);
665 return err; 665 return err;
666 } 666 }
@@ -696,7 +696,7 @@ static int snd_card_saa7134_hw_free(struct snd_pcm_substream * substream)
696 696
697 if (substream->runtime->dma_area) { 697 if (substream->runtime->dma_area) {
698 saa7134_pgtable_free(dev->pci, &dev->dmasound.pt); 698 saa7134_pgtable_free(dev->pci, &dev->dmasound.pt);
699 videobuf_sg_dma_unmap(&dev->pci->dev, &dev->dmasound.dma); 699 videobuf_dma_unmap(&dev->pci->dev, &dev->dmasound.dma);
700 dsp_buffer_free(dev); 700 dsp_buffer_free(dev);
701 substream->runtime->dma_area = NULL; 701 substream->runtime->dma_area = NULL;
702 } 702 }
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c
index 90f231881297..40bc635e8a3f 100644
--- a/drivers/media/video/saa7134/saa7134-core.c
+++ b/drivers/media/video/saa7134/saa7134-core.c
@@ -256,7 +256,7 @@ void saa7134_dma_free(struct videobuf_queue *q,struct saa7134_buf *buf)
256 BUG_ON(in_interrupt()); 256 BUG_ON(in_interrupt());
257 257
258 videobuf_waiton(&buf->vb,0,0); 258 videobuf_waiton(&buf->vb,0,0);
259 videobuf_dma_unmap(q, dma); 259 videobuf_dma_unmap(q->dev, dma);
260 videobuf_dma_free(dma); 260 videobuf_dma_free(dma);
261 buf->vb.state = VIDEOBUF_NEEDS_INIT; 261 buf->vb.state = VIDEOBUF_NEEDS_INIT;
262} 262}
diff --git a/drivers/media/video/videobuf-dma-sg.c b/drivers/media/video/videobuf-dma-sg.c
index a9b109178578..17b1f89e8133 100644
--- a/drivers/media/video/videobuf-dma-sg.c
+++ b/drivers/media/video/videobuf-dma-sg.c
@@ -235,7 +235,7 @@ int videobuf_dma_init_overlay(struct videobuf_dmabuf *dma, int direction,
235} 235}
236EXPORT_SYMBOL_GPL(videobuf_dma_init_overlay); 236EXPORT_SYMBOL_GPL(videobuf_dma_init_overlay);
237 237
238int videobuf_dma_map(struct videobuf_queue *q, struct videobuf_dmabuf *dma) 238int videobuf_dma_map(struct device *dev, struct videobuf_dmabuf *dma)
239{ 239{
240 MAGIC_CHECK(dma->magic, MAGIC_DMABUF); 240 MAGIC_CHECK(dma->magic, MAGIC_DMABUF);
241 BUG_ON(0 == dma->nr_pages); 241 BUG_ON(0 == dma->nr_pages);
@@ -263,7 +263,7 @@ int videobuf_dma_map(struct videobuf_queue *q, struct videobuf_dmabuf *dma)
263 return -ENOMEM; 263 return -ENOMEM;
264 } 264 }
265 if (!dma->bus_addr) { 265 if (!dma->bus_addr) {
266 dma->sglen = dma_map_sg(q->dev, dma->sglist, 266 dma->sglen = dma_map_sg(dev, dma->sglist,
267 dma->nr_pages, dma->direction); 267 dma->nr_pages, dma->direction);
268 if (0 == dma->sglen) { 268 if (0 == dma->sglen) {
269 printk(KERN_WARNING 269 printk(KERN_WARNING
@@ -279,14 +279,14 @@ int videobuf_dma_map(struct videobuf_queue *q, struct videobuf_dmabuf *dma)
279} 279}
280EXPORT_SYMBOL_GPL(videobuf_dma_map); 280EXPORT_SYMBOL_GPL(videobuf_dma_map);
281 281
282int videobuf_dma_unmap(struct videobuf_queue *q, struct videobuf_dmabuf *dma) 282int videobuf_dma_unmap(struct device *dev, struct videobuf_dmabuf *dma)
283{ 283{
284 MAGIC_CHECK(dma->magic, MAGIC_DMABUF); 284 MAGIC_CHECK(dma->magic, MAGIC_DMABUF);
285 285
286 if (!dma->sglen) 286 if (!dma->sglen)
287 return 0; 287 return 0;
288 288
289 dma_unmap_sg(q->dev, dma->sglist, dma->sglen, dma->direction); 289 dma_unmap_sg(dev, dma->sglist, dma->sglen, dma->direction);
290 290
291 vfree(dma->sglist); 291 vfree(dma->sglist);
292 dma->sglist = NULL; 292 dma->sglist = NULL;
@@ -322,28 +322,6 @@ EXPORT_SYMBOL_GPL(videobuf_dma_free);
322 322
323/* --------------------------------------------------------------------- */ 323/* --------------------------------------------------------------------- */
324 324
325int videobuf_sg_dma_map(struct device *dev, struct videobuf_dmabuf *dma)
326{
327 struct videobuf_queue q;
328
329 q.dev = dev;
330
331 return videobuf_dma_map(&q, dma);
332}
333EXPORT_SYMBOL_GPL(videobuf_sg_dma_map);
334
335int videobuf_sg_dma_unmap(struct device *dev, struct videobuf_dmabuf *dma)
336{
337 struct videobuf_queue q;
338
339 q.dev = dev;
340
341 return videobuf_dma_unmap(&q, dma);
342}
343EXPORT_SYMBOL_GPL(videobuf_sg_dma_unmap);
344
345/* --------------------------------------------------------------------- */
346
347static void videobuf_vm_open(struct vm_area_struct *vma) 325static void videobuf_vm_open(struct vm_area_struct *vma)
348{ 326{
349 struct videobuf_mapping *map = vma->vm_private_data; 327 struct videobuf_mapping *map = vma->vm_private_data;
@@ -520,7 +498,7 @@ static int __videobuf_iolock(struct videobuf_queue *q,
520 default: 498 default:
521 BUG(); 499 BUG();
522 } 500 }
523 err = videobuf_dma_map(q, &mem->dma); 501 err = videobuf_dma_map(q->dev, &mem->dma);
524 if (0 != err) 502 if (0 != err)
525 return err; 503 return err;
526 504
diff --git a/drivers/staging/cx25821/cx25821-alsa.c b/drivers/staging/cx25821/cx25821-alsa.c
index 1798975a69bd..4ce8790b05ec 100644
--- a/drivers/staging/cx25821/cx25821-alsa.c
+++ b/drivers/staging/cx25821/cx25821-alsa.c
@@ -331,7 +331,7 @@ static int dsp_buffer_free(struct cx25821_audio_dev *chip)
331 BUG_ON(!chip->dma_size); 331 BUG_ON(!chip->dma_size);
332 332
333 dprintk(2, "Freeing buffer\n"); 333 dprintk(2, "Freeing buffer\n");
334 videobuf_sg_dma_unmap(&chip->pci->dev, chip->dma_risc); 334 videobuf_dma_unmap(&chip->pci->dev, chip->dma_risc);
335 videobuf_dma_free(chip->dma_risc); 335 videobuf_dma_free(chip->dma_risc);
336 btcx_riscmem_free(chip->pci, &chip->buf->risc); 336 btcx_riscmem_free(chip->pci, &chip->buf->risc);
337 kfree(chip->buf); 337 kfree(chip->buf);
@@ -470,7 +470,7 @@ static int snd_cx25821_hw_params(struct snd_pcm_substream *substream,
470 if (ret < 0) 470 if (ret < 0)
471 goto error; 471 goto error;
472 472
473 ret = videobuf_sg_dma_map(&chip->pci->dev, dma); 473 ret = videobuf_dma_map(&chip->pci->dev, dma);
474 if (ret < 0) 474 if (ret < 0)
475 goto error; 475 goto error;
476 476
diff --git a/drivers/staging/cx25821/cx25821-core.c b/drivers/staging/cx25821/cx25821-core.c
index be44195783d4..c487c19256b9 100644
--- a/drivers/staging/cx25821/cx25821-core.c
+++ b/drivers/staging/cx25821/cx25821-core.c
@@ -1320,7 +1320,7 @@ void cx25821_free_buffer(struct videobuf_queue *q, struct cx25821_buffer *buf)
1320 1320
1321 BUG_ON(in_interrupt()); 1321 BUG_ON(in_interrupt());
1322 videobuf_waiton(&buf->vb, 0, 0); 1322 videobuf_waiton(&buf->vb, 0, 0);
1323 videobuf_dma_unmap(q, dma); 1323 videobuf_dma_unmap(q->dev, dma);
1324 videobuf_dma_free(dma); 1324 videobuf_dma_free(dma);
1325 btcx_riscmem_free(to_pci_dev(q->dev), &buf->risc); 1325 btcx_riscmem_free(to_pci_dev(q->dev), &buf->risc);
1326 buf->vb.state = VIDEOBUF_NEEDS_INIT; 1326 buf->vb.state = VIDEOBUF_NEEDS_INIT;
diff --git a/include/media/videobuf-dma-sg.h b/include/media/videobuf-dma-sg.h
index a195f3b9c00a..80130100e450 100644
--- a/include/media/videobuf-dma-sg.h
+++ b/include/media/videobuf-dma-sg.h
@@ -87,6 +87,16 @@ struct videobuf_dma_sg_memory {
87 struct videobuf_dmabuf dma; 87 struct videobuf_dmabuf dma;
88}; 88};
89 89
90/*
91 * Scatter-gather DMA buffer API.
92 *
93 * These functions provide a simple way to create a page list and a
94 * scatter-gather list from a kernel, userspace of physical address and map the
95 * memory for DMA operation.
96 *
97 * Despite the name, this is totally unrelated to videobuf, except that
98 * videobuf-dma-sg uses the same API internally.
99 */
90void videobuf_dma_init(struct videobuf_dmabuf *dma); 100void videobuf_dma_init(struct videobuf_dmabuf *dma);
91int videobuf_dma_init_user(struct videobuf_dmabuf *dma, int direction, 101int videobuf_dma_init_user(struct videobuf_dmabuf *dma, int direction,
92 unsigned long data, unsigned long size); 102 unsigned long data, unsigned long size);
@@ -96,8 +106,8 @@ int videobuf_dma_init_overlay(struct videobuf_dmabuf *dma, int direction,
96 dma_addr_t addr, int nr_pages); 106 dma_addr_t addr, int nr_pages);
97int videobuf_dma_free(struct videobuf_dmabuf *dma); 107int videobuf_dma_free(struct videobuf_dmabuf *dma);
98 108
99int videobuf_dma_map(struct videobuf_queue *q, struct videobuf_dmabuf *dma); 109int videobuf_dma_map(struct device *dev, struct videobuf_dmabuf *dma);
100int videobuf_dma_unmap(struct videobuf_queue *q, struct videobuf_dmabuf *dma); 110int videobuf_dma_unmap(struct device *dev, struct videobuf_dmabuf *dma);
101struct videobuf_dmabuf *videobuf_to_dma(struct videobuf_buffer *buf); 111struct videobuf_dmabuf *videobuf_to_dma(struct videobuf_buffer *buf);
102 112
103void *videobuf_sg_alloc(size_t size); 113void *videobuf_sg_alloc(size_t size);
@@ -111,11 +121,5 @@ void videobuf_queue_sg_init(struct videobuf_queue *q,
111 unsigned int msize, 121 unsigned int msize,
112 void *priv); 122 void *priv);
113 123
114/*FIXME: these variants are used only on *-alsa code, where videobuf is
115 * used without queue
116 */
117int videobuf_sg_dma_map(struct device *dev, struct videobuf_dmabuf *dma);
118int videobuf_sg_dma_unmap(struct device *dev, struct videobuf_dmabuf *dma);
119
120#endif /* _VIDEOBUF_DMA_SG_H */ 124#endif /* _VIDEOBUF_DMA_SG_H */
121 125