aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/imx/imx-pcm-dma-mx2.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2010-05-06 21:29:25 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2010-05-06 21:29:25 -0400
commit1ed31d6db90d51010545921e59d369d2f92b7ac2 (patch)
tree358a0b346bc8135cd5e53700eb44308b1a7c8c5b /sound/soc/imx/imx-pcm-dma-mx2.c
parentceba1abcb00b0ef0b1efcd715285f6e05523edef (diff)
parent722154e4cacf015161efe60009ae9be23d492296 (diff)
Merge commit 'origin/master' into next
Diffstat (limited to 'sound/soc/imx/imx-pcm-dma-mx2.c')
-rw-r--r--sound/soc/imx/imx-pcm-dma-mx2.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/sound/soc/imx/imx-pcm-dma-mx2.c b/sound/soc/imx/imx-pcm-dma-mx2.c
index 86668ab3f4d4..2b31ac673ea4 100644
--- a/sound/soc/imx/imx-pcm-dma-mx2.c
+++ b/sound/soc/imx/imx-pcm-dma-mx2.c
@@ -71,7 +71,12 @@ static void imx_ssi_dma_callback(int channel, void *data)
71 71
72static void snd_imx_dma_err_callback(int channel, void *data, int err) 72static void snd_imx_dma_err_callback(int channel, void *data, int err)
73{ 73{
74 pr_err("DMA error callback called\n"); 74 struct snd_pcm_substream *substream = data;
75 struct snd_soc_pcm_runtime *rtd = substream->private_data;
76 struct imx_pcm_dma_params *dma_params = rtd->dai->cpu_dai->dma_data;
77 struct snd_pcm_runtime *runtime = substream->runtime;
78 struct imx_pcm_runtime_data *iprtd = runtime->private_data;
79 int ret;
75 80
76 pr_err("DMA timeout on channel %d -%s%s%s%s\n", 81 pr_err("DMA timeout on channel %d -%s%s%s%s\n",
77 channel, 82 channel,
@@ -79,16 +84,26 @@ static void snd_imx_dma_err_callback(int channel, void *data, int err)
79 err & IMX_DMA_ERR_REQUEST ? " request" : "", 84 err & IMX_DMA_ERR_REQUEST ? " request" : "",
80 err & IMX_DMA_ERR_TRANSFER ? " transfer" : "", 85 err & IMX_DMA_ERR_TRANSFER ? " transfer" : "",
81 err & IMX_DMA_ERR_BUFFER ? " buffer" : ""); 86 err & IMX_DMA_ERR_BUFFER ? " buffer" : "");
87
88 imx_dma_disable(iprtd->dma);
89 ret = imx_dma_setup_sg(iprtd->dma, iprtd->sg_list, iprtd->sg_count,
90 IMX_DMA_LENGTH_LOOP, dma_params->dma_addr,
91 substream->stream == SNDRV_PCM_STREAM_PLAYBACK ?
92 DMA_MODE_WRITE : DMA_MODE_READ);
93 if (!ret)
94 imx_dma_enable(iprtd->dma);
82} 95}
83 96
84static int imx_ssi_dma_alloc(struct snd_pcm_substream *substream) 97static int imx_ssi_dma_alloc(struct snd_pcm_substream *substream)
85{ 98{
86 struct snd_soc_pcm_runtime *rtd = substream->private_data; 99 struct snd_soc_pcm_runtime *rtd = substream->private_data;
87 struct imx_pcm_dma_params *dma_params = rtd->dai->cpu_dai->dma_data; 100 struct imx_pcm_dma_params *dma_params;
88 struct snd_pcm_runtime *runtime = substream->runtime; 101 struct snd_pcm_runtime *runtime = substream->runtime;
89 struct imx_pcm_runtime_data *iprtd = runtime->private_data; 102 struct imx_pcm_runtime_data *iprtd = runtime->private_data;
90 int ret; 103 int ret;
91 104
105 dma_params = snd_soc_get_dma_data(rtd->dai->cpu_dai, substream);
106
92 iprtd->dma = imx_dma_request_by_prio(DRV_NAME, DMA_PRIO_HIGH); 107 iprtd->dma = imx_dma_request_by_prio(DRV_NAME, DMA_PRIO_HIGH);
93 if (iprtd->dma < 0) { 108 if (iprtd->dma < 0) {
94 pr_err("Failed to claim the audio DMA\n"); 109 pr_err("Failed to claim the audio DMA\n");
@@ -193,10 +208,12 @@ static int snd_imx_pcm_prepare(struct snd_pcm_substream *substream)
193{ 208{
194 struct snd_pcm_runtime *runtime = substream->runtime; 209 struct snd_pcm_runtime *runtime = substream->runtime;
195 struct snd_soc_pcm_runtime *rtd = substream->private_data; 210 struct snd_soc_pcm_runtime *rtd = substream->private_data;
196 struct imx_pcm_dma_params *dma_params = rtd->dai->cpu_dai->dma_data; 211 struct imx_pcm_dma_params *dma_params;
197 struct imx_pcm_runtime_data *iprtd = runtime->private_data; 212 struct imx_pcm_runtime_data *iprtd = runtime->private_data;
198 int err; 213 int err;
199 214
215 dma_params = snd_soc_get_dma_data(rtd->dai->cpu_dai, substream);
216
200 iprtd->substream = substream; 217 iprtd->substream = substream;
201 iprtd->buf = (unsigned int *)substream->dma_buffer.area; 218 iprtd->buf = (unsigned int *)substream->dma_buffer.area;
202 iprtd->period_cnt = 0; 219 iprtd->period_cnt = 0;