]> git.alsa-project.org Git - alsa-ucm-conf.git/commitdiff
sof-soundwire: rt1318: add playback control switch
authorShuming Fan <shumingf@realtek.com>
Mon, 24 Mar 2025 06:43:44 +0000 (14:43 +0800)
committerJaroslav Kysela <perex@perex.cz>
Mon, 24 Mar 2025 09:17:59 +0000 (10:17 +0100)
This patch defines 'rt1318-1 DAC' as PlaybackMixerElem when equipped with only one amp
and defines a remapped one 'rt1318 DAC Playback Switch' when using two amps.

Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/525
Signed-off-by: Shuming Fan <shumingf@realtek.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
ucm2/codecs/rt1318/init.conf
ucm2/sof-soundwire/rt1318.conf

index a31b41d05a44252fdf0e3f13d3005109812e1756..30c64d6bcb62f3a82bac3acaee5cb3c758f51a67 100644 (file)
@@ -1,5 +1,26 @@
 # RT1318 specific switch control settings
 
+Define.SpeakerMixerElem "rt1318-1 DAC"
+
+If.twoAmpsStereoToOne {
+       Condition {
+               Type RegexMatch
+               Regex "2"
+               String "${var:SpeakerAmps}"
+       }
+       True {
+               Define.SpeakerMixerElem "rt1318 DAC"
+               LibraryConfig.remap.Config {
+                       ctl.default.map {
+                               "name='rt1318 DAC Playback Switch'" {
+                                       "name='rt1318-1 DAC Switch'".vindex.0 [ 0 1 ]
+                                       "name='rt1318-2 DAC Switch'".vindex.1 [ 0 1 ]
+                               }
+                       }
+               }
+       }
+}
+
 If.oneAmp {
        Condition {
                Type ControlExists
index 9d018860a7929e056b2285ae409747ef8906b82f..c8f9146ed8ee1aa28c23d1a4204fff26613144fc 100644 (file)
@@ -41,5 +41,7 @@ SectionDevice."Speaker" {
        Value {
              PlaybackPriority 100
              PlaybackPCM "hw:${CardId},2"
+             PlaybackMixer "default:${CardId}"
+             PlaybackMixerElem "${var:SpeakerMixerElem}"
        }
 }