Skip to content

Commit acb2198

Browse files
ujfalusibroonie
authored andcommitted
ASoC: SOF: core: Add fw, tplg and ipc type override parameters
The different bus type helpers define their own override parameters for firmware name/path, topology name/path. sof-pci-dev covers all while others just a subset. There is no technical reason to do that since these are generic platform independent parameters. Add the override module options to core (snd-sof module) and update the description for the device helper modules as deprecated. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Link: https://patch.msgid.link/20241023110610.6141-3-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent de688e5 commit acb2198

4 files changed

Lines changed: 56 additions & 12 deletions

File tree

sound/soc/sof/core.c

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,31 @@
1919
#define CREATE_TRACE_POINTS
2020
#include <trace/events/sof.h>
2121

22+
/* Module parameters for firmware, topology and IPC type override */
23+
static char *override_fw_path;
24+
module_param_named(fw_path, override_fw_path, charp, 0444);
25+
MODULE_PARM_DESC(fw_path, "alternate path for SOF firmware.");
26+
27+
static char *override_fw_filename;
28+
module_param_named(fw_filename, override_fw_filename, charp, 0444);
29+
MODULE_PARM_DESC(fw_filename, "alternate filename for SOF firmware.");
30+
31+
static char *override_lib_path;
32+
module_param_named(lib_path, override_lib_path, charp, 0444);
33+
MODULE_PARM_DESC(lib_path, "alternate path for SOF firmware libraries.");
34+
35+
static char *override_tplg_path;
36+
module_param_named(tplg_path, override_tplg_path, charp, 0444);
37+
MODULE_PARM_DESC(tplg_path, "alternate path for SOF topology.");
38+
39+
static char *override_tplg_filename;
40+
module_param_named(tplg_filename, override_tplg_filename, charp, 0444);
41+
MODULE_PARM_DESC(tplg_filename, "alternate filename for SOF topology.");
42+
43+
static int override_ipc_type = -1;
44+
module_param_named(ipc_type, override_ipc_type, int, 0444);
45+
MODULE_PARM_DESC(ipc_type, "Force SOF IPC type. 0 - IPC3, 1 - IPC4");
46+
2247
/* see SOF_DBG_ flags */
2348
static int sof_core_debug = IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG_ENABLE_FIRMWARE_TRACE);
2449
module_param_named(sof_debug, sof_core_debug, int, 0444);
@@ -581,6 +606,23 @@ static void sof_probe_work(struct work_struct *work)
581606
}
582607
}
583608

609+
static void
610+
sof_apply_profile_override(struct sof_loadable_file_profile *path_override)
611+
{
612+
if (override_ipc_type >= 0 && override_ipc_type < SOF_IPC_TYPE_COUNT)
613+
path_override->ipc_type = override_ipc_type;
614+
if (override_fw_path)
615+
path_override->fw_path = override_fw_path;
616+
if (override_fw_filename)
617+
path_override->fw_name = override_fw_filename;
618+
if (override_lib_path)
619+
path_override->fw_lib_path = override_lib_path;
620+
if (override_tplg_path)
621+
path_override->tplg_path = override_tplg_path;
622+
if (override_tplg_filename)
623+
path_override->tplg_name = override_tplg_filename;
624+
}
625+
584626
int snd_sof_device_probe(struct device *dev, struct snd_sof_pdata *plat_data)
585627
{
586628
struct snd_sof_dev *sdev;
@@ -612,6 +654,8 @@ int snd_sof_device_probe(struct device *dev, struct snd_sof_pdata *plat_data)
612654
}
613655
}
614656

657+
sof_apply_profile_override(&plat_data->ipc_file_profile_base);
658+
615659
/* Initialize sof_ops based on the initial selected IPC version */
616660
ret = sof_init_sof_ops(sdev);
617661
if (ret)

sound/soc/sof/sof-acpi-dev.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@
2424

2525
static char *fw_path;
2626
module_param(fw_path, charp, 0444);
27-
MODULE_PARM_DESC(fw_path, "alternate path for SOF firmware.");
27+
MODULE_PARM_DESC(fw_path, "deprecated - moved to snd-sof module.");
2828

