ASoC: SOF: sof-pci-dev: add parameter to override firmware filename
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Thu, 14 Apr 2022 18:48:07 +0000 (13:48 -0500)
committerMark Brown <broonie@kernel.org>
Tue, 19 Apr 2022 11:03:35 +0000 (12:03 +0100)
The existing 'fw_path' module parameter can be used to load alternate
firmware files, be it for development or to handle OEM-specific or
board-specific releases. The firmware name is however non-modifiable
and defined by platform-specific descriptors.

For additional flexibility during development or enable quirks, this
patch adds the 'fw_filename' module parameter to override default
firmware names.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Paul Olaru <paul.olaru@oss.nxp.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20220414184817.362215-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/sof-pci-dev.c

index 470c0ac..15fffcd 100644 (file)
@@ -23,6 +23,10 @@ static char *fw_path;
 module_param(fw_path, charp, 0444);
 MODULE_PARM_DESC(fw_path, "alternate path for SOF firmware.");
 
+static char *fw_filename;
+module_param(fw_filename, charp, 0444);
+MODULE_PARM_DESC(fw_filename, "alternate filename for SOF firmware.");
+
 static char *tplg_path;
 module_param(tplg_path, charp, 0444);
 MODULE_PARM_DESC(tplg_path, "alternate path for SOF topology.");
@@ -175,7 +179,15 @@ int sof_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
        sof_pdata->dev = dev;
 
        sof_pdata->ipc_type = desc->ipc_default;
-       sof_pdata->fw_filename = desc->default_fw_filename[sof_pdata->ipc_type];
+
+       if (fw_filename) {
+               sof_pdata->fw_filename = fw_filename;
+
+               dev_dbg(dev, "Module parameter used, changed fw filename to %s\n",
+                       sof_pdata->fw_filename);
+       } else {
+               sof_pdata->fw_filename = desc->default_fw_filename[sof_pdata->ipc_type];
+       }
 
        /*
         * for platforms using the SOF community key, change the