12 #include <linux/module.h>
15 #include <linux/slab.h>
32 #define MMP_PCM_INFO (SNDRV_PCM_INFO_MMAP | \
33 SNDRV_PCM_INFO_MMAP_VALID | \
34 SNDRV_PCM_INFO_INTERLEAVED | \
35 SNDRV_PCM_INFO_PAUSE | \
36 SNDRV_PCM_INFO_RESUME)
38 #define MMP_PCM_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | \
39 SNDRV_PCM_FMTBIT_S24_LE | \
40 SNDRV_PCM_FMTBIT_S32_LE)
46 .period_bytes_min = 1024,
47 .period_bytes_max = 2048,
50 .buffer_bytes_max = 4096,
56 .period_bytes_min = 1024,
57 .period_bytes_max = 2048,
60 .buffer_bytes_max = 4096,
74 dma_params = snd_soc_dai_get_dma_data(rtd->
cpu_dai, substream);
94 snd_pcm_set_runtime_buffer(substream, &substream->
dma_buffer);
107 if ((
strcmp(dev_name(chan->
device->dev), devname) == 0) &&
130 &mmp_pcm_hardware[substream->
stream]);
133 if (dma_data ==
NULL)
173 .open = mmp_pcm_open,
174 .close = mmp_pcm_close,
176 .hw_params = mmp_pcm_hw_params,
179 .mmap = mmp_pcm_mmap,
182 static void mmp_pcm_free_dma_buffers(
struct snd_pcm *pcm)
193 for (stream = 0; stream < 2; stream++) {
196 substream = pcm->
streams[stream].substream;
218 buf->
dev.dev = substream->
pcm->card->dev;
239 for (stream = 0; stream < 2; stream++) {
240 substream = pcm->
streams[stream].substream;
242 ret = mmp_pcm_preallocate_dma_buffer(substream, stream);
250 mmp_pcm_free_dma_buffers(pcm);
257 .pcm_free = mmp_pcm_free_dma_buffers,
285 .name =
"mmp-pcm-audio",
289 .probe = mmp_pcm_probe,