xref: /linux/sound/soc/intel/common/soc-acpi-intel-sdca-quirks.c (revision cdd30ebb1b9f36159d66f088b61aee264e649d7a)
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * soc-acpi-intel-sdca-quirks.c - tables and support for SDCA quirks
4  *
5  * Copyright (c) 2024, Intel Corporation.
6  *
7  */
8 
9 #include <linux/soundwire/sdw_intel.h>
10 #include <sound/sdca.h>
11 #include <sound/soc-acpi.h>
12 #include "soc-acpi-intel-sdca-quirks.h"
13 
14 /*
15  * Pretend machine quirk. The argument type is not the traditional
16  * 'struct snd_soc_acpi_mach' pointer but instead the sdw_intel_ctx
17  * which contains the peripheral information required for the
18  * SoundWire/SDCA filter on the SMART_MIC setup and interface
19  * revision. When the return value is false, the entry in the
20  * 'snd_soc_acpi_mach' table needs to be skipped.
21  */
snd_soc_acpi_intel_sdca_is_device_rt712_vb(void * arg)22 bool snd_soc_acpi_intel_sdca_is_device_rt712_vb(void *arg)
23 {
24 	struct sdw_intel_ctx *ctx = arg;
25 	int i;
26 
27 	if (!ctx)
28 		return false;
29 
30 	for (i = 0; i < ctx->peripherals->num_peripherals; i++) {
31 		if (sdca_device_quirk_match(ctx->peripherals->array[i],
32 					    SDCA_QUIRKS_RT712_VB))
33 			return true;
34 	}
35 
36 	return false;
37 }
38 EXPORT_SYMBOL_NS(snd_soc_acpi_intel_sdca_is_device_rt712_vb, "SND_SOC_ACPI_INTEL_SDCA_QUIRKS");
39 
40 MODULE_DESCRIPTION("ASoC ACPI Intel SDCA quirks");
41 MODULE_LICENSE("GPL");
42 MODULE_IMPORT_NS("SND_SOC_SDCA");
43