alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Vinod Koul <vinod.koul@intel.com>
To: alsa-devel@alsa-project.org
Cc: liam.r.girdwood@linux.intel.com, patches.audio@intel.com,
	broonie@kernel.org, Vinod Koul <vinod.koul@intel.com>,
	Jeeja KP <jeeja.kp@intel.com>
Subject: [PATCH 4/5] ASoC: Intel: Skylake: Suspend PCMs when marked as active suspend
Date: Thu, 28 Apr 2016 18:45:28 +0530	[thread overview]
Message-ID: <1461849329-20364-5-git-send-email-vinod.koul@intel.com> (raw)
In-Reply-To: <1461849329-20364-1-git-send-email-vinod.koul@intel.com>

From: Jeeja KP <jeeja.kp@intel.com>

For 'ignore_suspend' cases we need to keep DSP and pipes On, but
can suspend the stream and pause the DMA as we are not rendering
data during the suspended time.

For this we can check the dai widget ignore_suspend flag in
trigger suspend/resume, and start and stop the host DMA and host
copier pipelines.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
 sound/soc/intel/skylake/skl-pcm.c | 30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c
index df24d8c6b757..c726937321ef 100644
--- a/sound/soc/intel/skylake/skl-pcm.c
+++ b/sound/soc/intel/skylake/skl-pcm.c
@@ -402,23 +402,33 @@ static int skl_pcm_trigger(struct snd_pcm_substream *substream, int cmd,
 	struct skl_module_cfg *mconfig;
 	struct hdac_ext_bus *ebus = get_bus_ctx(substream);
 	struct hdac_ext_stream *stream = get_hdac_ext_stream(substream);
+	struct snd_soc_dapm_widget *w;
 	int ret;
 
 	mconfig = skl_tplg_fe_get_cpr_module(dai, substream->stream);
 	if (!mconfig)
 		return -EIO;
 
+	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+		w = dai->playback_widget;
+	else
+		w = dai->capture_widget;
+
 	switch (cmd) {
 	case SNDRV_PCM_TRIGGER_RESUME:
-		skl_pcm_prepare(substream, dai);
-		/*
-		 * enable DMA Resume enable bit for the stream, set the dpib
-		 * & lpib position to resune before starting the DMA
-		 */
-		snd_hdac_ext_stream_drsm_enable(ebus, true,
-					hdac_stream(stream)->index);
-		snd_hdac_ext_stream_set_dpibr(ebus, stream, stream->dpib);
-		snd_hdac_ext_stream_set_lpib(stream, stream->lpib);
+		if (!w->ignore_suspend) {
+			skl_pcm_prepare(substream, dai);
+			/*
+			 * enable DMA Resume enable bit for the stream, set the
+			 * dpib & lpib position to resume before starting the
+			 * DMA
+			 */
+			snd_hdac_ext_stream_drsm_enable(ebus, true,
+						hdac_stream(stream)->index);
+			snd_hdac_ext_stream_set_dpibr(ebus, stream,
+							stream->dpib);
+			snd_hdac_ext_stream_set_lpib(stream, stream->lpib);
+		}
 
 	case SNDRV_PCM_TRIGGER_START:
 	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
@@ -448,7 +458,7 @@ static int skl_pcm_trigger(struct snd_pcm_substream *substream, int cmd,
 			return ret;
 
 		ret = skl_decoupled_trigger(substream, cmd);
-		if (cmd == SNDRV_PCM_TRIGGER_SUSPEND) {
+		if ((cmd == SNDRV_PCM_TRIGGER_SUSPEND) && !w->ignore_suspend) {
 			/* save the dpib and lpib positions */
 			stream->dpib = readl(ebus->bus.remap_addr +
 					AZX_REG_VS_SDXDPIB_XBASE +
-- 
1.9.1

  parent reply	other threads:[~2016-04-28 13:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-28 13:15 [PATCH 0/5] ASoC: Intel: Skylake: Wov optimizations Vinod Koul
2016-04-28 13:15 ` [PATCH 1/5] ASoC: Intel: Skylake: Fix the NULL pointer exception in dsp_clean up Vinod Koul
2016-05-02 11:03   ` Applied "ASoC: Intel: Skylake: Fix the NULL pointer exception in dsp_clean up" to the asoc tree Mark Brown
2016-04-28 13:15 ` [PATCH 2/5] ASoC: Intel: Skylake: Fix memory leak during init instance Vinod Koul
2016-05-02 11:03   ` Applied "ASoC: Intel: Skylake: Fix memory leak during init instance" to the asoc tree Mark Brown
2016-04-28 13:15 ` [PATCH 3/5] ASoC: Intel: Skylake: Prevent sending Set DMA Control IPC if the widget is "On" Vinod Koul
2016-05-02 11:03   ` Applied "ASoC: Intel: Skylake: Prevent sending Set DMA Control IPC if the widget is "On"" to the asoc tree Mark Brown
2016-04-28 13:15 ` Vinod Koul [this message]
2016-05-02 11:03   ` Applied "ASoC: Intel: Skylake: Suspend PCMs when marked as active suspend" " Mark Brown
2016-04-28 13:15 ` [PATCH 5/5] ASoC: Intel: Boards: remove ignore_suspend for WoV streams Vinod Koul
2016-05-02 11:03   ` Applied "ASoC: Intel: Boards: remove ignore_suspend for WoV streams" 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=1461849329-20364-5-git-send-email-vinod.koul@intel.com \
    --to=vinod.koul@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=jeeja.kp@intel.com \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=patches.audio@intel.com \
    /path/to/YOUR_REPLY

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

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).