@@ -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
new file mode 100644
@@ -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"
+]
new file mode 100644
@@ -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"
+]
new file mode 100644
@@ -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"
+]
@@ -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"
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