Commit bd23c5b6 authored by Arun Shamanna Lakshmi's avatar Arun Shamanna Lakshmi Committed by Mark Brown

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: default avatarSonghee Baek <sbaek@nvidia.com>
Signed-off-by: default avatarArun Shamanna Lakshmi <aruns@nvidia.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent f7d3c170
......@@ -2476,7 +2476,8 @@ static int snd_soc_dapm_add_path(struct snd_soc_dapm_context *dapm,
}
static int snd_soc_dapm_add_route(struct snd_soc_dapm_context *dapm,
const struct snd_soc_dapm_route *route)
const struct snd_soc_dapm_route *route,
unsigned int is_prefixed)
{
struct snd_soc_dapm_widget *wsource = NULL, *wsink = NULL, *w;
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,
char prefixed_source[80];
int ret;
if (dapm->codec && dapm->codec->name_prefix) {
if (dapm->codec && dapm->codec->name_prefix && !is_prefixed) {
snprintf(prefixed_sink, sizeof(prefixed_sink), "%s %s",
dapm->codec->name_prefix, route->sink);
sink = prefixed_sink;
......@@ -2614,7 +2615,7 @@ int snd_soc_dapm_add_routes(struct snd_soc_dapm_context *dapm,
mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_INIT);
for (i = 0; i < num; i++) {
r = snd_soc_dapm_add_route(dapm, route);
r = snd_soc_dapm_add_route(dapm, route, false);
if (r < 0) {
dev_err(dapm->dev, "ASoC: Failed to add route %s -> %s -> %s\n",
route->source,
......@@ -3670,7 +3671,7 @@ void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card)
cpu_dai->codec->name, r.source,
codec_dai->platform->name, r.sink);
snd_soc_dapm_add_route(&card->dapm, &r);
snd_soc_dapm_add_route(&card->dapm, &r, true);
}
/* 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)
codec_dai->codec->name, r.source,
cpu_dai->platform->name, r.sink);
snd_soc_dapm_add_route(&card->dapm, &r);
snd_soc_dapm_add_route(&card->dapm, &r, true);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment