Skip to content

Commit 0915b27

Browse files
committed
ucm2: use new SetLED macro to hide the implementation details
Closes: #517 Signed-off-by: Jaroslav Kysela <perex@perex.cz>
1 parent 31fadae commit 0915b27

File tree

10 files changed

+34
-49
lines changed

10 files changed

+34
-49
lines changed

ucm2/HDA/HDA.conf

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
Syntax 6
22

3+
Include.led.File "/common/ctl/led.conf"
4+
35
Define.Use "" # a non-empty string to use UCM configuration for HDA devices
46
Define.Done "" # a non-empty string to skip the end error
57

@@ -51,11 +53,10 @@ If.use {
5153
True {
5254
Include.init.File "/HDA/init.conf"
5355

54-
FixedBootSequence [
55-
cset-new "name='Mic ACP LED Capture Switch' type=bool,count=1 off"
56-
exec "-/sbin/modprobe snd_ctl_led"
57-
sysw "-/class/sound/ctl-led/mic/card${CardNumber}/attach:Mic ACP LED Capture Switch"
58-
sysw "-/class/sound/ctl-led/mic/card${CardNumber}/detach:Capture Switch"
56+
Macro [
57+
{ CtlNew { Arg="name='Mic ACP LED Capture Switch' type=bool,count=1 off" } }
58+
{ SetLED { LED="mic" Action="attach" CtlId="Mic ACP LED Capture Switch" } }
59+
{ SetLED { LED="mic" Action="detach" CtlId="Capture Switch" } }
5960
]
6061
}
6162
}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
Syntax 4
1+
Syntax 6
22

33
SectionUseCase."HiFi" {
44
File "/Intel/bytcr-rt5640/HiFi.conf"
55
Comment "Play HiFi quality Music"
66
}
77

8+
Include.led.File "/common/ctl/led.conf"
89
Include.card-init.File "/lib/card-init.conf"
910
Include.ctl-remap.File "/lib/ctl-remap.conf"
1011
Include.codec-init.File "/codecs/rt5640/init.conf"
1112

12-
FixedBootSequence [
13-
exec "-/sbin/modprobe snd_ctl_led"
14-
sysw "-/class/sound/ctl-led/speaker/card${CardNumber}/attach:Speaker Channel Switch"
15-
sysw "-/class/sound/ctl-led/speaker/card${CardNumber}/attach:HP Channel Switch"
13+
Macro [
14+
{ SetLED { LED="speaker" Action="attach" CtlId="Speaker Channel Switch" } }
15+
{ SetLED { LED="speaker" Action="attach" CtlId="HP Channel Switch" } }
1616
]
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
# Adapted from https://github.com/plbossart/UCM/tree/master/cht-bsw-rt5672
22

3-
Syntax 3
3+
Syntax 6
44

55
SectionUseCase."HiFi" {
66
File "/Intel/cht-bsw-rt5672/HiFi.conf"
77
Comment "Play HiFi quality Music"
88
}
99

10-
FixedBootSequence [
11-
exec "-/sbin/modprobe snd_ctl_led"
12-
sysw "-/class/sound/ctl-led/speaker/card${CardNumber}/attach:DAC1 Playback Switch"
13-
sysw "-/class/sound/ctl-led/mic/card${CardNumber}/attach:ADC Capture Switch"
10+
Include.led.File "/common/ctl/led.conf"
11+
12+
Macro [
13+
{ SetLED { LED="speaker" Action="attach" CtlId="DAC1 Playback Switch" } }
14+
{ SetLED { LED="mic" Action="attach" CtlId="ADC Capture Switch" } }
1415
]

ucm2/Intel/sof-hda-dsp/sof-hda-dsp.conf

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
Syntax 7
22

3+
Include.led.File "/common/ctl/led.conf"
34
Include.card-init.File "/lib/card-init.conf"
45
Include.dsp-variables.File "dsp.conf"
56

@@ -25,13 +26,13 @@ If.devdmic {
2526
True {
2627
Define.DeviceDmic "Mic1"
2728
Define.DeviceMic "Mic2"
29+
#
30+
# users expect to turn the LED on when only internal
31+
# mic is off, but it makes sense to turn this LED
32+
# when all internal inputs are off
33+
#
34+
Macro [{ SetLED { LED="mic" Action="detach" CtlId="Capture Switch" } }]
2835
FixedBootSequence [
29-
#
30-
# users expect to turn the LED on when only internal
31-
# mic is off, but it makes sense to turn this LED
32-
# when all internal inputs are off
33-
#
34-
sysw "-/class/sound/ctl-led/mic/card${CardNumber}/detach:Capture Switch"
3536
# dmic array info
3637
exec "-nhlt-dmic-info -o ${var:LibDir}/dmics-nhlt.json"
3738
]
@@ -82,11 +83,7 @@ If.DellMuteLed {
8283
Haystack "$${sys:class/leds/platform::mute/device}"
8384
Needle "dell-laptop"
8485
}
85-
True {
86-
FixedBootSequence [
87-
sysw "-/class/sound/ctl-led/speaker/card${CardNumber}/attach:Master Playback Switch"
88-
]
89-
}
86+
True.Macro [{ SetLED { LED="speaker" Action="detach" CtlId="Master Playback Switch" } }]
9087
}
9188

9289
If.headphone {

ucm2/codecs/cs42l43-dmic/init.conf

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ BootSequence [
1818
cset "name='cs42l43 Decimator 4 Switch' 0"
1919
]
2020

21-
FixedBootSequence [
22-
exec "-/sbin/modprobe snd_ctl_led"
23-
sysw "-/class/sound/ctl-led/mic/card${CardNumber}/attach:cs42l43 Decimator 3 Switch"
24-
sysw "-/class/sound/ctl-led/mic/card${CardNumber}/attach:cs42l43 Decimator 4 Switch"
21+
Macro [
22+
{ SetLED { LED="mic" Action="attach" CtlId="cs42l43 Decimator 3 Switch" } }
23+
{ SetLED { LED="mic" Action="attach" CtlId="cs42l43 Decimator 4 Switch" } }
2524
]

ucm2/codecs/cs42l43/init.conf

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,4 @@ BootSequence [
1515
cset "name='cs42l43 Decimator 1 Switch' 0"
1616
]
1717

18-
FixedBootSequence [
19-
exec "-/sbin/modprobe snd_ctl_led"
20-
sysw "-/class/sound/ctl-led/mic/card${CardNumber}/attach:cs42l43 Decimator 1 Switch"
21-
]
18+
Macro [{ SetLED { LED="mic" Action="attach" CtlId="cs42l43 Decimator 1 Switch" } }]

ucm2/codecs/rt715-sdca/init.conf

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,4 @@ BootSequence [
88
cset "name='rt714 FU02 Capture Volume' 47"
99
]
1010

11-
FixedBootSequence [
12-
exec "-/sbin/modprobe snd_ctl_led"
13-
sysw "-/class/sound/ctl-led/mic/card${CardNumber}/attach:rt714 FU02 Capture Switch"
14-
]
11+
Macro [{ SetLED { LED="mic" Action="attach" CtlId="rt714 FU02 Capture Switch" } }]

ucm2/codecs/rt715/init.conf

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,5 @@ If.capturesw {
2424
Type ControlExists
2525
Control "name='rt715 Capture Switch'"
2626
}
27-
True.FixedBootSequence [
28-
exec "-/sbin/modprobe snd_ctl_led"
29-
sysw "-/class/sound/ctl-led/mic/card${CardNumber}/attach:rt715 Capture Switch"
30-
]
27+
Macro [{ SetLED { LED="mic" Action="attach" CtlId="rt715 Capture Switch" } }]
3128
}

ucm2/codecs/rt722/init.conf

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,4 @@ BootSequence [
1010
cset "name='rt722 FU0F Capture Volume' 63"
1111
]
1212

13-
FixedBootSequence [
14-
exec "-/sbin/modprobe snd_ctl_led"
15-
sysw "-/class/sound/ctl-led/mic/card${CardNumber}/attach:rt722 FU1E Capture Switch"
16-
]
13+
Macro [{ SetLED { LED="mic" Action="attach" CtlId="rt722 FU1E Capture Switch" } }]

ucm2/sof-soundwire/sof-soundwire.conf

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ SectionUseCase."HiFi" {
55
Comment "Play HiFi quality Music"
66
}
77

8+
Include.led.File "/common/ctl/led.conf"
89
Include.card-init.File "/lib/card-init.conf"
910
Include.ctl-remap.File "/lib/ctl-remap.conf"
1011

@@ -126,9 +127,7 @@ If.mic_init_rt715 {
126127
Needle "rt715"
127128
Haystack "${var:MicCodec1}"
128129
}
129-
True.BootSequence [
130-
sysw "-/class/sound/ctl-led/mic/card${CardNumber}/detach:PGA5.0 5 Master Capture Switch"
131-
]
130+
True.Macro [{ SetLED { LED="mic" Action="detach" CtlId="PGA5.0 5 Master Capture Switch" } }]
132131
}
133132

134133
If.pga_init_pga2 {

0 commit comments

Comments
 (0)