]> git.alsa-project.org Git - alsa-ucm-conf.git/commitdiff
codecs/rt5640: Specify Playback/CaptureMasterElem for HW volume-control
authorHans de Goede <hdegoede@redhat.com>
Mon, 8 Mar 2021 22:05:54 +0000 (23:05 +0100)
committerJaroslav Kysela <perex@perex.cz>
Sat, 13 Mar 2021 15:57:43 +0000 (16:57 +0100)
Newer kernels add "aif:1" or "aif:2" to the components string to let
us know which AIF is being used.

Use this to 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>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
ucm2/bytcr-rt5640/HiFi.conf
ucm2/codecs/rt5640/DigitalMics.conf
ucm2/codecs/rt5640/HeadPhones.conf
ucm2/codecs/rt5640/HeadsetMic.conf
ucm2/codecs/rt5640/IN1-InternalMic.conf
ucm2/codecs/rt5640/IN3-InternalMic.conf
ucm2/codecs/rt5640/MonoSpeaker.conf
ucm2/codecs/rt5640/Speaker.conf

index a5c05ba4467b3d4b06fe508f7338dfcab65000be..7d504d1805fbe1505198039bd9a952509ff7bc47 100644 (file)
@@ -1,5 +1,26 @@
 # Use case Configuration for bytcr-rt5640
 
+Define.HaveAif1 ""
+Define.HaveAif2 ""
+
+If.DefineAif1 {
+       Condition {
+               Type String
+               Haystack "${CardComponents}"
+               Needle "aif:1"
+       }
+       True.Define.HaveAif1 "yes"
+}
+
+If.DefineAif2 {
+       Condition {
+               Type String
+               Haystack "${CardComponents}"
+               Needle "aif:2"
+       }
+       True.Define.HaveAif2 "yes"
+}
+
 SectionVerb {
        Include.e.File "/codecs/rt5640/EnableSeq.conf"
 
index 157c544d77dd8b257e2236831658ec52930a4ed0..032d95477c33e9e8106ce6776a323db4d861fc5c 100644 (file)
@@ -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"
+                       }
+               }
        }
 }
index 5535111bfbe7bf6459ee61ac2c609bdb0eb84e65..4fbe95d9cfd3ea157150963215a2cd76f6bceab1 100644 (file)
@@ -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"
+                       }
+               }
        }
 }
index 8479672aae5f0be0814dcab1c2ee4ca7c44fae98..b49dad4998629be541a8d62136240fd5628a3f86 100644 (file)
@@ -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"
+                       }
+               }
        }
 }
index a3173886446cc6b02bcaca0379aee18889d2a099..d670484b9bce0ce1a1d14db628944f4e1847fe28 100644 (file)
@@ -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"
+                       }
+               }
        }
 }
index ef4eaba9bc6676b8c153a93e6d6abc70024d938f..345db1e31eaaa3a9c9433ed4afb1630a4a3d65f3 100644 (file)
@@ -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"
+                       }
+               }
        }
 }
index 3cbeafd7d4ed80c9a617bb7d6ef40f660a3a2f88..addadddb16c271d357b5ab37c0c3af3c0c27f07d 100644 (file)
@@ -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"
+                       }
+               }
        }
 }
index 0924f9c07897c21d0b0f0b1d296e17e25349275d..e7ff67380eb80b5f82e4e2f39baa3a0704564fc7 100644 (file)
@@ -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"
+                       }
+               }
        }
 }