From bb940b13998c40d55e186f0cf5d65c592ea1677a Mon Sep 17 00:00:00 2001 From: Bard Liao Date: Tue, 14 Oct 2025 15:13:27 +0800 Subject: [PATCH 1/9] ASoC: SOF: Don't print the monolithic topology name if function topology may be used It may confuse people if "Topology file:" is printed but the topology file is not really used. We keep the print if the topology file is missing thus user can know what topology is missed in the file system. And increase the log level to info for the actual topology that is used. So that user can get which topology is used. Signed-off-by: Bard Liao Reviewed-by: Simon Trimmer Reviewed-by: Ranjani Sridharan Link: https://patch.msgid.link/20251014071335.3844631-2-yung-chuan.liao@linux.intel.com Signed-off-by: Mark Brown --- sound/soc/sof/fw-file-profile.c | 8 +++++++- sound/soc/sof/topology.c | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/sound/soc/sof/fw-file-profile.c b/sound/soc/sof/fw-file-profile.c index 1c0eb13ae557..d2b232860091 100644 --- a/sound/soc/sof/fw-file-profile.c +++ b/sound/soc/sof/fw-file-profile.c @@ -266,6 +266,7 @@ static void sof_print_profile_info(struct snd_sof_dev *sdev, enum sof_ipc_type ipc_type, struct sof_loadable_file_profile *profile) { + struct snd_sof_pdata *plat_data = sdev->pdata; struct device *dev = sdev->dev; if (ipc_type != profile->ipc_type) @@ -282,7 +283,12 @@ static void sof_print_profile_info(struct snd_sof_dev *sdev, if (profile->fw_lib_path) dev_info(dev, " Firmware lib path: %s\n", profile->fw_lib_path); - dev_info(dev, " Topology file: %s/%s\n", profile->tplg_path, profile->tplg_name); + + if (plat_data->machine->get_function_tplg_files && !plat_data->disable_function_topology) + dev_info(dev, " Topology file: function topologies\n"); + else + dev_info(dev, " Topology file: %s/%s\n", + profile->tplg_path, profile->tplg_name); } int sof_create_ipc_file_profile(struct snd_sof_dev *sdev, diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index b6d5c8024f8c..3404f1306494 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -2525,7 +2525,7 @@ int snd_sof_load_topology(struct snd_soc_component *scomp, const char *file) if (!tplg_cnt) { tplg_files[0] = file; tplg_cnt = 1; - dev_dbg(scomp->dev, "loading topology: %s\n", file); + dev_info(scomp->dev, "loading topology: %s\n", file); } else { dev_info(scomp->dev, "Using function topologies instead %s\n", file); } From 3180c7b1575d635851f0ceab6bdb176bb15e69dd Mon Sep 17 00:00:00 2001 From: Bard Liao Date: Tue, 14 Oct 2025 15:13:28 +0800 Subject: [PATCH 2/9] ASoC: soc-acpi: make some variables of acpi adr and link adr non-const Currently, we use predefined snd_soc_acpi_link_adr tables to match the link adr from ACPI table to select the machine driver and the topology. However, with the mechanism, we need to create the snd_soc_acpi_link_adr table for each audio config. The sof_sdw machine driver is used by almost all Intel platforms with SOF and we can load required topology file dynamically today. In other words, we can use sof_sdw machine driver as the default machine driver for Intel SOF SoundWire codecs and no need to create snd_soc_acpi_link_adr table for every new audio configs. To achieve it, we need to drop the const for some members and edit the link adr and acpi adr data to match the data from the ACPI table. Suggested-by: Charles Keepax Signed-off-by: Bard Liao Reviewed-by: Simon Trimmer Reviewed-by: Ranjani Sridharan Link: https://patch.msgid.link/20251014071335.3844631-3-yung-chuan.liao@linux.intel.com Signed-off-by: Mark Brown --- include/sound/soc-acpi.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/sound/soc-acpi.h b/include/sound/soc-acpi.h index b8af309c2683..90d73b9bddab 100644 --- a/include/sound/soc-acpi.h +++ b/include/sound/soc-acpi.h @@ -114,8 +114,8 @@ struct snd_soc_acpi_endpoint { * @name_prefix: string used for codec controls */ struct snd_soc_acpi_adr_device { - const u64 adr; - const u8 num_endpoints; + u64 adr; + u8 num_endpoints; const struct snd_soc_acpi_endpoint *endpoints; const char *name_prefix; }; @@ -131,8 +131,8 @@ struct snd_soc_acpi_adr_device { */ struct snd_soc_acpi_link_adr { - const u32 mask; - const u32 num_adr; + u32 mask; + u32 num_adr; const struct snd_soc_acpi_adr_device *adr_d; }; From aa1ee85ce3576defd29f2a389d7508d2036af977 Mon Sep 17 00:00:00 2001 From: Bard Liao Date: Tue, 14 Oct 2025 15:13:29 +0800 Subject: [PATCH 3/9] ASoC: soc_sdw_utils: add name_prefix to asoc_sdw_codec_info struct Currently, the codec name_prefix of Intel SoundWire machine driver is from the ACPI match table. We can have it in the asoc_sdw_codec_info struct as a default name_prefix of a codec if there is no corresponding audio config found in the ACPI match table. Signed-off-by: Bard Liao Reviewed-by: Simon Trimmer Reviewed-by: Ranjani Sridharan Link: https://patch.msgid.link/20251014071335.3844631-4-yung-chuan.liao@linux.intel.com Signed-off-by: Mark Brown --- include/sound/soc_sdw_utils.h | 1 + sound/soc/sdw_utils/soc_sdw_utils.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/include/sound/soc_sdw_utils.h b/include/sound/soc_sdw_utils.h index 3c5e9b2af7f1..e289b453baba 100644 --- a/include/sound/soc_sdw_utils.h +++ b/include/sound/soc_sdw_utils.h @@ -68,6 +68,7 @@ struct asoc_sdw_codec_info { const int part_id; const int version_id; const char *codec_name; + const char *name_prefix; int amp_num; const u8 acpi_id[ACPI_ID_LEN]; const bool ignore_internal_dmic; diff --git a/sound/soc/sdw_utils/soc_sdw_utils.c b/sound/soc/sdw_utils/soc_sdw_utils.c index 56c72ef27e7b..d2db597f84c0 100644 --- a/sound/soc/sdw_utils/soc_sdw_utils.c +++ b/sound/soc/sdw_utils/soc_sdw_utils.c @@ -60,6 +60,7 @@ static const struct snd_kcontrol_new rt700_controls[] = { struct asoc_sdw_codec_info codec_info_list[] = { { .part_id = 0x0000, /* TAS2783A */ + .name_prefix = "tas2783", .dais = { { .direction = {true, true}, @@ -78,6 +79,7 @@ struct asoc_sdw_codec_info codec_info_list[] = { }, { .part_id = 0x700, + .name_prefix = "rt700", .dais = { { .direction = {true, true}, @@ -95,6 +97,7 @@ struct asoc_sdw_codec_info codec_info_list[] = { }, { .part_id = 0x711, + .name_prefix = "rt711", .version_id = 3, .dais = { { @@ -115,6 +118,7 @@ struct asoc_sdw_codec_info codec_info_list[] = { }, { .part_id = 0x711, + .name_prefix = "rt711", .version_id = 2, .dais = { { @@ -135,6 +139,7 @@ struct asoc_sdw_codec_info codec_info_list[] = { }, { .part_id = 0x712, + .name_prefix = "rt712", .version_id = 3, .dais = { { @@ -176,6 +181,7 @@ struct asoc_sdw_codec_info codec_info_list[] = { }, { .part_id = 0x1712, + .name_prefix = "rt712-dmic", .version_id = 3, .dais = { { @@ -190,6 +196,7 @@ struct asoc_sdw_codec_info codec_info_list[] = { }, { .part_id = 0x713, + .name_prefix = "rt713", .version_id = 3, .dais = { { @@ -217,6 +224,7 @@ struct asoc_sdw_codec_info codec_info_list[] = { }, { .part_id = 0x1713, + .name_prefix = "rt713-dmic", .version_id = 3, .dais = { { @@ -231,6 +239,7 @@ struct asoc_sdw_codec_info codec_info_list[] = { }, { .part_id = 0x1308, + .name_prefix = "rt1308", .acpi_id = "10EC1308", .dais = { { @@ -253,6 +262,7 @@ struct asoc_sdw_codec_info codec_info_list[] = { }, { .part_id = 0x1316, + .name_prefix = "rt1316", .dais = { { .direction = {true, true}, @@ -273,6 +283,7 @@ struct asoc_sdw_codec_info codec_info_list[] = { }, { .part_id = 0x1318, + .name_prefix = "rt1318", .dais = { { .direction = {true, true}, @@ -293,6 +304,7 @@ struct asoc_sdw_codec_info codec_info_list[] = { }, { .part_id = 0x1320, + .name_prefix = "rt1320", .dais = { { .direction = {true, false}, @@ -313,6 +325,7 @@ struct asoc_sdw_codec_info codec_info_list[] = { }, { .part_id = 0x714, + .name_prefix = "rt714", .version_id = 3, .ignore_internal_dmic = true, .dais = { @@ -328,6 +341,7 @@ struct asoc_sdw_codec_info codec_info_list[] = { }, { .part_id = 0x715, + .name_prefix = "rt715", .version_id = 3, .ignore_internal_dmic = true, .dais = { @@ -343,6 +357,7 @@ struct asoc_sdw_codec_info codec_info_list[] = { }, { .part_id = 0x714, + .name_prefix = "rt714", .version_id = 2, .ignore_internal_dmic = true, .dais = { @@ -358,6 +373,7 @@ struct asoc_sdw_codec_info codec_info_list[] = { }, { .part_id = 0x715, + .name_prefix = "rt715", .version_id = 2, .ignore_internal_dmic = true, .dais = { @@ -373,6 +389,7 @@ struct asoc_sdw_codec_info codec_info_list[] = { }, { .part_id = 0x721, + .name_prefix = "rt721", .version_id = 3, .dais = { { @@ -415,6 +432,7 @@ struct asoc_sdw_codec_info codec_info_list[] = { }, { .part_id = 0x722, + .name_prefix = "rt722", .version_id = 3, .dais = { { @@ -459,6 +477,7 @@ struct asoc_sdw_codec_info codec_info_list[] = { }, { .part_id = 0x8373, + .name_prefix = "Left", .dais = { { .direction = {true, true}, @@ -478,6 +497,7 @@ struct asoc_sdw_codec_info codec_info_list[] = { }, { .part_id = 0x8363, + .name_prefix = "Left", .dais = { { .direction = {true, false}, @@ -497,6 +517,7 @@ struct asoc_sdw_codec_info codec_info_list[] = { }, { .part_id = 0x5682, + .name_prefix = "rt5682", .dais = { { .direction = {true, true}, @@ -514,6 +535,7 @@ struct asoc_sdw_codec_info codec_info_list[] = { }, { .part_id = 0x3556, + .name_prefix = "AMP", .dais = { { .direction = {true, false}, @@ -540,6 +562,7 @@ struct asoc_sdw_codec_info codec_info_list[] = { }, { .part_id = 0x3563, + .name_prefix = "AMP", .dais = { { .direction = {true, false}, @@ -566,6 +589,7 @@ struct asoc_sdw_codec_info codec_info_list[] = { }, { .part_id = 0x4242, + .name_prefix = "cs42l42", .dais = { { .direction = {true, true}, @@ -583,6 +607,7 @@ struct asoc_sdw_codec_info codec_info_list[] = { }, { .part_id = 0x4243, + .name_prefix = "cs42l43", .codec_name = "cs42l43-codec", .count_sidecar = asoc_sdw_bridge_cs35l56_count_sidecar, .add_sidecar = asoc_sdw_bridge_cs35l56_add_sidecar, @@ -634,6 +659,7 @@ struct asoc_sdw_codec_info codec_info_list[] = { }, { .part_id = 0xaaaa, /* generic codec mockup */ + .name_prefix = "sdw_mockup_mmulti-function", .version_id = 0, .dais = { { @@ -659,6 +685,7 @@ struct asoc_sdw_codec_info codec_info_list[] = { }, { .part_id = 0xaa55, /* headset codec mockup */ + .name_prefix = "sdw_mockup_headset0", .version_id = 0, .dais = { { @@ -672,6 +699,7 @@ struct asoc_sdw_codec_info codec_info_list[] = { }, { .part_id = 0x55aa, /* amplifier mockup */ + .name_prefix = "sdw_mockup_amp1", .version_id = 0, .dais = { { @@ -685,6 +713,7 @@ struct asoc_sdw_codec_info codec_info_list[] = { }, { .part_id = 0x5555, + .name_prefix = "sdw_mockup_mic0", .version_id = 0, .dais = { { From 55f8b5a96597a7b88c323a7de7228f9eae8c9943 Mon Sep 17 00:00:00 2001 From: Bard Liao Date: Tue, 14 Oct 2025 15:13:30 +0800 Subject: [PATCH 4/9] ASoC: Intel: export sof_sdw_get_tplg_files The sof_sdw_get_tplg_files function is a callback of snd_soc_acpi_mach. Export it to allow other modules to use it. Signed-off-by: Bard Liao Reviewed-by: Simon Trimmer Reviewed-by: Ranjani Sridharan Link: https://patch.msgid.link/20251014071335.3844631-5-yung-chuan.liao@linux.intel.com Signed-off-by: Mark Brown --- sound/soc/intel/common/sof-function-topology-lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/intel/common/sof-function-topology-lib.c b/sound/soc/intel/common/sof-function-topology-lib.c index 3cc81dcf047e..f685c1c5c6f0 100644 --- a/sound/soc/intel/common/sof-function-topology-lib.c +++ b/sound/soc/intel/common/sof-function-topology-lib.c @@ -133,4 +133,4 @@ int sof_sdw_get_tplg_files(struct snd_soc_card *card, const struct snd_soc_acpi_ return tplg_num; } - +EXPORT_SYMBOL_GPL(sof_sdw_get_tplg_files); From 506cbe36a2ac7b504a2362476dc53cd548b7a29e Mon Sep 17 00:00:00 2001 From: Bard Liao Date: Tue, 14 Oct 2025 15:13:31 +0800 Subject: [PATCH 5/9] ASoC: soc_sdw_utils: export asoc_sdw_get_dai_type asoc_sdw_get_dai_type() is quite useful to convert SDCA function types to SDW DAI types. It can be used by other drivers. Signed-off-by: Bard Liao Reviewed-by: Simon Trimmer Reviewed-by: Ranjani Sridharan Link: https://patch.msgid.link/20251014071335.3844631-6-yung-chuan.liao@linux.intel.com Signed-off-by: Mark Brown --- include/sound/soc_sdw_utils.h | 1 + sound/soc/sdw_utils/soc_sdw_utils.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/sound/soc_sdw_utils.h b/include/sound/soc_sdw_utils.h index e289b453baba..76c64c5245d4 100644 --- a/include/sound/soc_sdw_utils.h +++ b/include/sound/soc_sdw_utils.h @@ -169,6 +169,7 @@ int asoc_sdw_count_sdw_endpoints(struct snd_soc_card *card, int *num_devs, int * struct asoc_sdw_dailink *asoc_sdw_find_dailink(struct asoc_sdw_dailink *dailinks, const struct snd_soc_acpi_endpoint *new); +int asoc_sdw_get_dai_type(u32 type); int asoc_sdw_parse_sdw_endpoints(struct snd_soc_card *card, struct asoc_sdw_dailink *soc_dais, diff --git a/sound/soc/sdw_utils/soc_sdw_utils.c b/sound/soc/sdw_utils/soc_sdw_utils.c index d2db597f84c0..b75cb5c535d1 100644 --- a/sound/soc/sdw_utils/soc_sdw_utils.c +++ b/sound/soc/sdw_utils/soc_sdw_utils.c @@ -1241,7 +1241,7 @@ struct asoc_sdw_dailink *asoc_sdw_find_dailink(struct asoc_sdw_dailink *dailinks } EXPORT_SYMBOL_NS(asoc_sdw_find_dailink, "SND_SOC_SDW_UTILS"); -static int asoc_sdw_get_dai_type(u32 type) +int asoc_sdw_get_dai_type(u32 type) { switch (type) { case SDCA_FUNCTION_TYPE_SMART_AMP: @@ -1259,6 +1259,7 @@ static int asoc_sdw_get_dai_type(u32 type) return -EINVAL; } } +EXPORT_SYMBOL_NS(asoc_sdw_get_dai_type, "SND_SOC_SDW_UTILS"); /* * Check if the SDCA endpoint is present by the SDW peripheral From 0d202ae0256e8e7dcea862ead5904fa27cf4ce6a Mon Sep 17 00:00:00 2001 From: Bard Liao Date: Tue, 14 Oct 2025 15:13:32 +0800 Subject: [PATCH 6/9] ASoC: SOF: add platform name into sof_intel_dsp_desc The platform name will be used construct the topology name. Signed-off-by: Bard Liao Reviewed-by: Simon Trimmer Reviewed-by: Ranjani Sridharan Link: https://patch.msgid.link/20251014071335.3844631-7-yung-chuan.liao@linux.intel.com Signed-off-by: Mark Brown --- sound/soc/sof/intel/apl.c | 1 + sound/soc/sof/intel/cnl.c | 2 ++ sound/soc/sof/intel/icl.c | 1 + sound/soc/sof/intel/lnl.c | 1 + sound/soc/sof/intel/mtl.c | 2 ++ sound/soc/sof/intel/ptl.c | 2 ++ sound/soc/sof/intel/shim.h | 1 + sound/soc/sof/intel/skl.c | 1 + sound/soc/sof/intel/tgl.c | 4 ++++ 9 files changed, 15 insertions(+) diff --git a/sound/soc/sof/intel/apl.c b/sound/soc/sof/intel/apl.c index 76a92eaa1359..0c68ae41a8a8 100644 --- a/sound/soc/sof/intel/apl.c +++ b/sound/soc/sof/intel/apl.c @@ -118,4 +118,5 @@ const struct sof_intel_dsp_desc apl_chip_info = { .power_down_dsp = hda_power_down_dsp, .disable_interrupts = hda_dsp_disable_interrupts, .hw_ip_version = SOF_INTEL_CAVS_1_5_PLUS, + .platform = "apl", }; diff --git a/sound/soc/sof/intel/cnl.c b/sound/soc/sof/intel/cnl.c index 385e5339f0a4..dfef908554b3 100644 --- a/sound/soc/sof/intel/cnl.c +++ b/sound/soc/sof/intel/cnl.c @@ -479,6 +479,7 @@ const struct sof_intel_dsp_desc cnl_chip_info = { .power_down_dsp = hda_power_down_dsp, .disable_interrupts = hda_dsp_disable_interrupts, .hw_ip_version = SOF_INTEL_CAVS_1_8, + .platform = "cnl", }; /* @@ -515,5 +516,6 @@ const struct sof_intel_dsp_desc jsl_chip_info = { .power_down_dsp = hda_power_down_dsp, .disable_interrupts = hda_dsp_disable_interrupts, .hw_ip_version = SOF_INTEL_CAVS_2_0, + .platform = "jsl", }; EXPORT_SYMBOL_NS(jsl_chip_info, "SND_SOC_SOF_INTEL_CNL"); diff --git a/sound/soc/sof/intel/icl.c b/sound/soc/sof/intel/icl.c index dad6bc72ad37..dbc5ad62258b 100644 --- a/sound/soc/sof/intel/icl.c +++ b/sound/soc/sof/intel/icl.c @@ -193,4 +193,5 @@ const struct sof_intel_dsp_desc icl_chip_info = { .power_down_dsp = hda_power_down_dsp, .disable_interrupts = hda_dsp_disable_interrupts, .hw_ip_version = SOF_INTEL_CAVS_2_0, + .platform = "icl", }; diff --git a/sound/soc/sof/intel/lnl.c b/sound/soc/sof/intel/lnl.c index 2f3222040f98..c01ea7e731aa 100644 --- a/sound/soc/sof/intel/lnl.c +++ b/sound/soc/sof/intel/lnl.c @@ -183,6 +183,7 @@ const struct sof_intel_dsp_desc lnl_chip_info = { .power_down_dsp = mtl_power_down_dsp, .disable_interrupts = lnl_dsp_disable_interrupts, .hw_ip_version = SOF_INTEL_ACE_2_0, + .platform = "lnl", }; MODULE_IMPORT_NS("SND_SOC_SOF_INTEL_MTL"); diff --git a/sound/soc/sof/intel/mtl.c b/sound/soc/sof/intel/mtl.c index 2242c96bfa51..095dcf1a18e4 100644 --- a/sound/soc/sof/intel/mtl.c +++ b/sound/soc/sof/intel/mtl.c @@ -786,6 +786,7 @@ const struct sof_intel_dsp_desc mtl_chip_info = { .power_down_dsp = mtl_power_down_dsp, .disable_interrupts = mtl_dsp_disable_interrupts, .hw_ip_version = SOF_INTEL_ACE_1_0, + .platform = "mtl", }; const struct sof_intel_dsp_desc arl_s_chip_info = { @@ -814,4 +815,5 @@ const struct sof_intel_dsp_desc arl_s_chip_info = { .power_down_dsp = mtl_power_down_dsp, .disable_interrupts = mtl_dsp_disable_interrupts, .hw_ip_version = SOF_INTEL_ACE_1_0, + .platform = "arl", }; diff --git a/sound/soc/sof/intel/ptl.c b/sound/soc/sof/intel/ptl.c index 4633cd01e7dd..c1db735237f8 100644 --- a/sound/soc/sof/intel/ptl.c +++ b/sound/soc/sof/intel/ptl.c @@ -125,6 +125,7 @@ const struct sof_intel_dsp_desc ptl_chip_info = { .power_down_dsp = mtl_power_down_dsp, .disable_interrupts = lnl_dsp_disable_interrupts, .hw_ip_version = SOF_INTEL_ACE_3_0, + .platform = "ptl", }; const struct sof_intel_dsp_desc wcl_chip_info = { @@ -149,6 +150,7 @@ const struct sof_intel_dsp_desc wcl_chip_info = { .power_down_dsp = mtl_power_down_dsp, .disable_interrupts = lnl_dsp_disable_interrupts, .hw_ip_version = SOF_INTEL_ACE_3_0, + .platform = "wcl", }; MODULE_IMPORT_NS("SND_SOC_SOF_INTEL_MTL"); diff --git a/sound/soc/sof/intel/shim.h b/sound/soc/sof/intel/shim.h index d4372f0bff7e..dc6a93d05bfe 100644 --- a/sound/soc/sof/intel/shim.h +++ b/sound/soc/sof/intel/shim.h @@ -186,6 +186,7 @@ struct sof_intel_dsp_desc { u32 sdw_alh_base; u32 d0i3_offset; u32 quirks; + const char *platform; enum sof_intel_hw_ip_version hw_ip_version; int (*read_sdw_lcount)(struct snd_sof_dev *sdev); void (*enable_sdw_irq)(struct snd_sof_dev *sdev, bool enable); diff --git a/sound/soc/sof/intel/skl.c b/sound/soc/sof/intel/skl.c index 0696bce65e33..90a3c2e2334c 100644 --- a/sound/soc/sof/intel/skl.c +++ b/sound/soc/sof/intel/skl.c @@ -113,5 +113,6 @@ const struct sof_intel_dsp_desc skl_chip_info = { .power_down_dsp = hda_power_down_dsp, .disable_interrupts = hda_dsp_disable_interrupts, .hw_ip_version = SOF_INTEL_CAVS_1_5, + .platform = "skl", }; EXPORT_SYMBOL_NS(skl_chip_info, "SND_SOC_SOF_INTEL_HDA_COMMON"); diff --git a/sound/soc/sof/intel/tgl.c b/sound/soc/sof/intel/tgl.c index df2d26b78ddc..e68bbe685ba3 100644 --- a/sound/soc/sof/intel/tgl.c +++ b/sound/soc/sof/intel/tgl.c @@ -162,6 +162,7 @@ const struct sof_intel_dsp_desc tgl_chip_info = { .power_down_dsp = hda_power_down_dsp, .disable_interrupts = hda_dsp_disable_interrupts, .hw_ip_version = SOF_INTEL_CAVS_2_5, + .platform = "tgl", }; const struct sof_intel_dsp_desc tglh_chip_info = { @@ -191,6 +192,7 @@ const struct sof_intel_dsp_desc tglh_chip_info = { .power_down_dsp = hda_power_down_dsp, .disable_interrupts = hda_dsp_disable_interrupts, .hw_ip_version = SOF_INTEL_CAVS_2_5, + .platform = "tgl", }; const struct sof_intel_dsp_desc ehl_chip_info = { @@ -220,6 +222,7 @@ const struct sof_intel_dsp_desc ehl_chip_info = { .power_down_dsp = hda_power_down_dsp, .disable_interrupts = hda_dsp_disable_interrupts, .hw_ip_version = SOF_INTEL_CAVS_2_5, + .platform = "ehl", }; const struct sof_intel_dsp_desc adls_chip_info = { @@ -249,4 +252,5 @@ const struct sof_intel_dsp_desc adls_chip_info = { .power_down_dsp = hda_power_down_dsp, .disable_interrupts = hda_dsp_disable_interrupts, .hw_ip_version = SOF_INTEL_CAVS_2_5, + .platform = "adl", }; From 225d70b8074502acee3943bf0c2e839e867cd38c Mon Sep 17 00:00:00 2001 From: Bard Liao Date: Tue, 14 Oct 2025 15:13:33 +0800 Subject: [PATCH 7/9] ASoC: SOF: don't check the existence of dummy topology MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Monolithic topology is not needed if function topology is used. Instead of creating a dummy topology in the file system, we can skip the existence check in the kernel. Signed-off-by: Bard Liao Reviewed-by: Péter Ujfalusi Reviewed-by: Simon Trimmer Link: https://patch.msgid.link/20251014071335.3844631-8-yung-chuan.liao@linux.intel.com Signed-off-by: Mark Brown --- sound/soc/sof/fw-file-profile.c | 4 ++++ sound/soc/sof/topology.c | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/sound/soc/sof/fw-file-profile.c b/sound/soc/sof/fw-file-profile.c index d2b232860091..4a2afc04f338 100644 --- a/sound/soc/sof/fw-file-profile.c +++ b/sound/soc/sof/fw-file-profile.c @@ -73,6 +73,10 @@ static int sof_test_topology_file(struct device *dev, if (!profile->tplg_path || !profile->tplg_name) return 0; + /* Dummy topology does not exist and should not be used */ + if (strstr(profile->tplg_name, "dummy")) + return 0; + tplg_filename = kasprintf(GFP_KERNEL, "%s/%s", profile->tplg_path, profile->tplg_name); if (!tplg_filename) diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index 3404f1306494..c1083ea4624a 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -2523,6 +2523,11 @@ int snd_sof_load_topology(struct snd_soc_component *scomp, const char *file) * callback or the callback returns 0. */ if (!tplg_cnt) { + if (strstr(file, "dummy")) { + dev_err(scomp->dev, + "Function topology is required, please upgrade sof-firmware\n"); + return -EINVAL; + } tplg_files[0] = file; tplg_cnt = 1; dev_info(scomp->dev, "loading topology: %s\n", file); From 7f47685b150dbc20f881d029a7366a81b1d66322 Mon Sep 17 00:00:00 2001 From: Bard Liao Date: Tue, 14 Oct 2025 15:13:34 +0800 Subject: [PATCH 8/9] ASoC: SOF: Intel: use sof_sdw as default SDW machine driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If there is no SoundWire machine matches the existing acpi match table, get the required machine data from the acpi table and construct the link adrs and endpoints. Pass the data to the default Intel SoundWire machine driver. And we don't need to add new item to the acpi match table in common cases. We will construct a dummy topology name. The dummy topology is just used to extract the platform name for function topology and should not be used. Signed-off-by: Bard Liao Reviewed-by: Péter Ujfalusi Reviewed-by: Simon Trimmer Link: https://patch.msgid.link/20251014071335.3844631-9-yung-chuan.liao@linux.intel.com Signed-off-by: Mark Brown --- sound/soc/sof/intel/hda.c | 205 +++++++++++++++++++++++++++++++++++++- 1 file changed, 203 insertions(+), 2 deletions(-) diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c index 52e86fa60077..00835fc8ef8d 100644 --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -33,6 +34,7 @@ #include "../sof-pci-dev.h" #include "../ops.h" #include "../ipc4-topology.h" +#include "../../intel/common/sof-function-topology-lib.h" #include "hda.h" #include @@ -1131,14 +1133,166 @@ static void hda_generic_machine_select(struct snd_sof_dev *sdev, #if IS_ENABLED(CONFIG_SND_SOC_SOF_INTEL_SOUNDWIRE) +static bool is_endpoint_present(struct sdw_slave *sdw_device, + struct asoc_sdw_codec_info *dai_info, int dai_type) +{ + int i; + + for (i = 0; i < sdw_device->sdca_data.num_functions; i++) { + if (dai_type == dai_info->dais[i].dai_type) + return true; + } + dev_dbg(&sdw_device->dev, "Endpoint DAI type %d not found\n", dai_type); + return false; +} + +static struct snd_soc_acpi_adr_device *find_acpi_adr_device(struct device *dev, + struct sdw_slave *sdw_device, + struct snd_soc_acpi_link_adr *link, + int *amp_index) +{ + struct snd_soc_acpi_adr_device *adr_dev; + const char *name_prefix = ""; + int index = link->num_adr; + bool is_amp = true; /* Set it to false if the codec wiah any NON-AMP DAI type */ + int ep_index = 0; + int i, j; + + link->mask = BIT(sdw_device->bus->link_id); + /* index is 0 based, we need allocate index + 1 for the array size */ + if (!index) + adr_dev = devm_kzalloc(dev, sizeof(*adr_dev), GFP_KERNEL); + else + adr_dev = devm_krealloc(dev, (struct snd_soc_acpi_adr_device *)link->adr_d, + (index + 1) * sizeof(*adr_dev), GFP_KERNEL); + + if (!adr_dev) + return NULL; + + for (i = 0; i < asoc_sdw_get_codec_info_list_count(); i++) { + struct snd_soc_acpi_endpoint *endpoints; + int amp_group_id = 1; + + if (sdw_device->id.part_id != codec_info_list[i].part_id) + continue; + + endpoints = devm_kcalloc(dev, codec_info_list[i].dai_num, + sizeof(struct snd_soc_acpi_endpoint), GFP_KERNEL); + if (!endpoints) + return NULL; + + name_prefix = codec_info_list[i].name_prefix; + /* + * This should not happen, but add a paranoid check to avoid NULL pointer + * dereference + */ + if (!name_prefix) { + dev_err(dev, "codec_info_list name_prefix of part id %#x is missing\n", + codec_info_list[i].part_id); + return NULL; + } + for (j = 0; j < codec_info_list[i].dai_num; j++) { + /* Check if the endpoint is present by the SDCA DisCo table */ + if (!is_endpoint_present(sdw_device, &codec_info_list[i], + codec_info_list[i].dais[j].dai_type)) + continue; + + endpoints[ep_index].num = ep_index; + if (codec_info_list[i].dais[j].dai_type == SOC_SDW_DAI_TYPE_AMP) { + /* Assume all amp are aggregated */ + endpoints[ep_index].aggregated = 1; + endpoints[ep_index].group_id = amp_group_id; + endpoints[ep_index].group_position = *amp_index; + /* Set group id = 2 for feedback capture endpoint */ + amp_group_id++; + } else { + endpoints[ep_index].aggregated = 0; + endpoints[ep_index].group_id = 0; + endpoints[ep_index].group_position = 0; + is_amp = false; + } + ep_index++; + } + adr_dev[index].endpoints = endpoints; + adr_dev[index].num_endpoints = ep_index; + break; + } + + if (i == asoc_sdw_get_codec_info_list_count()) { + dev_err(dev, "part id %#x is not supported\n", sdw_device->id.part_id); + return NULL; + } + + adr_dev[index].adr = ((u64)sdw_device->id.class_id & 0xFF) | + ((u64)sdw_device->id.part_id & 0xFFFF) << 8 | + ((u64)sdw_device->id.mfg_id & 0xFFFF) << 24 | + ((u64)(sdw_device->id.unique_id & 0xF) << 40) | + ((u64)(sdw_device->id.sdw_version & 0xF) << 44) | + ((u64)(sdw_device->bus->link_id & 0xF) << 48); + + if (!is_amp) { + /* For non-amp codecs, get name_prefix from codec_info_list[] */ + adr_dev[index].name_prefix = devm_kasprintf(dev, GFP_KERNEL, "%s", name_prefix); + goto done_name_prefix; + } + + /* + * The name_prefix comes from codec_info_list which has a name_prefix per codec. + * And we need to give a unique name_prefix for each amp and should be backwards + * compatible to the existing acpi match tables to not break existing UCMs. + * For the common name_prefix, we append the amp index to it. However, for the + * "Left" name_prefix, we convert the second amp name_prefix to "Right" and + * for the third and further amps, we set the name_prefix to "AMP". + */ + if (!strcmp(name_prefix, "Left")) { + switch (*amp_index) { + case 1: + adr_dev[index].name_prefix = devm_kasprintf(dev, GFP_KERNEL, + "%s", "Left"); + break; + case 2: + adr_dev[index].name_prefix = devm_kasprintf(dev, GFP_KERNEL, + "%s", "Right"); + break; + default: + /* Set the name_fix to AMP if there are more than 2 amps */ + adr_dev[index].name_prefix = devm_kasprintf(dev, GFP_KERNEL, "%s%d", + "AMP", *amp_index); + break; + } + } else { + adr_dev[index].name_prefix = devm_kasprintf(dev, GFP_KERNEL, "%s%d", + name_prefix, + *amp_index); + } + (*amp_index)++; + +done_name_prefix: + if (!adr_dev[index].name_prefix) { + dev_err(dev, "failed to allocate memory for name_prefix\n"); + return NULL; + } + + dev_dbg(dev, "adr[%d] 0x%llx link id %d name_prefix \"%s\" is found\n", + index, adr_dev[index].adr, sdw_device->bus->link_id, adr_dev[index].name_prefix); + + link->num_adr++; + + return adr_dev; +} + static struct snd_soc_acpi_mach *hda_sdw_machine_select(struct snd_sof_dev *sdev) { struct snd_sof_pdata *pdata = sdev->pdata; const struct snd_soc_acpi_link_adr *link; + const struct sof_intel_dsp_desc *chip; + struct snd_soc_acpi_link_adr *links; struct sdw_peripherals *peripherals; struct snd_soc_acpi_mach *mach; struct sof_intel_hda_dev *hdev; - u32 link_mask; + int link_index, link_num; + int amp_index = 1; + u32 link_mask = 0; int i; hdev = pdata->hw_pdata; @@ -1215,7 +1369,53 @@ static struct snd_soc_acpi_mach *hda_sdw_machine_select(struct snd_sof_dev *sdev peripherals->array[i]->id.part_id, peripherals->array[i]->id.sdw_version); - return NULL; + chip = get_chip_info(sdev->pdata); + + /* SDCA was not well supported in the BIOS before ACE2.0 */ + if (chip->hw_ip_version < SOF_INTEL_ACE_2_0) + return NULL; + + if (!peripherals->num_peripherals) + return NULL; + + /* Create default SDW mach */ + mach = devm_kzalloc(sdev->dev, sizeof(*mach), GFP_KERNEL); + if (!mach) + return NULL; + + /* Get link mask and link number */ + for (i = 0; i < peripherals->num_peripherals; i++) + link_mask |= BIT(peripherals->array[i]->bus->link_id); + + link_num = hweight32(link_mask); + links = devm_kcalloc(sdev->dev, link_num, sizeof(*links), GFP_KERNEL); + if (!links) + return NULL; + + /* Generate snd_soc_acpi_link_adr struct for each peripheral reported by the ACPI table */ + for (i = 0; i < peripherals->num_peripherals; i++) { + /* link_index = the number of used links below the current link */ + link_index = hweight32(link_mask & (BIT(peripherals->array[i]->bus->link_id) - 1)); + links[link_index].adr_d = find_acpi_adr_device(sdev->dev, peripherals->array[i], + &links[link_index], &_index); + if (!links[link_index].adr_d) + return NULL; + } + + mach->drv_name = "sof_sdw"; + mach->mach_params.links = links; + mach->mach_params.link_mask = link_mask; + mach->mach_params.platform = dev_name(sdev->dev); + mach->get_function_tplg_files = sof_sdw_get_tplg_files; + /* + * Set mach->sof_tplg_filename as a dummy topology to avoid tplg file checking + * and being used. + */ + mach->sof_tplg_filename = devm_kasprintf(sdev->dev, GFP_KERNEL, + "sof-%s-dummy.tplg", chip->platform); + + dev_info(sdev->dev, "Use SoundWire default machine driver with function topologies\n"); + return mach; } #else static struct snd_soc_acpi_mach *hda_sdw_machine_select(struct snd_sof_dev *sdev) @@ -1543,6 +1743,7 @@ MODULE_IMPORT_NS("SND_SOC_SOF_XTENSA"); MODULE_IMPORT_NS("SND_INTEL_SOUNDWIRE_ACPI"); MODULE_IMPORT_NS("SOUNDWIRE_INTEL_INIT"); MODULE_IMPORT_NS("SOUNDWIRE_INTEL"); +MODULE_IMPORT_NS("SND_SOC_SDW_UTILS"); MODULE_IMPORT_NS("SND_SOC_SOF_HDA_MLINK"); MODULE_IMPORT_NS("SND_SOC_SOF_INTEL_HDA_COMMON"); MODULE_IMPORT_NS("SND_SOC_ACPI_INTEL_MATCH"); From 7e7e2c6e2a1cb250f8d03bb99eed01f6d982d5dd Mon Sep 17 00:00:00 2001 From: Bard Liao Date: Tue, 14 Oct 2025 15:13:35 +0800 Subject: [PATCH 9/9] ASoC: sof-function-topology-lib: escalate the log when missing function topoplogy Function topology must be used if the ACPI match table is created based on the reported ACPI table because the monolithic topology is not picked for the audio configuration. Escalate the log and ask the user to download the latest topologies. Signed-off-by: Bard Liao Reviewed-by: Simon Trimmer Reviewed-by: Ranjani Sridharan Link: https://patch.msgid.link/20251014071335.3844631-10-yung-chuan.liao@linux.intel.com Signed-off-by: Mark Brown --- sound/soc/intel/common/sof-function-topology-lib.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sound/soc/intel/common/sof-function-topology-lib.c b/sound/soc/intel/common/sof-function-topology-lib.c index f685c1c5c6f0..b10d4794159a 100644 --- a/sound/soc/intel/common/sof-function-topology-lib.c +++ b/sound/soc/intel/common/sof-function-topology-lib.c @@ -126,7 +126,11 @@ int sof_sdw_get_tplg_files(struct snd_soc_card *card, const struct snd_soc_acpi_ if (!ret) { release_firmware(fw); } else { - dev_dbg(card->dev, "Failed to open topology file: %s\n", (*tplg_files)[i]); + dev_warn(card->dev, + "Failed to open topology file: %s, you might need to\n", + (*tplg_files)[i]); + dev_warn(card->dev, + "download it from https://github.com/thesofproject/sof-bin/\n"); return 0; } }