Skip to content

Commit 57ebd5d

Browse files
committed
ASoC: SOF: pci: add quirks and PCI IDS
Merge series from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>: Add two PCI IDs and quirks for APL Chromebooks and Intel IPC4 selection for developers.
2 parents 8ad0b83 + c275872 commit 57ebd5d

3 files changed

Lines changed: 57 additions & 1 deletion

File tree

sound/soc/sof/core.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,13 @@ int snd_sof_device_probe(struct device *dev, struct snd_sof_pdata *plat_data)
358358
sdev->first_boot = true;
359359
dev_set_drvdata(dev, sdev);
360360

361+
/* check IPC support */
362+
if (!(BIT(plat_data->ipc_type) & plat_data->desc->ipc_supported_mask)) {
363+
dev_err(dev, "ipc_type %d is not supported on this platform, mask is %#x\n",
364+
plat_data->ipc_type, plat_data->desc->ipc_supported_mask);
365+
return -EINVAL;
366+
}
367+
361368
/* init ops, if necessary */
362369
ret = sof_ops_init(sdev);
363370
if (ret < 0)

sound/soc/sof/intel/pci-tgl.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,12 @@ static const struct pci_device_id sof_pci_ids[] = {
176176
.driver_data = (unsigned long)&adl_desc},
177177
{ PCI_DEVICE(0x8086, 0x51cd), /* ADL-P */
178178
.driver_data = (unsigned long)&adl_desc},
179+
{ PCI_DEVICE(0x8086, 0x51c9), /* ADL-PS */
180+
.driver_data = (unsigned long)&adl_desc},
181+
{ PCI_DEVICE(0x8086, 0x51ca), /* RPL-P */
182+
.driver_data = (unsigned long)&adl_desc},
183+
{ PCI_DEVICE(0x8086, 0x51cb), /* RPL-P */
184+
.driver_data = (unsigned long)&adl_desc},
179185
{ PCI_DEVICE(0x8086, 0x51cc), /* ADL-M */
180186
.driver_data = (unsigned long)&adl_desc},
181187
{ PCI_DEVICE(0x8086, 0x54c8), /* ADL-N */

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

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <linux/dmi.h>
1313
#include <linux/module.h>
1414
#include <linux/pci.h>
15+
#include <linux/platform_data/x86/soc.h>
1516
#include <linux/pm_runtime.h>
1617
#include <sound/soc-acpi.h>
1718
#include <sound/soc-acpi-intel-match.h>
@@ -39,7 +40,12 @@ static int sof_pci_debug;
3940
module_param_named(sof_pci_debug, sof_pci_debug, int, 0444);
4041
MODULE_PARM_DESC(sof_pci_debug, "SOF PCI debug options (0x0 all off)");
4142

43+
static int sof_pci_ipc_type = -1;
44+
module_param_named(ipc_type, sof_pci_ipc_type, int, 0444);
45+
MODULE_PARM_DESC(ipc_type, "SOF IPC type (0): SOF, (1) Intel CAVS");
46+
4247
static const char *sof_dmi_override_tplg_name;
48+
static bool sof_dmi_use_community_key;
4349

4450
#define SOF_PCI_DISABLE_PM_RUNTIME BIT(0)
4551

@@ -102,15 +108,35 @@ static const struct dmi_system_id sof_tplg_table[] = {
102108
{}
103109
};
104110

111+
/* all Up boards use the community key */
112+
static int up_use_community_key(const struct dmi_system_id *id)
113+
{
114+
sof_dmi_use_community_key = true;
115+
return 1;
116+
}
117+
118+
/*
119+
* For ApolloLake Chromebooks we want to force the use of the Intel production key.
120+
* All newer platforms use the community key
121+
*/
122+
static int chromebook_use_community_key(const struct dmi_system_id *id)
123+
{
124+
if (!soc_intel_is_apl())
125+
sof_dmi_use_community_key = true;
126+
return 1;
127+
}
128+
105129
static const struct dmi_system_id community_key_platforms[] = {
106130
{
107131
.ident = "Up boards",
132+
.callback = up_use_community_key,
108133
.matches = {
109134
DMI_MATCH(DMI_SYS_VENDOR, "AAEON"),
110135
}
111136
},
112137
{
113138
.ident = "Google Chromebooks",
139+
.callback = chromebook_use_community_key,
114140
.matches = {
115141
DMI_MATCH(DMI_SYS_VENDOR, "Google"),
116142
}
@@ -184,6 +210,23 @@ int sof_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
184210

185211
sof_pdata->ipc_type = desc->ipc_default;
186212

213+
if (sof_pci_ipc_type < 0) {
214+
sof_pdata->ipc_type = desc->ipc_default;
215+
} else {
216+
dev_info(dev, "overriding default IPC %d to requested %d\n",
217+
desc->ipc_default, sof_pci_ipc_type);
218+
if (sof_pci_ipc_type >= SOF_IPC_TYPE_COUNT) {
219+
dev_err(dev, "invalid request value %d\n", sof_pci_ipc_type);
220+
return -EINVAL;
221+
}
222+
if (!(BIT(sof_pci_ipc_type) & desc->ipc_supported_mask)) {
223+
dev_err(dev, "invalid request value %d, supported mask is %#x\n",
224+
sof_pci_ipc_type, desc->ipc_supported_mask);
225+
return -EINVAL;
226+
}
227+
sof_pdata->ipc_type = sof_pci_ipc_type;
228+
}
229+
187230
if (fw_filename) {
188231
sof_pdata->fw_filename = fw_filename;
189232

@@ -208,7 +251,7 @@ int sof_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
208251
"Module parameter used, changed fw path to %s\n",
209252
sof_pdata->fw_filename_prefix);
210253

211-
} else if (dmi_check_system(community_key_platforms)) {
254+
} else if (dmi_check_system(community_key_platforms) && sof_dmi_use_community_key) {
212255
sof_pdata->fw_filename_prefix =
213256
devm_kasprintf(dev, GFP_KERNEL, "%s/%s",
214257
sof_pdata->desc->default_fw_path[sof_pdata->ipc_type],

0 commit comments

Comments
 (0)