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