Skip to content

Commit 5253a73

Browse files
sathya-nujellabroonie
authored andcommitted
ASoC: SOF: Add topology filename override based on dmi data match
Add topology filename override based on system DMI data matching, typically to account for a different hardware layout. In ACPI based systems, the tplg_filename is pre-defined in an ACPI machine table. When a DMI quirk is detected, the sof_pdata->tplg_filename is not set with the hard-coded ACPI value, and instead is set with the DMI-specific filename. Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com> Signed-off-by: Sathyanarayana Nujella <sathyanarayana.nujella@intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20200821195603.215535-14-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 3e1734b commit 5253a73

2 files changed

Lines changed: 31 additions & 1 deletion

File tree

‎sound/soc/sof/intel/hda.c‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1179,7 +1179,13 @@ void hda_machine_select(struct snd_sof_dev *sdev)
11791179

11801180
mach = snd_soc_acpi_find_machine(desc->machines);
11811181
if (mach) {
1182-
sof_pdata->tplg_filename = mach->sof_tplg_filename;
1182+
/*
1183+
* If tplg file name is overridden, use it instead of
1184+
* the one set in mach table
1185+
*/
1186+
if (!sof_pdata->tplg_filename)
1187+
sof_pdata->tplg_filename = mach->sof_tplg_filename;
1188+
11831189
sof_pdata->machine = mach;
11841190

11851191
if (mach->link_mask) {

‎sound/soc/sof/sof-pci-dev.c‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,28 @@ static int sof_pci_debug;
3535
module_param_named(sof_pci_debug, sof_pci_debug, int, 0444);
3636
MODULE_PARM_DESC(sof_pci_debug, "SOF PCI debug options (0x0 all off)");
3737

38+
static const char *sof_override_tplg_name;
39+
3840
#define SOF_PCI_DISABLE_PM_RUNTIME BIT(0)
3941

42+
static int sof_tplg_cb(const struct dmi_system_id *id)
43+
{
44+
sof_override_tplg_name = id->driver_data;
45+
return 1;
46+
}
47+
48+
static const struct dmi_system_id sof_tplg_table[] = {
49+
{
50+
.callback = sof_tplg_cb,
51+
.matches = {
52+
DMI_MATCH(DMI_PRODUCT_FAMILY, "Google_Volteer"),
53+
DMI_MATCH(DMI_PRODUCT_NAME, "Terrador"),
54+
},
55+
.driver_data = "sof-tgl-rt5682-ssp0-max98373-ssp2.tplg",
56+
},
57+
{}
58+
};
59+
4060
static const struct dmi_system_id community_key_platforms[] = {
4161
{
4262
.ident = "Up Squared",
@@ -347,6 +367,10 @@ static int sof_pci_probe(struct pci_dev *pci,
347367
sof_pdata->tplg_filename_prefix =
348368
sof_pdata->desc->default_tplg_path;
349369

370+
dmi_check_system(sof_tplg_table);
371+
if (sof_override_tplg_name)
372+
sof_pdata->tplg_filename = sof_override_tplg_name;
373+
350374
#if IS_ENABLED(CONFIG_SND_SOC_SOF_PROBE_WORK_QUEUE)
351375
/* set callback to enable runtime_pm */
352376
sof_pdata->sof_probe_complete = sof_pci_probe_complete;

0 commit comments

Comments
 (0)