• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // SPDX-License-Identifier: GPL-2.0
2 /******************************************************************************
3  *
4  * Copyright(c) 2013 Realtek Corporation. All rights reserved.
5  *
6  ******************************************************************************/
7 #include <drv_types.h>
8 #include <rtw_debug.h>
9 #include <rtw_btcoex.h>
10 #include <hal_btcoex.h>
11 
rtw_btcoex_MediaStatusNotify(struct adapter * padapter,u8 mediaStatus)12 void rtw_btcoex_MediaStatusNotify(struct adapter *padapter, u8 mediaStatus)
13 {
14 	if ((mediaStatus == RT_MEDIA_CONNECT)
15 		&& (check_fwstate(&padapter->mlmepriv, WIFI_AP_STATE) == true)) {
16 		rtw_hal_set_hwreg(padapter, HW_VAR_DL_RSVD_PAGE, NULL);
17 	}
18 
19 	hal_btcoex_MediaStatusNotify(padapter, mediaStatus);
20 }
21 
rtw_btcoex_HaltNotify(struct adapter * padapter)22 void rtw_btcoex_HaltNotify(struct adapter *padapter)
23 {
24 	if (!padapter->bup) {
25 		DBG_871X(FUNC_ADPT_FMT ": bup =%d Skip!\n",
26 			FUNC_ADPT_ARG(padapter), padapter->bup);
27 
28 		return;
29 	}
30 
31 	if (padapter->bSurpriseRemoved) {
32 		DBG_871X(FUNC_ADPT_FMT ": bSurpriseRemoved =%d Skip!\n",
33 			FUNC_ADPT_ARG(padapter), padapter->bSurpriseRemoved);
34 
35 		return;
36 	}
37 
38 	hal_btcoex_HaltNotify(padapter);
39 }
40 
41 /*  ================================================== */
42 /*  Below Functions are called by BT-Coex */
43 /*  ================================================== */
rtw_btcoex_RejectApAggregatedPacket(struct adapter * padapter,u8 enable)44 void rtw_btcoex_RejectApAggregatedPacket(struct adapter *padapter, u8 enable)
45 {
46 	struct mlme_ext_info *pmlmeinfo;
47 	struct sta_info *psta;
48 
49 	pmlmeinfo = &padapter->mlmeextpriv.mlmext_info;
50 	psta = rtw_get_stainfo(&padapter->stapriv, get_bssid(&padapter->mlmepriv));
51 
52 	if (enable) {
53 		pmlmeinfo->accept_addba_req = false;
54 		if (psta)
55 			send_delba(padapter, 0, psta->hwaddr);
56 	} else {
57 		pmlmeinfo->accept_addba_req = true;
58 	}
59 }
60 
rtw_btcoex_LPS_Enter(struct adapter * padapter)61 void rtw_btcoex_LPS_Enter(struct adapter *padapter)
62 {
63 	struct pwrctrl_priv *pwrpriv;
64 	u8 lpsVal;
65 
66 
67 	pwrpriv = adapter_to_pwrctl(padapter);
68 
69 	pwrpriv->bpower_saving = true;
70 	lpsVal = hal_btcoex_LpsVal(padapter);
71 	rtw_set_ps_mode(padapter, PS_MODE_MIN, 0, lpsVal, "BTCOEX");
72 }
73 
rtw_btcoex_LPS_Leave(struct adapter * padapter)74 void rtw_btcoex_LPS_Leave(struct adapter *padapter)
75 {
76 	struct pwrctrl_priv *pwrpriv;
77 
78 
79 	pwrpriv = adapter_to_pwrctl(padapter);
80 
81 	if (pwrpriv->pwr_mode != PS_MODE_ACTIVE) {
82 		rtw_set_ps_mode(padapter, PS_MODE_ACTIVE, 0, 0, "BTCOEX");
83 		LPS_RF_ON_check(padapter, 100);
84 		pwrpriv->bpower_saving = false;
85 	}
86 }
87