Skip to contentSkip to conversation

bytcr-wm5102: Add support for speakers connected to HPOUT2

PATCH In review Hans de Goede 2 participants 4 messages Oct 21, 2023 – Oct 31, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 bytcr-wm5102: Add support for speakers connected to HPOUT2

On the Lenovo Yoga Tab 3 YT3-X90 the speaker amplifiers are connected to the HPOUT2 output pins instead of the the SPK output pins.

Check for "cfg-spk:hpout2" in the components string which indicates this setup and add a ucm2/codecs/wm5102/HPOut2-Speaker.conf file for this setup.

---
 ucm2/Intel/bytcr-wm5102/HiFi.conf      | 11 ++++++++++-
 ucm2/codecs/wm5102/EnableSeq.conf      |  2 ++
 ucm2/codecs/wm5102/HPOut2-Speaker.conf | 22 ++++++++++++++++++++++
 3 files changed, 34 insertions(+), 1 deletion(-)
 create mode 100644 ucm2/codecs/wm5102/HPOut2-Speaker.conf
ucm2/Intel/bytcr-wm5102/HiFi.conf +10 -1
index 1269868..2afc757 100644
@@ -21,7 +21,16 @@ SectionVerb {
 	}
 }
 
-Include.spk.File "/codecs/wm5102/Speaker.conf"
+If.spk {
+	Condition {
+		Type String
+		Haystack "${CardComponents}"
+		Needle "cfg-spk:hpout2"
+	}
+	True.Include.hpout2.File "/codecs/wm5102/HPOut2-Speaker.conf"
+	False.Include.spk.File "/codecs/wm5102/Speaker.conf"
+}
+
 Include.hp.File "/codecs/wm5102/HeadPhones.conf"
 Include.mic.File "/codecs/wm5102/IN3-InternalMic.conf"
 Include.headset.File "/codecs/wm5102/IN1-HeadsetMic.conf"
