aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
authorArun Shamanna Lakshmi <aruns@nvidia.com>2014-01-15 16:03:16 -0500
committerMark Brown <broonie@linaro.org>2014-01-17 13:56:39 -0500
commitbd23c5b661858446267f4d6b2fb4edd8eb710dda (patch)
treeccbf981df05f1816b30ae2517172b9243d3ab1a3 /sound/soc
parentf7d3c17096f6cbca8f0113d5a092ffcc72c7bf41 (diff)
ASoC: dapm: Fix double prefix addition
The prefix for the codec driver can be used during dual identical codec usecases. However, dapm adds prefix twice for codec DAI widget in snd_soc_dapm_add_route API. This change is to avoid double prefix addition for codec DAI widget and is needed while using identical dual codecs. Signed-off-by: Songhee Baek <sbaek@nvidia.com> Signed-off-by: Arun Shamanna Lakshmi <aruns@nvidia.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/soc-dapm.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 2a44fe9122a2..dc8ff13187f7 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -2476,7 +2476,8 @@ err:
2476} 2476}
2477 2477
2478static int snd_soc_dapm_add_route(struct snd_soc_dapm_context *dapm, 2478static int snd_soc_dapm_add_route(struct snd_soc_dapm_context *dapm,
2479 const struct snd_soc_dapm_route *route) 2479 const struct snd_soc_dapm_route *route,
2480 unsigned int is_prefixed)
2480{ 2481{
2481 struct snd_soc_dapm_widget *wsource = NULL, *wsink = NULL, *w; 2482 struct snd_soc_dapm_widget *wsource = NULL, *wsink = NULL, *w;
2482 struct snd_soc_dapm_widget *wtsource = NULL, *wtsink = NULL; 2483 struct snd_soc_dapm_widget *wtsource = NULL, *wtsink = NULL;
@@ -2486,7 +2487,7 @@ static int snd_soc_dapm_add_route(struct snd_soc_dapm_context *dapm,
2486 char prefixed_source[80]; 2487 char prefixed_source[80];
2487 int ret; 2488 int ret;
2488 2489
2489 if (dapm->codec && dapm->codec->name_prefix) { 2490 if (dapm->codec && dapm->codec->name_prefix && !is_prefixed) {
2490 snprintf(prefixed_sink, sizeof(prefixed_sink), "%s %s", 2491 snprintf(prefixed_sink, sizeof(prefixed_sink), "%s %s",
2491 dapm->codec->name_prefix, route->sink); 2492 dapm->codec->name_prefix, route->sink);
2492 sink = prefixed_sink; 2493 sink = prefixed_sink;
@@ -2614,7 +2615,7 @@ int snd_soc_dapm_add_routes(struct snd_soc_dapm_context *dapm,
2614 2615
2615 mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_INIT); 2616 mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_INIT);
2616 for (i = 0; i < num; i++) { 2617 for (i = 0; i < num; i++) {
2617 r = snd_soc_dapm_add_route(dapm, route); 2618 r = snd_soc_dapm_add_route(dapm, route, false);
2618 if (r < 0) { 2619 if (r < 0) {
2619 dev_err(dapm->dev, "ASoC: Failed to add route %s -> %s -> %s\n", 2620 dev_err(dapm->dev, "ASoC: Failed to add route %s -> %s -> %s\n",
2620 route->source, 2621 route->source,
@@ -3670,7 +3671,7 @@ void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card)
3670 cpu_dai->codec->name, r.source, 3671 cpu_dai->codec->name, r.source,
3671 codec_dai->platform->name, r.sink); 3672 codec_dai->platform->name, r.sink);
3672 3673
3673 snd_soc_dapm_add_route(&card->dapm, &r); 3674 snd_soc_dapm_add_route(&card->dapm, &r, true);
3674 } 3675 }
3675 3676
3676 /* connect BE DAI capture if widgets are valid */ 3677 /* connect BE DAI capture if widgets are valid */
@@ -3681,7 +3682,7 @@ void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card)
3681 codec_dai->codec->name, r.source, 3682 codec_dai->codec->name, r.source,
3682 cpu_dai->platform->name, r.sink); 3683 cpu_dai->platform->name, r.sink);
3683 3684
3684 snd_soc_dapm_add_route(&card->dapm, &r); 3685 snd_soc_dapm_add_route(&card->dapm, &r, true);
3685 } 3686 }
3686 3687
3687 } 3688 }