alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [alsa-devel] [PATCH 00/26] ASoC: SOF: enable S0ix support for Intel platforms
@ 2019-10-25 22:40 Pierre-Louis Bossart
  2019-10-25 22:40 ` [alsa-devel] [PATCH 01/26] ASoC: SOF: add a field to store the current D0 substate of DSP Pierre-Louis Bossart
                   ` (25 more replies)
  0 siblings, 26 replies; 61+ messages in thread
From: Pierre-Louis Bossart @ 2019-10-25 22:40 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, broonie, Pierre-Louis Bossart

In S0ix (aka S0 Idle), the audio DSP can enter the D0i3 substate and
keep some of the pipelines and processing active for e.g. Hotwording
and other acoustic event detection while optimizing power
consumption. This patchset mainly adds flags and state machines to
track which streams may remain active (tagged as such in the topology
file), and keep them active when the ALSA core tries to suspend
everything.

The Intel specific parts are limited to the changes in the IPC, where
instead of using an SRAM window, the IPC commands needed to enter and
exit D0i3 are sent in a compressed form using IPC registers
themselves.

This patchset is made of 26 patches, which is rather large, but each
change is rather small and contained. The code was initially reviewed
on GitHub, with 165+ comments provided and no regressions found
[1]. The S0ix mode was tested on a CometLake platform.

Future improvements will consist in an additional idle detection so
that the D0i3 mode can be entered even on devices where S0ix is not
enabled.

[1] https://github.com/thesofproject/linux/pull/1337

Keyon Jie (26):
  ASoC: SOF: add a field to store the current D0 substate of DSP
  ASoC: SOF: reset default d0_substate at probe() and resume()
  ASoC: SOF: add set_power_state() to dsp_ops for power state update
  ASoC: SOF: Intel: hda-dsp: Add helper for setting DSP D0ix substate
  ASoC: SOF: Intel: CNL: add set_power_state() ops
  ASoC: SOF: Intel: APL: add set_power_state() ops
  ASoC: SOF: add flag to snd_sof_pcm_stream for D0i3 compatible stream
  ASoC: SOF: token: add tokens for PCM compatible with D0i3 substate
  ASoC: SOF: topology: parse and store d0i3_compatible flag
  ASoC: SOF: Intel: hda-dsp: align the comments for D0I3C update
  ASoC: SOF: Intel: HDA: use macro for register polling retry count
  ASoC: SOF: PM: rename sof_send_pm_ipc to sof_send_pm_ctx_ipc
  ASoC: SOF: ipc: introduce message for DSP power gating
  ASoC: SOF: Intel: hda-ipc: Don't read mailbox for PM_GATE reply
  ASoC: SOF: Intel: HDA: add cAVS specific compact IPC header file
  ASoC: SOF: configure D0ix IPC flags in set_power_state
  ASoC: SOF: PM: add helpers for setting D0 substate for ADSP
  ASoC: SOF: Intel: CNL: add support for sending compact IPC
  ASoC: SOF: add a flag to indicate the system suspend target
  ASoC: SOF: add a flag suspend_ignored for sof stream
  ASoC: SOF: PM: implement prepare/complete callbacks
  ASoC: SOF: ignore suspend/resume for D0ix compatible streams
  ASoC: SOF: Intel: hda-dsp: implement suspend/resume for S0ix<->S0
    transition
  ASoC: SOF: return -ENOTSUPP if D0I3 is not supported
  ASoC: SOF: PM: Add support for DSP D0i3 state when entering S0ix
  ASoC: SOF: pci: Add prepare/complete PM callbacks

 include/sound/sof/header.h      |  1 +
 include/sound/sof/pm.h          |  8 +++
 include/uapi/sound/sof/tokens.h |  4 ++
 sound/soc/sof/core.c            |  3 ++
 sound/soc/sof/intel/apl.c       |  1 +
 sound/soc/sof/intel/cnl.c       | 43 +++++++++++++--
 sound/soc/sof/intel/hda-dsp.c   | 91 +++++++++++++++++++++++++++++++
 sound/soc/sof/intel/hda-ipc.c   |  6 ++-
 sound/soc/sof/intel/hda-ipc.h   | 51 ++++++++++++++++++
 sound/soc/sof/intel/hda.h       | 12 +++++
 sound/soc/sof/ops.h             | 10 ++++
 sound/soc/sof/pcm.c             | 31 +++++++++++
 sound/soc/sof/pm.c              | 95 +++++++++++++++++++++++++++++++--
 sound/soc/sof/sof-pci-dev.c     |  2 +
 sound/soc/sof/sof-priv.h        | 23 ++++++++
 sound/soc/sof/topology.c        | 43 ++++++++++++++-
 16 files changed, 413 insertions(+), 11 deletions(-)
 create mode 100644 sound/soc/sof/intel/hda-ipc.h

-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] [PATCH 01/26] ASoC: SOF: add a field to store the current D0 substate of DSP
  2019-10-25 22:40 [alsa-devel] [PATCH 00/26] ASoC: SOF: enable S0ix support for Intel platforms Pierre-Louis Bossart
@ 2019-10-25 22:40 ` Pierre-Louis Bossart
  2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: add a field to store the current D0 substate of DSP" to the asoc tree Mark Brown
  2019-10-29 10:20   ` [alsa-devel] [PATCH 01/26] ASoC: SOF: add a field to store the current D0 substate of DSP Cezary Rojewski
  2019-10-25 22:40 ` [alsa-devel] [PATCH 02/26] ASoC: SOF: reset default d0_substate at probe() and resume() Pierre-Louis Bossart
                   ` (24 subsequent siblings)
  25 siblings, 2 replies; 61+ messages in thread
From: Pierre-Louis Bossart @ 2019-10-25 22:40 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, broonie, Keyon Jie, Pierre-Louis Bossart

From: Keyon Jie <yang.jie@linux.intel.com>

Add field d0_substate to struct snd_sof_dev to store the current DSP
D0 sub-state(only meaningful when DSP in D0), which could be D0I0 or
D0I3.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/sof/sof-priv.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h
index 2d40de5ee285..481dfe4ee2d0 100644
--- a/sound/soc/sof/sof-priv.h
+++ b/sound/soc/sof/sof-priv.h
@@ -68,6 +68,12 @@ extern int sof_core_debug;
 
 #define DMA_CHAN_INVALID	0xFFFFFFFF
 
+/* DSP D0ix sub-state */
+enum sof_d0_substate {
+	SOF_DSP_D0I0 = 0,	/* DSP default D0 substate */
+	SOF_DSP_D0I3,		/* DSP D0i3(low power) substate*/
+};
+
 struct snd_sof_dev;
 struct snd_sof_ipc_msg;
 struct snd_sof_ipc;
@@ -387,6 +393,9 @@ struct snd_sof_dev {
 	 */
 	struct snd_soc_component_driver plat_drv;
 
+	/* power states related */
+	enum sof_d0_substate d0_substate;
+
 	/* DSP firmware boot */
 	wait_queue_head_t boot_wait;
 	u32 boot_complete;
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] [PATCH 02/26] ASoC: SOF: reset default d0_substate at probe() and resume()
  2019-10-25 22:40 [alsa-devel] [PATCH 00/26] ASoC: SOF: enable S0ix support for Intel platforms Pierre-Louis Bossart
  2019-10-25 22:40 ` [alsa-devel] [PATCH 01/26] ASoC: SOF: add a field to store the current D0 substate of DSP Pierre-Louis Bossart
@ 2019-10-25 22:40 ` Pierre-Louis Bossart
  2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: reset default d0_substate at probe() and resume()" to the asoc tree Mark Brown
  2019-10-25 22:40 ` [alsa-devel] [PATCH 03/26] ASoC: SOF: add set_power_state() to dsp_ops for power state update Pierre-Louis Bossart
                   ` (23 subsequent siblings)
  25 siblings, 1 reply; 61+ messages in thread
From: Pierre-Louis Bossart @ 2019-10-25 22:40 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, broonie, Keyon Jie, Pierre-Louis Bossart

From: Keyon Jie <yang.jie@linux.intel.com>

We initialize/reset d0_substate to default d0i0 value when doing
transition D3-->D0, e.g. at success of probing and resuming.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/sof/core.c | 3 +++
 sound/soc/sof/pm.c   | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/sound/soc/sof/core.c b/sound/soc/sof/core.c
index 5998861a9002..8661c2cca76b 100644
--- a/sound/soc/sof/core.c
+++ b/sound/soc/sof/core.c
@@ -458,6 +458,9 @@ int snd_sof_device_probe(struct device *dev, struct snd_sof_pdata *plat_data)
 	/* initialize sof device */
 	sdev->dev = dev;
 
+	/* initialize default D0 sub-state */
+	sdev->d0_substate = SOF_DSP_D0I0;
+
 	sdev->pdata = plat_data;
 	sdev->first_boot = true;
 	dev_set_drvdata(dev, sdev);
diff --git a/sound/soc/sof/pm.c b/sound/soc/sof/pm.c
index e23beaeefe00..81e623dfc7e5 100644
--- a/sound/soc/sof/pm.c
+++ b/sound/soc/sof/pm.c
@@ -326,6 +326,9 @@ static int sof_resume(struct device *dev, bool runtime_resume)
 			"error: ctx_restore ipc error during resume %d\n",
 			ret);
 
+	/* initialize default D0 sub-state */
+	sdev->d0_substate = SOF_DSP_D0I0;
+
 	return ret;
 }
 
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] [PATCH 03/26] ASoC: SOF: add set_power_state() to dsp_ops for power state update
  2019-10-25 22:40 [alsa-devel] [PATCH 00/26] ASoC: SOF: enable S0ix support for Intel platforms Pierre-Louis Bossart
  2019-10-25 22:40 ` [alsa-devel] [PATCH 01/26] ASoC: SOF: add a field to store the current D0 substate of DSP Pierre-Louis Bossart
  2019-10-25 22:40 ` [alsa-devel] [PATCH 02/26] ASoC: SOF: reset default d0_substate at probe() and resume() Pierre-Louis Bossart
@ 2019-10-25 22:40 ` Pierre-Louis Bossart
  2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: add set_power_state() to dsp_ops for power state update" to the asoc tree Mark Brown
  2019-10-25 22:41 ` [alsa-devel] [PATCH 04/26] ASoC: SOF: Intel: hda-dsp: Add helper for setting DSP D0ix substate Pierre-Louis Bossart
                   ` (22 subsequent siblings)
  25 siblings, 1 reply; 61+ messages in thread
From: Pierre-Louis Bossart @ 2019-10-25 22:40 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, broonie, Keyon Jie, Pierre-Louis Bossart

From: Keyon Jie <yang.jie@linux.intel.com>

D0i3 is a platform-defined substate of D0, so we need a
platform-specific callback in dsp_ops to handle the relevant
configurations.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/sof/ops.h      | 9 +++++++++
 sound/soc/sof/sof-priv.h | 2 ++
 2 files changed, 11 insertions(+)

diff --git a/sound/soc/sof/ops.h b/sound/soc/sof/ops.h
index 824d36fe59fd..d7c8fc06f961 100644
--- a/sound/soc/sof/ops.h
+++ b/sound/soc/sof/ops.h
@@ -193,6 +193,15 @@ static inline int snd_sof_dsp_set_clk(struct snd_sof_dev *sdev, u32 freq)
 	return 0;
 }
 
+static inline int snd_sof_dsp_set_power_state(struct snd_sof_dev *sdev,
+					      enum sof_d0_substate substate)
+{
+	if (sof_ops(sdev)->set_power_state)
+		return sof_ops(sdev)->set_power_state(sdev, substate);
+
+	return 0;
+}
+
 /* debug */
 static inline void snd_sof_dsp_dbg_dump(struct snd_sof_dev *sdev, u32 flags)
 {
diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h
index 481dfe4ee2d0..e9902e4e8e55 100644
--- a/sound/soc/sof/sof-priv.h
+++ b/sound/soc/sof/sof-priv.h
@@ -189,6 +189,8 @@ struct snd_sof_dsp_ops {
 	int (*runtime_resume)(struct snd_sof_dev *sof_dev); /* optional */
 	int (*runtime_idle)(struct snd_sof_dev *sof_dev); /* optional */
 	int (*set_hw_params_upon_resume)(struct snd_sof_dev *sdev); /* optional */
+	int (*set_power_state)(struct snd_sof_dev *sdev,
+			       enum sof_d0_substate d0_substate); /* optional */
 
 	/* DSP clocking */
 	int (*set_clk)(struct snd_sof_dev *sof_dev, u32 freq); /* optional */
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] [PATCH 04/26] ASoC: SOF: Intel: hda-dsp: Add helper for setting DSP D0ix substate
  2019-10-25 22:40 [alsa-devel] [PATCH 00/26] ASoC: SOF: enable S0ix support for Intel platforms Pierre-Louis Bossart
                   ` (2 preceding siblings ...)
  2019-10-25 22:40 ` [alsa-devel] [PATCH 03/26] ASoC: SOF: add set_power_state() to dsp_ops for power state update Pierre-Louis Bossart
@ 2019-10-25 22:41 ` Pierre-Louis Bossart
  2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: Intel: hda-dsp: Add helper for setting DSP D0ix substate" to the asoc tree Mark Brown
  2019-10-29 10:07   ` [alsa-devel] [PATCH 04/26] ASoC: SOF: Intel: hda-dsp: Add helper for setting DSP D0ix substate Cezary Rojewski
  2019-10-25 22:41 ` [alsa-devel] [PATCH 05/26] ASoC: SOF: Intel: CNL: add set_power_state() ops Pierre-Louis Bossart
                   ` (21 subsequent siblings)
  25 siblings, 2 replies; 61+ messages in thread
From: Pierre-Louis Bossart @ 2019-10-25 22:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, broonie, Keyon Jie, Pierre-Louis Bossart

From: Keyon Jie <yang.jie@linux.intel.com>

Adding helper to implement setting dsp to d0i3 or d0i0 status, this will
be needed for driver D0ix support.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/sof/intel/hda-dsp.c | 46 +++++++++++++++++++++++++++++++++++
 sound/soc/sof/intel/hda.h     | 10 ++++++++
 2 files changed, 56 insertions(+)

diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c
index 3ea401646e0c..fa2f1f66c72c 100644
--- a/sound/soc/sof/intel/hda-dsp.c
+++ b/sound/soc/sof/intel/hda-dsp.c
@@ -306,6 +306,52 @@ void hda_dsp_ipc_int_disable(struct snd_sof_dev *sdev)
 			HDA_DSP_REG_HIPCCTL_BUSY | HDA_DSP_REG_HIPCCTL_DONE, 0);
 }
 
+static int hda_dsp_wait_d0i3c_done(struct snd_sof_dev *sdev, int retry)
+{
+	struct hdac_bus *bus = sof_to_bus(sdev);
+
+	while (snd_hdac_chip_readb(bus, VS_D0I3C) & SOF_HDA_VS_D0I3C_CIP) {
+		if (!retry--)
+			return -ETIMEDOUT;
+		usleep_range(10, 15);
+	}
+
+	return 0;
+}
+
+int hda_dsp_set_power_state(struct snd_sof_dev *sdev,
+			    enum sof_d0_substate d0_substate)
+{
+	struct hdac_bus *bus = sof_to_bus(sdev);
+	int retry = 50;
+	int ret;
+	u8 value;
+
+	/* Write to D0I3C after Command-In-Progress bit is cleared */
+	ret = hda_dsp_wait_d0i3c_done(sdev, retry);
+	if (ret < 0) {
+		dev_err(bus->dev, "CIP timeout before update D0I3C!\n");
+		return ret;
+	}
+
+	/* Update D0I3C register */
+	value = d0_substate == SOF_DSP_D0I3 ? SOF_HDA_VS_D0I3C_I3 : 0;
+	snd_hdac_chip_updateb(bus, VS_D0I3C, SOF_HDA_VS_D0I3C_I3, value);
+
+	/* Wait for cmd in progress to be cleared before exiting the function */
+	retry = 50;
+	ret = hda_dsp_wait_d0i3c_done(sdev, retry);
+	if (ret < 0) {
+		dev_err(bus->dev, "CIP timeout after D0I3C updated!\n");
+		return ret;
+	}
+
+	dev_vdbg(bus->dev, "D0I3C updated, register = 0x%x\n",
+		 snd_hdac_chip_readb(bus, VS_D0I3C));
+
+	return 0;
+}
+
 static int hda_suspend(struct snd_sof_dev *sdev, bool runtime_suspend)
 {
 	struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h
index ea02bf40cb25..0e7c366b8f71 100644
--- a/sound/soc/sof/intel/hda.h
+++ b/sound/soc/sof/intel/hda.h
@@ -64,6 +64,13 @@
 #define SOF_HDA_PPCTL_PIE		BIT(31)
 #define SOF_HDA_PPCTL_GPROCEN		BIT(30)
 
+/*Vendor Specific Registers*/
+#define SOF_HDA_VS_D0I3C		0x104A
+
+/* D0I3C Register fields */
+#define SOF_HDA_VS_D0I3C_CIP		BIT(0) /* Command-In-Progress */
+#define SOF_HDA_VS_D0I3C_I3		BIT(2) /* D0i3 enable bit */
+
 /* DPIB entry size: 8 Bytes = 2 DWords */
 #define SOF_HDA_DPIB_ENTRY_SIZE	0x8
 
@@ -455,6 +462,9 @@ int hda_dsp_core_reset_power_down(struct snd_sof_dev *sdev,
 void hda_dsp_ipc_int_enable(struct snd_sof_dev *sdev);
 void hda_dsp_ipc_int_disable(struct snd_sof_dev *sdev);
 
+int hda_dsp_set_power_state(struct snd_sof_dev *sdev,
+			    enum sof_d0_substate d0_substate);
+
 int hda_dsp_suspend(struct snd_sof_dev *sdev);
 int hda_dsp_resume(struct snd_sof_dev *sdev);
 int hda_dsp_runtime_suspend(struct snd_sof_dev *sdev);
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] [PATCH 05/26] ASoC: SOF: Intel: CNL: add set_power_state() ops
  2019-10-25 22:40 [alsa-devel] [PATCH 00/26] ASoC: SOF: enable S0ix support for Intel platforms Pierre-Louis Bossart
                   ` (3 preceding siblings ...)
  2019-10-25 22:41 ` [alsa-devel] [PATCH 04/26] ASoC: SOF: Intel: hda-dsp: Add helper for setting DSP D0ix substate Pierre-Louis Bossart
@ 2019-10-25 22:41 ` Pierre-Louis Bossart
  2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: Intel: CNL: add set_power_state() ops" to the asoc tree Mark Brown
  2019-10-25 22:41 ` [alsa-devel] [PATCH 06/26] ASoC: SOF: Intel: APL: add set_power_state() ops Pierre-Louis Bossart
                   ` (20 subsequent siblings)
  25 siblings, 1 reply; 61+ messages in thread
From: Pierre-Louis Bossart @ 2019-10-25 22:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, broonie, Keyon Jie, Pierre-Louis Bossart

From: Keyon Jie <yang.jie@linux.intel.com>

Using hda_dsp_set_power_state() as set_power_state() ops for cnl to do
d0ix platform configuration updates.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/sof/intel/cnl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/soc/sof/intel/cnl.c b/sound/soc/sof/intel/cnl.c
index e9cdcc040fb5..982b81a0b13a 100644
--- a/sound/soc/sof/intel/cnl.c
+++ b/sound/soc/sof/intel/cnl.c
@@ -255,6 +255,7 @@ const struct snd_sof_dsp_ops sof_cnl_ops = {
 	.runtime_resume		= hda_dsp_runtime_resume,
 	.runtime_idle		= hda_dsp_runtime_idle,
 	.set_hw_params_upon_resume = hda_dsp_set_hw_params_upon_resume,
+	.set_power_state	= hda_dsp_set_power_state,
 
 	/* ALSA HW info flags */
 	.hw_info =	SNDRV_PCM_INFO_MMAP |
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] [PATCH 06/26] ASoC: SOF: Intel: APL: add set_power_state() ops
  2019-10-25 22:40 [alsa-devel] [PATCH 00/26] ASoC: SOF: enable S0ix support for Intel platforms Pierre-Louis Bossart
                   ` (4 preceding siblings ...)
  2019-10-25 22:41 ` [alsa-devel] [PATCH 05/26] ASoC: SOF: Intel: CNL: add set_power_state() ops Pierre-Louis Bossart
@ 2019-10-25 22:41 ` Pierre-Louis Bossart
  2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: Intel: APL: add set_power_state() ops" to the asoc tree Mark Brown
  2019-10-25 22:41 ` [alsa-devel] [PATCH 07/26] ASoC: SOF: add flag to snd_sof_pcm_stream for D0i3 compatible stream Pierre-Louis Bossart
                   ` (19 subsequent siblings)
  25 siblings, 1 reply; 61+ messages in thread
From: Pierre-Louis Bossart @ 2019-10-25 22:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, broonie, Keyon Jie, Pierre-Louis Bossart

From: Keyon Jie <yang.jie@linux.intel.com>

Using hda_dsp_set_power_state() as set_power_state() ops for apl to do
d0ix platform configuration updates.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/sof/intel/apl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/soc/sof/intel/apl.c b/sound/soc/sof/intel/apl.c
index 15d26e8d90a9..7daa8eb456c8 100644
--- a/sound/soc/sof/intel/apl.c
+++ b/sound/soc/sof/intel/apl.c
@@ -97,6 +97,7 @@ const struct snd_sof_dsp_ops sof_apl_ops = {
 	.runtime_resume		= hda_dsp_runtime_resume,
 	.runtime_idle		= hda_dsp_runtime_idle,
 	.set_hw_params_upon_resume = hda_dsp_set_hw_params_upon_resume,
+	.set_power_state	= hda_dsp_set_power_state,
 
 	/* ALSA HW info flags */
 	.hw_info =	SNDRV_PCM_INFO_MMAP |
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] [PATCH 07/26] ASoC: SOF: add flag to snd_sof_pcm_stream for D0i3 compatible stream
  2019-10-25 22:40 [alsa-devel] [PATCH 00/26] ASoC: SOF: enable S0ix support for Intel platforms Pierre-Louis Bossart
                   ` (5 preceding siblings ...)
  2019-10-25 22:41 ` [alsa-devel] [PATCH 06/26] ASoC: SOF: Intel: APL: add set_power_state() ops Pierre-Louis Bossart
@ 2019-10-25 22:41 ` Pierre-Louis Bossart
  2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: add flag to snd_sof_pcm_stream for D0i3 compatible stream" to the asoc tree Mark Brown
  2019-10-25 22:41 ` [alsa-devel] [PATCH 08/26] ASoC: SOF: token: add tokens for PCM compatible with D0i3 substate Pierre-Louis Bossart
                   ` (18 subsequent siblings)
  25 siblings, 1 reply; 61+ messages in thread
From: Pierre-Louis Bossart @ 2019-10-25 22:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, broonie, Keyon Jie, Pierre-Louis Bossart

From: Keyon Jie <yang.jie@linux.intel.com>

Add flag d0i3_compatible to struct snd_sof_pcm_stream to denote if the
stream can tolerate a transition to the D0i3 substate while opened (thus
seen as 'active' by pm_runtime).

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/sof/sof-priv.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h
index e9902e4e8e55..7a21a45d3635 100644
--- a/sound/soc/sof/sof-priv.h
+++ b/sound/soc/sof/sof-priv.h
@@ -310,6 +310,7 @@ struct snd_sof_pcm_stream {
 	struct sof_ipc_stream_posn posn;
 	struct snd_pcm_substream *substream;
 	struct work_struct period_elapsed_work;
+	bool d0i3_compatible; /* DSP can be in D0I3 when this pcm is opened */
 };
 
 /* ALSA SOF PCM device */
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] [PATCH 08/26] ASoC: SOF: token: add tokens for PCM compatible with D0i3 substate
  2019-10-25 22:40 [alsa-devel] [PATCH 00/26] ASoC: SOF: enable S0ix support for Intel platforms Pierre-Louis Bossart
                   ` (6 preceding siblings ...)
  2019-10-25 22:41 ` [alsa-devel] [PATCH 07/26] ASoC: SOF: add flag to snd_sof_pcm_stream for D0i3 compatible stream Pierre-Louis Bossart
