All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: alsa-devel@alsa-project.org
Cc: tiwai@suse.de, broonie@kernel.org,
	Ranjani Sridharan <ranjani.sridharan@linux.intel.com>,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Subject: [alsa-devel] [PATCH 3/9] ASoC: SOF: Add system_suspend_target field to struct snd_sof_dev
Date: Wed, 29 Jan 2020 16:07:20 -0600	[thread overview]
Message-ID: <20200129220726.31792-4-pierre-louis.bossart@linux.intel.com> (raw)
In-Reply-To: <20200129220726.31792-1-pierre-louis.bossart@linux.intel.com>

From: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>

Add the system_suspend_target field to struct snd_sof_dev
to track the intended system suspend power target. This will
be used as one of the criteria for determining the
final DSP power state.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/sof/intel/hda-dsp.c |  4 ++--
 sound/soc/sof/pcm.c           |  2 +-
 sound/soc/sof/pm.c            |  9 ++++++---
 sound/soc/sof/sof-priv.h      | 12 ++++++++++--
 4 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c
index 4a4d318f97ff..fddf2c48904f 100644
--- a/sound/soc/sof/intel/hda-dsp.c
+++ b/sound/soc/sof/intel/hda-dsp.c
@@ -481,7 +481,7 @@ int hda_dsp_resume(struct snd_sof_dev *sdev)
 	struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
 	struct pci_dev *pci = to_pci_dev(sdev->dev);
 
-	if (sdev->s0_suspend) {
+	if (sdev->system_suspend_target == SOF_SUSPEND_S0IX) {
 		/* restore L1SEN bit */
 		if (hda->l1_support_changed)
 			snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR,
@@ -530,7 +530,7 @@ int hda_dsp_suspend(struct snd_sof_dev *sdev)
 	struct pci_dev *pci = to_pci_dev(sdev->dev);
 	int ret;
 
-	if (sdev->s0_suspend) {
+	if (sdev->system_suspend_target == SOF_SUSPEND_S0IX) {
 		/* enable L1SEN to make sure the system can enter S0Ix */
 		hda->l1_support_changed =
 			snd_sof_dsp_update_bits(sdev, HDA_DSP_HDA_BAR,
diff --git a/sound/soc/sof/pcm.c b/sound/soc/sof/pcm.c
index 29435ba2d329..db3df02c7398 100644
--- a/sound/soc/sof/pcm.c
+++ b/sound/soc/sof/pcm.c
@@ -372,7 +372,7 @@ static int sof_pcm_trigger(struct snd_soc_component *component,
 		stream.hdr.cmd |= SOF_IPC_STREAM_TRIG_START;
 		break;
 	case SNDRV_PCM_TRIGGER_SUSPEND:
-		if (sdev->s0_suspend &&
+		if (sdev->system_suspend_target == SOF_SUSPEND_S0IX &&
 		    spcm->stream[substream->stream].d0i3_compatible) {
 			/*
 			 * trap the event, not sending trigger stop to
diff --git a/sound/soc/sof/pm.c b/sound/soc/sof/pm.c
index 5b186bceedb9..c86ac1e84bd7 100644
--- a/sound/soc/sof/pm.c
+++ b/sound/soc/sof/pm.c
@@ -323,10 +323,13 @@ 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;
+	if (acpi_target_system_state() == ACPI_STATE_S0)
+		sdev->system_suspend_target = SOF_SUSPEND_S0IX;
+	else
+		sdev->system_suspend_target = SOF_SUSPEND_S3;
 #else
 	/* will suspend to S3 by default */
-	sdev->s0_suspend = false;
+	sdev->system_suspend_target = SOF_SUSPEND_S3;
 #endif
 
 	return 0;
@@ -337,6 +340,6 @@ void snd_sof_complete(struct device *dev)
 {
 	struct snd_sof_dev *sdev = dev_get_drvdata(dev);
 
-	sdev->s0_suspend = false;
+	sdev->system_suspend_target = SOF_SUSPEND_NONE;
 }
 EXPORT_SYMBOL(snd_sof_complete);
diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h
index bc2337cf1142..1839cc51957d 100644
--- a/sound/soc/sof/sof-priv.h
+++ b/sound/soc/sof/sof-priv.h
@@ -60,6 +60,13 @@ enum sof_d0_substate {
 	SOF_DSP_D0I3,		/* DSP D0i3(low power) substate*/
 };
 
+/* System suspend target state */
+enum sof_system_suspend_state {
+	SOF_SUSPEND_NONE = 0,
+	SOF_SUSPEND_S0IX,
+	SOF_SUSPEND_S3,
+};
+
 struct snd_sof_dev;
 struct snd_sof_ipc_msg;
 struct snd_sof_ipc;
@@ -325,8 +332,9 @@ 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;
+
+	/* Intended power target of system suspend */
+	enum sof_system_suspend_state system_suspend_target;
 
 	/* 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

  parent reply	other threads:[~2020-01-29 22:11 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-29 22:07 [alsa-devel] [PATCH 0/9] ASoC: SOF: update S0ix/D0ix support Pierre-Louis Bossart
2020-01-29 22:07 ` [alsa-devel] [PATCH 1/9] ASoC: SOF: Do not reset hw_params for streams that ignored suspend Pierre-Louis Bossart
2020-02-11 15:48   ` [alsa-devel] Applied "ASoC: SOF: Do not reset hw_params for streams that ignored suspend" to the asoc tree Mark Brown
2020-01-29 22:07 ` [alsa-devel] [PATCH 2/9] ASoC: SOF: pm: Unify suspend/resume routines Pierre-Louis Bossart
2020-02-11 15:48   ` [alsa-devel] Applied "ASoC: SOF: pm: Unify suspend/resume routines" to the asoc tree Mark Brown
2020-01-29 22:07 ` Pierre-Louis Bossart [this message]
2020-02-11 15:48   ` [alsa-devel] Applied "ASoC: SOF: Add system_suspend_target field to struct snd_sof_dev" " Mark Brown
2020-01-29 22:07 ` [alsa-devel] [PATCH 4/9] ASoC: SOF: pm: Introduce DSP power states Pierre-Louis Bossart
2020-02-11 15:48   ` [alsa-devel] Applied "ASoC: SOF: pm: Introduce DSP power states" to the asoc tree Mark Brown
2020-01-29 22:07 ` [alsa-devel] [PATCH 5/9] ASoC: SOF: Move DSP power state transitions to platform-specific ops Pierre-Louis Bossart
2020-01-30  7:47   ` Amadeusz Sławiński
2020-01-30 13:03     ` Mark Brown
2020-01-30 13:34     ` Pierre-Louis Bossart
2020-01-30 15:33       ` Sridharan, Ranjani
2020-01-30 18:35         ` Pierre-Louis Bossart
2020-02-11 15:48   ` [alsa-devel] Applied "ASoC: SOF: Move DSP power state transitions to platform-specific ops" to the asoc tree Mark Brown
2020-01-29 22:07 ` [alsa-devel] [PATCH 6/9] ASoC: SOF: audio: Add helper to check if only D0i3 streams are active Pierre-Louis Bossart
2020-02-11 15:48   ` [alsa-devel] Applied "ASoC: SOF: audio: Add helper to check if only D0i3 streams are active" to the asoc tree Mark Brown
2020-01-29 22:07 ` [alsa-devel] [PATCH 7/9] ASoC: SOF: Intel: hda: Amend the DSP state transition diagram Pierre-Louis Bossart
2020-02-11 15:48   ` [alsa-devel] Applied "ASoC: SOF: Intel: hda: Amend the DSP state transition diagram" to the asoc tree Mark Brown
2020-01-29 22:07 ` [alsa-devel] [PATCH 8/9] ASoC: SOF: Intel: cnl: Implement feature to support DSP D0i3 in S0 Pierre-Louis Bossart
2020-02-11 15:48   ` [alsa-devel] Applied "ASoC: SOF: Intel: cnl: Implement feature to support DSP D0i3 in S0" to the asoc tree Mark Brown
2020-01-29 22:07 ` [alsa-devel] [PATCH 9/9] ASoC: SOF: Intel: hda: Allow trace DMA in S0 when DSP is in D0I3 for debug Pierre-Louis Bossart
2020-02-11 15:48   ` [alsa-devel] Applied "ASoC: SOF: Intel: hda: Allow trace DMA in S0 when DSP is in D0I3 for debug" to the asoc tree Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200129220726.31792-4-pierre-louis.bossart@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=ranjani.sridharan@linux.intel.com \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.