diff mbox series

[alsa-ucm-conf] chtrt5645: Add support for the components string

Message ID 20231126213544.300300-1-hdegoede@redhat.com
State New
Headers show
Series [alsa-ucm-conf] chtrt5645: Add support for the components string | expand

Commit Message

Hans de Goede Nov. 26, 2023, 9:35 p.m. UTC
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.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 ucm2/Intel/chtrt5645/HiFi.conf | 35 ++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
diff mbox series

Patch

diff --git a/ucm2/Intel/chtrt5645/HiFi.conf b/ucm2/Intel/chtrt5645/HiFi.conf
index 30fad50..f8dcbf5 100644
--- a/ucm2/Intel/chtrt5645/HiFi.conf
+++ b/ucm2/Intel/chtrt5645/HiFi.conf
@@ -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