OSDN Git Service

cht-bsw-rt5672: Add support for the components string
authorHans de Goede <hdegoede@redhat.com>
Fri, 7 May 2021 13:11:37 +0000 (15:11 +0200)
committerJaroslav Kysela <perex@perex.cz>
Tue, 18 May 2021 16:19:15 +0000 (18:19 +0200)
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 ""

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>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
ucm2/cht-bsw-rt5672/HiFi.conf

index 5e5f78f..41828ef 100644 (file)
@@ -7,7 +7,40 @@ Define.DigitalMic1 "yes"
 Define.DigitalMic2 "yes"
 Define.HeadsetMic "yes"
 
-If.cfg-dmic1 {
+# Figure out which components are in use on the device, we check both the
+# components string (present on newer kernels) as well as checking for DMI
+# strings for compatibility with older kernels. Note DMI matches for new
+# models should only be added to the kernel, this UCM profile will then
+# automatically pick up the info from the components string.
+
+If.components-stereo-spk {
+       Condition {
+               Type String
+               Haystack "${CardComponents}"
+               Needle "cfg-spk:2"
+       }
+       True.Define.MonoSpeaker ""
+}
+
+If.components-dmic1 {
+       Condition {
+               Type String
+               Haystack "${CardComponents}"
+               Needle "cfg-mic:dmic1"
+       }
+       True.Define.DigitalMic2 ""
+}
+
+If.components-dmic2 {
+       Condition {
+               Type String
+               Haystack "${CardComponents}"
+               Needle "cfg-mic:dmic2"
+       }
+       True.Define.DigitalMic1 ""
+}
+
+If.dmi-dmic1 {
        Condition {
                Type RegexMatch
                String "${CardLongName}"
@@ -19,7 +52,7 @@ If.cfg-dmic1 {
        }
 }
 
-If.cfg-dmic2 {
+If.dmi-dmic2 {
        Condition {
                Type RegexMatch
                String "${CardLongName}"