alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Sriram Periyasamy <sriramx.periyasamy@intel.com>
To: ALSA ML <alsa-devel@alsa-project.org>, Mark Brown <broonie@kernel.org>
Cc: Takashi Iwai <tiwai@suse.de>,
	Divya Prakash <divya1.prakash@intel.com>,
	Patches Audio <patches.audio@intel.com>,
	Liam Girdwood <liam.r.girdwood@linux.intel.com>,
	Vinod Koul <vinod.koul@intel.com>,
	Pardha Saradhi K <pardha.saradhi.kesapragada@intel.com>,
	Sriram Periyasamy <sriramx.periyasamy@intel.com>
Subject: [PATCH 1/3] ASoC: Intel: Skylake: Reset DSP Pipelines in prepare
Date: Mon,  2 Apr 2018 12:15:48 +0530	[thread overview]
Message-ID: <1522651550-27236-2-git-send-email-sriramx.periyasamy@intel.com> (raw)
In-Reply-To: <1522651550-27236-1-git-send-email-sriramx.periyasamy@intel.com>

From: Pardha Saradhi K <pardha.saradhi.kesapragada@intel.com>

An application can choose to call .prepare function
any number of times. In such scenarios, there is a
need to reset the DSP pipeline.

Signed-off-by: Pardha Saradhi K <pardha.saradhi.kesapragada@intel.com>
Signed-off-by: Divya Prakash <divya1.prakash@intel.com>
Signed-off-by: Sriram Periyasamy <sriramx.periyasamy@intel.com>
---
 sound/soc/intel/skylake/skl-pcm.c | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c
index 15cb8ac3e374..5ac0a12007c2 100644
--- a/sound/soc/intel/skylake/skl-pcm.c
+++ b/sound/soc/intel/skylake/skl-pcm.c
@@ -268,15 +268,31 @@ static int skl_pcm_prepare(struct snd_pcm_substream *substream,
 {
 	struct skl *skl = get_skl_ctx(dai->dev);
 	struct skl_module_cfg *mconfig;
+	int ret;
 
 	dev_dbg(dai->dev, "%s: %s\n", __func__, dai->name);
 
 	mconfig = skl_tplg_fe_get_cpr_module(dai, substream->stream);
 
-	/* In case of XRUN recovery, reset the FW pipe to clean state */
-	if (mconfig && (substream->runtime->status->state ==
-					SNDRV_PCM_STATE_XRUN))
-		skl_reset_pipe(skl->skl_sst, mconfig->pipe);
+	/*
+	 * In case of XRUN recovery or in the case when the application
+	 * calls prepare another time, reset the FW pipe to clean state
+	 */
+	if (mconfig &&
+		(substream->runtime->status->state == SNDRV_PCM_STATE_XRUN ||
+		 mconfig->pipe->state == SKL_PIPE_CREATED ||
+		 mconfig->pipe->state == SKL_PIPE_PAUSED)) {
+
+		ret = skl_reset_pipe(skl->skl_sst, mconfig->pipe);
+
+		if (ret < 0)
+			return ret;
+
+		ret = skl_pcm_host_dma_prepare(dai->dev,
+					mconfig->pipe->p_params);
+		if (ret < 0)
+			return ret;
+	}
 
 	return 0;
 }
-- 
2.7.4

  reply	other threads:[~2018-04-02  6:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-02  6:45 [PATCH 0/3] ASoC: Intel: Skylake: Driver updates for new DSP FW Sriram Periyasamy
2018-04-02  6:45 ` Sriram Periyasamy [this message]
2018-04-17 11:28   ` Applied "ASoC: Intel: Skylake: Reset DSP Pipelines in prepare" to the asoc tree Mark Brown
2018-04-02  6:45 ` [PATCH 2/3] ASoC: Intel: Skylake: Reset DSP pipe in skl_pcm_hw_free Sriram Periyasamy
2018-04-17 11:28   ` Applied "ASoC: Intel: Skylake: Reset DSP pipe in skl_pcm_hw_free" to the asoc tree Mark Brown
2018-04-02  6:45 ` [PATCH 3/3] ASoC: Intel: Skylake: Unify the fw ops for SKL and KBL Sriram Periyasamy
2018-04-17 11:28   ` Applied "ASoC: Intel: Skylake: Unify the fw ops for SKL and KBL" 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=1522651550-27236-2-git-send-email-sriramx.periyasamy@intel.com \
    --to=sriramx.periyasamy@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=divya1.prakash@intel.com \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=pardha.saradhi.kesapragada@intel.com \
    --cc=patches.audio@intel.com \
    --cc=tiwai@suse.de \
    --cc=vinod.koul@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).