17 #include <linux/slab.h>
19 #include <linux/module.h>
25 #include <mach/hardware.h>
30 #define ST_RUNNING (1<<0)
31 #define ST_OPENED (1<<1)
44 .buffer_bytes_max = 128*1024,
63 static void audio_buffdone(
void *
data);
81 pr_debug(
"%s: loaded %d, limit %d\n",
98 pr_debug(
"%s: corrected dma len %ld\n",
114 static void audio_buffdone(
void *
data)
129 spin_lock(&prtd->
lock);
130 if (!samsung_dma_has_circular()) {
132 dma_enqueue(substream);
134 spin_unlock(&prtd->
lock);
146 snd_soc_dai_get_dma_data(rtd->
cpu_dai, substream);
168 req.cap = (samsung_dma_has_circular() ?
181 snd_pcm_set_runtime_buffer(substream, &substream->
dma_buffer);
185 spin_lock_irq(&prtd->
lock);
187 prtd->
dma_period = params_period_bytes(params);
191 spin_unlock_irq(&prtd->
lock);
202 snd_pcm_set_runtime_buffer(substream,
NULL);
233 dma_enqueue(substream);
245 spin_lock(&prtd->
lock);
263 spin_unlock(&prtd->
lock);
279 pr_debug(
"Pointer offset: %lu\n", res);
287 if (res >= snd_pcm_lib_buffer_bytes(substream)) {
288 if (res == snd_pcm_lib_buffer_bytes(substream))
292 return bytes_to_frames(substream->
runtime, res);
323 pr_debug(
"dma_close called with prtd == NULL\n");
337 return dma_mmap_writecombine(substream->
pcm->card->dev, vma,
347 .hw_params = dma_hw_params,
348 .hw_free = dma_hw_free,
349 .prepare = dma_prepare,
350 .trigger = dma_trigger,
351 .pointer = dma_pointer,
355 static int preallocate_dma_buffer(
struct snd_pcm *pcm,
int stream)
374 static void dma_free_dma_buffers(
struct snd_pcm *pcm)
382 for (stream = 0; stream < 2; stream++) {
383 substream = pcm->
streams[stream].substream;
407 if (!card->
dev->dma_mask)
408 card->
dev->dma_mask = &dma_mask;
409 if (!card->
dev->coherent_dma_mask)
413 ret = preallocate_dma_buffer(pcm,
420 ret = preallocate_dma_buffer(pcm,
432 .pcm_free = dma_free_dma_buffers,
448 .name =
"samsung-audio",
452 .probe = samsung_asoc_platform_probe,
453 .remove =
__devexit_p(samsung_asoc_platform_remove),