All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH alsa-ucm-conf 0/8] codecs/rt5640: Cleanup + HW volume control support
@ 2021-02-26 15:40 Hans de Goede
  2021-02-26 15:40 ` [PATCH alsa-ucm-conf 1/8] codecs/rt5640: Cleanup: unify Stereo / Mono ADC handling Hans de Goede
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Hans de Goede @ 2021-02-26 15:40 UTC (permalink / raw)
  To: Jaroslav Kysela
  Cc: Hans de Goede, alsa-devel, Pierre-Louis Bossart, Bard Liao

Hi All,

Here is a patch series consisting of some codecs/rt5640 cleanups and
addition of HW volume control support to the rt5640 .conf snippets.

Note patch 7 and 8 depend on a new "aif:%d" part being added to the
components string, the kernel patches for this are pending upstream
in the "[PATCH 0/5] AsoC: rt5640/rt5651: Volume control fixes" patch
series.

Patches 7 and 8 should probably not be merged until the kernel patches
have landed, because theoretically the new component string part could
change as part of the review of the kernel patches.

Regards,

Hans


Hans de Goede (8):
  codecs/rt5640: Cleanup: unify Stereo / Mono ADC handling
  codecs/rt5640: Cleanup: Initially disable all inputs and outputs
  codecs/rt5640: Cleanup: Move 'SPK MIX' setup to main EnableSequene
  codecs/rt5640: Drop bogus 'DIG MIXL DAC L2 Switch' setting
  codecs/rt5640: Unify capture volume for AIF1 and AIF2 recording paths
  codecs/rt5640: Add hardware volume-control support
  codecs/rt5640: Use the new "aif:%d" part of the components string
  codecs/rt5640: Specify Playback/CaptureMasterElem for HW
    volume-control

 ucm2/bytcr-rt5640/HiFi.conf                   | 46 +++++++++++++++++
 ucm2/codecs/rt5640/DigitalMics.conf           | 18 ++++++-
 ucm2/codecs/rt5640/EnableSeq-AIF-unknown.conf |  7 +++
 ucm2/codecs/rt5640/EnableSeq-AIF1.conf        |  7 +++
 ucm2/codecs/rt5640/EnableSeq-AIF2.conf        |  7 +++
 ucm2/codecs/rt5640/EnableSeq.conf             | 50 ++++++++++++++-----
 ucm2/codecs/rt5640/HeadPhones.conf            | 15 +++++-
 ucm2/codecs/rt5640/HeadsetMic.conf            | 24 ++++++---
 ucm2/codecs/rt5640/IN1-InternalMic.conf       | 27 ++++++----
 ucm2/codecs/rt5640/IN3-InternalMic.conf       | 27 ++++++----
 ucm2/codecs/rt5640/MonoSpeaker.conf           | 17 +++++--
 ucm2/codecs/rt5640/Speaker.conf               | 17 +++++--
 12 files changed, 211 insertions(+), 51 deletions(-)
 create mode 100644 ucm2/codecs/rt5640/EnableSeq-AIF-unknown.conf
 create mode 100644 ucm2/codecs/rt5640/EnableSeq-AIF1.conf
 create mode 100644 ucm2/codecs/rt5640/EnableSeq-AIF2.conf

-- 
2.30.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH alsa-ucm-conf 1/8] codecs/rt5640: Cleanup: unify Stereo / Mono ADC handling
  2021-02-26 15:40 [PATCH alsa-ucm-conf 0/8] codecs/rt5640: Cleanup + HW volume control support Hans de Goede
@ 2021-02-26 15:40 ` Hans de Goede
  2021-02-26 15:40 ` [PATCH alsa-ucm-conf 2/8] codecs/rt5640: Cleanup: Initially disable all inputs and outputs Hans de Goede
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Hans de Goede @ 2021-02-26 15:40 UTC (permalink / raw)
  To: Jaroslav Kysela
  Cc: Hans de Goede, alsa-devel, Pierre-Louis Bossart, Bard Liao

Cleanup: no functional changes intended.

The rt5640 codec is sometimes used with AIF1 connected to the SoC
and sometimes with AIF2 connected to the SoC.

The rt5640 UCM configuration deals with this by accepting input from
and sending output to both AIFs, relying on the kernels DAPM framework to
disable parts of the graph which are connected to the unconnected AIF.

On the output side we solve this by enabling both the IF1_DAC and
IF2_DAC data inputs to the digital 'Stereo DAC MIX' mixer.

On the input side handling this is somewhat more complicated, the
"Digital Mixer Path" leading to the IF1_ADC and IF2_ADC outputs
are entirely separate paths. To solve this we enable the active
input (DMIC or ADC) in both the Stereo ADC (connected to IF1_ADC)
and the Mono ADC (IF2_ADC) paths.

So far we've not been entirely consistent in our handling of
the Stereo ADC vs Mono ADC paths, this commit cleans this up:

1. Set the 'Mono ADC Capture Switch' to on once from EnableSeq.conf,
   like we do for the 'ADC Capture Switch' instead of toggling it on/off
   from the individual input Enable/Disable sequences.

2. Group all the 'Mono ADC ...' mixer cset calls together with their
   stereo ADC counterparts.

3. Explicitly select DMIC L/R 1 for the Mono ADC L/R 2 Mux input, instead
   of relying on this being the default.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 ucm2/codecs/rt5640/DigitalMics.conf     |  2 --
 ucm2/codecs/rt5640/EnableSeq.conf       | 10 +++++++---
 ucm2/codecs/rt5640/HeadsetMic.conf      | 10 ++--------
 ucm2/codecs/rt5640/IN1-InternalMic.conf | 11 ++---------
 ucm2/codecs/rt5640/IN3-InternalMic.conf | 11 ++---------
 5 files changed, 13 insertions(+), 31 deletions(-)

diff --git a/ucm2/codecs/rt5640/DigitalMics.conf b/ucm2/codecs/rt5640/DigitalMics.conf
index fdd412f..157c544 100644
--- a/ucm2/codecs/rt5640/DigitalMics.conf
+++ b/ucm2/codecs/rt5640/DigitalMics.conf
@@ -8,7 +8,6 @@ SectionDevice."Mic" {
 	EnableSequence [
 		cset "name='Mono ADC MIXL ADC2 Switch' on"
 		cset "name='Mono ADC MIXR ADC2 Switch' on"
-		cset "name='Mono ADC Capture Switch' on"
 		cset "name='Stereo ADC MIXL ADC2 Switch' on"
 		cset "name='Stereo ADC MIXR ADC2 Switch' on"
 		cset "name='Internal Mic Switch' on"
@@ -18,7 +17,6 @@ SectionDevice."Mic" {
 	DisableSequence [
 		cset "name='Mono ADC MIXL ADC2 Switch' off"
 		cset "name='Mono ADC MIXR ADC2 Switch' off"
-		cset "name='Mono ADC Capture Switch' off"
 		cset "name='Stereo ADC MIXL ADC2 Switch' off"
 		cset "name='Stereo ADC MIXR ADC2 Switch' off"
 		cset "name='Internal Mic Switch' off"
diff --git a/ucm2/codecs/rt5640/EnableSeq.conf b/ucm2/codecs/rt5640/EnableSeq.conf
index 145a23b..4754df7 100644
--- a/ucm2/codecs/rt5640/EnableSeq.conf
+++ b/ucm2/codecs/rt5640/EnableSeq.conf
@@ -30,8 +30,13 @@ EnableSequence [
 	# Input Configuration
 	cset "name='Stereo ADC1 Mux' ADC"
 	cset "name='Stereo ADC2 Mux' DMIC1"
-	cset "name='Mono ADC L1 Mux' 1"
-	cset "name='Mono ADC R1 Mux' 1"
+	cset "name='ADC Capture Switch' on"
+
+	cset "name='Mono ADC L1 Mux' ADCL"
+	cset "name='Mono ADC R1 Mux' ADCR"
+	cset "name='Mono ADC L2 Mux' DMIC L1"
+	cset "name='Mono ADC R2 Mux' DMIC R1"
+	cset "name='Mono ADC Capture Switch' on"
 
 	# 47=0dB, 0.375 dB/step, set it to 6 dB to help with soft mics
 	cset "name='ADC Capture Volume' 63"
@@ -45,5 +50,4 @@ EnableSequence [
 
 	cset "name='Internal Mic Switch' off"
 	cset "name='Headset Mic Switch' off"
-	cset "name='ADC Capture Switch' on"
 ]
diff --git a/ucm2/codecs/rt5640/HeadsetMic.conf b/ucm2/codecs/rt5640/HeadsetMic.conf
index f88b611..829e4e6 100644
--- a/ucm2/codecs/rt5640/HeadsetMic.conf
+++ b/ucm2/codecs/rt5640/HeadsetMic.conf
@@ -21,26 +21,20 @@ SectionDevice."Headset" {
 
 		cset "name='Stereo ADC MIXL ADC1 Switch' on"
 		cset "name='Stereo ADC MIXR ADC1 Switch' on"
-
 		cset "name='Mono ADC MIXL ADC1 Switch' on"
 		cset "name='Mono ADC MIXR ADC1 Switch' on"
-
-		cset "name='Mono ADC Capture Switch' on"
 	]
 
 	DisableSequence [
 		cset "name='Stereo ADC MIXL ADC1 Switch' off"
 		cset "name='Stereo ADC MIXR ADC1 Switch' off"
+		cset "name='Mono ADC MIXL ADC1 Switch' off"
+		cset "name='Mono ADC MIXR ADC1 Switch' off"
 
 		cset "name='RECMIXL BST2 Switch' off"
 		cset "name='RECMIXR BST2 Switch' off"
 
 		cset "name='Headset Mic Switch' off"
-
-		cset "name='Mono ADC MIXL ADC1 Switch' off"
-		cset "name='Mono ADC MIXR ADC1 Switch' off"
-
-		cset "name='Mono ADC Capture Switch' off"
 	]
 
 	Value {
diff --git a/ucm2/codecs/rt5640/IN1-InternalMic.conf b/ucm2/codecs/rt5640/IN1-InternalMic.conf
index ebb5b6d..260df90 100644
--- a/ucm2/codecs/rt5640/IN1-InternalMic.conf
+++ b/ucm2/codecs/rt5640/IN1-InternalMic.conf
@@ -15,27 +15,20 @@ SectionDevice."Mic" {
 
 		cset "name='Stereo ADC MIXL ADC1 Switch' on"
 		cset "name='Stereo ADC MIXR ADC1 Switch' on"
-
 		cset "name='Mono ADC MIXL ADC1 Switch' on"
 		cset "name='Mono ADC MIXR ADC1 Switch' on"
-
-		cset "name='Mono ADC Capture Switch' on"
 	]
 
 	DisableSequence [
 		cset "name='Stereo ADC MIXL ADC1 Switch' off"
 		cset "name='Stereo ADC MIXR ADC1 Switch' off"
+		cset "name='Mono ADC MIXL ADC1 Switch' off"
+		cset "name='Mono ADC MIXR ADC1 Switch' off"
 
 		cset "name='RECMIXL BST1 Switch' off"
 		cset "name='RECMIXR BST1 Switch' off"
 
 		cset "name='Internal Mic Switch' off"
-
-		cset "name='Mono ADC MIXL ADC1 Switch' off"
-		cset "name='Mono ADC MIXR ADC1 Switch' off"
-
-		cset "name='Mono ADC Capture Switch' off"
-
 	]
 
 	Value {
diff --git a/ucm2/codecs/rt5640/IN3-InternalMic.conf b/ucm2/codecs/rt5640/IN3-InternalMic.conf
index 172d909..ebd2b9c 100644
--- a/ucm2/codecs/rt5640/IN3-InternalMic.conf
+++ b/ucm2/codecs/rt5640/IN3-InternalMic.conf
@@ -15,27 +15,20 @@ SectionDevice."Mic" {
 
 		cset "name='Stereo ADC MIXL ADC1 Switch' on"
 		cset "name='Stereo ADC MIXR ADC1 Switch' on"
-
 		cset "name='Mono ADC MIXL ADC1 Switch' on"
 		cset "name='Mono ADC MIXR ADC1 Switch' on"
-
-		cset "name='Mono ADC Capture Switch' on"
-
 	]
 
 	DisableSequence [
 		cset "name='Stereo ADC MIXL ADC1 Switch' off"
 		cset "name='Stereo ADC MIXR ADC1 Switch' off"
+		cset "name='Mono ADC MIXL ADC1 Switch' off"
+		cset "name='Mono ADC MIXR ADC1 Switch' off"
 
 		cset "name='RECMIXL BST3 Switch' off"
 		cset "name='RECMIXR BST3 Switch' off"
 
 		cset "name='Internal Mic Switch' off"
-
-		cset "name='Mono ADC MIXL ADC1 Switch' off"
-		cset "name='Mono ADC MIXR ADC1 Switch' off"
-
-		cset "name='Mono ADC Capture Switch' off"
 	]
 
 	Value {
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH alsa-ucm-conf 2/8] codecs/rt5640: Cleanup: Initially disable all inputs and outputs
  2021-02-26 15:40 [PATCH alsa-ucm-conf 0/8] codecs/rt5640: Cleanup + HW volume control support Hans de Goede
  2021-02-26 15:40 ` [PATCH alsa-ucm-conf 1/8] codecs/rt5640: Cleanup: unify Stereo / Mono ADC handling Hans de Goede
