alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/20] ASoC/soundwire: add support for ACE2.x
@ 2023-03-23  5:44 Bard Liao
  2023-03-23  5:44 ` [PATCH 01/20] ASoC: SOF: Intel: shim: add enum for ACE 2.0 IP used in LunarLake Bard Liao
                   ` (21 more replies)
  0 siblings, 22 replies; 30+ messages in thread
From: Bard Liao @ 2023-03-23  5:44 UTC (permalink / raw)
  To: alsa-devel, vkoul, broonie
  Cc: vinod.koul, linux-kernel, pierre-louis.bossart, bard.liao, tiwai

This series uses the abstraction added in past kernel cycles to provide
support for the ACE2.x integration. The existing SHIM and Cadence
registers are now split in 3 (SHIM, IP, SHIM vendor-specific), with some
parts also moved to the HDaudio Extended Multi link structures. Nothing
fundamentally different except for the register map.

This series only provides the basic mechanisms to expose SoundWire-based
DAIs. The PCI parts and DSP management will be contributed later, and the
DAI ops are now empty as well.

The change is mainly on SoundWire. It would be better to go through
SoundWire tree.

Pierre-Louis Bossart (20):
  ASoC: SOF: Intel: shim: add enum for ACE 2.0 IP used in LunarLake
  soundwire: intel: add ACE2.x SHIM definitions
  soundwire: intel_ace2x: add empty new ops for LunarLake
  soundwire/ASOC: Intel: update offsets for LunarLake
  soundwire: intel/cadence: set ip_offset at run-time
  ASoC/soundwire: intel: pass hdac_bus pointer for link management
  soundwire: intel: add eml_lock in the interface for new platforms
  ASoC: SOF: Intel: hda: retrieve SoundWire eml_lock and pass pointer
  soundwire: intel_init: use eml_lock parameter
  soundwire: intel_ace2x: add debugfs support
  soundwire: intel_ace2x: add link power-up/down helpers
  soundwire: intel_ace2x: set SYNCPRD before powering-up
  soundwire: intel_ace2x: configure link PHY
  soundwire: intel_ace2x: add DAI registration
  soundwire: intel_ace2x: add sync_arm/sync_go helpers
  soundwire: intel_ace2x: use common helpers for bus start/stop
  soundwire: intel_ace2x: enable wake support
  soundwire: intel_ace2x: add check_cmdsync_unlocked helper
  soundwire: bus: add new manager callback to deal with peripheral
    enumeration
  soundwire: intel_ace2x: add new_peripheral_assigned callback

 drivers/soundwire/Makefile              |   3 +-
 drivers/soundwire/bus.c                 |   3 +
 drivers/soundwire/cadence_master.h      |   2 +
 drivers/soundwire/intel.h               |  16 +
 drivers/soundwire/intel_ace2x.c         | 390 ++++++++++++++++++++++++
 drivers/soundwire/intel_ace2x_debugfs.c | 147 +++++++++
 drivers/soundwire/intel_auxdevice.c     |  17 ++
 drivers/soundwire/intel_init.c          |  21 +-
 include/linux/soundwire/sdw.h           |   3 +-
 include/linux/soundwire/sdw_intel.h     |  88 ++++++
 sound/soc/sof/intel/hda.c               |  31 +-
 sound/soc/sof/intel/shim.h              |   1 +
 12 files changed, 711 insertions(+), 11 deletions(-)
 create mode 100644 drivers/soundwire/intel_ace2x.c
 create mode 100644 drivers/soundwire/intel_ace2x_debugfs.c

-- 
2.25.1


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 01/20] ASoC: SOF: Intel: shim: add enum for ACE 2.0 IP used in LunarLake
  2023-03-23  5:44 [PATCH 00/20] ASoC/soundwire: add support for ACE2.x Bard Liao
@ 2023-03-23  5:44 ` Bard Liao
  2023-03-23 14:18   ` Mark Brown
  2023-03-23  5:44 ` [PATCH 02/20] soundwire: intel: add ACE2.x SHIM definitions Bard Liao
                   ` (20 subsequent siblings)
  21 siblings, 1 reply; 30+ messages in thread
From: Bard Liao @ 2023-03-23  5:44 UTC (permalink / raw)
  To: alsa-devel, vkoul, broonie
  Cc: vinod.koul, linux-kernel, pierre-louis.bossart, bard.liao, tiwai

From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

Add the new enum needed for SoundWire IP selection. The LunarLake PCI
descriptors and DSP parts will be added at a later time.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
---
 sound/soc/sof/intel/shim.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/soc/sof/intel/shim.h b/sound/soc/sof/intel/shim.h
index 48428ccbcfe0..207df48e27cf 100644
--- a/sound/soc/sof/intel/shim.h
+++ b/sound/soc/sof/intel/shim.h
@@ -21,6 +21,7 @@ enum sof_intel_hw_ip_version {
 	SOF_INTEL_CAVS_2_0,	/* IceLake, JasperLake */
 	SOF_INTEL_CAVS_2_5,	/* TigerLake, AlderLake */
 	SOF_INTEL_ACE_1_0,	/* MeteorLake */
+	SOF_INTEL_ACE_2_0,	/* LunarLake */
 };
 
 /*
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 02/20] soundwire: intel: add ACE2.x SHIM definitions
  2023-03-23  5:44 [PATCH 00/20] ASoC/soundwire: add support for ACE2.x Bard Liao
  2023-03-23  5:44 ` [PATCH 01/20] ASoC: SOF: Intel: shim: add enum for ACE 2.0 IP used in LunarLake Bard Liao
@ 2023-03-23  5:44 ` Bard Liao
  2023-03-23  5:44 ` [PATCH 03/20] soundwire: intel_ace2x: add empty new ops for LunarLake Bard Liao
                   ` (19 subsequent siblings)
  21 siblings, 0 replies; 30+ messages in thread
From: Bard Liao @ 2023-03-23  5:44 UTC (permalink / raw)
  To: alsa-devel, vkoul, broonie
  Cc: vinod.koul, linux-kernel, pierre-louis.bossart, bard.liao, tiwai

From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

With the HDaudio extended link integration, the SHIM and IP registers
are split in blocks

a) SHIM generic registers
b) IP registers (same offsets for Cadence IP as before)
c) SHIM vendor-specific registers

Add offsets and definitions as defined in the hardware specifications.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
---
 include/linux/soundwire/sdw_intel.h | 75 +++++++++++++++++++++++++++++
 1 file changed, 75 insertions(+)

diff --git a/include/linux/soundwire/sdw_intel.h b/include/linux/soundwire/sdw_intel.h
index 207701aeeb47..8e6183e029fa 100644
--- a/include/linux/soundwire/sdw_intel.h
+++ b/include/linux/soundwire/sdw_intel.h
@@ -7,6 +7,10 @@
 #include <linux/irqreturn.h>
 #include <linux/soundwire/sdw.h>
 
+/*********************************************************************
+ * cAVS and ACE1.x definitions
+ *********************************************************************/
+
 #define SDW_SHIM_BASE			0x2C000
 #define SDW_ALH_BASE			0x2C800
 #define SDW_SHIM_BASE_ACE		0x38000
@@ -101,6 +105,77 @@
 #define SDW_ALH_STRMZCFG_DMAT		GENMASK(7, 0)
 #define SDW_ALH_STRMZCFG_CHN		GENMASK(19, 16)
 
+/*********************************************************************
+ * ACE2.x definitions for SHIM registers - only accessible when the
+ * HDAudio extended link LCTL.SPA/CPA = 1.
+ *********************************************************************/
+/* x variable is link index */
+#define SDW_SHIM2_GENERIC_BASE(x)	(0x00030000 + 0x8000 * (x))
+#define SDW_IP_BASE(x)			(0x00030100 + 0x8000 * (x))
+#define SDW_SHIM2_VS_BASE(x)		(0x00036000 + 0x8000 * (x))
+
+/* SHIM2 Generic Registers */
+/* Read-only capabilities */
+#define SDW_SHIM2_LECAP			0x00
+#define SDW_SHIM2_LECAP_HDS		BIT(0)		/* unset -> Host mode */
+#define SDW_SHIM2_LECAP_MLC		GENMASK(3, 1)	/* Number of Lanes */
+
+/* PCM Stream capabilities */
+#define SDW_SHIM2_PCMSCAP		0x10
+#define SDW_SHIM2_PCMSCAP_ISS		GENMASK(3, 0)	/* Input-only streams */
+#define SDW_SHIM2_PCMSCAP_OSS		GENMASK(7, 4)	/* Output-only streams */
+#define SDW_SHIM2_PCMSCAP_BSS		GENMASK(12, 8)	/* Bidirectional streams */
+
+/* Read-only PCM Stream Channel Count, y variable is stream */
+#define SDW_SHIM2_PCMSYCHC(y)		(0x14 + (0x4 * (y)))
+#define SDW_SHIM2_PCMSYCHC_CS		GENMASK(3, 0)	/* Channels Supported */
+
+/* PCM Stream Channel Map */
+#define SDW_SHIM2_PCMSYCHM(y)		(0x16 + (0x4 * (y)))
+#define SDW_SHIM2_PCMSYCHM_LCHAN	GENMASK(3, 0)	/* Lowest channel used by the FIFO port */
+#define SDW_SHIM2_PCMSYCHM_HCHAN	GENMASK(7, 4)	/* Lowest channel used by the FIFO port */
+#define SDW_SHIM2_PCMSYCHM_STRM		GENMASK(13, 8)	/* HDaudio stream tag */
+#define SDW_SHIM2_PCMSYCHM_DIR		BIT(15)		/* HDaudio stream direction */
+
+/* SHIM2 vendor-specific registers */
+#define SDW_SHIM2_INTEL_VS_LVSCTL	0x04
+#define SDW_SHIM2_INTEL_VS_LVSCTL_FCG	BIT(26)
+#define SDW_SHIM2_INTEL_VS_LVSCTL_MLCS	GENMASK(29, 27)
+#define SDW_SHIM2_INTEL_VS_LVSCTL_DCGD	BIT(30)
+#define SDW_SHIM2_INTEL_VS_LVSCTL_ICGD	BIT(31)
+
+#define SDW_SHIM2_MLCS_XTAL_CLK		0x0
+#define SDW_SHIM2_MLCS_CARDINAL_CLK	0x1
+#define SDW_SHIM2_MLCS_AUDIO_PLL_CLK	0x2
+#define SDW_SHIM2_MLCS_MCLK_INPUT_CLK	0x3
+#define SDW_SHIM2_MLCS_WOV_RING_OSC_CLK 0x4
+
+#define SDW_SHIM2_INTEL_VS_WAKEEN	0x08
+#define SDW_SHIM2_INTEL_VS_WAKEEN_PWE	BIT(0)
+
+#define SDW_SHIM2_INTEL_VS_WAKESTS	0x0A
+#define SDW_SHIM2_INTEL_VS_WAKEEN_PWS	BIT(0)
+
+#define SDW_SHIM2_INTEL_VS_IOCTL	0x0C
+#define SDW_SHIM2_INTEL_VS_IOCTL_MIF	BIT(0)
+#define SDW_SHIM2_INTEL_VS_IOCTL_CO	BIT(1)
+#define SDW_SHIM2_INTEL_VS_IOCTL_COE	BIT(2)
+#define SDW_SHIM2_INTEL_VS_IOCTL_DO	BIT(3)
+#define SDW_SHIM2_INTEL_VS_IOCTL_DOE	BIT(4)
+#define SDW_SHIM2_INTEL_VS_IOCTL_BKE	BIT(5)
+#define SDW_SHIM2_INTEL_VS_IOCTL_WPDD	BIT(6)
+#define SDW_SHIM2_INTEL_VS_IOCTL_ODC	BIT(7)
+#define SDW_SHIM2_INTEL_VS_IOCTL_CIBD	BIT(8)
+#define SDW_SHIM2_INTEL_VS_IOCTL_DIBD	BIT(9)
+#define SDW_SHIM2_INTEL_VS_IOCTL_HAMIFD	BIT(10)
+
+#define SDW_SHIM2_INTEL_VS_ACTMCTL	0x0E
+#define SDW_SHIM2_INTEL_VS_ACTMCTL_DACTQE	BIT(0)
+#define SDW_SHIM2_INTEL_VS_ACTMCTL_DODS		BIT(1)
+#define SDW_SHIM2_INTEL_VS_ACTMCTL_DODSE	BIT(2)
+#define SDW_SHIM2_INTEL_VS_ACTMCTL_DOAIS	GENMASK(4, 3)
+#define SDW_SHIM2_INTEL_VS_ACTMCTL_DOAISE	BIT(5)
+
 /**
  * struct sdw_intel_stream_params_data: configuration passed during
  * the @params_stream callback, e.g. for interaction with DSP
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 03/20] soundwire: intel_ace2x: add empty new ops for LunarLake
  2023-03-23  5:44 [PATCH 00/20] ASoC/soundwire: add support for ACE2.x Bard Liao
  2023-03-23  5:44 ` [PATCH 01/20] ASoC: SOF: Intel: shim: add enum for ACE 2.0 IP used in LunarLake Bard Liao
  2023-03-23  5:44 ` [PATCH 02/20] soundwire: intel: add ACE2.x SHIM definitions Bard Liao
@ 2023-03-23  5:44 ` Bard Liao
  2023-03-23  5:44 ` [PATCH 04/20] soundwire/ASOC: Intel: update offsets " Bard Liao
                   ` (18 subsequent siblings)
  21 siblings, 0 replies; 30+ messages in thread
From: Bard Liao @ 2023-03-23  5:44 UTC (permalink / raw)
  To: alsa-devel, vkoul, broonie
  Cc: vinod.koul, linux-kernel, pierre-louis.bossart, bard.liao, tiwai

From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

The register map and programming sequences for the ACE2.x IP are
completely different and need to be abstracted with a different set of
callbacks.

This initial patch adds a new file, follow-up patches will add each
required callback.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
---
 drivers/soundwire/Makefile          |  2 +-
 drivers/soundwire/intel_ace2x.c     | 19 +++++++++++++++++++
 include/linux/soundwire/sdw_intel.h |  1 +
 3 files changed, 21 insertions(+), 1 deletion(-)
 create mode 100644 drivers/soundwire/intel_ace2x.c

diff --git a/drivers/soundwire/Makefile b/drivers/soundwire/Makefile
index 8038e840ac5b..d7212777a927 100644
--- a/drivers/soundwire/Makefile
+++ b/drivers/soundwire/Makefile
@@ -20,7 +20,7 @@ soundwire-cadence-y := cadence_master.o
 obj-$(CONFIG_SOUNDWIRE_CADENCE) += soundwire-cadence.o
 
 #Intel driver
-soundwire-intel-y :=	intel.o intel_auxdevice.o intel_init.o dmi-quirks.o \
+soundwire-intel-y :=	intel.o  intel_ace2x.o intel_auxdevice.o intel_init.o dmi-quirks.o \
 			intel_bus_common.o
 obj-$(CONFIG_SOUNDWIRE_INTEL) += soundwire-intel.o
 
diff --git a/drivers/soundwire/intel_ace2x.c b/drivers/soundwire/intel_ace2x.c
new file mode 100644
index 000000000000..623e4fd7db91
--- /dev/null
+++ b/drivers/soundwire/intel_ace2x.c
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
+// Copyright(c) 2023 Intel Corporation. All rights reserved.
+
+/*
+ * Soundwire Intel ops for LunarLake
+ */
+
+#include <linux/acpi.h>
+#include <linux/device.h>
+#include <linux/soundwire/sdw_registers.h>
+#include <linux/soundwire/sdw.h>
+#include <linux/soundwire/sdw_intel.h>
+#include "cadence_master.h"
+#include "bus.h"
+#include "intel.h"
+
+const struct sdw_intel_hw_ops sdw_intel_lnl_hw_ops = {
+};
+EXPORT_SYMBOL_NS(sdw_intel_lnl_hw_ops, SOUNDWIRE_INTEL);
diff --git a/include/linux/soundwire/sdw_intel.h b/include/linux/soundwire/sdw_intel.h
index 8e6183e029fa..66687e83a94f 100644
--- a/include/linux/soundwire/sdw_intel.h
+++ b/include/linux/soundwire/sdw_intel.h
@@ -419,5 +419,6 @@ struct sdw_intel_hw_ops {
 };
 
 extern const struct sdw_intel_hw_ops sdw_intel_cnl_hw_ops;
