Skip to content

drm/apple: audio: open the DCP PCM without a sink, and release data_lock on a DMA error - #169

Merged
RyanTheTide merged 2 commits into
aurora-silicon:aurora-wipfrom
cb2206:dcp-audio-open-without-sink
Oct 8, 2026
Merged

RyanTheTide merged 2 commits into
aurora-silicon:aurora-wipfrom
cb2206:dcp-audio-open-without-sink

Conversation

@cb2206

@cb2206 cb2206 commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

On a Mac booted without a monitor on HDMI or USB-C, a display plugged in later never gets an audio output until WirePlumber or PulseAudio is restarted.

Cause: dcp_pcm_open() returns -ENXIO while no sink is connected, because the PCM constraints come from the sink's audio elements. PipeWire's ACP probes every PCM of a UCM profile once, when the card appears: open, hw_params, and alsa-lib's automatic prepare. If that fails, it marks the profile unsupported for good. spa's udev monitor ignores "change" events for a card it has already emitted, so a later hotplug never triggers a new probe.

Commits:

  1. drm/apple: audio: release data_lock when DMA setup fails on open: dcp_pcm_open() returned the dcpaud_init_dma() error with data_lock still held. Everything that takes that lock then blocks, including the next open, the hotplug notifications and hw_params/prepare. This is an independent bug fix.
  2. drm/apple: audio: allow opening the PCM without a sink:
    • Without a sink, the PCM opens with a plain stereo fallback: 2 ch; 32, 44.1 or 48 kHz; S16, S24 or S32.
    • hw_params and prepare are no-ops for such an open. trigger still fails until a sink is connected, so nothing is sent to a missing display.
    • The next open after a display is attached gets the sink's real constraints.

Testing: MacBook Pro 14" M1 Pro (j314s), 4K monitor on the built-in HDMI port, plus a UCM profile for the DCP audio cards (AsahiLinux/alsa-ucm-conf-asahi#9).

  • Booted without a monitor on HDMI: the card has its HiFi profile, with the HDMI sink unavailable.
  • Monitor plugged in, no WirePlumber restart: the sink becomes available and plays. Over several days I ran this as part of my test kernels, and on 11.34 the first HDMI hotplug of the boot played on the first try.
  • One caveat: on 2026-09-30, on an older base, playback once stalled on the first HDMI hotplug after boot (PCM RUNNING, hw_ptr 0), until WirePlumber was restarted. I couldn't reproduce it afterwards, including the first-hotplug case today.

Not tested: audio over DP alt mode on USB-C, and other Mac models.

audio.c on aurora-wip (f9572b54204e) is identical to the base I tested on, so the commits apply as they are. checkpatch is clean.

cb2206 added 2 commits October 4, 2026 10:00
dcp_pcm_open() takes data_lock before dcpaud_init_dma() and returns its
error with the lock still held. The next open, the hotplug notifications
(dcpaud_connect()/dcpaud_disconnect()) and hw_params/prepare (through
dcpaud_connection_up()) all take data_lock and then block forever.

Unlock before returning.

Signed-off-by: Christian Bartels <[email protected]>
dcp_pcm_open() fails with -ENXIO while no display is connected, because
the format and rate constraints come from the sink's audio elements.
PipeWire and PulseAudio probe every PCM of a UCM profile once, when the
card appears: they open it, set hw_params and prepare it. If that fails,
the profile is marked unsupported for good, and udev "change" events for
a card that has already been seen are ignored. So on a Mac booted without
a monitor on HDMI or USB-C, a display attached later never gets an audio
output until the sound server is restarted.

Let the PCM open without a sink, with a plain stereo fallback (2
channels; 32, 44.1 or 48 kHz; S16, S24 or S32), as HDMI PCMs on other
platforms do. hw_params and prepare succeed as no-ops for such an open,
since alsa-lib prepares straight after hw_params. trigger still fails
until a sink is connected, so nothing is sent to a missing display. Once
a display is attached, the next open gets the sink's real constraints.

Tested on a MacBook Pro 14" M1 Pro (j314s) with a 4K monitor on the
built-in HDMI port: booted without a monitor on HDMI, the HDMI output
appears when the monitor is plugged in, without restarting WirePlumber,
and plays. Audio over DP alt mode on USB-C was not tested.

Signed-off-by: Christian Bartels <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants