Skip to contentSkip to conversation

sof-soundwire: Add basic support for cs42l43

PATCH Superseded Charles Keepax 3 participants 9 messages Dec 5, 2023 – Dec 6, 2023

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 sof-soundwire: Add basic support for cs42l43

cs42l43 is a codec device, add basic support for it. Including a dual channel DMIC input, stereo headphones, and a mono headset microphone.

---
 ucm2/sof-soundwire/cs42l43-dmic.conf | 28 +++++++++++++++++
 ucm2/sof-soundwire/cs42l43.conf      | 47 ++++++++++++++++++++++++++++
 2 files changed, 75 insertions(+)
 create mode 100644 ucm2/sof-soundwire/cs42l43-dmic.conf
 create mode 100644 ucm2/sof-soundwire/cs42l43.conf
ucm2/sof-soundwire/cs42l43-dmic.conf new file +28 -0
new file mode 100644
index 0000000..bf59eca
@@ -0,0 +1,28 @@
+# 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'"
+		cset "name='cs42l43 Decimator 3 Switch' on"
+		cset "name='cs42l43 Decimator 4 Switch' on"
+	]
+
+	DisableSequence [
+		cset "name='cs42l43 Decimator 3 Switch' off"
+		cset "name='cs42l43 Decimator 4 Switch' off"
+		cset "name='cs42l43 DP1TX1 Input' 'None'"
+		cset "name='cs42l43 DP1TX2 Input' 'None'"
+	]
+
+	Value {
+		CapturePriority 100
+		CapturePCM "hw:${CardId},4"
+	}
+}
ucm2/sof-soundwire/cs42l43.conf new file +47 -0

47 lines not on this page · raw message

Signature · 1 line
2.39.2
#1 lore raw

PATCH 2/2 sof-soundwire: Add basic support for a 4x cs35l56 configuration

cs35l56 is a boosted speaker amp add UCM support for a 4 amp configuration.

---
 ucm2/sof-soundwire/cs35l56-4.conf | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 ucm2/sof-soundwire/cs35l56-4.conf
ucm2/sof-soundwire/cs35l56-4.conf new file +24 -0
new file mode 100644
index 0000000..f5af1e4
@@ -0,0 +1,24 @@
+# Use case Configuration for sof-soundwire card
+
+SectionDevice."Speaker" {
+	Comment "Speaker"
+
+	EnableSequence [
+		cset "name='AMP1 Speaker Switch' 1"
+		cset "name='AMP2 Speaker Switch' 1"
+		cset "name='AMP3 Speaker Switch' 1"
+		cset "name='AMP4 Speaker Switch' 1"
+	]
+
+	DisableSequence [
+		cset "name='AMP4 Speaker Switch' 0"
+		cset "name='AMP3 Speaker Switch' 0"
+		cset "name='AMP2 Speaker Switch' 0"
+		cset "name='AMP1 Speaker Switch' 0"
+	]
+
+	Value {
+		PlaybackPriority 100
+		PlaybackPCM "hw:${CardId},2"
+	}
+}
Signature · 1 line
2.39.2
#2 lore raw

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

Quoted 23 lines · Charles Keepax

cs35l56 is a boosted speaker amp add UCM support for a 4 amp configuration.

---
 ucm2/sof-soundwire/cs35l56-4.conf | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 ucm2/sof-soundwire/cs35l56-4.conf
ucm2/sof-soundwire/cs35l56-4.conf new file +8 -0
new file mode 100644
index 0000000..f5af1e4
@@ -0,0 +1,24 @@
+# Use case Configuration for sof-soundwire card
+
+SectionDevice."Speaker" {
+	Comment "Speaker"
+
+	EnableSequence [
+		cset "name='AMP1 Speaker Switch' 1"
+		cset "name='AMP2 Speaker Switch' 1"

ucm2/sof-soundwire/cs35l56-4.conf line 18

Quoted 10 lines
ucm2/sof-soundwire/cs35l56-4.conf new file +10 -0
+		cset "name='AMP3 Speaker Switch' 1"
+		cset "name='AMP4 Speaker Switch' 1"
+	]
+
+	DisableSequence [
+		cset "name='AMP4 Speaker Switch' 0"
+		cset "name='AMP3 Speaker Switch' 0"
+		cset "name='AMP2 Speaker Switch' 0"
+		cset "name='AMP1 Speaker Switch' 0"
+	]

If we only need an on/off switch, I wonder if this can be made conditional, i.e. enable/disable a control if it exists. That would scale to various numbers of amplifiers without a need to add a 2-amp, 6 or 8-amp configuration.

Quoted 6 lines
ucm2/sof-soundwire/cs35l56-4.conf new file +6 -0
+
+	Value {
+		PlaybackPriority 100
+		PlaybackPCM "hw:${CardId},2"
+	}
+}
#3 lore raw

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

