sof-soundwire: rt1320: add playback control switch

This patch defines 'rt1320 OT23' as PlaybackMixerElem and
a remapped one 'rt1320 OT23 Playback Switch' when using one
or two amps.

And also attach rt1320 OT23 controls to speaker 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>
This commit is contained in:
derek fang 2026-03-13 11:11:34 +08:00 committed by Jaroslav Kysela
commit ee39f9ec0c
3 changed files with 73 additions and 3 deletions

View file

@ -0,0 +1,67 @@
# RT1320 amp specific switch control settings
DefineMacro.rt1320spkled.If.0 {
Condition {
Type RegexMatch
Regex "${var:__ForAmps}"
String "${var:SpeakerAmps}"
}
True.Macro [
{ SetLED { LED="speaker" Action="attach" CtlId="rt1320-${var:__Amp} OT23 L Switch" } }
{ SetLED { LED="speaker" Action="attach" CtlId="rt1320-${var:__Amp} OT23 R Switch" } }
]
}
If.spk_init_rt1320 {
Condition {
Type String
Needle "rt1320"
Haystack "${var:MultiSpeakerShadow}"
}
True {
Macro.num1.rt1320spkled { ForAmps "[12]" Amp 1 }
Macro.num2.rt1320spkled { ForAmps "2" Amp 2 }
}
}
Define.SpeakerMixerElem "rt1320-1 OT23"
If.oneAmp {
Condition {
Type RegexMatch
Regex "1"
String "${var:SpeakerAmps}"
}
True {
Define.SpeakerMixerElem "rt1320 OT23"
LibraryConfig.remap.Config {
ctl.default.map {
"name='rt1320 OT23 Playback Switch'" {
"name='rt1320-1 OT23 L Switch'".vindex.0 0
"name='rt1320-1 OT23 R Switch'".vindex.1 0
}
}
}
}
}
If.twoAmps {
Condition {
Type RegexMatch
Regex "2"
String "${var:SpeakerAmps}"
}
True {
Define.SpeakerMixerElem "rt1320 OT23"
LibraryConfig.remap.Config {
ctl.default.map {
"name='rt1320 OT23 Playback Switch'" {
"name='rt1320-1 OT23 L Switch'".vindex.0 0
"name='rt1320-1 OT23 R Switch'".vindex.0 0
"name='rt1320-2 OT23 L Switch'".vindex.1 0
"name='rt1320-2 OT23 R Switch'".vindex.1 0
}
}
}
}
}

View file

@ -43,5 +43,8 @@ SectionDevice."Speaker" {
Value {
PlaybackPriority 100
PlaybackPCM "hw:${CardId},2"
PlaybackMixer "default:${CardId}"
PlaybackMixerElem "${var:SpeakerMixerElem}"
PlaybackSwitch "${var:SpeakerMixerElem} Playback Switch"
}
}

View file

@ -50,7 +50,7 @@ DefineRegex {
String "${CardComponents}"
}
MultiCodec {
Regex "(rt712|rt713|rt721|rt722)"
Regex "(rt712|rt713|rt721|rt722|rt1320)"
String "${var:SpeakerCodec1} ${var:HeadsetCodec1} ${var:MicCodec1}"
}
}