summaryrefslogtreecommitdiff
path: root/sound/soc/sof/sof-pci-dev.c
diff options
context:
space:
mode:
authorRander Wang <rander.wang@intel.com>2022-04-21 19:33:56 +0300
committerMark Brown <broonie@kernel.org>2022-04-22 14:37:25 +0300
commit4bfbbb76e82e5f1e0e114e0831356656b4169c80 (patch)
tree187d5e92a44474199cad739bc2a003c3f2297132 /sound/soc/sof/sof-pci-dev.c
parentd81e4ba5ef1c1033b6c720b22fc99feeb71e71a0 (diff)
downloadlinux-4bfbbb76e82e5f1e0e114e0831356656b4169c80.tar.xz
ASOC: SOF: pci: add ipc_type override for Intel IPC4 tests
Add a kernel module parameter for select the non-default IPC type. This should only be used by developers with access to firmware and topology files, typically Intel and partners. Signed-off-by: Rander Wang <rander.wang@intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Link: https://lore.kernel.org/r/20220421163358.319489-3-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sof/sof-pci-dev.c')
-rw-r--r--sound/soc/sof/sof-pci-dev.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/sound/soc/sof/sof-pci-dev.c b/sound/soc/sof/sof-pci-dev.c
index 003120721779..cd90da7c92c2 100644
--- a/sound/soc/sof/sof-pci-dev.c
+++ b/sound/soc/sof/sof-pci-dev.c
@@ -40,6 +40,10 @@ 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;
@@ -206,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;