Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions ucm2/HDA/HDA.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
Syntax 6

Include.led.File "/common/ctl/led.conf"

Define.Use "" # a non-empty string to use UCM configuration for HDA devices
Define.Done "" # a non-empty string to skip the end error

Expand Down Expand Up @@ -51,11 +53,10 @@ If.use {
True {
Include.init.File "/HDA/init.conf"

FixedBootSequence [
cset-new "name='Mic ACP LED Capture Switch' type=bool,count=1 off"
exec "-/sbin/modprobe snd_ctl_led"
sysw "-/class/sound/ctl-led/mic/card${CardNumber}/attach:Mic ACP LED Capture Switch"
sysw "-/class/sound/ctl-led/mic/card${CardNumber}/detach:Capture Switch"
Macro [
{ CtlNew { Arg="name='Mic ACP LED Capture Switch' type=bool,count=1 off" } }
{ SetLED { LED="mic" Action="attach" CtlId="Mic ACP LED Capture Switch" } }
{ SetLED { LED="mic" Action="detach" CtlId="Capture Switch" } }
]
}
}
Expand Down
10 changes: 5 additions & 5 deletions ucm2/Intel/bytcr-rt5640/bytcr-rt5640.conf
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
Syntax 4
Syntax 6

SectionUseCase."HiFi" {
File "/Intel/bytcr-rt5640/HiFi.conf"
Comment "Play HiFi quality Music"
}

Include.led.File "/common/ctl/led.conf"
Include.card-init.File "/lib/card-init.conf"
Include.ctl-remap.File "/lib/ctl-remap.conf"
Include.codec-init.File "/codecs/rt5640/init.conf"

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

Syntax 3
Syntax 6

SectionUseCase."HiFi" {
File "/Intel/cht-bsw-rt5672/HiFi.conf"
Comment "Play HiFi quality Music"
}

FixedBootSequence [
exec "-/sbin/modprobe snd_ctl_led"
sysw "-/class/sound/ctl-led/speaker/card${CardNumber}/attach:DAC1 Playback Switch"
sysw "-/class/sound/ctl-led/mic/card${CardNumber}/attach:ADC Capture Switch"
Include.led.File "/common/ctl/led.conf"

Macro [
{ SetLED { LED="speaker" Action="attach" CtlId="DAC1 Playback Switch" } }
{ SetLED { LED="mic" Action="attach" CtlId="ADC Capture Switch" } }
]
19 changes: 8 additions & 11 deletions ucm2/Intel/sof-hda-dsp/sof-hda-dsp.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Syntax 7

Include.led.File "/common/ctl/led.conf"
Include.card-init.File "/lib/card-init.conf"
Include.dsp-variables.File "dsp.conf"

Expand All @@ -25,13 +26,13 @@ If.devdmic {
True {
Define.DeviceDmic "Mic1"
Define.DeviceMic "Mic2"
#
# users expect to turn the LED on when only internal
# mic is off, but it makes sense to turn this LED
# when all internal inputs are off
#
Macro [{ SetLED { LED="mic" Action="detach" CtlId="Capture Switch" } }]
FixedBootSequence [
#
# users expect to turn the LED on when only internal
# mic is off, but it makes sense to turn this LED
# when all internal inputs are off
#
sysw "-/class/sound/ctl-led/mic/card${CardNumber}/detach:Capture Switch"
# dmic array info
exec "-nhlt-dmic-info -o ${var:LibDir}/dmics-nhlt.json"
]
Expand Down Expand Up @@ -82,11 +83,7 @@ If.DellMuteLed {
Haystack "$${sys:class/leds/platform::mute/device}"
Needle "dell-laptop"
}
True {
FixedBootSequence [
sysw "-/class/sound/ctl-led/speaker/card${CardNumber}/attach:Master Playback Switch"
]
}
True.Macro [{ SetLED { LED="speaker" Action="detach" CtlId="Master Playback Switch" } }]
}

If.headphone {
Expand Down
7 changes: 3 additions & 4 deletions ucm2/codecs/cs42l43-dmic/init.conf
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ BootSequence [
cset "name='cs42l43 Decimator 4 Switch' 0"
]

FixedBootSequence [
exec "-/sbin/modprobe snd_ctl_led"
sysw "-/class/sound/ctl-led/mic/card${CardNumber}/attach:cs42l43 Decimator 3 Switch"
sysw "-/class/sound/ctl-led/mic/card${CardNumber}/attach:cs42l43 Decimator 4 Switch"
Macro [
{ SetLED { LED="mic" Action="attach" CtlId="cs42l43 Decimator 3 Switch" } }
{ SetLED { LED="mic" Action="attach" CtlId="cs42l43 Decimator 4 Switch" } }
]
5 changes: 1 addition & 4 deletions ucm2/codecs/cs42l43/init.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,4 @@ BootSequence [
cset "name='cs42l43 Decimator 1 Switch' 0"
]

FixedBootSequence [
exec "-/sbin/modprobe snd_ctl_led"
sysw "-/class/sound/ctl-led/mic/card${CardNumber}/attach:cs42l43 Decimator 1 Switch"
]
Macro [{ SetLED { LED="mic" Action="attach" CtlId="cs42l43 Decimator 1 Switch" } }]
17 changes: 17 additions & 0 deletions ucm2/codecs/rt1318/init.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# RT1318 specific switch control settings

If.oneAmp {
Condition {
Type ControlExists
Control "name='rt1318-1 DAC Switch'"
}
True.Macro[{ SetLED { LED="speaker" Action="attach" CtlId="rt1318-1 DAC Switch" } }]
}

If.twoAmps {
Condition {
Type ControlExists
Control "name='rt1318-2 DAC Switch'"
}
True.Macro[{ SetLED { LED="speaker" Action="attach" CtlId="rt1318-2 DAC Switch" } }]
}
5 changes: 1 addition & 4 deletions ucm2/codecs/rt715-sdca/init.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,4 @@ BootSequence [
cset "name='rt714 FU02 Capture Volume' 47"
]

FixedBootSequence [
exec "-/sbin/modprobe snd_ctl_led"
sysw "-/class/sound/ctl-led/mic/card${CardNumber}/attach:rt714 FU02 Capture Switch"
]
Macro [{ SetLED { LED="mic" Action="attach" CtlId="rt714 FU02 Capture Switch" } }]
5 changes: 1 addition & 4 deletions ucm2/codecs/rt715/init.conf
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,5 @@ If.capturesw {
Type ControlExists
Control "name='rt715 Capture Switch'"
}
True.FixedBootSequence [
exec "-/sbin/modprobe snd_ctl_led"
sysw "-/class/sound/ctl-led/mic/card${CardNumber}/attach:rt715 Capture Switch"
]
Macro [{ SetLED { LED="mic" Action="attach" CtlId="rt715 Capture Switch" } }]
}
5 changes: 1 addition & 4 deletions ucm2/codecs/rt722/init.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,4 @@ BootSequence [
cset "name='rt722 FU0F Capture Volume' 63"
]

FixedBootSequence [
exec "-/sbin/modprobe snd_ctl_led"
sysw "-/class/sound/ctl-led/mic/card${CardNumber}/attach:rt722 FU1E Capture Switch"
]
Macro [{ SetLED { LED="mic" Action="attach" CtlId="rt722 FU1E Capture Switch" } }]
64 changes: 64 additions & 0 deletions ucm2/common/ctl/led.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#
# Microphone/Speaker LED handling seems like an easy task, but
# the expectations are different:
#
# Main question: Which state should LEDs follow (devices)?
#
# case 1) set LEDs only for internal resources (speaker/microphone)
# case 2) set LEDs according the current stream (input/output)
# case 3) like case 1, but add analog headphones connected to laptop (analog jack)
#
# Discussion for case 2: It is not possible to handle this in driver
# (kernel). Usually, sound server knowns the current stream (maybe routed to
# bluetooth for example). Also, there is a security flaw, if the sound server will
# control LED directly.
#
# Discussion for case 3: Note that we have currently also USB headphones which won't follow
# the scenario. In this case, there is not clear LED mapping. It seems like that this case
# is a bit controversional. Thus analog headphones may be handled as external device.
#
# Result: For safety and for the simplicity and understable behaviour, only
# case 1 - LEDs should follow only internal speaker output and microphone
# input in UCM.
#

#
# Macro SetLED - attach or detach speaker or microphone LED to given control element
#
# Arguments:
# 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")
#

DefineMacro.SetLED {
If.0 {
Condition {
Type String
Empty "${var:-SndCtlLedModprobe}"
}
True {
FixedBootSequence [
exec "-/sbin/modprobe snd_ctl_led"
]
Define.SndCtlLedModprobe ok
}
}
If.1 {
Condition { Type AlwaysTrue }
True.FixedBootSequence [
sysw "-/class/sound/ctl-led/${var:__LED}/card${CardNumber}/${var:__Action}:${var:__CtlId}"
]
}
}

#
# Macro CtlNew - helper to create new control elemend
#
# Arguments:
# Arg - string for cset-new
#

DefineMacro.CtlNew.FixedBootSequence [
cset-new "${var:__Arg}"
]
13 changes: 10 additions & 3 deletions ucm2/sof-soundwire/sof-soundwire.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ SectionUseCase."HiFi" {
Comment "Play HiFi quality Music"
}

Include.led.File "/common/ctl/led.conf"
Include.card-init.File "/lib/card-init.conf"
Include.ctl-remap.File "/lib/ctl-remap.conf"

Expand Down Expand Up @@ -101,6 +102,14 @@ If.multi_headset {
}
}

If.spk_init_rt1318 {
Condition {
Type RegexMatch
Regex "(rt1318(-1)?)"
String "${var:SpeakerCodec1}"
}
True.Include.spk_init.File "/codecs/${var:SpeakerCodec1}/init.conf"
}

If.hs_init {
Condition {
Expand All @@ -126,9 +135,7 @@ If.mic_init_rt715 {
Needle "rt715"
Haystack "${var:MicCodec1}"
}
True.BootSequence [
sysw "-/class/sound/ctl-led/mic/card${CardNumber}/detach:PGA5.0 5 Master Capture Switch"
]
True.Macro [{ SetLED { LED="mic" Action="detach" CtlId="PGA5.0 5 Master Capture Switch" } }]
}

If.pga_init_pga2 {
Expand Down