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"