From 97d1f76ca42c352184bbc912551413554d2c3d93 Mon Sep 17 00:00:00 2001 From: derek fang Date: Fri, 10 Apr 2026 15:47:25 +0800 Subject: [PATCH] sof-soundwire: rt1320: add rt1320 dmic config 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 Signed-off-by: Jaroslav Kysela --- ucm2/codecs/rt1320/init.conf | 50 ++++++++++++++++++++++++++++++++++ ucm2/sof-soundwire/rt1320.conf | 41 ++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+) diff --git a/ucm2/codecs/rt1320/init.conf b/ucm2/codecs/rt1320/init.conf index f8f80c5..7ad37d7 100644 --- a/ucm2/codecs/rt1320/init.conf +++ b/ucm2/codecs/rt1320/init.conf @@ -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 + } + } + } + } + } + } +} diff --git a/ucm2/sof-soundwire/rt1320.conf b/ucm2/sof-soundwire/rt1320.conf index 2d5d1e8..e3c4395 100644 --- a/ucm2/sof-soundwire/rt1320.conf +++ b/ucm2/sof-soundwire/rt1320.conf @@ -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" + } + } + } +} -- 2.52.0