ucm2: HDA: Headphone output may be optional

Check for 'Headphone Playback Volume' or 'Headphone+LO Playback Volume'
controls. If they not present, don't create 'Headphone' UCM device.

Link: https://github.com/alsa-project/alsa-ucm-conf/issues/673
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2026-01-04 19:40:25 +01:00
commit c8b55418ff

View file

@ -42,6 +42,14 @@ If.linefront {
}
}
If.hpvol {
Condition {
Type ControlExists
Control "name='Headphone Playback Volume'"
}
False.Define.hpvol ""
}
If.hplo {
Condition {
Type ControlExists
@ -53,32 +61,38 @@ If.hplo {
}
}
SectionDevice."Headphones" {
Comment "Headphones"
If.headphone_switch {
Condition {
Type ControlExists
Control "name='Headphone Playback Switch'"
}
True {
EnableSequence [
cset "name='Headphone Playback Switch' on"
]
DisableSequence [
cset "name='Headphone Playback Switch' off"
]
}
If.hp {
Condition {
Type String
Empty "${var:hpvol}"
}
False.SectionDevice."Headphones" {
Comment "Headphones"
Value {
PlaybackPriority 200
PlaybackPCM "hw:${CardId}"
PlaybackMixerElem "${var:hpvol}"
PlaybackMasterElem "Master"
PlaybackVolume "${var:hpvol} Playback Volume"
PlaybackSwitch "Headphone Playback Switch"
JackControl "${var:hpjack}"
If.headphone_switch {
Condition {
Type ControlExists
Control "name='Headphone Playback Switch'"
}
True {
EnableSequence [
cset "name='Headphone Playback Switch' on"
]
DisableSequence [
cset "name='Headphone Playback Switch' off"
]
}
}
Value {
PlaybackPriority 200
PlaybackPCM "hw:${CardId}"
PlaybackMixerElem "${var:hpvol}"
PlaybackMasterElem "Master"
PlaybackVolume "${var:hpvol} Playback Volume"
PlaybackSwitch "Headphone Playback Switch"
JackControl "${var:hpjack}"
}
}
}