Skip to content

ASoC: qcom: qdsp6: report the position of a drained buffer

Vladyslav Tymoshchuk linux-arm-msm linux-sound lkml stable 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3ASoC: qcom: q6apm-dai: wrap the position of a full ring to 0sound/soc/qcom/qdsp6/q6apm-dai.c+8 -40 replies
2/3ASoC: qcom: q6apm: reset the hw pointer with the fragment queuesound/soc/qcom/qdsp6/q6apm.c+1 -00 replies
3/3ASoC: qcom: q6asm-dai: wrap the position of a full ring to 0sound/soc/qcom/qdsp6/q6asm-dai.c+3 -40 replies

Reviews trailers per patch

None of the 3 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchSrinivas Kandagatla
SeriesR-b T-b
1/3
2/3
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/3] ASoC: qcom: qdsp6: report the position of a drained buffer

Since commit a93dad6f4e6a ("ASoC: q6apm-dai: make use of q6apm_get_hw_pointer") q6apm-dai reports one frame less than the position of the last buffer the DSP returned, and commit 44432315444c ("ASoC: qcom: q6asm-dai: use q6asm_get_hw_pointer") did the same in q6asm-dai. When the application stops feeding a playback stream, the position never reaches appl_ptr: ALSA never sees the underrun, the stream stays RUNNING without period interrupts, and drain ends on its timeout with -EIO. On a OnePlus Pad 3 (SM8750) this left PipeWire's PCM stuck for hours after a stall.

Patch 1 wraps the q6apm position to 0 at the end of the ring, as before a93dad6f4e6a. Patch 2 resets the q6apm hw pointer on prepare, which a93dad6f4e6a also stopped doing. Patch 3 is patch 1 for q6asm-dai.

Patches 1 and 2 are tested on SM8750 (numbers in patch 1). Patch 3 is compile-tested only; a test on a Q6ASM board (RB3, RB5) and on x1e or sc8280xp for patches 1 and 2 would be very welcome.

The RFC "ASoC: qcom: q6apm: correct PCM formats and error handling" by Zhang Jiaxi [1] touches the same hw pointer, in graph_callback() (4/4 "recover PCM from failed data receipts"). The two do not conflict:
that series changes when the hw pointer is published, this one how it is turned into a position and when it is reset, and that series applies on top of this one on sound/for-next without conflicts.

The analysis, the patches and this text were drafted with an AI assistant (Claude, see Assisted-by); I reviewed them and ran the tests described in the patches.

[1] https://lore.kernel.org/r/SY5PR01MB10600B2BE812BAA1B0FA501B4A1932@SY5PR01MB10600.ausprd01.prod.outlook.com

Vladyslav Tymoshchuk (3):
ASoC: qcom: q6apm-dai: wrap the position of a full ring to 0
ASoC: qcom: q6apm: reset the hw pointer with the fragment queue
ASoC: qcom: q6asm-dai: wrap the position of a full ring to 0

 sound/soc/qcom/qdsp6/q6apm-dai.c | 12 ++++++++----
 sound/soc/qcom/qdsp6/q6apm.c     |  1 +
 sound/soc/qcom/qdsp6/q6asm-dai.c |  7 +++----
 3 files changed, 12 insertions(+), 8 deletions(-)

base-commit: 8ef28aef33f2d5da6959ad6b579ec3cfccc009f6

Signature · 1 line
2.43.0