aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound/memalloc.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/sound/memalloc.h')
-rw-r--r--include/sound/memalloc.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/include/sound/memalloc.h b/include/sound/memalloc.h
index ae2921d9ddcc..7ccce94a5255 100644
--- a/include/sound/memalloc.h
+++ b/include/sound/memalloc.h
@@ -37,7 +37,6 @@ struct snd_dma_device {
37#ifndef snd_dma_pci_data 37#ifndef snd_dma_pci_data
38#define snd_dma_pci_data(pci) (&(pci)->dev) 38#define snd_dma_pci_data(pci) (&(pci)->dev)
39#define snd_dma_isa_data() NULL 39#define snd_dma_isa_data() NULL
40#define snd_dma_sbus_data(sbus) ((struct device *)(sbus))
41#define snd_dma_continuous_data(x) ((struct device *)(unsigned long)(x)) 40#define snd_dma_continuous_data(x) ((struct device *)(unsigned long)(x))
42#endif 41#endif
43 42
@@ -49,7 +48,6 @@ struct snd_dma_device {
49#define SNDRV_DMA_TYPE_CONTINUOUS 1 /* continuous no-DMA memory */ 48#define SNDRV_DMA_TYPE_CONTINUOUS 1 /* continuous no-DMA memory */
50#define SNDRV_DMA_TYPE_DEV 2 /* generic device continuous */ 49#define SNDRV_DMA_TYPE_DEV 2 /* generic device continuous */
51#define SNDRV_DMA_TYPE_DEV_SG 3 /* generic device SG-buffer */ 50#define SNDRV_DMA_TYPE_DEV_SG 3 /* generic device SG-buffer */
52#define SNDRV_DMA_TYPE_SBUS 4 /* SBUS continuous */
53 51
54/* 52/*
55 * info for buffer allocation 53 * info for buffer allocation
@@ -65,6 +63,11 @@ struct snd_dma_buffer {
65/* 63/*
66 * Scatter-Gather generic device pages 64 * Scatter-Gather generic device pages
67 */ 65 */
66void *snd_malloc_sgbuf_pages(struct device *device,
67 size_t size, struct snd_dma_buffer *dmab,
68 size_t *res_size);
69int snd_free_sgbuf_pages(struct snd_dma_buffer *dmab);
70
68struct snd_sg_page { 71struct snd_sg_page {
69 void *buf; 72 void *buf;
70 dma_addr_t addr; 73 dma_addr_t addr;
@@ -92,9 +95,18 @@ static inline unsigned int snd_sgbuf_aligned_pages(size_t size)
92 */ 95 */
93static inline dma_addr_t snd_sgbuf_get_addr(struct snd_sg_buf *sgbuf, size_t offset) 96static inline dma_addr_t snd_sgbuf_get_addr(struct snd_sg_buf *sgbuf, size_t offset)
94{ 97{
95 return sgbuf->table[offset >> PAGE_SHIFT].addr + offset % PAGE_SIZE; 98 dma_addr_t addr = sgbuf->table[offset >> PAGE_SHIFT].addr;
99 addr &= PAGE_MASK;
100 return addr + offset % PAGE_SIZE;
96} 101}
97 102
103/*
104 * return the virtual address at the corresponding offset
105 */
106static inline void *snd_sgbuf_get_ptr(struct snd_sg_buf *sgbuf, size_t offset)
107{
108 return sgbuf->table[offset >> PAGE_SHIFT].buf + offset % PAGE_SIZE;
109}
98 110
99/* allocate/release a buffer */ 111/* allocate/release a buffer */
100int snd_dma_alloc_pages(int type, struct device *dev, size_t size, 112int snd_dma_alloc_pages(int type, struct device *dev, size_t size,