@ 2021-02-26 15:40 ` Hans de Goede
  2021-02-26 15:40 ` [PATCH alsa-ucm-conf 3/8] codecs/rt5640: Cleanup: Move 'SPK MIX' setup to main EnableSequene Hans de Goede
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Hans de Goede @ 2021-02-26 15:40 UTC (permalink / raw)
  To: Jaroslav Kysela
  Cc: Hans de Goede, alsa-devel, Pierre-Louis Bossart, Bard Liao

Cleanup: no functional changes intended.

Disable all inputs and outputs from the main EnableSequence.

This allows removing some weirdness from the individual input/output
EnableSequences where they were turning controls for other inputs/outputs
then themselves off.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 ucm2/codecs/rt5640/EnableSeq.conf       | 21 +++++++++++++++++++++
 ucm2/codecs/rt5640/HeadPhones.conf      |  1 -
 ucm2/codecs/rt5640/IN1-InternalMic.conf |  2 --
 ucm2/codecs/rt5640/IN3-InternalMic.conf |  2 --
 ucm2/codecs/rt5640/MonoSpeaker.conf     |  1 -
 ucm2/codecs/rt5640/Speaker.conf         |  1 -
 6 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/ucm2/codecs/rt5640/EnableSeq.conf b/ucm2/codecs/rt5640/EnableSeq.conf
