Skip to content

Commit

Permalink
ASoC: SOF: acpi: add dynamic selection of DSP driver
Browse files Browse the repository at this point in the history
Follow PCI example and stop the probe when another driver is desired
for the same ACPI HID.

Signed-off-by: Pierre-Louis Bossart <[email protected]>
Reviewed-by: Ranjani Sridharan <[email protected]>
Reviewed-by: Rander Wang <[email protected]>
Reviewed-by: Guennadi Liakhovetski <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
plbossart authored and broonie committed Nov 19, 2020
1 parent 05ff312 commit f7313f9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions sound/soc/sof/intel/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ config SND_SOC_SOF_BAYTRAIL_SUPPORT
config SND_SOC_SOF_BAYTRAIL
tristate
select SND_SOC_SOF_INTEL_ATOM_HIFI_EP
select SND_INTEL_DSP_CONFIG
help
This option is not user-selectable but automagically handled by
'select' statements at a higher level.
Expand Down
14 changes: 13 additions & 1 deletion sound/soc/sof/sof-acpi-dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <linux/firmware.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
#include <sound/intel-dsp-config.h>
#include <sound/soc-acpi.h>
#include <sound/soc-acpi-intel-match.h>
#include <sound/sof.h>
Expand Down Expand Up @@ -120,12 +121,23 @@ static void sof_acpi_probe_complete(struct device *dev)
static int sof_acpi_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
const struct acpi_device_id *id;
const struct sof_dev_desc *desc;
struct snd_sof_pdata *sof_pdata;
const struct snd_sof_dsp_ops *ops;
int ret;

dev_dbg(&pdev->dev, "ACPI DSP detected");
id = acpi_match_device(dev->driver->acpi_match_table, dev);
if (!id)
return -ENODEV;

ret = snd_intel_acpi_dsp_driver_probe(dev, id->id);
if (ret != SND_INTEL_DSP_DRIVER_ANY && ret != SND_INTEL_DSP_DRIVER_SOF) {
dev_dbg(dev, "SOF ACPI driver not selected, aborting probe\n");
return -ENODEV;
}

dev_dbg(dev, "ACPI DSP detected");

sof_pdata = devm_kzalloc(dev, sizeof(*sof_pdata), GFP_KERNEL);
if (!sof_pdata)
Expand Down

0 comments on commit f7313f9

Please sign in to comment.