From c56d0a46c621d16b053d5da16c3814fe1653c8c1 Mon Sep 17 00:00:00 2001 From: Charles Keepax Date: Tue, 23 Apr 2024 16:43:05 +0100 Subject: [PATCH] sof-soundwire: Add basic support for cs42l43's speaker Previous support was added for the mics and headset on cs42l43, expand this support with additional configuration for the speaker output. Link: https://lore.kernel.org/alsa-devel/20240423154305.2782347-1-ckeepax@opensource.cirrus.com/ Signed-off-by: Charles Keepax Signed-off-by: Jaroslav Kysela --- ucm2/sof-soundwire/HiFi.conf | 8 ++++++++ ucm2/sof-soundwire/cs42l43-spk.conf | 25 +++++++++++++++++++++++++ ucm2/sof-soundwire/sof-soundwire.conf | 13 +++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 ucm2/sof-soundwire/cs42l43-spk.conf diff --git a/ucm2/sof-soundwire/HiFi.conf b/ucm2/sof-soundwire/HiFi.conf index ffea077c..8777ee6e 100644 --- a/ucm2/sof-soundwire/HiFi.conf +++ b/ucm2/sof-soundwire/HiFi.conf @@ -8,6 +8,14 @@ SectionVerb { Value.TQ "HiFi" } +If.codec { + Condition { + Type String + Empty "${var:Codec1}" + } + False.Include.codec.File "/sof-soundwire/${var:Codec1}.conf" +} + If.spkdev { Condition { Type String diff --git a/ucm2/sof-soundwire/cs42l43-spk.conf b/ucm2/sof-soundwire/cs42l43-spk.conf new file mode 100644 index 00000000..73f12999 --- /dev/null +++ b/ucm2/sof-soundwire/cs42l43-spk.conf @@ -0,0 +1,25 @@ +# Use case Configuration for sof-soundwire card + +SectionDevice."Speaker" { + Comment "Speaker" + + ConflictingDevice [ + "Headphones" + ] + + EnableSequence [ + cset "name='cs42l43 Speaker L Input 1' 'DP5RX1'" + cset "name='cs42l43 Speaker R Input 1' 'DP5RX2'" + ] + + DisableSequence [ + cset "name='cs42l43 Speaker L Input 1' 'None'" + cset "name='cs42l43 Speaker R Input 1' 'None'" + ] + + Value { + PlaybackPriority 100 + PlaybackPCM "hw:${CardId},0" + PlaybackMixerElem "cs42l43 Speaker Digital" + } +} diff --git a/ucm2/sof-soundwire/sof-soundwire.conf b/ucm2/sof-soundwire/sof-soundwire.conf index 35a262c4..1ed888cc 100644 --- a/ucm2/sof-soundwire/sof-soundwire.conf +++ b/ucm2/sof-soundwire/sof-soundwire.conf @@ -18,6 +18,10 @@ Define { } DefineRegex { + Codec { + Regex " codec:([a-z0-9]+(-sdca)?)" + String "${CardComponents}" + } SpeakerCodec { Regex " spk:([a-z0-9]+(-sdca)?)" String "${CardComponents}" @@ -44,6 +48,15 @@ DefineRegex { } } +If.codec_init { + Condition { + Type RegexMatch + Regex "(rt722)" + String "${var:Codec1}" + } + True.Include.codec_init.File "/codecs/${var:Codec1}/init.conf" +} + If.hs_init { Condition { Type RegexMatch