lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241016102333.294448-6-yung-chuan.liao@linux.intel.com>
Date: Wed, 16 Oct 2024 18:23:27 +0800
From: Bard Liao <yung-chuan.liao@...ux.intel.com>
To: broonie@...nel.org,
	tiwai@...e.de,
	vkoul@...nel.org
Cc: vinod.koul@...aro.org,
	linux-kernel@...r.kernel.org,
	linux-sound@...r.kernel.org,
	pierre-louis.bossart@...ux.dev,
	bard.liao@...el.com
Subject: [PATCH 05/11] ASoC: SDCA: add quirk function for RT712_VB match

From: Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>

Add a generic match function for quirks, chances are we are going to
have lots of those...

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@...ux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@...ux.intel.com>
---
 include/sound/sdca.h         | 10 ++++++++-
 sound/soc/sdca/sdca_device.c | 43 ++++++++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+), 1 deletion(-)

diff --git a/include/sound/sdca.h b/include/sound/sdca.h
index 34473ca4c789..7e138229e8f3 100644
--- a/include/sound/sdca.h
+++ b/include/sound/sdca.h
@@ -39,16 +39,24 @@ struct sdca_device_data {
 	struct sdca_function_desc sdca_func[SDCA_MAX_FUNCTION_COUNT];
 };
 
+enum sdca_quirk {
+	SDCA_QUIRKS_RT712_VB,
+};
+
 #if IS_ENABLED(CONFIG_ACPI) && IS_ENABLED(CONFIG_SND_SOC_SDCA)
 
 void sdca_lookup_functions(struct sdw_slave *slave);
 void sdca_lookup_interface_revision(struct sdw_slave *slave);
+bool sdca_device_quirk_match(struct sdw_slave *slave, enum sdca_quirk quirk);
 
 #else
 
 static inline void sdca_lookup_functions(struct sdw_slave *slave) {}
 static inline void sdca_lookup_interface_revision(struct sdw_slave *slave) {}
-
+static inline bool sdca_device_quirk_match(struct sdw_slave *slave, enum sdca_quirk quirk)
+{
+	return false;
+}
 #endif
 
 #endif
diff --git a/sound/soc/sdca/sdca_device.c b/sound/soc/sdca/sdca_device.c
index 58f5f6f0f723..c44dc21cb634 100644
--- a/sound/soc/sdca/sdca_device.c
+++ b/sound/soc/sdca/sdca_device.c
@@ -9,6 +9,7 @@
 #include <linux/acpi.h>
 #include <linux/soundwire/sdw.h>
 #include <sound/sdca.h>
+#include <sound/sdca_function.h>
 
 void sdca_lookup_interface_revision(struct sdw_slave *slave)
 {
@@ -22,3 +23,45 @@ void sdca_lookup_interface_revision(struct sdw_slave *slave)
 				 &slave->sdca_data.interface_revision);
 }
 EXPORT_SYMBOL_NS(sdca_lookup_interface_revision, SND_SOC_SDCA);
+
+static bool sdca_device_quirk_rt712_vb(struct sdw_slave *slave)
+{
+	struct sdw_slave_id *id = &slave->id;
+	int i;
+
+	/*
+	 * The RT712_VA relies on the v06r04 draft, and the
+	 * RT712_VB on a more recent v08r01 draft.
+	 */
+	if (slave->sdca_data.interface_revision < 0x0801)
+		return false;
+
+	if (id->mfg_id != 0x025d)
+		return false;
+
+	if (id->part_id != 0x712 &&
+	    id->part_id != 0x713 &&
+	    id->part_id != 0x716 &&
+	    id->part_id != 0x717)
+		return false;
+
+	for (i = 0; i < slave->sdca_data.num_functions; i++) {
+		if (slave->sdca_data.sdca_func[i].type ==
+		    SDCA_FUNCTION_TYPE_SMART_MIC)
+			return true;
+	}
+
+	return false;
+}
+
+bool sdca_device_quirk_match(struct sdw_slave *slave, enum sdca_quirk quirk)
+{
+	switch (quirk) {
+	case SDCA_QUIRKS_RT712_VB:
+		return sdca_device_quirk_rt712_vb(slave);
+	default:
+		break;
+	}
+	return false;
+}
+EXPORT_SYMBOL_NS(sdca_device_quirk_match, SND_SOC_SDCA);
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