From fd0b2fd751fcce37f76524a0de1132ba1b635d19 Mon Sep 17 00:00:00 2001 From: Bard Liao Date: Fri, 13 Feb 2026 16:49:43 +0800 Subject: [PATCH] ASoC: sof-function-topology-lib: select different amp topologies We are going to support echo reference on the SoundWire function topologies. And the echo reference DAI should only be created once. The jack topology is always loaded before the amp topology. Therefore always create the echo reference DAI in the jack topology. And create the echo reference DAI in amp topology if no jack topology is required. Signed-off-by: Bard Liao --- sound/soc/intel/common/sof-function-topology-lib.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/sound/soc/intel/common/sof-function-topology-lib.c b/sound/soc/intel/common/sof-function-topology-lib.c index 0daa7d83808be6..fe7c5c5d56f5f5 100644 --- a/sound/soc/intel/common/sof-function-topology-lib.c +++ b/sound/soc/intel/common/sof-function-topology-lib.c @@ -56,8 +56,18 @@ int sof_sdw_get_tplg_files(struct snd_soc_card *card, const struct snd_soc_acpi_ tplg_dev_name = "sdca-jack"; } else if (strstr(dai_link->name, "SmartAmp")) { tplg_dev = TPLG_DEVICE_SDCA_AMP; - tplg_dev_name = devm_kasprintf(card->dev, GFP_KERNEL, - "sdca-%damp", dai_link->num_cpus); + /* + * The echo reference DAI will be created in the sdca-jack function topology. + * Select the topology with the echo reference DAI if the sdca-jack topology + * is not required, otherwise select the one without it. + * */ + if (tplg_mask & BIT(TPLG_DEVICE_SDCA_JACK)) + tplg_dev_name = devm_kasprintf(card->dev, GFP_KERNEL, + "sdca-%damp", dai_link->num_cpus); + else + tplg_dev_name = devm_kasprintf(card->dev, GFP_KERNEL, + "sdca-%damp-ref_dai", + dai_link->num_cpus); if (!tplg_dev_name) return -ENOMEM; } else if (strstr(dai_link->name, "SmartMic")) {