+extern const struct sdw_intel_hw_ops sdw_intel_lnl_hw_ops;
 
 #endif
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 04/20] soundwire/ASOC: Intel: update offsets for LunarLake
  2023-03-23  5:44 [PATCH 00/20] ASoC/soundwire: add support for ACE2.x Bard Liao
                   ` (2 preceding siblings ...)
  2023-03-23  5:44 ` [PATCH 03/20] soundwire: intel_ace2x: add empty new ops for LunarLake Bard Liao
@ 2023-03-23  5:44 ` Bard Liao
  2023-03-23 14:18   ` Mark Brown
  2023-03-23  5:44 ` [PATCH 05/20] soundwire: intel/cadence: set ip_offset at run-time Bard Liao
                   ` (17 subsequent siblings)
  21 siblings, 1 reply; 30+ messages in thread
From: Bard Liao @ 2023-03-23  5:44 UTC (permalink / raw)
  To: alsa-devel, vkoul, broonie
  Cc: vinod.koul, linux-kernel, pierre-louis.bossart, bard.liao, tiwai

From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

The previous settings are not applicable, use a flag to determine what
the register layout is.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
---
 drivers/soundwire/intel.h           |  2 ++
 drivers/soundwire/intel_init.c      | 14 ++++++++++----
 include/linux/soundwire/sdw_intel.h |  2 ++
 sound/soc/sof/intel/hda.c           | 21 +++++++++++++++++----
 4 files changed, 31 insertions(+), 8 deletions(-)

diff --git a/drivers/soundwire/intel.h b/drivers/soundwire/intel.h
index 09d479f2c77b..51aa42a5a824 100644
--- a/drivers/soundwire/intel.h
+++ b/drivers/soundwire/intel.h
@@ -11,6 +11,7 @@
  * @mmio_base: mmio base of SoundWire registers
  * @registers: Link IO registers base
  * @shim: Audio shim pointer
+ * @shim_vs: Audio vendor-specific shim pointer
  * @alh: ALH (Audio Link Hub) pointer
  * @irq: Interrupt line
  * @ops: Shim callback ops
