Skip to contentSkip to conversation

ucm2: bytcr-rt5640: Add support for swapped speakers

PATCH New Hans de Goede 1 participant 1 message Dec 17, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ucm2: bytcr-rt5640: Add support for swapped speakers

Some BYTCR x86 tablets with a rt5640 codec have their speakers swapped. This is indicated by the kernel by setting cfg-spk:swapped in the components string. Add support for this.

---
 ucm2/Intel/bytcr-rt5640/HiFi.conf | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
ucm2/Intel/bytcr-rt5640/HiFi.conf +28 -0
index fd1906c..7e10db5 100644
@@ -70,6 +70,7 @@ If.spk {
 
 		SectionDevice."Speaker" {
 			EnableSequence [
+				cset "name='DAC IF1 Data Switch' Normal"
 				cset "name='Speaker Switch' on"
 			]
 
@@ -91,6 +92,31 @@ If.mono {
 
 		SectionDevice."Speaker" {
 			EnableSequence [
+				cset "name='DAC IF1 Data Switch' Normal"
+				cset "name='Speaker Switch' on"
+			]
+
+			DisableSequence [
+				cset "name='Speaker Switch' off"
+			]
+		}
+	}
+}
+
+# Note this direcly looks at CardComponents since this is never set
+# by HiFi-LongName.conf
+If.swapped {
+	Condition {
+		Type String
+		Haystack "${CardComponents}"
+		Needle "cfg-spk:swapped"
+	}
+	True {
+		Include.spk.File "/codecs/rt5640/Speaker.conf"
+
+		SectionDevice."Speaker" {
+			EnableSequence [
+				cset "name='DAC IF1 Data Switch' Swap"
 				cset "name='Speaker Switch' on"
 			]
 
@@ -108,6 +134,7 @@ If.hp {
 
 		SectionDevice."Headphones" {
 			EnableSequence [
+				cset "name='DAC IF1 Data Switch' Normal"
 				cset "name='Headphone Switch' on"
 			]
 
@@ -125,6 +152,7 @@ If.hp2 {
 
 		SectionDevice."Headphones2" {
 			EnableSequence [
+				cset "name='DAC IF1 Data Switch' Normal"
 				cset "name='Line Out Switch' on"
 			]
 
Signature · 1 line
2.41.0