Lines Matching refs:dmab
27 static void snd_malloc_dev_pages(struct snd_dma_buffer *dmab, size_t size)
35 dmab->area = dma_alloc_coherent(dmab->dev.dev, size, &dmab->addr,
38 if (dmab->area && dmab->dev.type == SNDRV_DMA_TYPE_DEV_UC)
39 set_memory_wc((unsigned long)dmab->area,
45 static void snd_free_dev_pages(struct snd_dma_buffer *dmab)
48 if (dmab->dev.type == SNDRV_DMA_TYPE_DEV_UC)
49 set_memory_wb((unsigned long)dmab->area,
50 PAGE_ALIGN(dmab->bytes) >> PAGE_SHIFT);
52 dma_free_coherent(dmab->dev.dev, dmab->bytes, dmab->area, dmab->addr);
58 * @dmab: buffer allocation record to store the allocated data
63 static void snd_malloc_dev_iram(struct snd_dma_buffer *dmab, size_t size)
65 struct device *dev = dmab->dev.dev;
68 dmab->area = NULL;
69 dmab->addr = 0;
78 dmab->private_data = pool;
80 dmab->area = gen_pool_dma_alloc_align(pool, size, &dmab->addr,
86 * @dmab: buffer allocation record to store the allocated data
88 static void snd_free_dev_iram(struct snd_dma_buffer *dmab)
90 struct gen_pool *pool = dmab->private_data;
92 if (pool && dmab->area)
93 gen_pool_free(pool, (unsigned long)dmab->area, dmab->bytes);
118 * @dmab: buffer allocation record to store the allocated data
127 struct snd_dma_buffer *dmab)
133 if (WARN_ON(!dmab))
137 dmab->dev.type = type;
138 dmab->dev.dev = device;
139 dmab->bytes = 0;
140 dmab->area = NULL;
141 dmab->addr = 0;
142 dmab->private_data = NULL;
146 dmab->area = alloc_pages_exact(size, gfp);
150 dmab->area = __vmalloc(size, gfp);
155 snd_malloc_dev_iram(dmab, size);
156 if (dmab->area)
161 dmab->dev.type = SNDRV_DMA_TYPE_DEV;
166 snd_malloc_dev_pages(dmab, size);
172 snd_malloc_sgbuf_pages(device, size, dmab, NULL);
179 if (! dmab->area)
181 dmab->bytes = size;
191 * @dmab: buffer allocation record to store the allocated data
202 struct snd_dma_buffer *dmab)
206 while ((err = snd_dma_alloc_pages(type, device, size, dmab)) < 0) {
214 if (! dmab->area)
223 * @dmab: the buffer allocation record to release
227 void snd_dma_free_pages(struct snd_dma_buffer *dmab)
229 switch (dmab->dev.type) {
231 free_pages_exact(dmab->area, dmab->bytes);
234 vfree(dmab->area);
239 snd_free_dev_iram(dmab);
244 snd_free_dev_pages(dmab);
250 snd_free_sgbuf_pages(dmab);
254 pr_err("snd-malloc: invalid device type %d\n", dmab->dev.type);