alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2 1/3] ASoC: restructure dmaengine_pcm_request_chan_of()
@ 2013-12-03 21:26 Stephen Warren
  2013-12-03 21:26 ` [PATCH V2 2/3] ASoC: don't leak on error in snd_dmaengine_pcm_register Stephen Warren
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Stephen Warren @ 2013-12-03 21:26 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood, Lars-Peter Clausen; +Cc: alsa-devel, Stephen Warren

From: Stephen Warren <swarren@nvidia.com>

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>
---
v2 (new as a separate patch):
* Re-ordered patches, so that patch 3/3 in this series could be available
  in the ASoC tree without having to wait for the patches to the DMA tree
  the implement deferred probe during channel allocation.

This whole series is a dependency for some patches that will go through
the Tegra tree. If it could be applied to a topic branch in the ASoC tree
that would be great. the overall dependency structure will be:

a) This series.
   Can be applied on top of e.g. v3.13-rc1.
b) Patches to the DMA tree, which implement deferred probe.
   Can be applied on top of e.g. v3.13-rc1.
c) ASoC modifications to support deferred probe during DMA ch allocation
   This will depend on both (a) and (b).
d) Tegra modifications that depend on (c).
---
 sound/soc/soc-generic-dmaengine-pcm.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c
index cbc9c96ce1f4..88b011b80058 100644
--- a/sound/soc/soc-generic-dmaengine-pcm.c
+++ b/sound/soc/soc-generic-dmaengine-pcm.c
@@ -288,21 +288,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];
 }
 
 /**
-- 
1.8.1.5

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-12-09 18:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-03 21:26 [PATCH V2 1/3] ASoC: restructure dmaengine_pcm_request_chan_of() Stephen Warren
2013-12-03 21:26 ` [PATCH V2 2/3] ASoC: don't leak on error in snd_dmaengine_pcm_register Stephen Warren
2013-12-06  9:30   ` Lars-Peter Clausen
2013-12-09 18:43   ` Mark Brown
2013-12-03 21:26 ` [PATCH V2 3/3] ASoC: dmaengine: add custom DMA config to snd_dmaengine_pcm_config Stephen Warren
2013-12-09 18:45   ` Mark Brown
2013-12-06  9:30 ` [PATCH V2 1/3] ASoC: restructure dmaengine_pcm_request_chan_of() Lars-Peter Clausen
2013-12-09 18:43 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).