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 (mailing list archive)
State Superseded
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

Comments

Charles Keepax Dec. 6, 2023, 3:05 p.m. UTC | #1
On Wed, Dec 06, 2023 at 02:05:47PM +0000, Charles Keepax wrote:
> +	False {
> +		If.simplespeaker {

Ooops this name is left over from when I had the if the other way
around, so is a bit confusing. I will leave it a couple days for
any comments then fixup if we are happy.

Thanks,
Charles
Jaroslav Kysela Dec. 6, 2023, 3:16 p.m. UTC | #2
On 06. 12. 23 15:05, Charles Keepax wrote:
> 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>
> ---

...

> -	False.Include.spkdev.File "/sof-soundwire/${var:SpeakerCodec1}-${var:SpeakerAmps1}.conf"

Thanks, but I meant to do a global change like this:

https://github.com/alsa-project/alsa-ucm-conf/pull/370

Could you rebase your change on top?

Also, conditions may use ${var:SpeakerAmps1} for consistency. The driver 
should report the correct configuration. Macros are also helpful to reduce 
repeating configuration blocks.

				Thanks,
					Jaroslav
Charles Keepax Dec. 6, 2023, 3:52 p.m. UTC | #3
On Wed, Dec 06, 2023 at 04:16:06PM +0100, Jaroslav Kysela wrote:
> On 06. 12. 23 15:05, Charles Keepax wrote:
> >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>
> >---
> 
> ...
> 
> >-	False.Include.spkdev.File "/sof-soundwire/${var:SpeakerCodec1}-${var:SpeakerAmps1}.conf"
> 
> Thanks, but I meant to do a global change like this:
> 
> https://github.com/alsa-project/alsa-ucm-conf/pull/370
> 
> Could you rebase your change on top?

Sure no problem thank you.

Thanks,
Charles
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"
+	}
+}