.. | .. |
---|
1 | | -/****************************************************************************** |
---|
2 | | - * |
---|
3 | | - * Copyright(c) 2009-2014 Realtek Corporation. |
---|
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) 2009-2014 Realtek Corporation.*/ |
---|
25 | 3 | |
---|
26 | 4 | #include "../wifi.h" |
---|
27 | 5 | #include "../base.h" |
---|
.. | .. |
---|
247 | 225 | rtlpriv->dm.delta_power_index_last[RF90_PATH_A] = 0; |
---|
248 | 226 | rtlpriv->dm.power_index_offset[RF90_PATH_A] = 0; |
---|
249 | 227 | |
---|
250 | | - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, |
---|
251 | | - " rtlpriv->dm.txpower_tracking = %d\n", |
---|
252 | | - rtlpriv->dm.txpower_tracking); |
---|
| 228 | + rtl_dbg(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, |
---|
| 229 | + "rtlpriv->dm.txpower_tracking = %d\n", |
---|
| 230 | + rtlpriv->dm.txpower_tracking); |
---|
253 | 231 | } |
---|
254 | 232 | |
---|
255 | 233 | static void rtl8723be_dm_init_dynamic_atc_switch(struct ieee80211_hw *hw) |
---|
.. | .. |
---|
287 | 265 | if ((mac->link_state < MAC80211_LINKED) && |
---|
288 | 266 | (rtlpriv->dm.entry_min_undec_sm_pwdb == 0)) { |
---|
289 | 267 | rtl_dm_dig->min_undec_pwdb_for_dm = 0; |
---|
290 | | - RT_TRACE(rtlpriv, COMP_BB_POWERSAVING, DBG_LOUD, |
---|
291 | | - "Not connected to any\n"); |
---|
| 268 | + rtl_dbg(rtlpriv, COMP_BB_POWERSAVING, DBG_LOUD, |
---|
| 269 | + "Not connected to any\n"); |
---|
292 | 270 | } |
---|
293 | 271 | if (mac->link_state >= MAC80211_LINKED) { |
---|
294 | 272 | if (mac->opmode == NL80211_IFTYPE_AP || |
---|
295 | 273 | mac->opmode == NL80211_IFTYPE_ADHOC) { |
---|
296 | 274 | rtl_dm_dig->min_undec_pwdb_for_dm = |
---|
297 | 275 | rtlpriv->dm.entry_min_undec_sm_pwdb; |
---|
298 | | - RT_TRACE(rtlpriv, COMP_BB_POWERSAVING, DBG_LOUD, |
---|
299 | | - "AP Client PWDB = 0x%lx\n", |
---|
300 | | - rtlpriv->dm.entry_min_undec_sm_pwdb); |
---|
| 276 | + rtl_dbg(rtlpriv, COMP_BB_POWERSAVING, DBG_LOUD, |
---|
| 277 | + "AP Client PWDB = 0x%lx\n", |
---|
| 278 | + rtlpriv->dm.entry_min_undec_sm_pwdb); |
---|
301 | 279 | } else { |
---|
302 | 280 | rtl_dm_dig->min_undec_pwdb_for_dm = |
---|
303 | 281 | rtlpriv->dm.undec_sm_pwdb; |
---|
304 | | - RT_TRACE(rtlpriv, COMP_BB_POWERSAVING, DBG_LOUD, |
---|
305 | | - "STA Default Port PWDB = 0x%x\n", |
---|
306 | | - rtl_dm_dig->min_undec_pwdb_for_dm); |
---|
| 282 | + rtl_dbg(rtlpriv, COMP_BB_POWERSAVING, DBG_LOUD, |
---|
| 283 | + "STA Default Port PWDB = 0x%x\n", |
---|
| 284 | + rtl_dm_dig->min_undec_pwdb_for_dm); |
---|
307 | 285 | } |
---|
308 | 286 | } else { |
---|
309 | 287 | rtl_dm_dig->min_undec_pwdb_for_dm = |
---|
310 | 288 | rtlpriv->dm.entry_min_undec_sm_pwdb; |
---|
311 | | - RT_TRACE(rtlpriv, COMP_BB_POWERSAVING, DBG_LOUD, |
---|
312 | | - "AP Ext Port or disconnect PWDB = 0x%x\n", |
---|
313 | | - rtl_dm_dig->min_undec_pwdb_for_dm); |
---|
| 289 | + rtl_dbg(rtlpriv, COMP_BB_POWERSAVING, DBG_LOUD, |
---|
| 290 | + "AP Ext Port or disconnect PWDB = 0x%x\n", |
---|
| 291 | + rtl_dm_dig->min_undec_pwdb_for_dm); |
---|
314 | 292 | } |
---|
315 | | - RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "MinUndecoratedPWDBForDM =%d\n", |
---|
316 | | - rtl_dm_dig->min_undec_pwdb_for_dm); |
---|
| 293 | + rtl_dbg(rtlpriv, COMP_DIG, DBG_LOUD, "MinUndecoratedPWDBForDM =%d\n", |
---|
| 294 | + rtl_dm_dig->min_undec_pwdb_for_dm); |
---|
317 | 295 | } |
---|
318 | 296 | |
---|
319 | 297 | static void rtl8723be_dm_check_rssi_monitor(struct ieee80211_hw *hw) |
---|
.. | .. |
---|
443 | 421 | } else { |
---|
444 | 422 | dm_digtable->rx_gain_max = dm_dig_max; |
---|
445 | 423 | dig_min_0 = dm_dig_min; |
---|
446 | | - RT_TRACE(rtlpriv, COMP_DIG, DBG_LOUD, "no link\n"); |
---|
| 424 | + rtl_dbg(rtlpriv, COMP_DIG, DBG_LOUD, "no link\n"); |
---|
447 | 425 | } |
---|
448 | 426 | |
---|
449 | 427 | if (rtlpriv->falsealm_cnt.cnt_all > 10000) { |
---|
.. | .. |
---|
598 | 576 | rtl_set_bbreg(hw, DM_REG_CCK_FA_RST_11N, BIT(15) | BIT(14), 0); |
---|
599 | 577 | rtl_set_bbreg(hw, DM_REG_CCK_FA_RST_11N, BIT(15) | BIT(14), 2); |
---|
600 | 578 | |
---|
601 | | - RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, |
---|
602 | | - "cnt_parity_fail = %d, cnt_rate_illegal = %d, cnt_crc8_fail = %d, cnt_mcs_fail = %d\n", |
---|
603 | | - falsealm_cnt->cnt_parity_fail, |
---|
604 | | - falsealm_cnt->cnt_rate_illegal, |
---|
605 | | - falsealm_cnt->cnt_crc8_fail, |
---|
606 | | - falsealm_cnt->cnt_mcs_fail); |
---|
| 579 | + rtl_dbg(rtlpriv, COMP_DIG, DBG_TRACE, |
---|
| 580 | + "cnt_parity_fail = %d, cnt_rate_illegal = %d, cnt_crc8_fail = %d, cnt_mcs_fail = %d\n", |
---|
| 581 | + falsealm_cnt->cnt_parity_fail, |
---|
| 582 | + falsealm_cnt->cnt_rate_illegal, |
---|
| 583 | + falsealm_cnt->cnt_crc8_fail, |
---|
| 584 | + falsealm_cnt->cnt_mcs_fail); |
---|
607 | 585 | |
---|
608 | | - RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, |
---|
609 | | - "cnt_ofdm_fail = %x, cnt_cck_fail = %x, cnt_all = %x\n", |
---|
610 | | - falsealm_cnt->cnt_ofdm_fail, |
---|
611 | | - falsealm_cnt->cnt_cck_fail, |
---|
612 | | - falsealm_cnt->cnt_all); |
---|
| 586 | + rtl_dbg(rtlpriv, COMP_DIG, DBG_TRACE, |
---|
| 587 | + "cnt_ofdm_fail = %x, cnt_cck_fail = %x, cnt_all = %x\n", |
---|
| 588 | + falsealm_cnt->cnt_ofdm_fail, |
---|
| 589 | + falsealm_cnt->cnt_cck_fail, |
---|
| 590 | + falsealm_cnt->cnt_all); |
---|
613 | 591 | } |
---|
614 | 592 | |
---|
615 | 593 | static void rtl8723be_dm_dynamic_txpower(struct ieee80211_hw *hw) |
---|
.. | .. |
---|
758 | 736 | u8 ofdm_min_index = 6; |
---|
759 | 737 | u8 index_for_channel = 0; |
---|
760 | 738 | |
---|
761 | | - s8 delta_swing_table_idx_tup_a[TXSCALE_TABLE_SIZE] = { |
---|
| 739 | + static const s8 delta_swing_table_idx_tup_a[TXSCALE_TABLE_SIZE] = { |
---|
762 | 740 | 0, 0, 1, 2, 2, 2, 3, 3, 3, 4, 5, |
---|
763 | 741 | 5, 6, 6, 7, 7, 8, 8, 9, 9, 9, 10, |
---|
764 | 742 | 10, 11, 11, 12, 12, 13, 14, 15}; |
---|
765 | | - s8 delta_swing_table_idx_tdown_a[TXSCALE_TABLE_SIZE] = { |
---|
| 743 | + static const s8 delta_swing_table_idx_tdown_a[TXSCALE_TABLE_SIZE] = { |
---|
766 | 744 | 0, 0, 1, 2, 2, 2, 3, 3, 3, 4, 5, |
---|
767 | 745 | 5, 6, 6, 6, 6, 7, 7, 7, 8, 8, 9, |
---|
768 | 746 | 9, 10, 10, 11, 12, 13, 14, 15}; |
---|
769 | 747 | |
---|
770 | 748 | /*Initilization ( 7 steps in total )*/ |
---|
771 | 749 | rtlpriv->dm.txpower_trackinginit = true; |
---|
772 | | - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, |
---|
773 | | - "rtl8723be_dm_txpower_tracking_callback_thermalmeter\n"); |
---|
| 750 | + rtl_dbg(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, |
---|
| 751 | + "%s\n", __func__); |
---|
774 | 752 | |
---|
775 | 753 | thermalvalue = (u8)rtl_get_rfreg(hw, |
---|
776 | 754 | RF90_PATH_A, RF_T_METER, 0xfc00); |
---|
777 | 755 | if (!rtlpriv->dm.txpower_track_control || thermalvalue == 0 || |
---|
778 | 756 | rtlefuse->eeprom_thermalmeter == 0xFF) |
---|
779 | 757 | return; |
---|
780 | | - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, |
---|
781 | | - "Readback Thermal Meter = 0x%x pre thermal meter 0x%x eeprom_thermalmeter 0x%x\n", |
---|
782 | | - thermalvalue, rtldm->thermalvalue, |
---|
783 | | - rtlefuse->eeprom_thermalmeter); |
---|
| 758 | + rtl_dbg(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, |
---|
| 759 | + "Readback Thermal Meter = 0x%x pre thermal meter 0x%x eeprom_thermalmeter 0x%x\n", |
---|
| 760 | + thermalvalue, rtldm->thermalvalue, |
---|
| 761 | + rtlefuse->eeprom_thermalmeter); |
---|
784 | 762 | /*3 Initialize ThermalValues of RFCalibrateInfo*/ |
---|
785 | 763 | if (!rtldm->thermalvalue) { |
---|
786 | 764 | rtlpriv->dm.thermalvalue_lck = thermalvalue; |
---|
.. | .. |
---|
814 | 792 | (thermalvalue - rtlpriv->dm.thermalvalue_iqk) : |
---|
815 | 793 | (rtlpriv->dm.thermalvalue_iqk - thermalvalue); |
---|
816 | 794 | |
---|
817 | | - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, |
---|
818 | | - "Readback Thermal Meter = 0x%x pre thermal meter 0x%x eeprom_thermalmeter 0x%x delta 0x%x delta_lck 0x%x delta_iqk 0x%x\n", |
---|
819 | | - thermalvalue, rtlpriv->dm.thermalvalue, |
---|
820 | | - rtlefuse->eeprom_thermalmeter, delta, delta_lck, delta_iqk); |
---|
| 795 | + rtl_dbg(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, |
---|
| 796 | + "Readback Thermal Meter = 0x%x pre thermal meter 0x%x eeprom_thermalmeter 0x%x delta 0x%x delta_lck 0x%x delta_iqk 0x%x\n", |
---|
| 797 | + thermalvalue, rtlpriv->dm.thermalvalue, |
---|
| 798 | + rtlefuse->eeprom_thermalmeter, delta, delta_lck, delta_iqk); |
---|
821 | 799 | /* 6 If necessary, do LCK.*/ |
---|
822 | 800 | if (delta_lck >= IQK_THRESHOLD) { |
---|
823 | 801 | rtlpriv->dm.thermalvalue_lck = thermalvalue; |
---|
.. | .. |
---|
898 | 876 | } |
---|
899 | 877 | |
---|
900 | 878 | rtldm->txpowercount = 0; |
---|
901 | | - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, "end\n"); |
---|
| 879 | + rtl_dbg(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, "end\n"); |
---|
902 | 880 | |
---|
903 | 881 | } |
---|
904 | 882 | |
---|
.. | .. |
---|
912 | 890 | if (!rtlpriv->dm.tm_trigger) { |
---|
913 | 891 | rtl_set_rfreg(hw, RF90_PATH_A, RF_T_METER, BIT(17) | BIT(16), |
---|
914 | 892 | 0x03); |
---|
915 | | - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, |
---|
916 | | - "Trigger 8723be Thermal Meter!!\n"); |
---|
| 893 | + rtl_dbg(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, |
---|
| 894 | + "Trigger 8723be Thermal Meter!!\n"); |
---|
917 | 895 | rtlpriv->dm.tm_trigger = 1; |
---|
918 | 896 | return; |
---|
919 | 897 | } else { |
---|
920 | | - RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, |
---|
921 | | - "Schedule TxPowerTracking !!\n"); |
---|
| 898 | + rtl_dbg(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, |
---|
| 899 | + "Schedule TxPowerTracking !!\n"); |
---|
922 | 900 | rtl8723be_dm_txpower_tracking_callback_thermalmeter(hw); |
---|
923 | 901 | rtlpriv->dm.tm_trigger = 0; |
---|
924 | 902 | } |
---|
.. | .. |
---|
936 | 914 | struct ieee80211_sta *sta = NULL; |
---|
937 | 915 | |
---|
938 | 916 | if (is_hal_stop(rtlhal)) { |
---|
939 | | - RT_TRACE(rtlpriv, COMP_RATE, DBG_LOUD, |
---|
940 | | - "driver is going to unload\n"); |
---|
| 917 | + rtl_dbg(rtlpriv, COMP_RATE, DBG_LOUD, |
---|
| 918 | + "driver is going to unload\n"); |
---|
941 | 919 | return; |
---|
942 | 920 | } |
---|
943 | 921 | |
---|
944 | 922 | if (!rtlpriv->dm.useramask) { |
---|
945 | | - RT_TRACE(rtlpriv, COMP_RATE, DBG_LOUD, |
---|
946 | | - "driver does not control rate adaptive mask\n"); |
---|
| 923 | + rtl_dbg(rtlpriv, COMP_RATE, DBG_LOUD, |
---|
| 924 | + "driver does not control rate adaptive mask\n"); |
---|
947 | 925 | return; |
---|
948 | 926 | } |
---|
949 | 927 | |
---|
.. | .. |
---|
971 | 949 | p_ra->ratr_state = DM_RATR_STA_LOW; |
---|
972 | 950 | |
---|
973 | 951 | if (p_ra->pre_ratr_state != p_ra->ratr_state) { |
---|
974 | | - RT_TRACE(rtlpriv, COMP_RATE, DBG_LOUD, |
---|
975 | | - "RSSI = %ld\n", |
---|
| 952 | + rtl_dbg(rtlpriv, COMP_RATE, DBG_LOUD, |
---|
| 953 | + "RSSI = %ld\n", |
---|
976 | 954 | rtlpriv->dm.undec_sm_pwdb); |
---|
977 | | - RT_TRACE(rtlpriv, COMP_RATE, DBG_LOUD, |
---|
978 | | - "RSSI_LEVEL = %d\n", p_ra->ratr_state); |
---|
979 | | - RT_TRACE(rtlpriv, COMP_RATE, DBG_LOUD, |
---|
980 | | - "PreState = %d, CurState = %d\n", |
---|
981 | | - p_ra->pre_ratr_state, p_ra->ratr_state); |
---|
| 955 | + rtl_dbg(rtlpriv, COMP_RATE, DBG_LOUD, |
---|
| 956 | + "RSSI_LEVEL = %d\n", p_ra->ratr_state); |
---|
| 957 | + rtl_dbg(rtlpriv, COMP_RATE, DBG_LOUD, |
---|
| 958 | + "PreState = %d, CurState = %d\n", |
---|
| 959 | + p_ra->pre_ratr_state, p_ra->ratr_state); |
---|
982 | 960 | |
---|
983 | 961 | rcu_read_lock(); |
---|
984 | 962 | sta = rtl_find_sta(hw, mac->bssid); |
---|
.. | .. |
---|
1017 | 995 | u32 edca_be = 0x5ea42b; |
---|
1018 | 996 | u32 iot_peer = 0; |
---|
1019 | 997 | bool b_is_cur_rdlstate; |
---|
1020 | | - bool b_last_is_cur_rdlstate = false; |
---|
1021 | 998 | bool b_bias_on_rx = false; |
---|
1022 | 999 | bool b_edca_turbo_on = false; |
---|
1023 | | - |
---|
1024 | | - b_last_is_cur_rdlstate = rtlpriv->dm.is_cur_rdlstate; |
---|
1025 | 1000 | |
---|
1026 | 1001 | cur_txok_cnt = rtlpriv->stats.txbytesunicast - last_txok_cnt; |
---|
1027 | 1002 | cur_rxok_cnt = rtlpriv->stats.rxbytesunicast - last_rxok_cnt; |
---|
.. | .. |
---|
1098 | 1073 | |
---|
1099 | 1074 | dm_digtable->pre_cck_cca_thres = dm_digtable->cur_cck_cca_thres; |
---|
1100 | 1075 | dm_digtable->cur_cck_cca_thres = cur_cck_cca_thresh; |
---|
1101 | | - RT_TRACE(rtlpriv, COMP_DIG, DBG_TRACE, |
---|
1102 | | - "CCK cca thresh hold =%x\n", dm_digtable->cur_cck_cca_thres); |
---|
| 1076 | + rtl_dbg(rtlpriv, COMP_DIG, DBG_TRACE, |
---|
| 1077 | + "CCK cca thresh hold =%x\n", dm_digtable->cur_cck_cca_thres); |
---|
1103 | 1078 | } |
---|
1104 | 1079 | |
---|
1105 | 1080 | static void rtl8723be_dm_dynamic_edcca(struct ieee80211_hw *hw) |
---|
.. | .. |
---|
1146 | 1121 | } |
---|
1147 | 1122 | if (rtlpriv->cfg->ops->get_btc_status()) { |
---|
1148 | 1123 | if (!rtlpriv->btcoexist.btc_ops->btc_is_bt_disabled(rtlpriv)) { |
---|
1149 | | - RT_TRACE(rtlpriv, COMP_BT_COEXIST, DBG_LOUD, |
---|
1150 | | - "odm_DynamicATCSwitch(): Disable CFO tracking for BT!!\n"); |
---|
| 1124 | + rtl_dbg(rtlpriv, COMP_BT_COEXIST, DBG_LOUD, |
---|
| 1125 | + "odm_DynamicATCSwitch(): Disable CFO tracking for BT!!\n"); |
---|
1151 | 1126 | return; |
---|
1152 | 1127 | } |
---|
1153 | 1128 | } |
---|
.. | .. |
---|
1177 | 1152 | (rtldm->cfo_ave_pre - cfo_ave) : |
---|
1178 | 1153 | (cfo_ave - rtldm->cfo_ave_pre); |
---|
1179 | 1154 | |
---|
1180 | | - if (cfo_ave_diff > 20 && rtldm->large_cfo_hit == 0) { |
---|
1181 | | - rtldm->large_cfo_hit = 1; |
---|
| 1155 | + if (cfo_ave_diff > 20 && !rtldm->large_cfo_hit) { |
---|
| 1156 | + rtldm->large_cfo_hit = true; |
---|
1182 | 1157 | return; |
---|
1183 | 1158 | } else |
---|
1184 | | - rtldm->large_cfo_hit = 0; |
---|
| 1159 | + rtldm->large_cfo_hit = false; |
---|
1185 | 1160 | |
---|
1186 | 1161 | rtldm->cfo_ave_pre = cfo_ave; |
---|
1187 | 1162 | |
---|