]> git.alsa-project.org Git - alsa-ucm-conf.git/commitdiff
ucm2: sof-soundwire: add rt712+rt1320 amplifier
authorShuming Fan <shumingf@realtek.com>
Thu, 26 Jun 2025 11:04:19 +0000 (19:04 +0800)
committerJaroslav Kysela <perex@perex.cz>
Tue, 23 Sep 2025 10:13:51 +0000 (12:13 +0200)
This patch makes SpeakerCodec could get rt712+rt1320 string from spk:rt712+rt1320 component string.
According to the control name, we will know that one or two amplifiers exist.

Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/580
Signed-off-by: Shuming Fan <shumingf@realtek.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
ucm2/sof-soundwire/rt712+rt1320.conf [new file with mode: 0644]
ucm2/sof-soundwire/sof-soundwire.conf

diff --git a/ucm2/sof-soundwire/rt712+rt1320.conf b/ucm2/sof-soundwire/rt712+rt1320.conf
new file mode 100644 (file)
index 0000000..4fcad9c
--- /dev/null
@@ -0,0 +1,51 @@
+# Use case Configuration for sof-soundwire card
+
+#
+# Arguments:
+#   Amp - amplifier number (1,2 etc.)
+#   Sel - channel selection (L,R R,L L,L R,R L,L+R R,L+R L+R,L L+R,R L+R,L+R)
+#
+DefineMacro.rt1320spk {
+       EnableSequence [
+               cset "name='rt1320-${var:__Amp} RX Channel Select' ${var:__Sel}"
+               cset "name='rt1320-${var:__Amp} OT23 L Switch' 1"
+               cset "name='rt1320-${var:__Amp} OT23 R Switch' 1"
+       ]
+       DisableSequence [
+               cset "name='rt1320-${var:__Amp} OT23 L Switch' 0"
+               cset "name='rt1320-${var:__Amp} OT23 R Switch' 0"
+       ]
+}
+
+DefineMacro.rt1320AmpNum.If.0 {
+       Condition {
+               Type ControlExists
+               Control "name='rt1320-2 OT23 L Switch'"
+       }
+       True {
+               Macro.num1.rt1320spk { Amp 1 Sel "L,L" }
+               Macro.num2.rt1320spk { Amp 2 Sel "R,R" }
+       }
+       False {
+               Macro.num1.rt1320spk { Amp 1 Sel "L,R" }
+       }
+}
+
+SectionDevice."Speaker" {
+       Comment "Speaker"
+
+       Macro.num1.rt1320AmpNum { }
+
+       EnableSequence [
+               cset "name='Speaker Switch' on"
+       ]
+
+       DisableSequence [
+               cset "name='Speaker Switch' off"
+       ]
+
+       Value {
+             PlaybackPriority 100
+             PlaybackPCM "hw:${CardId},2"
+       }
+}
index 5dcafd8b89b50429e2a2a3e27e4ffc99d127716e..2b1323bd9f7040d6a0cedbb24ffffc737b96b62a 100644 (file)
@@ -22,7 +22,7 @@ Define {
 
 DefineRegex {
        SpeakerCodec {
-               Regex " spk:([a-z0-9]+((-sdca)|(-spk)|(-bridge))?)"
+               Regex " spk:([a-z0-9]+((-sdca)|(-spk)|(-bridge))?(\\+[a-z0-9]+)?)"
                String "${CardComponents}"
        }
        SpeakerChannels {