Skip to contentSkip to conversation

ASoC: SOF: amd: add soundwire IO support for ACP7.0 & ACP7.1 platforms

PATCH In review Vijendar Mukunda 2 participants 11 messages May 2, 2025 – May 5, 2025

Subsystems (3)
lore
Share & tools
lore

Vijendar Mukunda

author reviewer
#0 lore raw

cover ASoC: SOF: amd: add soundwire IO support for ACP7.0 & ACP7.1 platforms

This patch series contains
- ACP sof stack improvements
- Add support for ACP7.1 platform.
- Soundwire IO support for ACP7.0 & ACP7.1 platforms

Vijendar Mukunda (9):
ASoC: SOF: amd: remove else condition in resume sequence
ASoC: SOF: amd: add missing acp descriptor field
ASoC: SOF: amd: add ACP7.1 platform support
ASoC: SOF: amd: update soundwire specific acp descriptor fields
ASoC: SOF: amd: enable ACP_PME_EN register for ACP7.0 & ACP7.1
platforms
ASoC: SOF: amd: refactor acp reset sequence
ASoC: SOF: amd: enable soundwire host wake irq mask
ASoC: SOF: amd: add soundwire wake irq handling
ASoC: SOF: amd: add build support for soundwire

 sound/soc/sof/amd/Kconfig          |   7 +-
 sound/soc/sof/amd/acp-dsp-offset.h |  10 +++
 sound/soc/sof/amd/acp.c            | 133 +++++++++++++++++++++++++----
 sound/soc/sof/amd/acp.h            |   7 ++
 sound/soc/sof/amd/pci-acp70.c      |  10 ++-
 5 files changed, 148 insertions(+), 19 deletions(-)
Signature · 1 line
2.45.2
author reviewer
#1 lore raw

PATCH 1/9 ASoC: SOF: amd: remove else condition in resume sequence

Else condition is not required after break/return statement. Remove else condition in resume callback.

---
 sound/soc/sof/amd/acp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/sof/amd/acp.c +2 -2
index 7c6d647fa253..30c03a221513 100644
@@ -637,9 +637,9 @@ int amd_sof_acp_resume(struct snd_sof_dev *sdev)
 			return ret;
 		}
 		return acp_memory_init(sdev);
-	} else {
-		return acp_dsp_reset(sdev);
 	}
+
+	return acp_dsp_reset(sdev);
 }
 EXPORT_SYMBOL_NS(amd_sof_acp_resume, "SND_SOC_SOF_AMD_COMMON");
 
Signature · 1 line
2.45.2
author reviewer
#2 lore raw

PATCH 2/9 ASoC: SOF: amd: add missing acp descriptor field

In reply to Vijendar Mukunda

Add missing acp descriptor field acp_error_stat for ACP7.0 platform.

Fixes 490be7ba2a01 ("ASoC: SOF: amd: add support for acp7.0 based platform")
---
 sound/soc/sof/amd/pci-acp70.c | 1 +
 1 file changed, 1 insertion(+)
