Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Corey Smith <corsmith@gmail.com>
To: corsmith@gmail.com, Vijendar.Mukunda@amd.com,
	venkataprasad.potturu@amd.com
Cc: linux-sound@vger.kernel.org
Subject: [PATCH 7/11] ASoC: amd: ps: probe the ACP6x SoundWire stack
Date: Tue, 27 Oct 2026 22:05:48 -0400	[thread overview]
Message-ID: <20261028020552.35278-8-corsmith@gmail.com> (raw)
In-Reply-To: <20261028020552.35278-1-corsmith@gmail.com>

Accept the ACP6x PCI revisions in the Pink Sardine PCI driver when the
FLAG_AMD_LEGACY_SDW quirk selected it and wire up the ACP6x specific
pieces:

 - reuse the ACP6.3 hardware ops (power/reset, DMA IRQ);
 - use the ACP6x register range for the platform resources;
 - select snd_soc_acpi_amd_rmb_sdw_machines as the machine table;
 - probe the SoundWire controller at ACP6X_SDW_ADDR (_ADR 0x02).

Rembrandt firmware does not advertise the integrated PDM (DMIC)
controller through "acp-audio-device-type", so enable the PDM path
unconditionally for ACP6x, matching the legacy snd_pci_acp6x driver.

Assisted-by: LLM
Signed-off-by: Corey Smith <corsmith@gmail.com>
---
 sound/soc/amd/ps/pci-ps.c | 85 ++++++++++++++++++++++++++++++---------
 1 file changed, 66 insertions(+), 19 deletions(-)

diff --git a/sound/soc/amd/ps/pci-ps.c b/sound/soc/amd/ps/pci-ps.c
index 729f9aa..a8032b5 100644
--- a/sound/soc/amd/ps/pci-ps.c
+++ b/sound/soc/amd/ps/pci-ps.c
@@ -418,27 +418,54 @@ static int get_acp63_device_config(struct pci_dev *pci, struct acp63_dev_data *a
 
 	acp_hw_get_config(pci, acp_data);
 
+	if (acp_data->acp_rev == ACP6X_PCI_REV || acp_data->acp_rev == ACP6XR_PCI_REV) {
+		/*
+		 * Rembrandt firmware does not describe the integrated PDM
+		 * (DMIC) controller through "acp-audio-device-type" and uses
+		 * the legacy "mipi-sdw-master-list" property name.  Boards
+		 * reaching this driver were routed here because they expose
+		 * the ACP SoundWire controller, and the PDM controller is
+		 * always present, so enable both.
+		 */
+		acp_data->is_pdm_config = true;
+		acp_data->is_sdw_config = true;
+	}
+
 	if (acp_data->is_pdm_config) {
-		pdm_dev = acpi_find_child_device(ACPI_COMPANION(&pci->dev), ACP63_DMIC_ADDR, 0);
-		if (pdm_dev) {
-			/* is_dmic_dev flag will be set when ACP PDM controller device exists */
-			if (!acpi_dev_get_property(pdm_dev, "acp-audio-device-type",
-						   ACPI_TYPE_INTEGER, &obj) &&
-						   obj->integer.value == ACP_DMIC_DEV)
-				dmic_en = true;
-		}
+		if (acp_data->acp_rev == ACP6X_PCI_REV ||
+		    acp_data->acp_rev == ACP6XR_PCI_REV) {
+			/*
+			 * ACP6x always integrates the PDM controller and its
+			 * firmware does not gate it behind _WOV.
+			 */
+			dmic_en = true;
+		} else {
+			pdm_dev = acpi_find_child_device(ACPI_COMPANION(&pci->dev),
+							 ACP63_DMIC_ADDR, 0);
+			if (pdm_dev) {
+				/* is_dmic_dev flag will be set when ACP PDM controller device exists */
+				if (!acpi_dev_get_property(pdm_dev, "acp-audio-device-type",
+							   ACPI_TYPE_INTEGER, &obj) &&
+							   obj->integer.value == ACP_DMIC_DEV)
+					dmic_en = true;
+			}
 
-		handle = ACPI_HANDLE(&pci->dev);
-		ret = acpi_evaluate_integer(handle, "_WOV", NULL, &dmic_status);
-		if (!ACPI_FAILURE(ret))
-			wov_en = dmic_status;
+			handle = ACPI_HANDLE(&pci->dev);
+			ret = acpi_evaluate_integer(handle, "_WOV", NULL, &dmic_status);
+			if (!ACPI_FAILURE(ret))
+				wov_en = dmic_status;
+		}
 	}
 
 	if (dmic_en && wov_en)
 		is_dmic_dev = true;
 
 	if (acp_data->is_sdw_config) {
-		ret = acp_scan_sdw_devices(&pci->dev, ACP63_SDW_ADDR);
+		if (acp_data->acp_rev == ACP6X_PCI_REV ||
+		    acp_data->acp_rev == ACP6XR_PCI_REV)
+			ret = acp_scan_sdw_devices(&pci->dev, ACP6X_SDW_ADDR);
+		else
+			ret = acp_scan_sdw_devices(&pci->dev, ACP63_SDW_ADDR);
 		if (!ret && acp_data->info.link_mask)
 			is_sdw_dev = true;
 	}
@@ -487,7 +514,7 @@ static int create_acp63_platform_devs(struct pci_dev *pci, struct acp63_dev_data
 		}
 		adata->res->flags = IORESOURCE_MEM;
 		adata->res->start = addr;
-		adata->res->end = addr + (ACP63_REG_END - ACP63_REG_START);
+		adata->res->end = addr + adata->reg_range;
 		memset(&pdevinfo, 0, sizeof(pdevinfo));
 	}
 
