mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
To: <broonie@kernel.org>
Cc: <alsa-devel@alsa-project.org>, <lgirdwood@gmail.com>,
	<perex@perex.cz>, <tiwai@suse.com>,
	<pierre-louis.bossart@linux.dev>,
	<yung-chuan.liao@linux.intel.com>, <Basavaraj.Hiregoudar@amd.com>,
	<Sunil-kumar.Dommati@amd.com>, <venkataprasad.potturu@amd.com>,
	<Syed.SabaKareem@amd.com>, <Mario.Limonciello@amd.com>,
	<Richard.Gong@amd.com>, <Vijendar.Mukunda@amd.com>,
	<Poojitha.N@amd.com>, <linux-sound@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	<sound-open-firmware@alsa-project.org>
Subject: [PATCH v4 05/16] ASoC: amd: acp: add ACP7.B/7.F SoundWire DAI link support
Date: Fri, 30 Oct 2026 15:15:20 +0530	[thread overview]
Message-ID: <20261030094714.1123396-6-Vijendar.Mukunda@amd.com> (raw)
In-Reply-To: <20261030094714.1123396-1-Vijendar.Mukunda@amd.com>

Add CPU pin ID lookup and SoundWire DAI link support for ACP7.B/7.F
platforms with up to 4 SoundWire managers.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
---
 sound/soc/amd/acp/acp-sdw-mach-common.c | 48 +++++++++++++++++++++++++
 sound/soc/amd/acp/acp-sdw-sof-mach.c    |  7 ++++
 sound/soc/amd/acp/soc_amd_sdw_common.h  | 38 ++++++++++++++++++++
 3 files changed, 93 insertions(+)

diff --git a/sound/soc/amd/acp/acp-sdw-mach-common.c b/sound/soc/amd/acp/acp-sdw-mach-common.c
index e5f394dc2f4c..40184674dc80 100644
--- a/sound/soc/amd/acp/acp-sdw-mach-common.c
+++ b/sound/soc/amd/acp/acp-sdw-mach-common.c
@@ -93,6 +93,54 @@ int get_acp70_cpu_pin_id(u32 sdw_link_id, int be_id, int *cpu_pin_id, struct dev
 }
 EXPORT_SYMBOL_NS_GPL(get_acp70_cpu_pin_id, "SND_SOC_AMD_SDW_MACH");
 
+/*
+ * On ACP7x, each SoundWire data port has a dedicated DMA channel
+ * hardwired in hardware. This function selects only the ports required
+ * by the currently supported ACP7x machine topologies:
+ *   AUDIO0_TX (0)  - headset/jack playback
+ *   AUDIO4_TX (4)  - amplifier/speaker playback
+ *   AUDIO0_RX (11) - headset/jack capture
+ *   AUDIO4_RX (15) - amplifier/speaker capture (feedback)
+ *   AUDIO5_RX (16) - DMIC capture
+ * The remaining port IDs are defined to reflect the full hardware
+ * data port layout.
+ */
+int get_acp7x_cpu_pin_id(u32 sdw_link_id, int be_id, int *cpu_pin_id, struct device *dev)
+{
+	switch (sdw_link_id) {
+	case AMD_SDW0:
+	case AMD_SDW1:
+	case AMD_SDW2:
+	case AMD_SDW3:
+		switch (be_id) {
+		case SOC_SDW_JACK_OUT_DAI_ID:
+			*cpu_pin_id = ACP7X_SW_AUDIO0_TX;
+			break;
+		case SOC_SDW_JACK_IN_DAI_ID:
+			*cpu_pin_id = ACP7X_SW_AUDIO0_RX;
+			break;
+		case SOC_SDW_AMP_OUT_DAI_ID:
+			*cpu_pin_id = ACP7X_SW_AUDIO4_TX;
+			break;
+		case SOC_SDW_AMP_IN_DAI_ID:
+			*cpu_pin_id = ACP7X_SW_AUDIO4_RX;
+			break;
+		case SOC_SDW_DMIC_DAI_ID:
+			*cpu_pin_id = ACP7X_SW_AUDIO5_RX;
+			break;
+		default:
+			dev_err(dev, "Invalid be id:%d\n", be_id);
+			return -EINVAL;
+		}
+		break;
+	default:
+		return -EINVAL;
+	}
+	dev_dbg(dev, "sdw_link_id:%d, be_id:%d, cpu_pin_id:%d\n", sdw_link_id, be_id, *cpu_pin_id);
+	return 0;
+}
+EXPORT_SYMBOL_NS_GPL(get_acp7x_cpu_pin_id, "SND_SOC_AMD_SDW_MACH");
+
 MODULE_DESCRIPTION("AMD SoundWire Common Machine driver");
 MODULE_AUTHOR("Vijendar Mukunda <Vijendar.Mukunda@amd.com>");
 MODULE_LICENSE("GPL");
