[PATCH alsa-ucm-conf 5/5] bytcr-rt5640: Add support for a second headset input

[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) the headset mic input of
this second headset is connected to IN1, add support for this.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=213415
Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx>
---
 ucm2/bytcr-rt5640/HiFi-Components.conf  |  9 +++++
 ucm2/bytcr-rt5640/HiFi.conf             | 22 +++++++++++
 ucm2/codecs/rt5640/HeadsetMic2-IN1.conf | 52 +++++++++++++++++++++++++
 3 files changed, 83 insertions(+)
 create mode 100644 ucm2/codecs/rt5640/HeadsetMic2-IN1.conf

diff --git a/ucm2/bytcr-rt5640/HiFi-Components.conf b/ucm2/bytcr-rt5640/HiFi-Components.conf
index 3f941ac..ae5fd05 100644
--- a/ucm2/bytcr-rt5640/HiFi-Components.conf
+++ b/ucm2/bytcr-rt5640/HiFi-Components.conf
@@ -66,3 +66,12 @@ If.in3 {
 	}
 	True.Define.HaveInternalMic "in3"
 }
+
+If.hs2 {
+	Condition {
+		Type String
+		Haystack "${CardComponents}"
+		Needle "cfg-hs2:in1"
+	}
+	True.Define.HaveHeadsetMic2 "in1"
+}
diff --git a/ucm2/bytcr-rt5640/HiFi.conf b/ucm2/bytcr-rt5640/HiFi.conf
index 2e099bd..f758507 100644
--- a/ucm2/bytcr-rt5640/HiFi.conf
+++ b/ucm2/bytcr-rt5640/HiFi.conf
@@ -5,6 +5,7 @@ Define.HaveSpeaker ""
 Define.HaveHeadPhones2 ""
 Define.HaveInternalMic ""
 Define.HaveHeadsetMic "yes"
+Define.HaveHeadsetMic2 ""
 Define.StereoADC2Mux "DMIC1"
 
 If.DefineAif1 {
@@ -213,3 +214,24 @@ If.hsmic {
 		}
 	}
 }
+
+If.hsmic2 {
+	Condition {
+		Type String
+		Haystack "${var:HaveHeadsetMic2}"
+		Needle "in1"
+	}
+	True {
+		Include.hsmic.File "/codecs/rt5640/HeadsetMic2-IN1.conf"
+
+		SectionDevice."Headset2" {
+			EnableSequence [
+				cset "name='Headset Mic 2 Switch' on"
+			]
+
+			DisableSequence [
+				cset "name='Headset Mic 2 Switch' off"
+			]
+		}
+	}
+}
diff --git a/ucm2/codecs/rt5640/HeadsetMic2-IN1.conf b/ucm2/codecs/rt5640/HeadsetMic2-IN1.conf
new file mode 100644
index 0000000..ff05f82
--- /dev/null
+++ b/ucm2/codecs/rt5640/HeadsetMic2-IN1.conf
@@ -0,0 +1,52 @@
+SectionDevice."Headset2" {
+	Comment "Headset Microphone 2"
+
+	ConflictingDevice [
+		"Mic"
+		"Headset"
+	]
+
+	EnableSequence [
+		cset "name='RECMIXL BST1 Switch' on"
+		cset "name='RECMIXR BST1 Switch' on"
+
+		cset "name='Stereo ADC MIXL ADC1 Switch' on"
+		cset "name='Stereo ADC MIXR ADC1 Switch' on"
+		cset "name='Mono ADC MIXL ADC1 Switch' on"
+		cset "name='Mono ADC MIXR ADC1 Switch' on"
+	]
+
+	DisableSequence [
+		cset "name='Stereo ADC MIXL ADC1 Switch' off"
+		cset "name='Stereo ADC MIXR ADC1 Switch' off"
+		cset "name='Mono ADC MIXL ADC1 Switch' off"
+		cset "name='Mono ADC MIXR ADC1 Switch' off"
+
+		cset "name='RECMIXL BST1 Switch' off"
+		cset "name='RECMIXR BST1 Switch' off"
+	]
+
+	Value {
+		CapturePriority 300
+		CapturePCM "hw:${CardId}"
+		JackControl "Headset Mic 2 Jack"
+		CaptureMixerElem "IN1 Boost"
+		CaptureVolume "IN1 Boost"
+		If.In1Aif1 {
+			Condition {
+				Type String
+				String1 "${var:HaveAif}"
+				String2 "1"
+			}
+			True.CaptureMasterElem "ADC"
+		}
+		If.In1Aif2 {
+			Condition {
+				Type String
+				String1 "${var:HaveAif}"
+				String2 "2"
+			}
+			True.CaptureMasterElem "Mono ADC"
+		}
+	}
+}
-- 
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