ALC4080: S/PDIF disabled because `spdif_nodev` checks PCM `subname` instead of `name`
A message that is not in the archive (sent off-list or not yet received): [email protected]
alsa-project/alsa-ucm-conf issue #779 was opened from djglxxii:
On an MSI MAG X870 Tomahawk WiFi motherboard with Realtek ALC4080 USB audio (0db0:cd0e), optical S/PDIF output disappears with alsa-ucm-conf 1.2.16.
The kernel/driver side appears to expose the hardware correctly: direct ALSA playback to the raw PCM device works and is audible over optical. The regression appears to be in ucm2/USB-Audio/Realtek/ALC4080-HiFi.conf, where the S/PDIF device is disabled because find-device searches field=subname for Audio #3, but this device exposes Audio #3 in the PCM name field instead.
## Affected Hardware
- Motherboard: MSI MAG X870 Tomahawk WiFi
- Codec: Realtek ALC4080 USB audio
- USB ID: 0db0:cd0e
- Driver: snd_usb_audio
- CardComponents: USB0db0:cd0e
## Regression
- Working: alsa-ucm-conf 1.2.15.3
- Broken: alsa-ucm-conf 1.2.16
After upgrading alsa-ucm-conf, PipeWire/WirePlumber no longer exposes an S/PDIF sink. Since the analog outputs are jack-gated and unplugged on this setup, the card ends up with no usable output profile.
## Evidence That The Kernel/Hardware Path Works
Raw ALSA playback works:
```sh speaker-test -D hw:0,3 -c2 -t wav speaker-test -D hw:0,2 -c2 -t wav ```
Both are audible through the optical speakers.
The relevant PCM exists:
```text $ cat /proc/asound/card0/pcm3p/info id: USB Audio name: USB Audio #3 subname: subdevice #0 ```
aplay -l shows the same:
```text card 0: Audio [USB Audio], device 3: USB Audio [USB Audio #3] Subdevice #0: subdevice #0 ```
## Suspected Root Cause
ALC4080-HiFi.conf contains this logic:
```conf
If.spdif_dev2 {
Condition {
Type RegexMatch
String "${CardComponents}"
Regex "USB(0b05:(1996|1a5[23c])|0db0:1feb)"
}
True.Define {
SpdifName "S/PDIF Output"
SpdifPCM "2"
}
False.If.spdif_nodev {
Condition {
Type String
Empty "$${find-device:type=pcm,stream=playback,field=subname,regex='Audio #3'}"
}
True.Define.SpdifName ""
}
}
```On this board, the regex Audio #3 matches the PCM name, not the subname:
```text name: USB Audio #3 subname: subdevice #0 ```
So this lookup returns empty:
```conf field=subname,regex='Audio #3' ```
That causes:
```conf True.Define.SpdifName "" ```
which removes the S/PDIF SectionDevice from the HiFi verb even though the PCM exists and works.
## Suggested Fix
Search the PCM name field instead:
```diff
- Empty "$${find-device:type=pcm,stream=playback,field=subname,regex='Audio #3'}"
+ Empty "$${find-device:type=pcm,stream=playback,field=name,regex='Audio #3'}"
```Alternatively, detect the fourth playback PCM by index/device number rather than matching this string in subname.
## Workaround
Downgrading alsa-ucm-conf to 1.2.15.3 restores S/PDIF output. Applying the field=name change locally also restores the optical sink.
## Environment
- Distribution: CachyOS
- Upgrade command that exposed the regression: sudo pacman -Syu
- alsa-ucm-conf: 1.2.16 broken, 1.2.15.3 working
- alsa-lib: 1.2.16
- Kernel: 7.0.11-1-cachyos
- ALSA driver string: k7.0.11-1-cachyos
- Audio server: PipeWire/WirePlumber
- S/PDIF output terminal present in USB descriptors: bTerminalID 24, wTerminalType 0x0605 / S/PDIF interface
Issue URL : https://github.com/alsa-project/alsa-ucm-conf/issues/779
Repository URL: https://github.com/alsa-project/alsa-ucm-conf