diff --git a/sound/soc/amd/acp/acp-sdw-sof-mach.c b/sound/soc/amd/acp/acp-sdw-sof-mach.c
index 46c3815a777f..97b2e224492f 100644
--- a/sound/soc/amd/acp/acp-sdw-sof-mach.c
+++ b/sound/soc/amd/acp/acp-sdw-sof-mach.c
@@ -145,6 +145,13 @@ static int create_sdw_dailink(struct snd_soc_card *card,
 			if (ret)
 				return ret;
 			break;
+		case ACP7B_PCI_REV:
+		case ACP7F_PCI_REV:
+			ret = get_acp7x_cpu_pin_id(ffs(sof_end->link_mask) - 1,
+						   *be_id, &cpu_pin_id, dev);
+			if (ret)
+				return ret;
+			break;
 		default:
 			return -EINVAL;
 		}
diff --git a/sound/soc/amd/acp/soc_amd_sdw_common.h b/sound/soc/amd/acp/soc_amd_sdw_common.h
index c98d70a0d6ce..c979adf4e978 100644
--- a/sound/soc/amd/acp/soc_amd_sdw_common.h
+++ b/sound/soc/amd/acp/soc_amd_sdw_common.h
@@ -33,6 +33,8 @@
 
 #define AMD_SDW0	0
 #define AMD_SDW1	1
+#define AMD_SDW2	2
+#define AMD_SDW3	3
 #define ACP63_SW0_AUDIO0_TX	0
 #define ACP63_SW0_AUDIO1_TX	1
 #define ACP63_SW0_AUDIO2_TX	2
@@ -54,6 +56,41 @@
 #define ACP70_SW_AUDIO1_RX	4
 #define ACP70_SW_AUDIO2_RX	5
 
