From: Mark Brown Date: Mon, 9 Dec 2013 18:44:55 +0000 (+0000) Subject: Merge remote-tracking branch 'asoc/fix/dma' into asoc-dma X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a715d01e9c8177634bd7c22e67c9088282744569;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git Merge remote-tracking branch 'asoc/fix/dma' into asoc-dma --- a715d01e9c8177634bd7c22e67c9088282744569 diff --cc sound/soc/soc-generic-dmaengine-pcm.c index fbc28a799e06,41949af3baae..1cb3494cf278 --- a/sound/soc/soc-generic-dmaengine-pcm.c +++ b/sound/soc/soc-generic-dmaengine-pcm.c @@@ -298,21 -294,31 +298,35 @@@ static void dmaengine_pcm_request_chan_ !dev->of_node) return; - if (pcm->flags & SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX) { - pcm->chan[0] = dma_request_slave_channel(dev, "rx-tx"); - pcm->chan[1] = pcm->chan[0]; - } else { - for (i = SNDRV_PCM_STREAM_PLAYBACK; i <= SNDRV_PCM_STREAM_CAPTURE; i++) { - pcm->chan[i] = dma_request_slave_channel(dev, - dmaengine_pcm_dma_channel_names[i]); - } + for (i = SNDRV_PCM_STREAM_PLAYBACK; i <= SNDRV_PCM_STREAM_CAPTURE; + i++) { + if (pcm->flags & SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX) + name = "rx-tx"; + else + name = dmaengine_pcm_dma_channel_names[i]; + pcm->chan[i] = dma_request_slave_channel(dev, name); + if (pcm->flags & SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX) + break; } + + if (pcm->flags & SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX) + pcm->chan[1] = pcm->chan[0]; } + static void dmaengine_pcm_release_chan(struct dmaengine_pcm *pcm) + { + unsigned int i; + + for (i = SNDRV_PCM_STREAM_PLAYBACK; i <= SNDRV_PCM_STREAM_CAPTURE; + i++) { + if (!pcm->chan[i]) + continue; + dma_release_channel(pcm->chan[i]); + if (pcm->flags & SND_DMAENGINE_PCM_FLAG_HALF_DUPLEX) + break; + } + } + /** * snd_dmaengine_pcm_register - Register a dmaengine based PCM device * @dev: The parent device for the PCM device