]> git.alsa-project.org Git - alsa-ucm-conf.git/commitdiff
ucm2: Add setting LED Mode in SetLED macro
authorMaciej Strozek <mstrozek@opensource.cirrus.com>
Tue, 4 Nov 2025 11:50:26 +0000 (11:50 +0000)
committerJaroslav Kysela <perex@perex.cz>
Mon, 10 Nov 2025 08:38:29 +0000 (09:38 +0100)
Add 'Mode' argument to SetLED macro in order to allow setting a
different LED mode. This will allow mute switches with inverted
values to control the LEDs with 'follow-route' option instead of
default 'follow-mute'.

The Mode argument is optional.

Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/637
Signed-off-by: Maciej Strozek <mstrozek@opensource.cirrus.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
ucm2/codecs/cs42l45-dmic/init.conf
ucm2/common/ctl/led.conf

index 88b19c84f5d6936561f524c9429175bd39307280..6dd19bbf0ee809362bdfbb26c7cc7deed53d8746 100644 (file)
@@ -5,5 +5,5 @@ BootSequence [
 ]
 
 Macro [
-       { SetLED { LED="mic" Action="attach" CtlId="cs42l45 FU 113 Mute Switch" } }
+       { SetLED { LED="mic" Action="attach" CtlId="cs42l45 FU 113 Mute Switch" Mode="follow-route"} }
 ]
index f10ad87f76c14f8ce32f8acd1d5c6994d8ad9c0a..7f47daac4bceb4777efb803476346627454fcbd1 100644 (file)
@@ -30,6 +30,7 @@
 #   LED    - LED selection - "speaker" or "mic"
 #   Action - action for given control - "attach" or "detach"
 #   CtlId  - control identifier (as for amixer, e.g. "Capture Switch" or "name='CaptureSwitch',index=1")
+#   Mode   - (optional) LED mode - "on", "off", "follow-mute" or "follow-route"
 #
 
 DefineMacro.SetLED {
@@ -46,6 +47,15 @@ DefineMacro.SetLED {
                }
        }
        If.1 {
+               Condition {
+                       Type String
+                       Empty "${var:-__Mode}"
+               }
+               False.FixedBootSequence [
+                       sysw "-/class/sound/ctl-led/${var:__LED}/mode:${var:__Mode}"
+               ]
+       }
+       If.2 {
                Condition { Type AlwaysTrue }
                True.FixedBootSequence [
                        sysw "-/class/sound/ctl-led/${var:__LED}/card${CardNumber}/${var:__Action}:${var:__CtlId}"