@@ -556,6 +583,8 @@ static int acp_hw_init_ops(struct acp63_dev_data *adata, struct pci_dev *pci)
 		return -ENOMEM;
 
 	switch (adata->acp_rev) {
+	case ACP6X_PCI_REV:
+	case ACP6XR_PCI_REV:
 	case ACP63_PCI_REV:
 		acp63_hw_init_ops(adata->hw_ops);
 		break;
@@ -581,20 +610,33 @@ static int snd_acp63_probe(struct pci_dev *pci,
 
 	irqflags = IRQF_SHARED;
 
-	/* Return if acp config flag is defined */
+	/*
+	 * Return if an acp config flag is defined, except for
+	 * FLAG_AMD_LEGACY_SDW which explicitly selects this driver's
+	 * SoundWire stack over the DMIC-only snd_pci_acp6x driver.
+	 */
 	flag = snd_amd_acp_find_config(pci);
-	if (flag)
+	if (flag && flag != FLAG_AMD_LEGACY_SDW)
 		return -ENODEV;
 
-	/* ACP PCI revision id check for ACP6.3, ACP7.0 & ACP7.1 platforms */
+	/* ACP PCI revision id check for ACP6.x, ACP6.3, ACP7.0 & ACP7.1 platforms */
 	switch (pci->revision) {
+	case ACP6X_PCI_REV:
+	case ACP6XR_PCI_REV:
+		/*
+		 * ACP6x (Rembrandt) is handled here only when the DMI quirk
+		 * routed the platform away from the DMIC-only driver.
+		 */
+		if (flag != FLAG_AMD_LEGACY_SDW)
+			return -ENODEV;
+		break;
 	case ACP63_PCI_REV:
 	case ACP70_PCI_REV:
 	case ACP71_PCI_REV:
 	case ACP72_PCI_REV:
 		break;
 	default:
-		dev_dbg(&pci->dev, "acp63/acp70/acp71 pci device not found\n");
+		dev_dbg(&pci->dev, "acp6x/acp63/acp70/acp71 pci device not found\n");
 		return -ENODEV;
 	}
 	if (pci_enable_device(pci)) {
@@ -622,7 +664,10 @@ static int snd_acp63_probe(struct pci_dev *pci,
 		goto release_regions;
 	}
 	adata->addr = addr;
-	adata->reg_range = ACP63_REG_END - ACP63_REG_START;
+	if (pci->revision == ACP6X_PCI_REV || pci->revision == ACP6XR_PCI_REV)
+		adata->reg_range = ACP6X_REG_END - ACP6X_REG_START;
+	else
+		adata->reg_range = ACP63_REG_END - ACP63_REG_START;
 	adata->acp_rev = pci->revision;
 	adata->subsystem_vendor = pci->subsystem_vendor;
 	adata->subsystem_device = pci->subsystem_device;
@@ -657,6 +702,8 @@ static int snd_acp63_probe(struct pci_dev *pci,
 	}
 	if (adata->acp_rev >= ACP70_PCI_REV)
 		adata->machines = snd_soc_acpi_amd_acp70_sdw_machines;
+	else if (adata->acp_rev == ACP6X_PCI_REV || adata->acp_rev == ACP6XR_PCI_REV)
+		adata->machines = snd_soc_acpi_amd_rmb_sdw_machines;
 	else
 		adata->machines = snd_soc_acpi_amd_acp63_sdw_machines;
 

  parent reply	other threads:[~2026-10-28  2:06 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-28  2:05 [PATCH 0/11] ASoC/soundwire: AMD ACP6x (Rembrandt) SoundWire speaker support Corey Smith
2026-10-28  2:05 ` [PATCH 1/11] soundwire: amd: add ACP6x PCI revision ids Corey Smith
2026-10-28  2:05 ` [PATCH 2/11] soundwire: amd: support ACP6x SoundWire managers Corey Smith
2026-10-28  2:05 ` [PATCH 3/11] ASoC: amd: ps: add ACP6x PCI revision ids Corey Smith
2026-10-28  2:15   ` sashiko-bot
2026-10-28  2:05 ` [PATCH 4/11] ASoC: amd: ps: support ACP6x in the SoundWire DMA driver Corey Smith
2026-10-28  2:05 ` [PATCH 5/11] ASoC: amd: acp: add ACP6x (Rembrandt) SoundWire machine table Corey Smith
2026-10-28  2:05 ` [PATCH 6/11] ASoC: amd: acp-config: route HP Dragonfly Pro ONE through the ACP6x SDW stack Corey Smith
2026-10-28  2:05 ` Corey Smith [this message]
2026-10-28  2:20   ` [PATCH 7/11] ASoC: amd: ps: probe the ACP6x SoundWire stack sashiko-bot
2026-10-28  2:05 ` [PATCH 8/11] ASoC: amd: acp: add ACP6x SoundWire quirks and machine support Corey Smith
2026-10-28  2:22   ` sashiko-bot
2026-10-28  2:05 ` [PATCH 9/11] soundwire: amd: accept the legacy mipi-sdw-master-list property Corey Smith
2026-10-28  2:05 ` [PATCH 10/11] ASoC: amd: ps: harden the ACP interrupt path for ACP6x Corey Smith
2026-10-28  2:21   ` sashiko-bot
2026-10-28  2:05 ` [PATCH 11/11] soundwire: amd: provide defaults for the bus clock properties Corey Smith
2026-10-29  6:58 ` [PATCH 0/11] ASoC/soundwire: AMD ACP6x (Rembrandt) SoundWire speaker support Mukunda,Vijendar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261028020552.35278-8-corsmith@gmail.com \
    --to=corsmith@gmail.com \
    --cc=Vijendar.Mukunda@amd.com \
    --cc=linux-sound@vger.kernel.org \
    --cc=venkataprasad.potturu@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox