1 /******************************************************************************
3 * Copyright(c) 2009-2012 Realtek Corporation.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
18 * The full GNU General Public License is included in this distribution in the
19 * file called LICENSE.
21 * Contact Information:
22 * wlanfae <wlanfae@realtek.com>
23 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
24 * Hsinchu 300, Taiwan.
26 * Larry Finger <Larry.Finger@lwfinger.net>
28 *****************************************************************************/
30 #include "hal_bt_coexist.h"
38 void rtl8723ae_dm_bt_reject_ap_aggregated_packet(struct ieee80211_hw
*hw
,
43 void _rtl8723_dm_bt_check_wifi_state(struct ieee80211_hw
*hw
)
45 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
46 struct rtl_pci_priv
*rtlpcipriv
= rtl_pcipriv(hw
);
47 struct rtl_phy
*rtlphy
= &(rtlpriv
->phy
);
49 if (rtlpriv
->link_info
.busytraffic
) {
50 rtlpcipriv
->bt_coexist
.cstate
&= ~BT_COEX_STATE_WIFI_IDLE
;
52 if (rtlpriv
->link_info
.tx_busy_traffic
)
53 rtlpcipriv
->bt_coexist
.cstate
|=
54 BT_COEX_STATE_WIFI_UPLINK
;
56 rtlpcipriv
->bt_coexist
.cstate
&=
57 ~BT_COEX_STATE_WIFI_UPLINK
;
59 if (rtlpriv
->link_info
.rx_busy_traffic
)
60 rtlpcipriv
->bt_coexist
.cstate
|=
61 BT_COEX_STATE_WIFI_DOWNLINK
;
63 rtlpcipriv
->bt_coexist
.cstate
&=
64 ~BT_COEX_STATE_WIFI_DOWNLINK
;
66 rtlpcipriv
->bt_coexist
.cstate
|= BT_COEX_STATE_WIFI_IDLE
;
67 rtlpcipriv
->bt_coexist
.cstate
&= ~BT_COEX_STATE_WIFI_UPLINK
;
68 rtlpcipriv
->bt_coexist
.cstate
&= ~BT_COEX_STATE_WIFI_DOWNLINK
;
71 if (rtlpriv
->mac80211
.mode
== WIRELESS_MODE_G
||
72 rtlpriv
->mac80211
.mode
== WIRELESS_MODE_B
) {
73 rtlpcipriv
->bt_coexist
.cstate
|= BT_COEX_STATE_WIFI_LEGACY
;
74 rtlpcipriv
->bt_coexist
.cstate
&= ~BT_COEX_STATE_WIFI_HT20
;
75 rtlpcipriv
->bt_coexist
.cstate
&= ~BT_COEX_STATE_WIFI_HT40
;
77 rtlpcipriv
->bt_coexist
.cstate
&= ~BT_COEX_STATE_WIFI_LEGACY
;
78 if (rtlphy
->current_chan_bw
== HT_CHANNEL_WIDTH_20_40
) {
79 rtlpcipriv
->bt_coexist
.cstate
|=
80 BT_COEX_STATE_WIFI_HT40
;
81 rtlpcipriv
->bt_coexist
.cstate
&=
82 ~BT_COEX_STATE_WIFI_HT20
;
84 rtlpcipriv
->bt_coexist
.cstate
|=
85 BT_COEX_STATE_WIFI_HT20
;
86 rtlpcipriv
->bt_coexist
.cstate
&=
87 ~BT_COEX_STATE_WIFI_HT40
;
91 if (rtlpriv
->bt_operation_on
)
92 rtlpcipriv
->bt_coexist
.cstate
|= BT_COEX_STATE_BT30
;
94 rtlpcipriv
->bt_coexist
.cstate
&= ~BT_COEX_STATE_BT30
;
97 u8
rtl8723ae_dm_bt_check_coex_rssi_state1(struct ieee80211_hw
*hw
,
98 u8 level_num
, u8 rssi_thresh
,
102 struct rtl_pci_priv
*rtlpcipriv
= rtl_pcipriv(hw
);
103 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
105 u8 bt_rssi_state
= 0;
107 smooth
= rtl8723ae_dm_bt_get_rx_ss(hw
);
109 if (level_num
== 2) {
110 rtlpcipriv
->bt_coexist
.cstate
&=
111 ~BT_COEX_STATE_WIFI_RSSI_1_MEDIUM
;
113 if ((rtlpcipriv
->bt_coexist
.bt_pre_rssi_state
==
114 BT_RSSI_STATE_LOW
) ||
115 (rtlpcipriv
->bt_coexist
.bt_pre_rssi_state
==
116 BT_RSSI_STATE_STAY_LOW
)) {
117 if (smooth
>= (rssi_thresh
+
118 BT_FW_COEX_THRESH_TOL
)) {
119 bt_rssi_state
= BT_RSSI_STATE_HIGH
;
120 rtlpcipriv
->bt_coexist
.cstate
|=
121 BT_COEX_STATE_WIFI_RSSI_1_HIGH
;
122 rtlpcipriv
->bt_coexist
.cstate
&=
123 ~BT_COEX_STATE_WIFI_RSSI_1_LOW
;
124 RT_TRACE(rtlpriv
, COMP_BT_COEXIST
, DBG_TRACE
,
125 "[DM][BT], RSSI_1 state switch to High\n");
127 bt_rssi_state
= BT_RSSI_STATE_STAY_LOW
;
128 RT_TRACE(rtlpriv
, COMP_BT_COEXIST
, DBG_TRACE
,
129 "[DM][BT], RSSI_1 state stay at Low\n");
132 if (smooth
< rssi_thresh
) {
133 bt_rssi_state
= BT_RSSI_STATE_LOW
;
134 rtlpcipriv
->bt_coexist
.cstate
|=
135 BT_COEX_STATE_WIFI_RSSI_1_LOW
;
136 rtlpcipriv
->bt_coexist
.cstate
&=
137 ~BT_COEX_STATE_WIFI_RSSI_1_HIGH
;
138 RT_TRACE(rtlpriv
, COMP_BT_COEXIST
, DBG_TRACE
,
139 "[DM][BT], RSSI_1 state switch to Low\n");
141 bt_rssi_state
= BT_RSSI_STATE_STAY_HIGH
;
142 RT_TRACE(rtlpriv
, COMP_BT_COEXIST
, DBG_TRACE
,
143 "[DM][BT], RSSI_1 state stay at High\n");
146 } else if (level_num
== 3) {
147 if (rssi_thresh
> rssi_thresh1
) {
148 RT_TRACE(rtlpriv
, COMP_BT_COEXIST
, DBG_TRACE
,
149 "[DM][BT], RSSI_1 thresh error!!\n");
150 return rtlpcipriv
->bt_coexist
.bt_pre_rssi_state
;
153 if ((rtlpcipriv
->bt_coexist
.bt_pre_rssi_state
==
154 BT_RSSI_STATE_LOW
) ||
155 (rtlpcipriv
->bt_coexist
.bt_pre_rssi_state
==
156 BT_RSSI_STATE_STAY_LOW
)) {
158 (rssi_thresh
+BT_FW_COEX_THRESH_TOL
)) {
159 bt_rssi_state
= BT_RSSI_STATE_MEDIUM
;
160 rtlpcipriv
->bt_coexist
.cstate
|=
161 BT_COEX_STATE_WIFI_RSSI_1_MEDIUM
;
162 rtlpcipriv
->bt_coexist
.cstate
&=
163 ~BT_COEX_STATE_WIFI_RSSI_1_LOW
;
164 rtlpcipriv
->bt_coexist
.cstate
&=
165 ~BT_COEX_STATE_WIFI_RSSI_1_HIGH
;
166 RT_TRACE(rtlpriv
, COMP_BT_COEXIST
, DBG_TRACE
,
167 "[DM][BT], RSSI_1 state switch to Medium\n");
169 bt_rssi_state
= BT_RSSI_STATE_STAY_LOW
;
170 RT_TRACE(rtlpriv
, COMP_BT_COEXIST
, DBG_TRACE
,
171 "[DM][BT], RSSI_1 state stay at Low\n");
173 } else if ((rtlpcipriv
->bt_coexist
.bt_pre_rssi_state
==
174 BT_RSSI_STATE_MEDIUM
) ||
175 (rtlpcipriv
->bt_coexist
.bt_pre_rssi_state
==
176 BT_RSSI_STATE_STAY_MEDIUM
)) {
177 if (smooth
>= (rssi_thresh1
+
178 BT_FW_COEX_THRESH_TOL
)) {
179 bt_rssi_state
= BT_RSSI_STATE_HIGH
;
180 rtlpcipriv
->bt_coexist
.cstate
|=
181 BT_COEX_STATE_WIFI_RSSI_1_HIGH
;
182 rtlpcipriv
->bt_coexist
.cstate
&=
183 ~BT_COEX_STATE_WIFI_RSSI_1_LOW
;
184 rtlpcipriv
->bt_coexist
.cstate
&=
185 ~BT_COEX_STATE_WIFI_RSSI_1_MEDIUM
;
186 RT_TRACE(rtlpriv
, COMP_BT_COEXIST
, DBG_TRACE
,
187 "[DM][BT], RSSI_1 state switch to High\n");
188 } else if (smooth
< rssi_thresh
) {
189 bt_rssi_state
= BT_RSSI_STATE_LOW
;
190 rtlpcipriv
->bt_coexist
.cstate
|=
191 BT_COEX_STATE_WIFI_RSSI_1_LOW
;
192 rtlpcipriv
->bt_coexist
.cstate
&=
193 ~BT_COEX_STATE_WIFI_RSSI_1_HIGH
;
194 rtlpcipriv
->bt_coexist
.cstate
&=
195 ~BT_COEX_STATE_WIFI_RSSI_1_MEDIUM
;
196 RT_TRACE(rtlpriv
, COMP_BT_COEXIST
, DBG_TRACE
,
197 "[DM][BT], RSSI_1 state switch to Low\n");
199 bt_rssi_state
= BT_RSSI_STATE_STAY_MEDIUM
;
200 RT_TRACE(rtlpriv
, COMP_BT_COEXIST
, DBG_TRACE
,
201 "[DM][BT], RSSI_1 state stay at Medium\n");
204 if (smooth
< rssi_thresh1
) {
205 bt_rssi_state
= BT_RSSI_STATE_MEDIUM
;
206 rtlpcipriv
->bt_coexist
.cstate
|=
207 BT_COEX_STATE_WIFI_RSSI_1_MEDIUM
;
208 rtlpcipriv
->bt_coexist
.cstate
&=
209 ~BT_COEX_STATE_WIFI_RSSI_1_HIGH
;
210 rtlpcipriv
->bt_coexist
.cstate
&=
211 ~BT_COEX_STATE_WIFI_RSSI_1_LOW
;
212 RT_TRACE(rtlpriv
, COMP_BT_COEXIST
, DBG_TRACE
,
213 "[DM][BT], RSSI_1 state switch to Medium\n");
215 bt_rssi_state
= BT_RSSI_STATE_STAY_HIGH
;
216 RT_TRACE(rtlpriv
, COMP_BT_COEXIST
, DBG_TRACE
,
217 "[DM][BT], RSSI_1 state stay at High\n");
222 rtlpcipriv
->bt_coexist
.bt_pre_rssi_state1
= bt_rssi_state
;
224 return bt_rssi_state
;
227 u8
rtl8723ae_dm_bt_check_coex_rssi_state(struct ieee80211_hw
*hw
,
228 u8 level_num
, u8 rssi_thresh
,
231 struct rtl_pci_priv
*rtlpcipriv
= rtl_pcipriv(hw
);
232 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
234 u8 bt_rssi_state
= 0;
236 smooth
= rtl8723ae_dm_bt_get_rx_ss(hw
);
238 if (level_num
== 2) {
239 rtlpcipriv
->bt_coexist
.cstate
&=
240 ~BT_COEX_STATE_WIFI_RSSI_MEDIUM
;
242 if ((rtlpcipriv
->bt_coexist
.bt_pre_rssi_state
==
243 BT_RSSI_STATE_LOW
) ||
244 (rtlpcipriv
->bt_coexist
.bt_pre_rssi_state
==
245 BT_RSSI_STATE_STAY_LOW
)){
247 (rssi_thresh
+ BT_FW_COEX_THRESH_TOL
)) {
248 bt_rssi_state
= BT_RSSI_STATE_HIGH
;
249 rtlpcipriv
->bt_coexist
.cstate
|=
250 BT_COEX_STATE_WIFI_RSSI_HIGH
;
251 rtlpcipriv
->bt_coexist
.cstate
&=
252 ~BT_COEX_STATE_WIFI_RSSI_LOW
;
253 RT_TRACE(rtlpriv
, COMP_BT_COEXIST
, DBG_TRACE
,
254 "[DM][BT], RSSI state switch to High\n");
256 bt_rssi_state
= BT_RSSI_STATE_STAY_LOW
;
257 RT_TRACE(rtlpriv
, COMP_BT_COEXIST
, DBG_TRACE
,
258 "[DM][BT], RSSI state stay at Low\n");
261 if (smooth
< rssi_thresh
) {
262 bt_rssi_state
= BT_RSSI_STATE_LOW
;
263 rtlpcipriv
->bt_coexist
.cstate
|=
264 BT_COEX_STATE_WIFI_RSSI_LOW
;
265 rtlpcipriv
->bt_coexist
.cstate
&=
266 ~BT_COEX_STATE_WIFI_RSSI_HIGH
;
267 RT_TRACE(rtlpriv
, COMP_BT_COEXIST
, DBG_TRACE
,
268 "[DM][BT], RSSI state switch to Low\n");
270 bt_rssi_state
= BT_RSSI_STATE_STAY_HIGH
;
271 RT_TRACE(rtlpriv
, COMP_BT_COEXIST
, DBG_TRACE
,
272 "[DM][BT], RSSI state stay at High\n");
275 } else if (level_num
== 3) {
276 if (rssi_thresh
> rssi_thresh1
) {
277 RT_TRACE(rtlpriv
, COMP_BT_COEXIST
, DBG_TRACE
,
278 "[DM][BT], RSSI thresh error!!\n");
279 return rtlpcipriv
->bt_coexist
.bt_pre_rssi_state
;
281 if ((rtlpcipriv
->bt_coexist
.bt_pre_rssi_state
==
282 BT_RSSI_STATE_LOW
) ||
283 (rtlpcipriv
->bt_coexist
.bt_pre_rssi_state
==
284 BT_RSSI_STATE_STAY_LOW
)) {
286 (rssi_thresh
+ BT_FW_COEX_THRESH_TOL
)) {
287 bt_rssi_state
= BT_RSSI_STATE_MEDIUM
;
288 rtlpcipriv
->bt_coexist
.cstate
289 |= BT_COEX_STATE_WIFI_RSSI_MEDIUM
;
290 rtlpcipriv
->bt_coexist
.cstate
291 &= ~BT_COEX_STATE_WIFI_RSSI_LOW
;
292 rtlpcipriv
->bt_coexist
.cstate
293 &= ~BT_COEX_STATE_WIFI_RSSI_HIGH
;
294 RT_TRACE(rtlpriv
, COMP_BT_COEXIST
, DBG_TRACE
,
295 "[DM][BT], RSSI state switch to Medium\n");
297 bt_rssi_state
= BT_RSSI_STATE_STAY_LOW
;
298 RT_TRACE(rtlpriv
, COMP_BT_COEXIST
, DBG_TRACE
,
299 "[DM][BT], RSSI state stay at Low\n");
301 } else if ((rtlpcipriv
->bt_coexist
.bt_pre_rssi_state
==
302 BT_RSSI_STATE_MEDIUM
) ||
303 (rtlpcipriv
->bt_coexist
.bt_pre_rssi_state
==
304 BT_RSSI_STATE_STAY_MEDIUM
)) {
306 (rssi_thresh1
+ BT_FW_COEX_THRESH_TOL
)) {
307 bt_rssi_state
= BT_RSSI_STATE_HIGH
;
308 rtlpcipriv
->bt_coexist
.cstate
309 |= BT_COEX_STATE_WIFI_RSSI_HIGH
;
310 rtlpcipriv
->bt_coexist
.cstate
311 &= ~BT_COEX_STATE_WIFI_RSSI_LOW
;
312 rtlpcipriv
->bt_coexist
.cstate
313 &= ~BT_COEX_STATE_WIFI_RSSI_MEDIUM
;
314 RT_TRACE(rtlpriv
, COMP_BT_COEXIST
, DBG_TRACE
,
315 "[DM][BT], RSSI state switch to High\n");
316 } else if (smooth
< rssi_thresh
) {
317 bt_rssi_state
= BT_RSSI_STATE_LOW
;
318 rtlpcipriv
->bt_coexist
.cstate
319 |= BT_COEX_STATE_WIFI_RSSI_LOW
;
320 rtlpcipriv
->bt_coexist
.cstate
321 &= ~BT_COEX_STATE_WIFI_RSSI_HIGH
;
322 rtlpcipriv
->bt_coexist
.cstate
323 &= ~BT_COEX_STATE_WIFI_RSSI_MEDIUM
;
324 RT_TRACE(rtlpriv
, COMP_BT_COEXIST
, DBG_TRACE
,
325 "[DM][BT], RSSI state switch to Low\n");
327 bt_rssi_state
= BT_RSSI_STATE_STAY_MEDIUM
;
328 RT_TRACE(rtlpriv
, COMP_BT_COEXIST
, DBG_TRACE
,
329 "[DM][BT], RSSI state stay at Medium\n");
332 if (smooth
< rssi_thresh1
) {
333 bt_rssi_state
= BT_RSSI_STATE_MEDIUM
;
334 rtlpcipriv
->bt_coexist
.cstate
335 |= BT_COEX_STATE_WIFI_RSSI_MEDIUM
;
336 rtlpcipriv
->bt_coexist
.cstate
337 &= ~BT_COEX_STATE_WIFI_RSSI_HIGH
;
338 rtlpcipriv
->bt_coexist
.cstate
339 &= ~BT_COEX_STATE_WIFI_RSSI_LOW
;
340 RT_TRACE(rtlpriv
, COMP_BT_COEXIST
, DBG_TRACE
,
341 "[DM][BT], RSSI state switch to Medium\n");
343 bt_rssi_state
= BT_RSSI_STATE_STAY_HIGH
;
344 RT_TRACE(rtlpriv
, COMP_BT_COEXIST
, DBG_TRACE
,
345 "[DM][BT], RSSI state stay at High\n");
350 rtlpcipriv
->bt_coexist
.bt_pre_rssi_state
= bt_rssi_state
;
351 return bt_rssi_state
;
354 long rtl8723ae_dm_bt_get_rx_ss(struct ieee80211_hw
*hw
)
356 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
359 if (rtlpriv
->mac80211
.link_state
>= MAC80211_LINKED
)
360 smooth
= GET_UNDECORATED_AVERAGE_RSSI(rtlpriv
);
362 smooth
= rtlpriv
->dm
.entry_min_undec_sm_pwdb
;
364 RT_TRACE(rtlpriv
, COMP_BT_COEXIST
, DBG_TRACE
,
365 "rtl8723ae_dm_bt_get_rx_ss() = %ld\n", smooth
);
370 void rtl8723ae_dm_bt_balance(struct ieee80211_hw
*hw
,
371 bool balance_on
, u8 ms0
, u8 ms1
)
373 struct rtl_pci_priv
*rtlpcipriv
= rtl_pcipriv(hw
);
374 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
375 u8 h2c_parameter
[3] = {0};
378 h2c_parameter
[2] = 1;
379 h2c_parameter
[1] = ms1
;
380 h2c_parameter
[0] = ms0
;
381 rtlpcipriv
->bt_coexist
.fw_coexist_all_off
= false;
383 h2c_parameter
[2] = 0;
384 h2c_parameter
[1] = 0;
385 h2c_parameter
[0] = 0;
387 rtlpcipriv
->bt_coexist
.balance_on
= balance_on
;
389 RT_TRACE(rtlpriv
, COMP_BT_COEXIST
, DBG_TRACE
,
390 "[DM][BT], Balance=[%s:%dms:%dms], write 0xc=0x%x\n",
391 balance_on
? "ON" : "OFF", ms0
, ms1
,
392 h2c_parameter
[0]<<16 | h2c_parameter
[1]<<8 | h2c_parameter
[2]);
394 rtl8723ae_fill_h2c_cmd(hw
, 0xc, 3, h2c_parameter
);
398 void rtl8723ae_dm_bt_agc_table(struct ieee80211_hw
*hw
, u8 type
)
400 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
401 struct rtl_pci_priv
*rtlpcipriv
= rtl_pcipriv(hw
);
403 if (type
== BT_AGCTABLE_OFF
) {
404 RT_TRACE(rtlpriv
, COMP_BT_COEXIST
, DBG_TRACE
,
405 "[BT]AGCTable Off!\n");
406 rtl_write_dword(rtlpriv
, 0xc78, 0x641c0001);
407 rtl_write_dword(rtlpriv
, 0xc78, 0x631d0001);
408 rtl_write_dword(rtlpriv
, 0xc78, 0x621e0001);
409 rtl_write_dword(rtlpriv
, 0xc78, 0x611f0001);
410 rtl_write_dword(rtlpriv
, 0xc78, 0x60200001);
412 rtl8723ae_phy_set_rf_reg(hw
, RF90_PATH_A
,
413 RF_RX_AGC_HP
, 0xfffff, 0x32000);
414 rtl8723ae_phy_set_rf_reg(hw
, RF90_PATH_A
,
415 RF_RX_AGC_HP
, 0xfffff, 0x71000);
416 rtl8723ae_phy_set_rf_reg(hw
, RF90_PATH_A
,
417 RF_RX_AGC_HP
, 0xfffff, 0xb0000);
418 rtl8723ae_phy_set_rf_reg(hw
, RF90_PATH_A
,
419 RF_RX_AGC_HP
, 0xfffff, 0xfc000);
420 rtl8723ae_phy_set_rf_reg(hw
, RF90_PATH_A
,
421 RF_RX_G1
, 0xfffff, 0x30355);
422 } else if (type
== BT_AGCTABLE_ON
) {
423 RT_TRACE(rtlpriv
, COMP_BT_COEXIST
, DBG_TRACE
,
424 "[BT]AGCTable On!\n");
425 rtl_write_dword(rtlpriv
, 0xc78, 0x4e1c0001);
426 rtl_write_dword(rtlpriv
, 0xc78, 0x4d1d0001);
427 rtl_write_dword(rtlpriv
, 0xc78, 0x4c1e0001);
428 rtl_write_dword(rtlpriv
, 0xc78, 0x4b1f0001);
429 rtl_write_dword(rtlpriv
, 0xc78, 0x4a200001);
431 rtl8723ae_phy_set_rf_reg(hw
, RF90_PATH_A
,
432 RF_RX_AGC_HP
, 0xfffff, 0xdc000);
433 rtl8723ae_phy_set_rf_reg(hw
, RF90_PATH_A
,
434 RF_RX_AGC_HP
, 0xfffff, 0x90000);
435 rtl8723ae_phy_set_rf_reg(hw
, RF90_PATH_A
,
436 RF_RX_AGC_HP
, 0xfffff, 0x51000);
437 rtl8723ae_phy_set_rf_reg(hw
, RF90_PATH_A
,
438 RF_RX_AGC_HP
, 0xfffff, 0x12000);
439 rtl8723ae_phy_set_rf_reg(hw
, RF90_PATH_A
,
440 RF_RX_G1
, 0xfffff, 0x00355);
442 rtlpcipriv
->bt_coexist
.sw_coexist_all_off
= false;
446 void rtl8723ae_dm_bt_bback_off_level(struct ieee80211_hw
*hw
, u8 type
)
448 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
449 struct rtl_pci_priv
*rtlpcipriv
= rtl_pcipriv(hw
);
451 if (type
== BT_BB_BACKOFF_OFF
) {
452 RT_TRACE(rtlpriv
, COMP_BT_COEXIST
, DBG_TRACE
,
453 "[BT]BBBackOffLevel Off!\n");
454 rtl_write_dword(rtlpriv
, 0xc04, 0x3a05611);
455 } else if (type
== BT_BB_BACKOFF_ON
) {
456 RT_TRACE(rtlpriv
, COMP_BT_COEXIST
, DBG_TRACE
,
457 "[BT]BBBackOffLevel On!\n");
458 rtl_write_dword(rtlpriv
, 0xc04, 0x3a07611);
459 rtlpcipriv
->bt_coexist
.sw_coexist_all_off
= false;
463 void rtl8723ae_dm_bt_fw_coex_all_off(struct ieee80211_hw
*hw
)
465 struct rtl_pci_priv
*rtlpcipriv
= rtl_pcipriv(hw
);
466 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
467 RT_TRACE(rtlpriv
, COMP_BT_COEXIST
, DBG_TRACE
,
468 "rtl8723ae_dm_bt_fw_coex_all_off()\n");
470 if (rtlpcipriv
->bt_coexist
.fw_coexist_all_off
)
473 RT_TRACE(rtlpriv
, COMP_BT_COEXIST
, DBG_TRACE
,
474 "rtl8723ae_dm_bt_fw_coex_all_off(), real Do\n");
475 rtl8723ae_dm_bt_fw_coex_all_off_8723a(hw
);
476 rtlpcipriv
->bt_coexist
.fw_coexist_all_off
= true;
479 void rtl8723ae_dm_bt_sw_coex_all_off(struct ieee80211_hw
*hw
)
481 struct rtl_pci_priv
*rtlpcipriv
= rtl_pcipriv(hw
);
482 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
484 RT_TRACE(rtlpriv
, COMP_BT_COEXIST
, DBG_TRACE
,
485 "rtl8723ae_dm_bt_sw_coex_all_off()\n");
487 if (rtlpcipriv
->bt_coexist
.sw_coexist_all_off
)
490 RT_TRACE(rtlpriv
, COMP_BT_COEXIST
, DBG_TRACE
,
491 "rtl8723ae_dm_bt_sw_coex_all_off(), real Do\n");
492 rtl8723ae_dm_bt_sw_coex_all_off_8723a(hw
);
493 rtlpcipriv
->bt_coexist
.sw_coexist_all_off
= true;
496 void rtl8723ae_dm_bt_hw_coex_all_off(struct ieee80211_hw
*hw
)
498 struct rtl_pci_priv
*rtlpcipriv
= rtl_pcipriv(hw
);
499 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
501 RT_TRACE(rtlpriv
, COMP_BT_COEXIST
, DBG_TRACE
,
502 "rtl8723ae_dm_bt_hw_coex_all_off()\n");
504 if (rtlpcipriv
->bt_coexist
.hw_coexist_all_off
)
506 RT_TRACE(rtlpriv
, COMP_BT_COEXIST
, DBG_TRACE
,
507 "rtl8723ae_dm_bt_hw_coex_all_off(), real Do\n");
509 rtl8723ae_dm_bt_hw_coex_all_off_8723a(hw
);
511 rtlpcipriv
->bt_coexist
.hw_coexist_all_off
= true;
514 void rtl8723ae_btdm_coex_all_off(struct ieee80211_hw
*hw
)
516 rtl8723ae_dm_bt_fw_coex_all_off(hw
);
517 rtl8723ae_dm_bt_sw_coex_all_off(hw
);
518 rtl8723ae_dm_bt_hw_coex_all_off(hw
);
521 bool rtl8723ae_dm_bt_is_coexist_state_changed(struct ieee80211_hw
*hw
)
523 struct rtl_pci_priv
*rtlpcipriv
= rtl_pcipriv(hw
);
525 if ((rtlpcipriv
->bt_coexist
.previous_state
==
526 rtlpcipriv
->bt_coexist
.cstate
) &&
527 (rtlpcipriv
->bt_coexist
.previous_state_h
==
528 rtlpcipriv
->bt_coexist
.cstate_h
))
534 bool rtl8723ae_dm_bt_is_wifi_up_link(struct ieee80211_hw
*hw
)
536 struct rtl_priv
*rtlpriv
= rtl_priv(hw
);
538 if (rtlpriv
->link_info
.tx_busy_traffic
)