@ 2019-10-25 22:41 ` Pierre-Louis Bossart
  2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: token: add tokens for PCM compatible with D0i3 substate" to the asoc tree Mark Brown
  2019-10-29 10:11   ` [alsa-devel] [PATCH 08/26] ASoC: SOF: token: add tokens for PCM compatible with D0i3 substate Cezary Rojewski
  2019-10-25 22:41 ` [alsa-devel] [PATCH 09/26] ASoC: SOF: topology: parse and store d0i3_compatible flag Pierre-Louis Bossart
                   ` (17 subsequent siblings)
  25 siblings, 2 replies; 61+ messages in thread
From: Pierre-Louis Bossart @ 2019-10-25 22:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, broonie, Keyon Jie, Pierre-Louis Bossart

From: Keyon Jie <yang.jie@linux.intel.com>

Add stream token SOF_TKN_STREAM_PLAYBACK_COMPATIBLE_D0I3 and
SOF_TKN_STREAM_CAPTURE_COMPATIBLE_D0I3 to denote if the stream can be
opened at low power d0i3 status or not.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 include/uapi/sound/sof/tokens.h |  4 ++++
 sound/soc/sof/topology.c        | 10 ++++++++++
 2 files changed, 14 insertions(+)

diff --git a/include/uapi/sound/sof/tokens.h b/include/uapi/sound/sof/tokens.h
index d65406f34361..76883e6fb750 100644
--- a/include/uapi/sound/sof/tokens.h
+++ b/include/uapi/sound/sof/tokens.h
@@ -113,6 +113,10 @@
 /* ESAI */
 #define SOF_TKN_IMX_ESAI_MCLK_ID		1100
 
+/* Stream */
+#define SOF_TKN_STREAM_PLAYBACK_COMPATIBLE_D0I3	1200
+#define SOF_TKN_STREAM_CAPTURE_COMPATIBLE_D0I3	1201
+
 /* Led control for mute switches */
 #define SOF_TKN_MUTE_LED_USE			1300
 #define SOF_TKN_MUTE_LED_DIRECTION		1301
diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c
index b3ab6f23fc93..121e5d6f8477 100644
--- a/sound/soc/sof/topology.c
+++ b/sound/soc/sof/topology.c
@@ -567,6 +567,16 @@ static const struct sof_topology_token pcm_tokens[] = {
 		offsetof(struct sof_ipc_comp_host, dmac_config), 0},
 };
 
+/* PCM */
+static const struct sof_topology_token stream_tokens[] = {
+	{SOF_TKN_STREAM_PLAYBACK_COMPATIBLE_D0I3,
+		SND_SOC_TPLG_TUPLE_TYPE_BOOL, get_token_u16,
+		offsetof(struct snd_sof_pcm, stream[0].d0i3_compatible), 0},
+	{SOF_TKN_STREAM_CAPTURE_COMPATIBLE_D0I3,
+		SND_SOC_TPLG_TUPLE_TYPE_BOOL, get_token_u16,
+		offsetof(struct snd_sof_pcm, stream[1].d0i3_compatible), 0},
+};
+
 /* Generic components */
 static const struct sof_topology_token comp_tokens[] = {
 	{SOF_TKN_COMP_PERIOD_SINK_COUNT,
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] [PATCH 09/26] ASoC: SOF: topology: parse and store d0i3_compatible flag
  2019-10-25 22:40 [alsa-devel] [PATCH 00/26] ASoC: SOF: enable S0ix support for Intel platforms Pierre-Louis Bossart
                   ` (7 preceding siblings ...)
  2019-10-25 22:41 ` [alsa-devel] [PATCH 08/26] ASoC: SOF: token: add tokens for PCM compatible with D0i3 substate Pierre-Louis Bossart
@ 2019-10-25 22:41 ` Pierre-Louis Bossart
  2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: topology: parse and store d0i3_compatible flag" to the asoc tree Mark Brown
  2019-10-25 22:41 ` [alsa-devel] [PATCH 10/26] ASoC: SOF: Intel: hda-dsp: align the comments for D0I3C update Pierre-Louis Bossart
                   ` (16 subsequent siblings)
  25 siblings, 1 reply; 61+ messages in thread
From: Pierre-Louis Bossart @ 2019-10-25 22:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, broonie, Keyon Jie, Pierre-Louis Bossart

From: Keyon Jie <yang.jie@linux.intel.com>

Parses the token from tplg file and store it to snd_sof_pcm_stream
d0i3_compatible flag, which can be used later for d0ix transition
management.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/sof/topology.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c
index 121e5d6f8477..cc138ac6a8eb 100644
--- a/sound/soc/sof/topology.c
+++ b/sound/soc/sof/topology.c
@@ -2307,6 +2307,7 @@ static int sof_dai_load(struct snd_soc_component *scomp, int index,
 {
 	struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp);
 	struct snd_soc_tplg_stream_caps *caps;
+	struct snd_soc_tplg_private *private = &pcm->priv;
 	struct snd_sof_pcm *spcm;
 	int stream = SNDRV_PCM_STREAM_PLAYBACK;
 	int ret = 0;
@@ -2329,10 +2330,22 @@ static int sof_dai_load(struct snd_soc_component *scomp, int index,
 	dai_drv->dobj.private = spcm;
 	list_add(&spcm->list, &sdev->pcm_list);
 
+	ret = sof_parse_tokens(scomp, spcm, stream_tokens,
+			       ARRAY_SIZE(stream_tokens), private->array,
+			       le32_to_cpu(private->size));
+	if (ret) {
+		dev_err(sdev->dev, "error: parse stream tokens failed %d\n",
+			le32_to_cpu(private->size));
+		return ret;
+	}
+
 	/* do we need to allocate playback PCM DMA pages */
 	if (!spcm->pcm.playback)
 		goto capture;
 
+	dev_vdbg(sdev->dev, "tplg: pcm %s stream tokens: playback d0i3:%d\n",
+		 spcm->pcm.pcm_name, spcm->stream[0].d0i3_compatible);
+
 	caps = &spcm->pcm.caps[stream];
 
 	/* allocate playback page table buffer */
@@ -2360,6 +2373,9 @@ static int sof_dai_load(struct snd_soc_component *scomp, int index,
 	if (!spcm->pcm.capture)
 		return ret;
 
+	dev_vdbg(sdev->dev, "tplg: pcm %s stream tokens: capture d0i3:%d\n",
+		 spcm->pcm.pcm_name, spcm->stream[1].d0i3_compatible);
+
 	caps = &spcm->pcm.caps[stream];
 
 	/* allocate capture page table buffer */
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] [PATCH 10/26] ASoC: SOF: Intel: hda-dsp: align the comments for D0I3C update
  2019-10-25 22:40 [alsa-devel] [PATCH 00/26] ASoC: SOF: enable S0ix support for Intel platforms Pierre-Louis Bossart
                   ` (8 preceding siblings ...)
  2019-10-25 22:41 ` [alsa-devel] [PATCH 09/26] ASoC: SOF: topology: parse and store d0i3_compatible flag Pierre-Louis Bossart
@ 2019-10-25 22:41 ` Pierre-Louis Bossart
  2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: Intel: hda-dsp: align the comments for D0I3C update" to the asoc tree Mark Brown
  2019-10-25 22:41 ` [alsa-devel] [PATCH 11/26] ASoC: SOF: Intel: HDA: use macro for register polling retry count Pierre-Louis Bossart
                   ` (15 subsequent siblings)
  25 siblings, 1 reply; 61+ messages in thread
From: Pierre-Louis Bossart @ 2019-10-25 22:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, broonie, Keyon Jie, Pierre-Louis Bossart

From: Keyon Jie <yang.jie@linux.intel.com>

Align the logs for CIP timeout at D0I3C.I3 updating.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/sof/intel/hda-dsp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c
index fa2f1f66c72c..74805a066183 100644
--- a/sound/soc/sof/intel/hda-dsp.c
+++ b/sound/soc/sof/intel/hda-dsp.c
@@ -330,7 +330,7 @@ int hda_dsp_set_power_state(struct snd_sof_dev *sdev,
 	/* Write to D0I3C after Command-In-Progress bit is cleared */
 	ret = hda_dsp_wait_d0i3c_done(sdev, retry);
 	if (ret < 0) {
-		dev_err(bus->dev, "CIP timeout before update D0I3C!\n");
+		dev_err(bus->dev, "CIP timeout before D0I3C update!\n");
 		return ret;
 	}
 
@@ -342,7 +342,7 @@ int hda_dsp_set_power_state(struct snd_sof_dev *sdev,
 	retry = 50;
 	ret = hda_dsp_wait_d0i3c_done(sdev, retry);
 	if (ret < 0) {
-		dev_err(bus->dev, "CIP timeout after D0I3C updated!\n");
+		dev_err(bus->dev, "CIP timeout after D0I3C update!\n");
 		return ret;
 	}
 
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] [PATCH 11/26] ASoC: SOF: Intel: HDA: use macro for register polling retry count
  2019-10-25 22:40 [alsa-devel] [PATCH 00/26] ASoC: SOF: enable S0ix support for Intel platforms Pierre-Louis Bossart
                   ` (9 preceding siblings ...)
  2019-10-25 22:41 ` [alsa-devel] [PATCH 10/26] ASoC: SOF: Intel: hda-dsp: align the comments for D0I3C update Pierre-Louis Bossart
@ 2019-10-25 22:41 ` Pierre-Louis Bossart
  2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: Intel: HDA: use macro for register polling retry count" to the asoc tree Mark Brown
  2019-10-25 22:41 ` [alsa-devel] [PATCH 12/26] ASoC: SOF: PM: rename sof_send_pm_ipc to sof_send_pm_ctx_ipc Pierre-Louis Bossart
                   ` (14 subsequent siblings)
  25 siblings, 1 reply; 61+ messages in thread
From: Pierre-Louis Bossart @ 2019-10-25 22:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, broonie, Keyon Jie, Pierre-Louis Bossart

From: Keyon Jie <yang.jie@linux.intel.com>

Define macro and use it for the register polling retry count.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/sof/intel/hda-dsp.c | 6 ++----
 sound/soc/sof/intel/hda.h     | 1 +
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c
index 74805a066183..936361bd25e9 100644
--- a/sound/soc/sof/intel/hda-dsp.c
+++ b/sound/soc/sof/intel/hda-dsp.c
@@ -323,12 +323,11 @@ int hda_dsp_set_power_state(struct snd_sof_dev *sdev,
 			    enum sof_d0_substate d0_substate)
 {
 	struct hdac_bus *bus = sof_to_bus(sdev);
-	int retry = 50;
 	int ret;
 	u8 value;
 
 	/* Write to D0I3C after Command-In-Progress bit is cleared */
-	ret = hda_dsp_wait_d0i3c_done(sdev, retry);
+	ret = hda_dsp_wait_d0i3c_done(sdev, HDA_DSP_REG_POLL_RETRY_COUNT);
 	if (ret < 0) {
 		dev_err(bus->dev, "CIP timeout before D0I3C update!\n");
 		return ret;
@@ -339,8 +338,7 @@ int hda_dsp_set_power_state(struct snd_sof_dev *sdev,
 	snd_hdac_chip_updateb(bus, VS_D0I3C, SOF_HDA_VS_D0I3C_I3, value);
 
 	/* Wait for cmd in progress to be cleared before exiting the function */
-	retry = 50;
-	ret = hda_dsp_wait_d0i3c_done(sdev, retry);
+	ret = hda_dsp_wait_d0i3c_done(sdev, HDA_DSP_REG_POLL_RETRY_COUNT);
 	if (ret < 0) {
 		dev_err(bus->dev, "CIP timeout after D0I3C update!\n");
 		return ret;
diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h
index 0e7c366b8f71..99ec60218c16 100644
--- a/sound/soc/sof/intel/hda.h
+++ b/sound/soc/sof/intel/hda.h
@@ -214,6 +214,7 @@
 #define HDA_DSP_CTRL_RESET_TIMEOUT		100
 #define HDA_DSP_WAIT_TIMEOUT		500	/* 500 msec */
 #define HDA_DSP_REG_POLL_INTERVAL_US		500	/* 0.5 msec */
+#define HDA_DSP_REG_POLL_RETRY_COUNT		50
 
 #define HDA_DSP_ADSPIC_IPC			1
 #define HDA_DSP_ADSPIS_IPC			1
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] [PATCH 12/26] ASoC: SOF: PM: rename sof_send_pm_ipc to sof_send_pm_ctx_ipc
  2019-10-25 22:40 [alsa-devel] [PATCH 00/26] ASoC: SOF: enable S0ix support for Intel platforms Pierre-Louis Bossart
                   ` (10 preceding siblings ...)
  2019-10-25 22:41 ` [alsa-devel] [PATCH 11/26] ASoC: SOF: Intel: HDA: use macro for register polling retry count Pierre-Louis Bossart
@ 2019-10-25 22:41 ` Pierre-Louis Bossart
  2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: PM: rename sof_send_pm_ipc to sof_send_pm_ctx_ipc" to the asoc tree Mark Brown
  2019-10-25 22:41 ` [alsa-devel] [PATCH 13/26] ASoC: SOF: ipc: introduce message for DSP power gating Pierre-Louis Bossart
                   ` (13 subsequent siblings)
  25 siblings, 1 reply; 61+ messages in thread
From: Pierre-Louis Bossart @ 2019-10-25 22:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, broonie, Keyon Jie, Pierre-Louis Bossart

From: Keyon Jie <yang.jie@linux.intel.com>

The helper sof_send_pm_ipc() is only suitable for context save/restore
IPCs' sending, so rename it to sof_send_pm_ctx_ipc here.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/sof/pm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/soc/sof/pm.c b/sound/soc/sof/pm.c
index 81e623dfc7e5..ac900fb3379e 100644
--- a/sound/soc/sof/pm.c
+++ b/sound/soc/sof/pm.c
@@ -197,7 +197,7 @@ static int sof_restore_pipelines(struct snd_sof_dev *sdev)
 	return ret;
 }
 
-static int sof_send_pm_ipc(struct snd_sof_dev *sdev, int cmd)
+static int sof_send_pm_ctx_ipc(struct snd_sof_dev *sdev, int cmd)
 {
 	struct sof_ipc_pm_ctx pm_ctx;
 	struct sof_ipc_reply reply;
@@ -320,7 +320,7 @@ static int sof_resume(struct device *dev, bool runtime_resume)
 	}
 
 	/* notify DSP of system resume */
-	ret = sof_send_pm_ipc(sdev, SOF_IPC_PM_CTX_RESTORE);
+	ret = sof_send_pm_ctx_ipc(sdev, SOF_IPC_PM_CTX_RESTORE);
 	if (ret < 0)
 		dev_err(sdev->dev,
 			"error: ctx_restore ipc error during resume %d\n",
@@ -361,7 +361,7 @@ static int sof_suspend(struct device *dev, bool runtime_suspend)
 		sof_cache_debugfs(sdev);
 #endif
 	/* notify DSP of upcoming power down */
-	ret = sof_send_pm_ipc(sdev, SOF_IPC_PM_CTX_SAVE);
+	ret = sof_send_pm_ctx_ipc(sdev, SOF_IPC_PM_CTX_SAVE);
 	if (ret == -EBUSY || ret == -EAGAIN) {
 		/*
 		 * runtime PM has logic to handle -EBUSY/-EAGAIN so
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] [PATCH 13/26] ASoC: SOF: ipc: introduce message for DSP power gating
  2019-10-25 22:40 [alsa-devel] [PATCH 00/26] ASoC: SOF: enable S0ix support for Intel platforms Pierre-Louis Bossart
                   ` (11 preceding siblings ...)
  2019-10-25 22:41 ` [alsa-devel] [PATCH 12/26] ASoC: SOF: PM: rename sof_send_pm_ipc to sof_send_pm_ctx_ipc Pierre-Louis Bossart
@ 2019-10-25 22:41 ` Pierre-Louis Bossart
  2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: ipc: introduce message for DSP power gating" to the asoc tree Mark Brown
  2019-10-25 22:41 ` [alsa-devel] [PATCH 14/26] ASoC: SOF: Intel: hda-ipc: Don't read mailbox for PM_GATE reply Pierre-Louis Bossart
                   ` (12 subsequent siblings)
  25 siblings, 1 reply; 61+ messages in thread
From: Pierre-Louis Bossart @ 2019-10-25 22:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, broonie, Keyon Jie, Pierre-Louis Bossart

From: Keyon Jie <yang.jie@linux.intel.com>

Add new ipc messages which will be sent from driver to FW, to ask FW to
enter specific power saving state.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 include/sound/sof/header.h | 1 +
 include/sound/sof/pm.h     | 8 ++++++++
 2 files changed, 9 insertions(+)

diff --git a/include/sound/sof/header.h b/include/sound/sof/header.h
index 332143ff7278..bf3edd9c08b4 100644
--- a/include/sound/sof/header.h
+++ b/include/sound/sof/header.h
@@ -75,6 +75,7 @@
 #define SOF_IPC_PM_CLK_GET			SOF_CMD_TYPE(0x005)
 #define SOF_IPC_PM_CLK_REQ			SOF_CMD_TYPE(0x006)
 #define SOF_IPC_PM_CORE_ENABLE			SOF_CMD_TYPE(0x007)
+#define SOF_IPC_PM_GATE				SOF_CMD_TYPE(0x008)
 
 /* component runtime config - multiple different types */
 #define SOF_IPC_COMP_SET_VALUE			SOF_CMD_TYPE(0x001)
diff --git a/include/sound/sof/pm.h b/include/sound/sof/pm.h
index 003879401d63..3cf2e0f39d94 100644
--- a/include/sound/sof/pm.h
+++ b/include/sound/sof/pm.h
@@ -45,4 +45,12 @@ struct sof_ipc_pm_core_config {
 	uint32_t enable_mask;
 } __packed;
 
+struct sof_ipc_pm_gate {
+	struct sof_ipc_cmd_hdr hdr;
+	uint32_t flags;	/* platform specific */
+
+	/* reserved for future use */
+	uint32_t reserved[5];
+} __packed;
+
 #endif
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] [PATCH 14/26] ASoC: SOF: Intel: hda-ipc: Don't read mailbox for PM_GATE reply
  2019-10-25 22:40 [alsa-devel] [PATCH 00/26] ASoC: SOF: enable S0ix support for Intel platforms Pierre-Louis Bossart
                   ` (12 preceding siblings ...)
  2019-10-25 22:41 ` [alsa-devel] [PATCH 13/26] ASoC: SOF: ipc: introduce message for DSP power gating Pierre-Louis Bossart
@ 2019-10-25 22:41 ` Pierre-Louis Bossart
  2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: Intel: hda-ipc: Don't read mailbox for PM_GATE reply" to the asoc tree Mark Brown
  2019-10-25 22:41 ` [alsa-devel] [PATCH 15/26] ASoC: SOF: Intel: HDA: add cAVS specific compact IPC header file Pierre-Louis Bossart
                   ` (11 subsequent siblings)
  25 siblings, 1 reply; 61+ messages in thread
From: Pierre-Louis Bossart @ 2019-10-25 22:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, broonie, Keyon Jie, Pierre-Louis Bossart

From: Keyon Jie <yang.jie@linux.intel.com>

Memory windows could be powered off before receiving PM_GATE IPC reply
from FW, we can't read the mailbox to get reply.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/sof/intel/hda-ipc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sound/soc/sof/intel/hda-ipc.c b/sound/soc/sof/intel/hda-ipc.c
index 6aae6f18b3dc..0fd2153c1769 100644
--- a/sound/soc/sof/intel/hda-ipc.c
+++ b/sound/soc/sof/intel/hda-ipc.c
@@ -83,10 +83,12 @@ void hda_dsp_ipc_get_reply(struct snd_sof_dev *sdev)
 	}
 
 	hdr = msg->msg_data;
-	if (hdr->cmd == (SOF_IPC_GLB_PM_MSG | SOF_IPC_PM_CTX_SAVE)) {
+	if (hdr->cmd == (SOF_IPC_GLB_PM_MSG | SOF_IPC_PM_CTX_SAVE) ||
+	    hdr->cmd == (SOF_IPC_GLB_PM_MSG | SOF_IPC_PM_GATE)) {
 		/*
 		 * memory windows are powered off before sending IPC reply,
-		 * so we can't read the mailbox for CTX_SAVE reply.
+		 * so we can't read the mailbox for CTX_SAVE and PM_GATE
+		 * replies.
 		 */
 		reply.error = 0;
 		reply.hdr.cmd = SOF_IPC_GLB_REPLY;
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] [PATCH 15/26] ASoC: SOF: Intel: HDA: add cAVS specific compact IPC header file
  2019-10-25 22:40 [alsa-devel] [PATCH 00/26] ASoC: SOF: enable S0ix support for Intel platforms Pierre-Louis Bossart
                   ` (13 preceding siblings ...)
  2019-10-25 22:41 ` [alsa-devel] [PATCH 14/26] ASoC: SOF: Intel: hda-ipc: Don't read mailbox for PM_GATE reply Pierre-Louis Bossart
@ 2019-10-25 22:41 ` Pierre-Louis Bossart
  2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: Intel: HDA: add cAVS specific compact IPC header file" to the asoc tree Mark Brown
  2019-10-25 22:41 ` [alsa-devel] [PATCH 16/26] ASoC: SOF: configure D0ix IPC flags in set_power_state Pierre-Louis Bossart
                   ` (10 subsequent siblings)
  25 siblings, 1 reply; 61+ messages in thread
From: Pierre-Louis Bossart @ 2019-10-25 22:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, broonie, Keyon Jie, Pierre-Louis Bossart

From: Keyon Jie <yang.jie@linux.intel.com>

On cAVS platforms, some IPCs are required to be sent via IPC registers
only(e.g. when in D0i3, mailbox is unaccessible), add hda-ipc.h to hold
definition of those compact IPCs.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/sof/intel/hda-ipc.h | 51 +++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)
 create mode 100644 sound/soc/sof/intel/hda-ipc.h

diff --git a/sound/soc/sof/intel/hda-ipc.h b/sound/soc/sof/intel/hda-ipc.h
new file mode 100644
index 000000000000..aef0ceac9803
--- /dev/null
+++ b/sound/soc/sof/intel/hda-ipc.h
@@ -0,0 +1,51 @@
+/* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */
+/*
+ * This file is provided under a dual BSD/GPLv2 license.  When using or
+ * redistributing this file, you may do so under either license.
+ *
+ * Copyright(c) 2019 Intel Corporation. All rights reserved.
+ *
+ * Author: Keyon Jie <yang.jie@linux.intel.com>
+ */
+
+#ifndef __SOF_INTEL_HDA_IPC_H
+#define __SOF_INTEL_HDA_IPC_H
+
+/*
+ * Primary register, mapped to
+ * - DIPCTDR (HIPCIDR) in sideband IPC (cAVS 1.8+)
+ * - DIPCT in cAVS 1.5 IPC
+ *
+ * Secondary register, mapped to:
+ * - DIPCTDD (HIPCIDD) in sideband IPC (cAVS 1.8+)
+ * - DIPCTE in cAVS 1.5 IPC
+ */
+
+/* Common bits in primary register */
+
+/* Reserved for doorbell */
+#define HDA_IPC_RSVD_31		BIT(31)
+/* Target, 0 - normal message, 1 - compact message(cAVS compatible) */
+#define HDA_IPC_MSG_COMPACT	BIT(30)
+/* Direction, 0 - request, 1 - response */
+#define HDA_IPC_RSP		BIT(29)
+
+#define HDA_IPC_TYPE_SHIFT	24
+#define HDA_IPC_TYPE_MASK	GENMASK(28, 24)
+#define HDA_IPC_TYPE(x)		((x) << HDA_IPC_TYPE_SHIFT)
+
+#define HDA_IPC_PM_GATE		HDA_IPC_TYPE(0x8U)
+
+/* Command specific payload bits in secondary register */
+
+/* Disable DMA tracing (0 - keep tracing, 1 - to disable DMA trace) */
+#define HDA_PM_NO_DMA_TRACE	BIT(4)
+/* Prevent clock gating (0 - cg allowed, 1 - DSP clock always on) */
+#define HDA_PM_PCG		BIT(3)
+/* Prevent power gating (0 - deep power state transitions allowed) */
+#define HDA_PM_PPG		BIT(2)
+/* Indicates whether streaming is active */
+#define HDA_PM_PG_STREAMING	BIT(1)
+#define HDA_PM_PG_RSVD		BIT(0)
+
+#endif
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] [PATCH 16/26] ASoC: SOF: configure D0ix IPC flags in set_power_state
  2019-10-25 22:40 [alsa-devel] [PATCH 00/26] ASoC: SOF: enable S0ix support for Intel platforms Pierre-Louis Bossart
                   ` (14 preceding siblings ...)
  2019-10-25 22:41 ` [alsa-devel] [PATCH 15/26] ASoC: SOF: Intel: HDA: add cAVS specific compact IPC header file Pierre-Louis Bossart
