diff options
author | Stephen Warren <swarren@nvidia.com> | 2012-06-08 14:34:20 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-06-13 08:18:04 -0400 |
commit | a9db7dbee0436f0c741c6dfb39ab0241d4131539 (patch) | |
tree | 0049b77bd27152da4728a860c5850866a74f5c00 /sound/soc/soc-core.c | |
parent | b883f363495f3d2e237170f6b8814869a3dd16fe (diff) |
ASoC: when initializing CPU DAI, don't duplicate any CODEC init
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>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/soc-core.c')
-rw-r--r-- | 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 3d803f3cd272..448d4a7c09dd 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) | |||
983 | } | 983 | } |
984 | cpu_dai->probed = 0; | 984 | cpu_dai->probed = 0; |
985 | list_del(&cpu_dai->card_list); | 985 | list_del(&cpu_dai->card_list); |
986 | module_put(cpu_dai->dev->driver->owner); | 986 | |
987 | if (!cpu_dai->codec) | ||
988 | module_put(cpu_dai->dev->driver->owner); | ||
987 | } | 989 | } |
988 | } | 990 | } |
989 | 991 | ||
@@ -1257,11 +1259,13 @@ static int soc_probe_dai_link(struct snd_soc_card *card, int num, int order) | |||
1257 | /* probe the cpu_dai */ | 1259 | /* probe the cpu_dai */ |
1258 | if (!cpu_dai->probed && | 1260 | if (!cpu_dai->probed && |
1259 | cpu_dai->driver->probe_order == order) { | 1261 | cpu_dai->driver->probe_order == order) { |
1260 | cpu_dai->dapm.card = card; | 1262 | if (!cpu_dai->codec) { |
1261 | if (!try_module_get(cpu_dai->dev->driver->owner)) | 1263 | cpu_dai->dapm.card = card; |
1262 | return -ENODEV; | 1264 | if (!try_module_get(cpu_dai->dev->driver->owner)) |
1265 | return -ENODEV; | ||
1263 | 1266 | ||
1264 | snd_soc_dapm_new_dai_widgets(&cpu_dai->dapm, cpu_dai); | 1267 | snd_soc_dapm_new_dai_widgets(&cpu_dai->dapm, cpu_dai); |
1268 | } | ||
1265 | 1269 | ||
1266 | if (cpu_dai->driver->probe) { | 1270 | if (cpu_dai->driver->probe) { |
1267 | ret = cpu_dai->driver->probe(cpu_dai); | 1271 | ret = cpu_dai->driver->probe(cpu_dai); |