2929
static char *tplg_path;
3030
module_param(tplg_path, charp, 0444);
31-
MODULE_PARM_DESC(tplg_path, "alternate path for SOF topology.");
31+
MODULE_PARM_DESC(tplg_path, "deprecated - moved to snd-sof module.");
3232

3333
static int sof_acpi_debug;
3434
module_param_named(sof_acpi_debug, sof_acpi_debug, int, 0444);

sound/soc/sof/sof-of-dev.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@
1616

1717
static char *fw_path;
1818
module_param(fw_path, charp, 0444);
19-
MODULE_PARM_DESC(fw_path, "alternate path for SOF firmware.");
19+
MODULE_PARM_DESC(fw_path, "deprecated - moved to snd-sof module.");
2020

2121
static char *fw_filename;
2222
module_param(fw_filename, charp, 0444);
23-
MODULE_PARM_DESC(fw_filename, "alternate filename for SOF firmware.");
23+
MODULE_PARM_DESC(fw_filename, "deprecated - moved to snd-sof module.");
2424

2525
static char *tplg_path;
2626
module_param(tplg_path, charp, 0444);
27-
MODULE_PARM_DESC(tplg_path, "alternate path for SOF topology.");
27+
MODULE_PARM_DESC(tplg_path, "deprecated - moved to snd-sof module.");
2828

2929
static char *tplg_filename;
3030
module_param(tplg_filename, charp, 0444);
31-
MODULE_PARM_DESC(tplg_filename, "alternate filename for SOF topology.");
31+
MODULE_PARM_DESC(tplg_filename, "deprecated - moved to snd-sof module.");
3232

3333
const struct dev_pm_ops sof_of_pm = {
3434
.prepare = snd_sof_prepare,

sound/soc/sof/sof-pci-dev.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,31 +22,31 @@
2222

2323
static char *fw_path;
2424
module_param(fw_path, charp, 0444);
25-
MODULE_PARM_DESC(fw_path, "alternate path for SOF firmware.");
25+
MODULE_PARM_DESC(fw_path, "deprecated - moved to snd-sof module.");
2626

2727
static char *fw_filename;
2828
module_param(fw_filename, charp, 0444);
29-
MODULE_PARM_DESC(fw_filename, "alternate filename for SOF firmware.");
29+
MODULE_PARM_DESC(fw_filename, "deprecated - moved to snd-sof module.");
3030

3131
static char *lib_path;
3232
module_param(lib_path, charp, 0444);
33-
MODULE_PARM_DESC(lib_path, "alternate path for SOF firmware libraries.");
33+
MODULE_PARM_DESC(lib_path, "deprecated - moved to snd-sof module.");
3434

3535
static char *tplg_path;
3636
module_param(tplg_path, charp, 0444);
37-
MODULE_PARM_DESC(tplg_path, "alternate path for SOF topology.");
37+
MODULE_PARM_DESC(tplg_path, "deprecated - moved to snd-sof module.");
3838

3939
static char *tplg_filename;
4040
module_param(tplg_filename, charp, 0444);
41-
MODULE_PARM_DESC(tplg_filename, "alternate filename for SOF topology.");
41+
MODULE_PARM_DESC(tplg_filename, "deprecated - moved to snd-sof module.");
4242

4343
static int sof_pci_debug;
4444
module_param_named(sof_pci_debug, sof_pci_debug, int, 0444);
4545
MODULE_PARM_DESC(sof_pci_debug, "SOF PCI debug options (0x0 all off)");
4646

4747
static int sof_pci_ipc_type = -1;
4848
module_param_named(ipc_type, sof_pci_ipc_type, int, 0444);
49-
MODULE_PARM_DESC(ipc_type, "Force SOF IPC type. 0 - IPC3, 1 - IPC4");
49+
MODULE_PARM_DESC(ipc_type, "deprecated - moved to snd-sof module.");
5050

5151
static const char *sof_dmi_override_tplg_name;
5252
static bool sof_dmi_use_community_key;

0 commit comments

Comments
 (0)