@ 2019-10-25 22:41 ` Pierre-Louis Bossart
  2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: configure D0ix IPC flags in set_power_state" to the asoc tree Mark Brown
  2019-10-29 10:37   ` [alsa-devel] [PATCH 16/26] ASoC: SOF: configure D0ix IPC flags in set_power_state Cezary Rojewski
  2019-10-25 22:41 ` [alsa-devel] [PATCH 17/26] ASoC: SOF: PM: add helpers for setting D0 substate for ADSP Pierre-Louis Bossart
                   ` (9 subsequent siblings)
  25 siblings, 2 replies; 61+ messages in thread
From: Pierre-Louis Bossart @ 2019-10-25 22:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, broonie, Keyon Jie, Pierre-Louis Bossart

From: Keyon Jie <yang.jie@linux.intel.com>

The configuration for D0ix in FW is platform specific, let's do this and
send IPC in the platform set_power_state() ops.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/sof/intel/hda-dsp.c | 32 +++++++++++++++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)

diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c
index 936361bd25e9..b5070409a5e3 100644
--- a/sound/soc/sof/intel/hda-dsp.c
+++ b/sound/soc/sof/intel/hda-dsp.c
@@ -19,6 +19,7 @@
 #include <sound/hda_register.h>
 #include "../ops.h"
 #include "hda.h"
+#include "hda-ipc.h"
 
 /*
  * DSP Core control.
@@ -319,10 +320,28 @@ static int hda_dsp_wait_d0i3c_done(struct snd_sof_dev *sdev, int retry)
 	return 0;
 }
 
+static int hda_dsp_send_pm_gate_ipc(struct snd_sof_dev *sdev, u32 flags)
+{
+	struct sof_ipc_pm_gate pm_gate;
+	struct sof_ipc_reply reply;
+
+	memset(&pm_gate, 0, sizeof(pm_gate));
+
+	/* configure pm_gate ipc message */
+	pm_gate.hdr.size = sizeof(pm_gate);
+	pm_gate.hdr.cmd = SOF_IPC_GLB_PM_MSG | SOF_IPC_PM_GATE;
+	pm_gate.flags = flags;
+
+	/* send pm_gate ipc to dsp */
+	return sof_ipc_tx_message(sdev->ipc, pm_gate.hdr.cmd, &pm_gate,
+				  sizeof(pm_gate), &reply, sizeof(reply));
+}
+
 int hda_dsp_set_power_state(struct snd_sof_dev *sdev,
 			    enum sof_d0_substate d0_substate)
 {
 	struct hdac_bus *bus = sof_to_bus(sdev);
+	u32 flags;
 	int ret;
 	u8 value;
 
@@ -347,7 +366,18 @@ int hda_dsp_set_power_state(struct snd_sof_dev *sdev,
 	dev_vdbg(bus->dev, "D0I3C updated, register = 0x%x\n",
 		 snd_hdac_chip_readb(bus, VS_D0I3C));
 
-	return 0;
+	if (d0_substate == SOF_DSP_D0I0)
+		flags = HDA_PM_PPG;/* prevent power gating in D0 */
+	else
+		flags = HDA_PM_NO_DMA_TRACE;/* disable DMA trace in D0I3*/
+
+	/* sending pm_gate IPC */
+	ret = hda_dsp_send_pm_gate_ipc(sdev, flags);
+	if (ret < 0)
+		dev_err(sdev->dev,
+			"error: PM_GATE ipc error %d\n", ret);
+
+	return ret;
 }
 
 static int hda_suspend(struct snd_sof_dev *sdev, bool runtime_suspend)
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] [PATCH 17/26] ASoC: SOF: PM: add helpers for setting D0 substate for ADSP
  2019-10-25 22:40 [alsa-devel] [PATCH 00/26] ASoC: SOF: enable S0ix support for Intel platforms Pierre-Louis Bossart
                   ` (15 preceding siblings ...)
  2019-10-25 22:41 ` [alsa-devel] [PATCH 16/26] ASoC: SOF: configure D0ix IPC flags in set_power_state Pierre-Louis Bossart
@ 2019-10-25 22:41 ` Pierre-Louis Bossart
  2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: PM: add helpers for setting D0 substate for ADSP" to the asoc tree Mark Brown
  2019-10-29 10:44   ` [alsa-devel] [PATCH 17/26] ASoC: SOF: PM: add helpers for setting D0 substate for ADSP Cezary Rojewski
  2019-10-25 22:41 ` [alsa-devel] [PATCH 18/26] ASoC: SOF: Intel: CNL: add support for sending compact IPC Pierre-Louis Bossart
                   ` (8 subsequent siblings)
  25 siblings, 2 replies; 61+ messages in thread
From: Pierre-Louis Bossart @ 2019-10-25 22:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, broonie, Keyon Jie, Pierre-Louis Bossart

From: Keyon Jie <yang.jie@linux.intel.com>

Add snd_sof_set_d0_substate() helper for setting ADSP to a specific D0
substate, it will call into the platform specific implementation, and
update the d0_substate at success.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/sof/pm.c       | 17 +++++++++++++++++
 sound/soc/sof/sof-priv.h |  2 ++
 2 files changed, 19 insertions(+)

diff --git a/sound/soc/sof/pm.c b/sound/soc/sof/pm.c
index ac900fb3379e..584241e9734a 100644
--- a/sound/soc/sof/pm.c
+++ b/sound/soc/sof/pm.c
@@ -411,6 +411,23 @@ int snd_sof_runtime_resume(struct device *dev)
 }
 EXPORT_SYMBOL(snd_sof_runtime_resume);
 
+int snd_sof_set_d0_substate(struct snd_sof_dev *sdev,
+			    enum sof_d0_substate d0_substate)
+{
+	int ret;
+
+	/* do platform specific set_state */
+	ret = snd_sof_dsp_set_power_state(sdev, d0_substate);
+	if (ret < 0)
+		return ret;
+
+	/* update dsp D0 sub-state */
+	sdev->d0_substate = d0_substate;
+
+	return 0;
+}
+EXPORT_SYMBOL(snd_sof_set_d0_substate);
+
 int snd_sof_resume(struct device *dev)
 {
 	return sof_resume(dev, false);
diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h
index 7a21a45d3635..2231c673c678 100644
--- a/sound/soc/sof/sof-priv.h
+++ b/sound/soc/sof/sof-priv.h
@@ -485,6 +485,8 @@ int snd_sof_runtime_resume(struct device *dev);
 int snd_sof_runtime_idle(struct device *dev);
 int snd_sof_resume(struct device *dev);
 int snd_sof_suspend(struct device *dev);
+int snd_sof_set_d0_substate(struct snd_sof_dev *sdev,
+			    enum sof_d0_substate d0_substate);
 
 void snd_sof_new_platform_drv(struct snd_sof_dev *sdev);
 
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] [PATCH 18/26] ASoC: SOF: Intel: CNL: add support for sending compact IPC
  2019-10-25 22:40 [alsa-devel] [PATCH 00/26] ASoC: SOF: enable S0ix support for Intel platforms Pierre-Louis Bossart
                   ` (16 preceding siblings ...)
  2019-10-25 22:41 ` [alsa-devel] [PATCH 17/26] ASoC: SOF: PM: add helpers for setting D0 substate for ADSP Pierre-Louis Bossart
@ 2019-10-25 22:41 ` Pierre-Louis Bossart
  2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: Intel: CNL: add support for sending compact IPC" to the asoc tree Mark Brown
  2019-10-25 22:41 ` [alsa-devel] [PATCH 19/26] ASoC: SOF: add a flag to indicate the system suspend target Pierre-Louis Bossart
                   ` (7 subsequent siblings)
  25 siblings, 1 reply; 61+ messages in thread
From: Pierre-Louis Bossart @ 2019-10-25 22:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, broonie, Keyon Jie, Pierre-Louis Bossart

From: Keyon Jie <yang.jie@linux.intel.com>

For compact IPCs, we will send the IPC header/command via the HIPCIDR
register and the first 32bit payload via the HIPCIDD register, no
mailbox will be used.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/sof/intel/cnl.c | 42 ++++++++++++++++++++++++++++++++++-----
 sound/soc/sof/intel/hda.h |  1 +
 2 files changed, 38 insertions(+), 5 deletions(-)

diff --git a/sound/soc/sof/intel/cnl.c b/sound/soc/sof/intel/cnl.c
index 982b81a0b13a..0e1e265f3f3b 100644
--- a/sound/soc/sof/intel/cnl.c
+++ b/sound/soc/sof/intel/cnl.c
@@ -17,6 +17,7 @@
 
 #include "../ops.h"
 #include "hda.h"
+#include "hda-ipc.h"
 
 static const struct snd_sof_debugfs_map cnl_dsp_debugfs[] = {
 	{"hda", HDA_DSP_HDA_BAR, 0, 0x4000, SOF_DEBUGFS_ACCESS_ALWAYS},
@@ -150,14 +151,45 @@ static void cnl_ipc_dsp_done(struct snd_sof_dev *sdev)
 				CNL_DSP_REG_HIPCCTL_DONE);
 }
 
+static bool cnl_compact_ipc_compress(struct snd_sof_ipc_msg *msg,
+				     u32 *dr, u32 *dd)
+{
+	struct sof_ipc_pm_gate *pm_gate;
+
+	if (msg->header == (SOF_IPC_GLB_PM_MSG | SOF_IPC_PM_GATE)) {
+		pm_gate = msg->msg_data;
+
+		/* send the compact message via the primary register */
+		*dr = HDA_IPC_MSG_COMPACT | HDA_IPC_PM_GATE;
+
+		/* send payload via the extended data register */
+		*dd = pm_gate->flags;
+
+		return true;
+	}
+
+	return false;
+}
+
 static int cnl_ipc_send_msg(struct snd_sof_dev *sdev,
 			    struct snd_sof_ipc_msg *msg)
 {
-	/* send the message */
-	sof_mailbox_write(sdev, sdev->host_box.offset, msg->msg_data,
-			  msg->msg_size);
-	snd_sof_dsp_write(sdev, HDA_DSP_BAR, CNL_DSP_REG_HIPCIDR,
-			  CNL_DSP_REG_HIPCIDR_BUSY);
+	u32 dr = 0;
+	u32 dd = 0;
+
+	if (cnl_compact_ipc_compress(msg, &dr, &dd)) {
+		/* send the message via IPC registers */
+		snd_sof_dsp_write(sdev, HDA_DSP_BAR, CNL_DSP_REG_HIPCIDD,
+				  dd);
+		snd_sof_dsp_write(sdev, HDA_DSP_BAR, CNL_DSP_REG_HIPCIDR,
+				  CNL_DSP_REG_HIPCIDR_BUSY | dr);
+	} else {
+		/* send the message via mailbox */
+		sof_mailbox_write(sdev, sdev->host_box.offset, msg->msg_data,
+				  msg->msg_size);
+		snd_sof_dsp_write(sdev, HDA_DSP_BAR, CNL_DSP_REG_HIPCIDR,
+				  CNL_DSP_REG_HIPCIDR_BUSY);
+	}
 
 	return 0;
 }
diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h
index 99ec60218c16..52a87a47029d 100644
--- a/sound/soc/sof/intel/hda.h
+++ b/sound/soc/sof/intel/hda.h
@@ -312,6 +312,7 @@
 #define CNL_DSP_REG_HIPCTDD		(CNL_DSP_IPC_BASE + 0x08)
 #define CNL_DSP_REG_HIPCIDR		(CNL_DSP_IPC_BASE + 0x10)
 #define CNL_DSP_REG_HIPCIDA		(CNL_DSP_IPC_BASE + 0x14)
+#define CNL_DSP_REG_HIPCIDD		(CNL_DSP_IPC_BASE + 0x18)
 #define CNL_DSP_REG_HIPCCTL		(CNL_DSP_IPC_BASE + 0x28)
 
 /*  HIPCI */
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] [PATCH 19/26] ASoC: SOF: add a flag to indicate the system suspend target
  2019-10-25 22:40 [alsa-devel] [PATCH 00/26] ASoC: SOF: enable S0ix support for Intel platforms Pierre-Louis Bossart
                   ` (17 preceding siblings ...)
  2019-10-25 22:41 ` [alsa-devel] [PATCH 18/26] ASoC: SOF: Intel: CNL: add support for sending compact IPC Pierre-Louis Bossart
@ 2019-10-25 22:41 ` Pierre-Louis Bossart
  2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: add a flag to indicate the system suspend target" to the asoc tree Mark Brown
  2019-10-25 22:41 ` [alsa-devel] [PATCH 20/26] ASoC: SOF: add a flag suspend_ignored for sof stream Pierre-Louis Bossart
                   ` (6 subsequent siblings)
  25 siblings, 1 reply; 61+ messages in thread
From: Pierre-Louis Bossart @ 2019-10-25 22:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, broonie, Keyon Jie, Pierre-Louis Bossart

From: Keyon Jie <yang.jie@linux.intel.com>

Add flag 's0_suspend' to indicate if the system is entering S0ix or
not.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/sof/sof-priv.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h
index 2231c673c678..e715673f20e5 100644
--- a/sound/soc/sof/sof-priv.h
+++ b/sound/soc/sof/sof-priv.h
@@ -398,6 +398,8 @@ struct snd_sof_dev {
 
 	/* power states related */
 	enum sof_d0_substate d0_substate;
+	/* flag to track if the intended power target of suspend is S0ix */
+	bool s0_suspend;
 
 	/* DSP firmware boot */
 	wait_queue_head_t boot_wait;
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] [PATCH 20/26] ASoC: SOF: add a flag suspend_ignored for sof stream
  2019-10-25 22:40 [alsa-devel] [PATCH 00/26] ASoC: SOF: enable S0ix support for Intel platforms Pierre-Louis Bossart
                   ` (18 preceding siblings ...)
  2019-10-25 22:41 ` [alsa-devel] [PATCH 19/26] ASoC: SOF: add a flag to indicate the system suspend target Pierre-Louis Bossart
@ 2019-10-25 22:41 ` Pierre-Louis Bossart
  2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: add a flag suspend_ignored for sof stream" to the asoc tree Mark Brown
  2019-10-25 22:41 ` [alsa-devel] [PATCH 21/26] ASoC: SOF: PM: implement prepare/complete callbacks Pierre-Louis Bossart
                   ` (5 subsequent siblings)
  25 siblings, 1 reply; 61+ messages in thread
From: Pierre-Louis Bossart @ 2019-10-25 22:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, broonie, Keyon Jie, Pierre-Louis Bossart

From: Keyon Jie <yang.jie@linux.intel.com>

Add a suspend_ignored flag to snd_sof_pcm_stream that will be used to
decide if the corresponding FW pipeline should be kept active to perform
always on tasks when the system is entering the S0ix state.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/sof/sof-priv.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h
index e715673f20e5..c2541d020bde 100644
--- a/sound/soc/sof/sof-priv.h
+++ b/sound/soc/sof/sof-priv.h
@@ -311,6 +311,11 @@ struct snd_sof_pcm_stream {
 	struct snd_pcm_substream *substream;
 	struct work_struct period_elapsed_work;
 	bool d0i3_compatible; /* DSP can be in D0I3 when this pcm is opened */
+	/*
+	 * flag to indicate that the DSP pipelines should be kept
+	 * active or not while suspending the stream
+	 */
+	bool suspend_ignored;
 };
 
 /* ALSA SOF PCM device */
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] [PATCH 21/26] ASoC: SOF: PM: implement prepare/complete callbacks
  2019-10-25 22:40 [alsa-devel] [PATCH 00/26] ASoC: SOF: enable S0ix support for Intel platforms Pierre-Louis Bossart
                   ` (19 preceding siblings ...)
  2019-10-25 22:41 ` [alsa-devel] [PATCH 20/26] ASoC: SOF: add a flag suspend_ignored for sof stream Pierre-Louis Bossart
@ 2019-10-25 22:41 ` Pierre-Louis Bossart
  2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: PM: implement prepare/complete callbacks" to the asoc tree Mark Brown
  2019-10-25 22:41 ` [alsa-devel] [PATCH 22/26] ASoC: SOF: ignore suspend/resume for D0ix compatible streams Pierre-Louis Bossart
                   ` (4 subsequent siblings)
  25 siblings, 1 reply; 61+ messages in thread
From: Pierre-Louis Bossart @ 2019-10-25 22:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, broonie, Keyon Jie, Pierre-Louis Bossart

From: Keyon Jie <yang.jie@linux.intel.com>

Implement the prepare() and complete() callbacks for power management,
initialize s0_suspend flag at prepare(), and reset it at complete().

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/sof/pm.c       | 23 +++++++++++++++++++++++
 sound/soc/sof/sof-priv.h |  2 ++
 2 files changed, 25 insertions(+)

diff --git a/sound/soc/sof/pm.c b/sound/soc/sof/pm.c
index 584241e9734a..99e4e6ffff74 100644
--- a/sound/soc/sof/pm.c
+++ b/sound/soc/sof/pm.c
@@ -439,3 +439,26 @@ int snd_sof_suspend(struct device *dev)
 	return sof_suspend(dev, false);
 }
 EXPORT_SYMBOL(snd_sof_suspend);
+
+int snd_sof_prepare(struct device *dev)
+{
+	struct snd_sof_dev *sdev = dev_get_drvdata(dev);
+
+#if defined(CONFIG_ACPI)
+	sdev->s0_suspend = acpi_target_system_state() == ACPI_STATE_S0;
+#else
+	/* will suspend to S3 by default */
+	sdev->s0_suspend = false;
+#endif
+
+	return 0;
+}
+EXPORT_SYMBOL(snd_sof_prepare);
+
+void snd_sof_complete(struct device *dev)
+{
+	struct snd_sof_dev *sdev = dev_get_drvdata(dev);
+
+	sdev->s0_suspend = false;
+}
+EXPORT_SYMBOL(snd_sof_complete);
diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h
index c2541d020bde..6408ac88a3e5 100644
--- a/sound/soc/sof/sof-priv.h
+++ b/sound/soc/sof/sof-priv.h
@@ -492,6 +492,8 @@ int snd_sof_runtime_resume(struct device *dev);
 int snd_sof_runtime_idle(struct device *dev);
 int snd_sof_resume(struct device *dev);
 int snd_sof_suspend(struct device *dev);
+int snd_sof_prepare(struct device *dev);
+void snd_sof_complete(struct device *dev);
 int snd_sof_set_d0_substate(struct snd_sof_dev *sdev,
 			    enum sof_d0_substate d0_substate);
 
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] [PATCH 22/26] ASoC: SOF: ignore suspend/resume for D0ix compatible streams
  2019-10-25 22:40 [alsa-devel] [PATCH 00/26] ASoC: SOF: enable S0ix support for Intel platforms Pierre-Louis Bossart
                   ` (20 preceding siblings ...)
  2019-10-25 22:41 ` [alsa-devel] [PATCH 21/26] ASoC: SOF: PM: implement prepare/complete callbacks Pierre-Louis Bossart
@ 2019-10-25 22:41 ` Pierre-Louis Bossart
  2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: ignore suspend/resume for D0ix compatible streams" to the asoc tree Mark Brown
  2019-10-25 22:41 ` [alsa-devel] [PATCH 23/26] ASoC: SOF: Intel: hda-dsp: implement suspend/resume for S0ix<->S0 transition Pierre-Louis Bossart
                   ` (3 subsequent siblings)
  25 siblings, 1 reply; 61+ messages in thread
From: Pierre-Louis Bossart @ 2019-10-25 22:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, broonie, Keyon Jie, Pierre-Louis Bossart

From: Keyon Jie <yang.jie@linux.intel.com>

During system suspend, the PM framework will freeze all applications and
the ALSA/ASoC core will suspend all RUNNING PCM streams.

However, D0ix-compatible PCM streams should keep the related pipelines
active in the DSP when the system is entering S0ix. The TRIGGER_SUSPEND
event is trapped in such cases to prevent the pipelines from being
stopped. Likewise, the TRIGGER_RESUME/START events should not affect the
pipeline state.

The SOF driver also triggers some DSP Firmware pipelines based on the
DAPM widgets power events. In such cases, we also ignore PRE_PMU and
POST_PMD events to keep the pipelines active.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/sof/pcm.c      | 31 +++++++++++++++++++++++++++++++
 sound/soc/sof/topology.c | 17 ++++++++++++++++-
 2 files changed, 47 insertions(+), 1 deletion(-)

diff --git a/sound/soc/sof/pcm.c b/sound/soc/sof/pcm.c
index 9ba505cf5966..3d5cd1b445ba 100644
--- a/sound/soc/sof/pcm.c
+++ b/sound/soc/sof/pcm.c
@@ -346,6 +346,16 @@ static int sof_pcm_trigger(struct snd_soc_component *component,
 		stream.hdr.cmd |= SOF_IPC_STREAM_TRIG_RELEASE;
 		break;
 	case SNDRV_PCM_TRIGGER_RESUME:
+		if (spcm->stream[substream->stream].suspend_ignored) {
+			/*
+			 * this case will be triggered when INFO_RESUME is
+			 * supported, no need to resume streams that remained
+			 * enabled in D0ix.
+			 */
+			spcm->stream[substream->stream].suspend_ignored = false;
+			return 0;
+		}
+
 		/* set up hw_params */
 		ret = sof_pcm_prepare(component, substream);
 		if (ret < 0) {
@@ -356,9 +366,30 @@ static int sof_pcm_trigger(struct snd_soc_component *component,
 
 		/* fallthrough */
 	case SNDRV_PCM_TRIGGER_START:
+		if (spcm->stream[substream->stream].suspend_ignored) {
+			/*
+			 * This case will be triggered when INFO_RESUME is
+			 * not supported, no need to re-start streams that
+			 * remained enabled in D0ix.
+			 */
+			spcm->stream[substream->stream].suspend_ignored = false;
+			return 0;
+		}
 		stream.hdr.cmd |= SOF_IPC_STREAM_TRIG_START;
 		break;
 	case SNDRV_PCM_TRIGGER_SUSPEND:
+		if (sdev->s0_suspend &&
+		    spcm->stream[substream->stream].d0i3_compatible) {
+			/*
+			 * trap the event, not sending trigger stop to
+			 * prevent the FW pipelines from being stopped,
+			 * and mark the flag to ignore the upcoming DAPM
+			 * PM events.
+			 */
+			spcm->stream[substream->stream].suspend_ignored = true;
+			return 0;
+		}
+		/* fallthrough */
 	case SNDRV_PCM_TRIGGER_STOP:
 		stream.hdr.cmd |= SOF_IPC_STREAM_TRIG_STOP;
 		ipc_first = true;
diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c
index cc138ac6a8eb..e0e2ae734632 100644
--- a/sound/soc/sof/topology.c
+++ b/sound/soc/sof/topology.c
@@ -135,7 +135,9 @@ static int sof_keyword_dapm_event(struct snd_soc_dapm_widget *w,
 				  struct snd_kcontrol *k, int event)
 {
 	struct snd_sof_widget *swidget = w->dobj.private;
+	int stream = SNDRV_PCM_STREAM_CAPTURE;
 	struct snd_sof_dev *sdev;
+	struct snd_sof_pcm *spcm;
 	int ret = 0;
 
 	if (!swidget)
@@ -146,11 +148,19 @@ static int sof_keyword_dapm_event(struct snd_soc_dapm_widget *w,
 	dev_dbg(sdev->dev, "received event %d for widget %s\n",
 		event, w->name);
 
+	/* get runtime PCM params using widget's stream name */
+	spcm = snd_sof_find_spcm_name(sdev, swidget->widget->sname);
+
 	/* process events */
 	switch (event) {
 	case SND_SOC_DAPM_PRE_PMU:
+		if (spcm->stream[stream].suspend_ignored) {
+			dev_dbg(sdev->dev, "PRE_PMU event ignored, KWD pipeline is already RUNNING\n");
+			return 0;
+		}
+
 		/* set pcm params */
-		ret = ipc_pcm_params(swidget, SOF_IPC_STREAM_CAPTURE);
+		ret = ipc_pcm_params(swidget, stream);
 		if (ret < 0) {
 			dev_err(sdev->dev,
 				"error: failed to set pcm params for widget %s\n",
@@ -166,6 +176,11 @@ static int sof_keyword_dapm_event(struct snd_soc_dapm_widget *w,
 				swidget->widget->name);
 		break;
 	case SND_SOC_DAPM_POST_PMD:
+		if (spcm->stream[stream].suspend_ignored) {
+			dev_dbg(sdev->dev, "POST_PMD even ignored, KWD pipeline will remain RUNNING\n");
+			return 0;
+		}
+
 		/* stop trigger */
 		ret = ipc_trigger(swidget, SOF_IPC_STREAM_TRIG_STOP);
 		if (ret < 0)
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] [PATCH 23/26] ASoC: SOF: Intel: hda-dsp: implement suspend/resume for S0ix<->S0 transition
  2019-10-25 22:40 [alsa-devel] [PATCH 00/26] ASoC: SOF: enable S0ix support for Intel platforms Pierre-Louis Bossart
                   ` (21 preceding siblings ...)
  2019-10-25 22:41 ` [alsa-devel] [PATCH 22/26] ASoC: SOF: ignore suspend/resume for D0ix compatible streams Pierre-Louis Bossart
@ 2019-10-25 22:41 ` Pierre-Louis Bossart
  2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: Intel: hda-dsp: implement suspend/resume for S0ix<->S0 transition" to the asoc tree Mark Brown
  2019-10-25 22:41 ` [alsa-devel] [PATCH 24/26] ASoC: SOF: return -ENOTSUPP if D0I3 is not supported Pierre-Louis Bossart
                   ` (2 subsequent siblings)
  25 siblings, 1 reply; 61+ messages in thread
From: Pierre-Louis Bossart @ 2019-10-25 22:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, broonie, Keyon Jie, Pierre-Louis Bossart

From: Keyon Jie <yang.jie@linux.intel.com>

Enable system wake up via IPC interrupt from DSP when the system is
suspending to the S0ix state, and disable it in the corresponding
resuming.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/sof/intel/hda-dsp.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c
index b5070409a5e3..d23573d9e9c4 100644
--- a/sound/soc/sof/intel/hda-dsp.c
+++ b/sound/soc/sof/intel/hda-dsp.c
@@ -477,6 +477,15 @@ static int hda_resume(struct snd_sof_dev *sdev, bool runtime_resume)
 
 int hda_dsp_resume(struct snd_sof_dev *sdev)
 {
+	struct pci_dev *pci = to_pci_dev(sdev->dev);
+
+	if (sdev->s0_suspend) {
+		/* restore and disable the system wakeup */
+		pci_restore_state(pci);
+		disable_irq_wake(pci->irq);
+		return 0;
+	}
+
 	/* init hda controller. DSP cores will be powered up during fw boot */
 	return hda_resume(sdev, false);
 }
@@ -509,8 +518,16 @@ int hda_dsp_runtime_suspend(struct snd_sof_dev *sdev)
 int hda_dsp_suspend(struct snd_sof_dev *sdev)
 {
 	struct hdac_bus *bus = sof_to_bus(sdev);
+	struct pci_dev *pci = to_pci_dev(sdev->dev);
 	int ret;
 
+	if (sdev->s0_suspend) {
+		/* enable the system waking up via IPC IRQ */
+		enable_irq_wake(pci->irq);
+		pci_save_state(pci);
+		return 0;
+	}
+
 	/* stop hda controller and power dsp off */
 	ret = hda_suspend(sdev, false);
 	if (ret < 0) {
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] [PATCH 24/26] ASoC: SOF: return -ENOTSUPP if D0I3 is not supported
  2019-10-25 22:40 [alsa-devel] [PATCH 00/26] ASoC: SOF: enable S0ix support for Intel platforms Pierre-Louis Bossart
                   ` (22 preceding siblings ...)
  2019-10-25 22:41 ` [alsa-devel] [PATCH 23/26] ASoC: SOF: Intel: hda-dsp: implement suspend/resume for S0ix<->S0 transition Pierre-Louis Bossart
@ 2019-10-25 22:41 ` Pierre-Louis Bossart
  2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: return -ENOTSUPP if D0I3 is not supported" to the asoc tree Mark Brown
  2019-10-25 22:41 ` [alsa-devel] [PATCH 25/26] ASoC: SOF: PM: Add support for DSP D0i3 state when entering S0ix Pierre-Louis Bossart
  2019-10-25 22:41 ` [alsa-devel] [PATCH 26/26] ASoC: SOF: pci: Add prepare/complete PM callbacks Pierre-Louis Bossart
  25 siblings, 1 reply; 61+ messages in thread
From: Pierre-Louis Bossart @ 2019-10-25 22:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, broonie, Keyon Jie, Pierre-Louis Bossart

From: Keyon Jie <yang.jie@linux.intel.com>

No set_power_state ops means that the platform doesn't support D0i3,
return -ENOTSUPP for the case.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/sof/ops.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/soc/sof/ops.h b/sound/soc/sof/ops.h
index d7c8fc06f961..93512dcbaacd 100644
--- a/sound/soc/sof/ops.h
+++ b/sound/soc/sof/ops.h
@@ -199,7 +199,8 @@ static inline int snd_sof_dsp_set_power_state(struct snd_sof_dev *sdev,
 	if (sof_ops(sdev)->set_power_state)
 		return sof_ops(sdev)->set_power_state(sdev, substate);
 
-	return 0;
+	/* D0 substate is not supported */
+	return -ENOTSUPP;
 }
 
 /* debug */
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] [PATCH 25/26] ASoC: SOF: PM: Add support for DSP D0i3 state when entering S0ix
  2019-10-25 22:40 [alsa-devel] [PATCH 00/26] ASoC: SOF: enable S0ix support for Intel platforms Pierre-Louis Bossart
                   ` (23 preceding siblings ...)
  2019-10-25 22:41 ` [alsa-devel] [PATCH 24/26] ASoC: SOF: return -ENOTSUPP if D0I3 is not supported Pierre-Louis Bossart
@ 2019-10-25 22:41 ` Pierre-Louis Bossart
  2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: PM: Add support for DSP D0i3 state when entering S0ix" to the asoc tree Mark Brown
  2019-10-25 22:41 ` [alsa-devel] [PATCH 26/26] ASoC: SOF: pci: Add prepare/complete PM callbacks Pierre-Louis Bossart
  25 siblings, 1 reply; 61+ messages in thread
From: Pierre-Louis Bossart @ 2019-10-25 22:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, broonie, Keyon Jie, Pierre-Louis Bossart

From: Keyon Jie <yang.jie@linux.intel.com>

When system is entering into S0ix, the PCI device may transition to the
D0i3 substate instead of D3. In D0i3, some always-on functionality can
be enabled, such as acoustic event detection, voice activity detection
or hotwording. When an event is detected, the DSP firmware can wake-up
the device for a transition to D0 with an interrupt.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/sof/pm.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/sound/soc/sof/pm.c b/sound/soc/sof/pm.c
index 99e4e6ffff74..560a937e0484 100644
--- a/sound/soc/sof/pm.c
+++ b/sound/soc/sof/pm.c
@@ -430,12 +430,58 @@ EXPORT_SYMBOL(snd_sof_set_d0_substate);
 
 int snd_sof_resume(struct device *dev)
 {
+	struct snd_sof_dev *sdev = dev_get_drvdata(dev);
+	int ret;
+
+	if (sdev->s0_suspend) {
+		/* resume from D0I3 */
+		dev_dbg(sdev->dev, "DSP will exit from D0i3...\n");
+		ret = snd_sof_set_d0_substate(sdev, SOF_DSP_D0I0);
+		if (ret == -ENOTSUPP) {
+			/* fallback to resume from D3 */
+			dev_dbg(sdev->dev, "D0i3 not supported, fall back to resume from D3...\n");
+			goto d3_resume;
+		} else if (ret < 0) {
+			dev_err(sdev->dev, "error: failed to exit from D0I3 %d\n",
+				ret);
+			return ret;
+		}
+
+		/* platform-specific resume from D0i3 */
+		return snd_sof_dsp_resume(sdev);
+	}
+
+d3_resume:
+	/* resume from D3 */
 	return sof_resume(dev, false);
 }
 EXPORT_SYMBOL(snd_sof_resume);
 
 int snd_sof_suspend(struct device *dev)
 {
+	struct snd_sof_dev *sdev = dev_get_drvdata(dev);
+	int ret;
+
+	if (sdev->s0_suspend) {
+		/* suspend to D0i3 */
+		dev_dbg(sdev->dev, "DSP is trying to enter D0i3...\n");
+		ret = snd_sof_set_d0_substate(sdev, SOF_DSP_D0I3);
+		if (ret == -ENOTSUPP) {
+			/* fallback to D3 suspend */
+			dev_dbg(sdev->dev, "D0i3 not supported, fall back to D3...\n");
+			goto d3_suspend;
+		} else if (ret < 0) {
+			dev_err(sdev->dev, "error: failed to enter D0I3, %d\n",
+				ret);
+			return ret;
+		}
+
+		/* platform-specific suspend to D0i3 */
+		return snd_sof_dsp_suspend(sdev);
+	}
+
+d3_suspend:
+	/* suspend to D3 */
 	return sof_suspend(dev, false);
 }
 EXPORT_SYMBOL(snd_sof_suspend);
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] [PATCH 26/26] ASoC: SOF: pci: Add prepare/complete PM callbacks
  2019-10-25 22:40 [alsa-devel] [PATCH 00/26] ASoC: SOF: enable S0ix support for Intel platforms Pierre-Louis Bossart
                   ` (24 preceding siblings ...)
  2019-10-25 22:41 ` [alsa-devel] [PATCH 25/26] ASoC: SOF: PM: Add support for DSP D0i3 state when entering S0ix Pierre-Louis Bossart
@ 2019-10-25 22:41 ` Pierre-Louis Bossart
  2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: pci: Add prepare/complete PM callbacks" to the asoc tree Mark Brown
  25 siblings, 1 reply; 61+ messages in thread
From: Pierre-Louis Bossart @ 2019-10-25 22:41 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, broonie, Keyon Jie, Pierre-Louis Bossart

From: Keyon Jie <yang.jie@linux.intel.com>

Use the new implemented snd_sof_prepare() and snd_sof_complete() as the
power management callbacks for pci probing platforms.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/sof/sof-pci-dev.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/soc/sof/sof-pci-dev.c b/sound/soc/sof/sof-pci-dev.c
index 4adbb27c76c5..487b1f29f84d 100644
--- a/sound/soc/sof/sof-pci-dev.c
+++ b/sound/soc/sof/sof-pci-dev.c
@@ -264,6 +264,8 @@ static const struct sof_dev_desc jsl_desc = {
 #endif
 
 static const struct dev_pm_ops sof_pci_pm = {
+	.prepare = snd_sof_prepare,
+	.complete = snd_sof_complete,
 	SET_SYSTEM_SLEEP_PM_OPS(snd_sof_suspend, snd_sof_resume)
 	SET_RUNTIME_PM_OPS(snd_sof_runtime_suspend, snd_sof_runtime_resume,
 			   snd_sof_runtime_idle)
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] Applied "ASoC: SOF: pci: Add prepare/complete PM callbacks" to the asoc tree
  2019-10-25 22:41 ` [alsa-devel] [PATCH 26/26] ASoC: SOF: pci: Add prepare/complete PM callbacks Pierre-Louis Bossart
@ 2019-10-28 14:56   ` Mark Brown
  0 siblings, 0 replies; 61+ messages in thread
From: Mark Brown @ 2019-10-28 14:56 UTC (permalink / raw)
  To: Keyon Jie; +Cc: tiwai, alsa-devel, Mark Brown, Pierre-Louis Bossart

The patch

   ASoC: SOF: pci: Add prepare/complete PM callbacks

has been applied to the asoc tree at

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

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

From 6d407a39cc9619d0088b44333c6526924be00f8d Mon Sep 17 00:00:00 2001
From: Keyon Jie <yang.jie@linux.intel.com>
Date: Fri, 25 Oct 2019 17:41:22 -0500
Subject: [PATCH] ASoC: SOF: pci: Add prepare/complete PM callbacks

Use the new implemented snd_sof_prepare() and snd_sof_complete() as the
power management callbacks for pci probing platforms.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-27-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sof/sof-pci-dev.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/soc/sof/sof-pci-dev.c b/sound/soc/sof/sof-pci-dev.c
index 4adbb27c76c5..487b1f29f84d 100644
--- a/sound/soc/sof/sof-pci-dev.c
+++ b/sound/soc/sof/sof-pci-dev.c
@@ -264,6 +264,8 @@ static const struct sof_dev_desc jsl_desc = {
 #endif
 
 static const struct dev_pm_ops sof_pci_pm = {
+	.prepare = snd_sof_prepare,
+	.complete = snd_sof_complete,
 	SET_SYSTEM_SLEEP_PM_OPS(snd_sof_suspend, snd_sof_resume)
 	SET_RUNTIME_PM_OPS(snd_sof_runtime_suspend, snd_sof_runtime_resume,
 			   snd_sof_runtime_idle)
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] Applied "ASoC: SOF: PM: Add support for DSP D0i3 state when entering S0ix" to the asoc tree
  2019-10-25 22:41 ` [alsa-devel] [PATCH 25/26] ASoC: SOF: PM: Add support for DSP D0i3 state when entering S0ix Pierre-Louis Bossart
@ 2019-10-28 14:56   ` Mark Brown
  0 siblings, 0 replies; 61+ messages in thread
From: Mark Brown @ 2019-10-28 14:56 UTC (permalink / raw)
  To: Keyon Jie; +Cc: tiwai, alsa-devel, Mark Brown, Pierre-Louis Bossart

The patch

   ASoC: SOF: PM: Add support for DSP D0i3 state when entering S0ix

has been applied to the asoc tree at

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

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

From c470fc3f61b25e955f8ba90fc9dc554881e4e72c Mon Sep 17 00:00:00 2001
From: Keyon Jie <yang.jie@linux.intel.com>
Date: Fri, 25 Oct 2019 17:41:21 -0500
Subject: [PATCH] ASoC: SOF: PM: Add support for DSP D0i3 state when entering
 S0ix

When system is entering into S0ix, the PCI device may transition to the
D0i3 substate instead of D3. In D0i3, some always-on functionality can
be enabled, such as acoustic event detection, voice activity detection
or hotwording. When an event is detected, the DSP firmware can wake-up
the device for a transition to D0 with an interrupt.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-26-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sof/pm.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/sound/soc/sof/pm.c b/sound/soc/sof/pm.c
index 99e4e6ffff74..560a937e0484 100644
--- a/sound/soc/sof/pm.c
+++ b/sound/soc/sof/pm.c
@@ -430,12 +430,58 @@ EXPORT_SYMBOL(snd_sof_set_d0_substate);
 
 int snd_sof_resume(struct device *dev)
 {
+	struct snd_sof_dev *sdev = dev_get_drvdata(dev);
+	int ret;
+
+	if (sdev->s0_suspend) {
+		/* resume from D0I3 */
+		dev_dbg(sdev->dev, "DSP will exit from D0i3...\n");
+		ret = snd_sof_set_d0_substate(sdev, SOF_DSP_D0I0);
+		if (ret == -ENOTSUPP) {
+			/* fallback to resume from D3 */
+			dev_dbg(sdev->dev, "D0i3 not supported, fall back to resume from D3...\n");
+			goto d3_resume;
+		} else if (ret < 0) {
+			dev_err(sdev->dev, "error: failed to exit from D0I3 %d\n",
+				ret);
+			return ret;
+		}
+
+		/* platform-specific resume from D0i3 */
+		return snd_sof_dsp_resume(sdev);
+	}
+
+d3_resume:
+	/* resume from D3 */
 	return sof_resume(dev, false);
 }
 EXPORT_SYMBOL(snd_sof_resume);
 
 int snd_sof_suspend(struct device *dev)
 {
+	struct snd_sof_dev *sdev = dev_get_drvdata(dev);
+	int ret;
+
+	if (sdev->s0_suspend) {
+		/* suspend to D0i3 */
+		dev_dbg(sdev->dev, "DSP is trying to enter D0i3...\n");
+		ret = snd_sof_set_d0_substate(sdev, SOF_DSP_D0I3);
+		if (ret == -ENOTSUPP) {
+			/* fallback to D3 suspend */
+			dev_dbg(sdev->dev, "D0i3 not supported, fall back to D3...\n");
+			goto d3_suspend;
+		} else if (ret < 0) {
+			dev_err(sdev->dev, "error: failed to enter D0I3, %d\n",
+				ret);
+			return ret;
+		}
+
+		/* platform-specific suspend to D0i3 */
+		return snd_sof_dsp_suspend(sdev);
+	}
+
+d3_suspend:
+	/* suspend to D3 */
 	return sof_suspend(dev, false);
 }
 EXPORT_SYMBOL(snd_sof_suspend);
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] Applied "ASoC: SOF: Intel: hda-dsp: implement suspend/resume for S0ix<->S0 transition" to the asoc tree
  2019-10-25 22:41 ` [alsa-devel] [PATCH 23/26] ASoC: SOF: Intel: hda-dsp: implement suspend/resume for S0ix<->S0 transition Pierre-Louis Bossart
@ 2019-10-28 14:56   ` Mark Brown
  0 siblings, 0 replies; 61+ messages in thread
From: Mark Brown @ 2019-10-28 14:56 UTC (permalink / raw)
  To: Keyon Jie; +Cc: tiwai, alsa-devel, Mark Brown, Pierre-Louis Bossart

The patch

   ASoC: SOF: Intel: hda-dsp: implement suspend/resume for S0ix<->S0 transition

has been applied to the asoc tree at

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

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

From 66e40876ddc325d892c493a6d83574bbba5770ce Mon Sep 17 00:00:00 2001
From: Keyon Jie <yang.jie@linux.intel.com>
Date: Fri, 25 Oct 2019 17:41:19 -0500
Subject: [PATCH] ASoC: SOF: Intel: hda-dsp: implement suspend/resume for
 S0ix<->S0 transition

Enable system wake up via IPC interrupt from DSP when the system is
suspending to the S0ix state, and disable it in the corresponding
resuming.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-24-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sof/intel/hda-dsp.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c
index b5070409a5e3..d23573d9e9c4 100644
--- a/sound/soc/sof/intel/hda-dsp.c
+++ b/sound/soc/sof/intel/hda-dsp.c
@@ -477,6 +477,15 @@ static int hda_resume(struct snd_sof_dev *sdev, bool runtime_resume)
 
 int hda_dsp_resume(struct snd_sof_dev *sdev)
 {
+	struct pci_dev *pci = to_pci_dev(sdev->dev);
+
+	if (sdev->s0_suspend) {
+		/* restore and disable the system wakeup */
+		pci_restore_state(pci);
+		disable_irq_wake(pci->irq);
+		return 0;
+	}
+
 	/* init hda controller. DSP cores will be powered up during fw boot */
 	return hda_resume(sdev, false);
 }
@@ -509,8 +518,16 @@ int hda_dsp_runtime_suspend(struct snd_sof_dev *sdev)
 int hda_dsp_suspend(struct snd_sof_dev *sdev)
 {
 	struct hdac_bus *bus = sof_to_bus(sdev);
+	struct pci_dev *pci = to_pci_dev(sdev->dev);
 	int ret;
 
+	if (sdev->s0_suspend) {
+		/* enable the system waking up via IPC IRQ */
+		enable_irq_wake(pci->irq);
+		pci_save_state(pci);
+		return 0;
+	}
+
 	/* stop hda controller and power dsp off */
 	ret = hda_suspend(sdev, false);
 	if (ret < 0) {
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] Applied "ASoC: SOF: return -ENOTSUPP if D0I3 is not supported" to the asoc tree
  2019-10-25 22:41 ` [alsa-devel] [PATCH 24/26] ASoC: SOF: return -ENOTSUPP if D0I3 is not supported Pierre-Louis Bossart
@ 2019-10-28 14:56   ` Mark Brown
  0 siblings, 0 replies; 61+ messages in thread
From: Mark Brown @ 2019-10-28 14:56 UTC (permalink / raw)
  To: Keyon Jie; +Cc: tiwai, alsa-devel, Mark Brown, Pierre-Louis Bossart

The patch

   ASoC: SOF: return -ENOTSUPP if D0I3 is not supported

has been applied to the asoc tree at

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

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

From 5655ce660a6d3eec4a3ad37feb99fb228540d1a9 Mon Sep 17 00:00:00 2001
From: Keyon Jie <yang.jie@linux.intel.com>
Date: Fri, 25 Oct 2019 17:41:20 -0500
Subject: [PATCH] ASoC: SOF: return -ENOTSUPP if D0I3 is not supported

No set_power_state ops means that the platform doesn't support D0i3,
return -ENOTSUPP for the case.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-25-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sof/ops.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/soc/sof/ops.h b/sound/soc/sof/ops.h
index d7c8fc06f961..93512dcbaacd 100644
--- a/sound/soc/sof/ops.h
+++ b/sound/soc/sof/ops.h
@@ -199,7 +199,8 @@ static inline int snd_sof_dsp_set_power_state(struct snd_sof_dev *sdev,
 	if (sof_ops(sdev)->set_power_state)
 		return sof_ops(sdev)->set_power_state(sdev, substate);
 
-	return 0;
+	/* D0 substate is not supported */
+	return -ENOTSUPP;
 }
 
 /* debug */
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] Applied "ASoC: SOF: ignore suspend/resume for D0ix compatible streams" to the asoc tree
  2019-10-25 22:41 ` [alsa-devel] [PATCH 22/26] ASoC: SOF: ignore suspend/resume for D0ix compatible streams Pierre-Louis Bossart
@ 2019-10-28 14:56   ` Mark Brown
  0 siblings, 0 replies; 61+ messages in thread
From: Mark Brown @ 2019-10-28 14:56 UTC (permalink / raw)
  To: Keyon Jie; +Cc: tiwai, alsa-devel, Mark Brown, Pierre-Louis Bossart

The patch

   ASoC: SOF: ignore suspend/resume for D0ix compatible streams

has been applied to the asoc tree at

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

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

From ac8c046f19f94ec419c60d7a073af75a71386e97 Mon Sep 17 00:00:00 2001
From: Keyon Jie <yang.jie@linux.intel.com>
Date: Fri, 25 Oct 2019 17:41:18 -0500
Subject: [PATCH] ASoC: SOF: ignore suspend/resume for D0ix compatible streams

During system suspend, the PM framework will freeze all applications and
the ALSA/ASoC core will suspend all RUNNING PCM streams.

However, D0ix-compatible PCM streams should keep the related pipelines
active in the DSP when the system is entering S0ix. The TRIGGER_SUSPEND
event is trapped in such cases to prevent the pipelines from being
stopped. Likewise, the TRIGGER_RESUME/START events should not affect the
pipeline state.

The SOF driver also triggers some DSP Firmware pipelines based on the
DAPM widgets power events. In such cases, we also ignore PRE_PMU and
POST_PMD events to keep the pipelines active.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-23-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sof/pcm.c      | 31 +++++++++++++++++++++++++++++++
 sound/soc/sof/topology.c | 17 ++++++++++++++++-
 2 files changed, 47 insertions(+), 1 deletion(-)

diff --git a/sound/soc/sof/pcm.c b/sound/soc/sof/pcm.c
index 9ba505cf5966..3d5cd1b445ba 100644
--- a/sound/soc/sof/pcm.c
+++ b/sound/soc/sof/pcm.c
@@ -346,6 +346,16 @@ static int sof_pcm_trigger(struct snd_soc_component *component,
 		stream.hdr.cmd |= SOF_IPC_STREAM_TRIG_RELEASE;
 		break;
 	case SNDRV_PCM_TRIGGER_RESUME:
+		if (spcm->stream[substream->stream].suspend_ignored) {
+			/*
+			 * this case will be triggered when INFO_RESUME is
+			 * supported, no need to resume streams that remained
+			 * enabled in D0ix.
+			 */
+			spcm->stream[substream->stream].suspend_ignored = false;
+			return 0;
+		}
+
 		/* set up hw_params */
 		ret = sof_pcm_prepare(component, substream);
 		if (ret < 0) {
@@ -356,9 +366,30 @@ static int sof_pcm_trigger(struct snd_soc_component *component,
 
 		/* fallthrough */
 	case SNDRV_PCM_TRIGGER_START:
+		if (spcm->stream[substream->stream].suspend_ignored) {
+			/*
+			 * This case will be triggered when INFO_RESUME is
+			 * not supported, no need to re-start streams that
+			 * remained enabled in D0ix.
+			 */
+			spcm->stream[substream->stream].suspend_ignored = false;
+			return 0;
+		}
 		stream.hdr.cmd |= SOF_IPC_STREAM_TRIG_START;
 		break;
 	case SNDRV_PCM_TRIGGER_SUSPEND:
+		if (sdev->s0_suspend &&
+		    spcm->stream[substream->stream].d0i3_compatible) {
+			/*
+			 * trap the event, not sending trigger stop to
+			 * prevent the FW pipelines from being stopped,
+			 * and mark the flag to ignore the upcoming DAPM
+			 * PM events.
+			 */
+			spcm->stream[substream->stream].suspend_ignored = true;
+			return 0;
+		}
+		/* fallthrough */
 	case SNDRV_PCM_TRIGGER_STOP:
 		stream.hdr.cmd |= SOF_IPC_STREAM_TRIG_STOP;
 		ipc_first = true;
diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c
index cc138ac6a8eb..e0e2ae734632 100644
--- a/sound/soc/sof/topology.c
+++ b/sound/soc/sof/topology.c
@@ -135,7 +135,9 @@ static int sof_keyword_dapm_event(struct snd_soc_dapm_widget *w,
 				  struct snd_kcontrol *k, int event)
 {
 	struct snd_sof_widget *swidget = w->dobj.private;
+	int stream = SNDRV_PCM_STREAM_CAPTURE;
 	struct snd_sof_dev *sdev;
+	struct snd_sof_pcm *spcm;
 	int ret = 0;
 
 	if (!swidget)
@@ -146,11 +148,19 @@ static int sof_keyword_dapm_event(struct snd_soc_dapm_widget *w,
 	dev_dbg(sdev->dev, "received event %d for widget %s\n",
 		event, w->name);
 
+	/* get runtime PCM params using widget's stream name */
+	spcm = snd_sof_find_spcm_name(sdev, swidget->widget->sname);
+
 	/* process events */
 	switch (event) {
 	case SND_SOC_DAPM_PRE_PMU:
+		if (spcm->stream[stream].suspend_ignored) {
+			dev_dbg(sdev->dev, "PRE_PMU event ignored, KWD pipeline is already RUNNING\n");
+			return 0;
+		}
+
 		/* set pcm params */
-		ret = ipc_pcm_params(swidget, SOF_IPC_STREAM_CAPTURE);
+		ret = ipc_pcm_params(swidget, stream);
 		if (ret < 0) {
 			dev_err(sdev->dev,
 				"error: failed to set pcm params for widget %s\n",
@@ -166,6 +176,11 @@ static int sof_keyword_dapm_event(struct snd_soc_dapm_widget *w,
 				swidget->widget->name);
 		break;
 	case SND_SOC_DAPM_POST_PMD:
+		if (spcm->stream[stream].suspend_ignored) {
+			dev_dbg(sdev->dev, "POST_PMD even ignored, KWD pipeline will remain RUNNING\n");
+			return 0;
+		}
+
 		/* stop trigger */
 		ret = ipc_trigger(swidget, SOF_IPC_STREAM_TRIG_STOP);
 		if (ret < 0)
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] Applied "ASoC: SOF: add a flag suspend_ignored for sof stream" to the asoc tree
  2019-10-25 22:41 ` [alsa-devel] [PATCH 20/26] ASoC: SOF: add a flag suspend_ignored for sof stream Pierre-Louis Bossart
@ 2019-10-28 14:56   ` Mark Brown
  0 siblings, 0 replies; 61+ messages in thread
From: Mark Brown @ 2019-10-28 14:56 UTC (permalink / raw)
  To: Keyon Jie; +Cc: tiwai, alsa-devel, Mark Brown, Pierre-Louis Bossart

The patch

   ASoC: SOF: add a flag suspend_ignored for sof stream

has been applied to the asoc tree at

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

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

From 4cd933abd4820da7eefe672ff439b32d199a07be Mon Sep 17 00:00:00 2001
From: Keyon Jie <yang.jie@linux.intel.com>
Date: Fri, 25 Oct 2019 17:41:16 -0500
Subject: [PATCH] ASoC: SOF: add a flag suspend_ignored for sof stream

Add a suspend_ignored flag to snd_sof_pcm_stream that will be used to
decide if the corresponding FW pipeline should be kept active to perform
always on tasks when the system is entering the S0ix state.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-21-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sof/sof-priv.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h
index e715673f20e5..c2541d020bde 100644
--- a/sound/soc/sof/sof-priv.h
+++ b/sound/soc/sof/sof-priv.h
@@ -311,6 +311,11 @@ struct snd_sof_pcm_stream {
 	struct snd_pcm_substream *substream;
 	struct work_struct period_elapsed_work;
 	bool d0i3_compatible; /* DSP can be in D0I3 when this pcm is opened */
+	/*
+	 * flag to indicate that the DSP pipelines should be kept
+	 * active or not while suspending the stream
+	 */
+	bool suspend_ignored;
 };
 
 /* ALSA SOF PCM device */
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] Applied "ASoC: SOF: PM: implement prepare/complete callbacks" to the asoc tree
  2019-10-25 22:41 ` [alsa-devel] [PATCH 21/26] ASoC: SOF: PM: implement prepare/complete callbacks Pierre-Louis Bossart
@ 2019-10-28 14:56   ` Mark Brown
  0 siblings, 0 replies; 61+ messages in thread
From: Mark Brown @ 2019-10-28 14:56 UTC (permalink / raw)
  To: Keyon Jie; +Cc: tiwai, alsa-devel, Mark Brown, Pierre-Louis Bossart

The patch

   ASoC: SOF: PM: implement prepare/complete callbacks

has been applied to the asoc tree at

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

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

From 0b50b3b1c3bc2a2c9eeab418b3de3e60e0530cf4 Mon Sep 17 00:00:00 2001
From: Keyon Jie <yang.jie@linux.intel.com>
Date: Fri, 25 Oct 2019 17:41:17 -0500
Subject: [PATCH] ASoC: SOF: PM: implement prepare/complete callbacks

Implement the prepare() and complete() callbacks for power management,
initialize s0_suspend flag at prepare(), and reset it at complete().

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-22-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sof/pm.c       | 23 +++++++++++++++++++++++
 sound/soc/sof/sof-priv.h |  2 ++
 2 files changed, 25 insertions(+)

diff --git a/sound/soc/sof/pm.c b/sound/soc/sof/pm.c
index 584241e9734a..99e4e6ffff74 100644
--- a/sound/soc/sof/pm.c
+++ b/sound/soc/sof/pm.c
@@ -439,3 +439,26 @@ int snd_sof_suspend(struct device *dev)
 	return sof_suspend(dev, false);
 }
 EXPORT_SYMBOL(snd_sof_suspend);
+
+int snd_sof_prepare(struct device *dev)
+{
+	struct snd_sof_dev *sdev = dev_get_drvdata(dev);
+
+#if defined(CONFIG_ACPI)
+	sdev->s0_suspend = acpi_target_system_state() == ACPI_STATE_S0;
+#else
+	/* will suspend to S3 by default */
+	sdev->s0_suspend = false;
+#endif
+
+	return 0;
+}
+EXPORT_SYMBOL(snd_sof_prepare);
+
+void snd_sof_complete(struct device *dev)
+{
+	struct snd_sof_dev *sdev = dev_get_drvdata(dev);
+
+	sdev->s0_suspend = false;
+}
+EXPORT_SYMBOL(snd_sof_complete);
diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h
index c2541d020bde..6408ac88a3e5 100644
--- a/sound/soc/sof/sof-priv.h
+++ b/sound/soc/sof/sof-priv.h
@@ -492,6 +492,8 @@ int snd_sof_runtime_resume(struct device *dev);
 int snd_sof_runtime_idle(struct device *dev);
 int snd_sof_resume(struct device *dev);
 int snd_sof_suspend(struct device *dev);
+int snd_sof_prepare(struct device *dev);
+void snd_sof_complete(struct device *dev);
 int snd_sof_set_d0_substate(struct snd_sof_dev *sdev,
 			    enum sof_d0_substate d0_substate);
 
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] Applied "ASoC: SOF: Intel: CNL: add support for sending compact IPC" to the asoc tree
  2019-10-25 22:41 ` [alsa-devel] [PATCH 18/26] ASoC: SOF: Intel: CNL: add support for sending compact IPC Pierre-Louis Bossart
@ 2019-10-28 14:56   ` Mark Brown
  0 siblings, 0 replies; 61+ messages in thread
From: Mark Brown @ 2019-10-28 14:56 UTC (permalink / raw)
  To: Keyon Jie; +Cc: tiwai, alsa-devel, Mark Brown, Pierre-Louis Bossart

The patch

   ASoC: SOF: Intel: CNL: add support for sending compact IPC

has been applied to the asoc tree at

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

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

From 0267de58acfe5059ace739741f1533dd605ed22f Mon Sep 17 00:00:00 2001
From: Keyon Jie <yang.jie@linux.intel.com>
Date: Fri, 25 Oct 2019 17:41:14 -0500
Subject: [PATCH] ASoC: SOF: Intel: CNL: add support for sending compact IPC

For compact IPCs, we will send the IPC header/command via the HIPCIDR
register and the first 32bit payload via the HIPCIDD register, no
mailbox will be used.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-19-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sof/intel/cnl.c | 42 ++++++++++++++++++++++++++++++++++-----
 sound/soc/sof/intel/hda.h |  1 +
 2 files changed, 38 insertions(+), 5 deletions(-)

diff --git a/sound/soc/sof/intel/cnl.c b/sound/soc/sof/intel/cnl.c
index 982b81a0b13a..0e1e265f3f3b 100644
--- a/sound/soc/sof/intel/cnl.c
+++ b/sound/soc/sof/intel/cnl.c
@@ -17,6 +17,7 @@
 
 #include "../ops.h"
 #include "hda.h"
+#include "hda-ipc.h"
 
 static const struct snd_sof_debugfs_map cnl_dsp_debugfs[] = {
 	{"hda", HDA_DSP_HDA_BAR, 0, 0x4000, SOF_DEBUGFS_ACCESS_ALWAYS},
@@ -150,14 +151,45 @@ static void cnl_ipc_dsp_done(struct snd_sof_dev *sdev)
 				CNL_DSP_REG_HIPCCTL_DONE);
 }
 
+static bool cnl_compact_ipc_compress(struct snd_sof_ipc_msg *msg,
+				     u32 *dr, u32 *dd)
+{
+	struct sof_ipc_pm_gate *pm_gate;
+
+	if (msg->header == (SOF_IPC_GLB_PM_MSG | SOF_IPC_PM_GATE)) {
+		pm_gate = msg->msg_data;
+
+		/* send the compact message via the primary register */
+		*dr = HDA_IPC_MSG_COMPACT | HDA_IPC_PM_GATE;
+
+		/* send payload via the extended data register */
+		*dd = pm_gate->flags;
+
+		return true;
+	}
+
+	return false;
+}
+
 static int cnl_ipc_send_msg(struct snd_sof_dev *sdev,
 			    struct snd_sof_ipc_msg *msg)
 {
-	/* send the message */
-	sof_mailbox_write(sdev, sdev->host_box.offset, msg->msg_data,
-			  msg->msg_size);
-	snd_sof_dsp_write(sdev, HDA_DSP_BAR, CNL_DSP_REG_HIPCIDR,
-			  CNL_DSP_REG_HIPCIDR_BUSY);
+	u32 dr = 0;
+	u32 dd = 0;
+
+	if (cnl_compact_ipc_compress(msg, &dr, &dd)) {
+		/* send the message via IPC registers */
+		snd_sof_dsp_write(sdev, HDA_DSP_BAR, CNL_DSP_REG_HIPCIDD,
+				  dd);
+		snd_sof_dsp_write(sdev, HDA_DSP_BAR, CNL_DSP_REG_HIPCIDR,
+				  CNL_DSP_REG_HIPCIDR_BUSY | dr);
+	} else {
+		/* send the message via mailbox */
+		sof_mailbox_write(sdev, sdev->host_box.offset, msg->msg_data,
+				  msg->msg_size);
+		snd_sof_dsp_write(sdev, HDA_DSP_BAR, CNL_DSP_REG_HIPCIDR,
+				  CNL_DSP_REG_HIPCIDR_BUSY);
+	}
 
 	return 0;
 }
diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h
index 99ec60218c16..52a87a47029d 100644
--- a/sound/soc/sof/intel/hda.h
+++ b/sound/soc/sof/intel/hda.h
@@ -312,6 +312,7 @@
 #define CNL_DSP_REG_HIPCTDD		(CNL_DSP_IPC_BASE + 0x08)
 #define CNL_DSP_REG_HIPCIDR		(CNL_DSP_IPC_BASE + 0x10)
 #define CNL_DSP_REG_HIPCIDA		(CNL_DSP_IPC_BASE + 0x14)
+#define CNL_DSP_REG_HIPCIDD		(CNL_DSP_IPC_BASE + 0x18)
 #define CNL_DSP_REG_HIPCCTL		(CNL_DSP_IPC_BASE + 0x28)
 
 /*  HIPCI */
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] Applied "ASoC: SOF: add a flag to indicate the system suspend target" to the asoc tree
  2019-10-25 22:41 ` [alsa-devel] [PATCH 19/26] ASoC: SOF: add a flag to indicate the system suspend target Pierre-Louis Bossart
@ 2019-10-28 14:56   ` Mark Brown
  0 siblings, 0 replies; 61+ messages in thread
From: Mark Brown @ 2019-10-28 14:56 UTC (permalink / raw)
  To: Keyon Jie; +Cc: tiwai, alsa-devel, Mark Brown, Pierre-Louis Bossart

The patch

   ASoC: SOF: add a flag to indicate the system suspend target

has been applied to the asoc tree at

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

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

From 7367d3096b1443e55a2c730d1966f423b15d5cad Mon Sep 17 00:00:00 2001
From: Keyon Jie <yang.jie@linux.intel.com>
Date: Fri, 25 Oct 2019 17:41:15 -0500
Subject: [PATCH] ASoC: SOF: add a flag to indicate the system suspend target

Add flag 's0_suspend' to indicate if the system is entering S0ix or
not.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-20-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sof/sof-priv.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h
index 2231c673c678..e715673f20e5 100644
--- a/sound/soc/sof/sof-priv.h
+++ b/sound/soc/sof/sof-priv.h
@@ -398,6 +398,8 @@ struct snd_sof_dev {
 
 	/* power states related */
 	enum sof_d0_substate d0_substate;
+	/* flag to track if the intended power target of suspend is S0ix */
+	bool s0_suspend;
 
 	/* DSP firmware boot */
 	wait_queue_head_t boot_wait;
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] Applied "ASoC: SOF: PM: add helpers for setting D0 substate for ADSP" to the asoc tree
  2019-10-25 22:41 ` [alsa-devel] [PATCH 17/26] ASoC: SOF: PM: add helpers for setting D0 substate for ADSP Pierre-Louis Bossart
@ 2019-10-28 14:56   ` Mark Brown
  2019-10-29 10:44   ` [alsa-devel] [PATCH 17/26] ASoC: SOF: PM: add helpers for setting D0 substate for ADSP Cezary Rojewski
  1 sibling, 0 replies; 61+ messages in thread
From: Mark Brown @ 2019-10-28 14:56 UTC (permalink / raw)
  To: Keyon Jie; +Cc: tiwai, alsa-devel, Mark Brown, Pierre-Louis Bossart

The patch

   ASoC: SOF: PM: add helpers for setting D0 substate for ADSP

has been applied to the asoc tree at

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

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

From 601252869f50af6f5ab377e7f4846d7b09cc66c0 Mon Sep 17 00:00:00 2001
From: Keyon Jie <yang.jie@linux.intel.com>
Date: Fri, 25 Oct 2019 17:41:13 -0500
Subject: [PATCH] ASoC: SOF: PM: add helpers for setting D0 substate for ADSP

Add snd_sof_set_d0_substate() helper for setting ADSP to a specific D0
substate, it will call into the platform specific implementation, and
update the d0_substate at success.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-18-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sof/pm.c       | 17 +++++++++++++++++
 sound/soc/sof/sof-priv.h |  2 ++
 2 files changed, 19 insertions(+)

diff --git a/sound/soc/sof/pm.c b/sound/soc/sof/pm.c
index ac900fb3379e..584241e9734a 100644
--- a/sound/soc/sof/pm.c
+++ b/sound/soc/sof/pm.c
@@ -411,6 +411,23 @@ int snd_sof_runtime_resume(struct device *dev)
 }
 EXPORT_SYMBOL(snd_sof_runtime_resume);
 
+int snd_sof_set_d0_substate(struct snd_sof_dev *sdev,
+			    enum sof_d0_substate d0_substate)
+{
+	int ret;
+
+	/* do platform specific set_state */
+	ret = snd_sof_dsp_set_power_state(sdev, d0_substate);
+	if (ret < 0)
+		return ret;
+
+	/* update dsp D0 sub-state */
+	sdev->d0_substate = d0_substate;
+
+	return 0;
+}
+EXPORT_SYMBOL(snd_sof_set_d0_substate);
+
 int snd_sof_resume(struct device *dev)
 {
 	return sof_resume(dev, false);
diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h
index 7a21a45d3635..2231c673c678 100644
--- a/sound/soc/sof/sof-priv.h
+++ b/sound/soc/sof/sof-priv.h
@@ -485,6 +485,8 @@ int snd_sof_runtime_resume(struct device *dev);
 int snd_sof_runtime_idle(struct device *dev);
 int snd_sof_resume(struct device *dev);
 int snd_sof_suspend(struct device *dev);
+int snd_sof_set_d0_substate(struct snd_sof_dev *sdev,
+			    enum sof_d0_substate d0_substate);
 
 void snd_sof_new_platform_drv(struct snd_sof_dev *sdev);
 
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] Applied "ASoC: SOF: configure D0ix IPC flags in set_power_state" to the asoc tree
  2019-10-25 22:41 ` [alsa-devel] [PATCH 16/26] ASoC: SOF: configure D0ix IPC flags in set_power_state Pierre-Louis Bossart
@ 2019-10-28 14:56   ` Mark Brown
  2019-10-29 10:37   ` [alsa-devel] [PATCH 16/26] ASoC: SOF: configure D0ix IPC flags in set_power_state Cezary Rojewski
  1 sibling, 0 replies; 61+ messages in thread
From: Mark Brown @ 2019-10-28 14:56 UTC (permalink / raw)
  To: Keyon Jie; +Cc: tiwai, alsa-devel, Mark Brown, Pierre-Louis Bossart

The patch

   ASoC: SOF: configure D0ix IPC flags in set_power_state

has been applied to the asoc tree at

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

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

From 534037fddd34b58be86a826d449a5a6635ecdbf5 Mon Sep 17 00:00:00 2001
From: Keyon Jie <yang.jie@linux.intel.com>
Date: Fri, 25 Oct 2019 17:41:12 -0500
Subject: [PATCH] ASoC: SOF: configure D0ix IPC flags in set_power_state

The configuration for D0ix in FW is platform specific, let's do this and
send IPC in the platform set_power_state() ops.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-17-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sof/intel/hda-dsp.c | 32 +++++++++++++++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)

diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c
index 936361bd25e9..b5070409a5e3 100644
--- a/sound/soc/sof/intel/hda-dsp.c
+++ b/sound/soc/sof/intel/hda-dsp.c
@@ -19,6 +19,7 @@
 #include <sound/hda_register.h>
 #include "../ops.h"
 #include "hda.h"
+#include "hda-ipc.h"
 
 /*
  * DSP Core control.
@@ -319,10 +320,28 @@ static int hda_dsp_wait_d0i3c_done(struct snd_sof_dev *sdev, int retry)
 	return 0;
 }
 
+static int hda_dsp_send_pm_gate_ipc(struct snd_sof_dev *sdev, u32 flags)
+{
+	struct sof_ipc_pm_gate pm_gate;
+	struct sof_ipc_reply reply;
+
+	memset(&pm_gate, 0, sizeof(pm_gate));
+
+	/* configure pm_gate ipc message */
+	pm_gate.hdr.size = sizeof(pm_gate);
+	pm_gate.hdr.cmd = SOF_IPC_GLB_PM_MSG | SOF_IPC_PM_GATE;
+	pm_gate.flags = flags;
+
+	/* send pm_gate ipc to dsp */
+	return sof_ipc_tx_message(sdev->ipc, pm_gate.hdr.cmd, &pm_gate,
+				  sizeof(pm_gate), &reply, sizeof(reply));
+}
+
 int hda_dsp_set_power_state(struct snd_sof_dev *sdev,
 			    enum sof_d0_substate d0_substate)
 {
 	struct hdac_bus *bus = sof_to_bus(sdev);
+	u32 flags;
 	int ret;
 	u8 value;
 
@@ -347,7 +366,18 @@ int hda_dsp_set_power_state(struct snd_sof_dev *sdev,
 	dev_vdbg(bus->dev, "D0I3C updated, register = 0x%x\n",
 		 snd_hdac_chip_readb(bus, VS_D0I3C));
 
-	return 0;
+	if (d0_substate == SOF_DSP_D0I0)
+		flags = HDA_PM_PPG;/* prevent power gating in D0 */
+	else
+		flags = HDA_PM_NO_DMA_TRACE;/* disable DMA trace in D0I3*/
+
+	/* sending pm_gate IPC */
+	ret = hda_dsp_send_pm_gate_ipc(sdev, flags);
+	if (ret < 0)
+		dev_err(sdev->dev,
+			"error: PM_GATE ipc error %d\n", ret);
+
+	return ret;
 }
 
 static int hda_suspend(struct snd_sof_dev *sdev, bool runtime_suspend)
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] Applied "ASoC: SOF: ipc: introduce message for DSP power gating" to the asoc tree
  2019-10-25 22:41 ` [alsa-devel] [PATCH 13/26] ASoC: SOF: ipc: introduce message for DSP power gating Pierre-Louis Bossart
@ 2019-10-28 14:56   ` Mark Brown
  0 siblings, 0 replies; 61+ messages in thread
From: Mark Brown @ 2019-10-28 14:56 UTC (permalink / raw)
  To: Keyon Jie; +Cc: tiwai, alsa-devel, Mark Brown, Pierre-Louis Bossart

The patch

   ASoC: SOF: ipc: introduce message for DSP power gating

has been applied to the asoc tree at

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

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

From 10992004e1e960c7e256ec70c7ab22895a7003d7 Mon Sep 17 00:00:00 2001
From: Keyon Jie <yang.jie@linux.intel.com>
Date: Fri, 25 Oct 2019 17:41:09 -0500
Subject: [PATCH] ASoC: SOF: ipc: introduce message for DSP power gating

Add new ipc messages which will be sent from driver to FW, to ask FW to
enter specific power saving state.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-14-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 include/sound/sof/header.h | 1 +
 include/sound/sof/pm.h     | 8 ++++++++
 2 files changed, 9 insertions(+)

diff --git a/include/sound/sof/header.h b/include/sound/sof/header.h
index 332143ff7278..bf3edd9c08b4 100644
--- a/include/sound/sof/header.h
+++ b/include/sound/sof/header.h
@@ -75,6 +75,7 @@
 #define SOF_IPC_PM_CLK_GET			SOF_CMD_TYPE(0x005)
 #define SOF_IPC_PM_CLK_REQ			SOF_CMD_TYPE(0x006)
 #define SOF_IPC_PM_CORE_ENABLE			SOF_CMD_TYPE(0x007)
+#define SOF_IPC_PM_GATE				SOF_CMD_TYPE(0x008)
 
 /* component runtime config - multiple different types */
 #define SOF_IPC_COMP_SET_VALUE			SOF_CMD_TYPE(0x001)
diff --git a/include/sound/sof/pm.h b/include/sound/sof/pm.h
index 003879401d63..3cf2e0f39d94 100644
--- a/include/sound/sof/pm.h
+++ b/include/sound/sof/pm.h
@@ -45,4 +45,12 @@ struct sof_ipc_pm_core_config {
 	uint32_t enable_mask;
 } __packed;
 
+struct sof_ipc_pm_gate {
+	struct sof_ipc_cmd_hdr hdr;
+	uint32_t flags;	/* platform specific */
+
+	/* reserved for future use */
+	uint32_t reserved[5];
+} __packed;
+
 #endif
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] Applied "ASoC: SOF: Intel: hda-ipc: Don't read mailbox for PM_GATE reply" to the asoc tree
  2019-10-25 22:41 ` [alsa-devel] [PATCH 14/26] ASoC: SOF: Intel: hda-ipc: Don't read mailbox for PM_GATE reply Pierre-Louis Bossart
@ 2019-10-28 14:56   ` Mark Brown
  0 siblings, 0 replies; 61+ messages in thread
From: Mark Brown @ 2019-10-28 14:56 UTC (permalink / raw)
  To: Keyon Jie; +Cc: tiwai, alsa-devel, Mark Brown, Pierre-Louis Bossart

The patch

   ASoC: SOF: Intel: hda-ipc: Don't read mailbox for PM_GATE reply

has been applied to the asoc tree at

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

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

From 463fbf6dc03aff41e973602bbad6cb135fa6d48a Mon Sep 17 00:00:00 2001
From: Keyon Jie <yang.jie@linux.intel.com>
Date: Fri, 25 Oct 2019 17:41:10 -0500
Subject: [PATCH] ASoC: SOF: Intel: hda-ipc: Don't read mailbox for PM_GATE
 reply

Memory windows could be powered off before receiving PM_GATE IPC reply
from FW, we can't read the mailbox to get reply.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-15-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sof/intel/hda-ipc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sound/soc/sof/intel/hda-ipc.c b/sound/soc/sof/intel/hda-ipc.c
index 6aae6f18b3dc..0fd2153c1769 100644
--- a/sound/soc/sof/intel/hda-ipc.c
+++ b/sound/soc/sof/intel/hda-ipc.c
@@ -83,10 +83,12 @@ void hda_dsp_ipc_get_reply(struct snd_sof_dev *sdev)
 	}
 
 	hdr = msg->msg_data;
-	if (hdr->cmd == (SOF_IPC_GLB_PM_MSG | SOF_IPC_PM_CTX_SAVE)) {
+	if (hdr->cmd == (SOF_IPC_GLB_PM_MSG | SOF_IPC_PM_CTX_SAVE) ||
+	    hdr->cmd == (SOF_IPC_GLB_PM_MSG | SOF_IPC_PM_GATE)) {
 		/*
 		 * memory windows are powered off before sending IPC reply,
-		 * so we can't read the mailbox for CTX_SAVE reply.
+		 * so we can't read the mailbox for CTX_SAVE and PM_GATE
+		 * replies.
 		 */
 		reply.error = 0;
 		reply.hdr.cmd = SOF_IPC_GLB_REPLY;
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] Applied "ASoC: SOF: Intel: HDA: add cAVS specific compact IPC header file" to the asoc tree
  2019-10-25 22:41 ` [alsa-devel] [PATCH 15/26] ASoC: SOF: Intel: HDA: add cAVS specific compact IPC header file Pierre-Louis Bossart
@ 2019-10-28 14:56   ` Mark Brown
  0 siblings, 0 replies; 61+ messages in thread
From: Mark Brown @ 2019-10-28 14:56 UTC (permalink / raw)
  To: Keyon Jie; +Cc: tiwai, alsa-devel, Mark Brown, Pierre-Louis Bossart

The patch

   ASoC: SOF: Intel: HDA: add cAVS specific compact IPC header file

has been applied to the asoc tree at

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

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

From 5056193d4d1a8b73087145add21141c46027d6a2 Mon Sep 17 00:00:00 2001
From: Keyon Jie <yang.jie@linux.intel.com>
Date: Fri, 25 Oct 2019 17:41:11 -0500
Subject: [PATCH] ASoC: SOF: Intel: HDA: add cAVS specific compact IPC header
 file

On cAVS platforms, some IPCs are required to be sent via IPC registers
only(e.g. when in D0i3, mailbox is unaccessible), add hda-ipc.h to hold
definition of those compact IPCs.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-16-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sof/intel/hda-ipc.h | 51 +++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)
 create mode 100644 sound/soc/sof/intel/hda-ipc.h

diff --git a/sound/soc/sof/intel/hda-ipc.h b/sound/soc/sof/intel/hda-ipc.h
new file mode 100644
index 000000000000..aef0ceac9803
--- /dev/null
+++ b/sound/soc/sof/intel/hda-ipc.h
@@ -0,0 +1,51 @@
+/* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */
+/*
+ * This file is provided under a dual BSD/GPLv2 license.  When using or
+ * redistributing this file, you may do so under either license.
+ *
+ * Copyright(c) 2019 Intel Corporation. All rights reserved.
+ *
+ * Author: Keyon Jie <yang.jie@linux.intel.com>
+ */
+
+#ifndef __SOF_INTEL_HDA_IPC_H
+#define __SOF_INTEL_HDA_IPC_H
+
+/*
+ * Primary register, mapped to
+ * - DIPCTDR (HIPCIDR) in sideband IPC (cAVS 1.8+)
+ * - DIPCT in cAVS 1.5 IPC
+ *
+ * Secondary register, mapped to:
+ * - DIPCTDD (HIPCIDD) in sideband IPC (cAVS 1.8+)
+ * - DIPCTE in cAVS 1.5 IPC
+ */
+
+/* Common bits in primary register */
+
+/* Reserved for doorbell */
+#define HDA_IPC_RSVD_31		BIT(31)
+/* Target, 0 - normal message, 1 - compact message(cAVS compatible) */
+#define HDA_IPC_MSG_COMPACT	BIT(30)
+/* Direction, 0 - request, 1 - response */
+#define HDA_IPC_RSP		BIT(29)
+
+#define HDA_IPC_TYPE_SHIFT	24
+#define HDA_IPC_TYPE_MASK	GENMASK(28, 24)
+#define HDA_IPC_TYPE(x)		((x) << HDA_IPC_TYPE_SHIFT)
+
+#define HDA_IPC_PM_GATE		HDA_IPC_TYPE(0x8U)
+
+/* Command specific payload bits in secondary register */
+
+/* Disable DMA tracing (0 - keep tracing, 1 - to disable DMA trace) */
+#define HDA_PM_NO_DMA_TRACE	BIT(4)
+/* Prevent clock gating (0 - cg allowed, 1 - DSP clock always on) */
+#define HDA_PM_PCG		BIT(3)
+/* Prevent power gating (0 - deep power state transitions allowed) */
+#define HDA_PM_PPG		BIT(2)
+/* Indicates whether streaming is active */
+#define HDA_PM_PG_STREAMING	BIT(1)
+#define HDA_PM_PG_RSVD		BIT(0)
+
+#endif
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] Applied "ASoC: SOF: PM: rename sof_send_pm_ipc to sof_send_pm_ctx_ipc" to the asoc tree
  2019-10-25 22:41 ` [alsa-devel] [PATCH 12/26] ASoC: SOF: PM: rename sof_send_pm_ipc to sof_send_pm_ctx_ipc Pierre-Louis Bossart
@ 2019-10-28 14:56   ` Mark Brown
  0 siblings, 0 replies; 61+ messages in thread
From: Mark Brown @ 2019-10-28 14:56 UTC (permalink / raw)
  To: Keyon Jie; +Cc: tiwai, alsa-devel, Mark Brown, Pierre-Louis Bossart

The patch

   ASoC: SOF: PM: rename sof_send_pm_ipc to sof_send_pm_ctx_ipc

has been applied to the asoc tree at

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

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

From 7c7eba2402c11137d1fa1d3fb964a2c6fc1ded3e Mon Sep 17 00:00:00 2001
From: Keyon Jie <yang.jie@linux.intel.com>
Date: Fri, 25 Oct 2019 17:41:08 -0500
Subject: [PATCH] ASoC: SOF: PM: rename sof_send_pm_ipc to sof_send_pm_ctx_ipc

The helper sof_send_pm_ipc() is only suitable for context save/restore
IPCs' sending, so rename it to sof_send_pm_ctx_ipc here.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-13-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sof/pm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/soc/sof/pm.c b/sound/soc/sof/pm.c
index 81e623dfc7e5..ac900fb3379e 100644
--- a/sound/soc/sof/pm.c
+++ b/sound/soc/sof/pm.c
@@ -197,7 +197,7 @@ static int sof_restore_pipelines(struct snd_sof_dev *sdev)
 	return ret;
 }
 
-static int sof_send_pm_ipc(struct snd_sof_dev *sdev, int cmd)
+static int sof_send_pm_ctx_ipc(struct snd_sof_dev *sdev, int cmd)
 {
 	struct sof_ipc_pm_ctx pm_ctx;
 	struct sof_ipc_reply reply;
@@ -320,7 +320,7 @@ static int sof_resume(struct device *dev, bool runtime_resume)
 	}
 
 	/* notify DSP of system resume */
