]> git.alsa-project.org Git - alsa-ucm-conf.git/commitdiff
ALSA: hda: mic: fix HDAMicEnum macro
authorJaroslav Kysela <perex@perex.cz>
Mon, 3 Aug 2026 10:45:57 +0000 (12:45 +0200)
committerJaroslav Kysela <perex@perex.cz>
Fri, 21 Aug 2026 07:23:41 +0000 (09:23 +0200)
Expose devices only for existing enums in the source control.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
ucm2/HDA/HiFi-mic.conf

index e084700a5e0f9787c672683c19972aca36832ef6..f6b3f4bf6fca6ae750d5f25c2bd42ebb146c89d5 100644 (file)
@@ -115,35 +115,44 @@ If.micdevs {
 # Comment - Long name of the SectionDevice
 # Jack - Jack control if available
 # Priority - CapturePriority
-DefineMacro.HDAMicEnum.SectionDevice."${var:__DevName}" {
-       Comment "${var:__Comment}"
+DefineMacro.HDAMicEnum.If.enum {
+       Condition {
+               Type ControlExists
+               Control "name='${var:SourceControl}'"
+               ControlEnum "${var:__Enum}"
+       }
+       True.SectionDevice."${var:__DevName}" {
+               Comment "${var:__Comment}"
 
-       EnableSequence [
-               cset "name='${var:SourceControl}' '${var:__Enum}'"
-       ]
 
-       Value {
-               CapturePriority "${eval:($__Priority+$MicExtraPriority)}"
-               CapturePCM "hw:${CardId}"
-               CaptureMixerElem "Capture"
-               CaptureVolume "Capture Volume"
-               CaptureSwitch "Capture Switch"
-               CaptureMasterElem "${var:__Enum} Boost"
-       }
-       If.jack {
-               Condition {
-                       Type String
-                       Empty "${var:-__Jack}"
+
+               EnableSequence [
+                       cset "name='${var:SourceControl}' '${var:__Enum}'"
+               ]
+
+               Value {
+                       CapturePriority "${eval:($__Priority+$MicExtraPriority)}"
+                       CapturePCM "hw:${CardId}"
+                       CaptureMixerElem "Capture"
+                       CaptureVolume "Capture Volume"
+                       CaptureSwitch "Capture Switch"
+                       CaptureMasterElem "${var:__Enum} Boost"
+               }
+               If.jack {
+                       Condition {
+                               Type String
+                               Empty "${var:-__Jack}"
+                       }
+                       False.Value.JackControl "${var:__Jack}"
                }
-               False.Value.JackControl "${var:__Jack}"
-       }
 
-       ConflictingDevice [
-               "Mic:hda-int"
-               "Mic:hda-hp"
-               "Mic:hda"
-               "Headset:hda-mic"
-       ]
+               ConflictingDevice [
+                       "Mic:hda-int"
+                       "Mic:hda-hp"
+                       "Mic:hda"
+                       "Headset:hda-mic"
+               ]
+       }
 }
 
 # Macro HDAMicSwitch - Create the SectionDevice for HDA inputs (switches)