Skip to content

Commit e6a40d5

Browse files
committed
ASoC: SOF: add disable_function_topology flag and
Merge series from Bard Liao <[email protected]>: 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.
2 parents d9a1cbf + 7b400c9 commit e6a40d5

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

include/sound/sof.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ struct snd_sof_pdata {
106106
const char *fw_filename;
107107
const char *tplg_filename_prefix;
108108
const char *tplg_filename;
109+
bool disable_function_topology;
109110

110111
/* loadable external libraries available under this directory */
111112
const char *fw_lib_prefix;

sound/soc/sof/core.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,8 @@ static void sof_probe_work(struct work_struct *work)
607607
}
608608

609609
static void
610-
sof_apply_profile_override(struct sof_loadable_file_profile *path_override)
610+
sof_apply_profile_override(struct sof_loadable_file_profile *path_override,
611+
struct snd_sof_pdata *plat_data)
611612
{
612613
if (override_ipc_type >= 0 && override_ipc_type < SOF_IPC_TYPE_COUNT)
613614
path_override->ipc_type = override_ipc_type;
@@ -619,8 +620,11 @@ sof_apply_profile_override(struct sof_loadable_file_profile *path_override)
619620
path_override->fw_lib_path = override_lib_path;
620621
if (override_tplg_path)
621622
path_override->tplg_path = override_tplg_path;
622-
if (override_tplg_filename)
623+
if (override_tplg_filename) {
623624
path_override->tplg_name = override_tplg_filename;
625+
/* User requested a specific topology file and expect it to be loaded */
626+
plat_data->disable_function_topology = true;
627+
}
624628
}
625629

626630
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)
654658
}
655659
}
656660

657-
sof_apply_profile_override(&plat_data->ipc_file_profile_base);
661+
sof_apply_profile_override(&plat_data->ipc_file_profile_base, plat_data);
658662

659663
/* Initialize sof_ops based on the initial selected IPC version */
660664
ret = sof_init_sof_ops(sdev);

sound/soc/sof/topology.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
#include "sof-audio.h"
2020
#include "ops.h"
2121

22+
static bool disable_function_topology;
23+
module_param(disable_function_topology, bool, 0444);
24+
MODULE_PARM_DESC(disable_function_topology, "Disable function topology loading");
25+
2226
#define COMP_ID_UNASSIGNED 0xffffffff
2327
/*
2428
* 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)
24812485
if (!tplg_files)
24822486
return -ENOMEM;
24832487

2484-
if (sof_pdata->machine && sof_pdata->machine->get_function_tplg_files) {
2488+
if (!sof_pdata->disable_function_topology && !disable_function_topology &&
2489+
sof_pdata->machine && sof_pdata->machine->get_function_tplg_files) {
24852490
tplg_cnt = sof_pdata->machine->get_function_tplg_files(scomp->card,
24862491
sof_pdata->machine,
24872492
tplg_filename_prefix,

0 commit comments

Comments
 (0)