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 return;
26
27 if (padapter->bSurpriseRemoved)
28 return;
29
30 hal_btcoex_HaltNotify(padapter);
31 }
32
33 /* ================================================== */
34 /* Below Functions are called by BT-Coex */
35 /* ================================================== */
rtw_btcoex_RejectApAggregatedPacket(struct adapter * padapter,u8 enable)36 void rtw_btcoex_RejectApAggregatedPacket(struct adapter *padapter, u8 enable)
37 {
38 struct mlme_ext_info *pmlmeinfo;
39 struct sta_info *psta;
40
41 pmlmeinfo = &padapter->mlmeextpriv.mlmext_info;
42 psta = rtw_get_stainfo(&padapter->stapriv, get_bssid(&padapter->mlmepriv));
43
44 if (enable) {
45 pmlmeinfo->accept_addba_req = false;
46 if (psta)
47 send_delba(padapter, 0, psta->hwaddr);
48 } else {
49 pmlmeinfo->accept_addba_req = true;
50 }
51 }
52
rtw_btcoex_LPS_Enter(struct adapter * padapter)53 void rtw_btcoex_LPS_Enter(struct adapter *padapter)
54 {
55 struct pwrctrl_priv *pwrpriv;
56 u8 lpsVal;
57
58
59 pwrpriv = adapter_to_pwrctl(padapter);
60
61 pwrpriv->bpower_saving = true;
62 lpsVal = hal_btcoex_LpsVal(padapter);
63 rtw_set_ps_mode(padapter, PS_MODE_MIN, 0, lpsVal, "BTCOEX");
64 }
65
rtw_btcoex_LPS_Leave(struct adapter * padapter)66 void rtw_btcoex_LPS_Leave(struct adapter *padapter)
67 {
68 struct pwrctrl_priv *pwrpriv;
69
70
71 pwrpriv = adapter_to_pwrctl(padapter);
72
73 if (pwrpriv->pwr_mode != PS_MODE_ACTIVE) {
74 rtw_set_ps_mode(padapter, PS_MODE_ACTIVE, 0, 0, "BTCOEX");
75 LPS_RF_ON_check(padapter, 100);
76 pwrpriv->bpower_saving = false;
77 }
78 }
79