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

From: Vladimir Bely

Date: Sat Nov 28 2026 - 20:18:21 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 stops queuing on
-EAGAIN and retries on ASM_CLIENT_EVENT_DATA_WRITE_DONE under the PCM
stream lock while the stream is running.

Changes in v2 (addressing Sashiko AI review):
- 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 so a rewind/reset of
appl_ptr behind queue_ptr cannot wrap avail to ~runtime->boundary;
serialize event_handler() with ack/stop/XRUN/prepare/close via
pcm_stream_lock_irqsave and check snd_pcm_running(substream) instead of
using prtd->lock.

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 | 61 +++++++++++++++++++++++++-------
sound/soc/qcom/qdsp6/q6asm.c | 44 ++++++++++++++---------
2 files changed, 75 insertions(+), 30 deletions(-)

--
2.43.0