Merge branch 'asoc-4.18' into asoc-4.19 wmadsp dep
[muen/linux.git] / sound / soc / codecs / hdmi-codec.c
index 38e4a8515709743c75befa77addca1b491c7979b..d00734d31e0429bf3df8c12b0bcc118ccefb3ec2 100644 (file)
@@ -291,10 +291,6 @@ static const struct snd_soc_dapm_widget hdmi_widgets[] = {
        SND_SOC_DAPM_OUTPUT("TX"),
 };
 
        SND_SOC_DAPM_OUTPUT("TX"),
 };
 
-static const struct snd_soc_dapm_route hdmi_routes[] = {
-       { "TX", NULL, "Playback" },
-};
-
 enum {
        DAI_ID_I2S = 0,
        DAI_ID_SPDIF,
 enum {
        DAI_ID_I2S = 0,
        DAI_ID_SPDIF,
@@ -689,9 +685,23 @@ static int hdmi_codec_pcm_new(struct snd_soc_pcm_runtime *rtd,
        return snd_ctl_add(rtd->card->snd_card, kctl);
 }
 
        return snd_ctl_add(rtd->card->snd_card, kctl);
 }
 
+static int hdmi_dai_probe(struct snd_soc_dai *dai)
+{
+       struct snd_soc_dapm_context *dapm;
+       struct snd_soc_dapm_route route = {
+               .sink = "TX",
+               .source = dai->driver->playback.stream_name,
+       };
+
+       dapm = snd_soc_component_get_dapm(dai->component);
+
+       return snd_soc_dapm_add_routes(dapm, &route, 1);
+}
+
 static const struct snd_soc_dai_driver hdmi_i2s_dai = {
        .name = "i2s-hifi",
        .id = DAI_ID_I2S,
 static const struct snd_soc_dai_driver hdmi_i2s_dai = {
        .name = "i2s-hifi",
        .id = DAI_ID_I2S,
+       .probe = hdmi_dai_probe,
        .playback = {
                .stream_name = "I2S Playback",
                .channels_min = 2,
        .playback = {
                .stream_name = "I2S Playback",
                .channels_min = 2,
@@ -707,6 +717,7 @@ static const struct snd_soc_dai_driver hdmi_i2s_dai = {
 static const struct snd_soc_dai_driver hdmi_spdif_dai = {
        .name = "spdif-hifi",
        .id = DAI_ID_SPDIF,
 static const struct snd_soc_dai_driver hdmi_spdif_dai = {
        .name = "spdif-hifi",
        .id = DAI_ID_SPDIF,
+       .probe = hdmi_dai_probe,
        .playback = {
                .stream_name = "SPDIF Playback",
                .channels_min = 2,
        .playback = {
                .stream_name = "SPDIF Playback",
                .channels_min = 2,
@@ -733,8 +744,6 @@ static int hdmi_of_xlate_dai_id(struct snd_soc_component *component,
 static const struct snd_soc_component_driver hdmi_driver = {
        .dapm_widgets           = hdmi_widgets,
        .num_dapm_widgets       = ARRAY_SIZE(hdmi_widgets),
 static const struct snd_soc_component_driver hdmi_driver = {
        .dapm_widgets           = hdmi_widgets,
        .num_dapm_widgets       = ARRAY_SIZE(hdmi_widgets),
-       .dapm_routes            = hdmi_routes,
-       .num_dapm_routes        = ARRAY_SIZE(hdmi_routes),
        .of_xlate_dai_id        = hdmi_of_xlate_dai_id,
        .idle_bias_on           = 1,
        .use_pmdown_time        = 1,
        .of_xlate_dai_id        = hdmi_of_xlate_dai_id,
        .idle_bias_on           = 1,
        .use_pmdown_time        = 1,