From e48a906af6b3cfd09c50af14a8ea7a5cf45b39ab Mon Sep 17 00:00:00 2001 From: Bard Liao Date: Tue, 6 May 2025 19:33:08 +0800 Subject: [PATCH 1/3] ASoC: SOF: add disable_function_topology flag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SOF driver will load required function topologies dynamically. However, we prefer using the monolithic topology. Add a flag to allow user not using the function topologies. Signed-off-by: Bard Liao Reviewed-by: Péter Ujfalusi Reviewed-by: Ranjani Sridharan Link: https://patch.msgid.link/20250506113311.45487-2-yung-chuan.liao@linux.intel.com Signed-off-by: Mark Brown --- include/sound/sof.h | 1 + sound/soc/sof/topology.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/sound/sof.h b/include/sound/sof.h index 64fd5504cb2b..eddea82c7b5a 100644 --- a/include/sound/sof.h +++ b/include/sound/sof.h @@ -106,6 +106,7 @@ struct snd_sof_pdata { const char *fw_filename; const char *tplg_filename_prefix; const char *tplg_filename; + bool disable_function_topology; /* loadable external libraries available under this directory */ const char *fw_lib_prefix; diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index 5d3ee3a86392..fd80451cb4c0 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -2481,7 +2481,8 @@ int snd_sof_load_topology(struct snd_soc_component *scomp, const char *file) if (!tplg_files) return -ENOMEM; - if (sof_pdata->machine && sof_pdata->machine->get_function_tplg_files) { + if (!sof_pdata->disable_function_topology && sof_pdata->machine && + sof_pdata->machine->get_function_tplg_files) { tplg_cnt = sof_pdata->machine->get_function_tplg_files(scomp->card, sof_pdata->machine, tplg_filename_prefix, From 92b5f92d1128e108c583d63fab114601ce04eced Mon Sep 17 00:00:00 2001 From: Bard Liao Date: Tue, 6 May 2025 19:33:09 +0800 Subject: [PATCH 2/3] ASoC: SOF: set disable_function_topology if override_tplg_filename is set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit User will expect the specified topology is used when override_tplg_filename is set. However, the using function topologies feature may use the function topologies instead of the specified topology. Signed-off-by: Bard Liao Reviewed-by: Péter Ujfalusi Reviewed-by: Ranjani Sridharan Link: https://patch.msgid.link/20250506113311.45487-3-yung-chuan.liao@linux.intel.com Signed-off-by: Mark Brown --- sound/soc/sof/core.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sound/soc/sof/core.c b/sound/soc/sof/core.c index aed834d03e10..b11f408f1366 100644 --- a/sound/soc/sof/core.c +++ b/sound/soc/sof/core.c @@ -607,7 +607,8 @@ static void sof_probe_work(struct work_struct *work) } static void -sof_apply_profile_override(struct sof_loadable_file_profile *path_override) +sof_apply_profile_override(struct sof_loadable_file_profile *path_override, + struct snd_sof_pdata *plat_data) { if (override_ipc_type >= 0 && override_ipc_type < SOF_IPC_TYPE_COUNT) path_override->ipc_type = override_ipc_type; @@ -619,8 +620,11 @@ sof_apply_profile_override(struct sof_loadable_file_profile *path_override) path_override->fw_lib_path = override_lib_path; if (override_tplg_path) path_override->tplg_path = override_tplg_path; - if (override_tplg_filename) + if (override_tplg_filename) { path_override->tplg_name = override_tplg_filename; + /* User requested a specific topology file and expect it to be loaded */ + plat_data->disable_function_topology = true; + } } int snd_sof_device_probe(struct device *dev, struct snd_sof_pdata *plat_data) @@ -654,7 +658,7 @@ int snd_sof_device_probe(struct device *dev, struct snd_sof_pdata *plat_data) } } - sof_apply_profile_override(&plat_data->ipc_file_profile_base); + sof_apply_profile_override(&plat_data->ipc_file_profile_base, plat_data); /* Initialize sof_ops based on the initial selected IPC version */ ret = sof_init_sof_ops(sdev); From 7b400c9ab879a86aa4b9bf5d9fdd3df558eed9b5 Mon Sep 17 00:00:00 2001 From: Bard Liao Date: Tue, 6 May 2025 19:33:10 +0800 Subject: [PATCH 3/3] ASoC: SOF: add disable_function_topology module parameter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit User can disable the loading function topology feature. Signed-off-by: Bard Liao Reviewed-by: Péter Ujfalusi Reviewed-by: Ranjani Sridharan Link: https://patch.msgid.link/20250506113311.45487-4-yung-chuan.liao@linux.intel.com Signed-off-by: Mark Brown --- sound/soc/sof/topology.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index fd80451cb4c0..2d4e660b19d5 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -19,6 +19,10 @@ #include "sof-audio.h" #include "ops.h" +static bool disable_function_topology; +module_param(disable_function_topology, bool, 0444); +MODULE_PARM_DESC(disable_function_topology, "Disable function topology loading"); + #define COMP_ID_UNASSIGNED 0xffffffff /* * Constants used in the computation of linear volume gain @@ -2481,8 +2485,8 @@ int snd_sof_load_topology(struct snd_soc_component *scomp, const char *file) if (!tplg_files) return -ENOMEM; - if (!sof_pdata->disable_function_topology && sof_pdata->machine && - sof_pdata->machine->get_function_tplg_files) { + if (!sof_pdata->disable_function_topology && !disable_function_topology && + sof_pdata->machine && sof_pdata->machine->get_function_tplg_files) { tplg_cnt = sof_pdata->machine->get_function_tplg_files(scomp->card, sof_pdata->machine, tplg_filename_prefix,