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_btcoex.h>
9 #include <hal_btcoex.h>
10
rtw_btcoex_MediaStatusNotify(struct adapter * padapter,u8 mediaStatus)11 void rtw_btcoex_MediaStatusNotify(struct adapter *padapter, u8 mediaStatus)
12 {
13 if ((mediaStatus == RT_MEDIA_CONNECT)
14 && (check_fwstate(&padapter->mlmepriv, WIFI_AP_STATE) == true)) {
15 rtw_hal_set_hwreg(padapter, HW_VAR_DL_RSVD_PAGE, NULL);
16 }
17
18 hal_btcoex_MediaStatusNotify(padapter, mediaStatus);
19 }
20
rtw_btcoex_HaltNotify(struct adapter * padapter)21 void rtw_btcoex_HaltNotify(struct adapter *padapter)
22 {
23 if (!padapter->bup)
24 return;
25
26 if (padapter->bSurpriseRemoved)
27 return;
28
29 hal_btcoex_HaltNotify(padapter);
30 }
31
32 /* ================================================== */
33 /* Below Functions are called by BT-Coex */
34 /* ================================================== */
rtw_btcoex_RejectApAggregatedPacket(struct adapter * padapter,u8 enable)35 void rtw_btcoex_RejectApAggregatedPacket(struct adapter *padapter, u8 enable)
36 {
37 struct mlme_ext_info *pmlmeinfo;
38 struct sta_info *psta;
39
40 pmlmeinfo = &padapter->mlmeextpriv.mlmext_info;
41 psta = rtw_get_stainfo(&padapter->stapriv, get_bssid(&padapter->mlmepriv));
42
43 if (enable) {
44 pmlmeinfo->accept_addba_req = false;
45 if (psta)
46 send_delba(padapter, 0, psta->hwaddr);
47 } else {
48 pmlmeinfo->accept_addba_req = true;
49 }
50 }
51
rtw_btcoex_LPS_Enter(struct adapter * padapter)52 void rtw_btcoex_LPS_Enter(struct adapter *padapter)
53 {
54 struct pwrctrl_priv *pwrpriv;
55 u8 lpsVal;
56
57
58 pwrpriv = adapter_to_pwrctl(padapter);
59
60 pwrpriv->bpower_saving = true;
61 lpsVal = hal_btcoex_LpsVal(padapter);
62 rtw_set_ps_mode(padapter, PS_MODE_MIN, 0, lpsVal, "BTCOEX");
63 }
64
rtw_btcoex_LPS_Leave(struct adapter * padapter)65 void rtw_btcoex_LPS_Leave(struct adapter *padapter)
66 {
67 struct pwrctrl_priv *pwrpriv;
68
69
70 pwrpriv = adapter_to_pwrctl(padapter);
71
72 if (pwrpriv->pwr_mode != PS_MODE_ACTIVE) {
73 rtw_set_ps_mode(padapter, PS_MODE_ACTIVE, 0, 0, "BTCOEX");
74 LPS_RF_ON_check(padapter, 100);
75 pwrpriv->bpower_saving = false;
76 }
77 }
78