diff options
-rw-r--r-- | include/sound/soc-dapm.h | 1 | ||||
-rw-r--r-- | sound/soc/soc-core.c | 1 | ||||
-rw-r--r-- | sound/soc/soc-dapm.c | 49 |
3 files changed, 51 insertions, 0 deletions
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index 2037c45adfe6..a5de124d2f9d 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h | |||
@@ -411,6 +411,7 @@ int snd_soc_dapm_new_controls(struct snd_soc_dapm_context *dapm, | |||
411 | int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm, | 411 | int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm, |
412 | struct snd_soc_dai *dai); | 412 | struct snd_soc_dai *dai); |
413 | int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card); | 413 | int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card); |
414 | void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card); | ||
414 | int snd_soc_dapm_new_pcm(struct snd_soc_card *card, | 415 | int snd_soc_dapm_new_pcm(struct snd_soc_card *card, |
415 | const struct snd_soc_pcm_stream *params, | 416 | const struct snd_soc_pcm_stream *params, |
416 | struct snd_soc_dapm_widget *source, | 417 | struct snd_soc_dapm_widget *source, |
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 4e53d87e881d..7d9c0660ab24 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -1728,6 +1728,7 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card) | |||
1728 | } | 1728 | } |
1729 | 1729 | ||
1730 | snd_soc_dapm_link_dai_widgets(card); | 1730 | snd_soc_dapm_link_dai_widgets(card); |
1731 | snd_soc_dapm_connect_dai_link_widgets(card); | ||
1731 | 1732 | ||
1732 | if (card->controls) | 1733 | if (card->controls) |
1733 | snd_soc_add_card_controls(card, card->controls, card->num_controls); | 1734 | snd_soc_add_card_controls(card, card->controls, card->num_controls); |
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 67e63ab1f11e..51b4c192f41a 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -3634,6 +3634,55 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card) | |||
3634 | return 0; | 3634 | return 0; |
3635 | } | 3635 | } |
3636 | 3636 | ||
3637 | void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card) | ||
3638 | { | ||
3639 | struct snd_soc_pcm_runtime *rtd = card->rtd; | ||
3640 | struct snd_soc_dai *cpu_dai, *codec_dai; | ||
3641 | struct snd_soc_dapm_route r; | ||
3642 | int i; | ||
3643 | |||
3644 | memset(&r, 0, sizeof(r)); | ||
3645 | |||
3646 | /* for each BE DAI link... */ | ||
3647 | for (i = 0; i < card->num_rtd; i++) { | ||
3648 | rtd = &card->rtd[i]; | ||
3649 | cpu_dai = rtd->cpu_dai; | ||
3650 | codec_dai = rtd->codec_dai; | ||
3651 | |||
3652 | /* dynamic FE links have no fixed DAI mapping */ | ||
3653 | if (rtd->dai_link->dynamic) | ||
3654 | continue; | ||
3655 | |||
3656 | /* there is no point in connecting BE DAI links with dummies */ | ||
3657 | if (snd_soc_dai_is_dummy(codec_dai) || | ||
3658 | snd_soc_dai_is_dummy(cpu_dai)) | ||
3659 | continue; | ||
3660 | |||
3661 | /* connect BE DAI playback if widgets are valid */ | ||
3662 | if (codec_dai->playback_widget && cpu_dai->playback_widget) { | ||
3663 | r.source = cpu_dai->playback_widget->name; | ||
3664 | r.sink = codec_dai->playback_widget->name; | ||
3665 | dev_dbg(rtd->dev, "connected DAI link %s:%s -> %s:%s\n", | ||
3666 | cpu_dai->codec->name, r.source, | ||
3667 | codec_dai->platform->name, r.sink); | ||
3668 | |||
3669 | snd_soc_dapm_add_route(&card->dapm, &r); | ||
3670 | } | ||
3671 | |||
3672 | /* connect BE DAI capture if widgets are valid */ | ||
3673 | if (codec_dai->capture_widget && cpu_dai->capture_widget) { | ||
3674 | r.source = codec_dai->capture_widget->name; | ||
3675 | r.sink = cpu_dai->capture_widget->name; | ||
3676 | dev_dbg(rtd->dev, "connected DAI link %s:%s -> %s:%s\n", | ||
3677 | codec_dai->codec->name, r.source, | ||
3678 | cpu_dai->platform->name, r.sink); | ||
3679 | |||
3680 | snd_soc_dapm_add_route(&card->dapm, &r); | ||
3681 | } | ||
3682 | |||
3683 | } | ||
3684 | } | ||
3685 | |||
3637 | static void soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream, | 3686 | static void soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream, |
3638 | int event) | 3687 | int event) |
3639 | { | 3688 | { |