@@ -28,6 +29,7 @@ struct sdw_intel_link_res {
 	void __iomem *mmio_base; /* not strictly needed, useful for debug */
 	void __iomem *registers;
 	void __iomem *shim;
+	void __iomem *shim_vs;
 	void __iomem *alh;
 	int irq;
 	const struct sdw_intel_ops *ops;
diff --git a/drivers/soundwire/intel_init.c b/drivers/soundwire/intel_init.c
index cbe56b993c6c..e0023af9e0e1 100644
--- a/drivers/soundwire/intel_init.c
+++ b/drivers/soundwire/intel_init.c
@@ -63,10 +63,16 @@ static struct sdw_intel_link_dev *intel_link_dev_register(struct sdw_intel_res *
 	link = &ldev->link_res;
 	link->hw_ops = res->hw_ops;
 	link->mmio_base = res->mmio_base;
-	link->registers = res->mmio_base + SDW_LINK_BASE
-		+ (SDW_LINK_SIZE * link_id);
-	link->shim = res->mmio_base + res->shim_base;
-	link->alh = res->mmio_base + res->alh_base;
+	if (!res->ext) {
+		link->registers = res->mmio_base + SDW_LINK_BASE
+			+ (SDW_LINK_SIZE * link_id);
+		link->shim = res->mmio_base + res->shim_base;
+		link->alh = res->mmio_base + res->alh_base;
+	} else {
+		link->registers = res->mmio_base + SDW_IP_BASE(link_id);
+		link->shim = res->mmio_base +  SDW_SHIM2_GENERIC_BASE(link_id);
+		link->shim_vs = res->mmio_base + SDW_SHIM2_VS_BASE(link_id);
+	}
 
 	link->ops = res->ops;
 	link->dev = res->dev;
diff --git a/include/linux/soundwire/sdw_intel.h b/include/linux/soundwire/sdw_intel.h
index 66687e83a94f..88eb5bf98140 100644
--- a/include/linux/soundwire/sdw_intel.h
+++ b/include/linux/soundwire/sdw_intel.h
@@ -323,6 +323,7 @@ struct sdw_intel_ctx {
  * DSP driver. The quirks are common for all links for now.
  * @shim_base: sdw shim base.
  * @alh_base: sdw alh base.
+ * @ext: extended HDaudio link support
  */
 struct sdw_intel_res {
 	const struct sdw_intel_hw_ops *hw_ops;
@@ -337,6 +338,7 @@ struct sdw_intel_res {
 	u32 clock_stop_quirks;
 	u32 shim_base;
 	u32 alh_base;
+	bool ext;
 };
 
 /*
diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c
index 81c697e20108..db103524be4f 100644
--- a/sound/soc/sof/intel/hda.c
+++ b/sound/soc/sof/intel/hda.c
@@ -198,6 +198,7 @@ static int hda_sdw_acpi_scan(struct snd_sof_dev *sdev)
 
 static int hda_sdw_probe(struct snd_sof_dev *sdev)
 {
+	const struct sof_intel_dsp_desc *chip;
 	struct sof_intel_hda_dev *hdev;
 	struct sdw_intel_res res;
 	void *sdw;
@@ -206,10 +207,22 @@ static int hda_sdw_probe(struct snd_sof_dev *sdev)
 
 	memset(&res, 0, sizeof(res));
 
-	res.hw_ops = &sdw_intel_cnl_hw_ops;
-	res.mmio_base = sdev->bar[HDA_DSP_BAR];
-	res.shim_base = hdev->desc->sdw_shim_base;
-	res.alh_base = hdev->desc->sdw_alh_base;
+	chip = get_chip_info(sdev->pdata);
+	if (chip->hw_ip_version < SOF_INTEL_ACE_2_0) {
+		res.mmio_base = sdev->bar[HDA_DSP_BAR];
+		res.hw_ops = &sdw_intel_cnl_hw_ops;
+		res.shim_base = hdev->desc->sdw_shim_base;
+		res.alh_base = hdev->desc->sdw_alh_base;
+		res.ext = false;
+	} else {
+		res.mmio_base = sdev->bar[HDA_DSP_HDA_BAR];
+		/*
+		 * the SHIM and SoundWire register offsets are link-specific
+		 * and will be determined when adding auxiliary devices
+		 */
+		res.hw_ops = &sdw_intel_lnl_hw_ops;
+		res.ext = true;
+	}
 	res.irq = sdev->ipc_irq;
 	res.handle = hdev->info.handle;
 	res.parent = sdev->dev;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 05/20] soundwire: intel/cadence: set ip_offset at run-time
  2023-03-23  5:44 [PATCH 00/20] ASoC/soundwire: add support for ACE2.x Bard Liao
                   ` (3 preceding siblings ...)
  2023-03-23  5:44 ` [PATCH 04/20] soundwire/ASOC: Intel: update offsets " Bard Liao
@ 2023-03-23  5:44 ` Bard Liao
  2023-03-23  5:44 ` [PATCH 06/20] ASoC/soundwire: intel: pass hdac_bus pointer for link management Bard Liao
                   ` (16 subsequent siblings)
  21 siblings, 0 replies; 30+ messages in thread
From: Bard Liao @ 2023-03-23  5:44 UTC (permalink / raw)
  To: alsa-devel, vkoul, broonie
  Cc: vinod.koul, linux-kernel, pierre-louis.bossart, bard.liao, tiwai

From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

Select relevant ip-offset depending on hardware version. This offset
is used to access MCP_ or IP_MCP_ registers with a fixed offset.

For existing platforms, the offset is exactly zero. Starting with
LunarLake, the offset is 0x4000.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
---
 drivers/soundwire/cadence_master.h  | 2 ++
 drivers/soundwire/intel.h           | 2 ++
 drivers/soundwire/intel_auxdevice.c | 1 +
 drivers/soundwire/intel_init.c      | 2 ++
 4 files changed, 7 insertions(+)

diff --git a/drivers/soundwire/cadence_master.h b/drivers/soundwire/cadence_master.h
index b653734085d9..b0f0bf90640b 100644
--- a/drivers/soundwire/cadence_master.h
+++ b/drivers/soundwire/cadence_master.h
@@ -14,6 +14,8 @@
  */
 #define CDNS_MCP_IP_MAX_CMD_LEN		32
 
+#define SDW_CADENCE_MCP_IP_OFFSET	0x4000
+
 /**
  * struct sdw_cdns_pdi: PDI (Physical Data Interface) instance
  *
diff --git a/drivers/soundwire/intel.h b/drivers/soundwire/intel.h
index 51aa42a5a824..1b23292bb8be 100644
--- a/drivers/soundwire/intel.h
+++ b/drivers/soundwire/intel.h
@@ -10,6 +10,7 @@
  * @hw_ops: platform-specific ops
  * @mmio_base: mmio base of SoundWire registers
  * @registers: Link IO registers base
+ * @ip_offset: offset for MCP_IP registers
  * @shim: Audio shim pointer
  * @shim_vs: Audio vendor-specific shim pointer
  * @alh: ALH (Audio Link Hub) pointer
@@ -28,6 +29,7 @@ struct sdw_intel_link_res {
 
 	void __iomem *mmio_base; /* not strictly needed, useful for debug */
 	void __iomem *registers;
+	u32 ip_offset;
 	void __iomem *shim;
 	void __iomem *shim_vs;
 	void __iomem *alh;
diff --git a/drivers/soundwire/intel_auxdevice.c b/drivers/soundwire/intel_auxdevice.c
index 5021be0f4158..b02cef4f4b66 100644
--- a/drivers/soundwire/intel_auxdevice.c
+++ b/drivers/soundwire/intel_auxdevice.c
@@ -144,6 +144,7 @@ static int intel_link_probe(struct auxiliary_device *auxdev,
 	sdw->link_res = &ldev->link_res;
 	cdns->dev = dev;
 	cdns->registers = sdw->link_res->registers;
+	cdns->ip_offset = sdw->link_res->ip_offset;
 	cdns->instance = sdw->instance;
 	cdns->msg_count = 0;
 
diff --git a/drivers/soundwire/intel_init.c b/drivers/soundwire/intel_init.c
index e0023af9e0e1..43d339c6bcee 100644
--- a/drivers/soundwire/intel_init.c
+++ b/drivers/soundwire/intel_init.c
@@ -66,10 +66,12 @@ static struct sdw_intel_link_dev *intel_link_dev_register(struct sdw_intel_res *
 	if (!res->ext) {
 		link->registers = res->mmio_base + SDW_LINK_BASE
 			+ (SDW_LINK_SIZE * link_id);
+		link->ip_offset = 0;
 		link->shim = res->mmio_base + res->shim_base;
 		link->alh = res->mmio_base + res->alh_base;
 	} else {
 		link->registers = res->mmio_base + SDW_IP_BASE(link_id);
+		link->ip_offset = SDW_CADENCE_MCP_IP_OFFSET;
 		link->shim = res->mmio_base +  SDW_SHIM2_GENERIC_BASE(link_id);
 		link->shim_vs = res->mmio_base + SDW_SHIM2_VS_BASE(link_id);
 	}
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 06/20] ASoC/soundwire: intel: pass hdac_bus pointer for link management
  2023-03-23  5:44 [PATCH 00/20] ASoC/soundwire: add support for ACE2.x Bard Liao
                   ` (4 preceding siblings ...)
  2023-03-23  5:44 ` [PATCH 05/20] soundwire: intel/cadence: set ip_offset at run-time Bard Liao
@ 2023-03-23  5:44 ` Bard Liao
  2023-03-23 14:19   ` Mark Brown
  2023-03-23  5:44 ` [PATCH 07/20] soundwire: intel: add eml_lock in the interface for new platforms Bard Liao
                   ` (15 subsequent siblings)
  21 siblings, 1 reply; 30+ messages in thread
From: Bard Liao @ 2023-03-23  5:44 UTC (permalink / raw)
  To: alsa-devel, vkoul, broonie
  Cc: vinod.koul, linux-kernel, pierre-louis.bossart, bard.liao, tiwai

From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

The hdac_bus pointer is used to access the extended link information
and handle power management. Pass it from the SOF driver down to the
auxiliary devices.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
---
 drivers/soundwire/intel.h           | 4 ++++
 drivers/soundwire/intel_init.c      | 2 ++
 include/linux/soundwire/sdw_intel.h | 4 ++++
 sound/soc/sof/intel/hda.c           | 1 +
 4 files changed, 11 insertions(+)

diff --git a/drivers/soundwire/intel.h b/drivers/soundwire/intel.h
index 1b23292bb8be..cf9db4906de4 100644
--- a/drivers/soundwire/intel.h
+++ b/drivers/soundwire/intel.h
@@ -4,6 +4,8 @@
 #ifndef __SDW_INTEL_LOCAL_H
 #define __SDW_INTEL_LOCAL_H
 
+struct hdac_bus;
+
 /**
  * struct sdw_intel_link_res - Soundwire Intel link resource structure,
  * typically populated by the controller driver.
@@ -23,6 +25,7 @@
  * @link_mask: global mask needed for power-up/down sequences
  * @cdns: Cadence master descriptor
  * @list: used to walk-through all masters exposed by the same controller
+ * @hbus: hdac_bus pointer, needed for power management
  */
 struct sdw_intel_link_res {
 	const struct sdw_intel_hw_ops *hw_ops;
@@ -42,6 +45,7 @@ struct sdw_intel_link_res {
 	u32 link_mask;
 	struct sdw_cdns *cdns;
 	struct list_head list;
+	struct hdac_bus *hbus;
 };
 
 struct sdw_intel {
diff --git a/drivers/soundwire/intel_init.c b/drivers/soundwire/intel_init.c
index 43d339c6bcee..c918d2b81cc3 100644
--- a/drivers/soundwire/intel_init.c
+++ b/drivers/soundwire/intel_init.c
@@ -84,6 +84,8 @@ static struct sdw_intel_link_dev *intel_link_dev_register(struct sdw_intel_res *
 	link->shim_mask = &ctx->shim_mask;
 	link->link_mask = ctx->link_mask;
 
+	link->hbus = res->hbus;
+
 	/* now follow the two-step init/add sequence */
 	ret = auxiliary_device_init(auxdev);
 	if (ret < 0) {
diff --git a/include/linux/soundwire/sdw_intel.h b/include/linux/soundwire/sdw_intel.h
index 88eb5bf98140..c4281aa06e2e 100644
--- a/include/linux/soundwire/sdw_intel.h
+++ b/include/linux/soundwire/sdw_intel.h
@@ -269,6 +269,8 @@ struct sdw_intel_slave_id {
 	struct sdw_slave_id id;
 };
 
+struct hdac_bus;
+
 /**
  * struct sdw_intel_ctx - context allocated by the controller
  * driver probe
@@ -324,6 +326,7 @@ struct sdw_intel_ctx {
  * @shim_base: sdw shim base.
  * @alh_base: sdw alh base.
  * @ext: extended HDaudio link support
+ * @hbus: hdac_bus pointer, needed for power management
  */
 struct sdw_intel_res {
 	const struct sdw_intel_hw_ops *hw_ops;
@@ -339,6 +342,7 @@ struct sdw_intel_res {
 	u32 shim_base;
 	u32 alh_base;
 	bool ext;
+	struct hdac_bus *hbus;
 };
 
 /*
diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c
index db103524be4f..22eba57bb3e6 100644
--- a/sound/soc/sof/intel/hda.c
+++ b/sound/soc/sof/intel/hda.c
@@ -229,6 +229,7 @@ static int hda_sdw_probe(struct snd_sof_dev *sdev)
 	res.ops = &sdw_callback;
 	res.dev = sdev->dev;
 	res.clock_stop_quirks = sdw_clock_stop_quirks;
+	res.hbus = sof_to_bus(sdev);
 
 	/*
 	 * ops and arg fields are not populated for now,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 07/20] soundwire: intel: add eml_lock in the interface for new platforms
  2023-03-23  5:44 [PATCH 00/20] ASoC/soundwire: add support for ACE2.x Bard Liao
                   ` (5 preceding siblings ...)
  2023-03-23  5:44 ` [PATCH 06/20] ASoC/soundwire: intel: pass hdac_bus pointer for link management Bard Liao
@ 2023-03-23  5:44 ` Bard Liao
  2023-03-23  5:44 ` [PATCH 08/20] ASoC: SOF: Intel: hda: retrieve SoundWire eml_lock and pass pointer Bard Liao
                   ` (14 subsequent siblings)
  21 siblings, 0 replies; 30+ messages in thread
From: Bard Liao @ 2023-03-23  5:44 UTC (permalink / raw)
  To: alsa-devel, vkoul, broonie
  Cc: vinod.koul, linux-kernel, pierre-louis.bossart, bard.liao, tiwai

From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

In existing Intel/SoundWire systems, all the SoundWire configuration
is 'self-contained', with the 'shim_lock' mutex used to protect access
to shared registers in multi-link configurations.

With the move of part of the SoundWire registers to the HDaudio
multi-link structure, we need a unified lock. The hda-mlink
implementation provides an 'eml_lock' that is used to protect shared
registers such as LCTL and LSYNC, we can pass it to the SoundWire
side. There is no issue with possible dangling pointers since the
SoundWire auxiliary devices are children of the PCI device, so the
'eml_lock' cannot be removed while the SoundWire side is in use.

This patch only adds the interface for now.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
---
 include/linux/soundwire/sdw_intel.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/linux/soundwire/sdw_intel.h b/include/linux/soundwire/sdw_intel.h
index c4281aa06e2e..bafc6f2554b0 100644
--- a/include/linux/soundwire/sdw_intel.h
+++ b/include/linux/soundwire/sdw_intel.h
@@ -327,6 +327,8 @@ struct sdw_intel_ctx {
  * @alh_base: sdw alh base.
  * @ext: extended HDaudio link support
  * @hbus: hdac_bus pointer, needed for power management
+ * @eml_lock: mutex protecting shared registers in the HDaudio multi-link
+ * space
  */
 struct sdw_intel_res {
 	const struct sdw_intel_hw_ops *hw_ops;
@@ -343,6 +345,7 @@ struct sdw_intel_res {
 	u32 alh_base;
 	bool ext;
 	struct hdac_bus *hbus;
+	struct mutex *eml_lock;
 };
 
 /*
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 08/20] ASoC: SOF: Intel: hda: retrieve SoundWire eml_lock and pass pointer
  2023-03-23  5:44 [PATCH 00/20] ASoC/soundwire: add support for ACE2.x Bard Liao
                   ` (6 preceding siblings ...)
  2023-03-23  5:44 ` [PATCH 07/20] soundwire: intel: add eml_lock in the interface for new platforms Bard Liao
@ 2023-03-23  5:44 ` Bard Liao
  2023-03-23 14:20   ` Mark Brown
  2023-03-23  5:44 ` [PATCH 09/20] soundwire: intel_init: use eml_lock parameter Bard Liao
                   ` (13 subsequent siblings)
  21 siblings, 1 reply; 30+ messages in thread
From: Bard Liao @ 2023-03-23  5:44 UTC (permalink / raw)
  To: alsa-devel, vkoul, broonie
  Cc: vinod.koul, linux-kernel, pierre-louis.bossart, bard.liao, tiwai

From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

Use new helper and interface to make sure the HDaudio and SoundWire
parts use the same mutex when accessing shared registers.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
---
 sound/soc/sof/intel/hda.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c
index 22eba57bb3e6..f8cd5a9ebad1 100644
--- a/sound/soc/sof/intel/hda.c
+++ b/sound/soc/sof/intel/hda.c
@@ -215,6 +215,15 @@ static int hda_sdw_probe(struct snd_sof_dev *sdev)
 		res.alh_base = hdev->desc->sdw_alh_base;
 		res.ext = false;
 	} else {
+		/*
+		 * retrieve eml_lock needed to protect shared registers
+		 * in the HDaudio multi-link areas
+		 */
+		res.eml_lock = hdac_bus_eml_get_mutex(sof_to_bus(sdev), true,
+						      AZX_REG_ML_LEPTR_ID_SDW);
+		if (!res.eml_lock)
+			return -ENODEV;
+
 		res.mmio_base = sdev->bar[HDA_DSP_HDA_BAR];
 		/*
 		 * the SHIM and SoundWire register offsets are link-specific
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 09/20] soundwire: intel_init: use eml_lock parameter
  2023-03-23  5:44 [PATCH 00/20] ASoC/soundwire: add support for ACE2.x Bard Liao
                   ` (7 preceding siblings ...)
  2023-03-23  5:44 ` [PATCH 08/20] ASoC: SOF: Intel: hda: retrieve SoundWire eml_lock and pass pointer Bard Liao
@ 2023-03-23  5:44 ` Bard Liao
  2023-03-23  5:44 ` [PATCH 10/20] soundwire: intel_ace2x: add debugfs support Bard Liao
                   ` (12 subsequent siblings)
  21 siblings, 0 replies; 30+ messages in thread
From: Bard Liao @ 2023-03-23  5:44 UTC (permalink / raw)
  To: alsa-devel, vkoul, broonie
  Cc: vinod.koul, linux-kernel, pierre-louis.bossart, bard.liao, tiwai

From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

Now that the ASoC/SOF/HDAudio parts has retrieved the mutex and set
the parameter, we can use it to share the same synchronization across
the two domains.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
---
 drivers/soundwire/intel_init.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/soundwire/intel_init.c b/drivers/soundwire/intel_init.c
index c918d2b81cc3..534c8795e7e8 100644
--- a/drivers/soundwire/intel_init.c
+++ b/drivers/soundwire/intel_init.c
@@ -69,18 +69,19 @@ static struct sdw_intel_link_dev *intel_link_dev_register(struct sdw_intel_res *
 		link->ip_offset = 0;
 		link->shim = res->mmio_base + res->shim_base;
 		link->alh = res->mmio_base + res->alh_base;
+		link->shim_lock = &ctx->shim_lock;
 	} else {
 		link->registers = res->mmio_base + SDW_IP_BASE(link_id);
 		link->ip_offset = SDW_CADENCE_MCP_IP_OFFSET;
 		link->shim = res->mmio_base +  SDW_SHIM2_GENERIC_BASE(link_id);
 		link->shim_vs = res->mmio_base + SDW_SHIM2_VS_BASE(link_id);
+		link->shim_lock = res->eml_lock;
 	}
 
 	link->ops = res->ops;
 	link->dev = res->dev;
 
 	link->clock_stop_quirks = res->clock_stop_quirks;
-	link->shim_lock = &ctx->shim_lock;
 	link->shim_mask = &ctx->shim_mask;
 	link->link_mask = ctx->link_mask;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 10/20] soundwire: intel_ace2x: add debugfs support
  2023-03-23  5:44 [PATCH 00/20] ASoC/soundwire: add support for ACE2.x Bard Liao
                   ` (8 preceding siblings ...)
  2023-03-23  5:44 ` [PATCH 09/20] soundwire: intel_init: use eml_lock parameter Bard Liao
@ 2023-03-23  5:44 ` Bard Liao
  2023-03-23  5:44 ` [PATCH 11/20] soundwire: intel_ace2x: add link power-up/down helpers Bard Liao
                   ` (11 subsequent siblings)
  21 siblings, 0 replies; 30+ messages in thread
From: Bard Liao @ 2023-03-23  5:44 UTC (permalink / raw)
  To: alsa-devel, vkoul, broonie
  Cc: vinod.koul, linux-kernel, pierre-louis.bossart, bard.liao, tiwai

From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

Add access to registers in SHIM and SHIM_VS (vendor-specific) areas.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
---
 drivers/soundwire/Makefile              |   3 +-
 drivers/soundwire/intel.h               |   8 ++
 drivers/soundwire/intel_ace2x.c         |   2 +
 drivers/soundwire/intel_ace2x_debugfs.c | 147 ++++++++++++++++++++++++
 4 files changed, 159 insertions(+), 1 deletion(-)
 create mode 100644 drivers/soundwire/intel_ace2x_debugfs.c

diff --git a/drivers/soundwire/Makefile b/drivers/soundwire/Makefile
index d7212777a927..c57571c82e04 100644
--- a/drivers/soundwire/Makefile
+++ b/drivers/soundwire/Makefile
@@ -20,7 +20,8 @@ soundwire-cadence-y := cadence_master.o
 obj-$(CONFIG_SOUNDWIRE_CADENCE) += soundwire-cadence.o
 
 #Intel driver
-soundwire-intel-y :=	intel.o  intel_ace2x.o intel_auxdevice.o intel_init.o dmi-quirks.o \
+soundwire-intel-y :=	intel.o intel_ace2x.o intel_ace2x_debugfs.o \
+			intel_auxdevice.o intel_init.o dmi-quirks.o \
 			intel_bus_common.o
 obj-$(CONFIG_SOUNDWIRE_INTEL) += soundwire-intel.o
 
diff --git a/drivers/soundwire/intel.h b/drivers/soundwire/intel.h
index cf9db4906de4..511932c55216 100644
--- a/drivers/soundwire/intel.h
+++ b/drivers/soundwire/intel.h
@@ -95,6 +95,14 @@ static inline void intel_writew(void __iomem *base, int offset, u16 value)
 					 (sdw)->link_res->hw_ops->cb)
 #define SDW_INTEL_OPS(sdw, cb)		((sdw)->link_res->hw_ops->cb)
 
+#ifdef CONFIG_DEBUG_FS
+void intel_ace2x_debugfs_init(struct sdw_intel *sdw);
+void intel_ace2x_debugfs_exit(struct sdw_intel *sdw);
+#else
+static inline void intel_ace2x_debugfs_init(struct sdw_intel *sdw) {}
+static inline void intel_ace2x_debugfs_exit(struct sdw_intel *sdw) {}
+#endif
+
 static inline void sdw_intel_debugfs_init(struct sdw_intel *sdw)
 {
 	if (SDW_INTEL_CHECK_OPS(sdw, debugfs_init))
diff --git a/drivers/soundwire/intel_ace2x.c b/drivers/soundwire/intel_ace2x.c
index 623e4fd7db91..1c47bb2adb93 100644
--- a/drivers/soundwire/intel_ace2x.c
+++ b/drivers/soundwire/intel_ace2x.c
@@ -15,5 +15,7 @@
 #include "intel.h"
 
 const struct sdw_intel_hw_ops sdw_intel_lnl_hw_ops = {
+	.debugfs_init = intel_ace2x_debugfs_init,
+	.debugfs_exit = intel_ace2x_debugfs_exit,
 };
 EXPORT_SYMBOL_NS(sdw_intel_lnl_hw_ops, SOUNDWIRE_INTEL);
diff --git a/drivers/soundwire/intel_ace2x_debugfs.c b/drivers/soundwire/intel_ace2x_debugfs.c
new file mode 100644
index 000000000000..3d24661ffd37
--- /dev/null
+++ b/drivers/soundwire/intel_ace2x_debugfs.c
@@ -0,0 +1,147 @@
+// SPDX-License-Identifier: GPL-2.0-only
+// Copyright(c) 2023 Intel Corporation. All rights reserved.
+
+#include <linux/acpi.h>
+#include <linux/debugfs.h>
+#include <linux/delay.h>
+#include <linux/device.h>
+#include <linux/io.h>
+#include <linux/pm_runtime.h>
+#include <linux/soundwire/sdw.h>
+#include <linux/soundwire/sdw_intel.h>
+#include <linux/soundwire/sdw_registers.h>
+#include "bus.h"
+#include "cadence_master.h"
+#include "intel.h"
+
+/*
+ * debugfs
+ */
+#ifdef CONFIG_DEBUG_FS
+
+#define RD_BUF (2 * PAGE_SIZE)
+
+static ssize_t intel_sprintf(void __iomem *mem, bool l,
+			     char *buf, size_t pos, unsigned int reg)
+{
+	int value;
+
+	if (l)
+		value = intel_readl(mem, reg);
+	else
+		value = intel_readw(mem, reg);
+
+	return scnprintf(buf + pos, RD_BUF - pos, "%4x\t%4x\n", reg, value);
+}
+
+static int intel_reg_show(struct seq_file *s_file, void *data)
+{
+	struct sdw_intel *sdw = s_file->private;
+	void __iomem *s = sdw->link_res->shim;
+	void __iomem *vs_s = sdw->link_res->shim_vs;
+	ssize_t ret;
+	u32 pcm_cap;
+	int pcm_bd;
+	char *buf;
+	int j;
+
+	buf = kzalloc(RD_BUF, GFP_KERNEL);
+	if (!buf)
+		return -ENOMEM;
+
+	ret = scnprintf(buf, RD_BUF, "Register  Value\n");
+	ret += scnprintf(buf + ret, RD_BUF - ret, "\nShim\n");
+
+	ret += intel_sprintf(s, true, buf, ret, SDW_SHIM2_LECAP);
+	ret += intel_sprintf(s, false, buf, ret, SDW_SHIM2_PCMSCAP);
+
+	pcm_cap = intel_readw(s, SDW_SHIM2_PCMSCAP);
+	pcm_bd = FIELD_GET(SDW_SHIM2_PCMSCAP_BSS, pcm_cap);
+
+	for (j = 0; j < pcm_bd; j++) {
+		ret += intel_sprintf(s, false, buf, ret,
+				SDW_SHIM2_PCMSYCHM(j));
+		ret += intel_sprintf(s, false, buf, ret,
+				SDW_SHIM2_PCMSYCHC(j));
+	}
+
+	ret += scnprintf(buf + ret, RD_BUF - ret, "\nVS CLK controls\n");
+	ret += intel_sprintf(vs_s, true, buf, ret, SDW_SHIM2_INTEL_VS_LVSCTL);
+
+	ret += scnprintf(buf + ret, RD_BUF - ret, "\nVS Wake registers\n");
+	ret += intel_sprintf(vs_s, false, buf, ret, SDW_SHIM2_INTEL_VS_WAKEEN);
+	ret += intel_sprintf(vs_s, false, buf, ret, SDW_SHIM2_INTEL_VS_WAKESTS);
+
+	ret += scnprintf(buf + ret, RD_BUF - ret, "\nVS IOCTL, ACTMCTL\n");
+	ret += intel_sprintf(vs_s, false, buf, ret, SDW_SHIM2_INTEL_VS_IOCTL);
+	ret += intel_sprintf(vs_s, false, buf, ret, SDW_SHIM2_INTEL_VS_ACTMCTL);
+
+	seq_printf(s_file, "%s", buf);
+	kfree(buf);
+
+	return 0;
+}
+DEFINE_SHOW_ATTRIBUTE(intel_reg);
+
+static int intel_set_m_datamode(void *data, u64 value)
+{
+	struct sdw_intel *sdw = data;
+	struct sdw_bus *bus = &sdw->cdns.bus;
+
+	if (value > SDW_PORT_DATA_MODE_STATIC_1)
+		return -EINVAL;
+
+	/* Userspace changed the hardware state behind the kernel's back */
+	add_taint(TAINT_USER, LOCKDEP_STILL_OK);
+
+	bus->params.m_data_mode = value;
+
+	return 0;
+}
+DEFINE_DEBUGFS_ATTRIBUTE(intel_set_m_datamode_fops, NULL,
+			 intel_set_m_datamode, "%llu\n");
+
+static int intel_set_s_datamode(void *data, u64 value)
+{
+	struct sdw_intel *sdw = data;
+	struct sdw_bus *bus = &sdw->cdns.bus;
+
+	if (value > SDW_PORT_DATA_MODE_STATIC_1)
+		return -EINVAL;
+
+	/* Userspace changed the hardware state behind the kernel's back */
+	add_taint(TAINT_USER, LOCKDEP_STILL_OK);
+
+	bus->params.s_data_mode = value;
+
+	return 0;
+}
+DEFINE_DEBUGFS_ATTRIBUTE(intel_set_s_datamode_fops, NULL,
+			 intel_set_s_datamode, "%llu\n");
+
+void intel_ace2x_debugfs_init(struct sdw_intel *sdw)
+{
+	struct dentry *root = sdw->cdns.bus.debugfs;
+
+	if (!root)
+		return;
+
+	sdw->debugfs = debugfs_create_dir("intel-sdw", root);
+
+	debugfs_create_file("intel-registers", 0400, sdw->debugfs, sdw,
+			    &intel_reg_fops);
+
+	debugfs_create_file("intel-m-datamode", 0200, sdw->debugfs, sdw,
+			    &intel_set_m_datamode_fops);
+
+	debugfs_create_file("intel-s-datamode", 0200, sdw->debugfs, sdw,
+			    &intel_set_s_datamode_fops);
+
+	sdw_cdns_debugfs_init(&sdw->cdns, sdw->debugfs);
+}
+
+void intel_ace2x_debugfs_exit(struct sdw_intel *sdw)
+{
+	debugfs_remove_recursive(sdw->debugfs);
+}
+#endif /* CONFIG_DEBUG_FS */
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 11/20] soundwire: intel_ace2x: add link power-up/down helpers
  2023-03-23  5:44 [PATCH 00/20] ASoC/soundwire: add support for ACE2.x Bard Liao
                   ` (9 preceding siblings ...)
  2023-03-23  5:44 ` [PATCH 10/20] soundwire: intel_ace2x: add debugfs support Bard Liao
@ 2023-03-23  5:44 ` Bard Liao
  2023-03-23  5:44 ` [PATCH 12/20] soundwire: intel_ace2x: set SYNCPRD before powering-up Bard Liao
                   ` (10 subsequent siblings)
  21 siblings, 0 replies; 30+ messages in thread
From: Bard Liao @ 2023-03-23  5:44 UTC (permalink / raw)
  To: alsa-devel, vkoul, broonie
  Cc: vinod.koul, linux-kernel, pierre-louis.bossart, bard.liao, tiwai

From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

only power-up/down for now, the frequency is not set.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
---
 drivers/soundwire/intel_ace2x.c | 50 +++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/drivers/soundwire/intel_ace2x.c b/drivers/soundwire/intel_ace2x.c
index 1c47bb2adb93..5b6a608e63ba 100644
--- a/drivers/soundwire/intel_ace2x.c
+++ b/drivers/soundwire/intel_ace2x.c
@@ -10,12 +10,62 @@
 #include <linux/soundwire/sdw_registers.h>
 #include <linux/soundwire/sdw.h>
 #include <linux/soundwire/sdw_intel.h>
+#include <sound/hda-mlink.h>
 #include "cadence_master.h"
 #include "bus.h"
 #include "intel.h"
 
+static int intel_link_power_up(struct sdw_intel *sdw)
+{
+	int ret;
+
+	mutex_lock(sdw->link_res->shim_lock);
+
+	ret = hdac_bus_eml_sdw_power_up_unlocked(sdw->link_res->hbus, sdw->instance);
+	if (ret < 0) {
+		dev_err(sdw->cdns.dev, "%s: hdac_bus_eml_sdw_power_up failed: %d\n",
+			__func__, ret);
+		goto out;
+	}
+
+	sdw->cdns.link_up = true;
+out:
+	mutex_unlock(sdw->link_res->shim_lock);
+
+	return ret;
+}
+
+static int intel_link_power_down(struct sdw_intel *sdw)
+{
+	int ret;
+
+	mutex_lock(sdw->link_res->shim_lock);
+
+	sdw->cdns.link_up = false;
+
+	ret = hdac_bus_eml_sdw_power_down_unlocked(sdw->link_res->hbus, sdw->instance);
+	if (ret < 0) {
+		dev_err(sdw->cdns.dev, "%s: hdac_bus_eml_sdw_power_down failed: %d\n",
+			__func__, ret);
+
+		/*
+		 * we leave the sdw->cdns.link_up flag as false since we've disabled
+		 * the link at this point and cannot handle interrupts any longer.
+		 */
+	}
+
+	mutex_unlock(sdw->link_res->shim_lock);
+
+	return ret;
+}
+
 const struct sdw_intel_hw_ops sdw_intel_lnl_hw_ops = {
 	.debugfs_init = intel_ace2x_debugfs_init,
 	.debugfs_exit = intel_ace2x_debugfs_exit,
+
+	.link_power_up = intel_link_power_up,
+	.link_power_down = intel_link_power_down,
 };
 EXPORT_SYMBOL_NS(sdw_intel_lnl_hw_ops, SOUNDWIRE_INTEL);
+
+MODULE_IMPORT_NS(SND_SOC_SOF_HDA_MLINK);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 12/20] soundwire: intel_ace2x: set SYNCPRD before powering-up
  2023-03-23  5:44 [PATCH 00/20] ASoC/soundwire: add support for ACE2.x Bard Liao
                   ` (10 preceding siblings ...)
  2023-03-23  5:44 ` [PATCH 11/20] soundwire: intel_ace2x: add link power-up/down helpers Bard Liao
@ 2023-03-23  5:44 ` Bard Liao
  2023-03-23  5:44 ` [PATCH 13/20] soundwire: intel_ace2x: configure link PHY Bard Liao
                   ` (9 subsequent siblings)
  21 siblings, 0 replies; 30+ messages in thread
From: Bard Liao @ 2023-03-23  5:44 UTC (permalink / raw)
  To: alsa-devel, vkoul, broonie
  Cc: vinod.koul, linux-kernel, pierre-louis.bossart, bard.liao, tiwai

From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

The registers used for multi-link synchronization are no longer in the
SHIM but in the HDaudio multi-link capability space. Use helpers to
configure the SYNCPRD value, and wait for SYNCPU to change after
powering-up.

Note that the SYNCPRD value is shared between all sublinks, for
obvious reasons if those links are supposed to be synchronized. The
value of SYNCPRD is programmed only once for all sublinks.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
---
 drivers/soundwire/intel_ace2x.c | 42 +++++++++++++++++++++++++++++++--
 1 file changed, 40 insertions(+), 2 deletions(-)

diff --git a/drivers/soundwire/intel_ace2x.c b/drivers/soundwire/intel_ace2x.c
index 5b6a608e63ba..01668246b7ba 100644
--- a/drivers/soundwire/intel_ace2x.c
+++ b/drivers/soundwire/intel_ace2x.c
@@ -17,17 +17,51 @@
 
 static int intel_link_power_up(struct sdw_intel *sdw)
 {
+	struct sdw_bus *bus = &sdw->cdns.bus;
+	struct sdw_master_prop *prop = &bus->prop;
+	u32 *shim_mask = sdw->link_res->shim_mask;
+	unsigned int link_id = sdw->instance;
+	u32 syncprd;
 	int ret;
 
 	mutex_lock(sdw->link_res->shim_lock);
 
-	ret = hdac_bus_eml_sdw_power_up_unlocked(sdw->link_res->hbus, sdw->instance);
+	if (!*shim_mask) {
+		/* we first need to program the SyncPRD/CPU registers */
+		dev_dbg(sdw->cdns.dev, "first link up, programming SYNCPRD\n");
+
+		if (prop->mclk_freq % 6000000)
+			syncprd = SDW_SHIM_SYNC_SYNCPRD_VAL_38_4;
+		else
+			syncprd = SDW_SHIM_SYNC_SYNCPRD_VAL_24;
+
+		ret =  hdac_bus_eml_sdw_set_syncprd_unlocked(sdw->link_res->hbus, syncprd);
+		if (ret < 0) {
+			dev_err(sdw->cdns.dev, "%s: hdac_bus_eml_sdw_set_syncprd failed: %d\n",
+				__func__, ret);
+			goto out;
+		}
+	}
+
+	ret = hdac_bus_eml_sdw_power_up_unlocked(sdw->link_res->hbus, link_id);
 	if (ret < 0) {
 		dev_err(sdw->cdns.dev, "%s: hdac_bus_eml_sdw_power_up failed: %d\n",
 			__func__, ret);
 		goto out;
 	}
 
+	if (!*shim_mask) {
+		/* SYNCPU will change once link is active */
+		ret =  hdac_bus_eml_sdw_wait_syncpu_unlocked(sdw->link_res->hbus);
+		if (ret < 0) {
+			dev_err(sdw->cdns.dev, "%s: hdac_bus_eml_sdw_wait_syncpu failed: %d\n",
+				__func__, ret);
+			goto out;
+		}
+	}
+
+	*shim_mask |= BIT(link_id);
+
 	sdw->cdns.link_up = true;
 out:
 	mutex_unlock(sdw->link_res->shim_lock);
@@ -37,13 +71,17 @@ static int intel_link_power_up(struct sdw_intel *sdw)
 
 static int intel_link_power_down(struct sdw_intel *sdw)
 {
+	u32 *shim_mask = sdw->link_res->shim_mask;
+	unsigned int link_id = sdw->instance;
 	int ret;
 
 	mutex_lock(sdw->link_res->shim_lock);
 
 	sdw->cdns.link_up = false;
 
-	ret = hdac_bus_eml_sdw_power_down_unlocked(sdw->link_res->hbus, sdw->instance);
+	*shim_mask &= ~BIT(link_id);
+
+	ret = hdac_bus_eml_sdw_power_down_unlocked(sdw->link_res->hbus, link_id);
 	if (ret < 0) {
 		dev_err(sdw->cdns.dev, "%s: hdac_bus_eml_sdw_power_down failed: %d\n",
 			__func__, ret);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 13/20] soundwire: intel_ace2x: configure link PHY
  2023-03-23  5:44 [PATCH 00/20] ASoC/soundwire: add support for ACE2.x Bard Liao
                   ` (11 preceding siblings ...)
  2023-03-23  5:44 ` [PATCH 12/20] soundwire: intel_ace2x: set SYNCPRD before powering-up Bard Liao
@ 2023-03-23  5:44 ` Bard Liao
  2023-03-23  5:44 ` [PATCH 14/20] soundwire: intel_ace2x: add DAI registration Bard Liao
                   ` (8 subsequent siblings)
  21 siblings, 0 replies; 30+ messages in thread
From: Bard Liao @ 2023-03-23  5:44 UTC (permalink / raw)
  To: alsa-devel, vkoul, broonie
  Cc: vinod.koul, linux-kernel, pierre-louis.bossart, bard.liao, tiwai

From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

Unlike previous hardware generations, the glue-to-master transition is
not managed by software, instead the transitions are managed as part
of the power-up/down sequences controlled by SPA/CPA bits.

The only thing that's required is to configure the link PHY for
'normal' operation instead of the PHY test mode.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
---
 drivers/soundwire/intel_ace2x.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/soundwire/intel_ace2x.c b/drivers/soundwire/intel_ace2x.c
index 01668246b7ba..5deff32976f1 100644
--- a/drivers/soundwire/intel_ace2x.c
+++ b/drivers/soundwire/intel_ace2x.c
@@ -15,6 +15,22 @@
 #include "bus.h"
 #include "intel.h"
 
+/*
+ * shim vendor-specific (vs) ops
+ */
+
+static void intel_shim_vs_init(struct sdw_intel *sdw)
+{
+	void __iomem *shim_vs = sdw->link_res->shim_vs;
+	u16 act = 0;
+
+	u16p_replace_bits(&act, 0x1, SDW_SHIM2_INTEL_VS_ACTMCTL_DOAIS);
+	act |= SDW_SHIM2_INTEL_VS_ACTMCTL_DACTQE;
+	act |=  SDW_SHIM2_INTEL_VS_ACTMCTL_DODS;
+	intel_writew(shim_vs, SDW_SHIM2_INTEL_VS_ACTMCTL, act);
+	usleep_range(10, 15);
+}
+
 static int intel_link_power_up(struct sdw_intel *sdw)
 {
 	struct sdw_bus *bus = &sdw->cdns.bus;
@@ -63,6 +79,9 @@ static int intel_link_power_up(struct sdw_intel *sdw)
 	*shim_mask |= BIT(link_id);
 
 	sdw->cdns.link_up = true;
+
+	intel_shim_vs_init(sdw);
+
 out:
 	mutex_unlock(sdw->link_res->shim_lock);
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 14/20] soundwire: intel_ace2x: add DAI registration
  2023-03-23  5:44 [PATCH 00/20] ASoC/soundwire: add support for ACE2.x Bard Liao
                   ` (12 preceding siblings ...)
  2023-03-23  5:44 ` [PATCH 13/20] soundwire: intel_ace2x: configure link PHY Bard Liao
@ 2023-03-23  5:44 ` Bard Liao
  2023-03-23  5:44 ` [PATCH 15/20] soundwire: intel_ace2x: add sync_arm/sync_go helpers Bard Liao
                   ` (7 subsequent siblings)
  21 siblings, 0 replies; 30+ messages in thread
From: Bard Liao @ 2023-03-23  5:44 UTC (permalink / raw)
  To: alsa-devel, vkoul, broonie
  Cc: vinod.koul, linux-kernel, pierre-louis.bossart, bard.liao, tiwai

From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

The code is similar to the previous implementation, the only
difference is that the PDI descriptors are now in different areas.

Using common helpers proves tricky with multiple changed registers,
workarounds that are no longer necessary. It's simpler to duplicate
the intel_register_dai() function rather than try to add multiple
levels of abstraction and indirections.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
---
 drivers/soundwire/intel_ace2x.c | 161 ++++++++++++++++++++++++++++++++
 1 file changed, 161 insertions(+)

diff --git a/drivers/soundwire/intel_ace2x.c b/drivers/soundwire/intel_ace2x.c
index 5deff32976f1..d6d5e6e070f4 100644
--- a/drivers/soundwire/intel_ace2x.c
+++ b/drivers/soundwire/intel_ace2x.c
@@ -116,10 +116,171 @@ static int intel_link_power_down(struct sdw_intel *sdw)
 	return ret;
 }
 
+/*
+ * DAI operations
+ */
+static const struct snd_soc_dai_ops intel_pcm_dai_ops = {
+};
+
+static const struct snd_soc_component_driver dai_component = {
+	.name			= "soundwire",
+};
+
+/*
+ * PDI routines
+ */
+static void intel_pdi_init(struct sdw_intel *sdw,
+			   struct sdw_cdns_stream_config *config)
+{
+	void __iomem *shim = sdw->link_res->shim;
+	int pcm_cap;
+
+	/* PCM Stream Capability */
+	pcm_cap = intel_readw(shim, SDW_SHIM2_PCMSCAP);
+
+	config->pcm_bd = FIELD_GET(SDW_SHIM2_PCMSCAP_BSS, pcm_cap);
+	config->pcm_in = FIELD_GET(SDW_SHIM2_PCMSCAP_ISS, pcm_cap);
+	config->pcm_out = FIELD_GET(SDW_SHIM2_PCMSCAP_ISS, pcm_cap);
+
+	dev_dbg(sdw->cdns.dev, "PCM cap bd:%d in:%d out:%d\n",
+		config->pcm_bd, config->pcm_in, config->pcm_out);
+}
+
+static int
+intel_pdi_get_ch_cap(struct sdw_intel *sdw, unsigned int pdi_num)
+{
+	void __iomem *shim = sdw->link_res->shim;
+
+	/* zero based values for channel count in register */
+	return intel_readw(shim, SDW_SHIM2_PCMSYCHC(pdi_num)) + 1;
+}
+
+static void intel_pdi_get_ch_update(struct sdw_intel *sdw,
+				    struct sdw_cdns_pdi *pdi,
+				    unsigned int num_pdi,
+				    unsigned int *num_ch)
+{
+	int ch_count = 0;
+	int i;
+
+	for (i = 0; i < num_pdi; i++) {
+		pdi->ch_count = intel_pdi_get_ch_cap(sdw, pdi->num);
+		ch_count += pdi->ch_count;
+		pdi++;
+	}
+
+	*num_ch = ch_count;
+}
+
+static void intel_pdi_stream_ch_update(struct sdw_intel *sdw,
+				       struct sdw_cdns_streams *stream)
+{
+	intel_pdi_get_ch_update(sdw, stream->bd, stream->num_bd,
+				&stream->num_ch_bd);
+
+	intel_pdi_get_ch_update(sdw, stream->in, stream->num_in,
+				&stream->num_ch_in);
+
+	intel_pdi_get_ch_update(sdw, stream->out, stream->num_out,
+				&stream->num_ch_out);
+}
+
+static int intel_create_dai(struct sdw_cdns *cdns,
+			    struct snd_soc_dai_driver *dais,
+			    enum intel_pdi_type type,
+			    u32 num, u32 off, u32 max_ch)
+{
+	int i;
+
+	if (!num)
+		return 0;
+
+	for (i = off; i < (off + num); i++) {
+		dais[i].name = devm_kasprintf(cdns->dev, GFP_KERNEL,
+					      "SDW%d Pin%d",
+					      cdns->instance, i);
+		if (!dais[i].name)
+			return -ENOMEM;
+
+		if (type == INTEL_PDI_BD || type == INTEL_PDI_OUT) {
+			dais[i].playback.channels_min = 1;
+			dais[i].playback.channels_max = max_ch;
+		}
+
+		if (type == INTEL_PDI_BD || type == INTEL_PDI_IN) {
+			dais[i].capture.channels_min = 1;
+			dais[i].capture.channels_max = max_ch;
+		}
+
+		dais[i].ops = &intel_pcm_dai_ops;
+	}
+
+	return 0;
+}
+
+static int intel_register_dai(struct sdw_intel *sdw)
+{
+	struct sdw_cdns_dai_runtime **dai_runtime_array;
+	struct sdw_cdns_stream_config config;
+	struct sdw_cdns *cdns = &sdw->cdns;
+	struct sdw_cdns_streams *stream;
+	struct snd_soc_dai_driver *dais;
+	int num_dai;
+	int ret;
+	int off = 0;
+
+	/* Read the PDI config and initialize cadence PDI */
+	intel_pdi_init(sdw, &config);
+	ret = sdw_cdns_pdi_init(cdns, config);
+	if (ret)
+		return ret;
+
+	intel_pdi_stream_ch_update(sdw, &sdw->cdns.pcm);
+
+	/* DAIs are created based on total number of PDIs supported */
+	num_dai = cdns->pcm.num_pdi;
+
+	dai_runtime_array = devm_kcalloc(cdns->dev, num_dai,
+					 sizeof(struct sdw_cdns_dai_runtime *),
+					 GFP_KERNEL);
+	if (!dai_runtime_array)
+		return -ENOMEM;
+	cdns->dai_runtime_array = dai_runtime_array;
+
+	dais = devm_kcalloc(cdns->dev, num_dai, sizeof(*dais), GFP_KERNEL);
+	if (!dais)
+		return -ENOMEM;
+
+	/* Create PCM DAIs */
+	stream = &cdns->pcm;
+
+	ret = intel_create_dai(cdns, dais, INTEL_PDI_IN, cdns->pcm.num_in,
+			       off, stream->num_ch_in);
+	if (ret)
+		return ret;
+
+	off += cdns->pcm.num_in;
+	ret = intel_create_dai(cdns, dais, INTEL_PDI_OUT, cdns->pcm.num_out,
+			       off, stream->num_ch_out);
+	if (ret)
+		return ret;
+
+	off += cdns->pcm.num_out;
+	ret = intel_create_dai(cdns, dais, INTEL_PDI_BD, cdns->pcm.num_bd,
+			       off, stream->num_ch_bd);
+	if (ret)
+		return ret;
+
+	return devm_snd_soc_register_component(cdns->dev, &dai_component,
+					       dais, num_dai);
+}
+
 const struct sdw_intel_hw_ops sdw_intel_lnl_hw_ops = {
 	.debugfs_init = intel_ace2x_debugfs_init,
 	.debugfs_exit = intel_ace2x_debugfs_exit,
 
+	.register_dai = intel_register_dai,
+
 	.link_power_up = intel_link_power_up,
 	.link_power_down = intel_link_power_down,
 };
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 15/20] soundwire: intel_ace2x: add sync_arm/sync_go helpers
  2023-03-23  5:44 [PATCH 00/20] ASoC/soundwire: add support for ACE2.x Bard Liao
                   ` (13 preceding siblings ...)
  2023-03-23  5:44 ` [PATCH 14/20] soundwire: intel_ace2x: add DAI registration Bard Liao
@ 2023-03-23  5:44 ` Bard Liao
  2023-03-23  5:44 ` [PATCH 16/20] soundwire: intel_ace2x: use common helpers for bus start/stop Bard Liao
                   ` (6 subsequent siblings)
  21 siblings, 0 replies; 30+ messages in thread
From: Bard Liao @ 2023-03-23  5:44 UTC (permalink / raw)
  To: alsa-devel, vkoul, broonie
  Cc: vinod.koul, linux-kernel, pierre-louis.bossart, bard.liao, tiwai

From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

Same functionality as before, but with the registers moved to the
HDaudio multi-link area.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
---
 drivers/soundwire/intel_ace2x.c | 39 +++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/drivers/soundwire/intel_ace2x.c b/drivers/soundwire/intel_ace2x.c
index d6d5e6e070f4..20b8806f7de6 100644
--- a/drivers/soundwire/intel_ace2x.c
+++ b/drivers/soundwire/intel_ace2x.c
@@ -116,6 +116,41 @@ static int intel_link_power_down(struct sdw_intel *sdw)
 	return ret;
 }
 
+static void intel_sync_arm(struct sdw_intel *sdw)
+{
+	unsigned int link_id = sdw->instance;
+
+	mutex_lock(sdw->link_res->shim_lock);
+
+	hdac_bus_eml_sdw_sync_arm_unlocked(sdw->link_res->hbus, link_id);
+
+	mutex_unlock(sdw->link_res->shim_lock);
+}
+
+static int intel_sync_go_unlocked(struct sdw_intel *sdw)
+{
+	int ret;
+
+	ret = hdac_bus_eml_sdw_sync_go_unlocked(sdw->link_res->hbus);
+	if (ret < 0)
+		dev_err(sdw->cdns.dev, "%s: SyncGO clear failed: %d\n", __func__, ret);
+
+	return ret;
+}
+
+static int intel_sync_go(struct sdw_intel *sdw)
+{
+	int ret;
+
+	mutex_lock(sdw->link_res->shim_lock);
+
+	ret = intel_sync_go_unlocked(sdw);
+
+	mutex_unlock(sdw->link_res->shim_lock);
+
+	return ret;
+}
+
 /*
  * DAI operations
  */
@@ -283,6 +318,10 @@ const struct sdw_intel_hw_ops sdw_intel_lnl_hw_ops = {
 
 	.link_power_up = intel_link_power_up,
 	.link_power_down = intel_link_power_down,
+
+	.sync_arm = intel_sync_arm,
+	.sync_go_unlocked = intel_sync_go_unlocked,
+	.sync_go = intel_sync_go,
 };
 EXPORT_SYMBOL_NS(sdw_intel_lnl_hw_ops, SOUNDWIRE_INTEL);
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 16/20] soundwire: intel_ace2x: use common helpers for bus start/stop
  2023-03-23  5:44 [PATCH 00/20] ASoC/soundwire: add support for ACE2.x Bard Liao
                   ` (14 preceding siblings ...)
  2023-03-23  5:44 ` [PATCH 15/20] soundwire: intel_ace2x: add sync_arm/sync_go helpers Bard Liao
@ 2023-03-23  5:44 ` Bard Liao
  2023-03-23  5:44 ` [PATCH 17/20] soundwire: intel_ace2x: enable wake support Bard Liao
                   ` (5 subsequent siblings)
  21 siblings, 0 replies; 30+ messages in thread
From: Bard Liao @ 2023-03-23  5:44 UTC (permalink / raw)
  To: alsa-devel, vkoul, broonie
  Cc: vinod.koul, linux-kernel, pierre-louis.bossart, bard.liao, tiwai

From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

The sequences are so far identical, so the abstraction is a bit
over-engineered. In time we will simplify if there is no need to
special case or work-around programming sequences.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
---
 drivers/soundwire/intel_ace2x.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/soundwire/intel_ace2x.c b/drivers/soundwire/intel_ace2x.c
index 20b8806f7de6..2e33e8a00b55 100644
--- a/drivers/soundwire/intel_ace2x.c
+++ b/drivers/soundwire/intel_ace2x.c
@@ -316,6 +316,12 @@ const struct sdw_intel_hw_ops sdw_intel_lnl_hw_ops = {
 
 	.register_dai = intel_register_dai,
 
+	.check_clock_stop = intel_check_clock_stop,
+	.start_bus = intel_start_bus,
+	.start_bus_after_reset = intel_start_bus_after_reset,
+	.start_bus_after_clock_stop = intel_start_bus_after_clock_stop,
+	.stop_bus = intel_stop_bus,
+
 	.link_power_up = intel_link_power_up,
 	.link_power_down = intel_link_power_down,
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 17/20] soundwire: intel_ace2x: enable wake support
  2023-03-23  5:44 [PATCH 00/20] ASoC/soundwire: add support for ACE2.x Bard Liao
                   ` (15 preceding siblings ...)
  2023-03-23  5:44 ` [PATCH 16/20] soundwire: intel_ace2x: use common helpers for bus start/stop Bard Liao
@ 2023-03-23  5:44 ` Bard Liao
  2023-03-23  5:44 ` [PATCH 18/20] soundwire: intel_ace2x: add check_cmdsync_unlocked helper Bard Liao
                   ` (4 subsequent siblings)
  21 siblings, 0 replies; 30+ messages in thread
From: Bard Liao @ 2023-03-23  5:44 UTC (permalink / raw)
  To: alsa-devel, vkoul, broonie
  Cc: vinod.koul, linux-kernel, pierre-louis.bossart, bard.liao, tiwai

From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

The WAKEEN and WAKESTS registers were moved to the per-link SHIM_VS
area.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
---
 drivers/soundwire/intel_ace2x.c | 38 +++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/drivers/soundwire/intel_ace2x.c b/drivers/soundwire/intel_ace2x.c
index 2e33e8a00b55..fe950b3ea3bc 100644
--- a/drivers/soundwire/intel_ace2x.c
+++ b/drivers/soundwire/intel_ace2x.c
@@ -31,6 +31,41 @@ static void intel_shim_vs_init(struct sdw_intel *sdw)
 	usleep_range(10, 15);
 }
 
+static int intel_shim_check_wake(struct sdw_intel *sdw)
+{
+	void __iomem *shim_vs;
+	u16 wake_sts;
+
+	shim_vs = sdw->link_res->shim_vs;
+	wake_sts = intel_readw(shim_vs, SDW_SHIM2_INTEL_VS_WAKESTS);
+
+	return wake_sts & SDW_SHIM2_INTEL_VS_WAKEEN_PWS;
+}
+
+static void intel_shim_wake(struct sdw_intel *sdw, bool wake_enable)
+{
+	void __iomem *shim_vs = sdw->link_res->shim_vs;
+	u16 wake_en;
+	u16 wake_sts;
+
+	wake_en = intel_readw(shim_vs, SDW_SHIM2_INTEL_VS_WAKEEN);
+
+	if (wake_enable) {
+		/* Enable the wakeup */
+		wake_en |= SDW_SHIM2_INTEL_VS_WAKEEN_PWE;
+		intel_writew(shim_vs, SDW_SHIM2_INTEL_VS_WAKEEN, wake_en);
+	} else {
+		/* Disable the wake up interrupt */
+		wake_en &= ~SDW_SHIM2_INTEL_VS_WAKEEN_PWE;
+		intel_writew(shim_vs, SDW_SHIM2_INTEL_VS_WAKEEN, wake_en);
+
+		/* Clear wake status (W1C) */
+		wake_sts = intel_readw(shim_vs, SDW_SHIM2_INTEL_VS_WAKESTS);
+		wake_sts |= SDW_SHIM2_INTEL_VS_WAKEEN_PWS;
+		intel_writew(shim_vs, SDW_SHIM2_INTEL_VS_WAKESTS, wake_sts);
+	}
+}
+
 static int intel_link_power_up(struct sdw_intel *sdw)
 {
 	struct sdw_bus *bus = &sdw->cdns.bus;
@@ -325,6 +360,9 @@ const struct sdw_intel_hw_ops sdw_intel_lnl_hw_ops = {
 	.link_power_up = intel_link_power_up,
 	.link_power_down = intel_link_power_down,
 
+	.shim_check_wake = intel_shim_check_wake,
+	.shim_wake = intel_shim_wake,
+
 	.sync_arm = intel_sync_arm,
 	.sync_go_unlocked = intel_sync_go_unlocked,
 	.sync_go = intel_sync_go,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 18/20] soundwire: intel_ace2x: add check_cmdsync_unlocked helper
  2023-03-23  5:44 [PATCH 00/20] ASoC/soundwire: add support for ACE2.x Bard Liao
                   ` (16 preceding siblings ...)
  2023-03-23  5:44 ` [PATCH 17/20] soundwire: intel_ace2x: enable wake support Bard Liao
@ 2023-03-23  5:44 ` Bard Liao
  2023-03-23  5:44 ` [PATCH 19/20] soundwire: bus: add new manager callback to deal with peripheral enumeration Bard Liao
                   ` (3 subsequent siblings)
  21 siblings, 0 replies; 30+ messages in thread
From: Bard Liao @ 2023-03-23  5:44 UTC (permalink / raw)
  To: alsa-devel, vkoul, broonie
  Cc: vinod.koul, linux-kernel, pierre-louis.bossart, bard.liao, tiwai

From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

This is the last callback needed for all bus management routines on
new hardware. Same concept as before, just different register.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
---
 drivers/soundwire/intel_ace2x.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/soundwire/intel_ace2x.c b/drivers/soundwire/intel_ace2x.c
index fe950b3ea3bc..a12fee8a5bfa 100644
--- a/drivers/soundwire/intel_ace2x.c
+++ b/drivers/soundwire/intel_ace2x.c
@@ -186,6 +186,11 @@ static int intel_sync_go(struct sdw_intel *sdw)
 	return ret;
 }
 
+static bool intel_check_cmdsync_unlocked(struct sdw_intel *sdw)
+{
+	return hdac_bus_eml_sdw_check_cmdsync_unlocked(sdw->link_res->hbus);
+}
+
 /*
  * DAI operations
  */
@@ -366,6 +371,7 @@ const struct sdw_intel_hw_ops sdw_intel_lnl_hw_ops = {
 	.sync_arm = intel_sync_arm,
 	.sync_go_unlocked = intel_sync_go_unlocked,
 	.sync_go = intel_sync_go,
+	.sync_check_cmdsync_unlocked = intel_check_cmdsync_unlocked,
 };
 EXPORT_SYMBOL_NS(sdw_intel_lnl_hw_ops, SOUNDWIRE_INTEL);
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 19/20] soundwire: bus: add new manager callback to deal with peripheral enumeration
  2023-03-23  5:44 [PATCH 00/20] ASoC/soundwire: add support for ACE2.x Bard Liao
                   ` (17 preceding siblings ...)
  2023-03-23  5:44 ` [PATCH 18/20] soundwire: intel_ace2x: add check_cmdsync_unlocked helper Bard Liao
@ 2023-03-23  5:44 ` Bard Liao
  2023-03-23  5:44 ` [PATCH 20/20] soundwire: intel_ace2x: add new_peripheral_assigned callback Bard Liao
                   ` (2 subsequent siblings)
  21 siblings, 0 replies; 30+ messages in thread
From: Bard Liao @ 2023-03-23  5:44 UTC (permalink / raw)
  To: alsa-devel, vkoul, broonie
  Cc: vinod.koul, linux-kernel, pierre-louis.bossart, bard.liao, tiwai

From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

When a peripheral reports as ATTACHED, the manager may need to follow
a programming sequence, e.g. to assign DMA resources and/or assign a
command queue for that peripheral.

This patch adds an optional callback, which will be invoked every time
the peripheral attaches. This might be overkill in some scenarios, and
one could argue that this should be invoked only on the first
attachment. The bus does not however track this first attachment with
any existing state-mirroring variable, and using dev_num_sticky would
not work across suspend-resume cycles.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
---
 drivers/soundwire/bus.c       | 3 +++
 include/linux/soundwire/sdw.h | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c
index b6aca59c3130..35f49bcc53e5 100644
--- a/drivers/soundwire/bus.c
+++ b/drivers/soundwire/bus.c
@@ -716,6 +716,9 @@ static int sdw_assign_device_num(struct sdw_slave *slave)
 	/* After xfer of msg, restore dev_num */
 	slave->dev_num = slave->dev_num_sticky;
 
+	if (bus->ops && bus->ops->new_peripheral_assigned)
+		bus->ops->new_peripheral_assigned(bus, dev_num);
+
 	return 0;
 }
 
diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h
index ef645de13ae9..c076a3f879b3 100644
--- a/include/linux/soundwire/sdw.h
+++ b/include/linux/soundwire/sdw.h
@@ -846,6 +846,7 @@ struct sdw_defer {
  * @post_bank_switch: Callback for post bank switch
  * @read_ping_status: Read status from PING frames, reported with two bits per Device.
  * Bits 31:24 are reserved.
+ * @new_peripheral_assigned: Callback to handle enumeration of new peripheral.
  */
 struct sdw_master_ops {
 	int (*read_prop)(struct sdw_bus *bus);
@@ -860,7 +861,7 @@ struct sdw_master_ops {
 	int (*pre_bank_switch)(struct sdw_bus *bus);
 	int (*post_bank_switch)(struct sdw_bus *bus);
 	u32 (*read_ping_status)(struct sdw_bus *bus);
-
+	void (*new_peripheral_assigned)(struct sdw_bus *bus, int dev_num);
 };
 
 /**
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 20/20] soundwire: intel_ace2x: add new_peripheral_assigned callback
  2023-03-23  5:44 [PATCH 00/20] ASoC/soundwire: add support for ACE2.x Bard Liao
                   ` (18 preceding siblings ...)
  2023-03-23  5:44 ` [PATCH 19/20] soundwire: bus: add new manager callback to deal with peripheral enumeration Bard Liao
@ 2023-03-23  5:44 ` Bard Liao
  2023-03-23 14:15 ` [PATCH 00/20] ASoC/soundwire: add support for ACE2.x Liao, Bard
  2023-04-12 10:07 ` Vinod Koul
  21 siblings, 0 replies; 30+ messages in thread
From: Bard Liao @ 2023-03-23  5:44 UTC (permalink / raw)
  To: alsa-devel, vkoul, broonie
  Cc: vinod.koul, linux-kernel, pierre-louis.bossart, bard.liao, tiwai

From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

Add the abstraction needed to only program the LSDIID registers for
the HDaudio extended links. It's perfectly fine to program this
register multiple times in case devices lose sync and reattach.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
---
 drivers/soundwire/intel_ace2x.c     | 12 ++++++++++++
 drivers/soundwire/intel_auxdevice.c | 16 ++++++++++++++++
 include/linux/soundwire/sdw_intel.h |  3 +++
 3 files changed, 31 insertions(+)

diff --git a/drivers/soundwire/intel_ace2x.c b/drivers/soundwire/intel_ace2x.c
index a12fee8a5bfa..65deb4345354 100644
--- a/drivers/soundwire/intel_ace2x.c
+++ b/drivers/soundwire/intel_ace2x.c
@@ -350,6 +350,16 @@ static int intel_register_dai(struct sdw_intel *sdw)
 					       dais, num_dai);
 }
 
