WIP FPC-III support
[linux/fpc-iii.git] / drivers / net / wireless / intel / iwlwifi / fw / acpi.h
blob042dd247d387d7dbe047d400898cf638f52fad37
1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2 /*
3 * Copyright (C) 2017 Intel Deutschland GmbH
4 * Copyright (C) 2018-2020 Intel Corporation
5 */
6 #ifndef __iwl_fw_acpi__
7 #define __iwl_fw_acpi__
9 #include <linux/acpi.h>
10 #include "fw/api/commands.h"
11 #include "fw/api/power.h"
12 #include "fw/api/phy.h"
13 #include "fw/api/nvm-reg.h"
14 #include "fw/img.h"
15 #include "iwl-trans.h"
18 #define ACPI_WRDS_METHOD "WRDS"
19 #define ACPI_EWRD_METHOD "EWRD"
20 #define ACPI_WGDS_METHOD "WGDS"
21 #define ACPI_WRDD_METHOD "WRDD"
22 #define ACPI_SPLC_METHOD "SPLC"
23 #define ACPI_ECKV_METHOD "ECKV"
24 #define ACPI_PPAG_METHOD "PPAG"
25 #define ACPI_WTAS_METHOD "WTAS"
27 #define ACPI_WIFI_DOMAIN (0x07)
29 #define ACPI_SAR_TABLE_SIZE 10
30 #define ACPI_SAR_PROFILE_NUM 4
32 #define ACPI_GEO_TABLE_SIZE 6
33 #define ACPI_NUM_GEO_PROFILES 3
34 #define ACPI_GEO_PER_CHAIN_SIZE 3
36 #define ACPI_SAR_NUM_CHAIN_LIMITS 2
37 #define ACPI_SAR_NUM_SUB_BANDS 5
38 #define ACPI_SAR_NUM_TABLES 1
40 #define ACPI_WRDS_WIFI_DATA_SIZE (ACPI_SAR_TABLE_SIZE + 2)
41 #define ACPI_EWRD_WIFI_DATA_SIZE ((ACPI_SAR_PROFILE_NUM - 1) * \
42 ACPI_SAR_TABLE_SIZE + 3)
43 #define ACPI_WGDS_WIFI_DATA_SIZE 19
44 #define ACPI_WRDD_WIFI_DATA_SIZE 2
45 #define ACPI_SPLC_WIFI_DATA_SIZE 2
46 #define ACPI_ECKV_WIFI_DATA_SIZE 2
49 * 1 type, 1 enabled, 1 block list size, 16 block list array
51 #define APCI_WTAS_BLACK_LIST_MAX 16
52 #define ACPI_WTAS_WIFI_DATA_SIZE (3 + APCI_WTAS_BLACK_LIST_MAX)
54 #define ACPI_WGDS_TABLE_SIZE 3
56 #define ACPI_PPAG_WIFI_DATA_SIZE ((IWL_NUM_CHAIN_LIMITS * \
57 IWL_NUM_SUB_BANDS) + 3)
58 #define ACPI_PPAG_WIFI_DATA_SIZE_V2 ((IWL_NUM_CHAIN_LIMITS * \
59 IWL_NUM_SUB_BANDS_V2) + 3)
61 /* PPAG gain value bounds in 1/8 dBm */
62 #define ACPI_PPAG_MIN_LB -16
63 #define ACPI_PPAG_MAX_LB 24
64 #define ACPI_PPAG_MIN_HB -16
65 #define ACPI_PPAG_MAX_HB 40
67 struct iwl_sar_profile {
68 bool enabled;
69 u8 table[ACPI_SAR_TABLE_SIZE];
72 struct iwl_geo_profile {
73 u8 values[ACPI_GEO_TABLE_SIZE];
76 enum iwl_dsm_funcs_rev_0 {
77 DSM_FUNC_QUERY = 0,
78 DSM_FUNC_DISABLE_SRD = 1,
79 DSM_FUNC_ENABLE_INDONESIA_5G2 = 2,
82 enum iwl_dsm_values_srd {
83 DSM_VALUE_SRD_ACTIVE,
84 DSM_VALUE_SRD_PASSIVE,
85 DSM_VALUE_SRD_DISABLE,
86 DSM_VALUE_SRD_MAX
89 enum iwl_dsm_values_indonesia {
90 DSM_VALUE_INDONESIA_DISABLE,
91 DSM_VALUE_INDONESIA_ENABLE,
92 DSM_VALUE_INDONESIA_RESERVED,
93 DSM_VALUE_INDONESIA_MAX
96 #ifdef CONFIG_ACPI
98 struct iwl_fw_runtime;
100 void *iwl_acpi_get_object(struct device *dev, acpi_string method);
102 int iwl_acpi_get_dsm_u8(struct device *dev, int rev, int func);
104 union acpi_object *iwl_acpi_get_wifi_pkg(struct device *dev,
105 union acpi_object *data,
106 int data_size, int *tbl_rev);
109 * iwl_acpi_get_mcc - read MCC from ACPI, if available
111 * @dev: the struct device
112 * @mcc: output buffer (3 bytes) that will get the MCC
114 * This function tries to read the current MCC from ACPI if available.
116 int iwl_acpi_get_mcc(struct device *dev, char *mcc);
118 u64 iwl_acpi_get_pwr_limit(struct device *dev);
121 * iwl_acpi_get_eckv - read external clock validation from ACPI, if available
123 * @dev: the struct device
124 * @extl_clk: output var (2 bytes) that will get the clk indication.
126 * This function tries to read the external clock indication
127 * from ACPI if available.
129 int iwl_acpi_get_eckv(struct device *dev, u32 *extl_clk);
131 int iwl_sar_select_profile(struct iwl_fw_runtime *fwrt,
132 __le16 *per_chain, u32 n_tables, u32 n_subbands,
133 int prof_a, int prof_b);
135 int iwl_sar_get_wrds_table(struct iwl_fw_runtime *fwrt);
137 int iwl_sar_get_ewrd_table(struct iwl_fw_runtime *fwrt);
139 int iwl_sar_get_wgds_table(struct iwl_fw_runtime *fwrt);
141 bool iwl_sar_geo_support(struct iwl_fw_runtime *fwrt);
143 int iwl_sar_geo_init(struct iwl_fw_runtime *fwrt,
144 struct iwl_per_chain_offset *table, u32 n_bands);
146 int iwl_acpi_get_tas(struct iwl_fw_runtime *fwrt, __le32 *block_list_array,
147 int *block_list_size);
149 #else /* CONFIG_ACPI */
151 static inline void *iwl_acpi_get_object(struct device *dev, acpi_string method)
153 return ERR_PTR(-ENOENT);
156 static inline void *iwl_acpi_get_dsm_object(struct device *dev, int rev,
157 int func, union acpi_object *args)
159 return ERR_PTR(-ENOENT);
162 static inline int iwl_acpi_get_dsm_u8(struct device *dev, int rev, int func)
164 return -ENOENT;
167 static inline union acpi_object *iwl_acpi_get_wifi_pkg(struct device *dev,
168 union acpi_object *data,
169 int data_size,
170 int *tbl_rev)
172 return ERR_PTR(-ENOENT);
175 static inline int iwl_acpi_get_mcc(struct device *dev, char *mcc)
177 return -ENOENT;
180 static inline u64 iwl_acpi_get_pwr_limit(struct device *dev)
182 return 0;
185 static inline int iwl_acpi_get_eckv(struct device *dev, u32 *extl_clk)
187 return -ENOENT;
190 static inline int iwl_sar_select_profile(struct iwl_fw_runtime *fwrt,
191 __le16 *per_chain, u32 n_tables, u32 n_subbands,
192 int prof_a, int prof_b)
194 return -ENOENT;
197 static inline int iwl_sar_get_wrds_table(struct iwl_fw_runtime *fwrt)
199 return -ENOENT;
202 static inline int iwl_sar_get_ewrd_table(struct iwl_fw_runtime *fwrt)
204 return -ENOENT;
207 static inline int iwl_sar_get_wgds_table(struct iwl_fw_runtime *fwrt)
209 return -ENOENT;
212 static inline bool iwl_sar_geo_support(struct iwl_fw_runtime *fwrt)
214 return false;
217 static inline int iwl_acpi_get_tas(struct iwl_fw_runtime *fwrt,
218 __le32 *block_list_array,
219 int *block_list_size)
221 return -ENOENT;
223 #endif /* CONFIG_ACPI */
224 #endif /* __iwl_fw_acpi__ */