From c8b55418ff36036fc960731191ae0922bf6f1dae Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Sun, 4 Jan 2026 19:40:25 +0100 Subject: [PATCH] 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 --- ucm2/HDA/HiFi-analog.conf | 60 ++++++++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 23 deletions(-) diff --git a/ucm2/HDA/HiFi-analog.conf b/ucm2/HDA/HiFi-analog.conf index 673c74e..25eca3c 100644 --- a/ucm2/HDA/HiFi-analog.conf +++ b/ucm2/HDA/HiFi-analog.conf @@ -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.hp { + Condition { + Type String + Empty "${var:hpvol}" + } + False.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.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}" + Value { + PlaybackPriority 200 + PlaybackPCM "hw:${CardId}" + PlaybackMixerElem "${var:hpvol}" + PlaybackMasterElem "Master" + PlaybackVolume "${var:hpvol} Playback Volume" + PlaybackSwitch "Headphone Playback Switch" + JackControl "${var:hpjack}" + } } } -- 2.47.3