]> git.alsa-project.org Git - alsa-ucm-conf.git/commitdiff
bytcr-rt5640: Add support for a second headphones output
authorHans de Goede <hdegoede@redhat.com>
Wed, 29 Sep 2021 09:11:43 +0000 (11:11 +0200)
committerJaroslav Kysela <perex@perex.cz>
Wed, 29 Sep 2021 10:57:14 +0000 (12:57 +0200)
Some devices (HP Elitepad 1000 G2) have a second headphones output
(1 on the dock, 2nd on the tablet itself) which is implemented through
the line-out output of the codec combined with an external hp-amp.

The kernel has recently gotten support for this setup and will
advertise this to userspace by adding cfg-hp2:lineout to the
components string, add support for this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
ucm2/bytcr-rt5640/HiFi-Components.conf
ucm2/bytcr-rt5640/HiFi.conf
ucm2/codecs/rt5640/HeadPhones2.conf [new file with mode: 0644]

index 39c7f36d3937b994e693ee40da13c73f17a0e390..3f941acf4ad20b685319e1f883a32d28abfd281e 100644 (file)
@@ -16,6 +16,15 @@ If.mono {
        True.Define.HaveSpeaker "1"
 }
 
+If.hp2 {
+       Condition {
+               Type String
+               Haystack "${CardComponents}"
+               Needle "cfg-hp2:lineout"
+       }
+       True.Define.HaveHeadPhones2 "yes"
+}
+
 If.dmic1 {
        Condition {
                Type String
index 604e7d9e204fcbe1e9b940896e8dae70453b7f7f..2e099bd933b8b498ea6efd6119176541f8d10279 100644 (file)
@@ -2,6 +2,7 @@
 
 Define.HaveAif ""
 Define.HaveSpeaker ""
+Define.HaveHeadPhones2 ""
 Define.HaveInternalMic ""
 Define.HaveHeadsetMic "yes"
 Define.StereoADC2Mux "DMIC1"
@@ -116,6 +117,23 @@ If.hp {
        }
 }
 
+If.hp2 {
+       Condition { Type String Empty "${var:HaveHeadPhones2}" }
+       False {
+               Include.hs.File "/codecs/rt5640/HeadPhones2.conf"
+
+               SectionDevice."Headphones2" {
+                       EnableSequence [
+                               cset "name='Line Out Switch' on"
+                       ]
+
+                       DisableSequence [
+                               cset "name='Line Out Switch' off"
+                       ]
+               }
+       }
+}
+
 If.dmic {
        Condition {
                Type String
diff --git a/ucm2/codecs/rt5640/HeadPhones2.conf b/ucm2/codecs/rt5640/HeadPhones2.conf
new file mode 100644 (file)
index 0000000..b75e420
--- /dev/null
@@ -0,0 +1,46 @@
+# The 2nd headset jack uses lineout with an external HP-amp
+
+SectionDevice."Headphones2" {
+       Comment "Headphones 2"
+
+       ConflictingDevice [
+               "Speaker"
+               "Headphones"
+       ]
+
+       EnableSequence [
+               cset "name='LOUT MIX OUTVOL L Switch' on"
+               cset "name='LOUT MIX OUTVOL R Switch' on"
+               cset "name='OUT Channel Switch' on"
+       ]
+
+       DisableSequence [
+               cset "name='LOUT MIX OUTVOL L Switch' off"
+               cset "name='LOUT MIX OUTVOL R Switch' off"
+               cset "name='OUT Channel Switch' off"
+       ]
+
+       Value {
+               PlaybackPriority 400
+               PlaybackPCM "hw:${CardId}"
+               JackControl "Line Out Jack"
+               PlaybackMixerElem "OUT"
+               PlaybackVolume "OUT Playback Volume"
+               If.HpAif1 {
+                       Condition {
+                               Type String
+                               String1 "${var:HaveAif}"
+                               String2 "1"
+                       }
+                       True.PlaybackMasterElem "DAC1"
+               }
+               If.HpAif2 {
+                       Condition {
+                               Type String
+                               String1 "${var:HaveAif}"
+                               String2 "2"
+                       }
+                       True.PlaybackMasterElem "DAC2"
+               }
+       }
+}