diff --git a/sound/soc/intel/common/soc-acpi-intel-hda-match.c b/sound/soc/intel/common/soc-acpi-intel-hda-match.c index e93336e27bebd7..0654937de7d45b 100644 --- a/sound/soc/intel/common/soc-acpi-intel-hda-match.c +++ b/sound/soc/intel/common/soc-acpi-intel-hda-match.c @@ -6,13 +6,41 @@ * */ +#include #include #include +static const struct dmi_system_id hda_pdm1_dmic[] = { + { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "XIAOMI"), + DMI_MATCH(DMI_PRODUCT_NAME, "Redmi Book Pro 16 2025"), + }, + }, + { } +}; + +static struct snd_soc_acpi_mach intel_hda_dmic_2ch_pdm1_mach = { + /* .id is not used in this file */ + .drv_name = "skl_hda_dsp_generic", + .sof_tplg_filename = "sof-hda-generic-2ch-pdm1.tplg", +}; + +static struct snd_soc_acpi_mach *hda_dmic_pdm1_quirk(void *arg) +{ + struct snd_soc_acpi_mach *mach = arg; + + if (dmi_check_system(hda_pdm1_dmic)) + return &intel_hda_dmic_2ch_pdm1_mach; + + return mach; +} + struct snd_soc_acpi_mach snd_soc_acpi_intel_hda_machines[] = { { /* .id is not used in this file */ .drv_name = "skl_hda_dsp_generic", + .machine_quirk = hda_dmic_pdm1_quirk, .sof_tplg_filename = "sof-hda-generic", /* the tplg suffix is added at run time */ .tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER, }, diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c index 45e968fb19104b..ff9a0705a34d14 100644 --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c @@ -1045,7 +1045,7 @@ static void hda_generic_machine_select(struct snd_sof_dev *sdev, { struct hdac_bus *bus = sof_to_bus(sdev); struct snd_soc_acpi_mach_params *mach_params; - struct snd_soc_acpi_mach *hda_mach; + struct snd_soc_acpi_mach *hda_mach, *mach_alt; struct snd_sof_pdata *pdata = sdev->pdata; const char *tplg_filename; int codec_num = 0; @@ -1099,6 +1099,23 @@ static void hda_generic_machine_select(struct snd_sof_dev *sdev, if (!pdata->tplg_filename) tplg_fixup = true; + if (tplg_fixup && hda_mach->machine_quirk) { + mach_alt = hda_mach->machine_quirk(hda_mach); + if (mach_alt && mach_alt != hda_mach) { + /* + * The quirk provides the complete topology name + * (including the .tplg extension), so set it as + * if overridden by the user. This skips all + * topology name fixups later. + */ + hda_mach->drv_name = mach_alt->drv_name; + hda_mach->sof_tplg_filename = mach_alt->sof_tplg_filename; + pdata->tplg_filename = mach_alt->sof_tplg_filename; + tplg_fixup = false; + dev_dbg(bus->dev, "using quirk for HDA machine driver\n"); + } + } + if (tplg_fixup && codec_num == 1 && HDA_IDISP_CODEC(bus->codec_mask)) { tplg_filename = devm_kasprintf(sdev->dev, GFP_KERNEL,