All of lore.kernel.org
 help / color / mirror / Atom feed
From: GitHub issues - opened <github@alsa-project.org>
To: alsa-devel@alsa-project.org
Subject: ALC4080: S/PDIF disabled because `spdif_nodev` checks PCM `subname` instead of `name`
Date: Sat,  6 Jun 2026 02:07:31 +0200 (CEST)	[thread overview]
Message-ID: <18b6554265823e00-webhooks-bot@alsa-project.org> (raw)
In-Reply-To: <18b65542655dcd00-webhooks-bot@alsa-project.org>

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

           reply	other threads:[~2026-06-06  0:08 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <18b65542655dcd00-webhooks-bot@alsa-project.org>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=18b6554265823e00-webhooks-bot@alsa-project.org \
    --to=github@alsa-project.org \
    --cc=alsa-devel@alsa-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.