diff mbox series

[alsa-ucm-conf,v2,2/2] sof-soundwire: Add basic support for a 4x cs35l56 configuration

Message ID 20231206140547.1344041-2-ckeepax@opensource.cirrus.com
State New
Headers show
Series [alsa-ucm-conf,v2,1/2] sof-soundwire: Add basic support for cs42l43 | expand

Commit Message

Charles Keepax Dec. 6, 2023, 2:05 p.m. UTC
cs35l56 is a boosted speaker amp, add UCM support for configurations
with up to 8 amps. This also updates the default naming for the
speaker amp UCM file to remove the number of amps. Special cases are
added for the existing amps that require different UCM for different
numbers of amps, but future additions will defaults to not including
it in the naming.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
 ucm2/sof-soundwire/HiFi.conf    |  12 +++-
 ucm2/sof-soundwire/cs35l56.conf | 123 ++++++++++++++++++++++++++++++++
 2 files changed, 134 insertions(+), 1 deletion(-)
 create mode 100644 ucm2/sof-soundwire/cs35l56.conf
diff mbox series

Patch

diff --git a/ucm2/sof-soundwire/HiFi.conf b/ucm2/sof-soundwire/HiFi.conf
index a8c1e33..8b32d20 100644
--- a/ucm2/sof-soundwire/HiFi.conf
+++ b/ucm2/sof-soundwire/HiFi.conf
@@ -13,7 +13,17 @@  If.spkdev {
 		Type String
 		Empty "${var:SpeakerCodec1}"
 	}
-	False.Include.spkdev.File "/sof-soundwire/${var:SpeakerCodec1}-${var:SpeakerAmps1}.conf"
+	False {
+		If.simplespeaker {
+			Condition {
+				Type RegexMatch
+				Regex "(rt1308|rt1316|rt1318)"
+				String "${var:SpeakerCodec1}"
+			}
+			True.Include.spkdev.File "/sof-soundwire/${var:SpeakerCodec1}-${var:SpeakerAmps1}.conf"
+			False.Include.spkdev.File "/sof-soundwire/${var:SpeakerCodec1}.conf"
+		}
+	}
 }
 
 If.micdev {
diff --git a/ucm2/sof-soundwire/cs35l56.conf b/ucm2/sof-soundwire/cs35l56.conf
new file mode 100644
index 0000000..32c08e7
--- /dev/null
+++ b/ucm2/sof-soundwire/cs35l56.conf
@@ -0,0 +1,123 @@ 
+# Use case Configuration for sof-soundwire card
+
+SectionDevice."Speaker" {
+	Comment "Speaker"
+
+	If.amp1 {
+		Condition {
+			Type ControlExists
+			Control "name='AMP1 Speaker Switch'"
+		}
+		True {
+			EnableSequence [
+				cset "name='AMP1 Speaker Switch' 1"
+			]
+			DisableSequence [
+				cset "name='AMP1 Speaker Switch' 0"
+			]
+		}
+	}
+	If.amp2 {
+		Condition {
+			Type ControlExists
+			Control "name='AMP2 Speaker Switch'"
+		}
+		True {
+			EnableSequence [
+				cset "name='AMP2 Speaker Switch' 1"
+			]
+			DisableSequence [
+				cset "name='AMP2 Speaker Switch' 0"
+			]
+		}
+	}
+	If.amp3 {
+		Condition {
+			Type ControlExists
+			Control "name='AMP3 Speaker Switch'"
+		}
+		True {
+			EnableSequence [
+				cset "name='AMP3 Speaker Switch' 1"
+			]
+			DisableSequence [
+				cset "name='AMP3 Speaker Switch' 0"
+			]
+		}
+	}
+	If.amp4 {
+		Condition {
+			Type ControlExists
+			Control "name='AMP4 Speaker Switch'"
+		}
+		True {
+			EnableSequence [
+				cset "name='AMP4 Speaker Switch' 1"
+			]
+			DisableSequence [
+				cset "name='AMP4 Speaker Switch' 0"
+			]
+		}
+	}
+	If.amp5 {
+		Condition {
+			Type ControlExists
+			Control "name='AMP5 Speaker Switch'"
+		}
+		True {
+			EnableSequence [
+				cset "name='AMP5 Speaker Switch' 1"
+			]
+			DisableSequence [
+				cset "name='AMP5 Speaker Switch' 0"
+			]
+		}
+	}
+	If.amp6 {
+		Condition {
+			Type ControlExists
+			Control "name='AMP6 Speaker Switch'"
+		}
+		True {
+			EnableSequence [
+				cset "name='AMP6 Speaker Switch' 1"
+			]
+			DisableSequence [
+				cset "name='AMP6 Speaker Switch' 0"
+			]
+		}
+	}
+	If.amp7 {
+		Condition {
+			Type ControlExists
+			Control "name='AMP7 Speaker Switch'"
+		}
+		True {
+			EnableSequence [
+				cset "name='AMP7 Speaker Switch' 1"
+			]
+			DisableSequence [
+				cset "name='AMP7 Speaker Switch' 0"
+			]
+		}
+	}
+	If.amp8 {
+		Condition {
+			Type ControlExists
+			Control "name='AMP8 Speaker Switch'"
+		}
+		True {
+			EnableSequence [
+				cset "name='AMP8 Speaker Switch' 1"
+			]
+			DisableSequence [
+				cset "name='AMP8 Speaker Switch' 0"
+			]
+		}
+	}
+
+	Value {
+		PlaybackPriority 100
+		PlaybackPCM "hw:${CardId},2"
+	}
+}