aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-dapm.c
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2014-05-07 10:20:28 -0400
committerMark Brown <broonie@linaro.org>2014-05-12 16:37:17 -0400
commit0f9bd7b19467b9454a8e3729406f4cdcaaa32814 (patch)
tree7e773e4997edd936403270d11cc0e99e584649ad /sound/soc/soc-dapm.c
parentfe83897fc5b519b085f545d5cee2b722ed4f6d85 (diff)
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: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/soc-dapm.c')
-rw-r--r--sound/soc/soc-dapm.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 21ecf9a37d00..d0c61c120ac1 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -3334,6 +3334,7 @@ int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm,
3334int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card) 3334int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card)
3335{ 3335{
3336 struct snd_soc_dapm_widget *dai_w, *w; 3336 struct snd_soc_dapm_widget *dai_w, *w;
3337 struct snd_soc_dapm_widget *src, *sink;
3337 struct snd_soc_dai *dai; 3338 struct snd_soc_dai *dai;
3338 3339
3339 /* For each DAI widget... */ 3340 /* For each DAI widget... */
@@ -3364,25 +3365,15 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card)
3364 if (!w->sname || !strstr(w->sname, dai_w->name)) 3365 if (!w->sname || !strstr(w->sname, dai_w->name))
3365 continue; 3366 continue;
3366 3367
3367 if (dai->driver->playback.stream_name && 3368 if (dai_w->id == snd_soc_dapm_dai_in) {
3368 strstr(w->sname, 3369 src = dai_w;
3369 dai->driver->playback.stream_name)) { 3370 sink = w;
3370 dev_dbg(dai->dev, "%s -> %s\n", 3371 } else {
3371 dai->playback_widget->name, w->name); 3372 src = w;
3372 3373 sink = dai_w;
3373 snd_soc_dapm_add_path(w->dapm,
3374 dai->playback_widget, w, NULL, NULL);
3375 }
3376
3377 if (dai->driver->capture.stream_name &&
3378 strstr(w->sname,
3379 dai->driver->capture.stream_name)) {
3380 dev_dbg(dai->dev, "%s -> %s\n",
3381 w->name, dai->capture_widget->name);
3382
3383 snd_soc_dapm_add_path(w->dapm, w,
3384 dai->capture_widget, NULL, NULL);
3385 } 3374 }
3375 dev_dbg(dai->dev, "%s -> %s\n", src->name, sink->name);
3376 snd_soc_dapm_add_path(w->dapm, src, sink, NULL, NULL);
3386 } 3377 }
3387 } 3378 }
3388 3379