+static void intel_program_sdi(struct sdw_intel *sdw, int dev_num)
+{
+	int ret;
+
+	ret = hdac_bus_eml_sdw_set_lsdiid(sdw->link_res->hbus, sdw->instance, dev_num);
+	if (ret < 0)
+		dev_err(sdw->cdns.dev, "%s: could not set lsdiid for link %d %d\n",
+			__func__, sdw->instance, dev_num);
+}
+
 const struct sdw_intel_hw_ops sdw_intel_lnl_hw_ops = {
 	.debugfs_init = intel_ace2x_debugfs_init,
 	.debugfs_exit = intel_ace2x_debugfs_exit,
@@ -372,6 +382,8 @@ const struct sdw_intel_hw_ops sdw_intel_lnl_hw_ops = {
 	.sync_go_unlocked = intel_sync_go_unlocked,
 	.sync_go = intel_sync_go,
 	.sync_check_cmdsync_unlocked = intel_check_cmdsync_unlocked,
+
+	.program_sdi = intel_program_sdi,
 };
 EXPORT_SYMBOL_NS(sdw_intel_lnl_hw_ops, SOUNDWIRE_INTEL);
 
diff --git a/drivers/soundwire/intel_auxdevice.c b/drivers/soundwire/intel_auxdevice.c
index b02cef4f4b66..6e02782ef211 100644
--- a/drivers/soundwire/intel_auxdevice.c
+++ b/drivers/soundwire/intel_auxdevice.c
@@ -60,6 +60,21 @@ static int generic_post_bank_switch(struct sdw_bus *bus)
 	return sdw->link_res->hw_ops->post_bank_switch(sdw);
 }
 
