Unverified Commit 57ebd5d5 authored by Mark Brown's avatar Mark Brown
Browse files

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.
parents 8ad0b83e c2758721
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -358,6 +358,13 @@ int snd_sof_device_probe(struct device *dev, struct snd_sof_pdata *plat_data)
	sdev->first_boot = true;
	dev_set_drvdata(dev, sdev);

	/* check IPC support */
	if (!(BIT(plat_data->ipc_type) & plat_data->desc->ipc_supported_mask)) {
		dev_err(dev, "ipc_type %d is not supported on this platform, mask is %#x\n",
			plat_data->ipc_type, plat_data->desc->ipc_supported_mask);
		return -EINVAL;
	}

	/* init ops, if necessary */
	ret = sof_ops_init(sdev);
	if (ret < 0)
+6 −0
Original line number Diff line number Diff line
@@ -176,6 +176,12 @@ static const struct pci_device_id sof_pci_ids[] = {
		.driver_data = (unsigned long)&adl_desc},
	{ PCI_DEVICE(0x8086, 0x51cd), /* ADL-P */
		.driver_data = (unsigned long)&adl_desc},
	{ PCI_DEVICE(0x8086, 0x51c9), /* ADL-PS */
		.driver_data = (unsigned long)&adl_desc},
	{ PCI_DEVICE(0x8086, 0x51ca), /* RPL-P */
		.driver_data = (unsigned long)&adl_desc},
	{ PCI_DEVICE(0x8086, 0x51cb), /* RPL-P */
		.driver_data = (unsigned long)&adl_desc},
	{ PCI_DEVICE(0x8086, 0x51cc), /* ADL-M */
		.driver_data = (unsigned long)&adl_desc},
	{ PCI_DEVICE(0x8086, 0x54c8), /* ADL-N */
+44 −1
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@
#include <linux/dmi.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/platform_data/x86/soc.h>
#include <linux/pm_runtime.h>
#include <sound/soc-acpi.h>
#include <sound/soc-acpi-intel-match.h>
@@ -39,7 +40,12 @@ static int sof_pci_debug;
module_param_named(sof_pci_debug, sof_pci_debug, int, 0444);
MODULE_PARM_DESC(sof_pci_debug, "SOF PCI debug options (0x0 all off)");

static int sof_pci_ipc_type = -1;
module_param_named(ipc_type, sof_pci_ipc_type, int, 0444);
MODULE_PARM_DESC(ipc_type, "SOF IPC type (0): SOF, (1) Intel CAVS");

static const char *sof_dmi_override_tplg_name;
static bool sof_dmi_use_community_key;

#define SOF_PCI_DISABLE_PM_RUNTIME BIT(0)

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

/* all Up boards use the community key */
static int up_use_community_key(const struct dmi_system_id *id)
{
	sof_dmi_use_community_key = true;
	return 1;
}

/*
 * For ApolloLake Chromebooks we want to force the use of the Intel production key.
 * All newer platforms use the community key
 */
static int chromebook_use_community_key(const struct dmi_system_id *id)
{
	if (!soc_intel_is_apl())
		sof_dmi_use_community_key = true;
	return 1;
}

static const struct dmi_system_id community_key_platforms[] = {
	{
		.ident = "Up boards",
		.callback = up_use_community_key,
		.matches = {
			DMI_MATCH(DMI_SYS_VENDOR, "AAEON"),
		}
	},
	{
		.ident = "Google Chromebooks",
		.callback = chromebook_use_community_key,
		.matches = {
			DMI_MATCH(DMI_SYS_VENDOR, "Google"),
		}
@@ -184,6 +210,23 @@ int sof_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)

	sof_pdata->ipc_type = desc->ipc_default;

	if (sof_pci_ipc_type < 0) {
		sof_pdata->ipc_type = desc->ipc_default;
	} else {
		dev_info(dev, "overriding default IPC %d to requested %d\n",
			 desc->ipc_default, sof_pci_ipc_type);
		if (sof_pci_ipc_type >= SOF_IPC_TYPE_COUNT) {
			dev_err(dev, "invalid request value %d\n", sof_pci_ipc_type);
			return -EINVAL;
		}
		if (!(BIT(sof_pci_ipc_type) & desc->ipc_supported_mask)) {
			dev_err(dev, "invalid request value %d, supported mask is %#x\n",
				sof_pci_ipc_type, desc->ipc_supported_mask);
			return -EINVAL;
		}
		sof_pdata->ipc_type = sof_pci_ipc_type;
	}

	if (fw_filename) {
		sof_pdata->fw_filename = fw_filename;

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

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