-	ret = sof_send_pm_ipc(sdev, SOF_IPC_PM_CTX_RESTORE);
+	ret = sof_send_pm_ctx_ipc(sdev, SOF_IPC_PM_CTX_RESTORE);
 	if (ret < 0)
 		dev_err(sdev->dev,
 			"error: ctx_restore ipc error during resume %d\n",
@@ -361,7 +361,7 @@ static int sof_suspend(struct device *dev, bool runtime_suspend)
 		sof_cache_debugfs(sdev);
 #endif
 	/* notify DSP of upcoming power down */
-	ret = sof_send_pm_ipc(sdev, SOF_IPC_PM_CTX_SAVE);
+	ret = sof_send_pm_ctx_ipc(sdev, SOF_IPC_PM_CTX_SAVE);
 	if (ret == -EBUSY || ret == -EAGAIN) {
 		/*
 		 * runtime PM has logic to handle -EBUSY/-EAGAIN so
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] Applied "ASoC: SOF: Intel: HDA: use macro for register polling retry count" to the asoc tree
  2019-10-25 22:41 ` [alsa-devel] [PATCH 11/26] ASoC: SOF: Intel: HDA: use macro for register polling retry count Pierre-Louis Bossart
@ 2019-10-28 14:56   ` Mark Brown
  0 siblings, 0 replies; 61+ messages in thread
From: Mark Brown @ 2019-10-28 14:56 UTC (permalink / raw)
  To: Keyon Jie; +Cc: tiwai, alsa-devel, Mark Brown, Pierre-Louis Bossart

The patch

   ASoC: SOF: Intel: HDA: use macro for register polling retry count

has been applied to the asoc tree at

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

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

From 92f4beb718d76e93b76343a3ba872df6cb210672 Mon Sep 17 00:00:00 2001
From: Keyon Jie <yang.jie@linux.intel.com>
Date: Fri, 25 Oct 2019 17:41:07 -0500
Subject: [PATCH] ASoC: SOF: Intel: HDA: use macro for register polling retry
 count

Define macro and use it for the register polling retry count.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-12-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sof/intel/hda-dsp.c | 6 ++----
 sound/soc/sof/intel/hda.h     | 1 +
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c
index 74805a066183..936361bd25e9 100644
--- a/sound/soc/sof/intel/hda-dsp.c
+++ b/sound/soc/sof/intel/hda-dsp.c
@@ -323,12 +323,11 @@ int hda_dsp_set_power_state(struct snd_sof_dev *sdev,
 			    enum sof_d0_substate d0_substate)
 {
 	struct hdac_bus *bus = sof_to_bus(sdev);
-	int retry = 50;
 	int ret;
 	u8 value;
 
 	/* Write to D0I3C after Command-In-Progress bit is cleared */
-	ret = hda_dsp_wait_d0i3c_done(sdev, retry);
+	ret = hda_dsp_wait_d0i3c_done(sdev, HDA_DSP_REG_POLL_RETRY_COUNT);
 	if (ret < 0) {
 		dev_err(bus->dev, "CIP timeout before D0I3C update!\n");
 		return ret;
@@ -339,8 +338,7 @@ int hda_dsp_set_power_state(struct snd_sof_dev *sdev,
 	snd_hdac_chip_updateb(bus, VS_D0I3C, SOF_HDA_VS_D0I3C_I3, value);
 
 	/* Wait for cmd in progress to be cleared before exiting the function */
-	retry = 50;
-	ret = hda_dsp_wait_d0i3c_done(sdev, retry);
+	ret = hda_dsp_wait_d0i3c_done(sdev, HDA_DSP_REG_POLL_RETRY_COUNT);
 	if (ret < 0) {
 		dev_err(bus->dev, "CIP timeout after D0I3C update!\n");
 		return ret;
diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h
index 0e7c366b8f71..99ec60218c16 100644
--- a/sound/soc/sof/intel/hda.h
+++ b/sound/soc/sof/intel/hda.h
@@ -214,6 +214,7 @@
 #define HDA_DSP_CTRL_RESET_TIMEOUT		100
 #define HDA_DSP_WAIT_TIMEOUT		500	/* 500 msec */
 #define HDA_DSP_REG_POLL_INTERVAL_US		500	/* 0.5 msec */
+#define HDA_DSP_REG_POLL_RETRY_COUNT		50
 
 #define HDA_DSP_ADSPIC_IPC			1
 #define HDA_DSP_ADSPIS_IPC			1
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] Applied "ASoC: SOF: topology: parse and store d0i3_compatible flag" to the asoc tree
  2019-10-25 22:41 ` [alsa-devel] [PATCH 09/26] ASoC: SOF: topology: parse and store d0i3_compatible flag Pierre-Louis Bossart
@ 2019-10-28 14:56   ` Mark Brown
  0 siblings, 0 replies; 61+ messages in thread
From: Mark Brown @ 2019-10-28 14:56 UTC (permalink / raw)
  To: Keyon Jie; +Cc: tiwai, alsa-devel, Mark Brown, Pierre-Louis Bossart

The patch

   ASoC: SOF: topology: parse and store d0i3_compatible flag

has been applied to the asoc tree at

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

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

From c5232c0171428f005a3204e1c264231fb5999b28 Mon Sep 17 00:00:00 2001
From: Keyon Jie <yang.jie@linux.intel.com>
Date: Fri, 25 Oct 2019 17:41:05 -0500
Subject: [PATCH] ASoC: SOF: topology: parse and store d0i3_compatible flag

Parses the token from tplg file and store it to snd_sof_pcm_stream
d0i3_compatible flag, which can be used later for d0ix transition
management.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-10-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sof/topology.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c
index 121e5d6f8477..cc138ac6a8eb 100644
--- a/sound/soc/sof/topology.c
+++ b/sound/soc/sof/topology.c
@@ -2307,6 +2307,7 @@ static int sof_dai_load(struct snd_soc_component *scomp, int index,
 {
 	struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp);
 	struct snd_soc_tplg_stream_caps *caps;
+	struct snd_soc_tplg_private *private = &pcm->priv;
 	struct snd_sof_pcm *spcm;
 	int stream = SNDRV_PCM_STREAM_PLAYBACK;
 	int ret = 0;
@@ -2329,10 +2330,22 @@ static int sof_dai_load(struct snd_soc_component *scomp, int index,
 	dai_drv->dobj.private = spcm;
 	list_add(&spcm->list, &sdev->pcm_list);
 
+	ret = sof_parse_tokens(scomp, spcm, stream_tokens,
+			       ARRAY_SIZE(stream_tokens), private->array,
+			       le32_to_cpu(private->size));
+	if (ret) {
+		dev_err(sdev->dev, "error: parse stream tokens failed %d\n",
+			le32_to_cpu(private->size));
+		return ret;
+	}
+
 	/* do we need to allocate playback PCM DMA pages */
 	if (!spcm->pcm.playback)
 		goto capture;
 
+	dev_vdbg(sdev->dev, "tplg: pcm %s stream tokens: playback d0i3:%d\n",
+		 spcm->pcm.pcm_name, spcm->stream[0].d0i3_compatible);
+
 	caps = &spcm->pcm.caps[stream];
 
 	/* allocate playback page table buffer */
@@ -2360,6 +2373,9 @@ static int sof_dai_load(struct snd_soc_component *scomp, int index,
 	if (!spcm->pcm.capture)
 		return ret;
 
+	dev_vdbg(sdev->dev, "tplg: pcm %s stream tokens: capture d0i3:%d\n",
+		 spcm->pcm.pcm_name, spcm->stream[1].d0i3_compatible);
+
 	caps = &spcm->pcm.caps[stream];
 
 	/* allocate capture page table buffer */
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] Applied "ASoC: SOF: Intel: hda-dsp: align the comments for D0I3C update" to the asoc tree
  2019-10-25 22:41 ` [alsa-devel] [PATCH 10/26] ASoC: SOF: Intel: hda-dsp: align the comments for D0I3C update Pierre-Louis Bossart
@ 2019-10-28 14:56   ` Mark Brown
  0 siblings, 0 replies; 61+ messages in thread
From: Mark Brown @ 2019-10-28 14:56 UTC (permalink / raw)
  To: Keyon Jie; +Cc: tiwai, alsa-devel, Mark Brown, Pierre-Louis Bossart

The patch

   ASoC: SOF: Intel: hda-dsp: align the comments for D0I3C update

has been applied to the asoc tree at

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

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

From aae7c82d01219bf568a7b12f5839d7ca52b17d59 Mon Sep 17 00:00:00 2001
From: Keyon Jie <yang.jie@linux.intel.com>
Date: Fri, 25 Oct 2019 17:41:06 -0500
Subject: [PATCH] ASoC: SOF: Intel: hda-dsp: align the comments for D0I3C
 update

Align the logs for CIP timeout at D0I3C.I3 updating.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-11-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sof/intel/hda-dsp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c
index fa2f1f66c72c..74805a066183 100644
--- a/sound/soc/sof/intel/hda-dsp.c
+++ b/sound/soc/sof/intel/hda-dsp.c
@@ -330,7 +330,7 @@ int hda_dsp_set_power_state(struct snd_sof_dev *sdev,
 	/* Write to D0I3C after Command-In-Progress bit is cleared */
 	ret = hda_dsp_wait_d0i3c_done(sdev, retry);
 	if (ret < 0) {
-		dev_err(bus->dev, "CIP timeout before update D0I3C!\n");
+		dev_err(bus->dev, "CIP timeout before D0I3C update!\n");
 		return ret;
 	}
 
@@ -342,7 +342,7 @@ int hda_dsp_set_power_state(struct snd_sof_dev *sdev,
 	retry = 50;
 	ret = hda_dsp_wait_d0i3c_done(sdev, retry);
 	if (ret < 0) {
-		dev_err(bus->dev, "CIP timeout after D0I3C updated!\n");
+		dev_err(bus->dev, "CIP timeout after D0I3C update!\n");
 		return ret;
 	}
 
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] Applied "ASoC: SOF: token: add tokens for PCM compatible with D0i3 substate" to the asoc tree
  2019-10-25 22:41 ` [alsa-devel] [PATCH 08/26] ASoC: SOF: token: add tokens for PCM compatible with D0i3 substate Pierre-Louis Bossart
@ 2019-10-28 14:56   ` Mark Brown
  2019-10-29 10:11   ` [alsa-devel] [PATCH 08/26] ASoC: SOF: token: add tokens for PCM compatible with D0i3 substate Cezary Rojewski
  1 sibling, 0 replies; 61+ messages in thread
From: Mark Brown @ 2019-10-28 14:56 UTC (permalink / raw)
  To: Keyon Jie; +Cc: tiwai, alsa-devel, Mark Brown, Pierre-Louis Bossart

The patch

   ASoC: SOF: token: add tokens for PCM compatible with D0i3 substate

has been applied to the asoc tree at

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

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

From 4a94940988cc44adeb383401dea0beeac4abbe63 Mon Sep 17 00:00:00 2001
From: Keyon Jie <yang.jie@linux.intel.com>
Date: Fri, 25 Oct 2019 17:41:04 -0500
Subject: [PATCH] ASoC: SOF: token: add tokens for PCM compatible with D0i3
 substate

Add stream token SOF_TKN_STREAM_PLAYBACK_COMPATIBLE_D0I3 and
SOF_TKN_STREAM_CAPTURE_COMPATIBLE_D0I3 to denote if the stream can be
opened at low power d0i3 status or not.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-9-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 include/uapi/sound/sof/tokens.h |  4 ++++
 sound/soc/sof/topology.c        | 10 ++++++++++
 2 files changed, 14 insertions(+)

diff --git a/include/uapi/sound/sof/tokens.h b/include/uapi/sound/sof/tokens.h
index d65406f34361..76883e6fb750 100644
--- a/include/uapi/sound/sof/tokens.h
+++ b/include/uapi/sound/sof/tokens.h
@@ -113,6 +113,10 @@
 /* ESAI */
 #define SOF_TKN_IMX_ESAI_MCLK_ID		1100
 
+/* Stream */
+#define SOF_TKN_STREAM_PLAYBACK_COMPATIBLE_D0I3	1200
+#define SOF_TKN_STREAM_CAPTURE_COMPATIBLE_D0I3	1201
+
 /* Led control for mute switches */
 #define SOF_TKN_MUTE_LED_USE			1300
 #define SOF_TKN_MUTE_LED_DIRECTION		1301
diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c
index b3ab6f23fc93..121e5d6f8477 100644
--- a/sound/soc/sof/topology.c
+++ b/sound/soc/sof/topology.c
@@ -567,6 +567,16 @@ static const struct sof_topology_token pcm_tokens[] = {
 		offsetof(struct sof_ipc_comp_host, dmac_config), 0},
 };
 
+/* PCM */
+static const struct sof_topology_token stream_tokens[] = {
+	{SOF_TKN_STREAM_PLAYBACK_COMPATIBLE_D0I3,
+		SND_SOC_TPLG_TUPLE_TYPE_BOOL, get_token_u16,
+		offsetof(struct snd_sof_pcm, stream[0].d0i3_compatible), 0},
+	{SOF_TKN_STREAM_CAPTURE_COMPATIBLE_D0I3,
+		SND_SOC_TPLG_TUPLE_TYPE_BOOL, get_token_u16,
+		offsetof(struct snd_sof_pcm, stream[1].d0i3_compatible), 0},
+};
+
 /* Generic components */
 static const struct sof_topology_token comp_tokens[] = {
 	{SOF_TKN_COMP_PERIOD_SINK_COUNT,
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] Applied "ASoC: SOF: add flag to snd_sof_pcm_stream for D0i3 compatible stream" to the asoc tree
  2019-10-25 22:41 ` [alsa-devel] [PATCH 07/26] ASoC: SOF: add flag to snd_sof_pcm_stream for D0i3 compatible stream Pierre-Louis Bossart
@ 2019-10-28 14:56   ` Mark Brown
  0 siblings, 0 replies; 61+ messages in thread
From: Mark Brown @ 2019-10-28 14:56 UTC (permalink / raw)
  To: Keyon Jie; +Cc: tiwai, alsa-devel, Mark Brown, Pierre-Louis Bossart

The patch

   ASoC: SOF: add flag to snd_sof_pcm_stream for D0i3 compatible stream

has been applied to the asoc tree at

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

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

From e5c97e88084b8dca6850eba5d2937716b88306c1 Mon Sep 17 00:00:00 2001
From: Keyon Jie <yang.jie@linux.intel.com>
Date: Fri, 25 Oct 2019 17:41:03 -0500
Subject: [PATCH] ASoC: SOF: add flag to snd_sof_pcm_stream for D0i3 compatible
 stream

Add flag d0i3_compatible to struct snd_sof_pcm_stream to denote if the
stream can tolerate a transition to the D0i3 substate while opened (thus
seen as 'active' by pm_runtime).

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-8-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sof/sof-priv.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h
index e9902e4e8e55..7a21a45d3635 100644
--- a/sound/soc/sof/sof-priv.h
+++ b/sound/soc/sof/sof-priv.h
@@ -310,6 +310,7 @@ struct snd_sof_pcm_stream {
 	struct sof_ipc_stream_posn posn;
 	struct snd_pcm_substream *substream;
 	struct work_struct period_elapsed_work;
+	bool d0i3_compatible; /* DSP can be in D0I3 when this pcm is opened */
 };
 
 /* ALSA SOF PCM device */
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] Applied "ASoC: SOF: Intel: CNL: add set_power_state() ops" to the asoc tree
  2019-10-25 22:41 ` [alsa-devel] [PATCH 05/26] ASoC: SOF: Intel: CNL: add set_power_state() ops Pierre-Louis Bossart
@ 2019-10-28 14:56   ` Mark Brown
  0 siblings, 0 replies; 61+ messages in thread
From: Mark Brown @ 2019-10-28 14:56 UTC (permalink / raw)
  To: Keyon Jie; +Cc: tiwai, alsa-devel, Mark Brown, Pierre-Louis Bossart

The patch

   ASoC: SOF: Intel: CNL: add set_power_state() ops

has been applied to the asoc tree at

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

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

From 73b51957122dc47a40325a5359b44ef337cbf217 Mon Sep 17 00:00:00 2001
From: Keyon Jie <yang.jie@linux.intel.com>
Date: Fri, 25 Oct 2019 17:41:01 -0500
Subject: [PATCH] ASoC: SOF: Intel: CNL: add set_power_state() ops

Using hda_dsp_set_power_state() as set_power_state() ops for cnl to do
d0ix platform configuration updates.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sof/intel/cnl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/soc/sof/intel/cnl.c b/sound/soc/sof/intel/cnl.c
index e9cdcc040fb5..982b81a0b13a 100644
--- a/sound/soc/sof/intel/cnl.c
+++ b/sound/soc/sof/intel/cnl.c
@@ -255,6 +255,7 @@ const struct snd_sof_dsp_ops sof_cnl_ops = {
 	.runtime_resume		= hda_dsp_runtime_resume,
 	.runtime_idle		= hda_dsp_runtime_idle,
 	.set_hw_params_upon_resume = hda_dsp_set_hw_params_upon_resume,
+	.set_power_state	= hda_dsp_set_power_state,
 
 	/* ALSA HW info flags */
 	.hw_info =	SNDRV_PCM_INFO_MMAP |
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] Applied "ASoC: SOF: Intel: APL: add set_power_state() ops" to the asoc tree
  2019-10-25 22:41 ` [alsa-devel] [PATCH 06/26] ASoC: SOF: Intel: APL: add set_power_state() ops Pierre-Louis Bossart
@ 2019-10-28 14:56   ` Mark Brown
  0 siblings, 0 replies; 61+ messages in thread
From: Mark Brown @ 2019-10-28 14:56 UTC (permalink / raw)
  To: Keyon Jie; +Cc: tiwai, alsa-devel, Mark Brown, Pierre-Louis Bossart

The patch

   ASoC: SOF: Intel: APL: add set_power_state() ops

has been applied to the asoc tree at

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

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

From 35c930ba6025964ac71f041065ae212a0fcc7cca Mon Sep 17 00:00:00 2001
From: Keyon Jie <yang.jie@linux.intel.com>
Date: Fri, 25 Oct 2019 17:41:02 -0500
Subject: [PATCH] ASoC: SOF: Intel: APL: add set_power_state() ops

Using hda_dsp_set_power_state() as set_power_state() ops for apl to do
d0ix platform configuration updates.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sof/intel/apl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/soc/sof/intel/apl.c b/sound/soc/sof/intel/apl.c
index 15d26e8d90a9..7daa8eb456c8 100644
--- a/sound/soc/sof/intel/apl.c
+++ b/sound/soc/sof/intel/apl.c
@@ -97,6 +97,7 @@ const struct snd_sof_dsp_ops sof_apl_ops = {
 	.runtime_resume		= hda_dsp_runtime_resume,
 	.runtime_idle		= hda_dsp_runtime_idle,
 	.set_hw_params_upon_resume = hda_dsp_set_hw_params_upon_resume,
+	.set_power_state	= hda_dsp_set_power_state,
 
 	/* ALSA HW info flags */
 	.hw_info =	SNDRV_PCM_INFO_MMAP |
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] Applied "ASoC: SOF: Intel: hda-dsp: Add helper for setting DSP D0ix substate" to the asoc tree
  2019-10-25 22:41 ` [alsa-devel] [PATCH 04/26] ASoC: SOF: Intel: hda-dsp: Add helper for setting DSP D0ix substate Pierre-Louis Bossart
@ 2019-10-28 14:56   ` Mark Brown
  2019-10-29 10:07   ` [alsa-devel] [PATCH 04/26] ASoC: SOF: Intel: hda-dsp: Add helper for setting DSP D0ix substate Cezary Rojewski
  1 sibling, 0 replies; 61+ messages in thread
From: Mark Brown @ 2019-10-28 14:56 UTC (permalink / raw)
  To: Keyon Jie; +Cc: tiwai, alsa-devel, Mark Brown, Pierre-Louis Bossart

The patch

   ASoC: SOF: Intel: hda-dsp: Add helper for setting DSP D0ix substate

has been applied to the asoc tree at

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

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

From 62f8f76604623980d41cf73691ca45288871efd9 Mon Sep 17 00:00:00 2001
From: Keyon Jie <yang.jie@linux.intel.com>
Date: Fri, 25 Oct 2019 17:41:00 -0500
Subject: [PATCH] ASoC: SOF: Intel: hda-dsp: Add helper for setting DSP D0ix
 substate

Adding helper to implement setting dsp to d0i3 or d0i0 status, this will
be needed for driver D0ix support.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sof/intel/hda-dsp.c | 46 +++++++++++++++++++++++++++++++++++
 sound/soc/sof/intel/hda.h     | 10 ++++++++
 2 files changed, 56 insertions(+)

diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c
index 3ea401646e0c..fa2f1f66c72c 100644
--- a/sound/soc/sof/intel/hda-dsp.c
+++ b/sound/soc/sof/intel/hda-dsp.c
@@ -306,6 +306,52 @@ void hda_dsp_ipc_int_disable(struct snd_sof_dev *sdev)
 			HDA_DSP_REG_HIPCCTL_BUSY | HDA_DSP_REG_HIPCCTL_DONE, 0);
 }
 
+static int hda_dsp_wait_d0i3c_done(struct snd_sof_dev *sdev, int retry)
+{
+	struct hdac_bus *bus = sof_to_bus(sdev);
+
+	while (snd_hdac_chip_readb(bus, VS_D0I3C) & SOF_HDA_VS_D0I3C_CIP) {
+		if (!retry--)
+			return -ETIMEDOUT;
+		usleep_range(10, 15);
+	}
+
+	return 0;
+}
+
+int hda_dsp_set_power_state(struct snd_sof_dev *sdev,
+			    enum sof_d0_substate d0_substate)
+{
+	struct hdac_bus *bus = sof_to_bus(sdev);
+	int retry = 50;
+	int ret;
+	u8 value;
+
+	/* Write to D0I3C after Command-In-Progress bit is cleared */
+	ret = hda_dsp_wait_d0i3c_done(sdev, retry);
+	if (ret < 0) {
+		dev_err(bus->dev, "CIP timeout before update D0I3C!\n");
+		return ret;
+	}
+
+	/* Update D0I3C register */
+	value = d0_substate == SOF_DSP_D0I3 ? SOF_HDA_VS_D0I3C_I3 : 0;
+	snd_hdac_chip_updateb(bus, VS_D0I3C, SOF_HDA_VS_D0I3C_I3, value);
+
+	/* Wait for cmd in progress to be cleared before exiting the function */
+	retry = 50;
+	ret = hda_dsp_wait_d0i3c_done(sdev, retry);
+	if (ret < 0) {
+		dev_err(bus->dev, "CIP timeout after D0I3C updated!\n");
+		return ret;
+	}
+
+	dev_vdbg(bus->dev, "D0I3C updated, register = 0x%x\n",
+		 snd_hdac_chip_readb(bus, VS_D0I3C));
+
+	return 0;
+}
+
 static int hda_suspend(struct snd_sof_dev *sdev, bool runtime_suspend)
 {
 	struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h
index ea02bf40cb25..0e7c366b8f71 100644
--- a/sound/soc/sof/intel/hda.h
+++ b/sound/soc/sof/intel/hda.h
@@ -64,6 +64,13 @@
 #define SOF_HDA_PPCTL_PIE		BIT(31)
 #define SOF_HDA_PPCTL_GPROCEN		BIT(30)
 
+/*Vendor Specific Registers*/
+#define SOF_HDA_VS_D0I3C		0x104A
+
+/* D0I3C Register fields */
+#define SOF_HDA_VS_D0I3C_CIP		BIT(0) /* Command-In-Progress */
+#define SOF_HDA_VS_D0I3C_I3		BIT(2) /* D0i3 enable bit */
+
 /* DPIB entry size: 8 Bytes = 2 DWords */
 #define SOF_HDA_DPIB_ENTRY_SIZE	0x8
 
@@ -455,6 +462,9 @@ int hda_dsp_core_reset_power_down(struct snd_sof_dev *sdev,
 void hda_dsp_ipc_int_enable(struct snd_sof_dev *sdev);
 void hda_dsp_ipc_int_disable(struct snd_sof_dev *sdev);
 
+int hda_dsp_set_power_state(struct snd_sof_dev *sdev,
+			    enum sof_d0_substate d0_substate);
+
 int hda_dsp_suspend(struct snd_sof_dev *sdev);
 int hda_dsp_resume(struct snd_sof_dev *sdev);
 int hda_dsp_runtime_suspend(struct snd_sof_dev *sdev);
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] Applied "ASoC: SOF: add set_power_state() to dsp_ops for power state update" to the asoc tree
  2019-10-25 22:40 ` [alsa-devel] [PATCH 03/26] ASoC: SOF: add set_power_state() to dsp_ops for power state update Pierre-Louis Bossart
@ 2019-10-28 14:56   ` Mark Brown
  0 siblings, 0 replies; 61+ messages in thread
From: Mark Brown @ 2019-10-28 14:56 UTC (permalink / raw)
  To: Keyon Jie; +Cc: tiwai, alsa-devel, Mark Brown, Pierre-Louis Bossart

The patch

   ASoC: SOF: add set_power_state() to dsp_ops for power state update

has been applied to the asoc tree at

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

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

From e8f112d8c29f44ded83f97828c104bf0904871ec Mon Sep 17 00:00:00 2001
From: Keyon Jie <yang.jie@linux.intel.com>
Date: Fri, 25 Oct 2019 17:40:59 -0500
Subject: [PATCH] ASoC: SOF: add set_power_state() to dsp_ops for power state
 update

D0i3 is a platform-defined substate of D0, so we need a
platform-specific callback in dsp_ops to handle the relevant
configurations.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sof/ops.h      | 9 +++++++++
 sound/soc/sof/sof-priv.h | 2 ++
 2 files changed, 11 insertions(+)

diff --git a/sound/soc/sof/ops.h b/sound/soc/sof/ops.h
index 824d36fe59fd..d7c8fc06f961 100644
--- a/sound/soc/sof/ops.h
+++ b/sound/soc/sof/ops.h
@@ -193,6 +193,15 @@ static inline int snd_sof_dsp_set_clk(struct snd_sof_dev *sdev, u32 freq)
 	return 0;
 }
 
+static inline int snd_sof_dsp_set_power_state(struct snd_sof_dev *sdev,
+					      enum sof_d0_substate substate)
+{
+	if (sof_ops(sdev)->set_power_state)
+		return sof_ops(sdev)->set_power_state(sdev, substate);
+
+	return 0;
+}
+
 /* debug */
 static inline void snd_sof_dsp_dbg_dump(struct snd_sof_dev *sdev, u32 flags)
 {
diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h
index 481dfe4ee2d0..e9902e4e8e55 100644
--- a/sound/soc/sof/sof-priv.h
+++ b/sound/soc/sof/sof-priv.h
@@ -189,6 +189,8 @@ struct snd_sof_dsp_ops {
 	int (*runtime_resume)(struct snd_sof_dev *sof_dev); /* optional */
 	int (*runtime_idle)(struct snd_sof_dev *sof_dev); /* optional */
 	int (*set_hw_params_upon_resume)(struct snd_sof_dev *sdev); /* optional */
+	int (*set_power_state)(struct snd_sof_dev *sdev,
+			       enum sof_d0_substate d0_substate); /* optional */
 
 	/* DSP clocking */
 	int (*set_clk)(struct snd_sof_dev *sof_dev, u32 freq); /* optional */
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] Applied "ASoC: SOF: reset default d0_substate at probe() and resume()" to the asoc tree
  2019-10-25 22:40 ` [alsa-devel] [PATCH 02/26] ASoC: SOF: reset default d0_substate at probe() and resume() Pierre-Louis Bossart
@ 2019-10-28 14:56   ` Mark Brown
  0 siblings, 0 replies; 61+ messages in thread
From: Mark Brown @ 2019-10-28 14:56 UTC (permalink / raw)
  To: Keyon Jie; +Cc: tiwai, alsa-devel, Mark Brown, Pierre-Louis Bossart

The patch

   ASoC: SOF: reset default d0_substate at probe() and resume()

has been applied to the asoc tree at

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

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

From 09fe6b528886c0d07ce539b837749edcc46618d0 Mon Sep 17 00:00:00 2001
From: Keyon Jie <yang.jie@linux.intel.com>
Date: Fri, 25 Oct 2019 17:40:58 -0500
Subject: [PATCH] ASoC: SOF: reset default d0_substate at probe() and resume()

We initialize/reset d0_substate to default d0i0 value when doing
transition D3-->D0, e.g. at success of probing and resuming.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sof/core.c | 3 +++
 sound/soc/sof/pm.c   | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/sound/soc/sof/core.c b/sound/soc/sof/core.c
index 5998861a9002..8661c2cca76b 100644
--- a/sound/soc/sof/core.c
+++ b/sound/soc/sof/core.c
@@ -458,6 +458,9 @@ int snd_sof_device_probe(struct device *dev, struct snd_sof_pdata *plat_data)
 	/* initialize sof device */
 	sdev->dev = dev;
 
+	/* initialize default D0 sub-state */
+	sdev->d0_substate = SOF_DSP_D0I0;
+
 	sdev->pdata = plat_data;
 	sdev->first_boot = true;
 	dev_set_drvdata(dev, sdev);
diff --git a/sound/soc/sof/pm.c b/sound/soc/sof/pm.c
index e23beaeefe00..81e623dfc7e5 100644
--- a/sound/soc/sof/pm.c
+++ b/sound/soc/sof/pm.c
@@ -326,6 +326,9 @@ static int sof_resume(struct device *dev, bool runtime_resume)
 			"error: ctx_restore ipc error during resume %d\n",
 			ret);
 
+	/* initialize default D0 sub-state */
+	sdev->d0_substate = SOF_DSP_D0I0;
+
 	return ret;
 }
 
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* [alsa-devel] Applied "ASoC: SOF: add a field to store the current D0 substate of DSP" to the asoc tree
  2019-10-25 22:40 ` [alsa-devel] [PATCH 01/26] ASoC: SOF: add a field to store the current D0 substate of DSP Pierre-Louis Bossart
@ 2019-10-28 14:56   ` Mark Brown
  2019-10-29 10:20   ` [alsa-devel] [PATCH 01/26] ASoC: SOF: add a field to store the current D0 substate of DSP Cezary Rojewski
  1 sibling, 0 replies; 61+ messages in thread
From: Mark Brown @ 2019-10-28 14:56 UTC (permalink / raw)
  To: Keyon Jie; +Cc: tiwai, alsa-devel, Mark Brown, Pierre-Louis Bossart

The patch

   ASoC: SOF: add a field to store the current D0 substate of DSP

has been applied to the asoc tree at

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

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

From 4c19030c511fd6eab029bae838f736256d2f43cd Mon Sep 17 00:00:00 2001
From: Keyon Jie <yang.jie@linux.intel.com>
Date: Fri, 25 Oct 2019 17:40:57 -0500
Subject: [PATCH] ASoC: SOF: add a field to store the current D0 substate of
 DSP

Add field d0_substate to struct snd_sof_dev to store the current DSP
D0 sub-state(only meaningful when DSP in D0), which could be D0I0 or
D0I3.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191025224122.7718-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sof/sof-priv.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h
index 2d40de5ee285..481dfe4ee2d0 100644
--- a/sound/soc/sof/sof-priv.h
+++ b/sound/soc/sof/sof-priv.h
@@ -68,6 +68,12 @@ extern int sof_core_debug;
 
 #define DMA_CHAN_INVALID	0xFFFFFFFF
 
+/* DSP D0ix sub-state */
+enum sof_d0_substate {
+	SOF_DSP_D0I0 = 0,	/* DSP default D0 substate */
+	SOF_DSP_D0I3,		/* DSP D0i3(low power) substate*/
+};
+
 struct snd_sof_dev;
 struct snd_sof_ipc_msg;
 struct snd_sof_ipc;
@@ -387,6 +393,9 @@ struct snd_sof_dev {
 	 */
 	struct snd_soc_component_driver plat_drv;
 
+	/* power states related */
+	enum sof_d0_substate d0_substate;
+
 	/* DSP firmware boot */
 	wait_queue_head_t boot_wait;
 	u32 boot_complete;
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: [alsa-devel] [PATCH 04/26] ASoC: SOF: Intel: hda-dsp: Add helper for setting DSP D0ix substate
  2019-10-25 22:41 ` [alsa-devel] [PATCH 04/26] ASoC: SOF: Intel: hda-dsp: Add helper for setting DSP D0ix substate Pierre-Louis Bossart
  2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: Intel: hda-dsp: Add helper for setting DSP D0ix substate" to the asoc tree Mark Brown
@ 2019-10-29 10:07   ` Cezary Rojewski
  2019-10-29 16:37     ` Sridharan, Ranjani
  1 sibling, 1 reply; 61+ messages in thread
From: Cezary Rojewski @ 2019-10-29 10:07 UTC (permalink / raw)
  To: Pierre-Louis Bossart; +Cc: tiwai, alsa-devel, broonie, Keyon Jie

On 2019-10-26 00:41, Pierre-Louis Bossart wrote:
> From: Keyon Jie <yang.jie@linux.intel.com>
> 
> Adding helper to implement setting dsp to d0i3 or d0i0 status, this will
> be needed for driver D0ix support.
> 
> Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

> +static int hda_dsp_wait_d0i3c_done(struct snd_sof_dev *sdev, int retry)
> +{
> +	struct hdac_bus *bus = sof_to_bus(sdev);
> +
> +	while (snd_hdac_chip_readb(bus, VS_D0I3C) & SOF_HDA_VS_D0I3C_CIP) {
> +		if (!retry--)
> +			return -ETIMEDOUT;
> +		usleep_range(10, 15);
> +	}
> +
> +	return 0;
> +}
> +
> +int hda_dsp_set_power_state(struct snd_sof_dev *sdev,
> +			    enum sof_d0_substate d0_substate)
> +{
> +	struct hdac_bus *bus = sof_to_bus(sdev);
> +	int retry = 50;
> +	int ret;
> +	u8 value;
> +
> +	/* Write to D0I3C after Command-In-Progress bit is cleared */
> +	ret = hda_dsp_wait_d0i3c_done(sdev, retry);
> +	if (ret < 0) {
> +		dev_err(bus->dev, "CIP timeout before update D0I3C!\n");
> +		return ret;
> +	}
> +
> +	/* Update D0I3C register */
> +	value = d0_substate == SOF_DSP_D0I3 ? SOF_HDA_VS_D0I3C_I3 : 0;

Some indentation or parenthesis would make this cleaner.

> +	snd_hdac_chip_updateb(bus, VS_D0I3C, SOF_HDA_VS_D0I3C_I3, value);
> +
> +	/* Wait for cmd in progress to be cleared before exiting the function */
> +	retry = 50;
> +	ret = hda_dsp_wait_d0i3c_done(sdev, retry);
> +	if (ret < 0) {
> +		dev_err(bus->dev, "CIP timeout after D0I3C updated!\n");
> +		return ret;
> +	}
> +
> +	dev_vdbg(bus->dev, "D0I3C updated, register = 0x%x\n",
> +		 snd_hdac_chip_readb(bus, VS_D0I3C));
> +
> +	return 0;
> +}
> +

I believe hda_dsp_wait_d0i3c_done function could have had its argument 
list simplified. "retry" is passed externally and it is always set to 
50. One could put the "retry" right inside _done function. This or allow 
the caller to modify the sleep period. Another option is to replace 
"retry" with "timeout period" (total timeout, that is) entirely.

In regard to maintenance, both ret checks (resulting in dev_errs) assume 
-ETIMEOUT outcome on _done failure. If said function gets updated in the 
future, these implicit checks might cause problems.

>   static int hda_suspend(struct snd_sof_dev *sdev, bool runtime_suspend)
>   {
>   	struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
> diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h
> index ea02bf40cb25..0e7c366b8f71 100644
> --- a/sound/soc/sof/intel/hda.h
> +++ b/sound/soc/sof/intel/hda.h
> @@ -64,6 +64,13 @@
>   #define SOF_HDA_PPCTL_PIE		BIT(31)
>   #define SOF_HDA_PPCTL_GPROCEN		BIT(30)
>   
> +/*Vendor Specific Registers*/

Missing spaces.

> +#define SOF_HDA_VS_D0I3C		0x104A
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: [alsa-devel] [PATCH 08/26] ASoC: SOF: token: add tokens for PCM compatible with D0i3 substate
  2019-10-25 22:41 ` [alsa-devel] [PATCH 08/26] ASoC: SOF: token: add tokens for PCM compatible with D0i3 substate Pierre-Louis Bossart
  2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: token: add tokens for PCM compatible with D0i3 substate" to the asoc tree Mark Brown
@ 2019-10-29 10:11   ` Cezary Rojewski
  2019-10-29 14:13     ` Pierre-Louis Bossart
  1 sibling, 1 reply; 61+ messages in thread
From: Cezary Rojewski @ 2019-10-29 10:11 UTC (permalink / raw)
  To: Pierre-Louis Bossart; +Cc: tiwai, alsa-devel, broonie, Keyon Jie

On 2019-10-26 00:41, Pierre-Louis Bossart wrote:
> From: Keyon Jie <yang.jie@linux.intel.com>
> 
> Add stream token SOF_TKN_STREAM_PLAYBACK_COMPATIBLE_D0I3 and
> SOF_TKN_STREAM_CAPTURE_COMPATIBLE_D0I3 to denote if the stream can be
> opened at low power d0i3 status or not.
> 
> Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

By any chance, can stream be playback D0ix incompatible but capture D0ix 
compatible? Single token would suffice, no?
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: [alsa-devel] [PATCH 01/26] ASoC: SOF: add a field to store the current D0 substate of DSP
  2019-10-25 22:40 ` [alsa-devel] [PATCH 01/26] ASoC: SOF: add a field to store the current D0 substate of DSP Pierre-Louis Bossart
  2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: add a field to store the current D0 substate of DSP" to the asoc tree Mark Brown
@ 2019-10-29 10:20   ` Cezary Rojewski
  2019-10-29 14:11     ` Pierre-Louis Bossart
  1 sibling, 1 reply; 61+ messages in thread
From: Cezary Rojewski @ 2019-10-29 10:20 UTC (permalink / raw)
  To: Pierre-Louis Bossart; +Cc: tiwai, alsa-devel, broonie, Keyon Jie

On 2019-10-26 00:40, Pierre-Louis Bossart wrote:
> +/* DSP D0ix sub-state */
> +enum sof_d0_substate {
> +	SOF_DSP_D0I0 = 0,	/* DSP default D0 substate */
> +	SOF_DSP_D0I3,		/* DSP D0i3(low power) substate*/
> +};

Name of the type states: "d0 substate" while description "D0ix 
sub-state". Why was not this named D0ix from the get-go? Goes into the 
same the same naming bucket as S0ix.

On the further note, adding D0ix patch within "enable S0ix support for 
Intel platforms" is misleading. S-states != D-states. D0ix is especially 
orthogonal. It is these to further reduce power consumption when system 
and device are in S0 and D0 respectively and idle time between IPC 
communication is long enough for DSP to be power gated.

Czarek
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: [alsa-devel] [PATCH 16/26] ASoC: SOF: configure D0ix IPC flags in set_power_state
  2019-10-25 22:41 ` [alsa-devel] [PATCH 16/26] ASoC: SOF: configure D0ix IPC flags in set_power_state Pierre-Louis Bossart
  2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: configure D0ix IPC flags in set_power_state" to the asoc tree Mark Brown
@ 2019-10-29 10:37   ` Cezary Rojewski
  1 sibling, 0 replies; 61+ messages in thread
From: Cezary Rojewski @ 2019-10-29 10:37 UTC (permalink / raw)
  To: Pierre-Louis Bossart; +Cc: tiwai, alsa-devel, broonie, Keyon Jie

On 2019-10-26 00:41, Pierre-Louis Bossart wrote:
> +static int hda_dsp_send_pm_gate_ipc(struct snd_sof_dev *sdev, u32 flags)
> +{
> +	struct sof_ipc_pm_gate pm_gate;
> +	struct sof_ipc_reply reply;
> +
> +	memset(&pm_gate, 0, sizeof(pm_gate));
> +
> +	/* configure pm_gate ipc message */
> +	pm_gate.hdr.size = sizeof(pm_gate);
> +	pm_gate.hdr.cmd = SOF_IPC_GLB_PM_MSG | SOF_IPC_PM_GATE;
> +	pm_gate.flags = flags;
> +
> +	/* send pm_gate ipc to dsp */

Is this comment necessary?

> +	return sof_ipc_tx_message(sdev->ipc, pm_gate.hdr.cmd, &pm_gate,
> +				  sizeof(pm_gate), &reply, sizeof(reply));
> +}
> +
>   int hda_dsp_set_power_state(struct snd_sof_dev *sdev,
>   			    enum sof_d0_substate d0_substate)
>   {
>   	struct hdac_bus *bus = sof_to_bus(sdev);
> +	u32 flags;
>   	int ret;
>   	u8 value;
>   
> @@ -347,7 +366,18 @@ int hda_dsp_set_power_state(struct snd_sof_dev *sdev,
>   	dev_vdbg(bus->dev, "D0I3C updated, register = 0x%x\n",
>   		 snd_hdac_chip_readb(bus, VS_D0I3C));
>   
> -	return 0;
> +	if (d0_substate == SOF_DSP_D0I0)
> +		flags = HDA_PM_PPG;/* prevent power gating in D0 */
> +	else
> +		flags = HDA_PM_NO_DMA_TRACE;/* disable DMA trace in D0I3*/

Missing spaces between code and comments.
Could you explain what DMA trace has to do with your flow?

> +
> +	/* sending pm_gate IPC */
> +	ret = hda_dsp_send_pm_gate_ipc(sdev, flags);
> +	if (ret < 0)
> +		dev_err(sdev->dev,
> +			"error: PM_GATE ipc error %d\n", ret);
> +

Being so detailed within each ipc handler does not increase code 
readability. Having single "pipe" which all ipcs go through with common 
dev_err dumping fw error/ status and ipc's header is the better option 
IMHO. These are so many IPC handlers. Assume you change "error msg 
format". With current approach each and every handler with have to be 
updated.


> +	return ret;
>   }
>   
>   static int hda_suspend(struct snd_sof_dev *sdev, bool runtime_suspend)
> 
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: [alsa-devel] [PATCH 17/26] ASoC: SOF: PM: add helpers for setting D0 substate for ADSP
  2019-10-25 22:41 ` [alsa-devel] [PATCH 17/26] ASoC: SOF: PM: add helpers for setting D0 substate for ADSP Pierre-Louis Bossart
  2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: PM: add helpers for setting D0 substate for ADSP" to the asoc tree Mark Brown
@ 2019-10-29 10:44   ` Cezary Rojewski
  1 sibling, 0 replies; 61+ messages in thread
From: Cezary Rojewski @ 2019-10-29 10:44 UTC (permalink / raw)
  To: Pierre-Louis Bossart; +Cc: tiwai, alsa-devel, broonie, Keyon Jie

On 2019-10-26 00:41, Pierre-Louis Bossart wrote:
> +int snd_sof_set_d0_substate(struct snd_sof_dev *sdev,
> +			    enum sof_d0_substate d0_substate)
> +{
> +	int ret;
> +
> +	/* do platform specific set_state */
> +	ret = snd_sof_dsp_set_power_state(sdev, d0_substate);
> +	if (ret < 0)
> +		return ret;
> +
> +	/* update dsp D0 sub-state */
> +	sdev->d0_substate = d0_substate;
> +
> +	return 0;
> +}
> +EXPORT_SYMBOL(snd_sof_set_d0_substate);

Are reason for not merging this directly with snd_sof_dsp_set_power_state?
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: [alsa-devel] [PATCH 01/26] ASoC: SOF: add a field to store the current D0 substate of DSP
  2019-10-29 10:20   ` [alsa-devel] [PATCH 01/26] ASoC: SOF: add a field to store the current D0 substate of DSP Cezary Rojewski
@ 2019-10-29 14:11     ` Pierre-Louis Bossart
  0 siblings, 0 replies; 61+ messages in thread
From: Pierre-Louis Bossart @ 2019-10-29 14:11 UTC (permalink / raw)
  To: Cezary Rojewski; +Cc: tiwai, alsa-devel, broonie, Keyon Jie



On 10/29/19 5:20 AM, Cezary Rojewski wrote:
> On 2019-10-26 00:40, Pierre-Louis Bossart wrote:
>> +/* DSP D0ix sub-state */
>> +enum sof_d0_substate {
>> +    SOF_DSP_D0I0 = 0,    /* DSP default D0 substate */
>> +    SOF_DSP_D0I3,        /* DSP D0i3(low power) substate*/
>> +};
> 
> Name of the type states: "d0 substate" while description "D0ix 
> sub-state". Why was not this named D0ix from the get-go? Goes into the 
> same the same naming bucket as S0ix.

The definition is correct, from the pm_runtime perspective the device is 
'active' i.e. D0. D0ix is a substate of D0.

> 
> On the further note, adding D0ix patch within "enable S0ix support for 
> Intel platforms" is misleading. S-states != D-states. D0ix is especially 
> orthogonal. It is these to further reduce power consumption when system 
> and device are in S0 and D0 respectively and idle time between IPC 
> communication is long enough for DSP to be power gated.

there are well-defined requirements and dependencies between S and D states:

S0: device can be in D0, D0ix, D3
S0ix: device can be in D0ix, D3
S3: device can be in D3

That's hardly orthogonal.


_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: [alsa-devel] [PATCH 08/26] ASoC: SOF: token: add tokens for PCM compatible with D0i3 substate
  2019-10-29 10:11   ` [alsa-devel] [PATCH 08/26] ASoC: SOF: token: add tokens for PCM compatible with D0i3 substate Cezary Rojewski
@ 2019-10-29 14:13     ` Pierre-Louis Bossart
  0 siblings, 0 replies; 61+ messages in thread
From: Pierre-Louis Bossart @ 2019-10-29 14:13 UTC (permalink / raw)
  To: Cezary Rojewski; +Cc: tiwai, alsa-devel, broonie, Keyon Jie



On 10/29/19 5:11 AM, Cezary Rojewski wrote:
> On 2019-10-26 00:41, Pierre-Louis Bossart wrote:
>> From: Keyon Jie <yang.jie@linux.intel.com>
>>
>> Add stream token SOF_TKN_STREAM_PLAYBACK_COMPATIBLE_D0I3 and
>> SOF_TKN_STREAM_CAPTURE_COMPATIBLE_D0I3 to denote if the stream can be
>> opened at low power d0i3 status or not.
>>
>> Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
>> Signed-off-by: Pierre-Louis Bossart 
>> <pierre-louis.bossart@linux.intel.com>
> 
> By any chance, can stream be playback D0ix incompatible but capture D0ix 
> compatible? Single token would suffice, no?

we discussed this on github. If we generalize this to low-power 
streaming, it's possible to have a case where the buffering is not 
suitable on capture but suitable on playback, or vice-versa, so we added 
two tokens.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

* Re: [alsa-devel] [PATCH 04/26] ASoC: SOF: Intel: hda-dsp: Add helper for setting DSP D0ix substate
  2019-10-29 10:07   ` [alsa-devel] [PATCH 04/26] ASoC: SOF: Intel: hda-dsp: Add helper for setting DSP D0ix substate Cezary Rojewski
@ 2019-10-29 16:37     ` Sridharan, Ranjani
  0 siblings, 0 replies; 61+ messages in thread
From: Sridharan, Ranjani @ 2019-10-29 16:37 UTC (permalink / raw)
  To: Cezary Rojewski
  Cc: tiwai, Linux-ALSA, Mark Brown, Keyon Jie, Pierre-Louis Bossart

On Tue, Oct 29, 2019 at 3:10 AM Cezary Rojewski <cezary.rojewski@intel.com>
wrote:

> On 2019-10-26 00:41, Pierre-Louis Bossart wrote:
> > From: Keyon Jie <yang.jie@linux.intel.com>
> >
> > Adding helper to implement setting dsp to d0i3 or d0i0 status, this will
> > be needed for driver D0ix support.
> >
> > Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
> > Signed-off-by: Pierre-Louis Bossart <
> pierre-louis.bossart@linux.intel.com>
>
> > +static int hda_dsp_wait_d0i3c_done(struct snd_sof_dev *sdev, int retry)
> > +{
> > +     struct hdac_bus *bus = sof_to_bus(sdev);
> > +
> > +     while (snd_hdac_chip_readb(bus, VS_D0I3C) & SOF_HDA_VS_D0I3C_CIP) {
> > +             if (!retry--)
> > +                     return -ETIMEDOUT;
> > +             usleep_range(10, 15);
> > +     }
> > +
> > +     return 0;
> > +}
> > +
> > +int hda_dsp_set_power_state(struct snd_sof_dev *sdev,
> > +                         enum sof_d0_substate d0_substate)
> > +{
> > +     struct hdac_bus *bus = sof_to_bus(sdev);
> > +     int retry = 50;
> > +     int ret;
> > +     u8 value;
> > +
> > +     /* Write to D0I3C after Command-In-Progress bit is cleared */
> > +     ret = hda_dsp_wait_d0i3c_done(sdev, retry);
> > +     if (ret < 0) {
> > +             dev_err(bus->dev, "CIP timeout before update D0I3C!\n");
> > +             return ret;
> > +     }
> > +
> > +     /* Update D0I3C register */
> > +     value = d0_substate == SOF_DSP_D0I3 ? SOF_HDA_VS_D0I3C_I3 : 0;
>
> Some indentation or parenthesis would make this cleaner.
>
> > +     snd_hdac_chip_updateb(bus, VS_D0I3C, SOF_HDA_VS_D0I3C_I3, value);
> > +
> > +     /* Wait for cmd in progress to be cleared before exiting the
> function */
> > +     retry = 50;
> > +     ret = hda_dsp_wait_d0i3c_done(sdev, retry);
> > +     if (ret < 0) {
> > +             dev_err(bus->dev, "CIP timeout after D0I3C updated!\n");
> > +             return ret;
> > +     }
> > +
> > +     dev_vdbg(bus->dev, "D0I3C updated, register = 0x%x\n",
> > +              snd_hdac_chip_readb(bus, VS_D0I3C));
> > +
> > +     return 0;
> > +}
> > +
>
> I believe hda_dsp_wait_d0i3c_done function could have had its argument
> list simplified. "retry" is passed externally and it is always set to
> 50. One could put the "retry" right inside _done function. This or allow
> the caller to modify the sleep period. Another option is to replace
> "retry" with "timeout period" (total timeout, that is) entirely.
>
Cezary,

This has been fixed later in the series to use
the HDA_DSP_REG_POLL_RETRY_COUNT but I agree that this can further be
simplified to just use the macro inside the hda_dsp_wait_d0i3c_done()
instead of passing the argument.


>
> In regard to maintenance, both ret checks (resulting in dev_errs) assume
> -ETIMEOUT outcome on _done failure. If said function gets updated in the
> future, these implicit checks might cause problems.
>
Possibly, but at the moment -ETIMEOUT looks like the correct error to be
reported.

Thanks,
Ranjani

>
> >   static int hda_suspend(struct snd_sof_dev *sdev, bool runtime_suspend)
> >   {
> >       struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
> > diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h
> > index ea02bf40cb25..0e7c366b8f71 100644
> > --- a/sound/soc/sof/intel/hda.h
> > +++ b/sound/soc/sof/intel/hda.h
> > @@ -64,6 +64,13 @@
> >   #define SOF_HDA_PPCTL_PIE           BIT(31)
> >   #define SOF_HDA_PPCTL_GPROCEN               BIT(30)
> >
> > +/*Vendor Specific Registers*/
>
> Missing spaces.
>
> > +#define SOF_HDA_VS_D0I3C             0x104A
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

end of thread, other threads:[~2019-10-29 16:38 UTC | newest]

Thread overview: 61+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-25 22:40 [alsa-devel] [PATCH 00/26] ASoC: SOF: enable S0ix support for Intel platforms Pierre-Louis Bossart
2019-10-25 22:40 ` [alsa-devel] [PATCH 01/26] ASoC: SOF: add a field to store the current D0 substate of DSP Pierre-Louis Bossart
2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: add a field to store the current D0 substate of DSP" to the asoc tree Mark Brown
2019-10-29 10:20   ` [alsa-devel] [PATCH 01/26] ASoC: SOF: add a field to store the current D0 substate of DSP Cezary Rojewski
2019-10-29 14:11     ` Pierre-Louis Bossart
2019-10-25 22:40 ` [alsa-devel] [PATCH 02/26] ASoC: SOF: reset default d0_substate at probe() and resume() Pierre-Louis Bossart
2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: reset default d0_substate at probe() and resume()" to the asoc tree Mark Brown
2019-10-25 22:40 ` [alsa-devel] [PATCH 03/26] ASoC: SOF: add set_power_state() to dsp_ops for power state update Pierre-Louis Bossart
2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: add set_power_state() to dsp_ops for power state update" to the asoc tree Mark Brown
2019-10-25 22:41 ` [alsa-devel] [PATCH 04/26] ASoC: SOF: Intel: hda-dsp: Add helper for setting DSP D0ix substate Pierre-Louis Bossart
2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: Intel: hda-dsp: Add helper for setting DSP D0ix substate" to the asoc tree Mark Brown
2019-10-29 10:07   ` [alsa-devel] [PATCH 04/26] ASoC: SOF: Intel: hda-dsp: Add helper for setting DSP D0ix substate Cezary Rojewski
2019-10-29 16:37     ` Sridharan, Ranjani
2019-10-25 22:41 ` [alsa-devel] [PATCH 05/26] ASoC: SOF: Intel: CNL: add set_power_state() ops Pierre-Louis Bossart
2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: Intel: CNL: add set_power_state() ops" to the asoc tree Mark Brown
2019-10-25 22:41 ` [alsa-devel] [PATCH 06/26] ASoC: SOF: Intel: APL: add set_power_state() ops Pierre-Louis Bossart
2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: Intel: APL: add set_power_state() ops" to the asoc tree Mark Brown
2019-10-25 22:41 ` [alsa-devel] [PATCH 07/26] ASoC: SOF: add flag to snd_sof_pcm_stream for D0i3 compatible stream Pierre-Louis Bossart
2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: add flag to snd_sof_pcm_stream for D0i3 compatible stream" to the asoc tree Mark Brown
2019-10-25 22:41 ` [alsa-devel] [PATCH 08/26] ASoC: SOF: token: add tokens for PCM compatible with D0i3 substate Pierre-Louis Bossart
2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: token: add tokens for PCM compatible with D0i3 substate" to the asoc tree Mark Brown
2019-10-29 10:11   ` [alsa-devel] [PATCH 08/26] ASoC: SOF: token: add tokens for PCM compatible with D0i3 substate Cezary Rojewski
2019-10-29 14:13     ` Pierre-Louis Bossart
2019-10-25 22:41 ` [alsa-devel] [PATCH 09/26] ASoC: SOF: topology: parse and store d0i3_compatible flag Pierre-Louis Bossart
2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: topology: parse and store d0i3_compatible flag" to the asoc tree Mark Brown
2019-10-25 22:41 ` [alsa-devel] [PATCH 10/26] ASoC: SOF: Intel: hda-dsp: align the comments for D0I3C update Pierre-Louis Bossart
2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: Intel: hda-dsp: align the comments for D0I3C update" to the asoc tree Mark Brown
2019-10-25 22:41 ` [alsa-devel] [PATCH 11/26] ASoC: SOF: Intel: HDA: use macro for register polling retry count Pierre-Louis Bossart
2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: Intel: HDA: use macro for register polling retry count" to the asoc tree Mark Brown
2019-10-25 22:41 ` [alsa-devel] [PATCH 12/26] ASoC: SOF: PM: rename sof_send_pm_ipc to sof_send_pm_ctx_ipc Pierre-Louis Bossart
2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: PM: rename sof_send_pm_ipc to sof_send_pm_ctx_ipc" to the asoc tree Mark Brown
2019-10-25 22:41 ` [alsa-devel] [PATCH 13/26] ASoC: SOF: ipc: introduce message for DSP power gating Pierre-Louis Bossart
2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: ipc: introduce message for DSP power gating" to the asoc tree Mark Brown
2019-10-25 22:41 ` [alsa-devel] [PATCH 14/26] ASoC: SOF: Intel: hda-ipc: Don't read mailbox for PM_GATE reply Pierre-Louis Bossart
2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: Intel: hda-ipc: Don't read mailbox for PM_GATE reply" to the asoc tree Mark Brown
2019-10-25 22:41 ` [alsa-devel] [PATCH 15/26] ASoC: SOF: Intel: HDA: add cAVS specific compact IPC header file Pierre-Louis Bossart
2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: Intel: HDA: add cAVS specific compact IPC header file" to the asoc tree Mark Brown
2019-10-25 22:41 ` [alsa-devel] [PATCH 16/26] ASoC: SOF: configure D0ix IPC flags in set_power_state Pierre-Louis Bossart
2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: configure D0ix IPC flags in set_power_state" to the asoc tree Mark Brown
2019-10-29 10:37   ` [alsa-devel] [PATCH 16/26] ASoC: SOF: configure D0ix IPC flags in set_power_state Cezary Rojewski
2019-10-25 22:41 ` [alsa-devel] [PATCH 17/26] ASoC: SOF: PM: add helpers for setting D0 substate for ADSP Pierre-Louis Bossart
2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: PM: add helpers for setting D0 substate for ADSP" to the asoc tree Mark Brown
2019-10-29 10:44   ` [alsa-devel] [PATCH 17/26] ASoC: SOF: PM: add helpers for setting D0 substate for ADSP Cezary Rojewski
2019-10-25 22:41 ` [alsa-devel] [PATCH 18/26] ASoC: SOF: Intel: CNL: add support for sending compact IPC Pierre-Louis Bossart
2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: Intel: CNL: add support for sending compact IPC" to the asoc tree Mark Brown
2019-10-25 22:41 ` [alsa-devel] [PATCH 19/26] ASoC: SOF: add a flag to indicate the system suspend target Pierre-Louis Bossart
2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: add a flag to indicate the system suspend target" to the asoc tree Mark Brown
2019-10-25 22:41 ` [alsa-devel] [PATCH 20/26] ASoC: SOF: add a flag suspend_ignored for sof stream Pierre-Louis Bossart
2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: add a flag suspend_ignored for sof stream" to the asoc tree Mark Brown
2019-10-25 22:41 ` [alsa-devel] [PATCH 21/26] ASoC: SOF: PM: implement prepare/complete callbacks Pierre-Louis Bossart
2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: PM: implement prepare/complete callbacks" to the asoc tree Mark Brown
2019-10-25 22:41 ` [alsa-devel] [PATCH 22/26] ASoC: SOF: ignore suspend/resume for D0ix compatible streams Pierre-Louis Bossart
2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: ignore suspend/resume for D0ix compatible streams" to the asoc tree Mark Brown
2019-10-25 22:41 ` [alsa-devel] [PATCH 23/26] ASoC: SOF: Intel: hda-dsp: implement suspend/resume for S0ix<->S0 transition Pierre-Louis Bossart
2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: Intel: hda-dsp: implement suspend/resume for S0ix<->S0 transition" to the asoc tree Mark Brown
2019-10-25 22:41 ` [alsa-devel] [PATCH 24/26] ASoC: SOF: return -ENOTSUPP if D0I3 is not supported Pierre-Louis Bossart
2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: return -ENOTSUPP if D0I3 is not supported" to the asoc tree Mark Brown
2019-10-25 22:41 ` [alsa-devel] [PATCH 25/26] ASoC: SOF: PM: Add support for DSP D0i3 state when entering S0ix Pierre-Louis Bossart
2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: PM: Add support for DSP D0i3 state when entering S0ix" to the asoc tree Mark Brown
2019-10-25 22:41 ` [alsa-devel] [PATCH 26/26] ASoC: SOF: pci: Add prepare/complete PM callbacks Pierre-Louis Bossart
2019-10-28 14:56   ` [alsa-devel] Applied "ASoC: SOF: pci: Add prepare/complete PM callbacks" to the asoc tree Mark Brown

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).