+static void generic_new_peripheral_assigned(struct sdw_bus *bus, int dev_num)
+{
+	struct sdw_cdns *cdns = bus_to_cdns(bus);
+	struct sdw_intel *sdw = cdns_to_intel(cdns);
+
+	/* paranoia check, this should never happen */
+	if (dev_num < INTEL_DEV_NUM_IDA_MIN || dev_num > SDW_MAX_DEVICES)  {
+		dev_err(bus->dev, "%s: invalid dev_num %d\n", __func__, dev_num);
+		return;
+	}
+
+	if (sdw->link_res->hw_ops->program_sdi)
+		sdw->link_res->hw_ops->program_sdi(sdw, dev_num);
+}
+
 static int sdw_master_read_intel_prop(struct sdw_bus *bus)
 {
 	struct sdw_master_prop *prop = &bus->prop;
@@ -117,6 +132,7 @@ static struct sdw_master_ops sdw_intel_ops = {
 	.pre_bank_switch = generic_pre_bank_switch,
 	.post_bank_switch = generic_post_bank_switch,
 	.read_ping_status = cdns_read_ping_status,
+	.new_peripheral_assigned = generic_new_peripheral_assigned,
 };
 
 /*
diff --git a/include/linux/soundwire/sdw_intel.h b/include/linux/soundwire/sdw_intel.h
index bafc6f2554b0..1a8f32059cd8 100644
--- a/include/linux/soundwire/sdw_intel.h
+++ b/include/linux/soundwire/sdw_intel.h
@@ -399,6 +399,7 @@ struct sdw_intel;
  * @sync_go: helper for multi-link synchronization
  * @sync_check_cmdsync_unlocked: helper for multi-link synchronization
  * and bank switch - shim_lock is assumed to be locked at higher level
+ * @program_sdi: helper for codec command/control based on dev_num
  */
 struct sdw_intel_hw_ops {
 	void (*debugfs_init)(struct sdw_intel *sdw);
@@ -425,6 +426,8 @@ struct sdw_intel_hw_ops {
 	int (*sync_go_unlocked)(struct sdw_intel *sdw);
 	int (*sync_go)(struct sdw_intel *sdw);
 	bool (*sync_check_cmdsync_unlocked)(struct sdw_intel *sdw);
+
+	void (*program_sdi)(struct sdw_intel *sdw, int dev_num);
 };
 
 extern const struct sdw_intel_hw_ops sdw_intel_cnl_hw_ops;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 30+ messages in thread

* RE: [PATCH 00/20] ASoC/soundwire: add support for ACE2.x
  2023-03-23  5:44 [PATCH 00/20] ASoC/soundwire: add support for ACE2.x Bard Liao
                   ` (19 preceding siblings ...)
  2023-03-23  5:44 ` [PATCH 20/20] soundwire: intel_ace2x: add new_peripheral_assigned callback Bard Liao
@ 2023-03-23 14:15 ` Liao, Bard
  2023-04-12 10:07 ` Vinod Koul
  21 siblings, 0 replies; 30+ messages in thread
From: Liao, Bard @ 2023-03-23 14:15 UTC (permalink / raw)
  To: Bard Liao, alsa-devel, vkoul, broonie
  Cc: vinod.koul, linux-kernel, pierre-louis.bossart, tiwai

The patches will not compile due to missed dependency but welcome review
on the code changes.

> -----Original Message-----
> From: Bard Liao <yung-chuan.liao@linux.intel.com>
> Sent: Thursday, March 23, 2023 1:45 PM
> To: alsa-devel@alsa-project.org; vkoul@kernel.org; broonie@kernel.org
> Cc: vinod.koul@linaro.org; linux-kernel@vger.kernel.org; pierre-
> louis.bossart@linux.intel.com; Liao, Bard <bard.liao@intel.com>;
> tiwai@suse.de
> Subject: [PATCH 00/20] ASoC/soundwire: add support for ACE2.x
> 
> This series uses the abstraction added in past kernel cycles to provide
> support for the ACE2.x integration. The existing SHIM and Cadence
> registers are now split in 3 (SHIM, IP, SHIM vendor-specific), with some
> parts also moved to the HDaudio Extended Multi link structures. Nothing
> fundamentally different except for the register map.
> 
> This series only provides the basic mechanisms to expose SoundWire-based
> DAIs. The PCI parts and DSP management will be contributed later, and the
> DAI ops are now empty as well.
> 
> The change is mainly on SoundWire. It would be better to go through
> SoundWire tree.
> 
> Pierre-Louis Bossart (20):
>   ASoC: SOF: Intel: shim: add enum for ACE 2.0 IP used in LunarLake
>   soundwire: intel: add ACE2.x SHIM definitions
>   soundwire: intel_ace2x: add empty new ops for LunarLake
>   soundwire/ASOC: Intel: update offsets for LunarLake
>   soundwire: intel/cadence: set ip_offset at run-time
>   ASoC/soundwire: intel: pass hdac_bus pointer for link management
>   soundwire: intel: add eml_lock in the interface for new platforms
>   ASoC: SOF: Intel: hda: retrieve SoundWire eml_lock and pass pointer
>   soundwire: intel_init: use eml_lock parameter
>   soundwire: intel_ace2x: add debugfs support
>   soundwire: intel_ace2x: add link power-up/down helpers
>   soundwire: intel_ace2x: set SYNCPRD before powering-up
>   soundwire: intel_ace2x: configure link PHY
>   soundwire: intel_ace2x: add DAI registration
>   soundwire: intel_ace2x: add sync_arm/sync_go helpers
>   soundwire: intel_ace2x: use common helpers for bus start/stop
>   soundwire: intel_ace2x: enable wake support
>   soundwire: intel_ace2x: add check_cmdsync_unlocked helper
>   soundwire: bus: add new manager callback to deal with peripheral
>     enumeration
>   soundwire: intel_ace2x: add new_peripheral_assigned callback
> 
>  drivers/soundwire/Makefile              |   3 +-
>  drivers/soundwire/bus.c                 |   3 +
>  drivers/soundwire/cadence_master.h      |   2 +
>  drivers/soundwire/intel.h               |  16 +
>  drivers/soundwire/intel_ace2x.c         | 390 ++++++++++++++++++++++++
>  drivers/soundwire/intel_ace2x_debugfs.c | 147 +++++++++
>  drivers/soundwire/intel_auxdevice.c     |  17 ++
>  drivers/soundwire/intel_init.c          |  21 +-
>  include/linux/soundwire/sdw.h           |   3 +-
>  include/linux/soundwire/sdw_intel.h     |  88 ++++++
>  sound/soc/sof/intel/hda.c               |  31 +-
>  sound/soc/sof/intel/shim.h              |   1 +
>  12 files changed, 711 insertions(+), 11 deletions(-)
>  create mode 100644 drivers/soundwire/intel_ace2x.c
>  create mode 100644 drivers/soundwire/intel_ace2x_debugfs.c
> 
> --
> 2.25.1


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 01/20] ASoC: SOF: Intel: shim: add enum for ACE 2.0 IP used in LunarLake
  2023-03-23  5:44 ` [PATCH 01/20] ASoC: SOF: Intel: shim: add enum for ACE 2.0 IP used in LunarLake Bard Liao
@ 2023-03-23 14:18   ` Mark Brown
  0 siblings, 0 replies; 30+ messages in thread
From: Mark Brown @ 2023-03-23 14:18 UTC (permalink / raw)
  To: Bard Liao
  Cc: alsa-devel, vkoul, vinod.koul, linux-kernel,
	pierre-louis.bossart, bard.liao, tiwai

[-- Attachment #1: Type: text/plain, Size: 311 bytes --]

On Thu, Mar 23, 2023 at 01:44:33PM +0800, Bard Liao wrote:
> From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> 
> Add the new enum needed for SoundWire IP selection. The LunarLake PCI
> descriptors and DSP parts will be added at a later time.

Acked-by: Mark Brown <broonie@kernel.org>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 04/20] soundwire/ASOC: Intel: update offsets for LunarLake
  2023-03-23  5:44 ` [PATCH 04/20] soundwire/ASOC: Intel: update offsets " Bard Liao
@ 2023-03-23 14:18   ` Mark Brown
  0 siblings, 0 replies; 30+ messages in thread
From: Mark Brown @ 2023-03-23 14:18 UTC (permalink / raw)
  To: Bard Liao
  Cc: alsa-devel, vkoul, vinod.koul, linux-kernel,
	pierre-louis.bossart, bard.liao, tiwai

[-- Attachment #1: Type: text/plain, Size: 279 bytes --]

On Thu, Mar 23, 2023 at 01:44:36PM +0800, Bard Liao wrote:
> From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> 
> The previous settings are not applicable, use a flag to determine what
> the register layout is.

Acked-by: Mark Brown <broonie@kernel.org>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 06/20] ASoC/soundwire: intel: pass hdac_bus pointer for link management
  2023-03-23  5:44 ` [PATCH 06/20] ASoC/soundwire: intel: pass hdac_bus pointer for link management Bard Liao
@ 2023-03-23 14:19   ` Mark Brown
  0 siblings, 0 replies; 30+ messages in thread
From: Mark Brown @ 2023-03-23 14:19 UTC (permalink / raw)
  To: Bard Liao
  Cc: alsa-devel, vkoul, vinod.koul, linux-kernel,
	pierre-louis.bossart, bard.liao, tiwai

[-- Attachment #1: Type: text/plain, Size: 344 bytes --]

On Thu, Mar 23, 2023 at 01:44:38PM +0800, Bard Liao wrote:
> From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> 
> The hdac_bus pointer is used to access the extended link information
> and handle power management. Pass it from the SOF driver down to the
> auxiliary devices.

Acked-by: Mark Brown <broonie@kernel.org>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 08/20] ASoC: SOF: Intel: hda: retrieve SoundWire eml_lock and pass pointer
  2023-03-23  5:44 ` [PATCH 08/20] ASoC: SOF: Intel: hda: retrieve SoundWire eml_lock and pass pointer Bard Liao
@ 2023-03-23 14:20   ` Mark Brown
  0 siblings, 0 replies; 30+ messages in thread
From: Mark Brown @ 2023-03-23 14:20 UTC (permalink / raw)
  To: Bard Liao
  Cc: alsa-devel, vkoul, vinod.koul, linux-kernel,
	pierre-louis.bossart, bard.liao, tiwai

[-- Attachment #1: Type: text/plain, Size: 310 bytes --]

On Thu, Mar 23, 2023 at 01:44:40PM +0800, Bard Liao wrote:
> From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> 
> Use new helper and interface to make sure the HDaudio and SoundWire
> parts use the same mutex when accessing shared registers.

Acked-by: Mark Brown <broonie@kernel.org>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 00/20] ASoC/soundwire: add support for ACE2.x
  2023-03-23  5:44 [PATCH 00/20] ASoC/soundwire: add support for ACE2.x Bard Liao
                   ` (20 preceding siblings ...)
  2023-03-23 14:15 ` [PATCH 00/20] ASoC/soundwire: add support for ACE2.x Liao, Bard
@ 2023-04-12 10:07 ` Vinod Koul
  2023-04-12 14:11   ` Pierre-Louis Bossart
  21 siblings, 1 reply; 30+ messages in thread
From: Vinod Koul @ 2023-04-12 10:07 UTC (permalink / raw)
  To: Bard Liao
  Cc: alsa-devel, broonie, linux-kernel, pierre-louis.bossart,
	bard.liao, tiwai

On 23-03-23, 13:44, Bard Liao wrote:
> This series uses the abstraction added in past kernel cycles to provide
> support for the ACE2.x integration. The existing SHIM and Cadence

ACE2..?

> registers are now split in 3 (SHIM, IP, SHIM vendor-specific), with some
> parts also moved to the HDaudio Extended Multi link structures. Nothing
> fundamentally different except for the register map.
> 
> This series only provides the basic mechanisms to expose SoundWire-based
> DAIs. The PCI parts and DSP management will be contributed later, and the
> DAI ops are now empty as well.
> 
> The change is mainly on SoundWire. It would be better to go through
> SoundWire tree.
> 
> Pierre-Louis Bossart (20):
>   ASoC: SOF: Intel: shim: add enum for ACE 2.0 IP used in LunarLake
>   soundwire: intel: add ACE2.x SHIM definitions
>   soundwire: intel_ace2x: add empty new ops for LunarLake
>   soundwire/ASOC: Intel: update offsets for LunarLake
>   soundwire: intel/cadence: set ip_offset at run-time
>   ASoC/soundwire: intel: pass hdac_bus pointer for link management
>   soundwire: intel: add eml_lock in the interface for new platforms
>   ASoC: SOF: Intel: hda: retrieve SoundWire eml_lock and pass pointer
>   soundwire: intel_init: use eml_lock parameter
>   soundwire: intel_ace2x: add debugfs support
>   soundwire: intel_ace2x: add link power-up/down helpers
>   soundwire: intel_ace2x: set SYNCPRD before powering-up
>   soundwire: intel_ace2x: configure link PHY
>   soundwire: intel_ace2x: add DAI registration
>   soundwire: intel_ace2x: add sync_arm/sync_go helpers
>   soundwire: intel_ace2x: use common helpers for bus start/stop
>   soundwire: intel_ace2x: enable wake support
>   soundwire: intel_ace2x: add check_cmdsync_unlocked helper
>   soundwire: bus: add new manager callback to deal with peripheral
>     enumeration
>   soundwire: intel_ace2x: add new_peripheral_assigned callback
> 
>  drivers/soundwire/Makefile              |   3 +-
>  drivers/soundwire/bus.c                 |   3 +
>  drivers/soundwire/cadence_master.h      |   2 +
>  drivers/soundwire/intel.h               |  16 +
>  drivers/soundwire/intel_ace2x.c         | 390 ++++++++++++++++++++++++
>  drivers/soundwire/intel_ace2x_debugfs.c | 147 +++++++++
>  drivers/soundwire/intel_auxdevice.c     |  17 ++
>  drivers/soundwire/intel_init.c          |  21 +-
>  include/linux/soundwire/sdw.h           |   3 +-
>  include/linux/soundwire/sdw_intel.h     |  88 ++++++
>  sound/soc/sof/intel/hda.c               |  31 +-
>  sound/soc/sof/intel/shim.h              |   1 +
>  12 files changed, 711 insertions(+), 11 deletions(-)
>  create mode 100644 drivers/soundwire/intel_ace2x.c
>  create mode 100644 drivers/soundwire/intel_ace2x_debugfs.c
> 
> -- 
> 2.25.1

-- 
~Vinod

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 00/20] ASoC/soundwire: add support for ACE2.x
  2023-04-12 10:07 ` Vinod Koul
@ 2023-04-12 14:11   ` Pierre-Louis Bossart
  2023-04-12 15:22     ` Vinod Koul
  0 siblings, 1 reply; 30+ messages in thread
From: Pierre-Louis Bossart @ 2023-04-12 14:11 UTC (permalink / raw)
  To: Vinod Koul, Bard Liao; +Cc: alsa-devel, broonie, linux-kernel, bard.liao, tiwai



On 4/12/23 05:07, Vinod Koul wrote:
> On 23-03-23, 13:44, Bard Liao wrote:
>> This series uses the abstraction added in past kernel cycles to provide
>> support for the ACE2.x integration. The existing SHIM and Cadence
> 
> ACE2..?

Not sure I get the comment, this refers to the IP version.

ACE 2.0 IP used in LunarLake, x refers to future TDB versions.

BTW this depends on the series "[PATCH v2 00/18] ASoC: SOF: Intel:
hda-mlink: HDaudio multi-link extension update" applied yesterday by
Mark. It'd be really nice if we can have this in 6.4-rc1 to continue
adding the rest of the Lunar Lake patches.

We tried to limit the number of changes impacting both ASoC and
SoundWire subsystems but there's mechanically 2 merges needed (ASoC ->
SoundWire for the hda-mlink dependency and SoundWire->ASoC for the
interface changes below).

> 
>> registers are now split in 3 (SHIM, IP, SHIM vendor-specific), with some
>> parts also moved to the HDaudio Extended Multi link structures. Nothing
>> fundamentally different except for the register map.
>>
>> This series only provides the basic mechanisms to expose SoundWire-based
>> DAIs. The PCI parts and DSP management will be contributed later, and the
>> DAI ops are now empty as well.
>>
>> The change is mainly on SoundWire. It would be better to go through
>> SoundWire tree.
>>
>> Pierre-Louis Bossart (20):
>>   ASoC: SOF: Intel: shim: add enum for ACE 2.0 IP used in LunarLake
>>   soundwire: intel: add ACE2.x SHIM definitions
>>   soundwire: intel_ace2x: add empty new ops for LunarLake
>>   soundwire/ASOC: Intel: update offsets for LunarLake
>>   soundwire: intel/cadence: set ip_offset at run-time
>>   ASoC/soundwire: intel: pass hdac_bus pointer for link management
>>   soundwire: intel: add eml_lock in the interface for new platforms
>>   ASoC: SOF: Intel: hda: retrieve SoundWire eml_lock and pass pointer
>>   soundwire: intel_init: use eml_lock parameter
>>   soundwire: intel_ace2x: add debugfs support
>>   soundwire: intel_ace2x: add link power-up/down helpers
>>   soundwire: intel_ace2x: set SYNCPRD before powering-up
>>   soundwire: intel_ace2x: configure link PHY
>>   soundwire: intel_ace2x: add DAI registration
>>   soundwire: intel_ace2x: add sync_arm/sync_go helpers
>>   soundwire: intel_ace2x: use common helpers for bus start/stop
>>   soundwire: intel_ace2x: enable wake support
>>   soundwire: intel_ace2x: add check_cmdsync_unlocked helper
>>   soundwire: bus: add new manager callback to deal with peripheral
>>     enumeration
>>   soundwire: intel_ace2x: add new_peripheral_assigned callback
>>
>>  drivers/soundwire/Makefile              |   3 +-
>>  drivers/soundwire/bus.c                 |   3 +
>>  drivers/soundwire/cadence_master.h      |   2 +
>>  drivers/soundwire/intel.h               |  16 +
>>  drivers/soundwire/intel_ace2x.c         | 390 ++++++++++++++++++++++++
>>  drivers/soundwire/intel_ace2x_debugfs.c | 147 +++++++++
>>  drivers/soundwire/intel_auxdevice.c     |  17 ++
>>  drivers/soundwire/intel_init.c          |  21 +-
>>  include/linux/soundwire/sdw.h           |   3 +-
>>  include/linux/soundwire/sdw_intel.h     |  88 ++++++
>>  sound/soc/sof/intel/hda.c               |  31 +-
>>  sound/soc/sof/intel/shim.h              |   1 +
>>  12 files changed, 711 insertions(+), 11 deletions(-)
>>  create mode 100644 drivers/soundwire/intel_ace2x.c
>>  create mode 100644 drivers/soundwire/intel_ace2x_debugfs.c
>>
>> -- 
>> 2.25.1
> 

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 00/20] ASoC/soundwire: add support for ACE2.x
  2023-04-12 14:11   ` Pierre-Louis Bossart
