1 // SPDX-License-Identifier: GPL-2.0
2 /******************************************************************************
4 * Copyright(c) 2013 Realtek Corporation. All rights reserved.
6 ******************************************************************************/
9 #include <rtw_btcoex.h>
10 #include <hal_btcoex.h>
13 void rtw_btcoex_Initialize(struct adapter *padapter)
15 hal_btcoex_Initialize(padapter);
18 void rtw_btcoex_PowerOnSetting(struct adapter *padapter)
20 hal_btcoex_PowerOnSetting(padapter);
23 void rtw_btcoex_HAL_Initialize(struct adapter *padapter, u8 bWifiOnly)
25 hal_btcoex_InitHwConfig(padapter, bWifiOnly);
28 void rtw_btcoex_IpsNotify(struct adapter *padapter, u8 type)
30 hal_btcoex_IpsNotify(padapter, type);
33 void rtw_btcoex_LpsNotify(struct adapter *padapter, u8 type)
35 hal_btcoex_LpsNotify(padapter, type);
38 void rtw_btcoex_ScanNotify(struct adapter *padapter, u8 type)
40 hal_btcoex_ScanNotify(padapter, type);
43 void rtw_btcoex_ConnectNotify(struct adapter *padapter, u8 action)
45 hal_btcoex_ConnectNotify(padapter, action);
48 void rtw_btcoex_MediaStatusNotify(struct adapter *padapter, u8 mediaStatus)
50 if ((mediaStatus == RT_MEDIA_CONNECT)
51 && (check_fwstate(&padapter->mlmepriv, WIFI_AP_STATE) == true)) {
52 rtw_hal_set_hwreg(padapter, HW_VAR_DL_RSVD_PAGE, NULL);
55 hal_btcoex_MediaStatusNotify(padapter, mediaStatus);
58 void rtw_btcoex_SpecialPacketNotify(struct adapter *padapter, u8 pktType)
60 hal_btcoex_SpecialPacketNotify(padapter, pktType);
63 void rtw_btcoex_IQKNotify(struct adapter *padapter, u8 state)
65 hal_btcoex_IQKNotify(padapter, state);
68 void rtw_btcoex_BtInfoNotify(struct adapter *padapter, u8 length, u8 *tmpBuf)
70 hal_btcoex_BtInfoNotify(padapter, length, tmpBuf);
73 void rtw_btcoex_SuspendNotify(struct adapter *padapter, u8 state)
75 hal_btcoex_SuspendNotify(padapter, state);
78 void rtw_btcoex_HaltNotify(struct adapter *padapter)
81 DBG_871X(FUNC_ADPT_FMT ": bup =%d Skip!\n",
82 FUNC_ADPT_ARG(padapter), padapter->bup);
87 if (padapter->bSurpriseRemoved) {
88 DBG_871X(FUNC_ADPT_FMT ": bSurpriseRemoved =%d Skip!\n",
89 FUNC_ADPT_ARG(padapter), padapter->bSurpriseRemoved);
94 hal_btcoex_HaltNotify(padapter);
97 u8 rtw_btcoex_IsBtDisabled(struct adapter *padapter)
99 return hal_btcoex_IsBtDisabled(padapter);
102 void rtw_btcoex_Handler(struct adapter *padapter)
104 hal_btcoex_Hanlder(padapter);
107 s32 rtw_btcoex_IsBTCoexCtrlAMPDUSize(struct adapter *padapter)
111 coexctrl = hal_btcoex_IsBTCoexCtrlAMPDUSize(padapter);
116 void rtw_btcoex_SetManualControl(struct adapter *padapter, u8 manual)
118 hal_btcoex_SetManualControl(padapter, manual);
121 u8 rtw_btcoex_IsBtControlLps(struct adapter *padapter)
123 return hal_btcoex_IsBtControlLps(padapter);
126 u8 rtw_btcoex_IsLpsOn(struct adapter *padapter)
128 return hal_btcoex_IsLpsOn(padapter);
131 u8 rtw_btcoex_RpwmVal(struct adapter *padapter)
133 return hal_btcoex_RpwmVal(padapter);
136 u8 rtw_btcoex_LpsVal(struct adapter *padapter)
138 return hal_btcoex_LpsVal(padapter);
141 void rtw_btcoex_SetBTCoexist(struct adapter *padapter, u8 bBtExist)
143 hal_btcoex_SetBTCoexist(padapter, bBtExist);
146 void rtw_btcoex_SetChipType(struct adapter *padapter, u8 chipType)
148 hal_btcoex_SetChipType(padapter, chipType);
151 void rtw_btcoex_SetPGAntNum(struct adapter *padapter, u8 antNum)
153 hal_btcoex_SetPgAntNum(padapter, antNum);
156 void rtw_btcoex_SetSingleAntPath(struct adapter *padapter, u8 singleAntPath)
158 hal_btcoex_SetSingleAntPath(padapter, singleAntPath);
161 u32 rtw_btcoex_GetRaMask(struct adapter *padapter)
163 return hal_btcoex_GetRaMask(padapter);
166 void rtw_btcoex_RecordPwrMode(struct adapter *padapter, u8 *pCmdBuf, u8 cmdLen)
168 hal_btcoex_RecordPwrMode(padapter, pCmdBuf, cmdLen);
171 void rtw_btcoex_DisplayBtCoexInfo(struct adapter *padapter, u8 *pbuf, u32 bufsize)
173 hal_btcoex_DisplayBtCoexInfo(padapter, pbuf, bufsize);
176 void rtw_btcoex_SetDBG(struct adapter *padapter, u32 *pDbgModule)
178 hal_btcoex_SetDBG(padapter, pDbgModule);
181 u32 rtw_btcoex_GetDBG(struct adapter *padapter, u8 *pStrBuf, u32 bufSize)
183 return hal_btcoex_GetDBG(padapter, pStrBuf, bufSize);
186 /* ================================================== */
187 /* Below Functions are called by BT-Coex */
188 /* ================================================== */
189 void rtw_btcoex_RejectApAggregatedPacket(struct adapter *padapter, u8 enable)
191 struct mlme_ext_info *pmlmeinfo;
192 struct sta_info *psta;
194 pmlmeinfo = &padapter->mlmeextpriv.mlmext_info;
195 psta = rtw_get_stainfo(&padapter->stapriv, get_bssid(&padapter->mlmepriv));
198 pmlmeinfo->accept_addba_req = false;
200 send_delba(padapter, 0, psta->hwaddr);
202 pmlmeinfo->accept_addba_req = true;
206 void rtw_btcoex_LPS_Enter(struct adapter *padapter)
208 struct pwrctrl_priv *pwrpriv;
212 pwrpriv = adapter_to_pwrctl(padapter);
214 pwrpriv->bpower_saving = true;
215 lpsVal = rtw_btcoex_LpsVal(padapter);
216 rtw_set_ps_mode(padapter, PS_MODE_MIN, 0, lpsVal, "BTCOEX");
219 void rtw_btcoex_LPS_Leave(struct adapter *padapter)
221 struct pwrctrl_priv *pwrpriv;
224 pwrpriv = adapter_to_pwrctl(padapter);
226 if (pwrpriv->pwr_mode != PS_MODE_ACTIVE) {
227 rtw_set_ps_mode(padapter, PS_MODE_ACTIVE, 0, 0, "BTCOEX");
228 LPS_RF_ON_check(padapter, 100);
229 pwrpriv->bpower_saving = false;