diff options
author | Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> | 2024-10-16 18:23:27 +0800 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2024-10-17 18:42:13 +0100 |
commit | fdb220399177177917dce52063b326a191a35a02 (patch) | |
tree | 746c0c51630d8ed3d20205e288e7e3397dc94086 /sound/soc/sdca | |
parent | 0c673d2862534955241f339d7331f384b5ea44af (diff) |
ASoC: SDCA: add quirk function for RT712_VB match
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@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://patch.msgid.link/20241016102333.294448-6-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sdca')
-rw-r--r-- | sound/soc/sdca/sdca_device.c | 43 |
1 files changed, 43 insertions, 0 deletions
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); |