mirror of
https://github.com/torvalds/linux.git
synced 2026-05-03 22:12:32 -04:00
ASoC: SOF: Make creation of machine device from SOF core optional
Currently, SOF probes machine drivers by creating a platform device and passing the machine description as private data. This is driven by the ACPI restrictions. Ideally, ACPI tables should contain the description for the machine driver. This is not possible because ACPI tables are frozen and used on multiple OS-es (e.g Windows). In the case of Device Tree we don't have this restriction, so we choose to probe the machine drivers by creating a DT node as is the standard ALSA way. This patch makes the probing of machine drivers from SOF core optional allowing for Device Tree platforms to decouple the SOF core from machine driver probing. Along with this, it also consolidates the machine driver selection for Intel platforms by defining optional ops for selecting the machine driver based on the ACPI match for HDA and non-HDA platforms and setting the mach params. Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com> Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20191204211556.12671-11-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
committed by
Mark Brown
parent
80acdd4f8f
commit
285880a23d
@@ -275,7 +275,6 @@ static int sof_pci_probe(struct pci_dev *pci,
|
||||
struct device *dev = &pci->dev;
|
||||
const struct sof_dev_desc *desc =
|
||||
(const struct sof_dev_desc *)pci_id->driver_data;
|
||||
struct snd_soc_acpi_mach *mach;
|
||||
struct snd_sof_pdata *sof_pdata;
|
||||
const struct snd_sof_dsp_ops *ops;
|
||||
int ret;
|
||||
@@ -306,35 +305,10 @@ static int sof_pci_probe(struct pci_dev *pci,
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
#if IS_ENABLED(CONFIG_SND_SOC_SOF_FORCE_NOCODEC_MODE)
|
||||
/* force nocodec mode */
|
||||
dev_warn(dev, "Force to use nocodec mode\n");
|
||||
mach = devm_kzalloc(dev, sizeof(*mach), GFP_KERNEL);
|
||||
if (!mach) {
|
||||
ret = -ENOMEM;
|
||||
goto release_regions;
|
||||
}
|
||||
ret = sof_nocodec_setup(dev, sof_pdata, mach, desc, ops);
|
||||
if (ret < 0)
|
||||
goto release_regions;
|
||||
|
||||
#else
|
||||
/* find machine */
|
||||
mach = snd_soc_acpi_find_machine(desc->machines);
|
||||
if (!mach) {
|
||||
dev_warn(dev, "warning: No matching ASoC machine driver found\n");
|
||||
} else {
|
||||
mach->mach_params.platform = dev_name(dev);
|
||||
sof_pdata->fw_filename = mach->sof_fw_filename;
|
||||
sof_pdata->tplg_filename = mach->sof_tplg_filename;
|
||||
}
|
||||
#endif /* CONFIG_SND_SOC_SOF_FORCE_NOCODEC_MODE */
|
||||
|
||||
sof_pdata->name = pci_name(pci);
|
||||
sof_pdata->machine = mach;
|
||||
sof_pdata->desc = (struct sof_dev_desc *)pci_id->driver_data;
|
||||
sof_pdata->dev = dev;
|
||||
sof_pdata->platform = dev_name(dev);
|
||||
sof_pdata->fw_filename = desc->default_fw_filename;
|
||||
|
||||
/* alternate fw and tplg filenames ? */
|
||||
if (fw_path)
|
||||
|
||||
Reference in New Issue
Block a user