[PATCH v3 0/2] ASoC: qcom: qdsp6: handle SMD FIFO -EAGAIN in q6asm playback

From: Vladimir Bely

Date: Sun Nov 29 2026 - 04:20:37 EST


On SoCs with a small SMD FIFO (such as MSM8916), a playback burst in
q6asm_dai_ack() can fill the FIFO so rpmsg_trysend() returns -EAGAIN.
Today q6asm_write_async() still advances port->dsp_buf on that failed
send, and q6asm_dai_ack() fails the write with -EAGAIN.

Patch 1 keeps port->dsp_buf unchanged when apr_send_pkt() fails and
protects port->buf teardown under ac->lock. Patch 2 defers queuing
until trigger start, stops cleanly on -EAGAIN, and retries on
CMD_RUN_DONE and DATA_WRITE_DONE under the PCM stream lock while the
stream is running.

Changes in v3 (addressing Sashiko AI review):
- Patch 1: fix Fixes: trailer subjects and add Fixes: fdbb53d318aa.
- Patch 2:
- Defer playback queuing in q6asm_dai_ack() until
snd_pcm_running(substream) and queue after q6asm_run_nowait() in
q6asm_dai_trigger() (with CMD_RUN_DONE retry) so a full SMD FIFO
before start cannot fail SNDRV_PCM_TRIGGER_START with -EAGAIN.
- Combine snd_pcm_period_elapsed_under_stream_lock() and
q6asm_dai_queue_playback() under a single pcm_stream_lock_irqsave.
- Fix the Fixes: trailer subject.

Changes in v2:
- Patch 1: clear port->buf and port->dsp_buf under ac->lock in
q6asm_audio_client_free_buf() and check !port->buf || !port->num_periods
in q6asm_write_async() and q6asm_read().
- Patch 2: bound avail <= runtime->buffer_size; serialize event_handler()
with ack/stop/XRUN/prepare/close via pcm_stream_lock_irqsave and
snd_pcm_running(substream).

Vladimir Bely (2):
ASoC: qcom: q6asm: don't advance dsp_buf on failed write or read
ASoC: qcom: q6asm-dai: retry playback queuing on -EAGAIN

sound/soc/qcom/qdsp6/q6asm-dai.c | 75 ++++++++++++++++++++++++++------
sound/soc/qcom/qdsp6/q6asm.c | 44 +++++++++++--------
2 files changed, 88 insertions(+), 31 deletions(-)


base-commit: 626d2233d48884f22c16011a6e44f905824bd8e0
--
2.43.0