ASoC: SOF: add disable_function_topology flag and

Merge series from Bard Liao <yung-chuan.liao@linux.intel.com>:

SOF will load the function topologies by default. However, user may want
to use the monolithic topology. Add a flag amd a module parameter to
allow user specify the topology or not using function topologies.
This commit is contained in:
Mark Brown 2025-05-07 14:12:31 +09:00
commit e6a40d5c90
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
3 changed files with 14 additions and 4 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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,7 +2485,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 && !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,