@ 2023-04-12 15:22     ` Vinod Koul
  2023-04-12 16:06       ` Pierre-Louis Bossart
  0 siblings, 1 reply; 30+ messages in thread
From: Vinod Koul @ 2023-04-12 15:22 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: Bard Liao, alsa-devel, broonie, linux-kernel, bard.liao, tiwai

On 12-04-23, 09:11, Pierre-Louis Bossart wrote:
> 
> 
> On 4/12/23 05:07, Vinod Koul wrote:
> > On 23-03-23, 13:44, Bard Liao wrote:
> >> This series uses the abstraction added in past kernel cycles to provide
> >> support for the ACE2.x integration. The existing SHIM and Cadence
> > 
> > ACE2..?
> 
> Not sure I get the comment, this refers to the IP version.

What does ACE mean, it should be expanded so that people know what it
might refer to..?

> 
> ACE 2.0 IP used in LunarLake, x refers to future TDB versions.
> 
> BTW this depends on the series "[PATCH v2 00/18] ASoC: SOF: Intel:
> hda-mlink: HDaudio multi-link extension update" applied yesterday by
> Mark. It'd be really nice if we can have this in 6.4-rc1 to continue
> adding the rest of the Lunar Lake patches.

That should be mentioned in cover, I can ack this if okay and Mark might
apply..? or u folks have something else in mind?

> 
> We tried to limit the number of changes impacting both ASoC and
> SoundWire subsystems but there's mechanically 2 merges needed (ASoC ->
> SoundWire for the hda-mlink dependency and SoundWire->ASoC for the
> interface changes below).
> 
> > 
> >> registers are now split in 3 (SHIM, IP, SHIM vendor-specific), with some
> >> parts also moved to the HDaudio Extended Multi link structures. Nothing
> >> fundamentally different except for the register map.
> >>
> >> This series only provides the basic mechanisms to expose SoundWire-based
> >> DAIs. The PCI parts and DSP management will be contributed later, and the
> >> DAI ops are now empty as well.
> >>
> >> The change is mainly on SoundWire. It would be better to go through
> >> SoundWire tree.
> >>
> >> Pierre-Louis Bossart (20):
> >>   ASoC: SOF: Intel: shim: add enum for ACE 2.0 IP used in LunarLake
> >>   soundwire: intel: add ACE2.x SHIM definitions
> >>   soundwire: intel_ace2x: add empty new ops for LunarLake
> >>   soundwire/ASOC: Intel: update offsets for LunarLake
> >>   soundwire: intel/cadence: set ip_offset at run-time
> >>   ASoC/soundwire: intel: pass hdac_bus pointer for link management
> >>   soundwire: intel: add eml_lock in the interface for new platforms
> >>   ASoC: SOF: Intel: hda: retrieve SoundWire eml_lock and pass pointer
> >>   soundwire: intel_init: use eml_lock parameter
> >>   soundwire: intel_ace2x: add debugfs support
> >>   soundwire: intel_ace2x: add link power-up/down helpers
> >>   soundwire: intel_ace2x: set SYNCPRD before powering-up
> >>   soundwire: intel_ace2x: configure link PHY
> >>   soundwire: intel_ace2x: add DAI registration
> >>   soundwire: intel_ace2x: add sync_arm/sync_go helpers
> >>   soundwire: intel_ace2x: use common helpers for bus start/stop
> >>   soundwire: intel_ace2x: enable wake support
> >>   soundwire: intel_ace2x: add check_cmdsync_unlocked helper
> >>   soundwire: bus: add new manager callback to deal with peripheral
> >>     enumeration
> >>   soundwire: intel_ace2x: add new_peripheral_assigned callback
> >>
> >>  drivers/soundwire/Makefile              |   3 +-
> >>  drivers/soundwire/bus.c                 |   3 +
> >>  drivers/soundwire/cadence_master.h      |   2 +
> >>  drivers/soundwire/intel.h               |  16 +
> >>  drivers/soundwire/intel_ace2x.c         | 390 ++++++++++++++++++++++++
> >>  drivers/soundwire/intel_ace2x_debugfs.c | 147 +++++++++
> >>  drivers/soundwire/intel_auxdevice.c     |  17 ++
> >>  drivers/soundwire/intel_init.c          |  21 +-
> >>  include/linux/soundwire/sdw.h           |   3 +-
> >>  include/linux/soundwire/sdw_intel.h     |  88 ++++++
> >>  sound/soc/sof/intel/hda.c               |  31 +-
> >>  sound/soc/sof/intel/shim.h              |   1 +
> >>  12 files changed, 711 insertions(+), 11 deletions(-)
> >>  create mode 100644 drivers/soundwire/intel_ace2x.c
> >>  create mode 100644 drivers/soundwire/intel_ace2x_debugfs.c
> >>
> >> -- 
> >> 2.25.1
> > 

