diff mbox series

ASoC: qdsp6: q6apm-dai: unprepare stream if its already prepared

Message ID 20220610144818.511797-1-srinivas.kandagatla@linaro.org (mailing list archive)
State Accepted
Commit 58136d93d4e2c1207a5e4f3044815cd40b1d95fd
Headers show
Series ASoC: qdsp6: q6apm-dai: unprepare stream if its already prepared | expand

Commit Message

Srinivas Kandagatla June 10, 2022, 2:48 p.m. UTC
prepare callback can be called multiple times, so unprepare the stream
if its already prepared.

Without this DSP is not happy to setting the params on a already
prepared graph.

Fixes: 9b4fe0f1cd79 ("ASoC: qdsp6: audioreach: add q6apm-dai support")
Reported-by: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 sound/soc/qcom/qdsp6/q6apm-dai.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Mark Brown June 10, 2022, 6:21 p.m. UTC | #1
On Fri, 10 Jun 2022 15:48:18 +0100, Srinivas Kandagatla wrote:
> prepare callback can be called multiple times, so unprepare the stream
> if its already prepared.
> 
> Without this DSP is not happy to setting the params on a already
> prepared graph.
> 
> 
> [...]

Applied to

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

Thanks!

[1/1] ASoC: qdsp6: q6apm-dai: unprepare stream if its already prepared
      commit: 6548c884a595391fab172faeae39e2b329b848f3

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
diff mbox series

Patch

diff --git a/sound/soc/qcom/qdsp6/q6apm-dai.c b/sound/soc/qcom/qdsp6/q6apm-dai.c
index 19c4a90ec1ea..ee59ef36b85a 100644
--- a/sound/soc/qcom/qdsp6/q6apm-dai.c
+++ b/sound/soc/qcom/qdsp6/q6apm-dai.c
@@ -147,6 +147,12 @@  static int q6apm_dai_prepare(struct snd_soc_component *component,
 	cfg.num_channels = runtime->channels;
 	cfg.bit_width = prtd->bits_per_sample;
 
+	if (prtd->state) {
+		/* clear the previous setup if any  */
+		q6apm_graph_stop(prtd->graph);
+		q6apm_unmap_memory_regions(prtd->graph, substream->stream);
+	}
+
 	prtd->pcm_count = snd_pcm_lib_period_bytes(substream);
 	prtd->pos = 0;
 	/* rate and channels are sent to audio driver */