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