diff mbox series

[v4] sof-soundwire: Add basic support for cs42l43

Message ID 20231220165951.3675985-1-ckeepax@opensource.cirrus.com
State Superseded
Headers show
Series [v4] sof-soundwire: Add basic support for cs42l43 | expand

Commit Message

Charles Keepax Dec. 20, 2023, 4:59 p.m. UTC
cs42l43 is a codec device, add basic support for it. Including a dual
channel DMIC input, stereo headphones, and a mono headset microphone.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---

Changes since v3:
 - Rebase on GitHub series
 - Add control remapping for the PDM volume/switch

Little earlier than expected, still reviewing the workings behind the
scenes but this all tests out fine. So no need to hold everything up
on my account.

Thanks,
Charles

 ucm2/codecs/cs42l43/init.conf         | 14 ++++++++
 ucm2/sof-soundwire/cs42l43-dmic.conf  | 26 +++++++++++++++
 ucm2/sof-soundwire/cs42l43.conf       | 46 +++++++++++++++++++++++++++
 ucm2/sof-soundwire/sof-soundwire.conf |  2 +-
 4 files changed, 87 insertions(+), 1 deletion(-)
 create mode 100644 ucm2/codecs/cs42l43/init.conf
 create mode 100644 ucm2/sof-soundwire/cs42l43-dmic.conf
 create mode 100644 ucm2/sof-soundwire/cs42l43.conf
diff mbox series

Patch

diff --git a/ucm2/codecs/cs42l43/init.conf b/ucm2/codecs/cs42l43/init.conf
new file mode 100644
index 0000000..10a6e1f
--- /dev/null
+++ b/ucm2/codecs/cs42l43/init.conf
@@ -0,0 +1,14 @@ 
+# cs42l43 specific control settings
+
+LibraryConfig.remap.Config {
+	ctl.default.map {
+		"name='cs42l43 PDM2 Switch'" {
+			"name='cs42l43 Decimator 3 Switch'".vindex.0 0
+			"name='cs42l43 Decimator 4 Switch'".vindex.1 0
+		}
+		"name='cs42l43 PDM2 Volume'" {
+			"name='cs42l43 Decimator 3 Volume'".vindex.0 0
+			"name='cs42l43 Decimator 4 Volume'".vindex.1 0
+		}
+	}
+}
diff --git a/ucm2/sof-soundwire/cs42l43-dmic.conf b/ucm2/sof-soundwire/cs42l43-dmic.conf
new file mode 100644
index 0000000..d5f895d
--- /dev/null
+++ b/ucm2/sof-soundwire/cs42l43-dmic.conf
@@ -0,0 +1,26 @@ 
+# Use case Configuration for sof-soundwire card
+
+SectionDevice."Mic" {
+	Comment "Microphones"
+
+	ConflictingDevice [
+		"Headset"
+	]
+
+	EnableSequence [
+		cset "name='cs42l43 DP1TX1 Input' 'Decimator 3'"
+		cset "name='cs42l43 DP1TX2 Input' 'Decimator 4'"
+	]
+
+	DisableSequence [
+		cset "name='cs42l43 DP1TX1 Input' 'None'"
+		cset "name='cs42l43 DP1TX2 Input' 'None'"
+	]
+
+	Value {
+		CapturePriority 100
+		CapturePCM "hw:${CardId},4"
+		CaptureMixer "default:${CardId}"
+		CaptureMixerElem "cs42l43 PDM2"
+	}
+}
diff --git a/ucm2/sof-soundwire/cs42l43.conf b/ucm2/sof-soundwire/cs42l43.conf
new file mode 100644
index 0000000..1702cf0
--- /dev/null
+++ b/ucm2/sof-soundwire/cs42l43.conf
@@ -0,0 +1,46 @@ 
+# Use case Configuration for sof-soundwire card
+
+SectionDevice."Headphones" {
+	Comment "Headphones"
+
+	EnableSequence [
+		cset "name='cs42l43 Headphone L Input 1' 'DP5RX1'"
+		cset "name='cs42l43 Headphone R Input 1' 'DP5RX2'"
+	]
+
+	DisableSequence [
+		cset "name='cs42l43 Headphone L Input 1' 'None'"
+		cset "name='cs42l43 Headphone R Input 1' 'None'"
+	]
+
+	Value {
+		PlaybackPriority 200
+		PlaybackPCM "hw:${CardId},0"
+		PlaybackVolume "cs42l43 Headphone Digital Volume"
+		JackControl "Headphone Jack"
+	}
+}
+
+SectionDevice."Headset" {
+	Comment "Headset Microphone"
+
+	EnableSequence [
+		cset "name='cs42l43 ADC1 Input' 'IN1'"
+		cset "name='cs42l43 Decimator 1 Mode' 'ADC'"
+
+		cset "name='cs42l43 DP1TX1 Input' 'Decimator 1'"
+		cset "name='cs42l43 DP1TX2 Input' 'Decimator 1'"
+	]
+
+	DisableSequence [
+		cset "name='cs42l43 DP1TX1 Input' 'None'"
+		cset "name='cs42l43 DP1TX2 Input' 'None'"
+	]
+
+	Value {
+		CapturePriority 200
+		CapturePCM "hw:${CardId},4"
+		CaptureMixerElem "cs42l43 Decimator 1"
+		JackControl "Headset Mic Jack"
+	}
+}
diff --git a/ucm2/sof-soundwire/sof-soundwire.conf b/ucm2/sof-soundwire/sof-soundwire.conf
index 18b1bf8..35a262c 100644
--- a/ucm2/sof-soundwire/sof-soundwire.conf
+++ b/ucm2/sof-soundwire/sof-soundwire.conf
@@ -47,7 +47,7 @@  DefineRegex {
 If.hs_init {
 	Condition {
 		Type RegexMatch
-		Regex "(rt5682|rt700|rt711|rt713(-sdca)?)"
+		Regex "(cs42l43|rt5682|rt700|rt711|rt713(-sdca)?)"
 		String "${var:HeadsetCodec1}"
 	}
 	True.Include.hs_init.File "/codecs/${var:HeadsetCodec1}/init.conf"