From: Jaroslav Kysela Date: Thu, 27 May 2021 07:56:02 +0000 (+0200) Subject: rt5640 / bytcr-rt5640: cleanups X-Git-Tag: v1.2.5^0 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=4884ef82c2ea27942a51411d0606f5f0866dcd2e;p=alsa-ucm-conf.git rt5640 / bytcr-rt5640: cleanups - merge HaveAif1 and HaveAif2 to HaveAif with values 1 and 2 - HaveSpeaker identifies stereo and mono (values 2 and 1) - HaveInternalMic identifies internal mic input (dmic, in1, in3) - rewrite (unify) bytcr-rt5640 components detection BugLink: https://github.com/alsa-project/alsa-ucm-conf/pull/92 Signed-off-by: Jaroslav Kysela --- diff --git a/ucm2/Tegra/rt5640/ASUS Google Nexus 7 ALC5642.conf b/ucm2/Tegra/rt5640/ASUS Google Nexus 7 ALC5642.conf index a034116..8156006 100644 --- a/ucm2/Tegra/rt5640/ASUS Google Nexus 7 ALC5642.conf +++ b/ucm2/Tegra/rt5640/ASUS Google Nexus 7 ALC5642.conf @@ -1,10 +1,9 @@ # Use case Configuration for ASUS Google Nexus 7 (2012) -Define.HaveAif1 "yes" -Define.HaveAif2 "" -Define.HaveSpeaker "yes" +Define.HaveAif "1" +Define.HaveSpeaker "2" Define.HaveHeadsetMic "" -Define.HaveInternalMic "yes" +Define.HaveInternalMic "dmic1" Include.hp.File "/codecs/rt5640/HeadPhones.conf" Include.mspk.File "/codecs/rt5640/Speaker.conf" diff --git a/ucm2/bytcr-rt5640/HiFi-Components.conf b/ucm2/bytcr-rt5640/HiFi-Components.conf index b3ab9a0..729b2b6 100644 --- a/ucm2/bytcr-rt5640/HiFi-Components.conf +++ b/ucm2/bytcr-rt5640/HiFi-Components.conf @@ -1,27 +1,10 @@ -Define.HaveSpeaker "" -Define.HaveHeadsetMic "" -Define.HaveInternalMic "" - If.spk { Condition { Type String Haystack "${CardComponents}" Needle "cfg-spk:2" } - True { - Include.spk.File "/codecs/rt5640/Speaker.conf" - Define.HaveSpeaker "yes" - - SectionDevice."Speaker" { - EnableSequence [ - cset "name='Speaker Switch' on" - ] - - DisableSequence [ - cset "name='Speaker Switch' off" - ] - } - } + True.Define.HaveSpeaker "2" } If.mono { @@ -30,35 +13,7 @@ If.mono { Haystack "${CardComponents}" Needle "cfg-spk:1" } - True { - Include.mspk.File "/codecs/rt5640/MonoSpeaker.conf" - Define.HaveSpeaker "yes" - - SectionDevice."Speaker" { - EnableSequence [ - cset "name='Speaker Switch' on" - ] - - DisableSequence [ - cset "name='Speaker Switch' off" - ] - } - } -} - -If.hp { - Condition { Type String Empty "" } - True.Include.hs.File "/codecs/rt5640/HeadPhones.conf" - - SectionDevice."Headphones" { - EnableSequence [ - cset "name='Headphone Switch' on" - ] - - DisableSequence [ - cset "name='Headphone Switch' off" - ] - } + True.Define.HaveSpeaker "1" } If.dmic1 { @@ -67,20 +22,7 @@ If.dmic1 { Haystack "${CardComponents}" Needle "cfg-mic:dmic1" } - True { - Include.dmic.File "/codecs/rt5640/DigitalMics.conf" - Define.HaveInternalMic "yes" - - SectionDevice."Mic" { - EnableSequence [ - cset "name='Internal Mic Switch' on" - ] - - DisableSequence [ - cset "name='Internal Mic Switch' off" - ] - } - } + True.Define.HaveInternalMic "dmic1" } If.in1 { @@ -89,20 +31,7 @@ If.in1 { Haystack "${CardComponents}" Needle "cfg-mic:in1" } - True { - Include.mic1.File "/codecs/rt5640/IN1-InternalMic.conf" - Define.HaveInternalMic "yes" - - SectionDevice."Mic" { - EnableSequence [ - cset "name='Internal Mic Switch' on" - ] - - DisableSequence [ - cset "name='Internal Mic Switch' off" - ] - } - } + True.Define.HaveInternalMic "in1" } If.in3 { @@ -111,34 +40,5 @@ If.in3 { Haystack "${CardComponents}" Needle "cfg-mic:in3" } - True { - Include.mic3.File "/codecs/rt5640/IN3-InternalMic.conf" - Define.HaveInternalMic "yes" - - SectionDevice."Mic" { - EnableSequence [ - cset "name='Internal Mic Switch' on" - ] - - DisableSequence [ - cset "name='Internal Mic Switch' off" - ] - } - } -} - -If.hsmic { - Condition { Type String Empty "" } - True.Include.hsmic.File "/codecs/rt5640/HeadsetMic.conf" - Define.HaveHeadsetMic "yes" - - SectionDevice."Headset" { - EnableSequence [ - cset "name='Headset Mic Switch' on" - ] - - DisableSequence [ - cset "name='Headset Mic Switch' off" - ] - } + True.Define.HaveInternalMic "in3" } diff --git a/ucm2/bytcr-rt5640/HiFi-LongName.conf b/ucm2/bytcr-rt5640/HiFi-LongName.conf index 090010a..7af2d4a 100644 --- a/ucm2/bytcr-rt5640/HiFi-LongName.conf +++ b/ucm2/bytcr-rt5640/HiFi-LongName.conf @@ -1,27 +1,10 @@ -Define.HaveSpeaker "" -Define.HaveHeadsetMic "" -Define.HaveInternalMic "" - If.spk { Condition { Type String Haystack "${CardLongName}" Needle "-stereo-spk" } - True { - Include.spk.File "/codecs/rt5640/Speaker.conf" - Define.HaveSpeaker "yes" - - SectionDevice."Speaker" { - EnableSequence [ - cset "name='Speaker Switch' on" - ] - - DisableSequence [ - cset "name='Speaker Switch' off" - ] - } - } + True.Define.HaveSpeaker "2" } If.mono { @@ -30,35 +13,7 @@ If.mono { Haystack "${CardLongName}" Needle "-mono-spk" } - True { - Include.mspk.File "/codecs/rt5640/MonoSpeaker.conf" - Define.HaveSpeaker "yes" - - SectionDevice."Speaker" { - EnableSequence [ - cset "name='Speaker Switch' on" - ] - - DisableSequence [ - cset "name='Speaker Switch' off" - ] - } - } -} - -If.hp { - Condition { Type String Empty "" } - True.Include.hs.File "/codecs/rt5640/HeadPhones.conf" - - SectionDevice."Headphones" { - EnableSequence [ - cset "name='Headphone Switch' on" - ] - - DisableSequence [ - cset "name='Headphone Switch' off" - ] - } + True.Define.HaveSpeaker "1" } If.dmic1 { @@ -67,20 +22,7 @@ If.dmic1 { Haystack "${CardLongName}" Needle "-dmic1-mic" } - True { - Include.dmic.File "/codecs/rt5640/DigitalMics.conf" - Define.HaveInternalMic "yes" - - SectionDevice."Mic" { - EnableSequence [ - cset "name='Internal Mic Switch' on" - ] - - DisableSequence [ - cset "name='Internal Mic Switch' off" - ] - } - } + True.Define.HaveInternalMic "dmic1" } If.in1 { @@ -89,20 +31,7 @@ If.in1 { Haystack "${CardLongName}" Needle "-in1-mic" } - True { - Include.mic1.File "/codecs/rt5640/IN1-InternalMic.conf" - Define.HaveInternalMic "yes" - - SectionDevice."Mic" { - EnableSequence [ - cset "name='Internal Mic Switch' on" - ] - - DisableSequence [ - cset "name='Internal Mic Switch' off" - ] - } - } + True.Define.HaveInternalMic "in1" } If.in3 { @@ -111,34 +40,5 @@ If.in3 { Haystack "${CardLongName}" Needle "-in3-mic" } - True { - Include.mic3.File "/codecs/rt5640/IN3-InternalMic.conf" - Define.HaveInternalMic "yes" - - SectionDevice."Mic" { - EnableSequence [ - cset "name='Internal Mic Switch' on" - ] - - DisableSequence [ - cset "name='Internal Mic Switch' off" - ] - } - } -} - -If.hsmic { - Condition { Type String Empty "" } - True.Include.hsmic.File "/codecs/rt5640/HeadsetMic.conf" - Define.HaveHeadsetMic "yes" - - SectionDevice."Headset" { - EnableSequence [ - cset "name='Headset Mic Switch' on" - ] - - DisableSequence [ - cset "name='Headset Mic Switch' off" - ] - } + True.Define.HaveInternalMic "in3" } diff --git a/ucm2/bytcr-rt5640/HiFi.conf b/ucm2/bytcr-rt5640/HiFi.conf index d0a783a..a5b47df 100644 --- a/ucm2/bytcr-rt5640/HiFi.conf +++ b/ucm2/bytcr-rt5640/HiFi.conf @@ -1,7 +1,9 @@ # Use case Configuration for bytcr-rt5640 -Define.HaveAif1 "" -Define.HaveAif2 "" +Define.HaveAif "" +Define.HaveSpeaker "" +Define.HaveInternalMic "" +Define.HaveHeadsetMic "yes" If.DefineAif1 { Condition { @@ -9,7 +11,7 @@ If.DefineAif1 { Haystack "${CardComponents}" Needle "aif:1" } - True.Define.HaveAif1 "yes" + True.Define.HaveAif "1" } If.DefineAif2 { @@ -18,7 +20,17 @@ If.DefineAif2 { Haystack "${CardComponents}" Needle "aif:2" } - True.Define.HaveAif2 "yes" + True.Define.HaveAif "2" +} + +If.0 { + Condition { + Type String + Haystack "${CardComponents}" + Needle "cfg-spk:" + } + True.Include.comp.File "/bytcr-rt5640/HiFi-Components.conf" + False.Include.long.File "/bytcr-rt5640/HiFi-LongName.conf" } SectionVerb { @@ -44,12 +56,137 @@ SectionVerb { } } -If.0 { +If.spk { Condition { Type String - Haystack "${CardComponents}" - Needle "cfg-spk:" + Haystack "${var:HaveSpeaker}" + Needle "2" + } + True { + Include.spk.File "/codecs/rt5640/Speaker.conf" + + SectionDevice."Speaker" { + EnableSequence [ + cset "name='Speaker Switch' on" + ] + + DisableSequence [ + cset "name='Speaker Switch' off" + ] + } + } +} + +If.mono { + Condition { + Type String + Haystack "${var:HaveSpeaker}" + Needle "1" + } + True { + Include.mspk.File "/codecs/rt5640/MonoSpeaker.conf" + + SectionDevice."Speaker" { + EnableSequence [ + cset "name='Speaker Switch' on" + ] + + DisableSequence [ + cset "name='Speaker Switch' off" + ] + } + } +} + +If.hp { + Condition { Type String Empty "" } + True.Include.hs.File "/codecs/rt5640/HeadPhones.conf" + + SectionDevice."Headphones" { + EnableSequence [ + cset "name='Headphone Switch' on" + ] + + DisableSequence [ + cset "name='Headphone Switch' off" + ] + } +} + +If.dmic1 { + Condition { + Type String + Haystack "${var:HaveInternalMic}" + Needle "dmic1" + } + True { + Include.dmic.File "/codecs/rt5640/DigitalMics.conf" + + SectionDevice."Mic" { + EnableSequence [ + cset "name='Internal Mic Switch' on" + ] + + DisableSequence [ + cset "name='Internal Mic Switch' off" + ] + } + } +} + +If.in1 { + Condition { + Type String + Haystack "${var:HaveInternalMic}" + Needle "in1" + } + True { + Include.mic1.File "/codecs/rt5640/IN1-InternalMic.conf" + + SectionDevice."Mic" { + EnableSequence [ + cset "name='Internal Mic Switch' on" + ] + + DisableSequence [ + cset "name='Internal Mic Switch' off" + ] + } + } +} + +If.in3 { + Condition { + Type String + Haystack "${var:HaveInternalMic}" + Needle "in3" + } + True { + Include.mic3.File "/codecs/rt5640/IN3-InternalMic.conf" + + SectionDevice."Mic" { + EnableSequence [ + cset "name='Internal Mic Switch' on" + ] + + DisableSequence [ + cset "name='Internal Mic Switch' off" + ] + } + } +} + +If.hsmic { + Condition { Type String Empty "" } + True.Include.hsmic.File "/codecs/rt5640/HeadsetMic.conf" + + SectionDevice."Headset" { + EnableSequence [ + cset "name='Headset Mic Switch' on" + ] + + DisableSequence [ + cset "name='Headset Mic Switch' off" + ] } - True.Include.comp.File "/bytcr-rt5640/HiFi-Components.conf" - False.Include.long.File "/bytcr-rt5640/HiFi-LongName.conf" } diff --git a/ucm2/codecs/rt5640/DigitalMics.conf b/ucm2/codecs/rt5640/DigitalMics.conf index 79da8a3..b4d01ae 100644 --- a/ucm2/codecs/rt5640/DigitalMics.conf +++ b/ucm2/codecs/rt5640/DigitalMics.conf @@ -33,16 +33,24 @@ SectionDevice."Mic" { CapturePriority 100 CapturePCM "hw:${CardId}" If.DmicAif1 { - Condition { Type String Empty "${var:HaveAif1}" } - False { + Condition { + Type String + String1 "${var:HaveAif}" + String2 "1" + } + True { CaptureMixerElem "ADC" CaptureVolume "ADC Capture Volume" CaptureSwitch "ADC Capture Switch" } } If.DmicAif2 { - Condition { Type String Empty "${var:HaveAif2}" } - False { + Condition { + Type String + String1 "${var:HaveAif}" + String2 "2" + } + True { 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 d3be2a9..2be787d 100644 --- a/ucm2/codecs/rt5640/HeadPhones.conf +++ b/ucm2/codecs/rt5640/HeadPhones.conf @@ -34,16 +34,20 @@ SectionDevice."Headphones" { PlaybackMixerElem "HP" PlaybackVolume "HP Playback Volume" If.HpAif1 { - Condition { Type String Empty "${var:HaveAif1}" } - False { - PlaybackMasterElem "DAC1" + Condition { + Type String + String1 "${var:HaveAif}" + String2 "1" } + True.PlaybackMasterElem "DAC1" } If.HpAif2 { - Condition { Type String Empty "${var:HaveAif2}" } - False { - PlaybackMasterElem "DAC2" + Condition { + Type String + String1 "${var:HaveAif}" + String2 "2" } + True.PlaybackMasterElem "DAC2" } } } diff --git a/ucm2/codecs/rt5640/HeadsetMic.conf b/ucm2/codecs/rt5640/HeadsetMic.conf index 997aa29..e009a0c 100644 --- a/ucm2/codecs/rt5640/HeadsetMic.conf +++ b/ucm2/codecs/rt5640/HeadsetMic.conf @@ -40,16 +40,20 @@ SectionDevice."Headset" { CaptureMixerElem "IN2 Boost" CaptureVolume "IN2 Boost" If.HSmicAif1 { - Condition { Type String Empty "${var:HaveAif1}" } - False { - CaptureMasterElem "ADC" + Condition { + Type String + String1 "${var:HaveAif}" + String2 "1" } + True.CaptureMasterElem "ADC" } If.HSmicAif2 { - Condition { Type String Empty "${var:HaveAif2}" } - False { - CaptureMasterElem "Mono ADC" + Condition { + Type String + String1 "${var:HaveAif}" + String2 "2" } + True.CaptureMasterElem "Mono ADC" } } } diff --git a/ucm2/codecs/rt5640/IN1-InternalMic.conf b/ucm2/codecs/rt5640/IN1-InternalMic.conf index 146d7ec..9cafc30 100644 --- a/ucm2/codecs/rt5640/IN1-InternalMic.conf +++ b/ucm2/codecs/rt5640/IN1-InternalMic.conf @@ -39,16 +39,20 @@ SectionDevice."Mic" { CaptureMixerElem "IN1 Boost" CaptureVolume "IN1 Boost" If.In1Aif1 { - Condition { Type String Empty "${var:HaveAif1}" } - False { - CaptureMasterElem "ADC" + Condition { + Type String + String1 "${var:HaveAif}" + String2 "1" } + True.CaptureMasterElem "ADC" } If.In1Aif2 { - Condition { Type String Empty "${var:HaveAif2}" } - False { - CaptureMasterElem "Mono ADC" + Condition { + Type String + String1 "${var:HaveAif}" + String2 "2" } + True.CaptureMasterElem "Mono ADC" } } } diff --git a/ucm2/codecs/rt5640/IN3-InternalMic.conf b/ucm2/codecs/rt5640/IN3-InternalMic.conf index c896082..f1ce984 100644 --- a/ucm2/codecs/rt5640/IN3-InternalMic.conf +++ b/ucm2/codecs/rt5640/IN3-InternalMic.conf @@ -39,16 +39,20 @@ SectionDevice."Mic" { CaptureMixerElem "IN3 Boost" CaptureVolume "IN3 Boost" If.In3Aif1 { - Condition { Type String Empty "${var:HaveAif1}" } - False { - CaptureMasterElem "ADC" + Condition { + Type String + String1 "${var:HaveAif}" + String2 "1" } + True.CaptureMasterElem "ADC" } If.In3Aif2 { - Condition { Type String Empty "${var:HaveAif2}" } - False { - CaptureMasterElem "Mono ADC" + Condition { + Type String + String1 "${var:HaveAif}" + String2 "2" } + True.CaptureMasterElem "Mono ADC" } } } diff --git a/ucm2/codecs/rt5640/MonoSpeaker.conf b/ucm2/codecs/rt5640/MonoSpeaker.conf index 3a87d01..a236027 100644 --- a/ucm2/codecs/rt5640/MonoSpeaker.conf +++ b/ucm2/codecs/rt5640/MonoSpeaker.conf @@ -28,16 +28,20 @@ SectionDevice."Speaker" { PlaybackMixerElem "Speaker" PlaybackVolume "Speaker Playback Volume" If.MonoSpkAif1 { - Condition { Type String Empty "${var:HaveAif1}" } - False { - PlaybackMasterElem "DAC1" + Condition { + Type String + String1 "${var:HaveAif}" + String2 "1" } + True.PlaybackMasterElem "DAC1" } If.MonoSpkAif2 { - Condition { Type String Empty "${var:HaveAif2}" } - False { - PlaybackMasterElem "DAC2" + Condition { + Type String + String1 "${var:HaveAif}" + String2 "2" } + True.PlaybackMasterElem "DAC2" } } } diff --git a/ucm2/codecs/rt5640/Speaker.conf b/ucm2/codecs/rt5640/Speaker.conf index 31bb6f7..81ee91f 100644 --- a/ucm2/codecs/rt5640/Speaker.conf +++ b/ucm2/codecs/rt5640/Speaker.conf @@ -28,16 +28,20 @@ SectionDevice."Speaker" { PlaybackMixerElem "Speaker" PlaybackVolume "Speaker Playback Volume" If.SpkAif1 { - Condition { Type String Empty "${var:HaveAif1}" } - False { - PlaybackMasterElem "DAC1" + Condition { + Type String + String1 "${var:HaveAif}" + String2 "1" } + True.PlaybackMasterElem "DAC1" } If.SpkAif2 { - Condition { Type String Empty "${var:HaveAif2}" } - False { - PlaybackMasterElem "DAC2" + Condition { + Type String + String1 "${var:HaveAif}" + String2 "2" } + True.PlaybackMasterElem "DAC2" } } }