26 #include <linux/slab.h>
27 #include <linux/module.h>
47 .period_bytes_min = 32,
48 .period_bytes_max = 64 * 1024,
51 .buffer_bytes_max = 128 * 1024,
54 static int omap_pcm_get_dma_buswidth(
int num_bits)
84 dma_data = snd_soc_dai_get_dma_data(rtd->
cpu_dai, substream);
91 snd_pcm_set_runtime_buffer(substream, &substream->
dma_buffer);
105 int buswidth = omap_pcm_get_dma_buswidth(dma_data->
data_type);
118 return dmaengine_slave_config(chan, &
config);
123 snd_pcm_set_runtime_buffer(substream,
NULL);
133 dma_data = snd_soc_dai_get_dma_data(rtd->
cpu_dai, substream);
185 dma_data = snd_soc_dai_get_dma_data(rtd->
cpu_dai, substream);
202 return dma_mmap_writecombine(substream->
pcm->card->dev, vma,
209 .open = omap_pcm_open,
210 .close = omap_pcm_close,
212 .hw_params = omap_pcm_hw_params,
213 .hw_free = omap_pcm_hw_free,
214 .trigger = omap_pcm_trigger,
215 .pointer = omap_pcm_pointer,
216 .mmap = omap_pcm_mmap,
221 static int omap_pcm_preallocate_dma_buffer(
struct snd_pcm *pcm,
240 static void omap_pcm_free_dma_buffers(
struct snd_pcm *pcm)
246 for (stream = 0; stream < 2; stream++) {
247 substream = pcm->
streams[stream].substream;
267 if (!card->
dev->dma_mask)
268 card->
dev->dma_mask = &omap_pcm_dmamask;
269 if (!card->
dev->coherent_dma_mask)
273 ret = omap_pcm_preallocate_dma_buffer(pcm,
280 ret = omap_pcm_preallocate_dma_buffer(pcm,
289 omap_pcm_free_dma_buffers(pcm);
295 .ops = &omap_pcm_ops,
296 .pcm_new = omap_pcm_new,
297 .pcm_free = omap_pcm_free_dma_buffers,
314 .name =
"omap-pcm-audio",
318 .probe = omap_pcm_probe,