diff mbox series

[alsa-ucm-conf,v2,2/2] sof-soundwire: Add support for cs42l43/cs35l56 bridge configuration

Message ID 20240624153719.1053093-2-ckeepax@opensource.cirrus.com (mailing list archive)
State Superseded
Headers show
Series [alsa-ucm-conf,v2,1/2] sof-soundwire: Add missing match for cs42l43 speakers | expand

Commit Message

Charles Keepax June 24, 2024, 3:37 p.m. UTC
The cs42l43 has both a SPI master and an I2S interface, in some
configurations 2 cs35l56 amplifiers are connected to these to provide
bass speakers whilst the cs42l43's internal speaker drivers are used for
the tweeters. Add UCM configuration for this type of system.

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

Changes since v1:
 - Update control names to just "Speaker Switch/Volume"

Thanks,
Charles

 ucm2/sof-soundwire/cs35l56-bridge.conf | 61 ++++++++++++++++++++++++++
 ucm2/sof-soundwire/sof-soundwire.conf  |  2 +-
 2 files changed, 62 insertions(+), 1 deletion(-)
 create mode 100644 ucm2/sof-soundwire/cs35l56-bridge.conf

Comments

Charles Keepax June 27, 2024, 2:02 p.m. UTC | #1
On Mon, Jun 24, 2024 at 04:37:19PM +0100, Charles Keepax wrote:
> The cs42l43 has both a SPI master and an I2S interface, in some
> configurations 2 cs35l56 amplifiers are connected to these to provide
> bass speakers whilst the cs42l43's internal speaker drivers are used for
> the tweeters. Add UCM configuration for this type of system.
> 
> Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
> ---
> 
> Changes since v1:
>  - Update control names to just "Speaker Switch/Volume"
> 
> Thanks,
> Charles
> 
>  ucm2/sof-soundwire/cs35l56-bridge.conf | 61 ++++++++++++++++++++++++++
>  ucm2/sof-soundwire/sof-soundwire.conf  |  2 +-
>  2 files changed, 62 insertions(+), 1 deletion(-)
>  create mode 100644 ucm2/sof-soundwire/cs35l56-bridge.conf
> 
> diff --git a/ucm2/sof-soundwire/cs35l56-bridge.conf b/ucm2/sof-soundwire/cs35l56-bridge.conf
> new file mode 100644
> index 0000000..dcf5e5c
> --- /dev/null
> +++ b/ucm2/sof-soundwire/cs35l56-bridge.conf
> @@ -0,0 +1,61 @@
> +# Use case Configuration for sof-soundwire card
> +
> +LibraryConfig.remap.Config {
> +	ctl.default.map {
> +		"name='Speaker Switch'" {
> +			"name='AMPL Speaker Switch'".vindex.0 0
> +			"name='AMPR Speaker Switch'".vindex.1 0
> +		}
> +		"name='Speaker Volume'" {
> +			"name='AMPL Speaker Volume'".vindex.0 0
> +			"name='AMPR Speaker Volume'".vindex.1 0
> +		}
> +	}

Turns out there is an issue here. The machine driver already
creates a PIN_SWITCH control called Speaker Switch, so creating
these controls will fail. How would you feel about renaming them
back to something less generic?

Thanks,
Charles
Jaroslav Kysela July 8, 2024, 6:41 p.m. UTC | #2
On 27. 06. 24 16:02, Charles Keepax wrote:
> On Mon, Jun 24, 2024 at 04:37:19PM +0100, Charles Keepax wrote:
>> The cs42l43 has both a SPI master and an I2S interface, in some
>> configurations 2 cs35l56 amplifiers are connected to these to provide
>> bass speakers whilst the cs42l43's internal speaker drivers are used for
>> the tweeters. Add UCM configuration for this type of system.
>>
>> Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
>> ---
>>
>> Changes since v1:
>>   - Update control names to just "Speaker Switch/Volume"
>>
>> Thanks,
>> Charles
>>
>>   ucm2/sof-soundwire/cs35l56-bridge.conf | 61 ++++++++++++++++++++++++++
>>   ucm2/sof-soundwire/sof-soundwire.conf  |  2 +-
>>   2 files changed, 62 insertions(+), 1 deletion(-)
>>   create mode 100644 ucm2/sof-soundwire/cs35l56-bridge.conf
>>
>> diff --git a/ucm2/sof-soundwire/cs35l56-bridge.conf b/ucm2/sof-soundwire/cs35l56-bridge.conf
>> new file mode 100644
>> index 0000000..dcf5e5c
>> --- /dev/null
>> +++ b/ucm2/sof-soundwire/cs35l56-bridge.conf
>> @@ -0,0 +1,61 @@
>> +# Use case Configuration for sof-soundwire card
>> +
>> +LibraryConfig.remap.Config {
>> +	ctl.default.map {
>> +		"name='Speaker Switch'" {
>> +			"name='AMPL Speaker Switch'".vindex.0 0
>> +			"name='AMPR Speaker Switch'".vindex.1 0
>> +		}
>> +		"name='Speaker Volume'" {
>> +			"name='AMPL Speaker Volume'".vindex.0 0
>> +			"name='AMPR Speaker Volume'".vindex.1 0
>> +		}
>> +	}
> 
> Turns out there is an issue here. The machine driver already
> creates a PIN_SWITCH control called Speaker Switch, so creating
> these controls will fail. How would you feel about renaming them
> back to something less generic?

It's not ideal, but acceptable. The non-existent ASoC naming scheme is really 
pain.

				Jaroslav
diff mbox series

Patch

diff --git a/ucm2/sof-soundwire/cs35l56-bridge.conf b/ucm2/sof-soundwire/cs35l56-bridge.conf
new file mode 100644
index 0000000..dcf5e5c
--- /dev/null
+++ b/ucm2/sof-soundwire/cs35l56-bridge.conf
@@ -0,0 +1,61 @@ 
+# Use case Configuration for sof-soundwire card
+
+LibraryConfig.remap.Config {
+	ctl.default.map {
+		"name='Speaker Switch'" {
+			"name='AMPL Speaker Switch'".vindex.0 0
+			"name='AMPR Speaker Switch'".vindex.1 0
+		}
+		"name='Speaker Volume'" {
+			"name='AMPL Speaker Volume'".vindex.0 0
+			"name='AMPR Speaker Volume'".vindex.1 0
+		}
+	}
+}
+
+SectionDevice."Speaker" {
+	Comment "Speaker"
+
+	ConflictingDevice [
+		"Headphones"
+	]
+
+	EnableSequence [
+		cset "name='cs42l43 Speaker L Input 1' 'ASPRX1'"
+		cset "name='cs42l43 Speaker R Input 1' 'ASPRX2'"
+		cset "name='cs42l43 ASPTX1 Input' 'DP5RX1'"
+		cset "name='cs42l43 ASPTX2 Input' 'DP5RX2'"
+
+		cset "name='AMPL ASP1 TX1 Source' 'DSP1TX1'"
+		cset "name='AMPL ASP1 TX2 Source' 'None'"
+		cset "name='AMPL ASP1 TX3 Source' 'None'"
+		cset "name='AMPL ASP1 TX4 Source' 'None'"
+
+		cset "name='AMPR ASP1 TX1 Source' 'None'"
+		cset "name='AMPR ASP1 TX2 Source' 'DSP1TX1'"
+		cset "name='AMPR ASP1 TX3 Source' 'None'"
+		cset "name='AMPR ASP1 TX4 Source' 'None'"
+
+		cset "name='cs42l43 Speaker Digital Switch' 1"
+		cset "name='cs42l43 Speaker Digital Volume' 128"
+	]
+
+	DisableSequence [
+		cset "name='cs42l43 Speaker Digital Switch' 0"
+
+		cset "name='AMPL ASP1 TX2 Source' 'None'"
+		cset "name='AMPR ASP1 TX1 Source' 'None'"
+
+		cset "name='cs42l43 ASPTX1 Input' 'None'"
+		cset "name='cs42l43 ASPTX2 Input' 'None'"
+		cset "name='cs42l43 Speaker L Input 1' 'None'"
+		cset "name='cs42l43 Speaker R Input 1' 'None'"
+	]
+
+	Value {
+		PlaybackPriority 100
+		PlaybackPCM "hw:${CardId},0"
+		PlaybackMixer "default:${CardId}"
+		PlaybackMixerElem "Speaker"
+	}
+}
diff --git a/ucm2/sof-soundwire/sof-soundwire.conf b/ucm2/sof-soundwire/sof-soundwire.conf
index 2f61d11..2ede1cd 100644
--- a/ucm2/sof-soundwire/sof-soundwire.conf
+++ b/ucm2/sof-soundwire/sof-soundwire.conf
@@ -21,7 +21,7 @@  Define {
 
 DefineRegex {
 	SpeakerCodec {
-		Regex " spk:([a-z0-9]+((-sdca)|(-spk))?)"
+		Regex " spk:([a-z0-9]+((-sdca)|(-spk)|(-bridge))?)"
 		String "${CardComponents}"
 	}
 	SpeakerChannels {