From a9ff4234b23e6b74d52c3e7911bd8f6756836e07 Mon Sep 17 00:00:00 2001 From: Sugar Zhang Date: Thu, 21 May 2015 15:53:59 +0800 Subject: [PATCH] ASoC: dmaengine: use dma_request_slave_channel to request dma chan. if i2s module probe before dma module, dma chan resources are not ready. use dma_request_slave_channel to reinitialize dma chan if not ready. Signed-off-by: Sugar Zhang --- sound/soc/soc-generic-dmaengine-pcm.c | 28 ++++++--------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c index e29ec3cd84b1..38c54bb4f9e6 100644 --- a/sound/soc/soc-generic-dmaengine-pcm.c +++ b/sound/soc/soc-generic-dmaengine-pcm.c @@ -121,21 +121,10 @@ static void dmaengine_pcm_free(struct snd_pcm *pcm) snd_pcm_lib_preallocate_free_for_all(pcm); } -static struct dma_chan *dmaengine_pcm_compat_request_channel( - struct snd_soc_pcm_runtime *rtd, - struct snd_pcm_substream *substream) -{ - struct dmaengine_pcm *pcm = soc_platform_to_pcm(rtd->platform); - - if ((pcm->flags & SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX) && pcm->chan[0]) - return pcm->chan[0]; - - if (pcm->config->compat_request_channel) - return pcm->config->compat_request_channel(rtd, substream); - - return snd_dmaengine_pcm_request_channel(pcm->config->compat_filter_fn, - snd_soc_dai_get_dma_data(rtd->cpu_dai, substream)); -} +static const char * const dmaengine_pcm_dma_channel_names[] = { + [SNDRV_PCM_STREAM_PLAYBACK] = "tx", + [SNDRV_PCM_STREAM_CAPTURE] = "rx", +}; static int dmaengine_pcm_new(struct snd_soc_pcm_runtime *rtd) { @@ -151,8 +140,8 @@ static int dmaengine_pcm_new(struct snd_soc_pcm_runtime *rtd) continue; if (!pcm->chan[i] && (pcm->flags & SND_DMAENGINE_PCM_FLAG_COMPAT)) { - pcm->chan[i] = dmaengine_pcm_compat_request_channel(rtd, - substream); + pcm->chan[i] = dma_request_slave_channel(rtd->platform->dev, + dmaengine_pcm_dma_channel_names[i]); } if (!pcm->chan[i]) { @@ -212,11 +201,6 @@ static const struct snd_soc_platform_driver dmaengine_no_residue_pcm_platform = .probe_order = SND_SOC_COMP_ORDER_LATE, }; -static const char * const dmaengine_pcm_dma_channel_names[] = { - [SNDRV_PCM_STREAM_PLAYBACK] = "tx", - [SNDRV_PCM_STREAM_CAPTURE] = "rx", -}; - static void dmaengine_pcm_request_chan_of(struct dmaengine_pcm *pcm, struct device *dev) { -- 2.34.1