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 #include <linux/types.h> 13 #include <linux/kconfig.h> 14 15 struct acpi_table_swft; 16 struct sdw_slave; 17 18 #define SDCA_MAX_FUNCTION_COUNT 8 19 20 /** 21 * struct sdca_function_desc - short descriptor for an SDCA Function 22 * @node: firmware node for the Function. 23 * @name: Human-readable string. 24 * @type: Function topology type. 25 * @adr: ACPI address (used for SDCA register access). 26 */ 27 struct sdca_function_desc { 28 struct fwnode_handle *node; 29 const char *name; 30 u32 type; 31 u8 adr; 32 }; 33 34 /** 35 * struct sdca_device_data - structure containing all SDCA related information 36 * @interface_revision: Value read from _DSD property, mainly to check 37 * for changes between silicon versions. 38 * @num_functions: Total number of supported SDCA functions. Invalid/unsupported 39 * functions will be skipped. 40 * @function: Array of function descriptors. 41 * @swft: Pointer to the SWFT table, if available. 42 */ 43 struct sdca_device_data { 44 u32 interface_revision; 45 int num_functions; 46 struct sdca_function_desc function[SDCA_MAX_FUNCTION_COUNT]; 47 struct acpi_table_swft *swft; 48 }; 49 50 enum sdca_quirk { 51 SDCA_QUIRKS_RT712_VB, 52 SDCA_QUIRKS_SKIP_FUNC_TYPE_PATCHING, 53 }; 54 55 #if IS_ENABLED(CONFIG_ACPI) && IS_ENABLED(CONFIG_SND_SOC_SDCA) 56 57 void sdca_lookup_functions(struct sdw_slave *slave); 58 void sdca_lookup_swft(struct sdw_slave *slave); 59 void sdca_lookup_interface_revision(struct sdw_slave *slave); 60 bool sdca_device_quirk_match(struct sdw_slave *slave, enum sdca_quirk quirk); 61 62 #else 63 64 static inline void sdca_lookup_functions(struct sdw_slave *slave) {} 65 static inline void sdca_lookup_swft(struct sdw_slave *slave) {} 66 static inline void sdca_lookup_interface_revision(struct sdw_slave *slave) {} 67 static inline bool sdca_device_quirk_match(struct sdw_slave *slave, enum sdca_quirk quirk) 68 { 69 return false; 70 } 71 #endif 72 73 #endif 74