Get headphones working on SOF laptops that keep playing through the speakers
Issue #11005 and its comments (X1 Carbon Gen 9 and 7th gen) support the split UCM profiles, the stale HDMI jack, the mpris-pause behaviour and the withdrawn auto-profile rule. On this workstation lines 33 and 34 of /usr/share/wireplumber/scripts/monitors/alsa.lua set api.acp.auto-profile and auto-port to false, linking/mpris-pause.lua exists, linking.pause-playback is a bool setting (default true) in wireplumber.conf, wpctl settings --save is a real option, and alsactl and amixer come from alsa-utils, which is in omarchy-base.packages. The 0.5.18 NEWS entry (#683, !885) is quoted accurately. The follow script needed fixing. The controller the reporter said works ran both pactl set-card-profile and set-default-sink, while the record's script only switches the profile. On these machines the HDMI jack stays on after unplug (point 2, confirmed on the 7th gen), so WirePlumber can leave a stale HDMI sink as the default. That fails the record's own verify step. The script also read the card name once at start, so a start before pipewire-pulse answered left it switching nothing forever. The replacement waits for the server, reads the card on every event and sets the default sink when a matching one appears. It is still written for this record and untested on that hardware, and it says so. Not exercised: no SOF hardware here and no service was installed.
The follow script hardcodes the ALSA card number (alsa_card=0) and the profile names. On a machine where the SOF card is not card 0, or after a UCM update renames the profiles, it switches the wrong card or fails every time. Check aplay -l and step 1 before enabling it.
Symptom
On an Intel SOF laptop (reported on ThinkPad X1 Carbon 7th gen and Gen 9, card skl_hda_dsp_generic / sof-hda-dsp), plugging in headphones does nothing: sound keeps coming out of the speakers and the output picker lists only Speaker and the HDMI outputs. amixer -c 0 cget iface=CARD,name='Headphone Jack' reports values=on and the Headphones port shows as available, yet no headphone output appears. Switching by hand works but pauses whatever was playing.
Cause
The UCM configuration for these cards exposes speakers and headphones as two mutually exclusive card profiles, for example HiFi (HDMI1, HDMI2, HDMI3, Headphones, Mic1, Mic2) and HiFi (HDMI1, HDMI2, HDMI3, Mic1, Mic2, Speaker), so the headphone sink only exists after a profile change. WirePlumber's ALSA monitor sets api.acp.auto-profile = false and api.acp.auto-port = false for every ALSA card (lines 33 and 34 of /usr/share/wireplumber/scripts/monitors/alsa.lua on wireplumber 0.5.17, confirmed on this workstation), so ACP never follows the jack by itself. The pause on every switch is WirePlumber's linking.pause-playback hook (mpris-pause.lua), which pauses MPRIS players when their target sink disappears, and a profile change removes the sink. WirePlumber 0.5.18 changes find-best-profile to rank profiles on output availability before priority (#683, !885), which may improve the choice made at startup or on monitor hotplug. Whether it fixes live jack switching on these cards is not confirmed.
Fix
**1. Read the exact profile names.**
pactl list cards | grep -E 'Name: alsa_card|Active Profile|HiFi'
pactl list short sinks
**2. Switch by hand.** Copy the names exactly as listed, they differ between machines:
card=$(pactl list short cards | awk '/alsa_card/ {print $2; exit}')
pactl set-card-profile "$card" 'HiFi (HDMI1, HDMI2, HDMI3, Headphones, Mic1, Mic2)'
# back to the speakers:
pactl set-card-profile "$card" 'HiFi (HDMI1, HDMI2, HDMI3, Mic1, Mic2, Speaker)'
If the output still goes to an HDMI sink after the switch, make the new analog sink the default with pactl set-default-sink <name>, using the name from pactl list short sinks.
**Do not set api.acp.auto-profile = true in a monitor.alsa.rules drop-in.** One reporter tried it and withdrew it: with an HDMI monitor attached it fought WirePlumber's own profile handling and produced stale duplicate sinks (HDMI1.2, HDMI1.3) and sound from the speakers while Headphones showed as default.
**3. Optional: follow the jack with a user service.** What worked for the reporter was a single controller that watches the jack, switches the profile and sets the default sink. The script below is a minimal version of that pattern, written for this record and not tested on the reporter's hardware. Set the two profile names from step 1 and alsa_card to the SOF card's number from aplay -l:
#!/bin/bash
# ~/.local/bin/headphone-profile-follow
alsa_card=0
hp='HiFi (HDMI1, HDMI2, HDMI3, Headphones, Mic1, Mic2)'
spk='HiFi (HDMI1, HDMI2, HDMI3, Mic1, Mic2, Speaker)'
apply() {
local card profile port sink
card=$(pactl list short cards | awk '/alsa_card/ {print $2; exit}')
[[ -n $card ]] || return
if amixer -c "$alsa_card" cget iface=CARD,name='Headphone Jack' | grep -q 'values=on'; then
profile=$hp
port=Headphones
else
profile=$spk
port=Speaker
fi
pactl set-card-profile "$card" "$profile"
for _ in 1 2 3 4 5 6 7 8 9 10; do
sink=$(pactl list short sinks | awk -v p="$port" '$2 ~ /^alsa_output/ && $2 ~ p {print $2; exit}')
[[ -n $sink ]] && break
sleep 0.2
done
[[ -n $sink ]] && pactl set-default-sink "$sink"
}
until pactl info >/dev/null 2>&1; do sleep 1; done
apply
alsactl monitor "hw:$alsa_card" | while read -r line; do
[[ $line == *"Headphone Jack"* ]] && apply
done
If no sink name in pactl list short sinks contains Headphones or Speaker on your machine, the default-sink step does nothing and only the profile switches.
# ~/.config/systemd/user/headphone-profile-follow.service
[Unit]
Description=Switch card profile when headphones are plugged
After=wireplumber.service
PartOf=wireplumber.service
[Service]
ExecStart=%h/.local/bin/headphone-profile-follow
Restart=always
[Install]
WantedBy=default.target
chmod +x ~/.local/bin/headphone-profile-follow
systemctl --user daemon-reload
systemctl --user enable --now headphone-profile-follow.service
**4. If the pause on switching bothers you**, turn the hook off. You also lose the pause when headphones are pulled out:
wpctl settings --save linking.pause-playback false
The same applies on plain Arch with PipeWire and WirePlumber 0.5.
Verify
With headphones plugged, pactl list cards | grep 'Active Profile' shows the Headphones profile and wpctl status lists a Headphones sink as default. Unplugging returns to the Speaker profile (with the service) and sound follows.