All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] ASoC: SOF: Intel: update D0i3 registers for MTL
@ 2022-11-07 16:41 Pierre-Louis Bossart
  2022-11-07 16:41 ` [PATCH 1/3] ASoC: SOF: Intel: add d0i3 definition " Pierre-Louis Bossart
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Pierre-Louis Bossart @ 2022-11-07 16:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, broonie, Pierre-Louis Bossart

MeteorLake relies on a different register for D0i3 configuration, add
a platform-specific callback to abstract the differences.

Rander Wang (3):
  ASoC: SOF: Intel: add d0i3 definition for MTL
  ASoC: SOF: Intel: add d0i3_offset in chip_info
  ASoC: SOF: Intel: set d0i3 register with d0i3_offset

 sound/soc/sof/intel/apl.c     |  1 +
 sound/soc/sof/intel/cnl.c     |  2 ++
 sound/soc/sof/intel/hda-dsp.c | 21 ++++++++++++++-------
 sound/soc/sof/intel/icl.c     |  1 +
 sound/soc/sof/intel/mtl.c     |  1 +
 sound/soc/sof/intel/mtl.h     |  2 ++
 sound/soc/sof/intel/shim.h    |  1 +
 sound/soc/sof/intel/tgl.c     |  4 ++++
 8 files changed, 26 insertions(+), 7 deletions(-)

-- 
2.34.1


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

* [PATCH 1/3] ASoC: SOF: Intel: add d0i3 definition for MTL
  2022-11-07 16:41 [PATCH 0/3] ASoC: SOF: Intel: update D0i3 registers for MTL Pierre-Louis Bossart
@ 2022-11-07 16:41 ` Pierre-Louis Bossart
  2022-11-07 16:41 ` [PATCH 2/3] ASoC: SOF: Intel: add d0i3_offset in chip_info Pierre-Louis Bossart
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Pierre-Louis Bossart @ 2022-11-07 16:41 UTC (permalink / raw)
  To: alsa-devel
  Cc: tiwai, Pierre-Louis Bossart, broonie, Ranjani Sridharan, Rander Wang

From: Rander Wang <rander.wang@intel.com>

MTL has a different offset of d0i3 compared to cavs platforms.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/sof/intel/mtl.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/soc/sof/intel/mtl.h b/sound/soc/sof/intel/mtl.h
index 788bf0e3ea87..0fd4e6fe09b8 100644
--- a/sound/soc/sof/intel/mtl.h
+++ b/sound/soc/sof/intel/mtl.h
@@ -21,6 +21,8 @@
 #define MTL_IRQ_INTEN_L_SOUNDWIRE_MASK	BIT(6)
 #define MTL_HFINTIPPTR_PTR_MASK		GENMASK(20, 0)
 
+#define MTL_HDA_VS_D0I3C		0x1D4A
+
 #define MTL_DSP2CXCAP_PRIMARY_CORE	0x178D00
 #define MTL_DSP2CXCTL_PRIMARY_CORE	0x178D04
 #define MTL_DSP2CXCTL_PRIMARY_CORE_SPA_MASK BIT(0)
-- 
2.34.1


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

* [PATCH 2/3] ASoC: SOF: Intel: add d0i3_offset in chip_info
  2022-11-07 16:41 [PATCH 0/3] ASoC: SOF: Intel: update D0i3 registers for MTL Pierre-Louis Bossart
  2022-11-07 16:41 ` [PATCH 1/3] ASoC: SOF: Intel: add d0i3 definition " Pierre-Louis Bossart
