From: Shuming Fan Date: Mon, 24 Mar 2025 06:43:44 +0000 (+0800) Subject: sof-soundwire: rt1318: add playback control switch X-Git-Tag: v1.2.14~19 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=d627a0a9c860496f64f452a299e3f00ce9a6d20c;p=alsa-ucm-conf.git sof-soundwire: rt1318: add playback control switch 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 Signed-off-by: Jaroslav Kysela --- diff --git a/ucm2/codecs/rt1318/init.conf b/ucm2/codecs/rt1318/init.conf index a31b41d..30c64d6 100644 --- a/ucm2/codecs/rt1318/init.conf +++ b/ucm2/codecs/rt1318/init.conf @@ -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 diff --git a/ucm2/sof-soundwire/rt1318.conf b/ucm2/sof-soundwire/rt1318.conf index 9d01886..c8f9146 100644 --- a/ucm2/sof-soundwire/rt1318.conf +++ b/ucm2/sof-soundwire/rt1318.conf @@ -41,5 +41,7 @@ SectionDevice."Speaker" { Value { PlaybackPriority 100 PlaybackPCM "hw:${CardId},2" + PlaybackMixer "default:${CardId}" + PlaybackMixerElem "${var:SpeakerMixerElem}" } }