aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/imx/imx-pcm-dma-mx2.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/imx/imx-pcm-dma-mx2.c')
-rw-r--r--sound/soc/imx/imx-pcm-dma-mx2.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/sound/soc/imx/imx-pcm-dma-mx2.c b/sound/soc/imx/imx-pcm-dma-mx2.c
index 1cf2fe889f6a..5780c9b9d569 100644
--- a/sound/soc/imx/imx-pcm-dma-mx2.c
+++ b/sound/soc/imx/imx-pcm-dma-mx2.c
@@ -88,11 +88,13 @@ static int imx_ssi_dma_alloc(struct snd_pcm_substream *substream,
88 iprtd->dma_data.dma_request = dma_params->dma; 88 iprtd->dma_data.dma_request = dma_params->dma;
89 89
90 /* Try to grab a DMA channel */ 90 /* Try to grab a DMA channel */
91 dma_cap_zero(mask); 91 if (!iprtd->dma_chan) {
92 dma_cap_set(DMA_SLAVE, mask); 92 dma_cap_zero(mask);
93 iprtd->dma_chan = dma_request_channel(mask, filter, iprtd); 93 dma_cap_set(DMA_SLAVE, mask);
94 if (!iprtd->dma_chan) 94 iprtd->dma_chan = dma_request_channel(mask, filter, iprtd);
95 return -EINVAL; 95 if (!iprtd->dma_chan)
96 return -EINVAL;
97 }
96 98
97 switch (params_format(params)) { 99 switch (params_format(params)) {
98 case SNDRV_PCM_FORMAT_S16_LE: 100 case SNDRV_PCM_FORMAT_S16_LE:
@@ -107,12 +109,12 @@ static int imx_ssi_dma_alloc(struct snd_pcm_substream *substream,
107 } 109 }
108 110
109 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 111 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
110 slave_config.direction = DMA_TO_DEVICE; 112 slave_config.direction = DMA_MEM_TO_DEV;
111 slave_config.dst_addr = dma_params->dma_addr; 113 slave_config.dst_addr = dma_params->dma_addr;
112 slave_config.dst_addr_width = buswidth; 114 slave_config.dst_addr_width = buswidth;
113 slave_config.dst_maxburst = dma_params->burstsize; 115 slave_config.dst_maxburst = dma_params->burstsize;
114 } else { 116 } else {
115 slave_config.direction = DMA_FROM_DEVICE; 117 slave_config.direction = DMA_DEV_TO_MEM;
116 slave_config.src_addr = dma_params->dma_addr; 118 slave_config.src_addr = dma_params->dma_addr;
117 slave_config.src_addr_width = buswidth; 119 slave_config.src_addr_width = buswidth;
118 slave_config.src_maxburst = dma_params->burstsize; 120 slave_config.src_maxburst = dma_params->burstsize;
@@ -159,7 +161,7 @@ static int snd_imx_pcm_hw_params(struct snd_pcm_substream *substream,
159 iprtd->period_bytes * iprtd->periods, 161 iprtd->period_bytes * iprtd->periods,
160 iprtd->period_bytes, 162 iprtd->period_bytes,
161 substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? 163 substream->stream == SNDRV_PCM_STREAM_PLAYBACK ?
162 DMA_TO_DEVICE : DMA_FROM_DEVICE); 164 DMA_MEM_TO_DEV : DMA_DEV_TO_MEM);
163 if (!iprtd->desc) { 165 if (!iprtd->desc) {
164 dev_err(&chan->dev->device, "cannot prepare slave dma\n"); 166 dev_err(&chan->dev->device, "cannot prepare slave dma\n");
165 return -EINVAL; 167 return -EINVAL;