From 94bcaf816be835a71b6669a7e2cd4558ac77ee4d Mon Sep 17 00:00:00 2001 From: Vladimir Bely Date: Mon, 16 Nov 2026 01:45:20 +0300 Subject: [PATCH] ASoC: qcom: q6asm-dai: Close the stream on every re-prepare q6asm_dai_prepare() closes the previous DSP stream only when it is RUNNING. After TRIGGER_STOP or EOS the stream is STOPPED, but still open in the DSP. A second prepare then opens it again, as done for xrun recovery or when an Android audio HAL leaves standby. The DSP rejects that with ADSP_EALREADY, and playback stays silent from then on. Close the stream in every state except IDLE. Tested on MSM8916 by playing several times through the same PCM. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Vladimir Bely --- sound/soc/qcom/qdsp6/q6asm-dai.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sound/soc/qcom/qdsp6/q6asm-dai.c b/sound/soc/qcom/qdsp6/q6asm-dai.c index 9e3d176f50c24f..4fff3096d26564 100644 --- a/sound/soc/qcom/qdsp6/q6asm-dai.c +++ b/sound/soc/qcom/qdsp6/q6asm-dai.c @@ -225,7 +225,12 @@ static int q6asm_dai_prepare(struct snd_soc_component *component, prtd->pcm_count = snd_pcm_lib_period_bytes(substream); /* rate and channels are sent to audio driver */ - if (prtd->state == Q6ASM_STREAM_RUNNING) { + /* + * The DSP stream stays open after TRIGGER_STOP/EOS (state STOPPED), so a + * re-prepare (xrun recovery, resume from standby) must close it too, or + * the next open_write fails with ADSP_EALREADY. + */ + if (prtd->state != Q6ASM_STREAM_IDLE) { /* clear the previous setup if any */ q6asm_cmd(prtd->audio_client, prtd->stream_id, CMD_CLOSE); q6asm_unmap_memory_regions(substream->stream,