From 2e090676c9a46f39c8ce880b59147df2cad828bc Mon Sep 17 00:00:00 2001 From: Maciej Strozek Date: Tue, 4 Nov 2025 11:50:26 +0000 Subject: [PATCH] ucm2: Add setting LED Mode in SetLED macro 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 Signed-off-by: Jaroslav Kysela --- ucm2/codecs/cs42l45-dmic/init.conf | 2 +- ucm2/common/ctl/led.conf | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ucm2/codecs/cs42l45-dmic/init.conf b/ucm2/codecs/cs42l45-dmic/init.conf index 88b19c8..6dd19bb 100644 --- a/ucm2/codecs/cs42l45-dmic/init.conf +++ b/ucm2/codecs/cs42l45-dmic/init.conf @@ -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"} } ] diff --git a/ucm2/common/ctl/led.conf b/ucm2/common/ctl/led.conf index f10ad87..7f47daa 100644 --- a/ucm2/common/ctl/led.conf +++ b/ucm2/common/ctl/led.conf @@ -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}" -- 2.47.3