Skip to content

Commit 46207ca

Browse files
plbossartbroonie
authored andcommitted
ASoC: SOF: pci: change the default firmware path when the community key is used
Since ApolloLake, Intel platforms require signed firmware. On all Windows platforms the default is to require the Intel production key be used. But some platforms allow for a community key to be used, which allows developers to compile/build their own firmware. In the linux-firmware tree, the default intel/sof path is used for firmwares signed for the production key, and files signed with the community key are located in intel/sof/community. Since we don't have an API to query which key is used on what platforms, we have to rely on DMI-based quirks. Developers can bypass this mechanism by setting a kernel 'fw_path' module parameter. Additional dynamic debug traces are provided to help debug cases where the wrong file might be used. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20200107160840.1524-2-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent d4b74e2 commit 46207ca

1 file changed

Lines changed: 42 additions & 2 deletions

File tree

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

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
//
1010

1111
#include <linux/firmware.h>
12+
#include <linux/dmi.h>
1213
#include <linux/module.h>
1314
#include <linux/pci.h>
1415
#include <linux/pm_runtime.h>
@@ -36,6 +37,23 @@ MODULE_PARM_DESC(sof_pci_debug, "SOF PCI debug options (0x0 all off)");
3637

3738
#define SOF_PCI_DISABLE_PM_RUNTIME BIT(0)
3839

40+
static const struct dmi_system_id community_key_platforms[] = {
41+
{
42+
.ident = "Up Squared",
43+
.matches = {
44+
DMI_MATCH(DMI_SYS_VENDOR, "AAEON"),
45+
DMI_MATCH(DMI_BOARD_NAME, "UP-APL01"),
46+
}
47+
},
48+
{
49+
.ident = "Google Chromebooks",
50+
.matches = {
51+
DMI_MATCH(DMI_SYS_VENDOR, "Google"),
52+
}
53+
},
54+
{},
55+
};
56+
3957
#if IS_ENABLED(CONFIG_SND_SOC_SOF_APOLLOLAKE)
4058
static const struct sof_dev_desc bxt_desc = {
4159
.machines = snd_soc_acpi_intel_bxt_machines,
@@ -290,12 +308,34 @@ static int sof_pci_probe(struct pci_dev *pci,
290308
sof_pdata->dev = dev;
291309
sof_pdata->fw_filename = desc->default_fw_filename;
292310

311+
/*
312+
* for platforms using the SOF community key, change the
313+
* default path automatically to pick the right files from the
314+
* linux-firmware tree. This can be overridden with the
315+
* fw_path kernel parameter, e.g. for developers.
316+
*/
317+
293318
/* alternate fw and tplg filenames ? */
294-
if (fw_path)
319+
if (fw_path) {
295320
sof_pdata->fw_filename_prefix = fw_path;
296-
else
321+
322+
dev_dbg(dev,
323+
"Module parameter used, changed fw path to %s\n",
324+
sof_pdata->fw_filename_prefix);
325+
326+
} else if (dmi_check_system(community_key_platforms)) {
327+
sof_pdata->fw_filename_prefix =
328+
devm_kasprintf(dev, GFP_KERNEL, "%s/%s",
329+
sof_pdata->desc->default_fw_path,
330+
"community");
331+
332+
dev_dbg(dev,
333+
"Platform uses community key, changed fw path to %s\n",
334+
sof_pdata->fw_filename_prefix);
335+
} else {
297336
sof_pdata->fw_filename_prefix =
298337
sof_pdata->desc->default_fw_path;
338+
}
299339

300340
if (tplg_path)
301341
sof_pdata->tplg_filename_prefix = tplg_path;

0 commit comments

Comments
 (0)