]> git.alsa-project.org Git - alsa-ucm-conf.git/commitdiff
ucm2: HDA: Headphone output may be optional
authorJaroslav Kysela <perex@perex.cz>
Sun, 4 Jan 2026 18:40:25 +0000 (19:40 +0100)
committerJaroslav Kysela <perex@perex.cz>
Mon, 5 Jan 2026 14:43:45 +0000 (15:43 +0100)
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>
ucm2/HDA/HiFi-analog.conf

index 673c74ea7d556ca37144720e80be5f8641529c8c..25eca3c6b17ef5d27f6e085e6a30ded5fb095f2a 100644 (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.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}"
+               }
        }
 }