ASoC: SOF: topology: connect dai widget to all cpu-dais
authorBard Liao <yung-chuan.liao@linux.intel.com>
Thu, 12 Mar 2020 20:06:22 +0000 (15:06 -0500)
committerMark Brown <broonie@kernel.org>
Fri, 13 Mar 2020 15:13:26 +0000 (15:13 +0000)
Extend code from single cpu-dai to multi-dai

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200312200622.24477-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/topology.c

index 9f4f8868b3860b851c918ae4188bd0fcb14c8ad9..058de94fb8cf63c9f3618b1df09e2eb89343afa8 100644 (file)
@@ -1240,6 +1240,8 @@ static int sof_connect_dai_widget(struct snd_soc_component *scomp,
 {
        struct snd_soc_card *card = scomp->card;
        struct snd_soc_pcm_runtime *rtd;
+       struct snd_soc_dai *cpu_dai;
+       int i;
 
        list_for_each_entry(rtd, &card->rtd_list, list) {
                dev_vdbg(scomp->dev, "tplg: check widget: %s stream: %s dai stream: %s\n",
@@ -1254,13 +1256,15 @@ static int sof_connect_dai_widget(struct snd_soc_component *scomp,
 
                switch (w->id) {
                case snd_soc_dapm_dai_out:
-                       rtd->cpu_dai->capture_widget = w;
+                       for_each_rtd_cpu_dais(rtd, i, cpu_dai)
+                               cpu_dai->capture_widget = w;
                        dai->name = rtd->dai_link->name;
                        dev_dbg(scomp->dev, "tplg: connected widget %s -> DAI link %s\n",
                                w->name, rtd->dai_link->name);
                        break;
                case snd_soc_dapm_dai_in:
-                       rtd->cpu_dai->playback_widget = w;
+                       for_each_rtd_cpu_dais(rtd, i, cpu_dai)
+                               cpu_dai->playback_widget = w;
                        dai->name = rtd->dai_link->name;
                        dev_dbg(scomp->dev, "tplg: connected widget %s -> DAI link %s\n",
                                w->name, rtd->dai_link->name);