mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vladimir Bely <vlwwwwww@gmail.com>
To: Srinivas Kandagatla <srini@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	linux-sound@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org, Vladimir Bely <vlwwwwww@gmail.com>
Subject: [PATCH v3 0/2] ASoC: qcom: qdsp6: handle SMD FIFO -EAGAIN in q6asm playback
Date: Sun, 29 Nov 2026 12:20:26 +0300	[thread overview]
Message-ID: <20261129092028.239529-1-vlwwwwww@gmail.com> (raw)
In-Reply-To: <20261129011802.1025539-1-vlwwwwww@gmail.com>

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


  reply	other threads:[~2026-11-29  9:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-29  0:19 [PATCH " Vladimir Bely
2026-11-29  0:19 ` [PATCH 1/2] ASoC: qcom: q6asm: don't advance dsp_buf on failed write or read Vladimir Bely
2026-11-29  0:19 ` [PATCH 2/2] ASoC: qcom: q6asm-dai: retry playback queuing on -EAGAIN Vladimir Bely
2026-11-29  1:18 ` [PATCH v2 0/2] ASoC: qcom: qdsp6: handle SMD FIFO -EAGAIN in q6asm playback Vladimir Bely
2026-11-29  9:20   ` Vladimir Bely [this message]
2026-11-29  9:20   ` [PATCH v3 1/2] ASoC: qcom: q6asm: don't advance dsp_buf on failed write or read Vladimir Bely
2026-11-29  9:20   ` [PATCH v3 2/2] ASoC: qcom: q6asm-dai: retry playback queuing on -EAGAIN Vladimir Bely
2026-11-29  1:18 ` [PATCH v2 1/2] ASoC: qcom: q6asm: don't advance dsp_buf on failed write or read Vladimir Bely
2026-11-29  1:18 ` [PATCH v2 2/2] ASoC: qcom: q6asm-dai: retry playback queuing on -EAGAIN Vladimir Bely

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=20261129092028.239529-1-vlwwwwww@gmail.com \
    --to=vlwwwwww@gmail.com \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=srini@kernel.org \
    --cc=tiwai@suse.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

all inboxes | Powered by JetHome®