Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] ASoC: when initializing CPU DAI, don't duplicate any CODEC init
@ 2012-06-08 18:34 Stephen Warren
  2012-06-08 18:34 ` [PATCH 2/4] ASoC: when removing a CPU DAI, clean up its DAPM context Stephen Warren
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Stephen Warren @ 2012-06-08 18:34 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood; +Cc: alsa-devel, Stephen Warren

From: Stephen Warren <swarren@nvidia.com>

If the CPU-side of a DAI link is a CODEC rather than a standalone DAI,
the codec initialization will call try_module_get() and create the DAI
widgets. Ensure that this isn't duplicated when the CPU DAI itself is
probed, if the CPU DAI is part of a CODEC.

Note that this is not a complete fix on its own, since there's no
guarantee that the CODEC itself will be initialized - currently that only
happens if the CODEC is also used as the CODEC-side of a DAI link, and
that initialization may happen before or after the DAIs within the CODEC
are initialized. However, such a scenario doesn't necessarily currently
work, and I don't think this change alone makes it any worse. This is
fixed in a couple patches time.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
 sound/soc/soc-core.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 3d803f3..448d4a7 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -983,7 +983,9 @@ static void soc_remove_dai_link(struct snd_soc_card *card, int num, int order)
 		}
 		cpu_dai->probed = 0;
 		list_del(&cpu_dai->card_list);
-		module_put(cpu_dai->dev->driver->owner);
+
+		if (!cpu_dai->codec)
+			module_put(cpu_dai->dev->driver->owner);
 	}
 }
 
@@ -1257,11 +1259,13 @@ static int soc_probe_dai_link(struct snd_soc_card *card, int num, int order)
 	/* probe the cpu_dai */
 	if (!cpu_dai->probed &&
 			cpu_dai->driver->probe_order == order) {
-		cpu_dai->dapm.card = card;
-		if (!try_module_get(cpu_dai->dev->driver->owner))
-			return -ENODEV;
+		if (!cpu_dai->codec) {
+			cpu_dai->dapm.card = card;
+			if (!try_module_get(cpu_dai->dev->driver->owner))
+				return -ENODEV;
 
-		snd_soc_dapm_new_dai_widgets(&cpu_dai->dapm, cpu_dai);
+			snd_soc_dapm_new_dai_widgets(&cpu_dai->dapm, cpu_dai);
+		}
 
 		if (cpu_dai->driver->probe) {
 			ret = cpu_dai->driver->probe(cpu_dai);
-- 
1.7.0.4

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

end of thread, other threads:[~2012-06-13 12:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-08 18:34 [PATCH 1/4] ASoC: when initializing CPU DAI, don't duplicate any CODEC init Stephen Warren
2012-06-08 18:34 ` [PATCH 2/4] ASoC: when removing a CPU DAI, clean up its DAPM context Stephen Warren
2012-06-08 18:34 ` [PATCH 3/4] ASoC: factor out soc_remove_platform() Stephen Warren
2012-06-08 18:34 ` [PATCH 4/4] ASoC: probe CODECs and platforms before DAIs and links Stephen Warren
2012-06-13 12:18 ` [PATCH 1/4] ASoC: when initializing CPU DAI, don't duplicate any CODEC init Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox