17 #include <linux/slab.h>
18 #include <linux/module.h>
28 #define ST_RUNNING (1<<0)
29 #define ST_OPENED (1<<1)
47 .period_bytes_min = 128,
62 void (*
cb)(
void *dt,
int bytes_xfer);
65 static struct idma_info {
73 *src = idma.lp_tx_addr +
83 spin_lock(&prtd->
lock);
84 prtd->
token = (
void *) substream;
85 spin_unlock(&prtd->
lock);
88 val = idma.lp_tx_addr + prtd->
periodsz;
92 val = idma.lp_tx_addr;
113 void (*
cb)(
void *,
int))
117 spin_lock(&prtd->
lock);
119 spin_unlock(&prtd->
lock);
122 static void idma_control(
int op)
126 spin_lock(&idma.lock);
136 spin_unlock(&idma.lock);
141 spin_unlock(&idma.lock);
144 static void idma_done(
void *
id,
int bytes_xfer)
166 snd_pcm_set_runtime_buffer(substream, &substream->
dma_buffer);
171 prtd->
periodsz = params_period_bytes(params);
174 idma_setcallbk(substream, idma_done);
181 snd_pcm_set_runtime_buffer(substream,
NULL);
194 idma_enqueue(substream);
204 spin_lock(&prtd->
lock);
226 spin_unlock(&prtd->
lock);
239 spin_lock(&prtd->
lock);
242 res = src - prtd->
start;
244 spin_unlock(&prtd->
lock);
246 return bytes_to_frames(substream->
runtime, res);
285 addr += idma.lp_tx_addr;
310 pr_err(
"fail to claim i2s irq , ret = %d\n", ret);
330 pr_err(
"idma_close called with prtd == NULL\n");
341 .trigger = idma_trigger,
342 .pointer = idma_pointer,
344 .hw_params = idma_hw_params,
345 .hw_free = idma_hw_free,
346 .prepare = idma_prepare,
349 static void idma_free(
struct snd_pcm *pcm)
368 static int preallocate_idma_buffer(
struct snd_pcm *pcm,
int stream)
378 buf->
addr = idma.lp_tx_addr;
393 if (!card->
dev->dma_mask)
395 if (!card->
dev->coherent_dma_mask)
399 ret = preallocate_idma_buffer(pcm,
410 idma.lp_tx_addr =
addr;
416 .pcm_free = idma_free,
432 .name =
"samsung-idma",
436 .probe = asoc_idma_platform_probe,