[PATCH v3 3/5] ASoC: amd: yc: ask the firmware once about the ACP DMIC path

From: MuXian Chen

Date: Thu Dec 03 2026 - 07:15:37 EST


The machine driver used to evaluate _WOV on its own, after the PCI
driver had already initialized the block. Have the PCI driver run the
check once during probe and hand the resulting flag to the machine
device through platform data, following the convention used by the
other ACP platform drivers.

The machine driver now only reads the flag, so _WOV is evaluated once
per boot and the two drivers cannot reach different conclusions.

No functional change.

Signed-off-by: MuXian Chen <a18165943161@xxxxxxxxx>
---
sound/soc/amd/yc/acp6x-mach.c | 5 ++---
sound/soc/amd/yc/acp6x-quirks.c | 1 -
sound/soc/amd/yc/pci-acp6x.c | 10 ++++++++++
3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/sound/soc/amd/yc/acp6x-mach.c b/sound/soc/amd/yc/acp6x-mach.c
index d5dca8b..e8d1ab2 100644
--- a/sound/soc/amd/yc/acp6x-mach.c
+++ b/sound/soc/amd/yc/acp6x-mach.c
@@ -11,7 +11,6 @@
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <linux/io.h>
-#include <linux/pci.h>

#include "acp6x.h"

@@ -46,11 +45,11 @@ static struct snd_soc_card acp6x_card = {

static int acp6x_probe(struct platform_device *pdev)
{
- struct pci_dev *pci = to_pci_dev(pdev->dev.parent);
+ const bool *dmic = pdev->dev.platform_data;
struct snd_soc_card *card = &acp6x_card;
int ret;

- if (!snd_acp6x_platform_has_dmic(pci))
+ if (!dmic || !*dmic)
return -ENODEV;

platform_set_drvdata(pdev, card);
diff --git a/sound/soc/amd/yc/acp6x-quirks.c b/sound/soc/amd/yc/acp6x-quirks.c
index 04c07eb..d6df3b8 100644
--- a/sound/soc/amd/yc/acp6x-quirks.c
+++ b/sound/soc/amd/yc/acp6x-quirks.c
@@ -869,4 +869,3 @@ bool snd_acp6x_platform_has_dmic(struct pci_dev *pci)

return !!dmi_first_match(yc_acp_quirk_table);
}
-EXPORT_SYMBOL_GPL(snd_acp6x_platform_has_dmic);
diff --git a/sound/soc/amd/yc/pci-acp6x.c b/sound/soc/amd/yc/pci-acp6x.c
index a961e38..c987f6c 100644
--- a/sound/soc/amd/yc/pci-acp6x.c
+++ b/sound/soc/amd/yc/pci-acp6x.c
@@ -20,6 +20,7 @@ struct acp6x_dev_data {
void __iomem *acp6x_base;
struct resource *res;
bool acp6x_audio_mode;
+ bool dmic;
struct platform_device *pdev[ACP6x_DEVS];
};

@@ -152,6 +153,7 @@ static int snd_acp6x_probe(struct pci_dev *pci,
int val = 0x00;
u32 addr;
unsigned int irqflags, flag;
+ bool has_dmic;
int ret;

irqflags = IRQF_SHARED;
@@ -171,6 +173,8 @@ static int snd_acp6x_probe(struct pci_dev *pci,
dev_dbg(&pci->dev, "acp6x pci device not found\n");
return -ENODEV;
}
+ has_dmic = snd_acp6x_platform_has_dmic(pci);
+
if (pci_enable_device(pci)) {
dev_err(&pci->dev, "pci_enable_device failed\n");
return -ENODEV;
@@ -195,6 +199,7 @@ static int snd_acp6x_probe(struct pci_dev *pci,
ret = -ENOMEM;
goto release_regions;
}
+ adata->dmic = has_dmic;
pci_set_master(pci);
pci_set_drvdata(pci, adata);
ret = acp6x_init(adata->acp6x_base);
@@ -249,6 +254,11 @@ static int snd_acp6x_probe(struct pci_dev *pci,
pdevinfo[2].name = "acp_yc_mach";
pdevinfo[2].id = 0;
pdevinfo[2].parent = &pci->dev;
+ /* The flag lives as long as the PCI device, which outlives the
+ * platform devices unregistered in ->remove().
+ */
+ pdevinfo[2].data = &adata->dmic;
+ pdevinfo[2].size_data = sizeof(adata->dmic);

for (index = 0; index < ACP6x_DEVS; index++) {
adata->pdev[index] =
--
2.56.1