.. | .. |
---|
1 | | -/****************************************************************************** |
---|
2 | | - * |
---|
3 | | - * Copyright(c) 2007 - 2013 Realtek Corporation. All rights reserved. |
---|
4 | | - * |
---|
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. |
---|
8 | | - * |
---|
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 |
---|
12 | | - * more details. |
---|
13 | | - * |
---|
14 | | - * The full GNU General Public License is included in this distribution in the |
---|
15 | | - * file called LICENSE. |
---|
16 | | - * |
---|
17 | | - * Contact Information: |
---|
18 | | - * wlanfae <wlanfae@realtek.com> |
---|
19 | | - * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park, |
---|
20 | | - * Hsinchu 300, Taiwan. |
---|
21 | | - * |
---|
22 | | - * Larry Finger <Larry.Finger@lwfinger.net> |
---|
23 | | - * |
---|
24 | | - ******************************************************************************/ |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
---|
| 2 | +/* Copyright(c) 2007-2013 Realtek Corporation.*/ |
---|
25 | 3 | |
---|
26 | 4 | #include "halbt_precomp.h" |
---|
27 | 5 | |
---|
.. | .. |
---|
151 | 129 | |
---|
152 | 130 | if (rtlphy->current_channel != 0) |
---|
153 | 131 | chnl = rtlphy->current_channel; |
---|
154 | | - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD, |
---|
155 | | - "static halbtc_get_wifi_central_chnl:%d\n", chnl); |
---|
| 132 | + rtl_dbg(rtlpriv, COMP_BT_COEXIST, DBG_LOUD, |
---|
| 133 | + "%s:%d\n", __func__, chnl); |
---|
156 | 134 | return chnl; |
---|
157 | 135 | } |
---|
158 | 136 | |
---|
.. | .. |
---|
272 | 250 | if (!wait_ms) |
---|
273 | 251 | return true; |
---|
274 | 252 | |
---|
275 | | - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD, |
---|
276 | | - "btmpinfo wait req_num=%d wait=%ld\n", req_num, wait_ms); |
---|
| 253 | + rtl_dbg(rtlpriv, COMP_BT_COEXIST, DBG_LOUD, |
---|
| 254 | + "btmpinfo wait req_num=%d wait=%ld\n", req_num, wait_ms); |
---|
277 | 255 | |
---|
278 | 256 | if (in_interrupt()) |
---|
279 | 257 | return false; |
---|
280 | 258 | |
---|
281 | 259 | if (wait_for_completion_timeout(&btcoexist->bt_mp_comp, |
---|
282 | 260 | msecs_to_jiffies(wait_ms)) == 0) { |
---|
283 | | - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, |
---|
284 | | - "btmpinfo wait (req_num=%d) timeout\n", req_num); |
---|
| 261 | + rtl_dbg(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, |
---|
| 262 | + "btmpinfo wait (req_num=%d) timeout\n", req_num); |
---|
285 | 263 | |
---|
286 | 264 | return false; /* timeout */ |
---|
287 | 265 | } |
---|
.. | .. |
---|
292 | 270 | static void halbtc_leave_lps(struct btc_coexist *btcoexist) |
---|
293 | 271 | { |
---|
294 | 272 | struct rtl_priv *rtlpriv; |
---|
295 | | - struct rtl_ps_ctl *ppsc; |
---|
296 | 273 | bool ap_enable = false; |
---|
297 | 274 | |
---|
298 | 275 | rtlpriv = btcoexist->adapter; |
---|
299 | | - ppsc = rtl_psc(rtlpriv); |
---|
300 | 276 | |
---|
301 | 277 | btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_AP_MODE_ENABLE, |
---|
302 | 278 | &ap_enable); |
---|
303 | 279 | |
---|
304 | 280 | if (ap_enable) { |
---|
305 | | - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, |
---|
306 | | - "%s()<--dont leave lps under AP mode\n", __func__); |
---|
| 281 | + rtl_dbg(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, |
---|
| 282 | + "%s()<--dont leave lps under AP mode\n", __func__); |
---|
307 | 283 | return; |
---|
308 | 284 | } |
---|
309 | 285 | |
---|
310 | 286 | btcoexist->bt_info.bt_ctrl_lps = true; |
---|
311 | 287 | btcoexist->bt_info.bt_lps_on = false; |
---|
312 | | - rtl_lps_leave(rtlpriv->mac80211.hw); |
---|
| 288 | + /* FIXME: Context is unclear. Is it allowed to block? */ |
---|
| 289 | + rtl_lps_leave(rtlpriv->mac80211.hw, false); |
---|
313 | 290 | } |
---|
314 | 291 | |
---|
315 | 292 | static void halbtc_enter_lps(struct btc_coexist *btcoexist) |
---|
316 | 293 | { |
---|
317 | 294 | struct rtl_priv *rtlpriv; |
---|
318 | | - struct rtl_ps_ctl *ppsc; |
---|
319 | 295 | bool ap_enable = false; |
---|
320 | 296 | |
---|
321 | 297 | rtlpriv = btcoexist->adapter; |
---|
322 | | - ppsc = rtl_psc(rtlpriv); |
---|
323 | 298 | |
---|
324 | 299 | btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_AP_MODE_ENABLE, |
---|
325 | 300 | &ap_enable); |
---|
326 | 301 | |
---|
327 | 302 | if (ap_enable) { |
---|
328 | | - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, |
---|
329 | | - "%s()<--dont enter lps under AP mode\n", __func__); |
---|
| 303 | + rtl_dbg(rtlpriv, COMP_BT_COEXIST, DBG_DMESG, |
---|
| 304 | + "%s()<--dont enter lps under AP mode\n", __func__); |
---|
330 | 305 | return; |
---|
331 | 306 | } |
---|
332 | 307 | |
---|
333 | 308 | btcoexist->bt_info.bt_ctrl_lps = true; |
---|
334 | 309 | btcoexist->bt_info.bt_lps_on = true; |
---|
335 | | - rtl_lps_enter(rtlpriv->mac80211.hw); |
---|
| 310 | + /* FIXME: Context is unclear. Is it allowed to block? */ |
---|
| 311 | + rtl_lps_enter(rtlpriv->mac80211.hw, false); |
---|
336 | 312 | } |
---|
337 | 313 | |
---|
338 | 314 | static void halbtc_normal_lps(struct btc_coexist *btcoexist) |
---|
.. | .. |
---|
343 | 319 | |
---|
344 | 320 | if (btcoexist->bt_info.bt_ctrl_lps) { |
---|
345 | 321 | btcoexist->bt_info.bt_lps_on = false; |
---|
346 | | - rtl_lps_leave(rtlpriv->mac80211.hw); |
---|
| 322 | + /* FIXME: Context is unclear. Is it allowed to block? */ |
---|
| 323 | + rtl_lps_leave(rtlpriv->mac80211.hw, false); |
---|
347 | 324 | btcoexist->bt_info.bt_ctrl_lps = false; |
---|
348 | 325 | } |
---|
349 | 326 | } |
---|
.. | .. |
---|
354 | 331 | |
---|
355 | 332 | if (btcoexist->bt_info.bt_ctrl_lps) { |
---|
356 | 333 | btcoexist->bt_info.bt_lps_on = false; |
---|
357 | | - rtl_lps_leave(rtlpriv->mac80211.hw); |
---|
| 334 | + /* FIXME: Context is unclear. Is it allowed to block? */ |
---|
| 335 | + rtl_lps_leave(rtlpriv->mac80211.hw, false); |
---|
358 | 336 | } |
---|
359 | 337 | } |
---|
360 | 338 | |
---|
.. | .. |
---|
535 | 513 | |
---|
536 | 514 | static s32 halbtc_get_wifi_rssi(struct rtl_priv *rtlpriv) |
---|
537 | 515 | { |
---|
538 | | - int undec_sm_pwdb = 0; |
---|
539 | | - |
---|
540 | | - if (rtlpriv->mac80211.link_state >= MAC80211_LINKED) |
---|
541 | | - undec_sm_pwdb = rtlpriv->dm.undec_sm_pwdb; |
---|
542 | | - else /* associated entry pwdb */ |
---|
543 | | - undec_sm_pwdb = rtlpriv->dm.undec_sm_pwdb; |
---|
544 | | - return undec_sm_pwdb; |
---|
| 516 | + return rtlpriv->dm.undec_sm_pwdb; |
---|
545 | 517 | } |
---|
546 | 518 | |
---|
547 | 519 | static bool halbtc_get(void *void_btcoexist, u8 get_type, void *out_buf) |
---|
.. | .. |
---|
926 | 898 | (low_power ? ", 32k" : "")); |
---|
927 | 899 | |
---|
928 | 900 | seq_printf(m, |
---|
929 | | - "\n %-35s = %02x %02x %02x %02x %02x %02x (0x%x/0x%x)", |
---|
| 901 | + "\n %-35s = %6ph (0x%x/0x%x)", |
---|
930 | 902 | "Power mode cmd(lps/rpwm)", |
---|
931 | | - btcoexist->pwr_mode_val[0], btcoexist->pwr_mode_val[1], |
---|
932 | | - btcoexist->pwr_mode_val[2], btcoexist->pwr_mode_val[3], |
---|
933 | | - btcoexist->pwr_mode_val[4], btcoexist->pwr_mode_val[5], |
---|
| 903 | + btcoexist->pwr_mode_val, |
---|
934 | 904 | btcoexist->bt_info.lps_val, |
---|
935 | 905 | btcoexist->bt_info.rpwm_val); |
---|
936 | 906 | } |
---|
.. | .. |
---|
1350 | 1320 | { |
---|
1351 | 1321 | struct rtl_priv *rtlpriv = adapter; |
---|
1352 | 1322 | struct btc_coexist *btcoexist = rtl_btc_coexist(rtlpriv); |
---|
1353 | | - u8 ant_num = 2, chip_type, single_ant_path = 0; |
---|
| 1323 | + u8 ant_num, chip_type, single_ant_path; |
---|
1354 | 1324 | |
---|
1355 | 1325 | if (!btcoexist) |
---|
1356 | 1326 | return false; |
---|
.. | .. |
---|
1402 | 1372 | btcoexist->board_info.tfbga_package = true; |
---|
1403 | 1373 | |
---|
1404 | 1374 | if (btcoexist->board_info.tfbga_package) |
---|
1405 | | - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD, |
---|
1406 | | - "[BTCoex], Package Type = TFBGA\n"); |
---|
| 1375 | + rtl_dbg(rtlpriv, COMP_BT_COEXIST, DBG_LOUD, |
---|
| 1376 | + "[BTCoex], Package Type = TFBGA\n"); |
---|
1407 | 1377 | else |
---|
1408 | | - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD, |
---|
1409 | | - "[BTCoex], Package Type = Non-TFBGA\n"); |
---|
| 1378 | + rtl_dbg(rtlpriv, COMP_BT_COEXIST, DBG_LOUD, |
---|
| 1379 | + "[BTCoex], Package Type = Non-TFBGA\n"); |
---|
1410 | 1380 | |
---|
1411 | 1381 | btcoexist->board_info.rfe_type = rtl_get_hwpg_rfe_type(rtlpriv); |
---|
1412 | 1382 | btcoexist->board_info.ant_div_cfg = 0; |
---|
.. | .. |
---|
1493 | 1463 | ex_btc8192e2ant_init_coex_dm(btcoexist); |
---|
1494 | 1464 | } |
---|
1495 | 1465 | |
---|
1496 | | - btcoexist->initilized = true; |
---|
| 1466 | + btcoexist->initialized = true; |
---|
1497 | 1467 | } |
---|
1498 | 1468 | |
---|
1499 | 1469 | void exhalbtc_ips_notify(struct btc_coexist *btcoexist, u8 type) |
---|
.. | .. |
---|
1604 | 1574 | |
---|
1605 | 1575 | void exhalbtc_connect_notify(struct btc_coexist *btcoexist, u8 action) |
---|
1606 | 1576 | { |
---|
1607 | | - u8 asso_type, asso_type_v2; |
---|
| 1577 | + u8 asso_type; |
---|
1608 | 1578 | bool wifi_under_5g; |
---|
1609 | 1579 | |
---|
1610 | 1580 | if (!halbtc_is_bt_coexist_available(btcoexist)) |
---|
.. | .. |
---|
1615 | 1585 | |
---|
1616 | 1586 | btcoexist->btc_get(btcoexist, BTC_GET_BL_WIFI_UNDER_5G, &wifi_under_5g); |
---|
1617 | 1587 | |
---|
1618 | | - if (action) { |
---|
| 1588 | + if (action) |
---|
1619 | 1589 | asso_type = BTC_ASSOCIATE_START; |
---|
1620 | | - asso_type_v2 = wifi_under_5g ? BTC_ASSOCIATE_5G_START : |
---|
1621 | | - BTC_ASSOCIATE_START; |
---|
1622 | | - } else { |
---|
| 1590 | + else |
---|
1623 | 1591 | asso_type = BTC_ASSOCIATE_FINISH; |
---|
1624 | | - asso_type_v2 = wifi_under_5g ? BTC_ASSOCIATE_5G_FINISH : |
---|
1625 | | - BTC_ASSOCIATE_FINISH; |
---|
1626 | | - } |
---|
1627 | 1592 | |
---|
1628 | 1593 | halbtc_leave_low_power(btcoexist); |
---|
1629 | 1594 | |
---|
.. | .. |
---|
1769 | 1734 | if (btcoexist->board_info.btdm_ant_num == 1) |
---|
1770 | 1735 | ex_btc8723b1ant_rf_status_notify(btcoexist, type); |
---|
1771 | 1736 | } else if (IS_HARDWARE_TYPE_8192E(btcoexist->adapter)) { |
---|
1772 | | - } |
---|
1773 | | -} |
---|
1774 | | - |
---|
1775 | | -void exhalbtc_stack_operation_notify(struct btc_coexist *btcoexist, u8 type) |
---|
1776 | | -{ |
---|
1777 | | - u8 stack_op_type; |
---|
1778 | | - |
---|
1779 | | - if (!halbtc_is_bt_coexist_available(btcoexist)) |
---|
1780 | | - return; |
---|
1781 | | - btcoexist->statistics.cnt_stack_operation_notify++; |
---|
1782 | | - if (btcoexist->manual_control) |
---|
1783 | | - return; |
---|
1784 | | - |
---|
1785 | | - if ((type == HCI_BT_OP_INQUIRY_START) || |
---|
1786 | | - (type == HCI_BT_OP_PAGING_START) || |
---|
1787 | | - (type == HCI_BT_OP_PAIRING_START)) { |
---|
1788 | | - stack_op_type = BTC_STACK_OP_INQ_PAGE_PAIR_START; |
---|
1789 | | - } else if ((type == HCI_BT_OP_INQUIRY_FINISH) || |
---|
1790 | | - (type == HCI_BT_OP_PAGING_SUCCESS) || |
---|
1791 | | - (type == HCI_BT_OP_PAGING_UNSUCCESS) || |
---|
1792 | | - (type == HCI_BT_OP_PAIRING_FINISH)) { |
---|
1793 | | - stack_op_type = BTC_STACK_OP_INQ_PAGE_PAIR_FINISH; |
---|
1794 | | - } else { |
---|
1795 | | - stack_op_type = BTC_STACK_OP_NONE; |
---|
1796 | 1737 | } |
---|
1797 | 1738 | } |
---|
1798 | 1739 | |
---|