|
19 | 19 | #define CREATE_TRACE_POINTS |
20 | 20 | #include <trace/events/sof.h> |
21 | 21 |
|
| 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 | + |
22 | 47 | /* see SOF_DBG_ flags */ |
23 | 48 | static int sof_core_debug = IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG_ENABLE_FIRMWARE_TRACE); |
24 | 49 | module_param_named(sof_debug, sof_core_debug, int, 0444); |
@@ -598,6 +623,23 @@ static void sof_probe_work(struct work_struct *work) |
598 | 623 | } |
599 | 624 | } |
600 | 625 |
|
| 626 | +static void |
| 627 | +sof_apply_profile_override(struct sof_loadable_file_profile *path_override) |
| 628 | +{ |
| 629 | + if (override_ipc_type >= 0 && override_ipc_type < SOF_IPC_TYPE_COUNT) |
| 630 | + path_override->ipc_type = override_ipc_type; |
| 631 | + if (override_fw_path) |
| 632 | + path_override->fw_path = override_fw_path; |
| 633 | + if (override_fw_filename) |
| 634 | + path_override->fw_name = override_fw_filename; |
| 635 | + if (override_lib_path) |
| 636 | + path_override->fw_lib_path = override_lib_path; |
| 637 | + if (override_tplg_path) |
| 638 | + path_override->tplg_path = override_tplg_path; |
| 639 | + if (override_tplg_filename) |
| 640 | + path_override->tplg_name = override_tplg_filename; |
| 641 | +} |
| 642 | + |
601 | 643 | int snd_sof_device_probe(struct device *dev, struct snd_sof_pdata *plat_data) |
602 | 644 | { |
603 | 645 | struct snd_sof_dev *sdev; |
@@ -626,6 +668,8 @@ int snd_sof_device_probe(struct device *dev, struct snd_sof_pdata *plat_data) |
626 | 668 | } |
627 | 669 | } |
628 | 670 |
|
| 671 | + sof_apply_profile_override(&plat_data->ipc_file_profile_base); |
| 672 | + |
629 | 673 | /* Initialize sof_ops based on the initial selected IPC version */ |
630 | 674 | ret = sof_init_sof_ops(sdev); |
631 | 675 | if (ret) |
|
0 commit comments