sound/soc/sof/amd/pci-acp70.c +1 -0
index 8fa1170a2161..9108f1139ff2 100644
@@ -33,6 +33,7 @@ static const struct sof_amd_acp_desc acp70_chip_info = {
 	.ext_intr_cntl = ACP70_EXTERNAL_INTR_CNTL,
 	.ext_intr_stat	= ACP70_EXT_INTR_STAT,
 	.ext_intr_stat1	= ACP70_EXT_INTR_STAT1,
+	.acp_error_stat = ACP70_ERROR_STATUS,
 	.dsp_intr_base	= ACP70_DSP_SW_INTR_BASE,
 	.acp_sw0_i2s_err_reason = ACP7X_SW0_I2S_ERROR_REASON,
 	.sram_pte_offset = ACP70_SRAM_PTE_OFFSET,
Signature · 1 line
2.45.2
author reviewer
#3 lore raw

PATCH 3/9 ASoC: SOF: amd: add ACP7.1 platform support

In reply to Vijendar Mukunda

Add SOF support for ACP7.1 platform.

---
 sound/soc/sof/amd/Kconfig     |  6 +++---
 sound/soc/sof/amd/acp.c       | 10 +++++++++-
 sound/soc/sof/amd/acp.h       |  1 +
 sound/soc/sof/amd/pci-acp70.c |  7 ++++++-
 4 files changed, 19 insertions(+), 5 deletions(-)
sound/soc/sof/amd/Kconfig +3 -3
index 3ea82fa72e35..984132f32a21 100644
@@ -94,13 +94,13 @@ config SND_SOC_SOF_AMD_ACP63
 	  If unsure select "N".
 
 config SND_SOC_SOF_AMD_ACP70
-	tristate "SOF support for ACP7.0 platform"
+	tristate "SOF support for ACP7.0/ACP7.1 platforms"
 	depends on SND_SOC_SOF_PCI
 	depends on AMD_NODE
 	select SND_SOC_SOF_AMD_COMMON
 	help
 	  Select this option for SOF support on
-	  AMD ACP7.0 version based platforms.
-	  Say Y if you want to enable SOF on ACP7.0 based platform.
+	  AMD ACP7.0/ACP7.1 version based platforms.
+	  Say Y if you want to enable SOF on ACP7.0/ACP7.1 based platforms.
 
 endif
sound/soc/sof/amd/acp.c +9 -1
index 30c03a221513..ead31aee5e6f 100644
@@ -58,6 +58,7 @@ static void init_dma_descriptor(struct acp_dev_data *adata)
 
 	switch (acp_data->pci_rev) {
 	case ACP70_PCI_ID:
+	case ACP71_PCI_ID:
 		acp_dma_desc_base_addr = ACP70_DMA_DESC_BASE_ADDR;
 		acp_dma_desc_max_num_dscr = ACP70_DMA_DESC_MAX_NUM_DSCR;
 		break;
@@ -97,6 +98,7 @@ static int config_dma_channel(struct acp_dev_data *adata, unsigned int ch,
 
 	switch (acp_data->pci_rev) {
 	case ACP70_PCI_ID:
+	case ACP71_PCI_ID:
 		acp_dma_cntl_0 = ACP70_DMA_CNTL_0;
 		acp_dma_ch_rst_sts = ACP70_DMA_CH_RST_STS;
 		acp_dma_dscr_err_sts_0 = ACP70_DMA_ERR_STS_0;
@@ -336,6 +338,7 @@ int acp_dma_status(struct acp_dev_data *adata, unsigned char ch)
 
 	switch (adata->pci_rev) {
 	case ACP70_PCI_ID:
+	case ACP71_PCI_ID:
 		acp_dma_ch_sts = ACP70_DMA_CH_STS;
 		break;
 	default:
@@ -486,6 +489,7 @@ static int acp_power_on(struct snd_sof_dev *sdev)
 		acp_pgfsm_cntl_mask = ACP6X_PGFSM_CNTL_POWER_ON_MASK;
 		break;
 	case ACP70_PCI_ID:
+	case ACP71_PCI_ID:
 		acp_pgfsm_status_mask = ACP70_PGFSM_STATUS_MASK;
 		acp_pgfsm_cntl_mask = ACP70_PGFSM_CNTL_POWER_ON_MASK;
 		break;
@@ -616,8 +620,12 @@ int amd_sof_acp_suspend(struct snd_sof_dev *sdev, u32 target_state)
 		dev_err(sdev->dev, "ACP Reset failed\n");
 		return ret;
 	}
-	if (acp_data->pci_rev == ACP70_PCI_ID)
+	switch (acp_data->pci_rev) {
+	case ACP70_PCI_ID:
+	case ACP71_PCI_ID:
 		enable = true;
+		break;
+	}
 	snd_sof_dsp_write(sdev, ACP_DSP_BAR, ACP_CONTROL, enable);
 
 	return 0;
sound/soc/sof/amd/acp.h +1 -0
index d084db34eed8..86acd43f707e 100644
@@ -74,6 +74,7 @@
 #define ACP_RMB_PCI_ID				0x6F
 #define ACP63_PCI_ID				0x63
 #define ACP70_PCI_ID				0x70
+#define ACP71_PCI_ID				0x71
 
 #define HOST_BRIDGE_CZN				0x1630
 #define HOST_BRIDGE_VGH				0x1645
sound/soc/sof/amd/pci-acp70.c +6 -1
index 9108f1139ff2..8816c323d69e 100644
@@ -71,8 +71,13 @@ static int acp70_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_
 {
 	unsigned int flag;
 
-	if (pci->revision != ACP70_PCI_ID)
+	switch (pci->revision) {
+	case ACP70_PCI_ID:
+	case ACP71_PCI_ID:
+			break;
+	default:
 		return -ENODEV;
+	}
 
 	flag = snd_amd_acp_find_config(pci);
 	if (flag != FLAG_AMD_SOF && flag != FLAG_AMD_SOF_ONLY_DMIC)
Signature · 1 line
2.45.2
author reviewer
#4 lore raw

PATCH 4/9 ASoC: SOF: amd: update soundwire specific acp descriptor fields

In reply to Vijendar Mukunda

Update SoundWire specific acp descriptor structure fields for ACP7.0 & ACP7.1 platforms.

---
 sound/soc/sof/amd/acp.h       | 2 ++
 sound/soc/sof/amd/pci-acp70.c | 2 ++
 2 files changed, 4 insertions(+)
sound/soc/sof/amd/acp.h +2 -0
index 86acd43f707e..097454f2b48b 100644
@@ -110,9 +110,11 @@
 #define ACP_SDW0_IRQ_MASK			BIT(21)
 #define ACP_SDW1_IRQ_MASK			BIT(2)
 #define SDW_ACPI_ADDR_ACP63			5
+#define SDW_ACPI_ADDR_ACP70			SDW_ACPI_ADDR_ACP63
 #define ACP_DEFAULT_SRAM_LENGTH			0x00080000
 #define ACP_SRAM_PAGE_COUNT			128
 #define ACP6X_SDW_MAX_MANAGER_COUNT		2
+#define ACP70_SDW_MAX_MANAGER_COUNT		ACP6X_SDW_MAX_MANAGER_COUNT
 
 enum clock_source {
 	ACP_CLOCK_96M = 0,
sound/soc/sof/amd/pci-acp70.c +2 -0
index 8816c323d69e..c4db21668252 100644
@@ -40,6 +40,8 @@ static const struct sof_amd_acp_desc acp70_chip_info = {
 	.hw_semaphore_offset = ACP70_AXI2DAGB_SEM_0,
 	.fusion_dsp_offset = ACP70_DSP_FUSION_RUNSTALL,
 	.probe_reg_offset = ACP70_FUTURE_REG_ACLK_0,
+	.sdw_max_link_count = ACP70_SDW_MAX_MANAGER_COUNT,
+	.sdw_acpi_dev_addr = SDW_ACPI_ADDR_ACP70,
 	.reg_start_addr = ACP70_REG_START,
 	.reg_end_addr = ACP70_REG_END,
 };
Signature · 1 line
2.45.2
author reviewer
#5 lore raw

PATCH 5/9 ASoC: SOF: amd: enable ACP_PME_EN register for ACP7.0 & ACP7.1 platforms

In reply to Vijendar Mukunda

As per design flow for ACP7.0 & ACP7.1 platforms, enable ACP_PME_EN register for below scenarios.
1. During acp init sequence
2. During resume sequence for SoundWire ClockStop power mode.

---
 sound/soc/sof/amd/acp-dsp-offset.h |  1 +
 sound/soc/sof/amd/acp.c            | 19 ++++++++++++++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)
sound/soc/sof/amd/acp-dsp-offset.h +1 -0
index ecdcae07ace7..414151187b44 100644
@@ -130,4 +130,5 @@
 
 #define ACP_SW0_EN				0x3000
 #define ACP_SW1_EN				0x3C00
+#define ACP70_PME_EN				0x1400
 #endif
sound/soc/sof/amd/acp.c +18 -1
index ead31aee5e6f..615ed7ff3846 100644
@@ -570,9 +570,11 @@ static int acp_dsp_reset(struct snd_sof_dev *sdev)
 
 static int acp_init(struct snd_sof_dev *sdev)
 {
+	struct acp_dev_data *acp_data;
 	int ret;
 
 	/* power on */
+	acp_data = sdev->pdata->hw_pdata;
 	ret = acp_power_on(sdev);
 	if (ret) {
 		dev_err(sdev->dev, "ACP power on failed\n");
@@ -581,7 +583,16 @@ static int acp_init(struct snd_sof_dev *sdev)
 
 	snd_sof_dsp_write(sdev, ACP_DSP_BAR, ACP_CONTROL, 0x01);
 	/* Reset */
-	return acp_reset(sdev);
+	ret = acp_reset(sdev);
+	if (ret)
+		return ret;
+	switch (acp_data->pci_rev) {
+	case ACP70_PCI_ID:
+	case ACP71_PCI_ID:
+		snd_sof_dsp_write(sdev, ACP_DSP_BAR, ACP70_PME_EN, 1);
+		break;
+	}
+	return 0;
 }
 
 static bool check_acp_sdw_enable_status(struct snd_sof_dev *sdev)
@@ -646,6 +657,12 @@ int amd_sof_acp_resume(struct snd_sof_dev *sdev)
 		}
 		return acp_memory_init(sdev);
 	}
+	switch (acp_data->pci_rev) {
+	case ACP70_PCI_ID:
+	case ACP71_PCI_ID:
+		snd_sof_dsp_write(sdev, ACP_DSP_BAR, ACP70_PME_EN, 1);
+		break;
+	}
 
 	return acp_dsp_reset(sdev);
 }
Signature · 1 line
2.45.2
author reviewer
#6 lore raw

PATCH 6/9 ASoC: SOF: amd: refactor acp reset sequence

In reply to Vijendar Mukunda

Below mentioned register sequence should be part of acp init sequence.
1) Set ACP clock mux selection register to ACP_ACLK clock source.
2) Enable ACP global interrupt enable register
3) Enable ACP error interrupt mask.
ACP reset sequence should contain code related to asserting acp soft reset and release the soft reset.
Move the rest of the registers programming to acp init sequence.

