summaryrefslogtreecommitdiffstats
path: root/sound/soc/sof/sof-pci-dev.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2022-05-23 16:03:04 +0200
committerTakashi Iwai <tiwai@suse.de>2022-05-23 16:03:04 +0200
commit0163717ed5dec4fc3aaf937baa9f66f21ca11c1d (patch)
treeb0618a944385d1d35bd829c9aa09eddb5c9633fa /sound/soc/sof/sof-pci-dev.c
parent1693e265e0a5dbe11fba21b48272dd15dbb71ec0 (diff)
parente5cd20e0d6713138444cc3f3f982712cf9a36143 (diff)
downloadlinux-0163717ed5dec4fc3aaf937baa9f66f21ca11c1d.tar.gz
linux-0163717ed5dec4fc3aaf937baa9f66f21ca11c1d.tar.bz2
linux-0163717ed5dec4fc3aaf937baa9f66f21ca11c1d.zip
Merge tag 'asoc-v5.19' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Updates for v5.19 This is quite a big update, partly due to the addition of some larger drivers (more of which is to follow since at least the AVS driver is still a work in progress) and partly due to Charles' work sorting out our handling of endianness. As has been the case recently it's much more about drivers than the core. - Overhaul of endianness specification for data formats, avoiding needless restrictions due to CODECs. - Initial stages of Intel AVS driver merge. - Introduction of v4 IPC mechanism for SOF. - TDM mode support for AK4613. - Support for Analog Devices ADAU1361, Cirrus Logic CS35L45, Maxim MAX98396, MediaTek MT8186, NXP i.MX8 micfil and SAI interfaces, nVidia Tegra186 ASRC, and Texas Instruments TAS2764 and TAS2780
Diffstat (limited to 'sound/soc/sof/sof-pci-dev.c')
-rw-r--r--sound/soc/sof/sof-pci-dev.c96
1 files changed, 86 insertions, 10 deletions
diff --git a/sound/soc/sof/sof-pci-dev.c b/sound/soc/sof/sof-pci-dev.c
index 7fa2649e56e5..d627092b399d 100644
--- a/sound/soc/sof/sof-pci-dev.c
+++ b/sound/soc/sof/sof-pci-dev.c
@@ -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>
@@ -23,21 +24,34 @@ 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.");
+static char *tplg_filename;
+module_param(tplg_filename, charp, 0444);
+MODULE_PARM_DESC(tplg_filename, "alternate filename for SOF topology.");
+
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 const char *sof_override_tplg_name;
+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)
static int sof_tplg_cb(const struct dmi_system_id *id)
{
- sof_override_tplg_name = id->driver_data;
+ sof_dmi_override_tplg_name = id->driver_data;
return 1;
}
@@ -94,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"),
}
@@ -178,7 +212,36 @@ int sof_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
sof_pdata->name = pci_name(pci);
sof_pdata->desc = desc;
sof_pdata->dev = dev;
- sof_pdata->fw_filename = desc->default_fw_filename;
+
+ 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);
+ ret = -EINVAL;
+ goto out;
+ }
+ 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);
+ ret = -EINVAL;
+ goto out;
+ }
+ sof_pdata->ipc_type = sof_pci_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
@@ -195,10 +258,10 @@ 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->desc->default_fw_path[sof_pdata->ipc_type],
"community");
dev_dbg(dev,
@@ -206,24 +269,37 @@ int sof_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
sof_pdata->fw_filename_prefix);
} else {
sof_pdata->fw_filename_prefix =
- sof_pdata->desc->default_fw_path;
+ sof_pdata->desc->default_fw_path[sof_pdata->ipc_type];
}
if (tplg_path)
sof_pdata->tplg_filename_prefix = tplg_path;
else
sof_pdata->tplg_filename_prefix =
- sof_pdata->desc->default_tplg_path;
+ sof_pdata->desc->default_tplg_path[sof_pdata->ipc_type];
- dmi_check_system(sof_tplg_table);
- if (sof_override_tplg_name)
- sof_pdata->tplg_filename = sof_override_tplg_name;
+ /*
+ * the topology filename will be provided in the machine descriptor, unless
+ * it is overridden by a module parameter or DMI quirk.
+ */
+ if (tplg_filename) {
+ sof_pdata->tplg_filename = tplg_filename;
+
+ dev_dbg(dev, "Module parameter used, changed tplg filename to %s\n",
+ sof_pdata->tplg_filename);
+ } else {
+ dmi_check_system(sof_tplg_table);
+ if (sof_dmi_override_tplg_name)
+ sof_pdata->tplg_filename = sof_dmi_override_tplg_name;
+ }
/* set callback to be called on successful device probe to enable runtime_pm */
sof_pdata->sof_probe_complete = sof_pci_probe_complete;
/* call sof helper for DSP hardware probe */
ret = snd_sof_device_probe(dev, sof_pdata);
+
+out:
if (ret)
pci_release_regions(pci);