• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 2007-2013  Realtek Corporation.*/
3 
4 #include "halbt_precomp.h"
5 
6 /***************************************************
7  *		Debug related function
8  ***************************************************/
9 
10 static const char *const gl_btc_wifi_bw_string[] = {
11 	"11bg",
12 	"HT20",
13 	"HT40",
14 	"HT80",
15 	"HT160"
16 };
17 
18 static const char *const gl_btc_wifi_freq_string[] = {
19 	"2.4G",
20 	"5G"
21 };
22 
halbtc_is_bt_coexist_available(struct btc_coexist * btcoexist)23 static bool halbtc_is_bt_coexist_available(struct btc_coexist *btcoexist)
24 {
25 	if (!btcoexist->binded || NULL == btcoexist->adapter)
26 		return false;
27 
28 	return true;
29 }
30 
halbtc_is_wifi_busy(struct rtl_priv * rtlpriv)31 static bool halbtc_is_wifi_busy(struct rtl_priv *rtlpriv)
32 {
33 	if (rtlpriv->link_info.busytraffic)
34 		return true;
35 	else
36 		return false;
37 }
38 
halbtc_dbg_init(void)39 static void halbtc_dbg_init(void)
40 {
41 }
42 
43 /***************************************************
44  *		helper function
45  ***************************************************/
is_any_client_connect_to_ap(struct btc_coexist * btcoexist)46 static bool is_any_client_connect_to_ap(struct btc_coexist *btcoexist)
47 {
48 	struct rtl_priv *rtlpriv = btcoexist->adapter;
49 	struct rtl_mac *mac = rtl_mac(rtlpriv);
50 	struct rtl_sta_info *drv_priv;
51 	u8 cnt = 0;
52 
53 	if (mac->opmode == NL80211_IFTYPE_ADHOC ||
54 	    mac->opmode == NL80211_IFTYPE_MESH_POINT ||
55 	    mac->opmode == NL80211_IFTYPE_AP) {
56 		if (in_interrupt() > 0) {
57 			list_for_each_entry(drv_priv, &rtlpriv->entry_list,
58 					    list) {
59 				cnt++;
60 			}
61 		} else {
62 			spin_lock_bh(&rtlpriv->locks.entry_list_lock);
63 			list_for_each_entry(drv_priv, &rtlpriv->entry_list,
64 					    list) {
65 				cnt++;
66 			}
67 			spin_unlock_bh(&rtlpriv->locks.entry_list_lock);
68 		}
69 	}
70 	if (cnt > 0)
71 		return true;
72 	else
73 		return false;
74 }
75 
halbtc_legacy(struct rtl_priv * adapter)76 static bool halbtc_legacy(struct rtl_priv *adapter)
77 {
78 	struct rtl_priv *rtlpriv = adapter;
79 	struct rtl_mac *mac = rtl_mac(rtlpriv);
80 
81 	bool is_legacy = false;
82 
83 	if ((mac->mode == WIRELESS_MODE_B) || (mac->mode == WIRELESS_MODE_G))
84 		is_legacy = true;
85 
86 	return is_legacy;
87 }
88 
halbtc_is_wifi_uplink(struct rtl_priv * adapter)89 bool halbtc_is_wifi_uplink(struct rtl_priv *adapter)
90 {
91 	struct rtl_priv *rtlpriv = adapter;
92 
93 	if (rtlpriv->link_info.tx_busy_traffic)
94 		return true;
95 	else
96 		return false;
97 }
98 
halbtc_get_wifi_bw(struct btc_coexist * btcoexist)99 static u32 halbtc_get_wifi_bw(struct btc_coexist *btcoexist)
100 {
101 	struct rtl_priv *rtlpriv = btcoexist->adapter;
102 	struct rtl_phy *rtlphy = &rtlpriv->phy;
103 	u32 wifi_bw = BTC_WIFI_BW_HT20;
104 
105 	if (halbtc_legacy(rtlpriv)) {
106 		wifi_bw = BTC_WIFI_BW_LEGACY;
107 	} else {
108 		switch (rtlphy->current_chan_bw) {
109 		case HT_CHANNEL_WIDTH_20:
110 			wifi_bw = BTC_WIFI_BW_HT20;
111 			break;
112 		case HT_CHANNEL_WIDTH_20_40:
113 			wifi_bw = BTC_WIFI_BW_HT40;
114 			break;
115 		case HT_CHANNEL_WIDTH_80:
116 			wifi_bw = BTC_WIFI_BW_HT80;
117 			break;
118 		}
119 	}
120 
121 	return wifi_bw;
122 }
123 
halbtc_get_wifi_central_chnl(struct btc_coexist * btcoexist)124 static u8 halbtc_get_wifi_central_chnl(struct btc_coexist *btcoexist)
125 {
126 	struct rtl_priv *rtlpriv = btcoexist->adapter;
127 	struct rtl_phy	*rtlphy = &(rtlpriv->phy);
128 	u8 chnl = 1;
129 
130 	if (rtlphy->current_channel != 0)
131 		chnl = rtlphy->current_channel;
132 	RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
133 		 "static halbtc_get_wifi_central_chnl:%d\n", chnl);
134 	return chnl;
135 }
136 
rtl_get_hwpg_single_ant_path(struct rtl_priv * rtlpriv)137 static u8 rtl_get_hwpg_single_ant_path(struct rtl_priv *rtlpriv)
138 {
139 	return rtlpriv->btcoexist.btc_info.single_ant_path;
140 }
141 
rtl_get_hwpg_bt_type(struct rtl_priv * rtlpriv)142 static u8 rtl_get_hwpg_bt_type(struct rtl_priv *rtlpriv)
143 {
144 	return rtlpriv->btcoexist.btc_info.bt_type;
145 }
146 
rtl_get_hwpg_ant_num(struct rtl_priv * rtlpriv)147 static u8 rtl_get_hwpg_ant_num(struct rtl_priv *rtlpriv)
148 {
149 	u8 num;
150 
151 	if (rtlpriv->btcoexist.btc_info.ant_num == ANT_X2)
152 		num = 2;
153 	else
154 		num = 1;
155 
156 	return num;
157 }
158 
rtl_get_hwpg_package_type(struct rtl_priv * rtlpriv)159 static u8 rtl_get_hwpg_package_type(struct rtl_priv *rtlpriv)
160 {
161 	struct rtl_hal *rtlhal = rtl_hal(rtlpriv);
162 
163 	return rtlhal->package_type;
164 }
165 
166 static
rtl_get_hwpg_rfe_type(struct rtl_priv * rtlpriv)167 u8 rtl_get_hwpg_rfe_type(struct rtl_priv *rtlpriv)
168 {
169 	struct rtl_hal *rtlhal = rtl_hal(rtlpriv);
170 
171 	return rtlhal->rfe_type;
172 }
173 
174 static
halbtc_is_hw_mailbox_exist(struct btc_coexist * btcoexist)175 bool halbtc_is_hw_mailbox_exist(struct btc_coexist *btcoexist)
176 {
177 	if (IS_HARDWARE_TYPE_8812(btcoexist->adapter))
178 		return false;
179 	else
180 		return true;
181 }
182 
183 static
halbtc_send_bt_mp_operation(struct btc_coexist * btcoexist,u8 op_code,u8 * cmd,u32 len,unsigned long wait_ms)184 bool halbtc_send_bt_mp_operation(struct btc_coexist *btcoexist, u8 op_code,
185 				 u8 *cmd, u32 len, unsigned long wait_ms)
186 {
187 	struct rtl_priv *rtlpriv;
188 	const u8 oper_ver = 0;
189 	u8 req_num;
190 
191 	if (!halbtc_is_hw_mailbox_exist(btcoexist))
192 		return false;
193 
194 	if (wait_ms)	/* before h2c to avoid race condition */
195 		reinit_completion(&btcoexist->bt_mp_comp);
196 
197 	rtlpriv = btcoexist->adapter;
198 
199 	/* fill req_num by op_code, and rtl_btc_btmpinfo_notify() use it
200 	 * to know message type
201 	 */
202 	switch (op_code) {
203 	case BT_OP_GET_BT_VERSION:
204 		req_num = BT_SEQ_GET_BT_VERSION;
205 		break;
206 	case BT_OP_GET_AFH_MAP_L:
207 		req_num = BT_SEQ_GET_AFH_MAP_L;
208 		break;
209 	case BT_OP_GET_AFH_MAP_M:
210 		req_num = BT_SEQ_GET_AFH_MAP_M;
211 		break;
212 	case BT_OP_GET_AFH_MAP_H:
213 		req_num = BT_SEQ_GET_AFH_MAP_H;
214 		break;
215 	case BT_OP_GET_BT_COEX_SUPPORTED_FEATURE:
216 		req_num = BT_SEQ_GET_BT_COEX_SUPPORTED_FEATURE;
217 		break;
218 	case BT_OP_GET_BT_COEX_SUPPORTED_VERSION:
219 		req_num = BT_SEQ_GET_BT_COEX_SUPPORTED_VERSION;
220 		break;
221 	case BT_OP_GET_BT_ANT_DET_VAL:
222 		req_num = BT_SEQ_GET_BT_ANT_DET_VAL;
223 		break;
224 	case BT_OP_GET_BT_BLE_SCAN_PARA:
225 		req_num = BT_SEQ_GET_BT_BLE_SCAN_PARA;
226 		break;
227 	case BT_OP_GET_BT_BLE_SCAN_TYPE:
228 		req_num = BT_SEQ_GET_BT_BLE_SCAN_TYPE;
229 		break;
230 	case BT_OP_GET_BT_DEVICE_INFO:
231 		req_num = BT_SEQ_GET_BT_DEVICE_INFO;
232 		break;
233 	case BT_OP_GET_BT_FORBIDDEN_SLOT_VAL:
234 		req_num = BT_SEQ_GET_BT_FORB_SLOT_VAL;
235 		break;
236 	case BT_OP_WRITE_REG_ADDR:
237 	case BT_OP_WRITE_REG_VALUE:
238 	case BT_OP_READ_REG:
239 	default:
240 		req_num = BT_SEQ_DONT_CARE;
241 		break;
242 	}
243 
244 	cmd[0] |= (oper_ver & 0x0f);		/* Set OperVer */
245 	cmd[0] |= ((req_num << 4) & 0xf0);	/* Set ReqNum */
246 	cmd[1] = op_code;
247 	rtlpriv->cfg->ops->fill_h2c_cmd(rtlpriv->mac80211.hw, 0x67, len, cmd);
248 
249 	/* wait? */
250 	if (!wait_ms)
251 		return true;
252 
253 	RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
254 		 "btmpinfo wait req_num=%d wait=%ld\n", req_num, wait_ms);
255 
256 	if (in_interrupt())
257 		return false;
258 
259 	if (wait_for_completion_timeout(&btcoexist->bt_mp_comp,
260 					msecs_to_jiffies(wait_ms)) == 0) {
261 		RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG,
262 			 "btmpinfo wait (req_num=%d) timeout\n", req_num);
263 
264 		return false;	/* timeout */
265 	}
266 
267 	return true;
268 }
269 
halbtc_leave_lps(struct btc_coexist * btcoexist)270 static void halbtc_leave_lps(struct btc_coexist *btcoexist)
271 {
272 	struct rtl_priv *rtlpriv;
273 	bool ap_enable = false;
274 
275 	rtlpriv = btcoexist->adapter;
276 
277 	btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_AP_MODE_ENABLE,
278 			   &ap_enable);
279 
280 	if (ap_enable) {
281 		RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG,
282 			 "%s()<--dont leave lps under AP mode\n", __func__);
283 		return;
284 	}
285 
286 	btcoexist->bt_info.bt_ctrl_lps = true;
287 	btcoexist->bt_info.bt_lps_on = false;
288 	rtl_lps_leave(rtlpriv->mac80211.hw);
289 }
290 
halbtc_enter_lps(struct btc_coexist * btcoexist)291 static void halbtc_enter_lps(struct btc_coexist *btcoexist)
292 {
293 	struct rtl_priv *rtlpriv;
294 	bool ap_enable = false;
295 
296 	rtlpriv = btcoexist->adapter;
297 
298 	btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_AP_MODE_ENABLE,
299 			   &ap_enable);
300 
301 	if (ap_enable) {
302 		RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG,
303 			 "%s()<--dont enter lps under AP mode\n", __func__);
304 		return;
305 	}
306 
307 	btcoexist->bt_info.bt_ctrl_lps = true;
308 	btcoexist->bt_info.bt_lps_on = true;
309 	rtl_lps_enter(rtlpriv->mac80211.hw);
310 }
311 
halbtc_normal_lps(struct btc_coexist * btcoexist)312 static void halbtc_normal_lps(struct btc_coexist *btcoexist)
313 {
314 	struct rtl_priv *rtlpriv;
315 
316 	rtlpriv = btcoexist->adapter;
317 
318 	if (btcoexist->bt_info.bt_ctrl_lps) {
319 		btcoexist->bt_info.bt_lps_on = false;
320 		rtl_lps_leave(rtlpriv->mac80211.hw);
321 		btcoexist->bt_info.bt_ctrl_lps = false;
322 	}
323 }
324 
halbtc_pre_normal_lps(struct btc_coexist * btcoexist)325 static void halbtc_pre_normal_lps(struct btc_coexist *btcoexist)
326 {
327 	struct rtl_priv *rtlpriv = btcoexist->adapter;
328 
329 	if (btcoexist->bt_info.bt_ctrl_lps) {
330 		btcoexist->bt_info.bt_lps_on = false;
331 		rtl_lps_leave(rtlpriv->mac80211.hw);
332 	}
333 }
334 
halbtc_post_normal_lps(struct btc_coexist * btcoexist)335 static void halbtc_post_normal_lps(struct btc_coexist *btcoexist)
336 {
337 	if (btcoexist->bt_info.bt_ctrl_lps)
338 		btcoexist->bt_info.bt_ctrl_lps = false;
339 }
340 
halbtc_leave_low_power(struct btc_coexist * btcoexist)341 static void halbtc_leave_low_power(struct btc_coexist *btcoexist)
342 {
343 }
344 
halbtc_normal_low_power(struct btc_coexist * btcoexist)345 static void halbtc_normal_low_power(struct btc_coexist *btcoexist)
346 {
347 }
348 
halbtc_disable_low_power(struct btc_coexist * btcoexist,bool low_pwr_disable)349 static void halbtc_disable_low_power(struct btc_coexist *btcoexist,
350 				     bool low_pwr_disable)
351 {
352 	/* TODO: original/leave 32k low power */
353 	btcoexist->bt_info.bt_disable_low_pwr = low_pwr_disable;
354 }
355 
halbtc_aggregation_check(struct btc_coexist * btcoexist)356 static void halbtc_aggregation_check(struct btc_coexist *btcoexist)
357 {
358 	bool need_to_act = false;
359 	static unsigned long pre_time;
360 	unsigned long cur_time = 0;
361 	struct rtl_priv *rtlpriv = btcoexist->adapter;
362 
363 	/* To void continuous deleteBA=>addBA=>deleteBA=>addBA
364 	 * This function is not allowed to continuous called
365 	 * It can only be called after 8 seconds
366 	 */
367 
368 	cur_time = jiffies;
369 	if (jiffies_to_msecs(cur_time - pre_time) <= 8000) {
370 		/* over 8 seconds you can execute this function again. */
371 		return;
372 	}
373 	pre_time = cur_time;
374 
375 	if (btcoexist->bt_info.reject_agg_pkt) {
376 		need_to_act = true;
377 		btcoexist->bt_info.pre_reject_agg_pkt =
378 			btcoexist->bt_info.reject_agg_pkt;
379 	} else {
380 		if (btcoexist->bt_info.pre_reject_agg_pkt) {
381 			need_to_act = true;
382 			btcoexist->bt_info.pre_reject_agg_pkt =
383 				btcoexist->bt_info.reject_agg_pkt;
384 		}
385 
386 		if (btcoexist->bt_info.pre_bt_ctrl_agg_buf_size !=
387 		    btcoexist->bt_info.bt_ctrl_agg_buf_size) {
388 			need_to_act = true;
389 			btcoexist->bt_info.pre_bt_ctrl_agg_buf_size =
390 				btcoexist->bt_info.bt_ctrl_agg_buf_size;
391 		}
392 
393 		if (btcoexist->bt_info.bt_ctrl_agg_buf_size) {
394 			if (btcoexist->bt_info.pre_agg_buf_size !=
395 			    btcoexist->bt_info.agg_buf_size) {
396 				need_to_act = true;
397 			}
398 			btcoexist->bt_info.pre_agg_buf_size =
399 				btcoexist->bt_info.agg_buf_size;
400 		}
401 
402 		if (need_to_act)
403 			rtl_rx_ampdu_apply(rtlpriv);
404 	}
405 }
406 
halbtc_get_bt_patch_version(struct btc_coexist * btcoexist)407 static u32 halbtc_get_bt_patch_version(struct btc_coexist *btcoexist)
408 {
409 	u8 cmd_buffer[4] = {0};
410 
411 	if (btcoexist->bt_info.bt_real_fw_ver)
412 		goto label_done;
413 
414 	/* cmd_buffer[0] and [1] is filled by halbtc_send_bt_mp_operation() */
415 	halbtc_send_bt_mp_operation(btcoexist, BT_OP_GET_BT_VERSION,
416 				    cmd_buffer, 4, 200);
417 
418 label_done:
419 	return btcoexist->bt_info.bt_real_fw_ver;
420 }
421 
halbtc_get_bt_coex_supported_feature(void * btc_context)422 static u32 halbtc_get_bt_coex_supported_feature(void *btc_context)
423 {
424 	struct btc_coexist *btcoexist = (struct btc_coexist *)btc_context;
425 	u8 cmd_buffer[4] = {0};
426 
427 	if (btcoexist->bt_info.bt_supported_feature)
428 		goto label_done;
429 
430 	/* cmd_buffer[0] and [1] is filled by halbtc_send_bt_mp_operation() */
431 	halbtc_send_bt_mp_operation(btcoexist,
432 				    BT_OP_GET_BT_COEX_SUPPORTED_FEATURE,
433 				    cmd_buffer, 4, 200);
434 
435 label_done:
436 	return btcoexist->bt_info.bt_supported_feature;
437 }
438 
halbtc_get_bt_coex_supported_version(void * btc_context)439 static u32 halbtc_get_bt_coex_supported_version(void *btc_context)
440 {
441 	struct btc_coexist *btcoexist = (struct btc_coexist *)btc_context;
442 	u8 cmd_buffer[4] = {0};
443 
444 	if (btcoexist->bt_info.bt_supported_version)
445 		goto label_done;
446 
447 	/* cmd_buffer[0] and [1] is filled by halbtc_send_bt_mp_operation() */
448 	halbtc_send_bt_mp_operation(btcoexist,
449 				    BT_OP_GET_BT_COEX_SUPPORTED_VERSION,
450 				    cmd_buffer, 4, 200);
451 
452 label_done:
453 	return btcoexist->bt_info.bt_supported_version;
454 }
455 
halbtc_get_bt_device_info(void * btc_context)456 static u32 halbtc_get_bt_device_info(void *btc_context)
457 {
458 	struct btc_coexist *btcoexist = (struct btc_coexist *)btc_context;
459 	u8 cmd_buffer[4] = {0};
460 
461 	/* cmd_buffer[0] and [1] is filled by halbtc_send_bt_mp_operation() */
462 	halbtc_send_bt_mp_operation(btcoexist,
463 				    BT_OP_GET_BT_DEVICE_INFO,
464 				    cmd_buffer, 4, 200);
465 
466 	return btcoexist->bt_info.bt_device_info;
467 }
468 
halbtc_get_bt_forbidden_slot_val(void * btc_context)469 static u32 halbtc_get_bt_forbidden_slot_val(void *btc_context)
470 {
471 	struct btc_coexist *btcoexist = (struct btc_coexist *)btc_context;
472 	u8 cmd_buffer[4] = {0};
473 
474 	/* cmd_buffer[0] and [1] is filled by halbtc_send_bt_mp_operation() */
475 	halbtc_send_bt_mp_operation(btcoexist,
476 				    BT_OP_GET_BT_FORBIDDEN_SLOT_VAL,
477 				    cmd_buffer, 4, 200);
478 
479 	return btcoexist->bt_info.bt_forb_slot_val;
480 }
481 
halbtc_get_wifi_link_status(struct btc_coexist * btcoexist)482 static u32 halbtc_get_wifi_link_status(struct btc_coexist *btcoexist)
483 {
484 	/* return value:
485 	 * [31:16] => connected port number
486 	 * [15:0]  => port connected bit define
487 	 */
488 	struct rtl_priv *rtlpriv = btcoexist->adapter;
489 	struct rtl_mac *mac = rtl_mac(rtlpriv);
490 	u32 ret_val = 0;
491 	u32 port_connected_status = 0, num_of_connected_port = 0;
492 
493 	if (mac->opmode == NL80211_IFTYPE_STATION &&
494 	    mac->link_state >= MAC80211_LINKED) {
495 		port_connected_status |= WIFI_STA_CONNECTED;
496 		num_of_connected_port++;
497 	}
498 	/* AP & ADHOC & MESH */
499 	if (is_any_client_connect_to_ap(btcoexist)) {
500 		port_connected_status |= WIFI_AP_CONNECTED;
501 		num_of_connected_port++;
502 	}
503 	/* TODO: P2P Connected Status */
504 
505 	ret_val = (num_of_connected_port << 16) | port_connected_status;
506 
507 	return ret_val;
508 }
509 
halbtc_get_wifi_rssi(struct rtl_priv * rtlpriv)510 static s32 halbtc_get_wifi_rssi(struct rtl_priv *rtlpriv)
511 {
512 	return rtlpriv->dm.undec_sm_pwdb;
513 }
514 
halbtc_get(void * void_btcoexist,u8 get_type,void * out_buf)515 static bool halbtc_get(void *void_btcoexist, u8 get_type, void *out_buf)
516 {
517 	struct btc_coexist *btcoexist = (struct btc_coexist *)void_btcoexist;
518 	struct rtl_priv *rtlpriv = btcoexist->adapter;
519 	struct rtl_phy *rtlphy = &(rtlpriv->phy);
520 	struct rtl_mac *mac = rtl_mac(rtlpriv);
521 	struct rtl_hal *rtlhal = rtl_hal(rtlpriv);
522 	bool *bool_tmp = (bool *)out_buf;
523 	int *s32_tmp = (int *)out_buf;
524 	u32 *u32_tmp = (u32 *)out_buf;
525 	u8 *u8_tmp = (u8 *)out_buf;
526 	bool tmp = false;
527 	bool ret = true;
528 
529 	if (!halbtc_is_bt_coexist_available(btcoexist))
530 		return false;
531 
532 	switch (get_type) {
533 	case BTC_GET_BL_HS_OPERATION:
534 		*bool_tmp = false;
535 		ret = false;
536 		break;
537 	case BTC_GET_BL_HS_CONNECTING:
538 		*bool_tmp = false;
539 		ret = false;
540 		break;
541 	case BTC_GET_BL_WIFI_CONNECTED:
542 		if (rtlpriv->mac80211.opmode == NL80211_IFTYPE_STATION &&
543 		    rtlpriv->mac80211.link_state >= MAC80211_LINKED)
544 			tmp = true;
545 		if (is_any_client_connect_to_ap(btcoexist))
546 			tmp = true;
547 		*bool_tmp = tmp;
548 		break;
549 	case BTC_GET_BL_WIFI_DUAL_BAND_CONNECTED:
550 		*u8_tmp = BTC_MULTIPORT_SCC;
551 		break;
552 	case BTC_GET_BL_WIFI_BUSY:
553 		if (halbtc_is_wifi_busy(rtlpriv))
554 			*bool_tmp = true;
555 		else
556 			*bool_tmp = false;
557 		break;
558 	case BTC_GET_BL_WIFI_SCAN:
559 		if (mac->act_scanning)
560 			*bool_tmp = true;
561 		else
562 			*bool_tmp = false;
563 		break;
564 	case BTC_GET_BL_WIFI_LINK:
565 		if (mac->link_state == MAC80211_LINKING)
566 			*bool_tmp = true;
567 		else
568 			*bool_tmp = false;
569 		break;
570 	case BTC_GET_BL_WIFI_ROAM:
571 		if (mac->link_state == MAC80211_LINKING)
572 			*bool_tmp = true;
573 		else
574 			*bool_tmp = false;
575 		break;
576 	case BTC_GET_BL_WIFI_4_WAY_PROGRESS:
577 		*bool_tmp = rtlpriv->btcoexist.btc_info.in_4way;
578 		break;
579 	case BTC_GET_BL_WIFI_UNDER_5G:
580 		if (rtlhal->current_bandtype == BAND_ON_5G)
581 			*bool_tmp = true;
582 		else
583 			*bool_tmp = false;
584 		break;
585 	case BTC_GET_BL_WIFI_AP_MODE_ENABLE:
586 		if (mac->opmode == NL80211_IFTYPE_AP)
587 			*bool_tmp = true;
588 		else
589 			*bool_tmp = false;
590 		break;
591 	case BTC_GET_BL_WIFI_ENABLE_ENCRYPTION:
592 		if (NO_ENCRYPTION == rtlpriv->sec.pairwise_enc_algorithm)
593 			*bool_tmp = false;
594 		else
595 			*bool_tmp = true;
596 		break;
597 	case BTC_GET_BL_WIFI_UNDER_B_MODE:
598 		if (rtlpriv->mac80211.mode == WIRELESS_MODE_B)
599 			*bool_tmp = true;
600 		else
601 			*bool_tmp = false;
602 		break;
603 	case BTC_GET_BL_EXT_SWITCH:
604 		*bool_tmp = false;
605 		break;
606 	case BTC_GET_BL_WIFI_IS_IN_MP_MODE:
607 		*bool_tmp = false;
608 		break;
609 	case BTC_GET_BL_IS_ASUS_8723B:
610 		*bool_tmp = false;
611 		break;
612 	case BTC_GET_BL_RF4CE_CONNECTED:
613 		*bool_tmp = false;
614 		break;
615 	case BTC_GET_S4_WIFI_RSSI:
616 		*s32_tmp = halbtc_get_wifi_rssi(rtlpriv);
617 		break;
618 	case BTC_GET_S4_HS_RSSI:
619 		*s32_tmp = 0;
620 		ret = false;
621 		break;
622 	case BTC_GET_U4_WIFI_BW:
623 		*u32_tmp = halbtc_get_wifi_bw(btcoexist);
624 		break;
625 	case BTC_GET_U4_WIFI_TRAFFIC_DIRECTION:
626 		if (halbtc_is_wifi_uplink(rtlpriv))
627 			*u32_tmp = BTC_WIFI_TRAFFIC_TX;
628 		else
629 			*u32_tmp = BTC_WIFI_TRAFFIC_RX;
630 		break;
631 	case BTC_GET_U4_WIFI_FW_VER:
632 		*u32_tmp = (rtlhal->fw_version << 16) | rtlhal->fw_subversion;
633 		break;
634 	case BTC_GET_U4_WIFI_LINK_STATUS:
635 		*u32_tmp = halbtc_get_wifi_link_status(btcoexist);
636 		break;
637 	case BTC_GET_U4_BT_PATCH_VER:
638 		*u32_tmp = halbtc_get_bt_patch_version(btcoexist);
639 		break;
640 	case BTC_GET_U4_VENDOR:
641 		*u32_tmp = BTC_VENDOR_OTHER;
642 		break;
643 	case BTC_GET_U4_SUPPORTED_VERSION:
644 		*u32_tmp = halbtc_get_bt_coex_supported_version(btcoexist);
645 		break;
646 	case BTC_GET_U4_SUPPORTED_FEATURE:
647 		*u32_tmp = halbtc_get_bt_coex_supported_feature(btcoexist);
648 		break;
649 	case BTC_GET_U4_BT_DEVICE_INFO:
650 		*u32_tmp = halbtc_get_bt_device_info(btcoexist);
651 		break;
652 	case BTC_GET_U4_BT_FORBIDDEN_SLOT_VAL:
653 		*u32_tmp = halbtc_get_bt_forbidden_slot_val(btcoexist);
654 		break;
655 	case BTC_GET_U4_WIFI_IQK_TOTAL:
656 		*u32_tmp =
657 			btcoexist->btc_phydm_query_phy_counter(btcoexist,
658 							       DM_INFO_IQK_ALL);
659 		break;
660 	case BTC_GET_U4_WIFI_IQK_OK:
661 		*u32_tmp =
662 			btcoexist->btc_phydm_query_phy_counter(btcoexist,
663 							       DM_INFO_IQK_OK);
664 		break;
665 	case BTC_GET_U4_WIFI_IQK_FAIL:
666 		*u32_tmp =
667 			btcoexist->btc_phydm_query_phy_counter(btcoexist,
668 							       DM_INFO_IQK_NG);
669 		break;
670 	case BTC_GET_U1_WIFI_DOT11_CHNL:
671 		*u8_tmp = rtlphy->current_channel;
672 		break;
673 	case BTC_GET_U1_WIFI_CENTRAL_CHNL:
674 		*u8_tmp = halbtc_get_wifi_central_chnl(btcoexist);
675 		break;
676 	case BTC_GET_U1_WIFI_HS_CHNL:
677 		*u8_tmp = 0;
678 		ret = false;
679 		break;
680 	case BTC_GET_U1_AP_NUM:
681 		*u8_tmp = rtlpriv->btcoexist.btc_info.ap_num;
682 		break;
683 	case BTC_GET_U1_ANT_TYPE:
684 		*u8_tmp = (u8)BTC_ANT_TYPE_0;
685 		break;
686 	case BTC_GET_U1_IOT_PEER:
687 		*u8_tmp = 0;
688 		break;
689 
690 		/************* 1Ant **************/
691 	case BTC_GET_U1_LPS_MODE:
692 		*u8_tmp = btcoexist->pwr_mode_val[0];
693 		break;
694 
695 	default:
696 		ret = false;
697 		break;
698 	}
699 
700 	return ret;
701 }
702 
halbtc_set(void * void_btcoexist,u8 set_type,void * in_buf)703 static bool halbtc_set(void *void_btcoexist, u8 set_type, void *in_buf)
704 {
705 	struct btc_coexist *btcoexist = (struct btc_coexist *)void_btcoexist;
706 	bool *bool_tmp = (bool *)in_buf;
707 	u8 *u8_tmp = (u8 *)in_buf;
708 	u32 *u32_tmp = (u32 *)in_buf;
709 	bool ret = true;
710 
711 	if (!halbtc_is_bt_coexist_available(btcoexist))
712 		return false;
713 
714 	switch (set_type) {
715 	/* set some bool type variables. */
716 	case BTC_SET_BL_BT_DISABLE:
717 		btcoexist->bt_info.bt_disabled = *bool_tmp;
718 		break;
719 	case BTC_SET_BL_BT_TRAFFIC_BUSY:
720 		btcoexist->bt_info.bt_busy = *bool_tmp;
721 		break;
722 	case BTC_SET_BL_BT_LIMITED_DIG:
723 		btcoexist->bt_info.limited_dig = *bool_tmp;
724 		break;
725 	case BTC_SET_BL_FORCE_TO_ROAM:
726 		btcoexist->bt_info.force_to_roam = *bool_tmp;
727 		break;
728 	case BTC_SET_BL_TO_REJ_AP_AGG_PKT:
729 		btcoexist->bt_info.reject_agg_pkt = *bool_tmp;
730 		break;
731 	case BTC_SET_BL_BT_CTRL_AGG_SIZE:
732 		btcoexist->bt_info.bt_ctrl_agg_buf_size = *bool_tmp;
733 		break;
734 	case BTC_SET_BL_INC_SCAN_DEV_NUM:
735 		btcoexist->bt_info.increase_scan_dev_num = *bool_tmp;
736 		break;
737 	case BTC_SET_BL_BT_TX_RX_MASK:
738 		btcoexist->bt_info.bt_tx_rx_mask = *bool_tmp;
739 		break;
740 	case BTC_SET_BL_MIRACAST_PLUS_BT:
741 		btcoexist->bt_info.miracast_plus_bt = *bool_tmp;
742 		break;
743 		/* set some u1Byte type variables. */
744 	case BTC_SET_U1_RSSI_ADJ_VAL_FOR_AGC_TABLE_ON:
745 		btcoexist->bt_info.rssi_adjust_for_agc_table_on = *u8_tmp;
746 		break;
747 	case BTC_SET_U1_AGG_BUF_SIZE:
748 		btcoexist->bt_info.agg_buf_size = *u8_tmp;
749 		break;
750 
751 	/* the following are some action which will be triggered */
752 	case BTC_SET_ACT_GET_BT_RSSI:
753 		ret = false;
754 		break;
755 	case BTC_SET_ACT_AGGREGATE_CTRL:
756 		halbtc_aggregation_check(btcoexist);
757 		break;
758 
759 	/* 1Ant */
760 	case BTC_SET_U1_RSSI_ADJ_VAL_FOR_1ANT_COEX_TYPE:
761 		btcoexist->bt_info.rssi_adjust_for_1ant_coex_type = *u8_tmp;
762 		break;
763 	case BTC_SET_UI_SCAN_SIG_COMPENSATION:
764 		break;
765 	case BTC_SET_U1_LPS_VAL:
766 		btcoexist->bt_info.lps_val = *u8_tmp;
767 		break;
768 	case BTC_SET_U1_RPWM_VAL:
769 		btcoexist->bt_info.rpwm_val = *u8_tmp;
770 		break;
771 	/* the following are some action which will be triggered  */
772 	case BTC_SET_ACT_LEAVE_LPS:
773 		halbtc_leave_lps(btcoexist);
774 		break;
775 	case BTC_SET_ACT_ENTER_LPS:
776 		halbtc_enter_lps(btcoexist);
777 		break;
778 	case BTC_SET_ACT_NORMAL_LPS:
779 		halbtc_normal_lps(btcoexist);
780 		break;
781 	case BTC_SET_ACT_PRE_NORMAL_LPS:
782 		halbtc_pre_normal_lps(btcoexist);
783 		break;
784 	case BTC_SET_ACT_POST_NORMAL_LPS:
785 		halbtc_post_normal_lps(btcoexist);
786 		break;
787 	case BTC_SET_ACT_DISABLE_LOW_POWER:
788 		halbtc_disable_low_power(btcoexist, *bool_tmp);
789 		break;
790 	case BTC_SET_ACT_UPDATE_RAMASK:
791 		btcoexist->bt_info.ra_mask = *u32_tmp;
792 		break;
793 	case BTC_SET_ACT_SEND_MIMO_PS:
794 		break;
795 	case BTC_SET_ACT_CTRL_BT_INFO: /*wait for 8812/8821*/
796 		break;
797 	case BTC_SET_ACT_CTRL_BT_COEX:
798 		break;
799 	case BTC_SET_ACT_CTRL_8723B_ANT:
800 		break;
801 	default:
802 		break;
803 	}
804 
805 	return ret;
806 }
807 
halbtc_display_coex_statistics(struct btc_coexist * btcoexist,struct seq_file * m)808 static void halbtc_display_coex_statistics(struct btc_coexist *btcoexist,
809 					   struct seq_file *m)
810 {
811 }
812 
halbtc_display_bt_link_info(struct btc_coexist * btcoexist,struct seq_file * m)813 static void halbtc_display_bt_link_info(struct btc_coexist *btcoexist,
814 					struct seq_file *m)
815 {
816 }
817 
halbtc_display_wifi_status(struct btc_coexist * btcoexist,struct seq_file * m)818 static void halbtc_display_wifi_status(struct btc_coexist *btcoexist,
819 				       struct seq_file *m)
820 {
821 	struct rtl_priv *rtlpriv = btcoexist->adapter;
822 	s32 wifi_rssi = 0, bt_hs_rssi = 0;
823 	bool scan = false, link = false, roam = false, wifi_busy = false;
824 	bool wifi_under_b_mode = false;
825 	bool wifi_under_5g = false;
826 	u32 wifi_bw = BTC_WIFI_BW_HT20;
827 	u32 wifi_traffic_dir = BTC_WIFI_TRAFFIC_TX;
828 	u32 wifi_freq = BTC_FREQ_2_4G;
829 	u32 wifi_link_status = 0x0;
830 	bool bt_hs_on = false, under_ips = false, under_lps = false;
831 	bool low_power = false, dc_mode = false;
832 	u8 wifi_chnl = 0, wifi_hs_chnl = 0;
833 	u8 ap_num = 0;
834 
835 	wifi_link_status = halbtc_get_wifi_link_status(btcoexist);
836 	seq_printf(m, "\n %-35s = %d/ %d/ %d/ %d/ %d",
837 		   "STA/vWifi/HS/p2pGo/p2pGc",
838 		   ((wifi_link_status & WIFI_STA_CONNECTED) ? 1 : 0),
839 		   ((wifi_link_status & WIFI_AP_CONNECTED) ? 1 : 0),
840 		   ((wifi_link_status & WIFI_HS_CONNECTED) ? 1 : 0),
841 		   ((wifi_link_status & WIFI_P2P_GO_CONNECTED) ? 1 : 0),
842 		   ((wifi_link_status & WIFI_P2P_GC_CONNECTED) ? 1 : 0));
843 
844 	btcoexist->btc_get(btcoexist, BTC_GET_BL_HS_OPERATION, &bt_hs_on);
845 	btcoexist->btc_get(btcoexist, BTC_GET_U1_WIFI_DOT11_CHNL, &wifi_chnl);
846 	btcoexist->btc_get(btcoexist, BTC_GET_U1_WIFI_HS_CHNL, &wifi_hs_chnl);
847 	seq_printf(m, "\n %-35s = %d / %d(%d)",
848 		   "Dot11 channel / HsChnl(High Speed)",
849 		   wifi_chnl, wifi_hs_chnl, bt_hs_on);
850 
851 	btcoexist->btc_get(btcoexist, BTC_GET_S4_WIFI_RSSI, &wifi_rssi);
852 	btcoexist->btc_get(btcoexist, BTC_GET_S4_HS_RSSI, &bt_hs_rssi);
853 	seq_printf(m, "\n %-35s = %d/ %d",
854 		   "Wifi rssi/ HS rssi",
855 		   wifi_rssi - 100, bt_hs_rssi - 100);
856 
857 	btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_SCAN, &scan);
858 	btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_LINK, &link);
859 	btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_ROAM, &roam);
860 	seq_printf(m, "\n %-35s = %d/ %d/ %d ",
861 		   "Wifi link/ roam/ scan",
862 		   link, roam, scan);
863 
864 	btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_UNDER_5G, &wifi_under_5g);
865 	btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_BW, &wifi_bw);
866 	btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_BUSY, &wifi_busy);
867 	btcoexist->btc_get(btcoexist, BTC_GET_U4_WIFI_TRAFFIC_DIRECTION,
868 			   &wifi_traffic_dir);
869 	btcoexist->btc_get(btcoexist, BTC_GET_U1_AP_NUM, &ap_num);
870 	wifi_freq = (wifi_under_5g ? BTC_FREQ_5G : BTC_FREQ_2_4G);
871 	btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_UNDER_B_MODE,
872 			   &wifi_under_b_mode);
873 
874 	seq_printf(m, "\n %-35s = %s / %s/ %s/ AP=%d ",
875 		   "Wifi freq/ bw/ traffic",
876 		   gl_btc_wifi_freq_string[wifi_freq],
877 		   ((wifi_under_b_mode) ? "11b" :
878 		    gl_btc_wifi_bw_string[wifi_bw]),
879 		   ((!wifi_busy) ? "idle" : ((BTC_WIFI_TRAFFIC_TX ==
880 					      wifi_traffic_dir) ? "uplink" :
881 					     "downlink")),
882 		   ap_num);
883 
884 	/* power status	 */
885 	dc_mode = true;	/*TODO*/
886 	under_ips = rtlpriv->psc.inactive_pwrstate == ERFOFF ? 1 : 0;
887 	under_lps = rtlpriv->psc.dot11_psmode == EACTIVE ? 0 : 1;
888 	low_power = 0; /*TODO*/
889 	seq_printf(m, "\n %-35s = %s%s%s%s",
890 		   "Power Status",
891 		   (dc_mode ? "DC mode" : "AC mode"),
892 		   (under_ips ? ", IPS ON" : ""),
893 		   (under_lps ? ", LPS ON" : ""),
894 		   (low_power ? ", 32k" : ""));
895 
896 	seq_printf(m,
897 		   "\n %-35s = %02x %02x %02x %02x %02x %02x (0x%x/0x%x)",
898 		   "Power mode cmd(lps/rpwm)",
899 		   btcoexist->pwr_mode_val[0], btcoexist->pwr_mode_val[1],
900 		   btcoexist->pwr_mode_val[2], btcoexist->pwr_mode_val[3],
901 		   btcoexist->pwr_mode_val[4], btcoexist->pwr_mode_val[5],
902 		   btcoexist->bt_info.lps_val,
903 		   btcoexist->bt_info.rpwm_val);
904 }
905 
906 /************************************************************
907  *		IO related function
908  ************************************************************/
halbtc_read_1byte(void * bt_context,u32 reg_addr)909 static u8 halbtc_read_1byte(void *bt_context, u32 reg_addr)
910 {
911 	struct btc_coexist *btcoexist = (struct btc_coexist *)bt_context;
912 	struct rtl_priv *rtlpriv = btcoexist->adapter;
913 
914 	return	rtl_read_byte(rtlpriv, reg_addr);
915 }
916 
halbtc_read_2byte(void * bt_context,u32 reg_addr)917 static u16 halbtc_read_2byte(void *bt_context, u32 reg_addr)
918 {
919 	struct btc_coexist *btcoexist = (struct btc_coexist *)bt_context;
920 	struct rtl_priv *rtlpriv = btcoexist->adapter;
921 
922 	return	rtl_read_word(rtlpriv, reg_addr);
923 }
924 
halbtc_read_4byte(void * bt_context,u32 reg_addr)925 static u32 halbtc_read_4byte(void *bt_context, u32 reg_addr)
926 {
927 	struct btc_coexist *btcoexist = (struct btc_coexist *)bt_context;
928 	struct rtl_priv *rtlpriv = btcoexist->adapter;
929 
930 	return	rtl_read_dword(rtlpriv, reg_addr);
931 }
932 
halbtc_write_1byte(void * bt_context,u32 reg_addr,u32 data)933 static void halbtc_write_1byte(void *bt_context, u32 reg_addr, u32 data)
934 {
935 	struct btc_coexist *btcoexist = (struct btc_coexist *)bt_context;
936 	struct rtl_priv *rtlpriv = btcoexist->adapter;
937 
938 	rtl_write_byte(rtlpriv, reg_addr, data);
939 }
940 
halbtc_bitmask_write_1byte(void * bt_context,u32 reg_addr,u32 bit_mask,u8 data)941 static void halbtc_bitmask_write_1byte(void *bt_context, u32 reg_addr,
942 				       u32 bit_mask, u8 data)
943 {
944 	struct btc_coexist *btcoexist = (struct btc_coexist *)bt_context;
945 	struct rtl_priv *rtlpriv = btcoexist->adapter;
946 	u8 original_value, bit_shift = 0;
947 	u8 i;
948 
949 	if (bit_mask != MASKDWORD) {/*if not "double word" write*/
950 		original_value = rtl_read_byte(rtlpriv, reg_addr);
951 		for (i = 0; i <= 7; i++) {
952 			if ((bit_mask>>i) & 0x1)
953 				break;
954 		}
955 		bit_shift = i;
956 		data = (original_value & (~bit_mask)) |
957 			((data << bit_shift) & bit_mask);
958 	}
959 	rtl_write_byte(rtlpriv, reg_addr, data);
960 }
961 
halbtc_write_2byte(void * bt_context,u32 reg_addr,u16 data)962 static void halbtc_write_2byte(void *bt_context, u32 reg_addr, u16 data)
963 {
964 	struct btc_coexist *btcoexist = (struct btc_coexist *)bt_context;
965 	struct rtl_priv *rtlpriv = btcoexist->adapter;
966 
967 	rtl_write_word(rtlpriv, reg_addr, data);
968 }
969 
halbtc_write_4byte(void * bt_context,u32 reg_addr,u32 data)970 static void halbtc_write_4byte(void *bt_context, u32 reg_addr, u32 data)
971 {
972 	struct btc_coexist *btcoexist =
973 		(struct btc_coexist *)bt_context;
974 	struct rtl_priv *rtlpriv = btcoexist->adapter;
975 
976 	rtl_write_dword(rtlpriv, reg_addr, data);
977 }
978 
halbtc_write_local_reg_1byte(void * btc_context,u32 reg_addr,u8 data)979 static void halbtc_write_local_reg_1byte(void *btc_context, u32 reg_addr,
980 					 u8 data)
981 {
982 	struct btc_coexist *btcoexist = (struct btc_coexist *)btc_context;
983 	struct rtl_priv *rtlpriv = btcoexist->adapter;
984 
985 	if (btcoexist->chip_interface == BTC_INTF_SDIO)
986 		;
987 	else if (btcoexist->chip_interface == BTC_INTF_PCI)
988 		rtl_write_byte(rtlpriv, reg_addr, data);
989 	else if (btcoexist->chip_interface == BTC_INTF_USB)
990 		rtl_write_byte(rtlpriv, reg_addr, data);
991 }
992 
halbtc_set_bbreg(void * bt_context,u32 reg_addr,u32 bit_mask,u32 data)993 static void halbtc_set_bbreg(void *bt_context, u32 reg_addr, u32 bit_mask,
994 			     u32 data)
995 {
996 	struct btc_coexist *btcoexist = (struct btc_coexist *)bt_context;
997 	struct rtl_priv *rtlpriv = btcoexist->adapter;
998 
999 	rtl_set_bbreg(rtlpriv->mac80211.hw, reg_addr, bit_mask, data);
1000 }
1001 
halbtc_get_bbreg(void * bt_context,u32 reg_addr,u32 bit_mask)1002 static u32 halbtc_get_bbreg(void *bt_context, u32 reg_addr, u32 bit_mask)
1003 {
1004 	struct btc_coexist *btcoexist = (struct btc_coexist *)bt_context;
1005 	struct rtl_priv *rtlpriv = btcoexist->adapter;
1006 
1007 	return rtl_get_bbreg(rtlpriv->mac80211.hw, reg_addr, bit_mask);
1008 }
1009 
halbtc_set_rfreg(void * bt_context,u8 rf_path,u32 reg_addr,u32 bit_mask,u32 data)1010 static void halbtc_set_rfreg(void *bt_context, u8 rf_path, u32 reg_addr,
1011 			     u32 bit_mask, u32 data)
1012 {
1013 	struct btc_coexist *btcoexist = (struct btc_coexist *)bt_context;
1014 	struct rtl_priv *rtlpriv = btcoexist->adapter;
1015 
1016 	rtl_set_rfreg(rtlpriv->mac80211.hw, rf_path, reg_addr, bit_mask, data);
1017 }
1018 
halbtc_get_rfreg(void * bt_context,u8 rf_path,u32 reg_addr,u32 bit_mask)1019 static u32 halbtc_get_rfreg(void *bt_context, u8 rf_path, u32 reg_addr,
1020 			    u32 bit_mask)
1021 {
1022 	struct btc_coexist *btcoexist = (struct btc_coexist *)bt_context;
1023 	struct rtl_priv *rtlpriv = btcoexist->adapter;
1024 
1025 	return rtl_get_rfreg(rtlpriv->mac80211.hw, rf_path, reg_addr, bit_mask);
1026 }
1027 
halbtc_fill_h2c_cmd(void * bt_context,u8 element_id,u32 cmd_len,u8 * cmd_buf)1028 static void halbtc_fill_h2c_cmd(void *bt_context, u8 element_id,
1029 				u32 cmd_len, u8 *cmd_buf)
1030 {
1031 	struct btc_coexist *btcoexist = (struct btc_coexist *)bt_context;
1032 	struct rtl_priv *rtlpriv = btcoexist->adapter;
1033 
1034 	rtlpriv->cfg->ops->fill_h2c_cmd(rtlpriv->mac80211.hw, element_id,
1035 					cmd_len, cmd_buf);
1036 }
1037 
halbtc_send_wifi_port_id_cmd(void * bt_context)1038 void halbtc_send_wifi_port_id_cmd(void *bt_context)
1039 {
1040 	struct btc_coexist *btcoexist = (struct btc_coexist *)bt_context;
1041 	struct rtl_priv *rtlpriv = btcoexist->adapter;
1042 	u8 cmd_buf[1] = {0};	/* port id [2:0] = 0 */
1043 
1044 	rtlpriv->cfg->ops->fill_h2c_cmd(rtlpriv->mac80211.hw, H2C_BT_PORT_ID,
1045 					1, cmd_buf);
1046 }
1047 
halbtc_set_default_port_id_cmd(void * bt_context)1048 void halbtc_set_default_port_id_cmd(void *bt_context)
1049 {
1050 	struct btc_coexist *btcoexist = (struct btc_coexist *)bt_context;
1051 	struct rtl_priv *rtlpriv = btcoexist->adapter;
1052 	struct ieee80211_hw *hw = rtlpriv->mac80211.hw;
1053 
1054 	if (!rtlpriv->cfg->ops->set_default_port_id_cmd)
1055 		return;
1056 
1057 	rtlpriv->cfg->ops->set_default_port_id_cmd(hw);
1058 }
1059 
1060 static
halbtc_set_bt_reg(void * btc_context,u8 reg_type,u32 offset,u32 set_val)1061 void halbtc_set_bt_reg(void *btc_context, u8 reg_type, u32 offset, u32 set_val)
1062 {
1063 	struct btc_coexist *btcoexist = (struct btc_coexist *)btc_context;
1064 	u8 cmd_buffer1[4] = {0};
1065 	u8 cmd_buffer2[4] = {0};
1066 
1067 	/* cmd_buffer[0] and [1] is filled by halbtc_send_bt_mp_operation() */
1068 	*((__le16 *)&cmd_buffer1[2]) = cpu_to_le16((u16)set_val);
1069 	if (!halbtc_send_bt_mp_operation(btcoexist, BT_OP_WRITE_REG_VALUE,
1070 					 cmd_buffer1, 4, 200))
1071 		return;
1072 
1073 	/* cmd_buffer[0] and [1] is filled by halbtc_send_bt_mp_operation() */
1074 	cmd_buffer2[2] = reg_type;
1075 	*((u8 *)&cmd_buffer2[3]) = (u8)offset;
1076 	halbtc_send_bt_mp_operation(btcoexist, BT_OP_WRITE_REG_ADDR,
1077 				    cmd_buffer2, 4, 200);
1078 }
1079 
halbtc_display_dbg_msg(void * bt_context,u8 disp_type,struct seq_file * m)1080 static void halbtc_display_dbg_msg(void *bt_context, u8 disp_type,
1081 				   struct seq_file *m)
1082 {
1083 	struct btc_coexist *btcoexist = (struct btc_coexist *)bt_context;
1084 
1085 	switch (disp_type) {
1086 	case BTC_DBG_DISP_COEX_STATISTICS:
1087 		halbtc_display_coex_statistics(btcoexist, m);
1088 		break;
1089 	case BTC_DBG_DISP_BT_LINK_INFO:
1090 		halbtc_display_bt_link_info(btcoexist, m);
1091 		break;
1092 	case BTC_DBG_DISP_WIFI_STATUS:
1093 		halbtc_display_wifi_status(btcoexist, m);
1094 		break;
1095 	default:
1096 		break;
1097 	}
1098 }
1099 
halbtc_get_bt_reg(void * btc_context,u8 reg_type,u32 offset)1100 static u32 halbtc_get_bt_reg(void *btc_context, u8 reg_type, u32 offset)
1101 {
1102 	return 0;
1103 }
1104 
halbtc_under_ips(struct btc_coexist * btcoexist)1105 static bool halbtc_under_ips(struct btc_coexist *btcoexist)
1106 {
1107 	struct rtl_priv *rtlpriv = btcoexist->adapter;
1108 	struct rtl_ps_ctl *ppsc = rtl_psc(rtlpriv);
1109 	enum rf_pwrstate rtstate;
1110 
1111 	if (ppsc->inactiveps) {
1112 		rtstate = ppsc->rfpwr_state;
1113 
1114 		if (rtstate != ERFON &&
1115 		    ppsc->rfoff_reason == RF_CHANGE_BY_IPS) {
1116 			return true;
1117 		}
1118 	}
1119 
1120 	return false;
1121 }
1122 
1123 static
halbtc_get_phydm_version(void * btc_context)1124 u32 halbtc_get_phydm_version(void *btc_context)
1125 {
1126 	return 0;
1127 }
1128 
1129 static
halbtc_phydm_modify_ra_pcr_threshold(void * btc_context,u8 ra_offset_direction,u8 ra_threshold_offset)1130 void halbtc_phydm_modify_ra_pcr_threshold(void *btc_context,
1131 					  u8 ra_offset_direction,
1132 					  u8 ra_threshold_offset)
1133 {
1134 }
1135 
1136 static
halbtc_phydm_query_phy_counter(void * btc_context,enum dm_info_query dm_id)1137 u32 halbtc_phydm_query_phy_counter(void *btc_context, enum dm_info_query dm_id)
1138 {
1139 	return 0;
1140 }
1141 
halbtc_get_ant_det_val_from_bt(void * btc_context)1142 static u8 halbtc_get_ant_det_val_from_bt(void *btc_context)
1143 {
1144 	struct btc_coexist *btcoexist = (struct btc_coexist *)btc_context;
1145 	u8 cmd_buffer[4] = {0};
1146 
1147 	/* cmd_buffer[0] and [1] is filled by halbtc_send_bt_mp_operation() */
1148 	halbtc_send_bt_mp_operation(btcoexist, BT_OP_GET_BT_ANT_DET_VAL,
1149 				    cmd_buffer, 4, 200);
1150 
1151 	/* need wait completion to return correct value */
1152 
1153 	return btcoexist->bt_info.bt_ant_det_val;
1154 }
1155 
halbtc_get_ble_scan_type_from_bt(void * btc_context)1156 static u8 halbtc_get_ble_scan_type_from_bt(void *btc_context)
1157 {
1158 	struct btc_coexist *btcoexist = (struct btc_coexist *)btc_context;
1159 	u8 cmd_buffer[4] = {0};
1160 
1161 	/* cmd_buffer[0] and [1] is filled by halbtc_send_bt_mp_operation() */
1162 	halbtc_send_bt_mp_operation(btcoexist, BT_OP_GET_BT_BLE_SCAN_TYPE,
1163 				    cmd_buffer, 4, 200);
1164 
1165 	/* need wait completion to return correct value */
1166 
1167 	return btcoexist->bt_info.bt_ble_scan_type;
1168 }
1169 
halbtc_get_ble_scan_para_from_bt(void * btc_context,u8 scan_type)1170 static u32 halbtc_get_ble_scan_para_from_bt(void *btc_context, u8 scan_type)
1171 {
1172 	struct btc_coexist *btcoexist = (struct btc_coexist *)btc_context;
1173 	u8 cmd_buffer[4] = {0};
1174 
1175 	/* cmd_buffer[0] and [1] is filled by halbtc_send_bt_mp_operation() */
1176 	halbtc_send_bt_mp_operation(btcoexist, BT_OP_GET_BT_BLE_SCAN_PARA,
1177 				    cmd_buffer, 4, 200);
1178 
1179 	/* need wait completion to return correct value */
1180 
1181 	return btcoexist->bt_info.bt_ble_scan_para;
1182 }
1183 
halbtc_get_bt_afh_map_from_bt(void * btc_context,u8 map_type,u8 * afh_map)1184 static bool halbtc_get_bt_afh_map_from_bt(void *btc_context, u8 map_type,
1185 					  u8 *afh_map)
1186 {
1187 	struct btc_coexist *btcoexist = (struct btc_coexist *)btc_context;
1188 	u8 cmd_buffer[2] = {0};
1189 	bool ret;
1190 	u32 *afh_map_l = (u32 *)afh_map;
1191 	u32 *afh_map_m = (u32 *)(afh_map + 4);
1192 	u16 *afh_map_h = (u16 *)(afh_map + 8);
1193 
1194 	/* cmd_buffer[0] and [1] is filled by halbtc_send_bt_mp_operation() */
1195 	ret = halbtc_send_bt_mp_operation(btcoexist, BT_OP_GET_AFH_MAP_L,
1196 					  cmd_buffer, 2, 200);
1197 	if (!ret)
1198 		goto exit;
1199 
1200 	*afh_map_l = btcoexist->bt_info.afh_map_l;
1201 
1202 	/* cmd_buffer[0] and [1] is filled by halbtc_send_bt_mp_operation() */
1203 	ret = halbtc_send_bt_mp_operation(btcoexist, BT_OP_GET_AFH_MAP_M,
1204 					  cmd_buffer, 2, 200);
1205 	if (!ret)
1206 		goto exit;
1207 
1208 	*afh_map_m = btcoexist->bt_info.afh_map_m;
1209 
1210 	/* cmd_buffer[0] and [1] is filled by halbtc_send_bt_mp_operation() */
1211 	ret = halbtc_send_bt_mp_operation(btcoexist, BT_OP_GET_AFH_MAP_H,
1212 					  cmd_buffer, 2, 200);
1213 	if (!ret)
1214 		goto exit;
1215 
1216 	*afh_map_h = btcoexist->bt_info.afh_map_h;
1217 
1218 exit:
1219 	return ret;
1220 }
1221 
1222 /*****************************************************************
1223  *         Extern functions called by other module
1224  *****************************************************************/
exhalbtc_initlize_variables(struct rtl_priv * rtlpriv)1225 bool exhalbtc_initlize_variables(struct rtl_priv *rtlpriv)
1226 {
1227 	struct btc_coexist *btcoexist = rtl_btc_coexist(rtlpriv);
1228 
1229 	if (!btcoexist)
1230 		return false;
1231 
1232 	halbtc_dbg_init();
1233 
1234 	btcoexist->btc_read_1byte = halbtc_read_1byte;
1235 	btcoexist->btc_write_1byte = halbtc_write_1byte;
1236 	btcoexist->btc_write_1byte_bitmask = halbtc_bitmask_write_1byte;
1237 	btcoexist->btc_read_2byte = halbtc_read_2byte;
1238 	btcoexist->btc_write_2byte = halbtc_write_2byte;
1239 	btcoexist->btc_read_4byte = halbtc_read_4byte;
1240 	btcoexist->btc_write_4byte = halbtc_write_4byte;
1241 	btcoexist->btc_write_local_reg_1byte = halbtc_write_local_reg_1byte;
1242 
1243 	btcoexist->btc_set_bb_reg = halbtc_set_bbreg;
1244 	btcoexist->btc_get_bb_reg = halbtc_get_bbreg;
1245 
1246 	btcoexist->btc_set_rf_reg = halbtc_set_rfreg;
1247 	btcoexist->btc_get_rf_reg = halbtc_get_rfreg;
1248 
1249 	btcoexist->btc_fill_h2c = halbtc_fill_h2c_cmd;
1250 	btcoexist->btc_disp_dbg_msg = halbtc_display_dbg_msg;
1251 
1252 	btcoexist->btc_get = halbtc_get;
1253 	btcoexist->btc_set = halbtc_set;
1254 	btcoexist->btc_set_bt_reg = halbtc_set_bt_reg;
1255 	btcoexist->btc_get_bt_reg = halbtc_get_bt_reg;
1256 
1257 	btcoexist->bt_info.bt_ctrl_buf_size = false;
1258 	btcoexist->bt_info.agg_buf_size = 5;
1259 
1260 	btcoexist->bt_info.increase_scan_dev_num = false;
1261 
1262 	btcoexist->btc_get_bt_coex_supported_feature =
1263 					halbtc_get_bt_coex_supported_feature;
1264 	btcoexist->btc_get_bt_coex_supported_version =
1265 					halbtc_get_bt_coex_supported_version;
1266 	btcoexist->btc_get_bt_phydm_version = halbtc_get_phydm_version;
1267 	btcoexist->btc_phydm_modify_ra_pcr_threshold =
1268 					halbtc_phydm_modify_ra_pcr_threshold;
1269 	btcoexist->btc_phydm_query_phy_counter = halbtc_phydm_query_phy_counter;
1270 	btcoexist->btc_get_ant_det_val_from_bt = halbtc_get_ant_det_val_from_bt;
1271 	btcoexist->btc_get_ble_scan_type_from_bt =
1272 					halbtc_get_ble_scan_type_from_bt;
1273 	btcoexist->btc_get_ble_scan_para_from_bt =
1274 					halbtc_get_ble_scan_para_from_bt;
1275 	btcoexist->btc_get_bt_afh_map_from_bt =
1276 					halbtc_get_bt_afh_map_from_bt;
1277 
1278 	init_completion(&btcoexist->bt_mp_comp);
1279 
1280 	return true;
1281 }
1282 
exhalbtc_initlize_variables_wifi_only(struct rtl_priv * rtlpriv)1283 bool exhalbtc_initlize_variables_wifi_only(struct rtl_priv *rtlpriv)
1284 {
1285 	struct wifi_only_cfg *wifionly_cfg = rtl_btc_wifi_only(rtlpriv);
1286 	struct wifi_only_haldata *wifionly_haldata;
1287 
1288 	if (!wifionly_cfg)
1289 		return false;
1290 
1291 	wifionly_cfg->adapter = rtlpriv;
1292 
1293 	switch (rtlpriv->rtlhal.interface) {
1294 	case INTF_PCI:
1295 		wifionly_cfg->chip_interface = WIFIONLY_INTF_PCI;
1296 		break;
1297 	case INTF_USB:
1298 		wifionly_cfg->chip_interface = WIFIONLY_INTF_USB;
1299 		break;
1300 	default:
1301 		wifionly_cfg->chip_interface = WIFIONLY_INTF_UNKNOWN;
1302 		break;
1303 	}
1304 
1305 	wifionly_haldata = &wifionly_cfg->haldata_info;
1306 
1307 	wifionly_haldata->customer_id = CUSTOMER_NORMAL;
1308 	wifionly_haldata->efuse_pg_antnum = rtl_get_hwpg_ant_num(rtlpriv);
1309 	wifionly_haldata->efuse_pg_antpath =
1310 					rtl_get_hwpg_single_ant_path(rtlpriv);
1311 	wifionly_haldata->rfe_type = rtl_get_hwpg_rfe_type(rtlpriv);
1312 	wifionly_haldata->ant_div_cfg = 0;
1313 
1314 	return true;
1315 }
1316 
exhalbtc_bind_bt_coex_withadapter(void * adapter)1317 bool exhalbtc_bind_bt_coex_withadapter(void *adapter)
1318 {
1319 	struct rtl_priv *rtlpriv = adapter;
1320 	struct btc_coexist *btcoexist = rtl_btc_coexist(rtlpriv);
1321 	u8 ant_num = 2, chip_type, single_ant_path = 0;
1322 
1323 	if (!btcoexist)
1324 		return false;
1325 
1326 	if (btcoexist->binded)
1327 		return false;
1328 
1329 	switch (rtlpriv->rtlhal.interface) {
1330 	case INTF_PCI:
1331 		btcoexist->chip_interface = BTC_INTF_PCI;
1332 		break;
1333 	case INTF_USB:
1334 		btcoexist->chip_interface = BTC_INTF_USB;
1335 		break;
1336 	default:
1337 		btcoexist->chip_interface = BTC_INTF_UNKNOWN;
1338 		break;
1339 	}
1340 
1341 	btcoexist->binded = true;
1342 	btcoexist->statistics.cnt_bind++;
1343 
1344 	btcoexist->adapter = adapter;
1345 
1346 	btcoexist->stack_info.profile_notified = false;
1347 
1348 	btcoexist->bt_info.bt_ctrl_agg_buf_size = false;
1349 	btcoexist->bt_info.agg_buf_size = 5;
1350 
1351 	btcoexist->bt_info.increase_scan_dev_num = false;
1352 	btcoexist->bt_info.miracast_plus_bt = false;
1353 
1354 	chip_type = rtl_get_hwpg_bt_type(rtlpriv);
1355 	exhalbtc_set_chip_type(btcoexist, chip_type);
1356 	ant_num = rtl_get_hwpg_ant_num(rtlpriv);
1357 	exhalbtc_set_ant_num(rtlpriv, BT_COEX_ANT_TYPE_PG, ant_num);
1358 
1359 	/* set default antenna position to main  port */
1360 	btcoexist->board_info.btdm_ant_pos = BTC_ANTENNA_AT_MAIN_PORT;
1361 
1362 	single_ant_path = rtl_get_hwpg_single_ant_path(rtlpriv);
1363 	exhalbtc_set_single_ant_path(btcoexist, single_ant_path);
1364 
1365 	if (rtl_get_hwpg_package_type(rtlpriv) == 0)
1366 		btcoexist->board_info.tfbga_package = false;
1367 	else if (rtl_get_hwpg_package_type(rtlpriv) == 1)
1368 		btcoexist->board_info.tfbga_package = false;
1369 	else
1370 		btcoexist->board_info.tfbga_package = true;
1371 
1372 	if (btcoexist->board_info.tfbga_package)
1373 		RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
1374 			 "[BTCoex], Package Type = TFBGA\n");
1375 	else
1376 		RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD,
1377 			 "[BTCoex], Package Type = Non-TFBGA\n");
1378 
1379 	btcoexist->board_info.rfe_type = rtl_get_hwpg_rfe_type(rtlpriv);
1380 	btcoexist->board_info.ant_div_cfg = 0;
1381 
1382 	return true;
1383 }
1384 
exhalbtc_power_on_setting(struct btc_coexist * btcoexist)1385 void exhalbtc_power_on_setting(struct btc_coexist *btcoexist)
1386 {
1387 	if (!halbtc_is_bt_coexist_available(btcoexist))
1388 		return;
1389 
1390 	btcoexist->statistics.cnt_power_on++;
1391 
1392 	if (IS_HARDWARE_TYPE_8723B(btcoexist->adapter)) {
1393 		if (btcoexist->board_info.btdm_ant_num == 2)
1394 			ex_btc8723b2ant_power_on_setting(btcoexist);
1395 		else if (btcoexist->board_info.btdm_ant_num == 1)
1396 			ex_btc8723b1ant_power_on_setting(btcoexist);
1397 	}
1398 }
1399 
exhalbtc_pre_load_firmware(struct btc_coexist * btcoexist)1400 void exhalbtc_pre_load_firmware(struct btc_coexist *btcoexist)
1401 {
1402 	if (!halbtc_is_bt_coexist_available(btcoexist))
1403 		return;
1404 
1405 	btcoexist->statistics.cnt_pre_load_firmware++;
1406 
1407 	if (IS_HARDWARE_TYPE_8723B(btcoexist->adapter)) {
1408 		if (btcoexist->board_info.btdm_ant_num == 2)
1409 			ex_btc8723b2ant_pre_load_firmware(btcoexist);
1410 	}
1411 }
1412 
exhalbtc_init_hw_config(struct btc_coexist * btcoexist,bool wifi_only)1413 void exhalbtc_init_hw_config(struct btc_coexist *btcoexist, bool wifi_only)
1414 {
1415 	if (!halbtc_is_bt_coexist_available(btcoexist))
1416 		return;
1417 
1418 	btcoexist->statistics.cnt_init_hw_config++;
1419 
1420 	if (IS_HARDWARE_TYPE_8821(btcoexist->adapter)) {
1421 		if (btcoexist->board_info.btdm_ant_num == 2)
1422 			ex_btc8821a2ant_init_hwconfig(btcoexist);
1423 		else if (btcoexist->board_info.btdm_ant_num == 1)
1424 			ex_btc8821a1ant_init_hwconfig(btcoexist, wifi_only);
1425 	} else if (IS_HARDWARE_TYPE_8723B(btcoexist->adapter)) {
1426 		if (btcoexist->board_info.btdm_ant_num == 2)
1427 			ex_btc8723b2ant_init_hwconfig(btcoexist);
1428 		else if (btcoexist->board_info.btdm_ant_num == 1)
1429 			ex_btc8723b1ant_init_hwconfig(btcoexist, wifi_only);
1430 	} else if (IS_HARDWARE_TYPE_8723A(btcoexist->adapter)) {
1431 		/* 8723A has no this function */
1432 	} else if (IS_HARDWARE_TYPE_8192E(btcoexist->adapter)) {
1433 		if (btcoexist->board_info.btdm_ant_num == 2)
1434 			ex_btc8192e2ant_init_hwconfig(btcoexist);
1435 	}
1436 }
1437 
exhalbtc_init_hw_config_wifi_only(struct wifi_only_cfg * wifionly_cfg)1438 void exhalbtc_init_hw_config_wifi_only(struct wifi_only_cfg *wifionly_cfg)
1439 {
1440 }
1441 
exhalbtc_init_coex_dm(struct btc_coexist * btcoexist)1442 void exhalbtc_init_coex_dm(struct btc_coexist *btcoexist)
1443 {
1444 	if (!halbtc_is_bt_coexist_available(btcoexist))
1445 		return;
1446 
1447 	btcoexist->statistics.cnt_init_coex_dm++;
1448 
1449 	if (IS_HARDWARE_TYPE_8821(btcoexist->adapter)) {
1450 		if (btcoexist->board_info.btdm_ant_num == 2)
1451 			ex_btc8821a2ant_init_coex_dm(btcoexist);
1452 		else if (btcoexist->board_info.btdm_ant_num == 1)
1453 			ex_btc8821a1ant_init_coex_dm(btcoexist);
1454 	} else if (IS_HARDWARE_TYPE_8723B(btcoexist->adapter)) {
1455 		if (btcoexist->board_info.btdm_ant_num == 2)
1456 			ex_btc8723b2ant_init_coex_dm(btcoexist);
1457 		else if (btcoexist->board_info.btdm_ant_num == 1)
1458 			ex_btc8723b1ant_init_coex_dm(btcoexist);
1459 	} else if (IS_HARDWARE_TYPE_8192E(btcoexist->adapter)) {
1460 		if (btcoexist->board_info.btdm_ant_num == 2)
1461 			ex_btc8192e2ant_init_coex_dm(btcoexist);
1462 	}
1463 
1464 	btcoexist->initilized = true;
1465 }
1466 
exhalbtc_ips_notify(struct btc_coexist * btcoexist,u8 type)1467 void exhalbtc_ips_notify(struct btc_coexist *btcoexist, u8 type)
1468 {
1469 	u8 ips_type;
1470 
1471 	if (!halbtc_is_bt_coexist_available(btcoexist))
1472 		return;
1473 	btcoexist->statistics.cnt_ips_notify++;
1474 	if (btcoexist->manual_control)
1475 		return;
1476 
1477 	if (ERFOFF == type)
1478 		ips_type = BTC_IPS_ENTER;
1479 	else
1480 		ips_type = BTC_IPS_LEAVE;
1481 
1482 	halbtc_leave_low_power(btcoexist);
1483 
1484 	if (IS_HARDWARE_TYPE_8821(btcoexist->adapter)) {
1485 		if (btcoexist->board_info.btdm_ant_num == 2)
1486 			ex_btc8821a2ant_ips_notify(btcoexist, ips_type);
1487 		else if (btcoexist->board_info.btdm_ant_num == 1)
1488 			ex_btc8821a1ant_ips_notify(btcoexist, ips_type);
1489 	} else if (IS_HARDWARE_TYPE_8723B(btcoexist->adapter)) {
1490 		if (btcoexist->board_info.btdm_ant_num == 2)
1491 			ex_btc8723b2ant_ips_notify(btcoexist, ips_type);
1492 		else if (btcoexist->board_info.btdm_ant_num == 1)
1493 			ex_btc8723b1ant_ips_notify(btcoexist, ips_type);
1494 	} else if (IS_HARDWARE_TYPE_8192E(btcoexist->adapter)) {
1495 		if (btcoexist->board_info.btdm_ant_num == 2)
1496 			ex_btc8192e2ant_ips_notify(btcoexist, ips_type);
1497 	}
1498 
1499 	halbtc_normal_low_power(btcoexist);
1500 }
1501 
exhalbtc_lps_notify(struct btc_coexist * btcoexist,u8 type)1502 void exhalbtc_lps_notify(struct btc_coexist *btcoexist, u8 type)
1503 {
1504 	u8 lps_type;
1505 
1506 	if (!halbtc_is_bt_coexist_available(btcoexist))
1507 		return;
1508 	btcoexist->statistics.cnt_lps_notify++;
1509 	if (btcoexist->manual_control)
1510 		return;
1511 
1512 	if (EACTIVE == type)
1513 		lps_type = BTC_LPS_DISABLE;
1514 	else
1515 		lps_type = BTC_LPS_ENABLE;
1516 
1517 	if (IS_HARDWARE_TYPE_8821(btcoexist->adapter)) {
1518 		if (btcoexist->board_info.btdm_ant_num == 2)
1519 			ex_btc8821a2ant_lps_notify(btcoexist, lps_type);
1520 		else if (btcoexist->board_info.btdm_ant_num == 1)
1521 			ex_btc8821a1ant_lps_notify(btcoexist, lps_type);
1522 	} else if (IS_HARDWARE_TYPE_8723B(btcoexist->adapter)) {
1523 		if (btcoexist->board_info.btdm_ant_num == 2)
1524 			ex_btc8723b2ant_lps_notify(btcoexist, lps_type);
1525 		else if (btcoexist->board_info.btdm_ant_num == 1)
1526 			ex_btc8723b1ant_lps_notify(btcoexist, lps_type);
1527 	} else if (IS_HARDWARE_TYPE_8192E(btcoexist->adapter)) {
1528 		if (btcoexist->board_info.btdm_ant_num == 2)
1529 			ex_btc8192e2ant_lps_notify(btcoexist, lps_type);
1530 	}
1531 }
1532 
exhalbtc_scan_notify(struct btc_coexist * btcoexist,u8 type)1533 void exhalbtc_scan_notify(struct btc_coexist *btcoexist, u8 type)
1534 {
1535 	u8 scan_type;
1536 
1537 	if (!halbtc_is_bt_coexist_available(btcoexist))
1538 		return;
1539 	btcoexist->statistics.cnt_scan_notify++;
1540 	if (btcoexist->manual_control)
1541 		return;
1542 
1543 	if (type)
1544 		scan_type = BTC_SCAN_START;
1545 	else
1546 		scan_type = BTC_SCAN_FINISH;
1547 
1548 	halbtc_leave_low_power(btcoexist);
1549 
1550 	if (IS_HARDWARE_TYPE_8821(btcoexist->adapter)) {
1551 		if (btcoexist->board_info.btdm_ant_num == 2)
1552 			ex_btc8821a2ant_scan_notify(btcoexist, scan_type);
1553 		else if (btcoexist->board_info.btdm_ant_num == 1)
1554 			ex_btc8821a1ant_scan_notify(btcoexist, scan_type);
1555 	} else if (IS_HARDWARE_TYPE_8723B(btcoexist->adapter)) {
1556 		if (btcoexist->board_info.btdm_ant_num == 2)
1557 			ex_btc8723b2ant_scan_notify(btcoexist, scan_type);
1558 		else if (btcoexist->board_info.btdm_ant_num == 1)
1559 			ex_btc8723b1ant_scan_notify(btcoexist, scan_type);
1560 	} else if (IS_HARDWARE_TYPE_8192E(btcoexist->adapter)) {
1561 		if (btcoexist->board_info.btdm_ant_num == 2)
1562 			ex_btc8192e2ant_scan_notify(btcoexist, scan_type);
1563 	}
1564 
1565 	halbtc_normal_low_power(btcoexist);
1566 }
1567 
exhalbtc_scan_notify_wifi_only(struct wifi_only_cfg * wifionly_cfg,u8 is_5g)1568 void exhalbtc_scan_notify_wifi_only(struct wifi_only_cfg *wifionly_cfg,
1569 				    u8 is_5g)
1570 {
1571 }
1572 
exhalbtc_connect_notify(struct btc_coexist * btcoexist,u8 action)1573 void exhalbtc_connect_notify(struct btc_coexist *btcoexist, u8 action)
1574 {
1575 	u8 asso_type;
1576 	bool wifi_under_5g;
1577 
1578 	if (!halbtc_is_bt_coexist_available(btcoexist))
1579 		return;
1580 	btcoexist->statistics.cnt_connect_notify++;
1581 	if (btcoexist->manual_control)
1582 		return;
1583 
1584 	btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_UNDER_5G, &wifi_under_5g);
1585 
1586 	if (action)
1587 		asso_type = BTC_ASSOCIATE_START;
1588 	else
1589 		asso_type = BTC_ASSOCIATE_FINISH;
1590 
1591 	halbtc_leave_low_power(btcoexist);
1592 
1593 	if (IS_HARDWARE_TYPE_8821(btcoexist->adapter)) {
1594 		if (btcoexist->board_info.btdm_ant_num == 2)
1595 			ex_btc8821a2ant_connect_notify(btcoexist, asso_type);
1596 		else if (btcoexist->board_info.btdm_ant_num == 1)
1597 			ex_btc8821a1ant_connect_notify(btcoexist, asso_type);
1598 	} else if (IS_HARDWARE_TYPE_8723B(btcoexist->adapter)) {
1599 		if (btcoexist->board_info.btdm_ant_num == 2)
1600 			ex_btc8723b2ant_connect_notify(btcoexist, asso_type);
1601 		else if (btcoexist->board_info.btdm_ant_num == 1)
1602 			ex_btc8723b1ant_connect_notify(btcoexist, asso_type);
1603 	} else if (IS_HARDWARE_TYPE_8192E(btcoexist->adapter)) {
1604 		if (btcoexist->board_info.btdm_ant_num == 2)
1605 			ex_btc8192e2ant_connect_notify(btcoexist, asso_type);
1606 	}
1607 
1608 	halbtc_normal_low_power(btcoexist);
1609 }
1610 
exhalbtc_mediastatus_notify(struct btc_coexist * btcoexist,enum rt_media_status media_status)1611 void exhalbtc_mediastatus_notify(struct btc_coexist *btcoexist,
1612 				 enum rt_media_status media_status)
1613 {
1614 	u8 status;
1615 
1616 	if (!halbtc_is_bt_coexist_available(btcoexist))
1617 		return;
1618 	btcoexist->statistics.cnt_media_status_notify++;
1619 	if (btcoexist->manual_control)
1620 		return;
1621 
1622 	if (RT_MEDIA_CONNECT == media_status)
1623 		status = BTC_MEDIA_CONNECT;
1624 	else
1625 		status = BTC_MEDIA_DISCONNECT;
1626 
1627 	halbtc_leave_low_power(btcoexist);
1628 
1629 	if (IS_HARDWARE_TYPE_8821(btcoexist->adapter)) {
1630 		if (btcoexist->board_info.btdm_ant_num == 2)
1631 			ex_btc8821a2ant_media_status_notify(btcoexist, status);
1632 		else if (btcoexist->board_info.btdm_ant_num == 1)
1633 			ex_btc8821a1ant_media_status_notify(btcoexist, status);
1634 	} else if (IS_HARDWARE_TYPE_8723B(btcoexist->adapter)) {
1635 		if (btcoexist->board_info.btdm_ant_num == 2)
1636 			ex_btc8723b2ant_media_status_notify(btcoexist, status);
1637 		else if (btcoexist->board_info.btdm_ant_num == 1)
1638 			ex_btc8723b1ant_media_status_notify(btcoexist, status);
1639 	} else if (IS_HARDWARE_TYPE_8192E(btcoexist->adapter)) {
1640 		if (btcoexist->board_info.btdm_ant_num == 2)
1641 			ex_btc8192e2ant_media_status_notify(btcoexist, status);
1642 	}
1643 
1644 	halbtc_normal_low_power(btcoexist);
1645 }
1646 
exhalbtc_special_packet_notify(struct btc_coexist * btcoexist,u8 pkt_type)1647 void exhalbtc_special_packet_notify(struct btc_coexist *btcoexist, u8 pkt_type)
1648 {
1649 	u8 packet_type;
1650 
1651 	if (!halbtc_is_bt_coexist_available(btcoexist))
1652 		return;
1653 	btcoexist->statistics.cnt_special_packet_notify++;
1654 	if (btcoexist->manual_control)
1655 		return;
1656 
1657 	if (pkt_type == PACKET_DHCP) {
1658 		packet_type = BTC_PACKET_DHCP;
1659 	} else if (pkt_type == PACKET_EAPOL) {
1660 		packet_type = BTC_PACKET_EAPOL;
1661 	} else if (pkt_type == PACKET_ARP) {
1662 		packet_type = BTC_PACKET_ARP;
1663 	} else {
1664 		packet_type = BTC_PACKET_UNKNOWN;
1665 		return;
1666 	}
1667 
1668 	halbtc_leave_low_power(btcoexist);
1669 
1670 	if (IS_HARDWARE_TYPE_8821(btcoexist->adapter)) {
1671 		if (btcoexist->board_info.btdm_ant_num == 2)
1672 			ex_btc8821a2ant_special_packet_notify(btcoexist,
1673 							      packet_type);
1674 		else if (btcoexist->board_info.btdm_ant_num == 1)
1675 			ex_btc8821a1ant_special_packet_notify(btcoexist,
1676 							      packet_type);
1677 	} else if (IS_HARDWARE_TYPE_8723B(btcoexist->adapter)) {
1678 		if (btcoexist->board_info.btdm_ant_num == 2)
1679 			ex_btc8723b2ant_special_packet_notify(btcoexist,
1680 							      packet_type);
1681 		else if (btcoexist->board_info.btdm_ant_num == 1)
1682 			ex_btc8723b1ant_special_packet_notify(btcoexist,
1683 							      packet_type);
1684 	} else if (IS_HARDWARE_TYPE_8192E(btcoexist->adapter)) {
1685 		if (btcoexist->board_info.btdm_ant_num == 2)
1686 			ex_btc8192e2ant_special_packet_notify(btcoexist,
1687 							      packet_type);
1688 	}
1689 
1690 	halbtc_normal_low_power(btcoexist);
1691 }
1692 
exhalbtc_bt_info_notify(struct btc_coexist * btcoexist,u8 * tmp_buf,u8 length)1693 void exhalbtc_bt_info_notify(struct btc_coexist *btcoexist,
1694 			     u8 *tmp_buf, u8 length)
1695 {
1696 	if (!halbtc_is_bt_coexist_available(btcoexist))
1697 		return;
1698 	btcoexist->statistics.cnt_bt_info_notify++;
1699 
1700 	halbtc_leave_low_power(btcoexist);
1701 
1702 	if (IS_HARDWARE_TYPE_8821(btcoexist->adapter)) {
1703 		if (btcoexist->board_info.btdm_ant_num == 2)
1704 			ex_btc8821a2ant_bt_info_notify(btcoexist, tmp_buf,
1705 						       length);
1706 		else if (btcoexist->board_info.btdm_ant_num == 1)
1707 			ex_btc8821a1ant_bt_info_notify(btcoexist, tmp_buf,
1708 						       length);
1709 	} else if (IS_HARDWARE_TYPE_8723B(btcoexist->adapter)) {
1710 		if (btcoexist->board_info.btdm_ant_num == 2)
1711 			ex_btc8723b2ant_bt_info_notify(btcoexist, tmp_buf,
1712 						       length);
1713 		else if (btcoexist->board_info.btdm_ant_num == 1)
1714 			ex_btc8723b1ant_bt_info_notify(btcoexist, tmp_buf,
1715 						       length);
1716 	} else if (IS_HARDWARE_TYPE_8192E(btcoexist->adapter)) {
1717 		if (btcoexist->board_info.btdm_ant_num == 2)
1718 			ex_btc8192e2ant_bt_info_notify(btcoexist, tmp_buf,
1719 						       length);
1720 	}
1721 
1722 	halbtc_normal_low_power(btcoexist);
1723 }
1724 
exhalbtc_rf_status_notify(struct btc_coexist * btcoexist,u8 type)1725 void exhalbtc_rf_status_notify(struct btc_coexist *btcoexist, u8 type)
1726 {
1727 	if (!halbtc_is_bt_coexist_available(btcoexist))
1728 		return;
1729 
1730 	if (IS_HARDWARE_TYPE_8821(btcoexist->adapter)) {
1731 	} else if (IS_HARDWARE_TYPE_8723B(btcoexist->adapter)) {
1732 		if (btcoexist->board_info.btdm_ant_num == 1)
1733 			ex_btc8723b1ant_rf_status_notify(btcoexist, type);
1734 	} else if (IS_HARDWARE_TYPE_8192E(btcoexist->adapter)) {
1735 	}
1736 }
1737 
exhalbtc_halt_notify(struct btc_coexist * btcoexist)1738 void exhalbtc_halt_notify(struct btc_coexist *btcoexist)
1739 {
1740 	if (!halbtc_is_bt_coexist_available(btcoexist))
1741 		return;
1742 
1743 	if (IS_HARDWARE_TYPE_8821(btcoexist->adapter)) {
1744 		if (btcoexist->board_info.btdm_ant_num == 2)
1745 			ex_btc8821a2ant_halt_notify(btcoexist);
1746 		else if (btcoexist->board_info.btdm_ant_num == 1)
1747 			ex_btc8821a1ant_halt_notify(btcoexist);
1748 	} else if (IS_HARDWARE_TYPE_8723B(btcoexist->adapter)) {
1749 		if (btcoexist->board_info.btdm_ant_num == 2)
1750 			ex_btc8723b2ant_halt_notify(btcoexist);
1751 		else if (btcoexist->board_info.btdm_ant_num == 1)
1752 			ex_btc8723b1ant_halt_notify(btcoexist);
1753 	} else if (IS_HARDWARE_TYPE_8192E(btcoexist->adapter)) {
1754 		if (btcoexist->board_info.btdm_ant_num == 2)
1755 			ex_btc8192e2ant_halt_notify(btcoexist);
1756 	}
1757 
1758 	btcoexist->binded = false;
1759 }
1760 
exhalbtc_pnp_notify(struct btc_coexist * btcoexist,u8 pnp_state)1761 void exhalbtc_pnp_notify(struct btc_coexist *btcoexist, u8 pnp_state)
1762 {
1763 	if (!halbtc_is_bt_coexist_available(btcoexist))
1764 		return;
1765 
1766 	/* currently only 1ant we have to do the notification,
1767 	 * once pnp is notified to sleep state, we have to leave LPS that
1768 	 * we can sleep normally.
1769 	 */
1770 
1771 	if (IS_HARDWARE_TYPE_8723B(btcoexist->adapter)) {
1772 		if (btcoexist->board_info.btdm_ant_num == 1)
1773 			ex_btc8723b1ant_pnp_notify(btcoexist, pnp_state);
1774 		else if (btcoexist->board_info.btdm_ant_num == 2)
1775 			ex_btc8723b2ant_pnp_notify(btcoexist, pnp_state);
1776 	} else if (IS_HARDWARE_TYPE_8821(btcoexist->adapter)) {
1777 		if (btcoexist->board_info.btdm_ant_num == 1)
1778 			ex_btc8821a1ant_pnp_notify(btcoexist, pnp_state);
1779 		else if (btcoexist->board_info.btdm_ant_num == 2)
1780 			ex_btc8821a2ant_pnp_notify(btcoexist, pnp_state);
1781 	} else if (IS_HARDWARE_TYPE_8192E(btcoexist->adapter)) {
1782 	}
1783 }
1784 
exhalbtc_coex_dm_switch(struct btc_coexist * btcoexist)1785 void exhalbtc_coex_dm_switch(struct btc_coexist *btcoexist)
1786 {
1787 	struct rtl_priv *rtlpriv = btcoexist->adapter;
1788 
1789 	if (!halbtc_is_bt_coexist_available(btcoexist))
1790 		return;
1791 	btcoexist->statistics.cnt_coex_dm_switch++;
1792 
1793 	halbtc_leave_low_power(btcoexist);
1794 
1795 	if (IS_HARDWARE_TYPE_8723B(btcoexist->adapter)) {
1796 		if (btcoexist->board_info.btdm_ant_num == 1) {
1797 			btcoexist->stop_coex_dm = true;
1798 			ex_btc8723b1ant_coex_dm_reset(btcoexist);
1799 			exhalbtc_set_ant_num(rtlpriv,
1800 					     BT_COEX_ANT_TYPE_DETECTED, 2);
1801 			ex_btc8723b2ant_init_hwconfig(btcoexist);
1802 			ex_btc8723b2ant_init_coex_dm(btcoexist);
1803 			btcoexist->stop_coex_dm = false;
1804 		}
1805 	}
1806 
1807 	halbtc_normal_low_power(btcoexist);
1808 }
1809 
exhalbtc_periodical(struct btc_coexist * btcoexist)1810 void exhalbtc_periodical(struct btc_coexist *btcoexist)
1811 {
1812 	if (!halbtc_is_bt_coexist_available(btcoexist))
1813 		return;
1814 	btcoexist->statistics.cnt_periodical++;
1815 
1816 	halbtc_leave_low_power(btcoexist);
1817 
1818 	if (IS_HARDWARE_TYPE_8821(btcoexist->adapter)) {
1819 		if (btcoexist->board_info.btdm_ant_num == 2)
1820 			ex_btc8821a2ant_periodical(btcoexist);
1821 		else if (btcoexist->board_info.btdm_ant_num == 1)
1822 			if (!halbtc_under_ips(btcoexist))
1823 				ex_btc8821a1ant_periodical(btcoexist);
1824 	} else if (IS_HARDWARE_TYPE_8723B(btcoexist->adapter)) {
1825 		if (btcoexist->board_info.btdm_ant_num == 2)
1826 			ex_btc8723b2ant_periodical(btcoexist);
1827 		else if (btcoexist->board_info.btdm_ant_num == 1)
1828 			ex_btc8723b1ant_periodical(btcoexist);
1829 	} else if (IS_HARDWARE_TYPE_8192E(btcoexist->adapter)) {
1830 		if (btcoexist->board_info.btdm_ant_num == 2)
1831 			ex_btc8192e2ant_periodical(btcoexist);
1832 	}
1833 
1834 	halbtc_normal_low_power(btcoexist);
1835 }
1836 
exhalbtc_dbg_control(struct btc_coexist * btcoexist,u8 code,u8 len,u8 * data)1837 void exhalbtc_dbg_control(struct btc_coexist *btcoexist,
1838 			  u8 code, u8 len, u8 *data)
1839 {
1840 	if (!halbtc_is_bt_coexist_available(btcoexist))
1841 		return;
1842 	btcoexist->statistics.cnt_dbg_ctrl++;
1843 
1844 	halbtc_leave_low_power(btcoexist);
1845 
1846 	halbtc_normal_low_power(btcoexist);
1847 }
1848 
exhalbtc_antenna_detection(struct btc_coexist * btcoexist,u32 cent_freq,u32 offset,u32 span,u32 seconds)1849 void exhalbtc_antenna_detection(struct btc_coexist *btcoexist, u32 cent_freq,
1850 				u32 offset, u32 span, u32 seconds)
1851 {
1852 	if (!halbtc_is_bt_coexist_available(btcoexist))
1853 		return;
1854 }
1855 
exhalbtc_stack_update_profile_info(void)1856 void exhalbtc_stack_update_profile_info(void)
1857 {
1858 }
1859 
exhalbtc_update_min_bt_rssi(struct btc_coexist * btcoexist,s8 bt_rssi)1860 void exhalbtc_update_min_bt_rssi(struct btc_coexist *btcoexist, s8 bt_rssi)
1861 {
1862 	if (!halbtc_is_bt_coexist_available(btcoexist))
1863 		return;
1864 
1865 	btcoexist->stack_info.min_bt_rssi = bt_rssi;
1866 }
1867 
exhalbtc_set_hci_version(struct btc_coexist * btcoexist,u16 hci_version)1868 void exhalbtc_set_hci_version(struct btc_coexist *btcoexist, u16 hci_version)
1869 {
1870 	if (!halbtc_is_bt_coexist_available(btcoexist))
1871 		return;
1872 
1873 	btcoexist->stack_info.hci_version = hci_version;
1874 }
1875 
exhalbtc_set_bt_patch_version(struct btc_coexist * btcoexist,u16 bt_hci_version,u16 bt_patch_version)1876 void exhalbtc_set_bt_patch_version(struct btc_coexist *btcoexist,
1877 				   u16 bt_hci_version, u16 bt_patch_version)
1878 {
1879 	if (!halbtc_is_bt_coexist_available(btcoexist))
1880 		return;
1881 
1882 	btcoexist->bt_info.bt_real_fw_ver = bt_patch_version;
1883 	btcoexist->bt_info.bt_hci_ver = bt_hci_version;
1884 }
1885 
exhalbtc_set_chip_type(struct btc_coexist * btcoexist,u8 chip_type)1886 void exhalbtc_set_chip_type(struct btc_coexist *btcoexist, u8 chip_type)
1887 {
1888 	switch (chip_type) {
1889 	default:
1890 	case BT_2WIRE:
1891 	case BT_ISSC_3WIRE:
1892 	case BT_ACCEL:
1893 	case BT_RTL8756:
1894 		btcoexist->board_info.bt_chip_type = BTC_CHIP_UNDEF;
1895 		break;
1896 	case BT_CSR_BC4:
1897 		btcoexist->board_info.bt_chip_type = BTC_CHIP_CSR_BC4;
1898 		break;
1899 	case BT_CSR_BC8:
1900 		btcoexist->board_info.bt_chip_type = BTC_CHIP_CSR_BC8;
1901 		break;
1902 	case BT_RTL8723A:
1903 		btcoexist->board_info.bt_chip_type = BTC_CHIP_RTL8723A;
1904 		break;
1905 	case BT_RTL8821A:
1906 		btcoexist->board_info.bt_chip_type = BTC_CHIP_RTL8821;
1907 		break;
1908 	case BT_RTL8723B:
1909 		btcoexist->board_info.bt_chip_type = BTC_CHIP_RTL8723B;
1910 		break;
1911 	}
1912 }
1913 
exhalbtc_set_ant_num(struct rtl_priv * rtlpriv,u8 type,u8 ant_num)1914 void exhalbtc_set_ant_num(struct rtl_priv *rtlpriv, u8 type, u8 ant_num)
1915 {
1916 	struct btc_coexist *btcoexist = rtl_btc_coexist(rtlpriv);
1917 
1918 	if (!btcoexist)
1919 		return;
1920 
1921 	if (BT_COEX_ANT_TYPE_PG == type) {
1922 		btcoexist->board_info.pg_ant_num = ant_num;
1923 		btcoexist->board_info.btdm_ant_num = ant_num;
1924 	} else if (BT_COEX_ANT_TYPE_ANTDIV == type) {
1925 		btcoexist->board_info.btdm_ant_num = ant_num;
1926 	} else if (type == BT_COEX_ANT_TYPE_DETECTED) {
1927 		btcoexist->board_info.btdm_ant_num = ant_num;
1928 		if (rtlpriv->cfg->mod_params->ant_sel == 1)
1929 			btcoexist->board_info.btdm_ant_pos =
1930 				BTC_ANTENNA_AT_AUX_PORT;
1931 		else
1932 			btcoexist->board_info.btdm_ant_pos =
1933 				BTC_ANTENNA_AT_MAIN_PORT;
1934 	}
1935 }
1936 
1937 /* Currently used by 8723b only, S0 or S1 */
exhalbtc_set_single_ant_path(struct btc_coexist * btcoexist,u8 single_ant_path)1938 void exhalbtc_set_single_ant_path(struct btc_coexist *btcoexist,
1939 				  u8 single_ant_path)
1940 {
1941 	btcoexist->board_info.single_ant_path = single_ant_path;
1942 }
1943 
exhalbtc_display_bt_coex_info(struct btc_coexist * btcoexist,struct seq_file * m)1944 void exhalbtc_display_bt_coex_info(struct btc_coexist *btcoexist,
1945 				   struct seq_file *m)
1946 {
1947 	if (!halbtc_is_bt_coexist_available(btcoexist))
1948 		return;
1949 
1950 	halbtc_leave_low_power(btcoexist);
1951 
1952 	if (IS_HARDWARE_TYPE_8821(btcoexist->adapter)) {
1953 		if (btcoexist->board_info.btdm_ant_num == 2)
1954 			ex_btc8821a2ant_display_coex_info(btcoexist, m);
1955 		else if (btcoexist->board_info.btdm_ant_num == 1)
1956 			ex_btc8821a1ant_display_coex_info(btcoexist, m);
1957 	} else if (IS_HARDWARE_TYPE_8723B(btcoexist->adapter)) {
1958 		if (btcoexist->board_info.btdm_ant_num == 2)
1959 			ex_btc8723b2ant_display_coex_info(btcoexist, m);
1960 		else if (btcoexist->board_info.btdm_ant_num == 1)
1961 			ex_btc8723b1ant_display_coex_info(btcoexist, m);
1962 	} else if (IS_HARDWARE_TYPE_8192E(btcoexist->adapter)) {
1963 		if (btcoexist->board_info.btdm_ant_num == 2)
1964 			ex_btc8192e2ant_display_coex_info(btcoexist, m);
1965 	}
1966 
1967 	halbtc_normal_low_power(btcoexist);
1968 }
1969 
exhalbtc_switch_band_notify(struct btc_coexist * btcoexist,u8 type)1970 void exhalbtc_switch_band_notify(struct btc_coexist *btcoexist, u8 type)
1971 {
1972 	if (!halbtc_is_bt_coexist_available(btcoexist))
1973 		return;
1974 
1975 	if (btcoexist->manual_control)
1976 		return;
1977 
1978 	halbtc_leave_low_power(btcoexist);
1979 
1980 	halbtc_normal_low_power(btcoexist);
1981 }
1982 
exhalbtc_switch_band_notify_wifi_only(struct wifi_only_cfg * wifionly_cfg,u8 is_5g)1983 void exhalbtc_switch_band_notify_wifi_only(struct wifi_only_cfg *wifionly_cfg,
1984 					   u8 is_5g)
1985 {
1986 }
1987