[PATCH alsa-ucm-conf 4/5] bytcr-rt5640: Add support for a second headphones output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 ucm2/bytcr-rt5640/HiFi-Components.conf |  9 +++++
 ucm2/bytcr-rt5640/HiFi.conf            | 18 ++++++++++
 ucm2/codecs/rt5640/HeadPhones2.conf    | 46 ++++++++++++++++++++++++++
 3 files changed, 73 insertions(+)
 create mode 100644 ucm2/codecs/rt5640/HeadPhones2.conf

diff --git a/ucm2/bytcr-rt5640/HiFi-Components.conf b/ucm2/bytcr-rt5640/HiFi-Components.conf
index 39c7f36..3f941ac 100644
--- a/ucm2/bytcr-rt5640/HiFi-Components.conf
+++ b/ucm2/bytcr-rt5640/HiFi-Components.conf
@@ -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
diff --git a/ucm2/bytcr-rt5640/HiFi.conf b/ucm2/bytcr-rt5640/HiFi.conf
index 604e7d9..2e099bd 100644
--- a/ucm2/bytcr-rt5640/HiFi.conf
+++ b/ucm2/bytcr-rt5640/HiFi.conf
@@ -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
index 0000000..b75e420
--- /dev/null
+++ b/ucm2/codecs/rt5640/HeadPhones2.conf
@@ -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"
+		}
+	}
+}
-- 
2.31.1




[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux