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:
Daniel Baluta
2019-12-04 15:15:53 -06:00
committed by Mark Brown
parent 80acdd4f8f
commit 285880a23d
15 changed files with 361 additions and 231 deletions

View File

@@ -44,8 +44,6 @@ static int sof_of_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
const struct sof_dev_desc *desc;
/*TODO: create a generic snd_soc_xxx_mach */
struct snd_soc_acpi_mach *mach;
struct snd_sof_pdata *sof_pdata;
const struct snd_sof_dsp_ops *ops;
int ret;
@@ -67,27 +65,9 @@ static int sof_of_probe(struct platform_device *pdev)
return -ENODEV;
}
#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)
return -ENOMEM;
ret = sof_nocodec_setup(dev, sof_pdata, mach, desc, ops);
if (ret < 0)
return ret;
#else
/* TODO: implement case where we actually have a codec */
return -ENODEV;
#endif
if (mach)
mach->mach_params.platform = dev_name(dev);
sof_pdata->machine = mach;
sof_pdata->desc = desc;
sof_pdata->dev = &pdev->dev;
sof_pdata->platform = dev_name(dev);
sof_pdata->fw_filename = desc->default_fw_filename;
/* TODO: read alternate fw and tplg filenames from DT */
sof_pdata->fw_filename_prefix = sof_pdata->desc->default_fw_path;