summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2013-12-03 22:26:32 +0100
committerMark Brown <broonie@linaro.org>2013-12-09 19:42:27 +0100
commit11b3a7add2841aa698aa0a32396b6db413c22eda (patch)
treeae84542e406d20f97bdc84e8a4ed31478c5fe0f3
parentASoC: generic-dmaengine-pcm: Set BATCH flag when residue reporting is not sup... (diff)
downloadlinux-11b3a7add2841aa698aa0a32396b6db413c22eda.tar.xz
linux-11b3a7add2841aa698aa0a32396b6db413c22eda.zip
ASoC: restructure dmaengine_pcm_request_chan_of()
Restructure the internals of dmaengine_pcm_request_chan_of() as a loop over all channels to be allocated. This makes it easier to add logic that applies to all allocated channels, without having to duplicate that logic in each of the half-duplex/full-duplex paths. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r--sound/soc/soc-generic-dmaengine-pcm.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c
index 87e86357124e..fbc28a799e06 100644
--- a/sound/soc/soc-generic-dmaengine-pcm.c
+++ b/sound/soc/soc-generic-dmaengine-pcm.c
@@ -291,21 +291,26 @@ static void dmaengine_pcm_request_chan_of(struct dmaengine_pcm *pcm,
struct device *dev)
{
unsigned int i;
+ const char *name;
if ((pcm->flags & (SND_DMAENGINE_PCM_FLAG_NO_DT |
SND_DMAENGINE_PCM_FLAG_CUSTOM_CHANNEL_NAME)) ||
!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];
}
/**