aboutsummaryrefslogtreecommitdiffstats
path: root/include/media/videobuf-dma-sg.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/media/videobuf-dma-sg.h')
-rw-r--r--include/media/videobuf-dma-sg.h39
1 files changed, 13 insertions, 26 deletions
diff --git a/include/media/videobuf-dma-sg.h b/include/media/videobuf-dma-sg.h
index a195f3b9c00a..97e07f46a0fa 100644
--- a/include/media/videobuf-dma-sg.h
+++ b/include/media/videobuf-dma-sg.h
@@ -25,23 +25,6 @@
25/* --------------------------------------------------------------------- */ 25/* --------------------------------------------------------------------- */
26 26
27/* 27/*
28 * Return a scatterlist for some page-aligned vmalloc()'ed memory
29 * block (NULL on errors). Memory for the scatterlist is allocated
30 * using kmalloc. The caller must free the memory.
31 */
32struct scatterlist *videobuf_vmalloc_to_sg(unsigned char *virt, int nr_pages);
33
34/*
35 * Return a scatterlist for a an array of userpages (NULL on errors).
36 * Memory for the scatterlist is allocated using kmalloc. The caller
37 * must free the memory.
38 */
39struct scatterlist *videobuf_pages_to_sg(struct page **pages, int nr_pages,
40 int offset);
41
42/* --------------------------------------------------------------------- */
43
44/*
45 * A small set of helper functions to manage buffers (both userland 28 * A small set of helper functions to manage buffers (both userland
46 * and kernel) for DMA. 29 * and kernel) for DMA.
47 * 30 *
@@ -68,7 +51,7 @@ struct videobuf_dmabuf {
68 struct page **pages; 51 struct page **pages;
69 52
70 /* for kernel buffers */ 53 /* for kernel buffers */
71 void *vmalloc; 54 void *vaddr;
72 55
73 /* for overlay buffers (pci-pci dma) */ 56 /* for overlay buffers (pci-pci dma) */
74 dma_addr_t bus_addr; 57 dma_addr_t bus_addr;
@@ -87,6 +70,16 @@ struct videobuf_dma_sg_memory {
87 struct videobuf_dmabuf dma; 70 struct videobuf_dmabuf dma;
88}; 71};
89 72
73/*
74 * Scatter-gather DMA buffer API.
75 *
76 * These functions provide a simple way to create a page list and a
77 * scatter-gather list from a kernel, userspace of physical address and map the
78 * memory for DMA operation.
79 *
80 * Despite the name, this is totally unrelated to videobuf, except that
81 * videobuf-dma-sg uses the same API internally.
82 */
90void videobuf_dma_init(struct videobuf_dmabuf *dma); 83void videobuf_dma_init(struct videobuf_dmabuf *dma);
91int videobuf_dma_init_user(struct videobuf_dmabuf *dma, int direction, 84int videobuf_dma_init_user(struct videobuf_dmabuf *dma, int direction,
92 unsigned long data, unsigned long size); 85 unsigned long data, unsigned long size);
@@ -96,8 +89,8 @@ int videobuf_dma_init_overlay(struct videobuf_dmabuf *dma, int direction,
96 dma_addr_t addr, int nr_pages); 89 dma_addr_t addr, int nr_pages);
97int videobuf_dma_free(struct videobuf_dmabuf *dma); 90int videobuf_dma_free(struct videobuf_dmabuf *dma);
98 91
99int videobuf_dma_map(struct videobuf_queue *q, struct videobuf_dmabuf *dma); 92int videobuf_dma_map(struct device *dev, struct videobuf_dmabuf *dma);
100int videobuf_dma_unmap(struct videobuf_queue *q, struct videobuf_dmabuf *dma); 93int videobuf_dma_unmap(struct device *dev, struct videobuf_dmabuf *dma);
101struct videobuf_dmabuf *videobuf_to_dma(struct videobuf_buffer *buf); 94struct videobuf_dmabuf *videobuf_to_dma(struct videobuf_buffer *buf);
102 95
103void *videobuf_sg_alloc(size_t size); 96void *videobuf_sg_alloc(size_t size);
@@ -111,11 +104,5 @@ void videobuf_queue_sg_init(struct videobuf_queue *q,
111 unsigned int msize, 104 unsigned int msize,
112 void *priv); 105 void *priv);
113 106
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 */ 107#endif /* _VIDEOBUF_DMA_SG_H */
121 108