index 4754df7..5dc7092 100644
--- a/ucm2/codecs/rt5640/EnableSeq.conf
+++ b/ucm2/codecs/rt5640/EnableSeq.conf
@@ -48,6 +48,27 @@ EnableSequence [
 	cset "name='IN2 Boost' 1"
 	cset "name='IN3 Boost' 8"
 
+	# Start with all controls which are used by the individual
+	# input/output Enable/DisableSequences off
+
+	cset "name='RECMIXL BST1 Switch' off"
+	cset "name='RECMIXR BST1 Switch' off"
+	cset "name='RECMIXL BST2 Switch' off"
+	cset "name='RECMIXR BST2 Switch' off"
+	cset "name='RECMIXL BST3 Switch' off"
+	cset "name='RECMIXR BST3 Switch' off"
+
+	cset "name='Stereo ADC MIXL ADC1 Switch' off"
+	cset "name='Stereo ADC MIXR ADC1 Switch' off"
+	cset "name='Stereo ADC MIXL ADC2 Switch' off"
+	cset "name='Stereo ADC MIXR ADC2 Switch' off"
+	cset "name='Mono ADC MIXL ADC1 Switch' off"
+	cset "name='Mono ADC MIXR ADC1 Switch' off"
+	cset "name='Mono ADC MIXL ADC2 Switch' off"
+	cset "name='Mono ADC MIXR ADC2 Switch' off"
+
+	cset "name='Speaker Switch' off"
+	cset "name='Headphone Switch' off"
 	cset "name='Internal Mic Switch' off"
 	cset "name='Headset Mic Switch' off"
 ]
