[alsa-devel] [PATCH] ASoC: snd-sof-pci - add model parameter and pass it to HDA codec driver

Jaroslav Kysela perex at perex.cz
Tue Dec 3 17:19:08 CET 2019


It may be useful to pass the specific model to the generic HDA codec
routines like the legacy HDA driver (snd-hda-intel) allows.
The model name "sofbus" is tricky anyway.

Signed-off-by: Jaroslav Kysela <perex at perex.cz>
Cc: Pierre-Louis Bossart <pierre-louis.bossart at linux.intel.com>
Cc: Mark Brown <broonie at kernel.org>
---
 include/sound/sof.h         | 1 +
 sound/soc/sof/intel/hda.c   | 2 +-
 sound/soc/sof/sof-pci-dev.c | 5 +++++
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/sound/sof.h b/include/sound/sof.h
index 479101736ee0..a62686baa95d 100644
--- a/include/sound/sof.h
+++ b/include/sound/sof.h
@@ -25,6 +25,7 @@ struct snd_sof_pdata {
 	const char *drv_name;
 	const char *name;
 	const char *platform;
+	const char *modelname;
 
 	struct device *dev;
 
diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c
index 91bd88fddac7..ccb640bacc99 100644
--- a/sound/soc/sof/intel/hda.c
+++ b/sound/soc/sof/intel/hda.c
@@ -271,7 +271,7 @@ static int hda_init(struct snd_sof_dev *sdev)
 	mutex_init(&hbus->prepare_mutex);
 	hbus->pci = pci;
 	hbus->mixer_assigned = -1;
-	hbus->modelname = "sofbus";
+	hbus->modelname = sdev->pdata->modelname;
 
 	/* initialise hdac bus */
 	bus->addr = pci_resource_start(pci, 0);
diff --git a/sound/soc/sof/sof-pci-dev.c b/sound/soc/sof/sof-pci-dev.c
index bbeffd932de7..c01ad85aad2a 100644
--- a/sound/soc/sof/sof-pci-dev.c
+++ b/sound/soc/sof/sof-pci-dev.c
@@ -34,6 +34,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 char *model;
+module_param(model, charp, 0444);
+MODULE_PARM_DESC(model, "Use the given HDA board model.");
+
 #define SOF_PCI_DISABLE_PM_RUNTIME BIT(0)
 
 #if IS_ENABLED(CONFIG_SND_SOC_SOF_APOLLOLAKE)
@@ -326,6 +330,7 @@ static int sof_pci_probe(struct pci_dev *pci,
 	sof_pdata->desc = (struct sof_dev_desc *)pci_id->driver_data;
 	sof_pdata->dev = dev;
 	sof_pdata->platform = dev_name(dev);
+	sof_pdata->modelname = model;
 
 	/* alternate fw and tplg filenames ? */
 	if (fw_path)
-- 
2.20.1


More information about the Alsa-devel mailing list