---
 sound/soc/sof/amd/acp.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)
sound/soc/sof/amd/acp.c +11 -9
index 615ed7ff3846..2ad5fbf43c8a 100644
@@ -511,7 +511,6 @@ static int acp_power_on(struct snd_sof_dev *sdev)
 
 static int acp_reset(struct snd_sof_dev *sdev)
 {
-	const struct sof_amd_acp_desc *desc = get_chip_info(sdev->pdata);
 	unsigned int val;
 	int ret;
 
@@ -532,14 +531,6 @@ static int acp_reset(struct snd_sof_dev *sdev)
 	if (ret < 0)
 		dev_err(sdev->dev, "timeout in releasing reset\n");
 
-	if (desc->acp_clkmux_sel)
-		snd_sof_dsp_write(sdev, ACP_DSP_BAR, desc->acp_clkmux_sel, ACP_CLOCK_ACLK);
-
-	if (desc->ext_intr_enb)
-		snd_sof_dsp_write(sdev, ACP_DSP_BAR, desc->ext_intr_enb, 0x01);
-
-	if (desc->ext_intr_cntl)
-		snd_sof_dsp_write(sdev, ACP_DSP_BAR, desc->ext_intr_cntl, ACP_ERROR_IRQ_MASK);
 	return ret;
 }
 