Quoted 11 lines · Pierre-Louis Bossart
Quoted 10 lines · Charles Keepax
ucm2/sof-soundwire/cs35l56-4.conf new file +10 -0
+	EnableSequence [
+		cset "name='AMP1 Speaker Switch' 1"
+		cset "name='AMP2 Speaker Switch' 1"
+		cset "name='AMP3 Speaker Switch' 1"
+		cset "name='AMP4 Speaker Switch' 1"
+	]
+
+	DisableSequence [
+		cset "name='AMP4 Speaker Switch' 0"
+		cset "name='AMP3 Speaker Switch' 0"
Quoted 8 lines

ucm2/sof-soundwire/cs35l56-4.conf line 18

Quoted 3 lines
ucm2/sof-soundwire/cs35l56-4.conf new file +3 -0
+		cset "name='AMP2 Speaker Switch' 0"
+		cset "name='AMP1 Speaker Switch' 0"
+	]

If we only need an on/off switch, I wonder if this can be made conditional, i.e. enable/disable a control if it exists. That would scale to various numbers of amplifiers without a need to add a 2-amp, 6 or 8-amp configuration.

I think that is possible, would you lean towards modifying HiFi.conf to only include a single file for cs35l56, or would you lean more towards having each cs35l56-x.conf file include a single base file?

Thanks,
Charles

#4 lore raw

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

Quoted 21 lines · Charles Keepax
Quoted 11 lines · Pierre-Louis Bossart
Quoted 10 lines · Charles Keepax
ucm2/sof-soundwire/cs35l56-4.conf new file +10 -0
+	EnableSequence [
+		cset "name='AMP1 Speaker Switch' 1"
+		cset "name='AMP2 Speaker Switch' 1"
+		cset "name='AMP3 Speaker Switch' 1"
+		cset "name='AMP4 Speaker Switch' 1"
+	]
+
+	DisableSequence [
+		cset "name='AMP4 Speaker Switch' 0"
+		cset "name='AMP3 Speaker Switch' 0"
Quoted 8 lines

ucm2/sof-soundwire/cs35l56-4.conf line 18

Quoted 3 lines
ucm2/sof-soundwire/cs35l56-4.conf new file +3 -0
+		cset "name='AMP2 Speaker Switch' 0"
+		cset "name='AMP1 Speaker Switch' 0"
+	]

If we only need an on/off switch, I wonder if this can be made conditional, i.e. enable/disable a control if it exists. That would scale to various numbers of amplifiers without a need to add a 2-amp, 6 or 8-amp configuration.

Quoted 4 lines

I think that is possible, would you lean towards modifying HiFi.conf to only include a single file for cs35l56, or would you lean more towards having each cs35l56-x.conf file include a single base file?

I wasn't referring to partitioning of files, rather the conditional UCM syntax,

Condition {
Type ControlExists
Control "name='AMP4 Speaker Switch'"
}

e.g.

https://github.com/alsa-project/alsa-ucm-conf/blob/master/ucm2/Intel/sof-hda-dsp/HiFi.conf#L37

I am not sure however if this can be part of an Enable/Disable sequence, that was really a question for Jaroslav.

#5 lore raw

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

Quoted 20 lines · Pierre-Louis Bossart
Quoted 14 lines · Charles Keepax
Quoted 12 lines · Pierre-Louis Bossart

ucm2/sof-soundwire/cs35l56-4.conf line 11

Quoted 6 lines · Charles Keepax
ucm2/sof-soundwire/cs35l56-4.conf new file +6 -0
+	EnableSequence [
+		cset "name='AMP1 Speaker Switch' 1"
+		cset "name='AMP2 Speaker Switch' 1"
+		cset "name='AMP3 Speaker Switch' 1"
+		cset "name='AMP4 Speaker Switch' 1"
+	]

If we only need an on/off switch, I wonder if this can be made conditional, i.e. enable/disable a control if it exists. That would scale to various numbers of amplifiers without a need to add a 2-amp, 6 or 8-amp configuration.

Quoted 4 lines

I think that is possible, would you lean towards modifying HiFi.conf to only include a single file for cs35l56, or would you lean more towards having each cs35l56-x.conf file include a single base file?

Quoted 8 lines

I wasn't referring to partitioning of files, rather the conditional UCM syntax,

Condition {
Type ControlExists
Control "name='AMP4 Speaker Switch'"
}

I get that, but once you have added those you still have the issue HiFi.conf will load the speaker use-case as follows:

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

