]> git.alsa-project.org Git - alsa-ucm-conf.git/commitdiff
ucm2: sof-soundwire: add combined cs42l43-spk+cs35l56 config HEAD master
authorMaciej Strozek <mstrozek@opensource.cirrus.com>
Wed, 15 Apr 2026 12:47:06 +0000 (13:47 +0100)
committerJaroslav Kysela <perex@perex.cz>
Mon, 4 May 2026 09:26:02 +0000 (11:26 +0200)
In some systems cs42l43-spk and cs35l56 can be used simultaneously to
drive seprate speakers (e.g. tweeters and woofers), add a configuration
to support that.

Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/748
Link: https://lore.kernel.org/all/20260417144529.2385360-1-mstrozek@opensource.cirrus.com/
Signed-off-by: Maciej Strozek <mstrozek@opensource.cirrus.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
ucm2/codecs/cs35l56+cs42l43-spk [new symlink]
ucm2/codecs/cs42l43-spk+cs35l56/init.conf [new file with mode: 0644]
ucm2/sof-soundwire/cs35l56+cs42l43-spk.conf [new symlink]
ucm2/sof-soundwire/cs42l43-spk+cs35l56.conf [new symlink]
ucm2/sof-soundwire/sof-soundwire.conf

diff --git a/ucm2/codecs/cs35l56+cs42l43-spk b/ucm2/codecs/cs35l56+cs42l43-spk
new file mode 120000 (symlink)
index 0000000..6f81756
--- /dev/null
@@ -0,0 +1 @@
+cs42l43-spk+cs35l56
\ No newline at end of file
diff --git a/ucm2/codecs/cs42l43-spk+cs35l56/init.conf b/ucm2/codecs/cs42l43-spk+cs35l56/init.conf
new file mode 100644 (file)
index 0000000..c3ff43e
--- /dev/null
@@ -0,0 +1,42 @@
+# cs42l43+cs35l56 specific control settings
+#
+# Arguments:
+#   Amp - amplifier number 1-8
+#
+DefineMacro.cs35l56spkInit.If.0 {
+       Condition {
+               Type ControlExists
+               Control "name='AMP${var:__Amp} Speaker Switch'"
+       }
+       True {
+               LibraryConfig.remap.Config.ctl.default.map {
+                       "name='cs42l43 Speaker Playback Switch'" {
+                               "name='AMP${var:__Amp} Speaker Switch'".vindex.0 0
+                       }
+               }
+               FixedBootSequence [
+                       cset "name='AMP${var:__Amp} Speaker Switch' 0"
+               ]
+               Macro [{ SetLED { LED="speaker" Action="attach" CtlId="AMP${var:__Amp} Speaker Switch" } }]
+       }
+}
+
+LibraryConfig.remap.Config {
+       ctl.default.map {
+               "name='cs42l43 Speaker Playback Switch'" {
+                       "name='cs42l43 Speaker Digital Switch'".vindex.0 [ 0 1 ]
+               }
+       }
+}
+
+Macro [
+       { SetLED { LED="speaker" Action="attach" CtlId="cs42l43 Speaker Digital Switch" } }
+       { cs35l56spkInit { Amp 1 } }
+       { cs35l56spkInit { Amp 2 } }
+       { cs35l56spkInit { Amp 3 } }
+       { cs35l56spkInit { Amp 4 } }
+       { cs35l56spkInit { Amp 5 } }
+       { cs35l56spkInit { Amp 6 } }
+       { cs35l56spkInit { Amp 7 } }
+       { cs35l56spkInit { Amp 8 } }
+]
diff --git a/ucm2/sof-soundwire/cs35l56+cs42l43-spk.conf b/ucm2/sof-soundwire/cs35l56+cs42l43-spk.conf
new file mode 120000 (symlink)
index 0000000..93e49c3
--- /dev/null
@@ -0,0 +1 @@
+cs42l43-spk.conf
\ No newline at end of file
diff --git a/ucm2/sof-soundwire/cs42l43-spk+cs35l56.conf b/ucm2/sof-soundwire/cs42l43-spk+cs35l56.conf
new file mode 120000 (symlink)
index 0000000..93e49c3
--- /dev/null
@@ -0,0 +1 @@
+cs42l43-spk.conf
\ No newline at end of file
index 0a2c15d604c46a70228d83d5828249673b0375e3..1eb930ef4b456149cd4e1ffda86e4d6a1739996a 100644 (file)
@@ -22,7 +22,7 @@ Define {
 
 DefineRegex {
        SpeakerCodec {
 
 DefineRegex {
        SpeakerCodec {
-               Regex " spk:([a-z0-9]+((-sdca)|(-spk)|(-bridge))?(\\+[a-z0-9]+)?)"
+               Regex " spk:([a-z0-9]+((-sdca)|(-spk)|(-bridge))?(\\+[a-z0-9]+((-spk)?))?)"
                String "${CardComponents}"
        }
        SpeakerChannels {
                String "${CardComponents}"
        }
        SpeakerChannels {
@@ -55,6 +55,16 @@ DefineRegex {
        }
 }
 
        }
 }
 
+# check to keep combatibility with older kernels that have two separate spk: tags
+If.old_multi_spk {
+       Condition {
+               Type RegexMatch
+               Regex "(spk:cs42l43-spk .*spk:cs35l56( |$))|(spk:cs35l56 .*spk:cs42l43-spk( |$))"
+               String "${CardComponents}"
+       }
+       True.Define.SpeakerCodec1 "cs42l43-spk+cs35l56"
+}
+
 If.multi_init {
        Condition {
                Type String
 If.multi_init {
        Condition {
                Type String
@@ -108,7 +118,7 @@ If.multi_headset {
 If.spk_init {
        Condition {
                Type RegexMatch
 If.spk_init {
        Condition {
                Type RegexMatch
-               Regex "(rt1318(-1)?|cs42l43-spk|cs35l56(-bridge)?)"
+               Regex "(rt1318(-1)?|cs42l43-spk(\\+cs35l56)?|cs35l56((-bridge)|(\\+cs42l43-spk))?)"
                String "${var:SpeakerCodec1}"
        }
        True.Include.spk_init.File "/codecs/${var:SpeakerCodec1}/init.conf"
                String "${var:SpeakerCodec1}"
        }
        True.Include.spk_init.File "/codecs/${var:SpeakerCodec1}/init.conf"