From: jeeja.kp@intel.com
To: alsa-devel@alsa-project.org
Cc: patches.audio@intel.com, Jeeja KP <jeeja.kp@intel.com>,
broonie@kernel.org, Vinod Koul <vinod.koul@intel.com>,
liam.r.girdwood@intel.com
Subject: [PATCH 01/10] ASoC: Intel: Skylake: Reset DSP pipe when host/link DMA is reset
Date: Fri, 3 Jun 2016 18:29:34 +0530 [thread overview]
Message-ID: <1464958783-19344-2-git-send-email-jeeja.kp@intel.com> (raw)
In-Reply-To: <1464958783-19344-1-git-send-email-jeeja.kp@intel.com>
From: Jeeja KP <jeeja.kp@intel.com>
In case of XRUN recovery PCM prepare will be called. In this case
Host/Link DMAs are reset and reconfigured, hence the corresponding
FE/BE pipe needs to be reset in order to get to a clean state.
Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
sound/soc/intel/skylake/skl-messages.c | 23 +++++++++++++++++++++++
sound/soc/intel/skylake/skl-pcm.c | 17 +++++++++++++++++
sound/soc/intel/skylake/skl-topology.h | 5 ++++-
3 files changed, 44 insertions(+), 1 deletion(-)
diff --git a/sound/soc/intel/skylake/skl-messages.c b/sound/soc/intel/skylake/skl-messages.c
index 226db84..c682403 100644
--- a/sound/soc/intel/skylake/skl-messages.c
+++ b/sound/soc/intel/skylake/skl-messages.c
@@ -1130,6 +1130,29 @@ int skl_stop_pipe(struct skl_sst *ctx, struct skl_pipe *pipe)
return 0;
}
+/*
+ * Reset the pipeline by sending set pipe state IPC this will reset the DMA
+ * from the DSP side
+ */
+int skl_reset_pipe(struct skl_sst *ctx, struct skl_pipe *pipe)
+{
+ int ret;
+
+ /* If pipe was not created in FW, do not try to pause or delete */
+ if (pipe->state < SKL_PIPE_PAUSED)
+ return 0;
+
+ ret = skl_set_pipe_state(ctx, pipe, PPL_RESET);
+ if (ret < 0) {
+ dev_dbg(ctx->dev, "Failed to reset pipe ret=%d\n", ret);
+ return ret;
+ }
+
+ pipe->state = SKL_PIPE_RESET;
+
+ return 0;
+}
+
/* Algo parameter set helper function */
int skl_set_module_params(struct skl_sst *ctx, u32 *params, int size,
u32 param_id, struct skl_module_cfg *mcfg)
diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c
index 7c81b31..ff04917 100644
--- a/sound/soc/intel/skylake/skl-pcm.c
+++ b/sound/soc/intel/skylake/skl-pcm.c
@@ -227,16 +227,25 @@ static int skl_pcm_prepare(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct hdac_ext_stream *stream = get_hdac_ext_stream(substream);
+ struct skl *skl = get_skl_ctx(dai->dev);
unsigned int format_val;
int err;
+ struct skl_module_cfg *mconfig;
dev_dbg(dai->dev, "%s: %s\n", __func__, dai->name);
+ mconfig = skl_tplg_fe_get_cpr_module(dai, substream->stream);
+
format_val = skl_get_format(substream, dai);
dev_dbg(dai->dev, "stream_tag=%d formatvalue=%d\n",
hdac_stream(stream)->stream_tag, format_val);
snd_hdac_stream_reset(hdac_stream(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);
+
err = snd_hdac_stream_set_params(hdac_stream(stream), format_val);
if (err < 0)
return err;
@@ -521,6 +530,8 @@ static int skl_link_pcm_prepare(struct snd_pcm_substream *substream,
struct skl_dma_params *dma_params;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct hdac_ext_link *link;
+ struct skl *skl = get_skl_ctx(dai->dev);
+ struct skl_module_cfg *mconfig = NULL;
dma_params = (struct skl_dma_params *)
snd_soc_dai_get_dma_data(codec_dai, substream);
@@ -535,6 +546,12 @@ static int skl_link_pcm_prepare(struct snd_pcm_substream *substream,
snd_hdac_ext_link_stream_reset(link_dev);
+ /* In case of XRUN recovery, reset the FW pipe to clean state */
+ mconfig = skl_tplg_be_get_cpr_module(dai, substream->stream);
+ if (mconfig && (substream->runtime->status->state ==
+ SNDRV_PCM_STATE_XRUN))
+ skl_reset_pipe(skl->skl_sst, mconfig->pipe);
+
snd_hdac_ext_link_stream_setup(link_dev, format_val);
snd_hdac_ext_link_set_stream_id(link, hdac_stream(link_dev)->stream_tag);
diff --git a/sound/soc/intel/skylake/skl-topology.h b/sound/soc/intel/skylake/skl-topology.h
index e4b399c..d4a58bc 100644
--- a/sound/soc/intel/skylake/skl-topology.h
+++ b/sound/soc/intel/skylake/skl-topology.h
@@ -244,7 +244,8 @@ enum skl_pipe_state {
SKL_PIPE_INVALID = 0,
SKL_PIPE_CREATED = 1,
SKL_PIPE_PAUSED = 2,
- SKL_PIPE_STARTED = 3
+ SKL_PIPE_STARTED = 3,
+ SKL_PIPE_RESET = 4
};
struct skl_pipe_module {
@@ -357,6 +358,8 @@ int skl_delete_pipe(struct skl_sst *ctx, struct skl_pipe *pipe);
int skl_stop_pipe(struct skl_sst *ctx, struct skl_pipe *pipe);
+int skl_reset_pipe(struct skl_sst *ctx, struct skl_pipe *pipe);
+
int skl_init_module(struct skl_sst *ctx, struct skl_module_cfg *module_config);
int skl_bind_modules(struct skl_sst *ctx, struct skl_module_cfg
--
2.5.0
next prev parent reply other threads:[~2016-06-03 12:56 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-03 12:59 [PATCH 00/10] ASoC: Intel: Skylake: Improvements in Skylake driver jeeja.kp
2016-06-03 12:59 ` jeeja.kp [this message]
2016-06-07 13:27 ` Applied "ASoC: Intel: Skylake: Reset DSP pipe when host/link DMA is reset" to the asoc tree Mark Brown
2016-06-03 12:59 ` [PATCH 02/10] ASoC: Intel: Skylake: Set the pipe state to paused when paused jeeja.kp
2016-06-07 12:56 ` Mark Brown
2016-06-08 9:39 ` Jeeja KP
2016-06-07 13:27 ` Applied "ASoC: Intel: Skylake: Set the pipe state to paused when paused" to the asoc tree Mark Brown
2016-06-03 12:59 ` [PATCH 03/10] ASoC: Intel: Skylake: Don't pause stopped pipeline while deleting jeeja.kp
2016-06-07 13:27 ` Applied "ASoC: Intel: Skylake: Don't pause stopped pipeline while deleting" to the asoc tree Mark Brown
2016-06-03 12:59 ` [PATCH 04/10] ASoC: Intel: Skylake: Disable SRAM Retention before D3 jeeja.kp
2016-06-03 13:04 ` Takashi Iwai
2016-06-03 16:15 ` Ughreja, Rakesh A
2016-06-07 13:27 ` Applied "ASoC: Intel: Skylake: Disable SRAM Retention before D3" to the asoc tree Mark Brown
2016-06-03 12:59 ` [PATCH 05/10] ASoC: Intel: Skylake: Avoid freeing up of unallocated memory/mcps jeeja.kp
2016-06-07 13:27 ` Applied "ASoC: Intel: Skylake: Avoid freeing up of unallocated memory/mcps" to the asoc tree Mark Brown
2016-06-03 12:59 ` [PATCH 06/10] ASoC: Intel: Skylake: Clean up of driver resources in suspend jeeja.kp
2016-06-07 13:27 ` Applied "ASoC: Intel: Skylake: Clean up of driver resources in suspend" to the asoc tree Mark Brown
2016-06-03 12:59 ` [PATCH 07/10] ASoC: Intel: Skylake: Create Pipe to widget list in soc probe jeeja.kp
2016-06-07 13:27 ` Applied "ASoC: Intel: Skylake: Create Pipe to widget list in soc probe" to the asoc tree Mark Brown
2016-06-03 12:59 ` [PATCH 08/10] ASoC: Intel: Skylake: Set the DSP pipe type jeeja.kp
2016-06-07 13:27 ` Applied "ASoC: Intel: Skylake: Set the DSP pipe type" to the asoc tree Mark Brown
2016-06-03 12:59 ` [PATCH 09/10] ASoC: Intel: Skylake: Copy the pipe parameter by pipe type jeeja.kp
2016-06-07 13:27 ` Applied "ASoC: Intel: Skylake: Copy the pipe parameter by pipe type" to the asoc tree Mark Brown
2016-06-03 12:59 ` [PATCH 10/10] ASoC: Intel: Skylake: Report position in pointer query jeeja.kp
2016-06-07 13:27 ` Applied "ASoC: Intel: Skylake: Report position in pointer query" 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=1464958783-19344-2-git-send-email-jeeja.kp@intel.com \
--to=jeeja.kp@intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=liam.r.girdwood@intel.com \
--cc=patches.audio@intel.com \
--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).