]> git.alsa-project.org Git - alsa-ucm-conf.git/commitdiff
sof-soundwire: Add LED support for cs35l56 amplifiers
authorStefan Binding <sbinding@opensource.cirrus.com>
Mon, 31 Mar 2025 09:34:30 +0000 (10:34 +0100)
committerJaroslav Kysela <perex@perex.cz>
Mon, 31 Mar 2025 13:32:49 +0000 (15:32 +0200)
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.

Link: https://lore.kernel.org/alsa-devel/20250331093440.9412-1-sbinding@opensource.cirrus.com/
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
ucm2/codecs/cs35l56-bridge/init.conf [new file with mode: 0644]
ucm2/codecs/cs35l56/init.conf [new file with mode: 0644]
ucm2/sof-soundwire/cs35l56.conf
ucm2/sof-soundwire/sof-soundwire.conf

diff --git a/ucm2/codecs/cs35l56-bridge/init.conf b/ucm2/codecs/cs35l56-bridge/init.conf
new file mode 100644 (file)
index 0000000..407bb09
--- /dev/null
@@ -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" } }
+]
\ No newline at end of file
diff --git a/ucm2/codecs/cs35l56/init.conf b/ucm2/codecs/cs35l56/init.conf
new file mode 100644 (file)
index 0000000..dca14c7
--- /dev/null
@@ -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 } }
+]
index f74b99afbb550f208caef3eab08a9369b661bf66..53e4d6dd8edab9323026a9d1c731a974d1071835 100644 (file)
@@ -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"
        }
 }
index 1cddfbf4cfbf414cb229cce9880f468c4be264ef..8f9bc82c2d3bf083a1b56fd60006b450902b21df 100644 (file)
@@ -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"