Commit 0f9bd7b1 authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Mark Brown

ASoC: dapm: Simplify snd_soc_dapm_link_dai_widgets()

If we find a widget who's stream name matches the name of a DAI widget then
thats the one it should be connected to. Based on the widget id we can say in
which direction the path should be. No need to go back to the DAI and check the
stream names.
Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent fe83897f
...@@ -3334,6 +3334,7 @@ int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm, ...@@ -3334,6 +3334,7 @@ int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm,
int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card) int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card)
{ {
struct snd_soc_dapm_widget *dai_w, *w; struct snd_soc_dapm_widget *dai_w, *w;
struct snd_soc_dapm_widget *src, *sink;
struct snd_soc_dai *dai; struct snd_soc_dai *dai;
/* For each DAI widget... */ /* For each DAI widget... */
...@@ -3364,25 +3365,15 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card) ...@@ -3364,25 +3365,15 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card)
if (!w->sname || !strstr(w->sname, dai_w->name)) if (!w->sname || !strstr(w->sname, dai_w->name))
continue; continue;
if (dai->driver->playback.stream_name && if (dai_w->id == snd_soc_dapm_dai_in) {
strstr(w->sname, src = dai_w;
dai->driver->playback.stream_name)) { sink = w;
dev_dbg(dai->dev, "%s -> %s\n", } else {
dai->playback_widget->name, w->name); src = w;
sink = dai_w;
snd_soc_dapm_add_path(w->dapm,
dai->playback_widget, w, NULL, NULL);
}
if (dai->driver->capture.stream_name &&
strstr(w->sname,
dai->driver->capture.stream_name)) {
dev_dbg(dai->dev, "%s -> %s\n",
w->name, dai->capture_widget->name);
snd_soc_dapm_add_path(w->dapm, w,
dai->capture_widget, NULL, NULL);
} }
dev_dbg(dai->dev, "%s -> %s\n", src->name, sink->name);
snd_soc_dapm_add_path(w->dapm, src, sink, NULL, NULL);
} }
} }
......
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