All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Jaroslav Kysela <perex@perex.cz>
Cc: Hans de Goede <hdegoede@redhat.com>,
	alsa-devel@alsa-project.org,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	Bard Liao <bard.liao@intel.com>
Subject: [PATCH alsa-ucm-conf 1/1] cht-bsw-rt5672: Add support for the components string
Date: Sun,  4 Apr 2021 09:45:21 +0200	[thread overview]
Message-ID: <20210404074521.3709-2-hdegoede@redhat.com> (raw)
In-Reply-To: <20210404074521.3709-1-hdegoede@redhat.com>

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>
---
 ucm2/cht-bsw-rt5672/HiFi.conf | 37 +++++++++++++++++++++++++++++++++--
 1 file changed, 35 insertions(+), 2 deletions(-)

diff --git a/ucm2/cht-bsw-rt5672/HiFi.conf b/ucm2/cht-bsw-rt5672/HiFi.conf
index 5e5f78f..41828ef 100644
--- a/ucm2/cht-bsw-rt5672/HiFi.conf
+++ b/ucm2/cht-bsw-rt5672/HiFi.conf
@@ -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}"
-- 
2.30.2


      reply	other threads:[~2021-04-04  7:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-04  7:45 [PATCH alsa-ucm-conf 0/1] cht-bsw-rt5672: Add support for the components string Hans de Goede
2021-04-04  7:45 ` Hans de Goede [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210404074521.3709-2-hdegoede@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=bard.liao@intel.com \
    --cc=perex@perex.cz \
    --cc=pierre-louis.bossart@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.