@@ -570,6 +561,7 @@ static int acp_dsp_reset(struct snd_sof_dev *sdev)
 
 static int acp_init(struct snd_sof_dev *sdev)
 {
+	const struct sof_amd_acp_desc *desc = get_chip_info(sdev->pdata);
 	struct acp_dev_data *acp_data;
 	int ret;
 
@@ -586,6 +578,16 @@ static int acp_init(struct snd_sof_dev *sdev)
 	ret = acp_reset(sdev);
 	if (ret)
 		return ret;
+
+	if (desc->acp_clkmux_sel)
+		snd_sof_dsp_write(sdev, ACP_DSP_BAR, desc->acp_clkmux_sel, ACP_CLOCK_ACLK);
+
+	if (desc->ext_intr_enb)
+		snd_sof_dsp_write(sdev, ACP_DSP_BAR, desc->ext_intr_enb, 0x01);
+
+	if (desc->ext_intr_cntl)
+		snd_sof_dsp_write(sdev, ACP_DSP_BAR, desc->ext_intr_cntl, ACP_ERROR_IRQ_MASK);
+
 	switch (acp_data->pci_rev) {
 	case ACP70_PCI_ID:
 	case ACP71_PCI_ID:
Signature · 1 line
2.45.2
author reviewer
#7 lore raw

PATCH 7/9 ASoC: SOF: amd: enable soundwire host wake irq mask

In reply to Vijendar Mukunda

Enable SoundWire host wake interrupt mask during acp init sequence based on wake enable checks for each SoundWire manager instance for ACP7.0 & ACP7.1 platforms.

---
 sound/soc/sof/amd/acp-dsp-offset.h | 5 +++++
 sound/soc/sof/amd/acp.c            | 7 +++++++
 2 files changed, 12 insertions(+)
sound/soc/sof/amd/acp-dsp-offset.h +5 -0
index 414151187b44..e77554f74c20 100644
@@ -131,4 +131,9 @@
 #define ACP_SW0_EN				0x3000
 #define ACP_SW1_EN				0x3C00
 #define ACP70_PME_EN				0x1400
+#define ACP70_EXTERNAL_INTR_CNTL1		0x1A08
+#define ACP70_SW0_WAKE_EN			0x1458
+#define ACP70_SW1_WAKE_EN			0x1460
+#define ACP70_SDW_HOST_WAKE_MASK		0x0C00000
+
 #endif
sound/soc/sof/amd/acp.c +7 -0
index 2ad5fbf43c8a..d62ba4f75e4f 100644
@@ -563,6 +563,7 @@ static int acp_init(struct snd_sof_dev *sdev)
 {
 	const struct sof_amd_acp_desc *desc = get_chip_info(sdev->pdata);
 	struct acp_dev_data *acp_data;
+	unsigned int sdw0_wake_en, sdw1_wake_en;
 	int ret;
 
 	/* power on */
@@ -591,6 +592,12 @@ static int acp_init(struct snd_sof_dev *sdev)
 	switch (acp_data->pci_rev) {
 	case ACP70_PCI_ID:
 	case ACP71_PCI_ID:
+		sdw0_wake_en = snd_sof_dsp_read(sdev, ACP_DSP_BAR, ACP70_SW0_WAKE_EN);
+		sdw1_wake_en = snd_sof_dsp_read(sdev, ACP_DSP_BAR, ACP70_SW1_WAKE_EN);
+		if (sdw0_wake_en || sdw1_wake_en)
+			snd_sof_dsp_update_bits(sdev, ACP_DSP_BAR, ACP70_EXTERNAL_INTR_CNTL1,
+						ACP70_SDW_HOST_WAKE_MASK, ACP70_SDW_HOST_WAKE_MASK);
+
 		snd_sof_dsp_write(sdev, ACP_DSP_BAR, ACP70_PME_EN, 1);
 		break;
 	}
Signature · 1 line
2.45.2
author reviewer
#8 lore raw

PATCH 8/9 ASoC: SOF: amd: add soundwire wake irq handling

In reply to Vijendar Mukunda

Add SoundWire wake interrupt handling for ACP7.0 & ACP7.1 platforms.

---
 sound/soc/sof/amd/acp-dsp-offset.h |  4 ++
 sound/soc/sof/amd/acp.c            | 73 +++++++++++++++++++++++++++++-
 sound/soc/sof/amd/acp.h            |  4 ++
 3 files changed, 79 insertions(+), 2 deletions(-)
sound/soc/sof/amd/acp-dsp-offset.h +4 -0
index e77554f74c20..08583a91afbc 100644
@@ -135,5 +135,9 @@
 #define ACP70_SW0_WAKE_EN			0x1458
 #define ACP70_SW1_WAKE_EN			0x1460
 #define ACP70_SDW_HOST_WAKE_MASK		0x0C00000
+#define ACP70_SDW0_HOST_WAKE_STAT		BIT(24)
+#define ACP70_SDW1_HOST_WAKE_STAT		BIT(25)
+#define ACP70_SDW0_PME_STAT			BIT(26)
+#define ACP70_SDW1_PME_STAT			BIT(27)
 
 #endif
sound/soc/sof/amd/acp.c +71 -2

92 lines not on this page · raw message

sound/soc/sof/amd/acp.h +4 -0
index 097454f2b48b..d3c5b2386cdf 100644
@@ -263,6 +263,10 @@ struct acp_dev_data {
 	bool is_dram_in_use;
 	bool is_sram_in_use;
 	bool sdw_en_stat;
+	/* acp70_sdw0_wake_event flag set to true when wake irq asserted for SW0 instance */
+	bool acp70_sdw0_wake_event;
+	/* acp70_sdw1_wake_event flag set to true when wake irq asserted for SW1 instance */
+	bool acp70_sdw1_wake_event;
 	unsigned int pci_rev;
 };
 
Signature · 1 line
2.45.2
author reviewer
#9 lore raw

PATCH 9/9 ASoC: SOF: amd: add build support for soundwire

In reply to Vijendar Mukunda

Add build support for SoundWire for ACP7.0/ACP7.1 platforms.

---
 sound/soc/sof/amd/Kconfig | 1 +
 1 file changed, 1 insertion(+)
sound/soc/sof/amd/Kconfig +1 -0
index 984132f32a21..05faf1c6d6fc 100644
@@ -98,6 +98,7 @@ config SND_SOC_SOF_AMD_ACP70
 	depends on SND_SOC_SOF_PCI
 	depends on AMD_NODE
 	select SND_SOC_SOF_AMD_COMMON
+	select SND_SOC_SOF_AMD_SOUNDWIRE_LINK_BASELINE
 	help
 	  Select this option for SOF support on
 	  AMD ACP7.0/ACP7.1 version based platforms.
Signature · 1 line
2.45.2
maintainer
#10 lore raw
In reply to Vijendar Mukunda
Quoted 10 lines · Vijendar Mukunda

This patch series contains
- ACP sof stack improvements
- Add support for ACP7.1 platform.
- Soundwire IO support for ACP7.0 & ACP7.1 platforms

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/9] ASoC: SOF: amd: remove else condition in resume sequence

      commit: e46da64f333ede33adc3a1903821a73ed6c018a6
[2/9] ASoC: SOF: amd: add missing acp descriptor field
      commit: 7c2bad7b95db5b4b978853cd4dd042ae3ec83e63
[3/9] ASoC: SOF: amd: add ACP7.1 platform support
      commit: 451bd0e7b91c83f817b741557c9be0f133d3836d
[4/9] ASoC: SOF: amd: update soundwire specific acp descriptor fields
      commit: 8cc69ecbf195aaf90e8bd5f364ed10ec0bdecb5f
[5/9] ASoC: SOF: amd: enable ACP_PME_EN register for ACP7.0 & ACP7.1 platforms
      commit: cc489cced17b2e32170ee87a3b64aaa3c7c6fddb
[6/9] ASoC: SOF: amd: refactor acp reset sequence
      commit: 169c5e444bb9cd4ae770f54157a04fdd8569508a
[7/9] ASoC: SOF: amd: enable soundwire host wake irq mask
      commit: a536f3c51edb63900b3340978d38da3aabc1fb2f
[8/9] ASoC: SOF: amd: add soundwire wake irq handling
      commit: 1f41bf67bfe3721a4d4d36695302801cf70b5a70
[9/9] ASoC: SOF: amd: add build support for soundwire
      commit: e68074c63fded9468c513f65734ffb4c80dc2a6d

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark