@@ -19,6 +19,7 @@ enum tplg_device_id {
1919 TPLG_DEVICE_SDCA_MIC ,
2020 TPLG_DEVICE_INTEL_PCH_DMIC ,
2121 TPLG_DEVICE_HDMI ,
22+ TPLG_DEVICE_LOOPBACK_VIRTUAL ,
2223 TPLG_DEVICE_MAX
2324};
2425
@@ -91,6 +92,15 @@ int sof_sdw_get_tplg_files(struct snd_soc_card *card, const struct snd_soc_acpi_
9192 } else if (strstr (dai_link -> name , "iDisp" )) {
9293 tplg_devs [tplg_num ].id = TPLG_DEVICE_HDMI ;
9394 tplg_devs [tplg_num ].name = "hdmi-pcm5" ;
95+ } else if (strstr (dai_link -> name , "Loopback_Virtual" )) {
96+ tplg_devs [tplg_num ].id = TPLG_DEVICE_LOOPBACK_VIRTUAL ;
97+ /*
98+ * Mark the LOOPBACK_VIRTUAL device but not create the LOOPBACK_VIRTUAL
99+ * topology. The information will be used to create the SoundWire
100+ * topologyes that may or may not include the echo reference
101+ */
102+ tplg_mask |= BIT (tplg_devs [tplg_num ].id );
103+ continue ;
94104 } else {
95105 /* The dai link is not supported by separated tplg yet */
96106 dev_dbg (card -> dev ,
@@ -126,6 +136,42 @@ int sof_sdw_get_tplg_files(struct snd_soc_card *card, const struct snd_soc_acpi_
126136 tplg_devs [i ].name ,
127137 tplg_devs [i ].dai_link_id );
128138 break ;
139+ case TPLG_DEVICE_SDCA_JACK :
140+ case TPLG_DEVICE_SDCA_AMP :
141+ if (tplg_mask & BIT (TPLG_DEVICE_LOOPBACK_VIRTUAL )) {
142+ /* Use the topology with echo reference */
143+ /*
144+ * The echo reference DAI should be created in the first
145+ * function topology that with the echo reference support.
146+ * SDCA JCAK function topology is always loaded before SDCA AMP,
147+ * so if the jack exists, create the echo reference DAI in the
148+ * jack topology, otherwise create it in the amp topology.
149+ */
150+ const char * ref_name ;
151+ if (tplg_devs [i ].id == TPLG_DEVICE_SDCA_AMP &&
152+ tplg_mask & BIT (TPLG_DEVICE_SDCA_JACK ))
153+ ref_name = "ref" ;
154+ else
155+ ref_name = "ref-dai" ;
156+
157+ (* tplg_files )[i ] = devm_kasprintf (card -> dev , GFP_KERNEL ,
158+ "%s/sof-%s-%s-id%d.tplg" ,
159+ prefix ,
160+ tplg_devs [i ].name ,
161+ ref_name ,
162+ tplg_devs [i ].dai_link_id );
163+ } else {
164+ /* Use the topology without echo reference */
165+ (* tplg_files )[i ] = devm_kasprintf (card -> dev , GFP_KERNEL ,
166+ "%s/sof-%s-id%d.tplg" ,
167+ prefix ,
168+ tplg_devs [i ].name ,
169+ tplg_devs [i ].dai_link_id );
170+ }
171+ break ;
172+ case TPLG_DEVICE_LOOPBACK_VIRTUAL :
173+ /* No function topology is needed for the LOOPBACK_VIRTUAL DAI link */
174+ break ;
129175 default :
130176 (* tplg_files )[i ] = devm_kasprintf (card -> dev , GFP_KERNEL ,
131177 "%s/sof-%s-id%d.tplg" ,
0 commit comments