diff --git a/ucm2/codecs/rt5640/HeadPhones.conf b/ucm2/codecs/rt5640/HeadPhones.conf
index a9e4d20..1f4316d 100644
--- a/ucm2/codecs/rt5640/HeadPhones.conf
+++ b/ucm2/codecs/rt5640/HeadPhones.conf
@@ -17,7 +17,6 @@ SectionDevice."Headphones" {
  		cset "name='HPO MIX HPVOL Switch'  on"
  		cset "name='Headphone Switch'  on"
 		cset "name='HP Channel Switch' on"
- 		cset "name='Speaker Switch' off"
 		cset "name='HP L Playback Switch' on"
 		cset "name='HP R Playback Switch' on"
 		cset "name='HP Playback Volume' 29"
diff --git a/ucm2/codecs/rt5640/IN1-InternalMic.conf b/ucm2/codecs/rt5640/IN1-InternalMic.conf
index 260df90..d7c419e 100644
--- a/ucm2/codecs/rt5640/IN1-InternalMic.conf
+++ b/ucm2/codecs/rt5640/IN1-InternalMic.conf
@@ -10,8 +10,6 @@ SectionDevice."Mic" {
 
 		cset "name='RECMIXL BST1 Switch' on"
 		cset "name='RECMIXR BST1 Switch' on"
-		cset "name='RECMIXL BST3 Switch' off"
-		cset "name='RECMIXR BST3 Switch' off"
 
 		cset "name='Stereo ADC MIXL ADC1 Switch' on"
 		cset "name='Stereo ADC MIXR ADC1 Switch' on"
diff --git a/ucm2/codecs/rt5640/IN3-InternalMic.conf b/ucm2/codecs/rt5640/IN3-InternalMic.conf
index ebd2b9c..3e330e6 100644
--- a/ucm2/codecs/rt5640/IN3-InternalMic.conf
+++ b/ucm2/codecs/rt5640/IN3-InternalMic.conf
@@ -8,8 +8,6 @@ SectionDevice."Mic" {
 	EnableSequence [
 		cset "name='Internal Mic Switch' on"
 
-		cset "name='RECMIXL BST1 Switch' off"
-		cset "name='RECMIXR BST1 Switch' off"
 		cset "name='RECMIXL BST3 Switch' on"
 		cset "name='RECMIXR BST3 Switch' on"
 
diff --git a/ucm2/codecs/rt5640/MonoSpeaker.conf b/ucm2/codecs/rt5640/MonoSpeaker.conf
index 23cf34c..5035c8d 100644
--- a/ucm2/codecs/rt5640/MonoSpeaker.conf
+++ b/ucm2/codecs/rt5640/MonoSpeaker.conf
@@ -14,7 +14,6 @@ SectionDevice."Speaker" {
 		cset "name='SPOL MIX SPKVOL R Switch' on"
 		cset "name='Speaker Switch' on"
 		cset "name='Speaker Channel Switch' on"
-		cset "name='Headphone Switch' off"
 		cset "name='Speaker L Playback Switch' on"
 		cset "name='Speaker R Playback Switch' on"
 		cset "name='Speaker Playback Volume' 35"
diff --git a/ucm2/codecs/rt5640/Speaker.conf b/ucm2/codecs/rt5640/Speaker.conf
index 422cfdf..fd74994 100644
--- a/ucm2/codecs/rt5640/Speaker.conf
+++ b/ucm2/codecs/rt5640/Speaker.conf
@@ -14,7 +14,6 @@ SectionDevice."Speaker" {
 		cset "name='SPOL MIX SPKVOL R Switch' off"
 		cset "name='Speaker Switch' on"
 		cset "name='Speaker Channel Switch' on"
-		cset "name='Headphone Switch' off"
 		cset "name='Speaker L Playback Switch' on"
 		cset "name='Speaker R Playback Switch' on"
 		cset "name='Speaker Playback Volume' 35"
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH alsa-ucm-conf 3/8] codecs/rt5640: Cleanup: Move 'SPK MIX' setup to main EnableSequene
  2021-02-26 15:40 [PATCH alsa-ucm-conf 0/8] codecs/rt5640: Cleanup + HW volume control support Hans de Goede
  2021-02-26 15:40 ` [PATCH alsa-ucm-conf 1/8] codecs/rt5640: Cleanup: unify Stereo / Mono ADC handling Hans de Goede
  2021-02-26 15:40 ` [PATCH alsa-ucm-conf 2/8] codecs/rt5640: Cleanup: Initially disable all inputs and outputs Hans de Goede
@ 2021-02-26 15:40 ` Hans de Goede
  2021-02-26 15:40 ` [PATCH alsa-ucm-conf 4/8] codecs/rt5640: Drop bogus 'DIG MIXL DAC L2 Switch' setting Hans de Goede
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Hans de Goede @ 2021-02-26 15:40 UTC (permalink / raw)
  To: Jaroslav Kysela
  Cc: Hans de Goede, alsa-devel, Pierre-Louis Bossart, Bard Liao

Cleanup: no functional changes intended.

Do the 'SPK MIXL' / 'SPK MIXR' setup only once from the main
EnableSequene, like we do for the 'OUT MIXL' / 'OUT MIXR' setup
used by the headphones already.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 ucm2/codecs/rt5640/EnableSeq.conf   | 6 ++++--
 ucm2/codecs/rt5640/MonoSpeaker.conf | 2 --
 ucm2/codecs/rt5640/Speaker.conf     | 2 --
 3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/ucm2/codecs/rt5640/EnableSeq.conf b/ucm2/codecs/rt5640/EnableSeq.conf
index 5dc7092..4a355a5 100644
--- a/ucm2/codecs/rt5640/EnableSeq.conf
+++ b/ucm2/codecs/rt5640/EnableSeq.conf
@@ -6,8 +6,10 @@ EnableSequence [
 	cset "name='Stereo DAC MIXR DAC R1 Switch' on"
 	cset "name='Stereo DAC MIXL DAC L2 Switch' on"
 	cset "name='Stereo DAC MIXR DAC R2 Switch' on"
-	cset "name='OUT MIXL DAC L1 Switch'  on"
-	cset "name='OUT MIXR DAC R1 Switch'  on"
+	cset "name='OUT MIXL DAC L1 Switch' on"
+	cset "name='OUT MIXR DAC R1 Switch' on"
+	cset "name='SPK MIXL DAC L1 Switch' on"
+	cset "name='SPK MIXR DAC R1 Switch' on"
 
 	# uncomment for loopback mic->speakers
 	# cset "name='SPOL MIX BST1 Switch' on"
diff --git a/ucm2/codecs/rt5640/MonoSpeaker.conf b/ucm2/codecs/rt5640/MonoSpeaker.conf
index 5035c8d..654edc3 100644
--- a/ucm2/codecs/rt5640/MonoSpeaker.conf
+++ b/ucm2/codecs/rt5640/MonoSpeaker.conf
@@ -6,8 +6,6 @@ SectionDevice."Speaker" {
 	]
 
 	EnableSequence [
-		cset "name='SPK MIXL DAC L1 Switch' on"
-		cset "name='SPK MIXR DAC R1 Switch' on"
 		cset "name='SPOL MIX SPKVOL L Switch' on"
 # for mono speaker we apply left on right
 #		cset "name='SPOR MIX SPKVOL R Switch' on"
diff --git a/ucm2/codecs/rt5640/Speaker.conf b/ucm2/codecs/rt5640/Speaker.conf
index fd74994..3264cc3 100644
--- a/ucm2/codecs/rt5640/Speaker.conf
+++ b/ucm2/codecs/rt5640/Speaker.conf
@@ -6,8 +6,6 @@ SectionDevice."Speaker" {
 	]
 
 	EnableSequence [
-		cset "name='SPK MIXL DAC L1 Switch' on"
-		cset "name='SPK MIXR DAC R1 Switch' on"
 		cset "name='SPOL MIX SPKVOL L Switch' on"
 		cset "name='SPOR MIX SPKVOL R Switch' on"
 		# undo MonoSpeaker mixing of right channel to left speaker
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH alsa-ucm-conf 4/8] codecs/rt5640: Drop bogus 'DIG MIXL DAC L2 Switch' setting
  2021-02-26 15:40 [PATCH alsa-ucm-conf 0/8] codecs/rt5640: Cleanup + HW volume control support Hans de Goede
                   ` (2 preceding siblings ...)
  2021-02-26 15:40 ` [PATCH alsa-ucm-conf 3/8] codecs/rt5640: Cleanup: Move 'SPK MIX' setup to main EnableSequene Hans de Goede
@ 2021-02-26 15:40 ` Hans de Goede
  2021-02-26 15:40 ` [PATCH alsa-ucm-conf 5/8] codecs/rt5640: Unify capture volume for AIF1 and AIF2 recording paths Hans de Goede
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Hans de Goede @ 2021-02-26 15:40 UTC (permalink / raw)
  To: Jaroslav Kysela
  Cc: Hans de Goede, alsa-devel, Pierre-Louis Bossart, Bard Liao

The 'DIG MIXL DAC L2 Switch' path is only used for Digital Mixer Path
loopback, which we don't use. Drop it.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 ucm2/codecs/rt5640/EnableSeq.conf | 1 -
 1 file changed, 1 deletion(-)

diff --git a/ucm2/codecs/rt5640/EnableSeq.conf b/ucm2/codecs/rt5640/EnableSeq.conf
index 4a355a5..223cceb 100644
--- a/ucm2/codecs/rt5640/EnableSeq.conf
+++ b/ucm2/codecs/rt5640/EnableSeq.conf
@@ -27,7 +27,6 @@ EnableSequence [
 	#cset "name='DAI select' 1"
 
 	cset "name='DAC2 Playback Switch' on"
-	cset "name='DIG MIXL DAC L2 Switch' on"
 
 	# Input Configuration
 	cset "name='Stereo ADC1 Mux' ADC"
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH alsa-ucm-conf 5/8] codecs/rt5640: Unify capture volume for AIF1 and AIF2 recording paths
  2021-02-26 15:40 [PATCH alsa-ucm-conf 0/8] codecs/rt5640: Cleanup + HW volume control support Hans de Goede
                   ` (3 preceding siblings ...)
  2021-02-26 15:40 ` [PATCH alsa-ucm-conf 4/8] codecs/rt5640: Drop bogus 'DIG MIXL DAC L2 Switch' setting Hans de Goede
@ 2021-02-26 15:40 ` Hans de Goede
  2021-02-26 15:40 ` [PATCH alsa-ucm-conf 6/8] codecs/rt5640: Add hardware volume-control support Hans de Goede
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Hans de Goede @ 2021-02-26 15:40 UTC (permalink / raw)
  To: Jaroslav Kysela
  Cc: Hans de Goede, alsa-devel, Pierre-Louis Bossart, Bard Liao

The rt5640 codec is sometimes used with AIF1 connected to the
SoC and sometimes with AIF2 connected to the SoC.

The rt5640 UCM configuration deals with this by accepting input from
and sending output to both AIFs, relying on the kernels DAPM framework to
disable parts of the graph which are connected to the unconnected AIF.

Before this commit codecs/rt5640/EnableSeq.conf was adding a +9dB
(digital) boost to recording going through the 'ADC' path to AIF1,
while not touching the 'Mono ADC' path to AIF2.

This was causing recordings on devices using AIF2 to be somewhat soft.

This commit unifies the record volume control settings for both paths by
only using the '[Mono ]ADC Capture Volume' control, which is present
in both paths and setting it to +9dB on both paths.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 ucm2/codecs/rt5640/EnableSeq.conf | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/ucm2/codecs/rt5640/EnableSeq.conf b/ucm2/codecs/rt5640/EnableSeq.conf
index 223cceb..8b30153 100644
--- a/ucm2/codecs/rt5640/EnableSeq.conf
+++ b/ucm2/codecs/rt5640/EnableSeq.conf
@@ -39,10 +39,14 @@ EnableSequence [
 	cset "name='Mono ADC R2 Mux' DMIC R1"
 	cset "name='Mono ADC Capture Switch' on"
 
-	# 47=0dB, 0.375 dB/step, set it to 6 dB to help with soft mics
-	cset "name='ADC Capture Volume' 63"
-	# Set ADC Boost Gain to 3dB higher vals result in too much noise
-	cset "name='ADC Boost Gain' 1"
+	# 47=0dB, 0.375 dB/step, set it to 9 dB to help with soft mics
+	cset "name='ADC Capture Volume' 71"
+	cset "name='Mono ADC Capture Volume' 71"
+
+	# The second 'Mono ADC' path does not have a 'Boost Gain',
+        # set this to 0dB so that the volume of the AIF1 and AIF2 paths is equal.
+	cset "name='ADC Boost Gain' 0"
+
 	# Set IN1/IN3 internal mic boost to 8 (max)
 	# Set IN2 headset-mic boost to 1, headset mics are quite loud
 	cset "name='IN1 Boost' 8"
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH alsa-ucm-conf 6/8] codecs/rt5640: Add hardware volume-control support
  2021-02-26 15:40 [PATCH alsa-ucm-conf 0/8] codecs/rt5640: Cleanup + HW volume control support Hans de Goede
                   ` (4 preceding siblings ...)
  2021-02-26 15:40 ` [PATCH alsa-ucm-conf 5/8] codecs/rt5640: Unify capture volume for AIF1 and AIF2 recording paths Hans de Goede
@ 2021-02-26 15:40 ` Hans de Goede
  2021-02-26 15:40 ` [PATCH alsa-ucm-conf 7/8] codecs/rt5640: Use the new "aif:%d" part of the components string Hans de Goede
  2021-02-26 15:40 ` [PATCH alsa-ucm-conf 8/8] codecs/rt5640: Specify Playback/CaptureMasterElem for HW volume-control Hans de Goede
  7 siblings, 0 replies; 9+ messages in thread
From: Hans de Goede @ 2021-02-26 15:40 UTC (permalink / raw)
  To: Jaroslav Kysela
  Cc: Hans de Goede, alsa-devel, Pierre-Louis Bossart, Bard Liao

Add hardware volume-control support for the rt5640 codec.

Note this commit does not add support for the (digital) master
ADC/DAC Volume / Mute controls. There are 2 of each, and which
one should be used depends on which AIF is being used.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 ucm2/codecs/rt5640/HeadPhones.conf      | 2 ++
 ucm2/codecs/rt5640/HeadsetMic.conf      | 2 ++
 ucm2/codecs/rt5640/IN1-InternalMic.conf | 2 ++
 ucm2/codecs/rt5640/IN3-InternalMic.conf | 2 ++
 ucm2/codecs/rt5640/MonoSpeaker.conf     | 2 ++
 ucm2/codecs/rt5640/Speaker.conf         | 2 ++
 6 files changed, 12 insertions(+)

diff --git a/ucm2/codecs/rt5640/HeadPhones.conf b/ucm2/codecs/rt5640/HeadPhones.conf
index 1f4316d..5535111 100644
--- a/ucm2/codecs/rt5640/HeadPhones.conf
+++ b/ucm2/codecs/rt5640/HeadPhones.conf
@@ -35,5 +35,7 @@ SectionDevice."Headphones" {
 		PlaybackPriority 300
 		PlaybackPCM "hw:${CardId}"
 		JackControl "Headphone Jack"
+		PlaybackMixerElem "HP"
+		PlaybackVolume "HP Playback Volume"
 	}
 }
diff --git a/ucm2/codecs/rt5640/HeadsetMic.conf b/ucm2/codecs/rt5640/HeadsetMic.conf
index 829e4e6..8479672 100644
--- a/ucm2/codecs/rt5640/HeadsetMic.conf
+++ b/ucm2/codecs/rt5640/HeadsetMic.conf
@@ -41,5 +41,7 @@ SectionDevice."Headset" {
 		CapturePriority 200
 		CapturePCM "hw:${CardId}"
 		JackControl "Headset Mic Jack"
+		CaptureMixerElem "IN2 Boost"
+		CaptureVolume "IN2 Boost"
 	}
 }
diff --git a/ucm2/codecs/rt5640/IN1-InternalMic.conf b/ucm2/codecs/rt5640/IN1-InternalMic.conf
index d7c419e..a317388 100644
--- a/ucm2/codecs/rt5640/IN1-InternalMic.conf
+++ b/ucm2/codecs/rt5640/IN1-InternalMic.conf
@@ -32,5 +32,7 @@ SectionDevice."Mic" {
 	Value {
 		CapturePriority 100
 		CapturePCM "hw:${CardId}"
+		CaptureMixerElem "IN1 Boost"
+		CaptureVolume "IN1 Boost"
 	}
 }
diff --git a/ucm2/codecs/rt5640/IN3-InternalMic.conf b/ucm2/codecs/rt5640/IN3-InternalMic.conf
index 3e330e6..ef4eaba 100644
--- a/ucm2/codecs/rt5640/IN3-InternalMic.conf
+++ b/ucm2/codecs/rt5640/IN3-InternalMic.conf
@@ -32,5 +32,7 @@ SectionDevice."Mic" {
 	Value {
 		CapturePriority 100
 		CapturePCM "hw:${CardId}"
+		CaptureMixerElem "IN3 Boost"
+		CaptureVolume "IN3 Boost"
 	}
 }
diff --git a/ucm2/codecs/rt5640/MonoSpeaker.conf b/ucm2/codecs/rt5640/MonoSpeaker.conf
index 654edc3..3cbeafd 100644
--- a/ucm2/codecs/rt5640/MonoSpeaker.conf
+++ b/ucm2/codecs/rt5640/MonoSpeaker.conf
@@ -29,5 +29,7 @@ SectionDevice."Speaker" {
 	Value {
 		PlaybackPriority 100
 		PlaybackPCM "hw:${CardId}"
+		PlaybackMixerElem "Speaker"
+		PlaybackVolume "Speaker Playback Volume"
 	}
 }
diff --git a/ucm2/codecs/rt5640/Speaker.conf b/ucm2/codecs/rt5640/Speaker.conf
index 3264cc3..0924f9c 100644
--- a/ucm2/codecs/rt5640/Speaker.conf
+++ b/ucm2/codecs/rt5640/Speaker.conf
@@ -29,5 +29,7 @@ SectionDevice."Speaker" {
 	Value {
 		PlaybackPriority 100
 		PlaybackPCM "hw:${CardId}"
+		PlaybackMixerElem "Speaker"
+		PlaybackVolume "Speaker Playback Volume"
 	}
 }
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH alsa-ucm-conf 7/8] codecs/rt5640: Use the new "aif:%d" part of the components string
  2021-02-26 15:40 [PATCH alsa-ucm-conf 0/8] codecs/rt5640: Cleanup + HW volume control support Hans de Goede
                   ` (5 preceding siblings ...)
  2021-02-26 15:40 ` [PATCH alsa-ucm-conf 6/8] codecs/rt5640: Add hardware volume-control support Hans de Goede
@ 2021-02-26 15:40 ` Hans de Goede
  2021-02-26 15:40 ` [PATCH alsa-ucm-conf 8/8] codecs/rt5640: Specify Playback/CaptureMasterElem for HW volume-control Hans de Goede
  7 siblings, 0 replies; 9+ messages in thread
From: Hans de Goede @ 2021-02-26 15:40 UTC (permalink / raw)
  To: Jaroslav Kysela
  Cc: Hans de Goede, alsa-devel, Pierre-Louis Bossart, Bard Liao

Newer kernels add "aif:1" or "aif:2" to the components string to let
us know which AIF is being used.

Use this to mute the ADC/DAC master controls on the other AIF. Muting
these is necessary to make mute LED control work properly, because the
snd_ctl_led will only turn on the mute LED if both DAC Volume Switches
are disabled.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 ucm2/bytcr-rt5640/HiFi.conf                   | 46 +++++++++++++++++++
 ucm2/codecs/rt5640/EnableSeq-AIF-unknown.conf |  7 +++
 ucm2/codecs/rt5640/EnableSeq-AIF1.conf        |  7 +++
 ucm2/codecs/rt5640/EnableSeq-AIF2.conf        |  7 +++
 ucm2/codecs/rt5640/EnableSeq.conf             |  4 --
 5 files changed, 67 insertions(+), 4 deletions(-)
 create mode 100644 ucm2/codecs/rt5640/EnableSeq-AIF-unknown.conf
 create mode 100644 ucm2/codecs/rt5640/EnableSeq-AIF1.conf
 create mode 100644 ucm2/codecs/rt5640/EnableSeq-AIF2.conf

diff --git a/ucm2/bytcr-rt5640/HiFi.conf b/ucm2/bytcr-rt5640/HiFi.conf
index a5c05ba..39a9a2b 100644
--- a/ucm2/bytcr-rt5640/HiFi.conf
+++ b/ucm2/bytcr-rt5640/HiFi.conf
@@ -1,8 +1,54 @@
 # Use case Configuration for bytcr-rt5640
 
+Define.HaveAif ""
+Define.HaveAif1 ""
+Define.HaveAif2 ""
+
+If.DefineAif1 {
+	Condition {
+		Type String
+		Haystack "${CardComponents}"
+		Needle "aif:1"
+	}
+	True {
+		Define.HaveAif "yes"
+		Define.HaveAif1 "yes"
+	}
+}
+
+If.DefineAif2 {
+	Condition {
+		Type String
+		Haystack "${CardComponents}"
+		Needle "aif:2"
+	}
+	True {
+		Define.HaveAif "yes"
+		Define.HaveAif2 "yes"
+	}
+}
+
 SectionVerb {
 	Include.e.File "/codecs/rt5640/EnableSeq.conf"
 
+	If.Aif1 {
+		Condition { Type String Empty "${var:HaveAif1}" }
+		Before.EnableSequence "0"
+		False.Include.aif1.File "/codecs/rt5640/EnableSeq-AIF1.conf"
+	}
+
+	If.Aif2 {
+		Condition { Type String Empty "${var:HaveAif2}" }
+		Before.EnableSequence "0"
+		False.Include.aif1.File "/codecs/rt5640/EnableSeq-AIF2.conf"
+	}
+
+	If.AifUnknown {
+		Condition { Type String Empty "${var:HaveAif}" }
+		Before.EnableSequence "0"
+		True.Include.aif-unknown.File "/codecs/rt5640/EnableSeq-AIF-unknown.conf"
+	}
+
 	If.Controls {
 		Condition {
 			Type ControlExists
diff --git a/ucm2/codecs/rt5640/EnableSeq-AIF-unknown.conf b/ucm2/codecs/rt5640/EnableSeq-AIF-unknown.conf
new file mode 100644
index 0000000..3160d5c
--- /dev/null
+++ b/ucm2/codecs/rt5640/EnableSeq-AIF-unknown.conf
@@ -0,0 +1,7 @@
+EnableSequence [
+	# When the AIF is unknown enable audio from/to both AIFs
+	# Note kernels which do not advertise the AIF do not have a 'DAC1 Playback Switch'
+	cset "name='DAC2 Playback Switch' on"
+	cset "name='ADC Capture Switch' on"
+	cset "name='Mono ADC Capture Switch' on"
+]
diff --git a/ucm2/codecs/rt5640/EnableSeq-AIF1.conf b/ucm2/codecs/rt5640/EnableSeq-AIF1.conf
new file mode 100644
index 0000000..b31fb7b
--- /dev/null
+++ b/ucm2/codecs/rt5640/EnableSeq-AIF1.conf
@@ -0,0 +1,7 @@
+EnableSequence [
+	cset "name='DAC1 Playback Switch' on"
+	cset "name='ADC Capture Switch' on"
+	# When AIF1 is used, mute the AIF2 ADC/DAC master control
+	cset "name='DAC2 Playback Switch' off"
+	cset "name='Mono ADC Capture Switch' off"
+]
diff --git a/ucm2/codecs/rt5640/EnableSeq-AIF2.conf b/ucm2/codecs/rt5640/EnableSeq-AIF2.conf
new file mode 100644
index 0000000..a1d4d68
--- /dev/null
+++ b/ucm2/codecs/rt5640/EnableSeq-AIF2.conf
@@ -0,0 +1,7 @@
+EnableSequence [
+	cset "name='DAC2 Playback Switch' on"
+	cset "name='Mono ADC Capture Switch' on"
+	# When AIF2 is used, mute the AIF1 ADC/DAC master control
+	cset "name='DAC1 Playback Switch' off"
+	cset "name='ADC Capture Switch' off"
+]
diff --git a/ucm2/codecs/rt5640/EnableSeq.conf b/ucm2/codecs/rt5640/EnableSeq.conf
index 8b30153..572d1a2 100644
--- a/ucm2/codecs/rt5640/EnableSeq.conf
+++ b/ucm2/codecs/rt5640/EnableSeq.conf
@@ -26,18 +26,14 @@ EnableSequence [
 	#cset "name='SDI select' 1"
 	#cset "name='DAI select' 1"
 
-	cset "name='DAC2 Playback Switch' on"
-
 	# Input Configuration
 	cset "name='Stereo ADC1 Mux' ADC"
 	cset "name='Stereo ADC2 Mux' DMIC1"
-	cset "name='ADC Capture Switch' on"
 
 	cset "name='Mono ADC L1 Mux' ADCL"
 	cset "name='Mono ADC R1 Mux' ADCR"
 	cset "name='Mono ADC L2 Mux' DMIC L1"
 	cset "name='Mono ADC R2 Mux' DMIC R1"
-	cset "name='Mono ADC Capture Switch' on"
 
 	# 47=0dB, 0.375 dB/step, set it to 9 dB to help with soft mics
 	cset "name='ADC Capture Volume' 71"
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH alsa-ucm-conf 8/8] codecs/rt5640: Specify Playback/CaptureMasterElem for HW volume-control
  2021-02-26 15:40 [PATCH alsa-ucm-conf 0/8] codecs/rt5640: Cleanup + HW volume control support Hans de Goede
                   ` (6 preceding siblings ...)
  2021-02-26 15:40 ` [PATCH alsa-ucm-conf 7/8] codecs/rt5640: Use the new "aif:%d" part of the components string Hans de Goede
@ 2021-02-26 15:40 ` Hans de Goede
  7 siblings, 0 replies; 9+ messages in thread
From: Hans de Goede @ 2021-02-26 15:40 UTC (permalink / raw)
  To: Jaroslav Kysela
  Cc: Hans de Goede, alsa-devel, Pierre-Louis Bossart, Bard Liao

Specify the correct Playback/CaptureMasterElem for HW volume-control,
based on which AIF is being used.

On older kernels, where there is no "aif:%d" string in the components
string, no Playback/CaptureMasterElem is specified.

In DigitalMics.conf the master mixer is used as regular CaptureMixerElem
instead of as CaptureMasterElem since the DMICs don't have any analog
volume control.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 ucm2/codecs/rt5640/DigitalMics.conf     | 16 ++++++++++++++++
 ucm2/codecs/rt5640/HeadPhones.conf      | 12 ++++++++++++
 ucm2/codecs/rt5640/HeadsetMic.conf      | 12 ++++++++++++
 ucm2/codecs/rt5640/IN1-InternalMic.conf | 12 ++++++++++++
 ucm2/codecs/rt5640/IN3-InternalMic.conf | 12 ++++++++++++
 ucm2/codecs/rt5640/MonoSpeaker.conf     | 12 ++++++++++++
 ucm2/codecs/rt5640/Speaker.conf         | 12 ++++++++++++
 7 files changed, 88 insertions(+)

diff --git a/ucm2/codecs/rt5640/DigitalMics.conf b/ucm2/codecs/rt5640/DigitalMics.conf
index 157c544..032d954 100644
--- a/ucm2/codecs/rt5640/DigitalMics.conf
+++ b/ucm2/codecs/rt5640/DigitalMics.conf
@@ -26,5 +26,21 @@ SectionDevice."Mic" {
 	Value {
 		CapturePriority 100
 		CapturePCM "hw:${CardId}"
+		If.DmicAif1 {
+			Condition { Type String Empty "${var:HaveAif1}" }
+			False {
+				CaptureMixerElem "ADC"
+				CaptureVolume "ADC Capture Volume"
+				CaptureSwitch "ADC Capture Switch"
+			}
+		}
+		If.DmicAif2 {
+			Condition { Type String Empty "${var:HaveAif2}" }
+			False {
+				CaptureMixerElem "Mono ADC"
+				CaptureVolume "Mono ADC Capture Volume"
+				CaptureSwitch "Mono ADC Capture Switch"
+			}
+		}
 	}
 }
diff --git a/ucm2/codecs/rt5640/HeadPhones.conf b/ucm2/codecs/rt5640/HeadPhones.conf
index 5535111..4fbe95d 100644
--- a/ucm2/codecs/rt5640/HeadPhones.conf
+++ b/ucm2/codecs/rt5640/HeadPhones.conf
@@ -37,5 +37,17 @@ SectionDevice."Headphones" {
 		JackControl "Headphone Jack"
 		PlaybackMixerElem "HP"
 		PlaybackVolume "HP Playback Volume"
+		If.HpAif1 {
+			Condition { Type String Empty "${var:HaveAif1}" }
+			False {
+				PlaybackMasterElem "DAC1"
+			}
+		}
+		If.HpAif2 {
+			Condition { Type String Empty "${var:HaveAif2}" }
+			False {
+				PlaybackMasterElem "DAC2"
+			}
+		}
 	}
 }
diff --git a/ucm2/codecs/rt5640/HeadsetMic.conf b/ucm2/codecs/rt5640/HeadsetMic.conf
index 8479672..b49dad4 100644
--- a/ucm2/codecs/rt5640/HeadsetMic.conf
+++ b/ucm2/codecs/rt5640/HeadsetMic.conf
@@ -43,5 +43,17 @@ SectionDevice."Headset" {
 		JackControl "Headset Mic Jack"
 		CaptureMixerElem "IN2 Boost"
 		CaptureVolume "IN2 Boost"
+		If.HSmicAif1 {
+			Condition { Type String Empty "${var:HaveAif1}" }
+			False {
+				CaptureMasterElem "ADC"
+			}
+		}
+		If.HSmicAif2 {
+			Condition { Type String Empty "${var:HaveAif2}" }
+			False {
+				CaptureMasterElem "Mono ADC"
+			}
+		}
 	}
 }
diff --git a/ucm2/codecs/rt5640/IN1-InternalMic.conf b/ucm2/codecs/rt5640/IN1-InternalMic.conf
index a317388..d670484 100644
--- a/ucm2/codecs/rt5640/IN1-InternalMic.conf
+++ b/ucm2/codecs/rt5640/IN1-InternalMic.conf
@@ -34,5 +34,17 @@ SectionDevice."Mic" {
 		CapturePCM "hw:${CardId}"
 		CaptureMixerElem "IN1 Boost"
 		CaptureVolume "IN1 Boost"
+		If.In1Aif1 {
+			Condition { Type String Empty "${var:HaveAif1}" }
+			False {
+				CaptureMasterElem "ADC"
+			}
+		}
+		If.In1Aif2 {
+			Condition { Type String Empty "${var:HaveAif2}" }
+			False {
+				CaptureMasterElem "Mono ADC"
+			}
+		}
 	}
 }
diff --git a/ucm2/codecs/rt5640/IN3-InternalMic.conf b/ucm2/codecs/rt5640/IN3-InternalMic.conf
index ef4eaba..345db1e 100644
--- a/ucm2/codecs/rt5640/IN3-InternalMic.conf
+++ b/ucm2/codecs/rt5640/IN3-InternalMic.conf
@@ -34,5 +34,17 @@ SectionDevice."Mic" {
 		CapturePCM "hw:${CardId}"
 		CaptureMixerElem "IN3 Boost"
 		CaptureVolume "IN3 Boost"
+		If.In3Aif1 {
+			Condition { Type String Empty "${var:HaveAif1}" }
+			False {
+				CaptureMasterElem "ADC"
+			}
+		}
+		If.In3Aif2 {
+			Condition { Type String Empty "${var:HaveAif2}" }
+			False {
+				CaptureMasterElem "Mono ADC"
+			}
+		}
 	}
 }
diff --git a/ucm2/codecs/rt5640/MonoSpeaker.conf b/ucm2/codecs/rt5640/MonoSpeaker.conf
index 3cbeafd..addaddd 100644
--- a/ucm2/codecs/rt5640/MonoSpeaker.conf
+++ b/ucm2/codecs/rt5640/MonoSpeaker.conf
@@ -31,5 +31,17 @@ SectionDevice."Speaker" {
 		PlaybackPCM "hw:${CardId}"
 		PlaybackMixerElem "Speaker"
 		PlaybackVolume "Speaker Playback Volume"
+		If.MonoSpkAif1 {
+			Condition { Type String Empty "${var:HaveAif1}" }
+			False {
+				PlaybackMasterElem "DAC1"
+			}
+		}
+		If.MonoSpkAif2 {
+			Condition { Type String Empty "${var:HaveAif2}" }
+			False {
+				PlaybackMasterElem "DAC2"
+			}
+		}
 	}
 }
diff --git a/ucm2/codecs/rt5640/Speaker.conf b/ucm2/codecs/rt5640/Speaker.conf
index 0924f9c..e7ff673 100644
--- a/ucm2/codecs/rt5640/Speaker.conf
+++ b/ucm2/codecs/rt5640/Speaker.conf
@@ -31,5 +31,17 @@ SectionDevice."Speaker" {
 		PlaybackPCM "hw:${CardId}"
 		PlaybackMixerElem "Speaker"
 		PlaybackVolume "Speaker Playback Volume"
+		If.SpkAif1 {
+			Condition { Type String Empty "${var:HaveAif1}" }
+			False {
+				PlaybackMasterElem "DAC1"
+			}
+		}
+		If.SpkAif2 {
+			Condition { Type String Empty "${var:HaveAif2}" }
+			False {
+				PlaybackMasterElem "DAC2"
+			}
+		}
 	}
 }
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-02-26 15:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-26 15:40 [PATCH alsa-ucm-conf 0/8] codecs/rt5640: Cleanup + HW volume control support Hans de Goede
2021-02-26 15:40 ` [PATCH alsa-ucm-conf 1/8] codecs/rt5640: Cleanup: unify Stereo / Mono ADC handling Hans de Goede
2021-02-26 15:40 ` [PATCH alsa-ucm-conf 2/8] codecs/rt5640: Cleanup: Initially disable all inputs and outputs Hans de Goede
2021-02-26 15:40 ` [PATCH alsa-ucm-conf 3/8] codecs/rt5640: Cleanup: Move 'SPK MIX' setup to main EnableSequene Hans de Goede
2021-02-26 15:40 ` [PATCH alsa-ucm-conf 4/8] codecs/rt5640: Drop bogus 'DIG MIXL DAC L2 Switch' setting Hans de Goede
2021-02-26 15:40 ` [PATCH alsa-ucm-conf 5/8] codecs/rt5640: Unify capture volume for AIF1 and AIF2 recording paths Hans de Goede
2021-02-26 15:40 ` [PATCH alsa-ucm-conf 6/8] codecs/rt5640: Add hardware volume-control support Hans de Goede
2021-02-26 15:40 ` [PATCH alsa-ucm-conf 7/8] codecs/rt5640: Use the new "aif:%d" part of the components string Hans de Goede
2021-02-26 15:40 ` [PATCH alsa-ucm-conf 8/8] codecs/rt5640: Specify Playback/CaptureMasterElem for HW volume-control Hans de Goede

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.