Skip to content

[BUG] [PTL] Speaker PCM hangs (RUNNING, hw_ptr frozen) when restarted while Deepbuffer Speaker PCM is held PREPARED #11566

In review
thesofproject/linux
#6070

Description

@KSubedi

Describe the bug

On a Panther Lake laptop with SDCA amps (function topologies), the Speaker PCM (hw:0,2) hangs if it is stopped and started again while the Deepbuffer Speaker PCM (hw:0,35) is held open in PREPARED state (hw_params + prepare done, never started, or re-prepared after a previous playback).

After the restart the Speaker PCM reports RUNNING, but its hw_ptr stops at 1052 frames (about 22 ms at 48 kHz) and never moves again. The speakers are silent for every application. Closing the deep-buffer PCM afterwards does not un-stick it; the Speaker PCM has to be closed and reopened. Nothing is printed in dmesg at the moment of the hang.

This was found through a small daemon that keeps the deep-buffer PCM prepared so it can start a short sound with low latency. In normal use it showed up as "speakers randomly go silent": PipeWire suspends the idle speaker sink after a few seconds (closing hw:0,2) while the deep-buffer PCM is still prepared, and the next sound that starts hangs.

What I tried, deep-buffer PCM state during the Speaker stop + start (each case repeated, results were the same every time):

Deep-buffer PCM (hw:0,35) Speaker PCM after restart
closed fine
open, PREPARED the whole time (fresh open) hangs at hw_ptr 1052
open, PREPARED the whole time (played once, then drop + prepare) hangs at hw_ptr 1052
open, in XRUN (played once, not prepared again) fine
open and RUNNING at the moment of the restart fine
PREPARED while Speaker stops, then closed before Speaker starts fine
closed while Speaker stops, then opened/PREPARED before Speaker starts fine
PREPARED while Speaker stops, then drop + prepare again (or close + reopen) once Speaker is closed, still PREPARED when Speaker starts fine

So the hang needs the deep-buffer pipeline to stay prepared continuously across both the stop and the following start of the Speaker PCM. Preparing it again after the Speaker PCM has closed is enough to avoid it, which is the workaround I am using.

Separately, starting the deep-buffer PCM (writei + start) while the Speaker PCM is in the middle of being opened (between its hw_params and its trigger) also hung the Speaker PCM, 8 of 8 attempts (hw_ptr stuck at 384 in seven of them, 572 in one). I did not investigate that one further.

To Reproduce

With PipeWire running and the built-in speakers as the output (the sink name will differ per machine):

SINK=alsa_output.pci-0000_00_1f.3-platform-sof_sdw.HiFi__Speaker__sink

# 1. keep the Speaker PCM running
pacat --device=$SINK --format=s16le --rate=48000 --channels=2 /dev/zero &

# 2. hold the deep-buffer PCM open and prepared (aplay blocks waiting for data)
sleep 600 | aplay -q -D hw:0,35 -t raw -f S16_LE -c 2 -r 48000 - &
sleep 0.5; head -1 /proc/asound/card0/pcm35p/sub0/status    # state: PREPARED

# 3. make PipeWire close and reopen the Speaker PCM
pactl suspend-sink $SINK 1; pactl suspend-sink $SINK 0

# 4. hw_ptr no longer advances
sleep 1; grep -E 'state|hw_ptr' /proc/asound/card0/pcm2p/sub0/status
sleep 1; grep -E 'state|hw_ptr' /proc/asound/card0/pcm2p/sub0/status

Output of step 4:

state: RUNNING
hw_ptr      : 1052
state: RUNNING
hw_ptr      : 1052

Without step 2 the same restart is fine (hw_ptr advances). To recover: stop the aplay, then repeat step 3.

I have only reproduced this through PipeWire, not with PipeWire stopped and plain aplay on both PCMs.

Reproduction Rate

All the time with the steps above (3/3 with these exact commands, and every attempt in the table above, a few dozen in total). 0 hangs in the control cases.

Expected behavior

The Speaker PCM keeps running after being restarted, whatever state the deep-buffer PCM is in.

Impact

Complete loss of speaker output until the stream is restarted, for any program that keeps the deep-buffer PCM prepared. Worked around in my own software.

Environment

  1. Versions
    • Kernel: 7.3.6 (distribution build, 7.3.6-5-omarchy, Arch based)
    • SOF: intel/sof-ipc4/ptl/sof-ptl.ri, "Booted firmware version: 2.15.0.1", Arch package sof-firmware 2026.09.2
    • PipeWire 1.6.12, WirePlumber 0.5.19, alsa-ucm-conf 1.2.16.1
  2. Topology: function topologies ("Using function topologies instead intel/sof-ipc4-tplg/sof-ptl-dummy.tplg"): sof-sdca-2amp-id2.tplg, sof-sdca-jack-id0.tplg, sof-sdca-mic-id4.tplg, sof-hdmi-pcm5-id5.tplg. Topology ABI 3:29:1, kernel ABI 3:23:1.
  3. Platform: ASUS Zenbook S14 UX5406AA, Intel Core Ultra 9 386H (Panther Lake), sof-audio-pci-intel-ptl, card sof-soundwire, 4x CS35L56 amps on SoundWire links 1 and 2.

Screenshots or console output

Speaker PCM status while hung:

state: RUNNING
owner_pid   : 1445
trigger_time: 4244.877029497
tstamp      : 4244.901298935
...
hw_ptr      : 1052
appl_ptr    : 6528

Nothing from sof-audio-pci-intel-ptl appears in dmesg when it happens. I have not captured a firmware log yet; I can collect one, or dmesg with dynamic debug enabled, if you tell me which options are useful.

Activity

  1. added
    bug
    on Dec 1, 2026
  2. ujfalusi commented on Dec 1, 2026

    @ujfalusi
    Contributor

    Thanks for the detailed report, the state table made this easy to pin down.

    What goes wrong

    The Speaker and Deepbuffer Speaker PCMs share the same backend (BE) DAI link. The problem needs this setup:

    1. Speaker PCM is running.
    2. Deepbuffer PCM is opened and prepared, but not started.
    3. Speaker PCM is stopped (for example PipeWire suspends the sink). The BE is stopped, and SOF resets the link DMA on STOP. It expects the BE to be prepared again before the next start.

    From here the BE gets started again without a prepare:

    • Speaker PCM is restarted: ASoC skips the BE prepare because the deepbuffer PCM is still in PREPARED state.
    • Deepbuffer PCM is started: it goes straight from PREPARED to RUNNING, so no prepare is called at all.
    • Speaker PCM is reopened and the deepbuffer PCM is started before it: this is your second case. It's the same as above, with the Speaker PCM's hw_ptr stuck at 384.

    In all three cases the BE is started with an unconfigured link DMA. The host DMA fills the buffer (your hw_ptr of 1052 or 384) and then nothing moves. Nothing is logged because, from the driver's point of view, everything succeeded.

    This is also why preparing the deepbuffer PCM again after the Speaker PCM has closed avoids the hang: that prepare reconfigures the BE.

    Fix

    I could reproduce all three cases with plain aplay on a PTL SoundWire device, without PipeWire. The fix makes the DAI set up the link DMA at START if it hasn't been set up since the last STOP: thesofproject/linux#6070

    Could you give it a try? Until then, your workaround (preparing the deepbuffer PCM again once the Speaker PCM has closed) is the right one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions