]> git.alsa-project.org Git - alsa-ucm-conf.git/commitdiff
sof-soundwire: rt1320: add rt1320 dmic config
authorderek fang <derek.fang@realtek.com>
Fri, 10 Apr 2026 07:47:25 +0000 (15:47 +0800)
committerJaroslav Kysela <perex@perex.cz>
Thu, 16 Apr 2026 12:00:59 +0000 (14:00 +0200)
This patch adds configs for rt1320 dmic function.
It defines the MicMixerElem, a remapped control for the two rt1320-dmic
case, and also attaches rt1320 FU capture controls to the mic LED.

Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/743
Signed-off-by: derek fang <derek.fang@realtek.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
ucm2/codecs/rt1320/init.conf
ucm2/sof-soundwire/rt1320.conf

index f8f80c522d8c271627508c7dad512393d426d63f..7ad37d75b757ff7c97b97ae851daa426fac64b5c 100644 (file)
@@ -65,3 +65,53 @@ If.twoAmps {
                }
        }
 }
+
+# RT1320 DMIC specific switch control settings
+
+Define.MicMixerElem "rt1320-1 FU"
+
+DefineMacro.rt1320micled.If.0 {
+       Condition {
+               Type RegexMatch
+               Regex "${var:__ForMics}"
+               String "${var:Mics}"
+       }
+       True.Macro [{ SetLED { LED="mic" Action="attach" CtlId="rt1320-${var:__Mic} FU Capture Switch" } }]
+}
+
+If.mic_init_rt1320 {
+       Condition {
+               Type String
+               Needle "rt1320"
+               Haystack "${var:MultiMicShadow}"
+       }
+       True {
+               Macro.num1.rt1320micled { ForMics "[12]" Mic 1 }
+               Macro.num2.rt1320micled { ForMics "2" Mic 2 }
+
+               If.twoMics {
+                       Condition {
+                               Type RegexMatch
+                               Regex "2"
+                               String "${var:Mics}"
+                       }
+                       True {
+                               Define.MicMixerElem "rt1320 FU"
+                               LibraryConfig.remap.Config {
+                                       ctl.default.map {
+                                               "name='rt1320 FU Capture Switch'" {
+                                                       "name='rt1320-1 FU Capture Switch'".vindex.0 0
+                                                       "name='rt1320-1 FU Capture Switch'".vindex.1 1
+                                                       "name='rt1320-1 FU Capture Switch'".vindex.2 2
+                                                       "name='rt1320-1 FU Capture Switch'".vindex.3 3
+                                                       "name='rt1320-2 FU Capture Switch'".vindex.4 0
+                                                       "name='rt1320-2 FU Capture Switch'".vindex.5 1
+                                                       "name='rt1320-2 FU Capture Switch'".vindex.6 2
+                                                       "name='rt1320-2 FU Capture Switch'".vindex.7 3
+                                               }
+                                       }
+                               }
+                       }
+               }
+       }
+}
index 2d5d1e84f82ed51bb006089b13444075376b5f33..e3c43959f3c72bb7f2b52dec7afd5e2d30c16542 100644 (file)
@@ -48,3 +48,44 @@ SectionDevice."Speaker" {
                PlaybackSwitch "${var:SpeakerMixerElem} Playback Switch"
        }
 }
+
+# Use case Configuration for RT1320 SoundWire DMIC (microphone function)
+
+DefineMacro.rt1320dmic.If.0 {
+       Condition {
+               Type RegexMatch
+               Regex "${var:__ForMics}"
+               String "${var:Mics}"
+       }
+       True {
+               EnableSequence [
+                       cset "name='rt1320-${var:__Mic} FU Capture Switch' 1"
+               ]
+               DisableSequence [
+                       cset "name='rt1320-${var:__Mic} FU Capture Switch' 0"
+               ]
+       }
+}
+
+If.codecmic {
+       Condition {
+               Type String
+               Needle "rt1320"
+               Haystack "${var:MultiMicShadow}"
+       }
+       True {
+               SectionDevice."Mic" {
+                       Comment "Microphones"
+
+                       Macro.num1.rt1320dmic { ForMics "[12]" Mic 1 }
+                       Macro.num2.rt1320dmic { ForMics "2" Mic 2 }
+
+                       Value {
+                               CapturePriority 100
+                               CapturePCM "hw:${CardId},4"
+                               CaptureMixerElem "${var:MicMixerElem}"
+                               CaptureSwitch "${var:MicMixerElem} Capture Switch"
+                       }
+               }
+       }
+}