[PATCH alsa-ucm-conf v1] sof-soundwire: Add LED support for cs35l56 amplifiers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Systems may have up to 8 CS35L56 amplifiers, and each amplifier should
be attached to the speaker LED. A mapped Playback switch is required to
ensure all amps are muted and unmute appropriately.

Signed-off-by: Stefan Binding <sbinding@xxxxxxxxxxxxxxxxxxxxx>
---
 ucm2/codecs/cs35l56-bridge/init.conf  | 11 ++++++++
 ucm2/codecs/cs35l56/init.conf         | 36 +++++++++++++++++++++++++++
 ucm2/sof-soundwire/cs35l56.conf       | 32 ++----------------------
 ucm2/sof-soundwire/sof-soundwire.conf |  4 +--
 4 files changed, 51 insertions(+), 32 deletions(-)
 create mode 100644 ucm2/codecs/cs35l56-bridge/init.conf
 create mode 100644 ucm2/codecs/cs35l56/init.conf

diff --git a/ucm2/codecs/cs35l56-bridge/init.conf b/ucm2/codecs/cs35l56-bridge/init.conf
new file mode 100644
index 000000000000..407bb0937559
--- /dev/null
+++ b/ucm2/codecs/cs35l56-bridge/init.conf
@@ -0,0 +1,11 @@
+# cs35l56 specific control settings
+
+FixedBootSequence [
+	cset "name='AMPL Speaker Switch' 0"
+	cset "name='AMPR Speaker Switch' 0"
+]
+
+Macro [
+	{ SetLED { LED="speaker" Action="attach" CtlId="AMPL Speaker Switch" } }
+	{ SetLED { LED="speaker" Action="attach" CtlId="AMPR Speaker Switch" } }
+]
\ No newline at end of file
diff --git a/ucm2/codecs/cs35l56/init.conf b/ucm2/codecs/cs35l56/init.conf
new file mode 100644
index 000000000000..dca14c709fda
--- /dev/null
+++ b/ucm2/codecs/cs35l56/init.conf
@@ -0,0 +1,36 @@
+# cs35l56 specific control settings
+
+#
+# Arguments:
+#   ForAmps - regex filter for var:SpeakerAmps
+#   Amp - amplifier number 1-8
+#
+DefineMacro.cs35l56spkInit.If.0 {
+	Condition {
+		Type RegexMatch
+		Regex "${var:__ForAmps}"
+		String "${var:SpeakerAmps}"
+	}
+	True {
+		LibraryConfig.remap.Config.ctl.default.map {
+			"name='cs35l56 Speaker Playback Switch'" {
+				"name='AMP${var:__Amp} Speaker Switch'".vindex."${eval:($__Amp-1)}" 0
+			}
+		}
+		FixedBootSequence [
+			cset "name='AMP${var:__Amp} Speaker Switch' 0"
+		]
+		Macro [{ SetLED { LED="speaker" Action="attach" CtlId="AMP${var:__Amp} Speaker Switch" } }]
+	}
+}
+
+Macro [
+	{ cs35l56spkInit { ForAmps "[1-8]" Amp 1 } }
+	{ cs35l56spkInit { ForAmps "[2-8]" Amp 2 } }
+	{ cs35l56spkInit { ForAmps "[3-8]" Amp 3 } }
+	{ cs35l56spkInit { ForAmps "[4-8]" Amp 4 } }
+	{ cs35l56spkInit { ForAmps "[5-8]" Amp 5 } }
+	{ cs35l56spkInit { ForAmps "[6-8]" Amp 6 } }
+	{ cs35l56spkInit { ForAmps "[78]" Amp 7 } }
+	{ cs35l56spkInit { ForAmps "8" Amp 8 } }
+]
diff --git a/ucm2/sof-soundwire/cs35l56.conf b/ucm2/sof-soundwire/cs35l56.conf
index f74b99afbb55..53e4d6dd8eda 100644
--- a/ucm2/sof-soundwire/cs35l56.conf
+++ b/ucm2/sof-soundwire/cs35l56.conf
@@ -1,40 +1,12 @@
 # Use case Configuration for sof-soundwire card
 
-#
-# Arguments:
-#   ForAmps - regex filter for var:SpeakerAmps
-#   Amp - amplifier number 1-8
-#
-DefineMacro.cs42l43spk.If.0 {
-	Condition {
-		Type RegexMatch
-		Regex "${var:__ForAmps}"
-		String "${var:SpeakerAmps}"
-	}
-	True {
-		EnableSequence [
-			cset "name='AMP${var:__Amp} Speaker Switch' 1"
-		]
-		DisableSequence [
-			cset "name='AMP${var:__Amp} Speaker Switch' 0"
-		]
-	}
-}
-
 SectionDevice."Speaker" {
 	Comment "Speaker"
 
-	Macro.num1.cs42l43spk { ForAmps "[1-8]" Amp 1 }
-	Macro.num2.cs42l43spk { ForAmps "[2-8]" Amp 2 }
-	Macro.num3.cs42l43spk { ForAmps "[3-8]" Amp 3 }
-	Macro.num4.cs42l43spk { ForAmps "[4-8]" Amp 4 }
-	Macro.num5.cs42l43spk { ForAmps "[5-8]" Amp 5 }
-	Macro.num6.cs42l43spk { ForAmps "[6-8]" Amp 6 }
-	Macro.num7.cs42l43spk { ForAmps "[78]" Amp 7 }
-	Macro.num8.cs42l43spk { ForAmps "8" Amp 8 }
-
 	Value {
 		PlaybackPriority 100
 		PlaybackPCM "hw:${CardId},2"
+		PlaybackMixer "default:${CardId}"
+		PlaybackMixerElem "cs35l56 Speaker"
 	}
 }
diff --git a/ucm2/sof-soundwire/sof-soundwire.conf b/ucm2/sof-soundwire/sof-soundwire.conf
index 1cddfbf4cfbf..8f9bc82c2d3b 100644
--- a/ucm2/sof-soundwire/sof-soundwire.conf
+++ b/ucm2/sof-soundwire/sof-soundwire.conf
@@ -102,10 +102,10 @@ If.multi_headset {
 	}
 }
 
-If.spk_init_rt1318 {
+If.spk_init {
 	Condition {
 		Type RegexMatch
-		Regex "(rt1318(-1)?)"
+		Regex "(rt1318(-1)?|cs35l56(-bridge)?)"
 		String "${var:SpeakerCodec1}"
 	}
 	True.Include.spk_init.File "/codecs/${var:SpeakerCodec1}/init.conf"
-- 
2.43.0




[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux