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.h27
1 files changed, 25 insertions, 2 deletions
diff --git a/include/sound/memalloc.h b/include/sound/memalloc.h
index c42506212649..844af65af626 100644
--- a/include/sound/memalloc.h
+++ b/include/sound/memalloc.h
@@ -98,8 +98,10 @@ static inline unsigned int snd_sgbuf_aligned_pages(size_t size)
98/* 98/*
99 * return the physical address at the corresponding offset 99 * return the physical address at the corresponding offset
100 */ 100 */
101static inline dma_addr_t snd_sgbuf_get_addr(struct snd_sg_buf *sgbuf, size_t offset) 101static inline dma_addr_t snd_sgbuf_get_addr(struct snd_dma_buffer *dmab,
102 size_t offset)
102{ 103{
104 struct snd_sg_buf *sgbuf = dmab->private_data;
103 dma_addr_t addr = sgbuf->table[offset >> PAGE_SHIFT].addr; 105 dma_addr_t addr = sgbuf->table[offset >> PAGE_SHIFT].addr;
104 addr &= PAGE_MASK; 106 addr &= PAGE_MASK;
105 return addr + offset % PAGE_SIZE; 107 return addr + offset % PAGE_SIZE;
@@ -108,10 +110,31 @@ static inline dma_addr_t snd_sgbuf_get_addr(struct snd_sg_buf *sgbuf, size_t off
108/* 110/*
109 * return the virtual address at the corresponding offset 111 * return the virtual address at the corresponding offset
110 */ 112 */
111static inline void *snd_sgbuf_get_ptr(struct snd_sg_buf *sgbuf, size_t offset) 113static inline void *snd_sgbuf_get_ptr(struct snd_dma_buffer *dmab,
114 size_t offset)
112{ 115{
116 struct snd_sg_buf *sgbuf = dmab->private_data;
113 return sgbuf->table[offset >> PAGE_SHIFT].buf + offset % PAGE_SIZE; 117 return sgbuf->table[offset >> PAGE_SHIFT].buf + offset % PAGE_SIZE;
114} 118}
119
120unsigned int snd_sgbuf_get_chunk_size(struct snd_dma_buffer *dmab,
121 unsigned int ofs, unsigned int size);
122#else
123/* non-SG versions */
124static inline dma_addr_t snd_sgbuf_get_addr(struct snd_dma_buffer *dmab,
125 size_t offset)
126{
127 return dmab->addr + offset;
128}
129
130static inline void *snd_sgbuf_get_ptr(struct snd_dma_buffer *dmab,
131 size_t offset)
132{
133 return dmab->area + offset;
134}
135
136#define snd_sgbuf_get_chunk_size(dmab, ofs, size) (size)
137
115#endif /* CONFIG_SND_DMA_SGBUF */ 138#endif /* CONFIG_SND_DMA_SGBUF */
116 139
117/* allocate/release a buffer */ 140/* allocate/release a buffer */