Meaning the number of amps will be part of the file name requested. So my question was how you wanted to deal with that? Personally I would lean towards just having all the cs35l56-8.conf, cs35l56-6.conf etc. include a cs35l56-base.conf. Its slightly more files, but feels a bit less crufty than having a special case for cs35l56 to not include the number of amps in the filename.

Thanks,
Charles

#6 lore raw

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

Quoted 30 lines · Charles Keepax
Quoted 20 lines · Pierre-Louis Bossart
Quoted 14 lines · Charles Keepax
Quoted 12 lines · Pierre-Louis Bossart

ucm2/sof-soundwire/cs35l56-4.conf line 11

Quoted 6 lines · Charles Keepax
ucm2/sof-soundwire/cs35l56-4.conf new file +6 -0
+	EnableSequence [
+		cset "name='AMP1 Speaker Switch' 1"
+		cset "name='AMP2 Speaker Switch' 1"
+		cset "name='AMP3 Speaker Switch' 1"
+		cset "name='AMP4 Speaker Switch' 1"
+	]

If we only need an on/off switch, I wonder if this can be made conditional, i.e. enable/disable a control if it exists. That would scale to various numbers of amplifiers without a need to add a 2-amp, 6 or 8-amp configuration.

Quoted 4 lines

I think that is possible, would you lean towards modifying HiFi.conf to only include a single file for cs35l56, or would you lean more towards having each cs35l56-x.conf file include a single base file?

Quoted 8 lines

I wasn't referring to partitioning of files, rather the conditional UCM syntax,

Condition {
Type ControlExists
Control "name='AMP4 Speaker Switch'"
}

Quoted 4 lines

I get that, but once you have added those you still have the issue HiFi.conf will load the speaker use-case as follows:

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

This is a good question. From the maintainer POV, I would prefer to use conditionals (join the common code) also for other codecs, so I vote to remove SpeakerAmps1 substitution from the filename for all codecs.

Jaroslav

Signature · 2 lines
Jaroslav Kysela <[email protected]>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
#7 lore raw

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

Quoted 8 lines · Jaroslav Kysela
Quoted 7 lines · Charles Keepax
Quoted 3 lines · Pierre-Louis Bossart
Quoted 2 lines · Charles Keepax
Quoted 1 line · Pierre-Louis Bossart

On 12/5/23 08:24, Charles Keepax wrote:

I get that, but once you have added those you still have the issue HiFi.conf will load the speaker use-case as follows:

Quoted 6 lines
Quoted 1 line

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

This is a good question. From the maintainer POV, I would prefer to use conditionals (join the common code) also for other codecs, so I vote to remove SpeakerAmps1 substitution from the filename for all codecs.

Ok I think for now I will add a conditional to drop the SpeakerAmps1 just for the cs35l56, there are 3 realtek devices that also use this stuff. They look slightly more complex than the Cirrus case, although maybe doable with conditionals. But I will leave those for people with the hardware to look at.

Thanks,
Charles

#8 lore raw

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

In reply to Charles Keepax
Quoted 34 lines
Quoted 20 lines
Quoted 15 lines
Quoted 14 lines

ucm2/sof-soundwire/cs35l56-4.conf line 11

Quoted 9 lines
ucm2/sof-soundwire/cs35l56-4.conf new file +6 -0
+	EnableSequence [
+		cset "name='AMP1 Speaker Switch' 1"
+		cset "name='AMP2 Speaker Switch' 1"
+		cset "name='AMP3 Speaker Switch' 1"
+		cset "name='AMP4 Speaker Switch' 1"
+	]

If we only need an on/off switch, I wonder if this can be made conditional, i.e. enable/disable a control if it exists. That would scale to various numbers of amplifiers without a need to add a 2-amp, 6 or 8-amp configuration.

Quoted 4 lines

I think that is possible, would you lean towards modifying HiFi.conf to only include a single file for cs35l56, or would you lean more towards having each cs35l56-x.conf file include a single base file?

Quoted 8 lines

I wasn't referring to partitioning of files, rather the conditional UCM syntax,

Condition {
Type ControlExists
Control "name='AMP4 Speaker Switch'"
}

I get that, but once you have added those you still have the issue HiFi.conf will load the speaker use-case as follows:

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

Quoted 7 lines

Meaning the number of amps will be part of the file name requested. So my question was how you wanted to deal with that? Personally I would lean towards just having all the cs35l56-8.conf, cs35l56-6.conf etc. include a cs35l56-base.conf. Its slightly more files, but feels a bit less crufty than having a special case for cs35l56 to not include the number of amps in the filename.

Ah yes, I forgot that part...

I must admit I don't recall either what we were trying to achieve in UCM with the number of amplifiers and speakers both added to the components
string: "cfg-spk:%d cfg-amp:%d"

Probably best to go with your solution and see what can be optimized later...