mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/3] ASoC: qcom: q6apm: Fix shared memory unmap
@ 2026-10-16 14:11 Shawn Guo
  2026-10-16 14:11 ` [PATCH 1/3] ASoC: qcom: q6apm: Fix unmap regions response handling Shawn Guo
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Shawn Guo @ 2026-10-16 14:11 UTC (permalink / raw)
  To: Srinivas Kandagatla, Mark Brown
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
	Krzysztof Kozlowski, Ajay Kumar Nandam, linux-sound,
	linux-arm-msm, linux-kernel, Shawn Guo

Since the early buffer mapping, q6apm maps a front-end's DSP buffers
once in pcm_new() and unmaps them in pcm_free(). The unmap side has a
few problems, which show up when the sound card is unbound and bound
again, e.g. by unbinding and binding any codec on the card:

- The card core removes the components before it frees the PCMs, so
  the topology and its graph info are gone by the time pcm_free()
  tries to unmap. The unmap is silently skipped, the DSP keeps the old
  mapping, and the next bind fails to create the PCM:

    qcom-apm gprsvc:service:2:1: Error (1) Processing 0x0100100c cmd
    snd-sc8280xp sound: ASoC: can't create pcm MultiMedia1 Playback :-22

- Once unmap is actually sent, every command stalls for five seconds,
  because the response handler matches on the wrong opcode:

    qcom-apm gprsvc:service:2:1: CMD timeout for [100100d] opcode

- Unmapping the position buffer clears the circular buffer's handle
  instead of its own.

Patch 1 fixes the unmap response handling, patch 2 makes the position
buffer unmap clear its own handle, and patch 3 moves the unmap to the
APM component's remove callback, before the topology is unloaded.
Patches 1 and 2 go first so that patch 3 does not introduce the five
second stalls.

Tested on Qualcomm Ride board by unbinding and binding the PCM1681
codec.

  echo 0-004c > /sys/bus/i2c/drivers/pcm1681/unbind
  echo 0-004c > /sys/bus/i2c/drivers/pcm1681/bind

Shawn Guo (3):
  ASoC: qcom: q6apm: Fix unmap regions response handling
  ASoC: qcom: q6apm: Clear the right handle on pos buffer unmap
  ASoC: qcom: q6apm: Unmap DSP buffers before removing the topology

 sound/soc/qcom/qdsp6/q6apm.c | 49 ++++++++++++++++++++++++++----------
 1 file changed, 36 insertions(+), 13 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-10-20  6:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-16 14:11 [PATCH 0/3] ASoC: qcom: q6apm: Fix shared memory unmap Shawn Guo
2026-10-16 14:11 ` [PATCH 1/3] ASoC: qcom: q6apm: Fix unmap regions response handling Shawn Guo
2026-10-16 14:11 ` [PATCH 2/3] ASoC: qcom: q6apm: Clear the right handle on pos buffer unmap Shawn Guo
2026-10-16 14:11 ` [PATCH 3/3] ASoC: qcom: q6apm: Unmap DSP buffers before removing the topology Shawn Guo
2026-10-20  6:26 ` [PATCH 0/3] ASoC: qcom: q6apm: Fix shared memory unmap Srinivas Kandagatla

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®