29 #include <linux/module.h>
45 static void bf5xx_dma_irq(
void *
data)
59 .period_bytes_min = 32,
60 .period_bytes_max = 0x10000,
63 .buffer_bytes_max = 0x20000,
87 int period_bytes = frames_to_bytes(runtime, runtime->
period_size);
93 runtime->
periods, period_bytes);
97 runtime->
periods, period_bytes);
150 if (diff == snd_pcm_lib_buffer_bytes(substream))
153 frames = bytes_to_frames(substream->
runtime, diff);
162 struct sport_device *sport_handle = snd_soc_dai_get_drvdata(cpu_dai);
176 if (sport_handle !=
NULL) {
184 pr_err(
"sport_handle is NULL\n");
206 .open = bf5xx_pcm_open,
208 .hw_params = bf5xx_pcm_hw_params,
209 .hw_free = bf5xx_pcm_hw_free,
210 .prepare = bf5xx_pcm_prepare,
211 .trigger = bf5xx_pcm_trigger,
212 .pointer = bf5xx_pcm_pointer,
213 .mmap = bf5xx_pcm_mmap,
216 static int bf5xx_pcm_preallocate_dma_buffer(
struct snd_pcm *pcm,
int stream)
228 pr_err(
"Failed to allocate dma memory - Please increase uncached DMA memory region\n");
233 pr_debug(
"%s, area:%p, size:0x%08lx\n", __func__,
239 static void bf5xx_pcm_free_dma_buffers(
struct snd_pcm *pcm)
245 for (stream = 0; stream < 2; stream++) {
246 substream = pcm->
streams[stream].substream;
267 if (!card->
dev->dma_mask)
268 card->
dev->dma_mask = &bf5xx_pcm_dmamask;
269 if (!card->
dev->coherent_dma_mask)
273 ret = bf5xx_pcm_preallocate_dma_buffer(pcm,
280 ret = bf5xx_pcm_preallocate_dma_buffer(pcm,
290 .ops = &bf5xx_pcm_i2s_ops,
291 .pcm_new = bf5xx_pcm_i2s_new,
292 .pcm_free = bf5xx_pcm_free_dma_buffers,
308 .name =
"bfin-i2s-pcm-audio",
312 .probe = bfin_i2s_soc_platform_probe,
313 .remove =
__devexit_p(bfin_i2s_soc_platform_remove),