Commit 4bfbbb76 authored by Rander Wang's avatar Rander Wang Committed by Mark Brown

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: default avatarRander Wang <rander.wang@intel.com>
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: default avatarPéter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20220421163358.319489-3-pierre-louis.bossart@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent d81e4ba5
...@@ -358,6 +358,13 @@ int snd_sof_device_probe(struct device *dev, struct snd_sof_pdata *plat_data) ...@@ -358,6 +358,13 @@ int snd_sof_device_probe(struct device *dev, struct snd_sof_pdata *plat_data)
sdev->first_boot = true; sdev->first_boot = true;
dev_set_drvdata(dev, sdev); 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 */ /* init ops, if necessary */
ret = sof_ops_init(sdev); ret = sof_ops_init(sdev);
if (ret < 0) if (ret < 0)
......
...@@ -40,6 +40,10 @@ static int sof_pci_debug; ...@@ -40,6 +40,10 @@ static int sof_pci_debug;
module_param_named(sof_pci_debug, sof_pci_debug, int, 0444); module_param_named(sof_pci_debug, sof_pci_debug, int, 0444);
MODULE_PARM_DESC(sof_pci_debug, "SOF PCI debug options (0x0 all off)"); 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 const char *sof_dmi_override_tplg_name;
static bool sof_dmi_use_community_key; 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) ...@@ -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; 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) { if (fw_filename) {
sof_pdata->fw_filename = fw_filename; sof_pdata->fw_filename = fw_filename;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment