[PATCH] ASoC: amd: ps: Add support for MSI Crosshair A16 HX

Sidharth Sharma posted 1 patch 1 week ago
There is a newer version of this series
sound/soc/amd/ps/pci-ps.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
[PATCH] ASoC: amd: ps: Add support for MSI Crosshair A16 HX
Posted by Sidharth Sharma 1 week ago
The MSI Crosshair A16 HX (D8WFKG) uses a Ryzen 9 8940HX processor,
which identifies with ACP PCI revision 0x62. This revision is currently
unlisted in the Pink Sardine driver, causing the probe to return -ENODEV.

Furthermore, the MSI BIOS lacks the necessary 'acp-audio-device-type'
and '_WOV' ACPI entries required to automatically route the internal
digital microphone array.

Add the 0x62 revision to the PCI validation switch block, and introduce
a DMI quirk table to manually force the PDM configuration flag for this
specific board, allowing the acp63-dmic-capture node to map correctly.

Signed-off-by: Sidharth Sharma <wednisegit@gmail.com>
---
 sound/soc/amd/ps/pci-ps.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/sound/soc/amd/ps/pci-ps.c b/sound/soc/amd/ps/pci-ps.c
index 9751cf078..b9758a7b5 100644
--- a/sound/soc/amd/ps/pci-ps.c
+++ b/sound/soc/amd/ps/pci-ps.c
@@ -17,10 +17,24 @@
 #include <linux/pm_runtime.h>
 #include <linux/iopoll.h>
 #include <linux/soundwire/sdw_amd.h>
+#include <linux/dmi.h>
 #include "../mach-config.h"
 
 #include "acp63.h"
 
+#define ACP62_PCI_REV 0x62
+
+static const struct dmi_system_id acp63_dmic_quirk_table[] = {
+	{
+		.ident = "MSI Crosshair A16 HX",
+		.matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "Micro-Star International Co., Ltd."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Crosshair A16 HX D8WFKG"),
+		}
+	},
+	{}
+};
+
 static void handle_acp70_sdw_wake_event(struct acp63_dev_data *adata)
 {
 	struct amd_sdw_manager *amd_manager;
@@ -436,6 +450,12 @@ static int get_acp63_device_config(struct pci_dev *pci, struct acp63_dev_data *a
 	if (dmic_en && wov_en)
 		is_dmic_dev = true;
 
+	/* fallback for msi firmware lacking standard acpi audio routing flags */
+	if (dmi_check_system(acp63_dmic_quirk_table)) {
+		is_dmic_dev = true;
+		acp_data->is_pdm_config = true;
+	}
+
 	if (acp_data->is_sdw_config) {
 		ret = acp_scan_sdw_devices(&pci->dev, ACP63_SDW_ADDR);
 		if (!ret && acp_data->info.link_mask)
@@ -587,6 +607,7 @@ static int snd_acp63_probe(struct pci_dev *pci,
 
 	/* ACP PCI revision id check for ACP6.3, ACP7.0 & ACP7.1 platforms */
 	switch (pci->revision) {
+	case ACP62_PCI_REV:
 	case ACP63_PCI_REV:
 	case ACP70_PCI_REV:
 	case ACP71_PCI_REV:
-- 
2.53.0