+/*
+ * ACP7.B/7.F SoundWire CPU pin IDs.
+ *
+ * ACP7x hardware exposes 11 TX and 11 RX data ports per SoundWire
+ * instance, each with a dedicated DMA channel hardwired in hardware.
+ * The CPU pin IDs use a flat linear numbering shared across all four
+ * SoundWire links (SW0-SW3): TX ports are numbered 0-10 and RX ports
+ * are numbered 11-21. All port IDs are defined here to represent the
+ * ACP7x hardware data port layout. The ID numbering differs from
+ * ACP70 due to hardware differences between ACP70 and ACP7x.
+ */
+#define ACP7X_SW_AUDIO0_TX	0
+#define ACP7X_SW_AUDIO1_TX	1
+#define ACP7X_SW_AUDIO2_TX	2
+#define ACP7X_SW_AUDIO3_TX	3
+#define ACP7X_SW_AUDIO4_TX	4
+#define ACP7X_SW_AUDIO5_TX	5
+#define ACP7X_SW_AUDIO6_TX	6
+#define ACP7X_SW_AUDIO7_TX	7
+#define ACP7X_SW_AUDIO8_TX	8
+#define ACP7X_SW_AUDIO9_TX	9
+#define ACP7X_SW_AUDIO10_TX	10
+
+#define ACP7X_SW_AUDIO0_RX	11
+#define ACP7X_SW_AUDIO1_RX	12
+#define ACP7X_SW_AUDIO2_RX	13
+#define ACP7X_SW_AUDIO3_RX	14
+#define ACP7X_SW_AUDIO4_RX	15
+#define ACP7X_SW_AUDIO5_RX	16
+#define ACP7X_SW_AUDIO6_RX	17
+#define ACP7X_SW_AUDIO7_RX	18
+#define ACP7X_SW_AUDIO8_RX	19
+#define ACP7X_SW_AUDIO9_RX	20
+#define ACP7X_SW_AUDIO10_RX	21
+
 struct amd_mc_ctx {
 	unsigned int acp_rev;
 	unsigned int max_sdw_links;
@@ -61,5 +98,6 @@ struct amd_mc_ctx {
 
 int get_acp63_cpu_pin_id(u32 sdw_link_id, int be_id, int *cpu_pin_id, struct device *dev);
 int get_acp70_cpu_pin_id(u32 sdw_link_id, int be_id, int *cpu_pin_id, struct device *dev);
+int get_acp7x_cpu_pin_id(u32 sdw_link_id, int be_id, int *cpu_pin_id, struct device *dev);
 
 #endif
-- 
2.53.0


  parent reply	other threads:[~2026-10-30  9:48 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-30  9:45 [PATCH v4 00/16] ASoC: amd: acp: ACP7.B/7.F SoundWire machine driver support Vijendar Mukunda
2026-10-30  9:45 ` [PATCH v4 01/16] ASoC: amd: acp: fix missing cleanup on devm_kasprintf() failure in mc_probe() Vijendar Mukunda
2026-10-30  9:45 ` [PATCH v4 02/16] ASoC: amd: acp: fix missing cleanup on devm_kasprintf() failure in legacy SDW machine driver Vijendar Mukunda
2026-10-30  9:45 ` [PATCH v4 03/16] ASoC: amd: sdw: remove unused ACP63_SDW_MAX_CPU_DAIS define Vijendar Mukunda
2026-10-30  9:45 ` [PATCH v4 04/16] ASoC: amd: acp: add ACP7.B/7.F SoundWire link count for machine driver Vijendar Mukunda
2026-10-30  9:45 ` Vijendar Mukunda [this message]
2026-10-30  9:45 ` [PATCH v4 06/16] ASoC: amd: acp: add PDM controller selection for ACP7.B/7.F SoundWire " Vijendar Mukunda
2026-11-01 18:28   ` Pierre-Louis Bossart
2026-11-02  5:42     ` Mukunda,Vijendar
2026-10-30  9:45 ` [PATCH v4 07/16] ASoC: amd: acp: log ASOC_SDW_ACP_DMIC1 quirk in SOF " Vijendar Mukunda
2026-10-30  9:45 ` [PATCH v4 08/16] ASoC: amd: acp: enable DMIC DAI link based on PDM controller selection Vijendar Mukunda
2026-10-30  9:45 ` [PATCH v4 09/16] ASoC: amd: acp: move ignore_internal_dmic gate to DMIC enable condition Vijendar Mukunda
2026-10-30  9:45 ` [PATCH v4 10/16] ASoC: amd: acp: add DMIC components string for SOF SoundWire machine driver Vijendar Mukunda
2026-10-30  9:45 ` [PATCH v4 11/16] ASoC: amd: acp: set PCI subsystem ID " Vijendar Mukunda
2026-10-30  9:45 ` [PATCH v4 12/16] ASoC: amd: acp: fix MODULE_AUTHOR missing closing angle bracket Vijendar Mukunda
2026-10-30  9:45 ` [PATCH v4 13/16] ASoC: amd: acp: add ACPI machine tables for ACP7.F SoundWire Vijendar Mukunda
2026-11-01 18:24   ` Pierre-Louis Bossart
2026-11-02  5:59     ` Mukunda,Vijendar
2026-10-30  9:45 ` [PATCH v4 14/16] ASoC: SOF: amd: add alt_machines for ACP7.F SOF SoundWire Vijendar Mukunda
2026-10-30  9:45 ` [PATCH v4 15/16] ASoC: amd: acp: add SoundWire machine table for ACP7.B platform Vijendar Mukunda
2026-10-30  9:45 ` [PATCH v4 16/16] ASoC: SOF: amd: register SoundWire alt_machines for ACP7.B Vijendar Mukunda
2026-11-01 18:34 ` [PATCH v4 00/16] ASoC: amd: acp: ACP7.B/7.F SoundWire machine driver support Pierre-Louis Bossart
2026-11-02  6:01   ` 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=20261030094714.1123396-6-Vijendar.Mukunda@amd.com \
    --to=vijendar.mukunda@amd.com \
    --cc=Basavaraj.Hiregoudar@amd.com \
    --cc=Mario.Limonciello@amd.com \
    --cc=Poojitha.N@amd.com \
    --cc=Richard.Gong@amd.com \
    --cc=Sunil-kumar.Dommati@amd.com \
    --cc=Syed.SabaKareem@amd.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=pierre-louis.bossart@linux.dev \
    --cc=sound-open-firmware@alsa-project.org \
    --cc=tiwai@suse.com \
    --cc=venkataprasad.potturu@amd.com \
    --cc=yung-chuan.liao@linux.intel.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

all inboxes | Powered by JetHome®