sof-soundwire: Add LED support for cs35l56 amplifiers
PATCH 1/1 sof-soundwire: Add LED support for cs35l56 amplifiers
Systems may have up to 8 CS35L56 amplifiers, and each amplifier should be attached to the speaker LED. A mapped Playback switch is required to ensure all amps are muted and unmute appropriately.
Signed-off-by Stefan Binding <[email protected]>
--- ucm2/codecs/cs35l56-bridge/init.conf | 11 ++++++++ ucm2/codecs/cs35l56/init.conf | 36 +++++++++++++++++++++++++++ ucm2/sof-soundwire/cs35l56.conf | 32 ++---------------------- ucm2/sof-soundwire/sof-soundwire.conf | 4 +-- 4 files changed, 51 insertions(+), 32 deletions(-) create mode 100644 ucm2/codecs/cs35l56-bridge/init.conf create mode 100644 ucm2/codecs/cs35l56/init.conf
ucm2/codecs/cs35l56-bridge/init.conf new file +11 -0
@@ -0,0 +1,11 @@ +# cs35l56 specific control settings + +FixedBootSequence [ + cset "name='AMPL Speaker Switch' 0" + cset "name='AMPR Speaker Switch' 0" +] + +Macro [ + { SetLED { LED="speaker" Action="attach" CtlId="AMPL Speaker Switch" } } + { SetLED { LED="speaker" Action="attach" CtlId="AMPR Speaker Switch" } } +]
ucm2/codecs/cs35l56/init.conf new file +36 -0
@@ -0,0 +1,36 @@ +# cs35l56 specific control settings + +# +# Arguments: +# ForAmps - regex filter for var:SpeakerAmps +# Amp - amplifier number 1-8 +# +DefineMacro.cs35l56spkInit.If.0 { + Condition { + Type RegexMatch + Regex "${var:__ForAmps}" + String "${var:SpeakerAmps}" + } + True { + LibraryConfig.remap.Config.ctl.default.map { + "name='cs35l56 Speaker Playback Switch'" { + "name='AMP${var:__Amp} Speaker Switch'".vindex."${eval:($__Amp-1)}" 0 + } + } + FixedBootSequence [ + cset "name='AMP${var:__Amp} Speaker Switch' 0" + ] + Macro [{ SetLED { LED="speaker" Action="attach" CtlId="AMP${var:__Amp} Speaker Switch" } }] + } +} + +Macro [ + { cs35l56spkInit { ForAmps "[1-8]" Amp 1 } } + { cs35l56spkInit { ForAmps "[2-8]" Amp 2 } } + { cs35l56spkInit { ForAmps "[3-8]" Amp 3 } } + { cs35l56spkInit { ForAmps "[4-8]" Amp 4 } } + { cs35l56spkInit { ForAmps "[5-8]" Amp 5 } } + { cs35l56spkInit { ForAmps "[6-8]" Amp 6 } } + { cs35l56spkInit { ForAmps "[78]" Amp 7 } } + { cs35l56spkInit { ForAmps "8" Amp 8 } } +]
ucm2/sof-soundwire/cs35l56.conf +2 -30
@@ -1,40 +1,12 @@ # Use case Configuration for sof-soundwire card -# -# Arguments: -# ForAmps - regex filter for var:SpeakerAmps -# Amp - amplifier number 1-8 -# -DefineMacro.cs42l43spk.If.0 { - Condition { - Type RegexMatch - Regex "${var:__ForAmps}" - String "${var:SpeakerAmps}" - } - True { - EnableSequence [ - cset "name='AMP${var:__Amp} Speaker Switch' 1" - ] - DisableSequence [ - cset "name='AMP${var:__Amp} Speaker Switch' 0" - ] - } -} - SectionDevice."Speaker" { Comment "Speaker" - Macro.num1.cs42l43spk { ForAmps "[1-8]" Amp 1 } - Macro.num2.cs42l43spk { ForAmps "[2-8]" Amp 2 } - Macro.num3.cs42l43spk { ForAmps "[3-8]" Amp 3 } - Macro.num4.cs42l43spk { ForAmps "[4-8]" Amp 4 } - Macro.num5.cs42l43spk { ForAmps "[5-8]" Amp 5 } - Macro.num6.cs42l43spk { ForAmps "[6-8]" Amp 6 } - Macro.num7.cs42l43spk { ForAmps "[78]" Amp 7 } - Macro.num8.cs42l43spk { ForAmps "8" Amp 8 } - Value { PlaybackPriority 100 PlaybackPCM "hw:${CardId},2" + PlaybackMixer "default:${CardId}" + PlaybackMixerElem "cs35l56 Speaker" } }
ucm2/sof-soundwire/sof-soundwire.conf +2 -2
@@ -102,10 +102,10 @@ If.multi_headset { } } -If.spk_init_rt1318 { +If.spk_init { Condition { Type RegexMatch - Regex "(rt1318(-1)?)" + Regex "(rt1318(-1)?|cs35l56(-bridge)?)" String "${var:SpeakerCodec1}" } True.Include.spk_init.File "/codecs/${var:SpeakerCodec1}/init.conf"
Signature · 1 line
2.43.0
Quoted 3 lines · Stefan Binding
Systems may have up to 8 CS35L56 amplifiers, and each amplifier should be attached to the speaker LED. A mapped Playback switch is required to ensure all amps are muted and unmute appropriately.
Applied. Thanks. It would be nice to make next contributions through github (pull request) to allow CI testing and more easy comments.
Jaroslav
Signature · 2 lines
Jaroslav Kysela <[email protected]> Linux Sound Maintainer; ALSA Project; Red Hat, Inc.