-- 
~Vinod

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 00/20] ASoC/soundwire: add support for ACE2.x
  2023-04-12 15:22     ` Vinod Koul
@ 2023-04-12 16:06       ` Pierre-Louis Bossart
  0 siblings, 0 replies; 30+ messages in thread
From: Pierre-Louis Bossart @ 2023-04-12 16:06 UTC (permalink / raw)
  To: Vinod Koul; +Cc: Bard Liao, alsa-devel, broonie, linux-kernel, bard.liao, tiwai



On 4/12/23 10:22, Vinod Koul wrote:
> On 12-04-23, 09:11, Pierre-Louis Bossart wrote:
>>
>>
>> On 4/12/23 05:07, Vinod Koul wrote:
>>> On 23-03-23, 13:44, Bard Liao wrote:
>>>> This series uses the abstraction added in past kernel cycles to provide
>>>> support for the ACE2.x integration. The existing SHIM and Cadence
>>>
>>> ACE2..?
>>
>> Not sure I get the comment, this refers to the IP version.
> 
> What does ACE mean, it should be expanded so that people know what it
> might refer to..?

I think at one point it stood for "Audio Converged Engine", which
doesn't really clarify anything, does it? It's easier for most people to
just refer to cAVS or ACE as a type of IP followed by a version number,
and use the mapping between the IP version and end-user device in the
PCI descriptors.

>> ACE 2.0 IP used in LunarLake, x refers to future TDB versions.
>>
>> BTW this depends on the series "[PATCH v2 00/18] ASoC: SOF: Intel:
>> hda-mlink: HDaudio multi-link extension update" applied yesterday by
>> Mark. It'd be really nice if we can have this in 6.4-rc1 to continue
>> adding the rest of the Lunar Lake patches.
> 
> That should be mentioned in cover, 

Yes the cover and some patches miss details, it's hard when you have
such a long series to be clear and avoid repetition at the same time...

> I can ack this if okay and Mark might apply..? or u folks have
something else in mind?

that would be ideal, but unfortunately this series will not apply as is
on Mark's for-next branch. I just checked, there are multiple conflicts
with the intel_bus_common stuff which is missing in Mark's tree.

Mark also provided his Acked-by tag already for patches 1/4/6/8, so I
was under the impression that these patches would be merged  through the
soundwire tree.

I think what's missing is a tag from Mark to make sure the hda-mlink
dependencies are in the soundwire tree?

>>
>> We tried to limit the number of changes impacting both ASoC and
>> SoundWire subsystems but there's mechanically 2 merges needed (ASoC ->
>> SoundWire for the hda-mlink dependency and SoundWire->ASoC for the
>> interface changes below).
>>
>>>
>>>> registers are now split in 3 (SHIM, IP, SHIM vendor-specific), with some
>>>> parts also moved to the HDaudio Extended Multi link structures. Nothing
>>>> fundamentally different except for the register map.
>>>>
>>>> This series only provides the basic mechanisms to expose SoundWire-based
>>>> DAIs. The PCI parts and DSP management will be contributed later, and the
>>>> DAI ops are now empty as well.
>>>>
>>>> The change is mainly on SoundWire. It would be better to go through
>>>> SoundWire tree.
>>>>
>>>> Pierre-Louis Bossart (20):
>>>>   ASoC: SOF: Intel: shim: add enum for ACE 2.0 IP used in LunarLake
>>>>   soundwire: intel: add ACE2.x SHIM definitions
>>>>   soundwire: intel_ace2x: add empty new ops for LunarLake
>>>>   soundwire/ASOC: Intel: update offsets for LunarLake
>>>>   soundwire: intel/cadence: set ip_offset at run-time
>>>>   ASoC/soundwire: intel: pass hdac_bus pointer for link management
>>>>   soundwire: intel: add eml_lock in the interface for new platforms
>>>>   ASoC: SOF: Intel: hda: retrieve SoundWire eml_lock and pass pointer
>>>>   soundwire: intel_init: use eml_lock parameter
>>>>   soundwire: intel_ace2x: add debugfs support
>>>>   soundwire: intel_ace2x: add link power-up/down helpers
>>>>   soundwire: intel_ace2x: set SYNCPRD before powering-up
>>>>   soundwire: intel_ace2x: configure link PHY
>>>>   soundwire: intel_ace2x: add DAI registration
>>>>   soundwire: intel_ace2x: add sync_arm/sync_go helpers
>>>>   soundwire: intel_ace2x: use common helpers for bus start/stop
>>>>   soundwire: intel_ace2x: enable wake support
>>>>   soundwire: intel_ace2x: add check_cmdsync_unlocked helper
>>>>   soundwire: bus: add new manager callback to deal with peripheral
>>>>     enumeration
>>>>   soundwire: intel_ace2x: add new_peripheral_assigned callback
>>>>
>>>>  drivers/soundwire/Makefile              |   3 +-
>>>>  drivers/soundwire/bus.c                 |   3 +
>>>>  drivers/soundwire/cadence_master.h      |   2 +
>>>>  drivers/soundwire/intel.h               |  16 +
>>>>  drivers/soundwire/intel_ace2x.c         | 390 ++++++++++++++++++++++++
>>>>  drivers/soundwire/intel_ace2x_debugfs.c | 147 +++++++++
>>>>  drivers/soundwire/intel_auxdevice.c     |  17 ++
>>>>  drivers/soundwire/intel_init.c          |  21 +-
>>>>  include/linux/soundwire/sdw.h           |   3 +-
>>>>  include/linux/soundwire/sdw_intel.h     |  88 ++++++
>>>>  sound/soc/sof/intel/hda.c               |  31 +-
>>>>  sound/soc/sof/intel/shim.h              |   1 +
>>>>  12 files changed, 711 insertions(+), 11 deletions(-)
>>>>  create mode 100644 drivers/soundwire/intel_ace2x.c
>>>>  create mode 100644 drivers/soundwire/intel_ace2x_debugfs.c
>>>>
>>>> -- 
>>>> 2.25.1
>>>
> 

^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2023-04-12 16:10 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-23  5:44 [PATCH 00/20] ASoC/soundwire: add support for ACE2.x Bard Liao
2023-03-23  5:44 ` [PATCH 01/20] ASoC: SOF: Intel: shim: add enum for ACE 2.0 IP used in LunarLake Bard Liao
2023-03-23 14:18   ` Mark Brown
2023-03-23  5:44 ` [PATCH 02/20] soundwire: intel: add ACE2.x SHIM definitions Bard Liao
2023-03-23  5:44 ` [PATCH 03/20] soundwire: intel_ace2x: add empty new ops for LunarLake Bard Liao
2023-03-23  5:44 ` [PATCH 04/20] soundwire/ASOC: Intel: update offsets " Bard Liao
2023-03-23 14:18   ` Mark Brown
2023-03-23  5:44 ` [PATCH 05/20] soundwire: intel/cadence: set ip_offset at run-time Bard Liao
2023-03-23  5:44 ` [PATCH 06/20] ASoC/soundwire: intel: pass hdac_bus pointer for link management Bard Liao
2023-03-23 14:19   ` Mark Brown
2023-03-23  5:44 ` [PATCH 07/20] soundwire: intel: add eml_lock in the interface for new platforms Bard Liao
2023-03-23  5:44 ` [PATCH 08/20] ASoC: SOF: Intel: hda: retrieve SoundWire eml_lock and pass pointer Bard Liao
2023-03-23 14:20   ` Mark Brown
2023-03-23  5:44 ` [PATCH 09/20] soundwire: intel_init: use eml_lock parameter Bard Liao
2023-03-23  5:44 ` [PATCH 10/20] soundwire: intel_ace2x: add debugfs support Bard Liao
2023-03-23  5:44 ` [PATCH 11/20] soundwire: intel_ace2x: add link power-up/down helpers Bard Liao
2023-03-23  5:44 ` [PATCH 12/20] soundwire: intel_ace2x: set SYNCPRD before powering-up Bard Liao
2023-03-23  5:44 ` [PATCH 13/20] soundwire: intel_ace2x: configure link PHY Bard Liao
2023-03-23  5:44 ` [PATCH 14/20] soundwire: intel_ace2x: add DAI registration Bard Liao
2023-03-23  5:44 ` [PATCH 15/20] soundwire: intel_ace2x: add sync_arm/sync_go helpers Bard Liao
2023-03-23  5:44 ` [PATCH 16/20] soundwire: intel_ace2x: use common helpers for bus start/stop Bard Liao
2023-03-23  5:44 ` [PATCH 17/20] soundwire: intel_ace2x: enable wake support Bard Liao
2023-03-23  5:44 ` [PATCH 18/20] soundwire: intel_ace2x: add check_cmdsync_unlocked helper Bard Liao
2023-03-23  5:44 ` [PATCH 19/20] soundwire: bus: add new manager callback to deal with peripheral enumeration Bard Liao
2023-03-23  5:44 ` [PATCH 20/20] soundwire: intel_ace2x: add new_peripheral_assigned callback Bard Liao
2023-03-23 14:15 ` [PATCH 00/20] ASoC/soundwire: add support for ACE2.x Liao, Bard
2023-04-12 10:07 ` Vinod Koul
2023-04-12 14:11   ` Pierre-Louis Bossart
2023-04-12 15:22     ` Vinod Koul
2023-04-12 16:06       ` Pierre-Louis Bossart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).