Skip to contentSkip to conversation

chtrt5645: Add support for the components string

PATCH New Hans de Goede 1 participant 1 message Nov 26, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 chtrt5645: Add support for the components string

Upcoming kernel versions will report which speaker and dmic config is used by the device in a components strings so that we don't need to duplicate the DMI quirks in both the kernel and the UCM profile.

Add support for getting the speaker and dmic config from the components string.

Note the old DMI matching is kept for support of older kernels, this means that on devices where the old DMI matching was used things like:

Define.MonoSpeaker "Yes"

Will now be done twice, this is harmless as long as the kernel and UCM profile DMI quirks are in sync, which they are.

---
 ucm2/Intel/chtrt5645/HiFi.conf | 35 ++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
ucm2/Intel/chtrt5645/HiFi.conf +35 -0
index 30fad50..f8dcbf5 100644
@@ -2,6 +2,41 @@ Define.MonoSpeaker ""
 Define.AnalogMic "yes"
 Define.DigitalMic ""
 
+If.components-dmic1 {
+	Condition {
+		Type String
+		Haystack "${CardComponents}"
+		Needle "cfg-mic:dmic1"
+	}
+	True {
+		Define.AnalogMic ""
+		Define.DigitalMic "DMIC1"
+	}
+}
+
+If.components-dmic2 {
+	Condition {
+		Type String
+		Haystack "${CardComponents}"
+		Needle "cfg-mic:dmic2"
+	}
+	True {
+		Define.AnalogMic ""
+		Define.DigitalMic "DMIC2"
+	}
+}
+
+If.components-mspk {
+	Condition {
+		Type String
+		Haystack "${CardComponents}"
+		Needle "cfg-spk:1"
+	}
+	True {
+		Define.MonoSpeaker "yes"
+	}
+}
+
 If.cfg-dmic1 {
 	Condition {
 		Type RegexMatch
Signature · 1 line
2.41.0