Skip to contentSkip to conversation

HDA/HiFi-analog: no Headphones device when codec has only 'Headphone Playback Volume' (CS8409/CS42L42, sof-hda-dsp)

DISCUSSION GitHub issues - opened 1 participant 1 message Dec 2 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

alsa-project/alsa-ucm-conf issue #937 was opened from wervin:

### Summary

On a Dell Inspiron 16 5620 (sof-hda-dsp, Cirrus Logic CS8409/CS42L42 codec) the HiFi verb has no usable Headphones device. PipeWire only exposes Speaker, and WirePlumber logs:

```
spa.alsa: No sink and source at HiFi: Headphones
```

The kernel driver works: the jack is detected (Headphone Jack = on) and audio physically reaches the headphones, but through the Speaker device, so Headphone Playback Volume is never controlled and there is no Headphones port in the desktop.

### Cause

This codec exposes a headphone **volume** but no headphone **switch**:

```
numid=6,iface=CARD,name='Headphone Jack'
numid=4,iface=CARD,name='Mic Jack'
numid=5,iface=CARD,name='Speaker Phantom Jack'
numid=1,iface=MIXER,name='Headphone Playback Volume'
numid=2,iface=MIXER,name='Mic Capture Volume'
numid=3,iface=MIXER,name='Speaker Playback Switch'
```

ucm2/HDA/HiFi-analog.conf only keeps hpvol when Headphone Playback Switch exists:

```
If.hpvol {
	Condition {
		Type ControlExists
		Control "name='Headphone Playback Switch'"
	}
	False.Define.hpvol ""
}
```

So hpvol becomes empty and SectionDevice."Headphones" is not created there. Intel/sof-hda-dsp/HiFi-sof.conf then still declares SectionDevice."Headphones" (its If.hp block, True branch when hpvol is empty), which leaves a device without PlaybackPCM:

```
Device.Headphones {
	Values {
		CaptureCTL "_ucm0001.hw:sofhdadsp"
		PlaybackCTL "_ucm0001.hw:sofhdadsp"
		TQ HiFi
	}
}
```

Current master has the same If.hpvol condition.

### Tested fix

Accepting a codec that has only the volume control fixes it here:

```diff
--- a/ucm2/HDA/HiFi-analog.conf
+++ b/ucm2/HDA/HiFi-analog.conf
@@
 		Type ControlExists
 		Control "name='Headphone Playback Switch'"
 	}
-	False.Define.hpvol ""
+	False.If.hpvolonly {
+		# Codecs such as CS8409/CS42L42 expose only a volume control
+		Condition {
+			Type ControlExists
+			Control "name='Headphone Playback Volume'"
+		}
+		False.Define.hpvol ""
+	}
 }
```

With this change (tested against 1.2.16.1):

- alsaucm dump text shows Headphones with PlaybackPCM, PlaybackMixerElem Headphone and JackControl "Headphone Jack"
- WirePlumber creates the Headphones sink, the route is reported available when the jack is plugged, and it is selected by default
- the volume slider drives the hardware Headphone Playback Volume
- playback through the headphones works

### System

- Dell Inspiron 16 5620, Alder Lake PCH-P, sof-audio-pci-intel-tgl, machine driver skl_hda_dsp_generic, topology sof-hda-generic-2ch.tplg
- Codec: Cirrus Logic CS8409/CS42L42, vendor id 0x10138409, subsystem id 0x10280baa
- Ubuntu 26.10, kernel 7.3.0-11-generic
- alsa-ucm-conf 1.2.16.1, alsa-lib 1.2.16.1, PipeWire 1.6.8, WirePlumber 0.5.17

alsa-info output is attached.

[alsa-info.txt](https://github.com/user-attachments/files/35731395/alsa-info.txt)

Issue URL : https://github.com/alsa-project/alsa-ucm-conf/issues/937
Repository URL: https://github.com/alsa-project/alsa-ucm-conf