@ 2022-11-07 16:41 ` Pierre-Louis Bossart
  2022-11-07 16:41 ` [PATCH 3/3] ASoC: SOF: Intel: set d0i3 register with d0i3_offset Pierre-Louis Bossart
  2022-11-10 17:55 ` [PATCH 0/3] ASoC: SOF: Intel: update D0i3 registers for MTL Mark Brown
  3 siblings, 0 replies; 5+ messages in thread
From: Pierre-Louis Bossart @ 2022-11-07 16:41 UTC (permalink / raw)
  To: alsa-devel
  Cc: tiwai, Pierre-Louis Bossart, broonie, Ranjani Sridharan, Rander Wang

From: Rander Wang <rander.wang@intel.com>

MTL has different d0i3 offset compared to cavs platforms.
Use d0i3_offset to unify the setting.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/sof/intel/apl.c  | 1 +
 sound/soc/sof/intel/cnl.c  | 2 ++
 sound/soc/sof/intel/icl.c  | 1 +
 sound/soc/sof/intel/mtl.c  | 1 +
 sound/soc/sof/intel/shim.h | 1 +
 sound/soc/sof/intel/tgl.c  | 4 ++++
 6 files changed, 10 insertions(+)

diff --git a/sound/soc/sof/intel/apl.c b/sound/soc/sof/intel/apl.c
index d93b4ead3c37..0e7a7e4ad976 100644
--- a/sound/soc/sof/intel/apl.c
+++ b/sound/soc/sof/intel/apl.c
@@ -109,6 +109,7 @@ const struct sof_intel_dsp_desc apl_chip_info = {
 	.rom_init_timeout	= 150,
 	.ssp_count = APL_SSP_COUNT,
 	.ssp_base_offset = APL_SSP_BASE_OFFSET,
+	.d0i3_offset = SOF_HDA_VS_D0I3C,
 	.quirks = SOF_INTEL_PROCEN_FMT_QUIRK,
 	.check_ipc_irq	= hda_dsp_check_ipc_irq,
 	.cl_init = cl_dsp_init,
diff --git a/sound/soc/sof/intel/cnl.c b/sound/soc/sof/intel/cnl.c
index 2553afe6f27d..0aaa44bd49eb 100644
--- a/sound/soc/sof/intel/cnl.c
+++ b/sound/soc/sof/intel/cnl.c
@@ -456,6 +456,7 @@ const struct sof_intel_dsp_desc cnl_chip_info = {
 	.ssp_base_offset = CNL_SSP_BASE_OFFSET,
 	.sdw_shim_base = SDW_SHIM_BASE,
 	.sdw_alh_base = SDW_ALH_BASE,
+	.d0i3_offset = SOF_HDA_VS_D0I3C,
 	.check_sdw_irq	= hda_common_check_sdw_irq,
 	.check_ipc_irq	= hda_dsp_check_ipc_irq,
 	.cl_init = cl_dsp_init,
@@ -488,6 +489,7 @@ const struct sof_intel_dsp_desc jsl_chip_info = {
 	.ssp_base_offset = CNL_SSP_BASE_OFFSET,
 	.sdw_shim_base = SDW_SHIM_BASE,
 	.sdw_alh_base = SDW_ALH_BASE,
+	.d0i3_offset = SOF_HDA_VS_D0I3C,
 	.check_sdw_irq	= hda_common_check_sdw_irq,
 	.check_ipc_irq	= hda_dsp_check_ipc_irq,
 	.cl_init = cl_dsp_init,
diff --git a/sound/soc/sof/intel/icl.c b/sound/soc/sof/intel/icl.c
index f95b2ec57077..8dd51f489ba1 100644
--- a/sound/soc/sof/intel/icl.c
+++ b/sound/soc/sof/intel/icl.c
@@ -180,6 +180,7 @@ const struct sof_intel_dsp_desc icl_chip_info = {
 	.ssp_base_offset = CNL_SSP_BASE_OFFSET,
 	.sdw_shim_base = SDW_SHIM_BASE,
 	.sdw_alh_base = SDW_ALH_BASE,
+	.d0i3_offset = SOF_HDA_VS_D0I3C,
 	.check_sdw_irq	= hda_common_check_sdw_irq,
 	.check_ipc_irq	= hda_dsp_check_ipc_irq,
 	.cl_init = cl_dsp_init,
diff --git a/sound/soc/sof/intel/mtl.c b/sound/soc/sof/intel/mtl.c
index 91619036762b..7452a7dbb0e4 100644
--- a/sound/soc/sof/intel/mtl.c
+++ b/sound/soc/sof/intel/mtl.c
@@ -684,6 +684,7 @@ const struct sof_intel_dsp_desc mtl_chip_info = {
 	.ssp_base_offset = CNL_SSP_BASE_OFFSET,
 	.sdw_shim_base = SDW_SHIM_BASE_ACE,
 	.sdw_alh_base = SDW_ALH_BASE_ACE,
+	.d0i3_offset = MTL_HDA_VS_D0I3C,
 	.check_sdw_irq = mtl_dsp_check_sdw_irq,
 	.check_ipc_irq = mtl_dsp_check_ipc_irq,
 	.cl_init = mtl_dsp_cl_init,
diff --git a/sound/soc/sof/intel/shim.h b/sound/soc/sof/intel/shim.h
index 3ceba5c39317..3e777c500a56 100644
--- a/sound/soc/sof/intel/shim.h
+++ b/sound/soc/sof/intel/shim.h
@@ -182,6 +182,7 @@ struct sof_intel_dsp_desc {
 	int ssp_base_offset;		/* base address of the SSPs */
 	u32 sdw_shim_base;
 	u32 sdw_alh_base;
+	u32 d0i3_offset;
 	u32 quirks;
 	enum sof_intel_hw_ip_version hw_ip_version;
 	bool (*check_sdw_irq)(struct snd_sof_dev *sdev);
diff --git a/sound/soc/sof/intel/tgl.c b/sound/soc/sof/intel/tgl.c
index 143447f7c1ac..946044f440c9 100644
--- a/sound/soc/sof/intel/tgl.c
+++ b/sound/soc/sof/intel/tgl.c
@@ -135,6 +135,7 @@ const struct sof_intel_dsp_desc tgl_chip_info = {
 	.ssp_base_offset = CNL_SSP_BASE_OFFSET,
 	.sdw_shim_base = SDW_SHIM_BASE,
 	.sdw_alh_base = SDW_ALH_BASE,
+	.d0i3_offset = SOF_HDA_VS_D0I3C,
 	.check_sdw_irq	= hda_common_check_sdw_irq,
 	.check_ipc_irq	= hda_dsp_check_ipc_irq,
 	.cl_init = cl_dsp_init,
@@ -160,6 +161,7 @@ const struct sof_intel_dsp_desc tglh_chip_info = {
 	.ssp_base_offset = CNL_SSP_BASE_OFFSET,
 	.sdw_shim_base = SDW_SHIM_BASE,
 	.sdw_alh_base = SDW_ALH_BASE,
+	.d0i3_offset = SOF_HDA_VS_D0I3C,
 	.check_sdw_irq	= hda_common_check_sdw_irq,
 	.check_ipc_irq	= hda_dsp_check_ipc_irq,
 	.cl_init = cl_dsp_init,
@@ -185,6 +187,7 @@ const struct sof_intel_dsp_desc ehl_chip_info = {
 	.ssp_base_offset = CNL_SSP_BASE_OFFSET,
 	.sdw_shim_base = SDW_SHIM_BASE,
 	.sdw_alh_base = SDW_ALH_BASE,
+	.d0i3_offset = SOF_HDA_VS_D0I3C,
 	.check_sdw_irq	= hda_common_check_sdw_irq,
 	.check_ipc_irq	= hda_dsp_check_ipc_irq,
 	.cl_init = cl_dsp_init,
@@ -210,6 +213,7 @@ const struct sof_intel_dsp_desc adls_chip_info = {
 	.ssp_base_offset = CNL_SSP_BASE_OFFSET,
 	.sdw_shim_base = SDW_SHIM_BASE,
 	.sdw_alh_base = SDW_ALH_BASE,
+	.d0i3_offset = SOF_HDA_VS_D0I3C,
 	.check_sdw_irq	= hda_common_check_sdw_irq,
 	.check_ipc_irq	= hda_dsp_check_ipc_irq,
 	.cl_init = cl_dsp_init,
-- 
2.34.1


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

* [PATCH 3/3] ASoC: SOF: Intel: set d0i3 register with d0i3_offset
  2022-11-07 16:41 [PATCH 0/3] ASoC: SOF: Intel: update D0i3 registers for MTL Pierre-Louis Bossart
  2022-11-07 16:41 ` [PATCH 1/3] ASoC: SOF: Intel: add d0i3 definition " Pierre-Louis Bossart
  2022-11-07 16:41 ` [PATCH 2/3] ASoC: SOF: Intel: add d0i3_offset in chip_info Pierre-Louis Bossart
@ 2022-11-07 16:41 ` Pierre-Louis Bossart
  2022-11-10 17:55 ` [PATCH 0/3] ASoC: SOF: Intel: update D0i3 registers for MTL Mark Brown
  3 siblings, 0 replies; 5+ messages in thread
From: Pierre-Louis Bossart @ 2022-11-07 16:41 UTC (permalink / raw)
  To: alsa-devel
  Cc: tiwai, Pierre-Louis Bossart, broonie, Ranjani Sridharan, Rander Wang

From: Rander Wang <rander.wang@intel.com>

Set the d0i3 with d0i3_offset for different platforms

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/sof/intel/hda-dsp.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c
index 6d5c26a2147e..5fa29df54b42 100644
--- a/sound/soc/sof/intel/hda-dsp.c
+++ b/sound/soc/sof/intel/hda-dsp.c
@@ -348,8 +348,12 @@ void hda_dsp_ipc_int_disable(struct snd_sof_dev *sdev)
 static int hda_dsp_wait_d0i3c_done(struct snd_sof_dev *sdev)
 {
 	int retry = HDA_DSP_REG_POLL_RETRY_COUNT;
+	struct snd_sof_pdata *pdata = sdev->pdata;
+	const struct sof_intel_dsp_desc *chip;
 
-	while (snd_sof_dsp_read8(sdev, HDA_DSP_HDA_BAR, SOF_HDA_VS_D0I3C) & SOF_HDA_VS_D0I3C_CIP) {
+	chip = get_chip_info(pdata);
+	while (snd_sof_dsp_read8(sdev, HDA_DSP_HDA_BAR, chip->d0i3_offset) &
+		SOF_HDA_VS_D0I3C_CIP) {
 		if (!retry--)
 			return -ETIMEDOUT;
 		usleep_range(10, 15);
@@ -377,29 +381,32 @@ static int hda_dsp_send_pm_gate_ipc(struct snd_sof_dev *sdev, u32 flags)
 
 static int hda_dsp_update_d0i3c_register(struct snd_sof_dev *sdev, u8 value)
 {
-	struct hdac_bus *bus = sof_to_bus(sdev);
+	struct snd_sof_pdata *pdata = sdev->pdata;
+	const struct sof_intel_dsp_desc *chip;
 	int ret;
 	u8 reg;
 
+	chip = get_chip_info(pdata);
+
 	/* Write to D0I3C after Command-In-Progress bit is cleared */
 	ret = hda_dsp_wait_d0i3c_done(sdev);
 	if (ret < 0) {
-		dev_err(bus->dev, "CIP timeout before D0I3C update!\n");
+		dev_err(sdev->dev, "CIP timeout before D0I3C update!\n");
 		return ret;
 	}
 
 	/* Update D0I3C register */
-	snd_sof_dsp_update8(sdev, HDA_DSP_HDA_BAR,
-			    SOF_HDA_VS_D0I3C, SOF_HDA_VS_D0I3C_I3, value);
+	snd_sof_dsp_update8(sdev, HDA_DSP_HDA_BAR, chip->d0i3_offset,
+			    SOF_HDA_VS_D0I3C_I3, value);
 
 	/* Wait for cmd in progress to be cleared before exiting the function */
 	ret = hda_dsp_wait_d0i3c_done(sdev);
 	if (ret < 0) {
-		dev_err(bus->dev, "CIP timeout after D0I3C update!\n");
+		dev_err(sdev->dev, "CIP timeout after D0I3C update!\n");
 		return ret;
 	}
 
-	reg = snd_sof_dsp_read8(sdev, HDA_DSP_HDA_BAR, SOF_HDA_VS_D0I3C);
+	reg = snd_sof_dsp_read8(sdev, HDA_DSP_HDA_BAR, chip->d0i3_offset);
 	trace_sof_intel_D0I3C_updated(sdev, reg);
 
 	return 0;
-- 
2.34.1


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

* Re: [PATCH 0/3] ASoC: SOF: Intel: update D0i3 registers for MTL
  2022-11-07 16:41 [PATCH 0/3] ASoC: SOF: Intel: update D0i3 registers for MTL Pierre-Louis Bossart
                   ` (2 preceding siblings ...)
  2022-11-07 16:41 ` [PATCH 3/3] ASoC: SOF: Intel: set d0i3 register with d0i3_offset Pierre-Louis Bossart
@ 2022-11-10 17:55 ` Mark Brown
  3 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2022-11-10 17:55 UTC (permalink / raw)
  To: alsa-devel, Pierre-Louis Bossart; +Cc: tiwai

On Mon, 7 Nov 2022 10:41:51 -0600, Pierre-Louis Bossart wrote:
> MeteorLake relies on a different register for D0i3 configuration, add
> a platform-specific callback to abstract the differences.
> 
> Rander Wang (3):
>   ASoC: SOF: Intel: add d0i3 definition for MTL
>   ASoC: SOF: Intel: add d0i3_offset in chip_info
>   ASoC: SOF: Intel: set d0i3 register with d0i3_offset
> 
> [...]

Applied to

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

Thanks!

[1/3] ASoC: SOF: Intel: add d0i3 definition for MTL
      commit: 09e3c1d398bec1c9684f91563e82a2f455548448
[2/3] ASoC: SOF: Intel: add d0i3_offset in chip_info
      commit: f8632adc53e25501c74f25794cddac4dbe3f1c59
[3/3] ASoC: SOF: Intel: set d0i3 register with d0i3_offset
      commit: 57f93492410942355b5a6eacbbe977176ffe5110

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

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

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

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

Thanks,
Mark

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

end of thread, other threads:[~2022-11-10 17:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-07 16:41 [PATCH 0/3] ASoC: SOF: Intel: update D0i3 registers for MTL Pierre-Louis Bossart
2022-11-07 16:41 ` [PATCH 1/3] ASoC: SOF: Intel: add d0i3 definition " Pierre-Louis Bossart
2022-11-07 16:41 ` [PATCH 2/3] ASoC: SOF: Intel: add d0i3_offset in chip_info Pierre-Louis Bossart
2022-11-07 16:41 ` [PATCH 3/3] ASoC: SOF: Intel: set d0i3 register with d0i3_offset Pierre-Louis Bossart
2022-11-10 17:55 ` [PATCH 0/3] ASoC: SOF: Intel: update D0i3 registers for MTL Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.