xref: /linux/include/sound/sdca.h (revision 572af9f284669d31d9175122bbef9bc62cea8ded)
1 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
2 /*
3  * The MIPI SDCA specification is available for public downloads at
4  * https://www.mipi.org/mipi-sdca-v1-0-download
5  *
6  * Copyright(c) 2024 Intel Corporation
7  */
8 
9 #ifndef __SDCA_H__
10 #define __SDCA_H__
11 
12 struct sdw_slave;
13 
14 #define SDCA_MAX_FUNCTION_COUNT 8
15 
16 /**
17  * sdca_device_desc - short descriptor for an SDCA Function
18  * @adr: ACPI address (used for SDCA register access)
19  * @type: Function topology type
20  * @name: human-readable string
21  */
22 struct sdca_function_desc {
23 	u64 adr;
24 	u32 type;
25 	const char *name;
26 };
27 
28 /**
29  * sdca_device_data - structure containing all SDCA related information
30  * @sdca_interface_revision: value read from _DSD property, mainly to check
31  * for changes between silicon versions
32  * @num_functions: total number of supported SDCA functions. Invalid/unsupported
33  * functions will be skipped.
34  * @sdca_func: array of function descriptors
35  */
36 struct sdca_device_data {
37 	u32 interface_revision;
38 	int num_functions;
39 	struct sdca_function_desc sdca_func[SDCA_MAX_FUNCTION_COUNT];
40 };
41 
42 enum sdca_quirk {
43 	SDCA_QUIRKS_RT712_VB,
44 };
45 
46 #if IS_ENABLED(CONFIG_ACPI) && IS_ENABLED(CONFIG_SND_SOC_SDCA)
47 
48 void sdca_lookup_functions(struct sdw_slave *slave);
49 void sdca_lookup_interface_revision(struct sdw_slave *slave);
50 bool sdca_device_quirk_match(struct sdw_slave *slave, enum sdca_quirk quirk);
51 
52 #else
53 
54 static inline void sdca_lookup_functions(struct sdw_slave *slave) {}
55 static inline void sdca_lookup_interface_revision(struct sdw_slave *slave) {}
56 static inline bool sdca_device_quirk_match(struct sdw_slave *slave, enum sdca_quirk quirk)
57 {
58 	return false;
59 }
60 #endif
61 
62 #endif
63