From 1ef469e4c7dfc41b64eded97ee88a6fb95dcad84 Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Tue, 25 Aug 2026 12:54:01 +0300 Subject: [PATCH] ASoC: SOF: Intel: hda: add quirk for Xiaomi Redmi Book 16 with PDM1 dmic Add a quirk to force a PDM1 DMIC topology on systems where PCH DMIC is connected to PDM1 and not not PDM0. Link: https://github.com/thesofproject/linux/issues/5894 Signed-off-by: Kai Vehmanen --- .../intel/common/soc-acpi-intel-hda-match.c | 28 +++++++++++++++++++ sound/soc/sof/intel/hda.c | 11 +++++++- 2 files changed, 38 insertions(+), 1 deletion(-) 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..5d85c480675997 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_4ch_pdm1_mach = { + /* .id is not used in this file */ + .drv_name = "skl_hda_dsp_generic", + .sof_tplg_filename = "sof-hda-generic-4ch-pdm1", +}; + +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_4ch_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 4dbba9186b29d4..7a63fdb6f114e0 100644 --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c @@ -1041,7 +1041,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; @@ -1095,6 +1095,15 @@ static void hda_generic_machine_select(struct snd_sof_dev *sdev, if (!pdata->tplg_filename) tplg_fixup = true; + if (hda_mach->machine_quirk) { + mach_alt = hda_mach->machine_quirk(hda_mach); + if (mach_alt) { + hda_mach = mach_alt; + 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,