xref: /wlan-driver/qcacld-3.0/components/fw_offload/dispatcher/inc/cfg_coex.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 /**
21  * DOC: This file contains centralized definitions of converged configuration.
22  */
23 
24 #ifndef __CFG_COEX_H
25 #define __CFG_COEX_H
26 
27 /*
28  * <ini>
29  * gSetBTCMode - Config BTC mode
30  * @Min: 0
31  * @Max: 2
32  * @Default: 0
33  *
34  * 0 - TDD
35  * 1 - FDD
36  * 2 - Hybrid
37  *
38  * Usage: External
39  *
40  * </ini>
41  */
42 #define CFG_BTC_MODE CFG_INI_UINT( \
43 			"gSetBTCMode", \
44 			0, \
45 			2, \
46 			0, \
47 			CFG_VALUE_OR_DEFAULT, \
48 			"BTC mode")
49 
50 /*
51  * <ini>
52  * gSetAntennaIsolation - Set Antenna Isolation
53  * @Min: 0
54  * @Max: 255
55  * @Default: 25
56  *
57  * Usage: External
58  *
59  * </ini>
60  */
61 #define CFG_ANTENNA_ISOLATION CFG_INI_UINT( \
62 			"gSetAntennaIsolation", \
63 			0, \
64 			255, \
65 			25, \
66 			CFG_VALUE_OR_DEFAULT, \
67 			"Antenna Isolation")
68 
69 /*
70  * <ini>
71  * gSetMaxTxPowerForBTC - Set Max WLAN Tx power in COEX scenario
72  * @Min: 0
73  * @Max: 100
74  * @Default: 100
75  *
76  * Usage: External
77  *
78  * </ini>
79  */
80 #define CFG_MAX_TX_POWER_FOR_BTC CFG_INI_UINT( \
81 			"gSetMaxTxPowerForBTC", \
82 			0, \
83 			100, \
84 			100, \
85 			CFG_VALUE_OR_DEFAULT, \
86 			"Max Tx Power for BTC")
87 
88 /*
89  * <ini>
90  * gSetWlanLowRssiThreshold - Set WLAN low RSSI threshold for BTC mode switching
91  * @Min: -100
92  * @Max: 0
93  * @Default: -80
94  *
95  * Usage: External
96  *
97  * </ini>
98  */
99 #define CFG_WLAN_LOW_RSSI_THRESHOLD CFG_INI_INT( \
100 			"gSetWlanLowRssiThreshold", \
101 			-100, \
102 			0, \
103 			-80, \
104 			CFG_VALUE_OR_DEFAULT, \
105 			"WLAN Low RSSI Threshold")
106 
107 /*
108  * <ini>
109  * gSetBtLowRssiThreshold - Set BT low RSSI threshold for BTC mode switching
110  * @Min: -100
111  * @Max: 0
112  * @Default: -65
113  *
114  * Usage: External
115  *
116  * </ini>
117  */
118 #define CFG_BT_LOW_RSSI_THRESHOLD CFG_INI_INT( \
119 			"gSetBtLowRssiThreshold", \
120 			-100, \
121 			0, \
122 			-65, \
123 			CFG_VALUE_OR_DEFAULT, \
124 			"BT Low RSSI Threshold")
125 
126 /*
127  * <ini>
128  * gSetBtInterferenceLowLL - Set lower limit of low level BT interference
129  * @Min: -100
130  * @Max: 100
131  * @Default: -25
132  *
133  * Usage: External
134  *
135  * </ini>
136  */
137 #define CFG_BT_INTERFERENCE_LOW_LL CFG_INI_INT( \
138 			"gSetBtInterferenceLowLL", \
139 			-100, \
140 			100, \
141 			-25, \
142 			CFG_VALUE_OR_DEFAULT, \
143 			"BT Interference Low LL")
144 
145 /*
146  * <ini>
147  * gSetBtInterferenceLowUL - Set upper limit of low level BT interference
148  * @Min: -100
149  * @Max: 100
150  * @Default: -21
151  *
152  * Usage: External
153  *
154  * </ini>
155  */
156 #define CFG_BT_INTERFERENCE_LOW_UL CFG_INI_INT( \
157 			"gSetBtInterferenceLowUL", \
158 			-100, \
159 			100, \
160 			-21, \
161 			CFG_VALUE_OR_DEFAULT, \
162 			"BT Interference Low UL")
163 
164 /*
165  * <ini>
166  * gSetBtInterferenceMediumLL - Set lower limit of medium level BT interference
167  * @Min: -100
168  * @Max: 100
169  * @Default: -20
170  *
171  * Usage: External
172  *
173  * </ini>
174  */
175 #define CFG_BT_INTERFERENCE_MEDIUM_LL CFG_INI_INT( \
176 			"gSetBtInterferenceMediumLL", \
177 			-100, \
178 			100, \
179 			-20, \
180 			CFG_VALUE_OR_DEFAULT, \
181 			"BT Interference Medium LL")
182 
183 /*
184  * <ini>
185  * gSetBtInterferenceMediumUL - Set upper limit of medium level BT interference
186  * @Min: -100
187  * @Max: 100
188  * @Default: -16
189  *
190  * Usage: External
191  *
192  * </ini>
193  */
194 #define CFG_BT_INTERFERENCE_MEDIUM_UL CFG_INI_INT( \
195 			"gSetBtInterferenceMediumUL", \
196 			-100, \
197 			100, \
198 			-16, \
199 			CFG_VALUE_OR_DEFAULT, \
200 			"BT Interference Medium UL")
201 
202 /*
203  * <ini>
204  * gSetBtInterferenceHighLL - Set lower limit of high level BT interference
205  * @Min: -100
206  * @Max: 100
207  * @Default: -15
208  *
209  * Usage: External
210  *
211  * </ini>
212  */
213 #define CFG_BT_INTERFERENCE_HIGH_LL CFG_INI_INT( \
214 			"gSetBtInterferenceHighLL", \
215 			-100, \
216 			100, \
217 			-15, \
218 			CFG_VALUE_OR_DEFAULT, \
219 			"BT Interference High LL")
220 
221 /*
222  * <ini>
223  * gSetBtInterferenceHighUL - Set upper limit of high level BT interference
224  * @Min: -100
225  * @Max: 100
226  * @Default: -11
227  *
228  * Usage: External
229  *
230  * </ini>
231  */
232 #define CFG_BT_INTERFERENCE_HIGH_UL CFG_INI_INT( \
233 			"gSetBtInterferenceHighUL", \
234 			-100, \
235 			100, \
236 			-11, \
237 			CFG_VALUE_OR_DEFAULT, \
238 			"BT Interference High UL")
239 
240 #ifdef FEATURE_MPTA_HELPER
241 /*
242  * <ini>
243  * gMPTAHelperEnable - Enable MPTA Helper
244  * @Min: 0
245  * @Max: 1
246  * @Default: 0
247  *
248  * This ini is used to enable or disable coex MPTA Helper.
249  *
250  * Usage: External
251  *
252  * </ini>
253  */
254 #define CFG_COEX_MPTA_HELPER CFG_INI_BOOL( \
255 		"gMPTAHelperEnable", \
256 		0, \
257 		"Enable/Disable MPTA Helper")
258 
259 #define COEX_MPTA_HELPER_CFG CFG(CFG_COEX_MPTA_HELPER)
260 #else
261 #define COEX_MPTA_HELPER_CFG
262 #endif
263 
264 /*
265  * <ini>
266  * gBtScoAllowWlan2GScan - Allow wlan 2g scan when BT SCO connection is on
267  * @Min: 0
268  * @Max: 1
269  * @Default: 1
270  *
271  * 0 - Disable
272  * 1 - Enable
273  *
274  * This ini is used to enable or disable wlan 2g scan
275  * when BT SCO connection is on.
276  *
277  * Usage: External
278  *
279  * </ini>
280  */
281 #define CFG_BT_SCO_ALLOW_WLAN_2G_SCAN CFG_INI_BOOL( \
282 		"gBtScoAllowWlan2GScan", \
283 		1, \
284 		"Bt Sco Allow Wlan 2G Scan")
285 
286 /*
287  * <ini>
288  * ble_scan_coex_policy - Ini to configure coex policy
289  * @Min: 0
290  * @Max: 1
291  * @Default: 0
292  *
293  * 0 - Better BLE Advertiser reception performance
294  * 1 - Better WLAN performance
295  *
296  * This ini is used to control the performance of ble scan case,’0’ to place
297  * more emphasis on BLE Scan results , ‘1’ to place more emphasis on WLAN
298  * performance
299  *
300  * Usage: External
301  *
302  * </ini>
303  */
304 #define CFG_BLE_SCAN_COEX_POLICY CFG_INI_BOOL( \
305 		"ble_scan_coex_policy", \
306 		0, \
307 		"BLE scan Coex policy")
308 
309 #ifdef FEATURE_COEX_CONFIG
310 /*
311  * <ini>
312  * gThreeWayCoexConfigLegacyEnable - Enable coex config legacy feature
313  * @Min: 0
314  * @Max: 1
315  * @Default: 0
316  *
317  * This ini is used to enable or disable three way coex config legacy feature.
318  * This feature is designed only for non-mobile solution.
319  * When the feature is disabled, Firmware use the default configuration to
320  * set the coex priority of three antenna(WLAN, BT, ZIGBEE).
321  * when enable this feature, customer can use the vendor command to set antenna
322  * coex priority dynamically.
323  *
324  * Supported Feature: three way coex config
325  *
326  * Usage: External
327  *
328  * </ini>
329  */
330 #define CFG_THREE_WAY_COEX_CONFIG_LEGACY CFG_INI_BOOL( \
331 		"gThreeWayCoexConfigLegacyEnable", \
332 		0, \
333 		"Enable/Disable COEX Config Legacy")
334 
335 #define THREE_WAY_COEX_CONFIG_LEGACY_CFG CFG(CFG_THREE_WAY_COEX_CONFIG_LEGACY)
336 #else
337 #define THREE_WAY_COEX_CONFIG_LEGACY_CFG
338 #endif
339 
340 #ifdef FEATURE_BTC_CHAIN_MODE
341 /*
342  * <ini>
343  * gSetInitChainModeForBTC - Used to set init chain mode for BTC
344  * @Min: 0
345  * @Max: 0xFF
346  * @Default: 0xFF
347  *
348  * This ini is used to set init chain mode for BTC, default value
349  * should be set to the same as macro WLAN_COEX_BTC_CHAIN_MODE_UNSETTLED(0xFF),
350  * only below values can be set:
351  * 0 - init WLAN 2.4G to support 2x2.
352  *     It means chains of BT and WLAN 2.4G are shared, or BT is OFF.
353  * 1 - init WLAN 2.4G as 1x1, chains of BT and WLAN 2.4G are separated,
354  *     fixed FDD.
355  * 2 - init WLAN 2.4G as 1x1, chains of BT and WLAN 2.4G are separated,
356  *     hybrid mode
357  * 0xFF - no need to send init chain mode for BTC to firmware.
358  *
359  * Supported Feature: init chain mode for BTC
360  *
361  * Usage: External
362  *
363  * </ini>
364  */
365 #define CFG_SET_INIT_CHAIN_MODE_FOR_BTC CFG_INI_UINT( \
366 		"gSetInitChainModeForBTC", \
367 		0, \
368 		0xFF, \
369 		0xFF, \
370 		CFG_VALUE_OR_DEFAULT, \
371 		"Init Chain Mode For BTC")
372 
373 #define SET_INIT_CHAIN_MODE_FOR_BTC_CFG CFG(CFG_SET_INIT_CHAIN_MODE_FOR_BTC)
374 #else
375 #define SET_INIT_CHAIN_MODE_FOR_BTC_CFG
376 #endif
377 
378 #ifdef FEATURE_COEX_TPUT_SHAPING_CONFIG
379 /*
380  * <ini>
381  * coex_tput_shaping_enable - Ini to enable wifi configure traffic shaping
382  * @Min: 0
383  * @Max: 1
384  * @Default: 0
385  *
386  * 0 - traffic shaping is disable
387  * 1 - traffic shaping is enable
388  *
389  * This ini is used to enable and disable wifi traffic shaping
390  *
391  * Usage: External
392  *
393  * </ini>
394  */
395 #define CFG_TPUT_SHAPING_ENABLE CFG_INI_BOOL( \
396 		"coex_tput_shaping_enable", \
397 		0, \
398 		"coex_tput_shaping_enable")
399 #define TPUT_SHAPING_ENABLE_CFG CFG(CFG_TPUT_SHAPING_ENABLE)
400 #else
401 #define TPUT_SHAPING_ENABLE_CFG
402 #endif
403 
404 #define CFG_COEX_ALL \
405 	CFG(CFG_BTC_MODE) \
406 	CFG(CFG_ANTENNA_ISOLATION) \
407 	CFG(CFG_MAX_TX_POWER_FOR_BTC) \
408 	CFG(CFG_WLAN_LOW_RSSI_THRESHOLD) \
409 	CFG(CFG_BT_LOW_RSSI_THRESHOLD) \
410 	CFG(CFG_BT_INTERFERENCE_LOW_LL) \
411 	CFG(CFG_BT_INTERFERENCE_LOW_UL) \
412 	CFG(CFG_BT_INTERFERENCE_MEDIUM_LL) \
413 	CFG(CFG_BT_INTERFERENCE_MEDIUM_UL) \
414 	CFG(CFG_BT_INTERFERENCE_HIGH_LL) \
415 	CFG(CFG_BT_INTERFERENCE_HIGH_UL) \
416 	COEX_MPTA_HELPER_CFG \
417 	CFG(CFG_BT_SCO_ALLOW_WLAN_2G_SCAN) \
418 	THREE_WAY_COEX_CONFIG_LEGACY_CFG \
419 	SET_INIT_CHAIN_MODE_FOR_BTC_CFG \
420 	CFG(CFG_BLE_SCAN_COEX_POLICY) \
421 	TPUT_SHAPING_ENABLE_CFG
422 #endif
423