ucm2/codecs/wm5102/EnableSeq.conf +2 -0
index 6a857a2..87cb3bb 100644
@@ -4,6 +4,8 @@ EnableSequence [
 	cset "name='SPKOUTR Input 1' AIF1RX2"
 	cset "name='HPOUT1L Input 1' AIF1RX1"
 	cset "name='HPOUT1R Input 1' AIF1RX2"
+	cset "name='HPOUT2L Input 1' AIF1RX1"
+	cset "name='HPOUT2R Input 1' AIF1RX2"
 
 	# Both mics are quite soft by default, boost then
 	cset "name='IN1L Volume' 28"
ucm2/codecs/wm5102/HPOut2-Speaker.conf new file +22 -0
new file mode 100644
index 0000000..375f9ba
@@ -0,0 +1,22 @@
+SectionDevice."Speaker" {
+	Comment "Speakers"
+
+	Value {
+		PlaybackPriority 100
+		PlaybackPCM "hw:${CardId}"
+	}
+
+	ConflictingDevice [
+		"Headphones"
+	]
+
+	EnableSequence [
+		cset "name='HPOUT2 Digital Switch' on"
+		cset "name='Speaker Switch' on"
+	]
+
+	DisableSequence [
+		cset "name='HPOUT2 Digital Switch' off"
+		cset "name='Speaker Switch' off"
+	]
+}
Signature · 1 line
2.41.0
#1 lore raw

PATCH 2/2 bytcr-wm5102: Add support for different microphone routes

Unlike all designs supported sofar the Lenovo Yoga Tab 3 YT3-X90 does not have its internal microphone (intmic) on IN3L with the headset microphone on IN1L. Instead this tablet has the intmic on IN1L and the hsmic on IN2L.

Add IN1-InternalMic.conf and IN2-HeadsetMic.conf config snippets under ucm2/codecs/wm5102/ for this and check the components string to determine which microphone routes should be used.

---
 ucm2/Intel/bytcr-wm5102/HiFi.conf       | 22 ++++++++++++++++++++--
 ucm2/codecs/wm5102/EnableSeq.conf       |  3 ++-
 ucm2/codecs/wm5102/IN1-InternalMic.conf | 23 +++++++++++++++++++++++
 ucm2/codecs/wm5102/IN2-HeadsetMic.conf  | 24 ++++++++++++++++++++++++
 4 files changed, 69 insertions(+), 3 deletions(-)
 create mode 100644 ucm2/codecs/wm5102/IN1-InternalMic.conf
 create mode 100644 ucm2/codecs/wm5102/IN2-HeadsetMic.conf
ucm2/Intel/bytcr-wm5102/HiFi.conf +20 -2
index 2afc757..46ef7d1 100644
@@ -32,5 +32,23 @@ If.spk {
 }
 
 Include.hp.File "/codecs/wm5102/HeadPhones.conf"
-Include.mic.File "/codecs/wm5102/IN3-InternalMic.conf"
-Include.headset.File "/codecs/wm5102/IN1-HeadsetMic.conf"
+
+If.intmic {
+	Condition {
+		Type String
+		Haystack "${CardComponents}"
+		Needle "cfg-intmic:in1l"
+	}
+	True.Include.intmic1.File "/codecs/wm5102/IN1-InternalMic.conf"
+	False.Include.intmic3.File "/codecs/wm5102/IN3-InternalMic.conf"
+}
+
+If.hsmic {
+	Condition {
+		Type String
+		Haystack "${CardComponents}"
+		Needle "cfg-hsmic:in2l"
+	}
+	True.Include.hsmic2.File "/codecs/wm5102/IN2-HeadsetMic.conf"
+	False.Include.hsmic1.File "/codecs/wm5102/IN1-HeadsetMic.conf"
+}
ucm2/codecs/wm5102/EnableSeq.conf +2 -1
index 87cb3bb..11166c0 100644
@@ -7,8 +7,9 @@ EnableSequence [
 	cset "name='HPOUT2L Input 1' AIF1RX1"
 	cset "name='HPOUT2R Input 1' AIF1RX2"
 
-	# Both mics are quite soft by default, boost then
+	# mics are quite soft by default, boost then
 	cset "name='IN1L Volume' 28"
+	cset "name='IN2L Volume' 28"
 	cset "name='IN3L Volume' 28"
 
 	cset "name='Headphone Switch' off"
ucm2/codecs/wm5102/IN1-InternalMic.conf new file +23 -0
new file mode 100644
index 0000000..d9a70ce
@@ -0,0 +1,23 @@
+SectionDevice."Mic" {
+	Comment "Internal Microphone"
+
+	ConflictingDevice [
+		"Headset"
+	]
+
+	EnableSequence [
+		cset "name='AIF1TX1 Input 1' IN1L"
+		cset "name='AIF1TX2 Input 1' IN1L"
+
+		cset "name='Internal Mic Switch' on"
+	]
+
+	DisableSequence [
+		cset "name='Internal Mic Switch' off"
+	]
+
+	Value {
+		CapturePriority 100
+		CapturePCM "hw:${CardId}"
+	}
+}
ucm2/codecs/wm5102/IN2-HeadsetMic.conf new file +24 -0
new file mode 100644
index 0000000..8fbbcb1
@@ -0,0 +1,24 @@
+SectionDevice."Headset" {
+	Comment "Headset Microphone"
+
+	ConflictingDevice [
+		"Mic"
+	]
+
+	EnableSequence [
+		cset "name='AIF1TX1 Input 1' IN2L"
+		cset "name='AIF1TX2 Input 1' IN2L"
+
+		cset "name='Headset Mic Switch' on"
+	]
+
+	DisableSequence [
+		cset "name='Headset Mic Switch' off"
+	]
+
+	Value {
+		CapturePriority 200
+		CapturePCM "hw:${CardId}"
+		JackControl "Headset Mic Jack"
+	}
+}
Signature · 1 line
2.41.0
#2 lore raw

Re: [PATCH alsa-ucm-conf 2/2] bytcr-wm5102: Add support for different microphone routes

Quoted 9 lines · Hans de Goede

Unlike all designs supported sofar the Lenovo Yoga Tab 3 YT3-X90 does not have its internal microphone (intmic) on IN3L with the headset microphone on IN1L. Instead this tablet has the intmic on IN1L and the hsmic on IN2L.

Add IN1-InternalMic.conf and IN2-HeadsetMic.conf config snippets under ucm2/codecs/wm5102/ for this and check the components string to determine which microphone routes should be used.

Thanks. Applied.

Jaroslav

Signature · 2 lines
Jaroslav Kysela <[email protected]>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
#3 lore raw
In reply to Hans de Goede
Quoted 8 lines · Hans de Goede

On the Lenovo Yoga Tab 3 YT3-X90 the speaker amplifiers are connected to the HPOUT2 output pins instead of the the SPK output pins.

Check for "cfg-spk:hpout2" in the components string which indicates this setup and add a ucm2/codecs/wm5102/HPOut2-Speaker.conf file for this setup.

Thanks. Applied.

Jaroslav

Signature · 2 lines
Jaroslav Kysela <[email protected]>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.