Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: SOF: Add path definition for external firmware libraries

IPC4 based firmware supports dynamically loaded external libraries.
The libraries will be not stored alongside of the firmware or tplg files.

For intel platforms the default path will be:
intel/avs-lib|sof-ipc4-lib/<platform>/ if a community key is used on the
given machine then the libraries will be under 'community' directory, like
it is done for the firmware itself.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Chao Song <chao.song@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20221020121238.18339-12-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Peter Ujfalusi and committed by
Mark Brown
25bbc0c5 c73f8b47

+34 -1
+5 -1
include/sound/sof.h
··· 82 82 const char *tplg_filename_prefix; 83 83 const char *tplg_filename; 84 84 85 + /* loadable external libraries available under this directory */ 86 + const char *fw_lib_prefix; 87 + 85 88 /* machine */ 86 89 struct platform_device *pdev_mach; 87 90 const struct snd_soc_acpi_mach *machine; ··· 130 127 unsigned int ipc_supported_mask; 131 128 enum sof_ipc_type ipc_default; 132 129 133 - /* defaults paths for firmware and topology files */ 130 + /* defaults paths for firmware, library and topology files */ 134 131 const char *default_fw_path[SOF_IPC_TYPE_COUNT]; 132 + const char *default_lib_path[SOF_IPC_TYPE_COUNT]; 135 133 const char *default_tplg_path[SOF_IPC_TYPE_COUNT]; 136 134 137 135 /* default firmware name */
+3
sound/soc/sof/intel/pci-tgl.c
··· 174 174 [SOF_IPC] = "intel/sof", 175 175 [SOF_INTEL_IPC4] = "intel/avs/adl-n", 176 176 }, 177 + .default_lib_path = { 178 + [SOF_INTEL_IPC4] = "intel/avs-lib/adl-n", 179 + }, 177 180 .default_tplg_path = { 178 181 [SOF_IPC] = "intel/sof-tplg", 179 182 [SOF_INTEL_IPC4] = "intel/avs-tplg",
+26
sound/soc/sof/sof-pci-dev.c
··· 28 28 module_param(fw_filename, charp, 0444); 29 29 MODULE_PARM_DESC(fw_filename, "alternate filename for SOF firmware."); 30 30 31 + static char *lib_path; 32 + module_param(lib_path, charp, 0444); 33 + MODULE_PARM_DESC(lib_path, "alternate path for SOF firmware libraries."); 34 + 31 35 static char *tplg_path; 32 36 module_param(tplg_path, charp, 0444); 33 37 MODULE_PARM_DESC(tplg_path, "alternate path for SOF topology."); ··· 274 270 } else { 275 271 sof_pdata->fw_filename_prefix = 276 272 sof_pdata->desc->default_fw_path[sof_pdata->ipc_type]; 273 + } 274 + 275 + if (lib_path) { 276 + sof_pdata->fw_lib_prefix = lib_path; 277 + 278 + dev_dbg(dev, "Module parameter used, changed fw_lib path to %s\n", 279 + sof_pdata->fw_lib_prefix); 280 + 281 + } else if (sof_pdata->desc->default_lib_path[sof_pdata->ipc_type]) { 282 + if (dmi_check_system(community_key_platforms) && sof_dmi_use_community_key) { 283 + sof_pdata->fw_lib_prefix = 284 + devm_kasprintf(dev, GFP_KERNEL, "%s/%s", 285 + sof_pdata->desc->default_lib_path[sof_pdata->ipc_type], 286 + "community"); 287 + 288 + dev_dbg(dev, 289 + "Platform uses community key, changed fw_lib path to %s\n", 290 + sof_pdata->fw_lib_prefix); 291 + } else { 292 + sof_pdata->fw_lib_prefix = 293 + sof_pdata->desc->default_lib_path[sof_pdata->ipc_type]; 294 + } 277 295 } 278 296 279 297 if (tplg_path)