38 #define UNDEC_SM_PWDB entry_min_undecoratedsmoothed_pwdb
87 {0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04},
88 {0x33, 0x32, 0x2b, 0x23, 0x1a, 0x11, 0x08, 0x04},
89 {0x30, 0x2f, 0x29, 0x21, 0x19, 0x10, 0x08, 0x03},
90 {0x2d, 0x2d, 0x27, 0x1f, 0x18, 0x0f, 0x08, 0x03},
91 {0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03},
92 {0x28, 0x28, 0x22, 0x1c, 0x15, 0x0d, 0x07, 0x03},
93 {0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03},
94 {0x24, 0x23, 0x1f, 0x19, 0x13, 0x0c, 0x06, 0x03},
95 {0x22, 0x21, 0x1d, 0x18, 0x11, 0x0b, 0x06, 0x02},
96 {0x20, 0x20, 0x1b, 0x16, 0x11, 0x08, 0x05, 0x02},
97 {0x1f, 0x1e, 0x1a, 0x15, 0x10, 0x0a, 0x05, 0x02},
98 {0x1d, 0x1c, 0x18, 0x14, 0x0f, 0x0a, 0x05, 0x02},
99 {0x1b, 0x1a, 0x17, 0x13, 0x0e, 0x09, 0x04, 0x02},
100 {0x1a, 0x19, 0x16, 0x12, 0x0d, 0x09, 0x04, 0x02},
101 {0x18, 0x17, 0x15, 0x11, 0x0c, 0x08, 0x04, 0x02},
102 {0x17, 0x16, 0x13, 0x10, 0x0c, 0x08, 0x04, 0x02},
103 {0x16, 0x15, 0x12, 0x0f, 0x0b, 0x07, 0x04, 0x01},
104 {0x14, 0x14, 0x11, 0x0e, 0x0b, 0x07, 0x03, 0x02},
105 {0x13, 0x13, 0x10, 0x0d, 0x0a, 0x06, 0x03, 0x01},
106 {0x12, 0x12, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01},
107 {0x11, 0x11, 0x0f, 0x0c, 0x09, 0x06, 0x03, 0x01},
108 {0x10, 0x10, 0x0e, 0x0b, 0x08, 0x05, 0x03, 0x01},
109 {0x0f, 0x0f, 0x0d, 0x0b, 0x08, 0x05, 0x03, 0x01},
110 {0x0e, 0x0e, 0x0c, 0x0a, 0x08, 0x05, 0x02, 0x01},
111 {0x0d, 0x0d, 0x0c, 0x0a, 0x07, 0x05, 0x02, 0x01},
112 {0x0d, 0x0c, 0x0b, 0x09, 0x07, 0x04, 0x02, 0x01},
113 {0x0c, 0x0c, 0x0a, 0x09, 0x06, 0x04, 0x02, 0x01},
114 {0x0b, 0x0b, 0x0a, 0x08, 0x06, 0x04, 0x02, 0x01},
115 {0x0b, 0x0a, 0x09, 0x08, 0x06, 0x04, 0x02, 0x01},
116 {0x0a, 0x0a, 0x09, 0x07, 0x05, 0x03, 0x02, 0x01},
117 {0x0a, 0x09, 0x08, 0x07, 0x05, 0x03, 0x02, 0x01},
118 {0x09, 0x09, 0x08, 0x06, 0x05, 0x03, 0x01, 0x01},
119 {0x09, 0x08, 0x07, 0x06, 0x04, 0x03, 0x01, 0x01}
123 {0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00},
124 {0x33, 0x32, 0x2b, 0x19, 0x00, 0x00, 0x00, 0x00},
125 {0x30, 0x2f, 0x29, 0x18, 0x00, 0x00, 0x00, 0x00},
126 {0x2d, 0x2d, 0x17, 0x17, 0x00, 0x00, 0x00, 0x00},
127 {0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00},
128 {0x28, 0x28, 0x24, 0x14, 0x00, 0x00, 0x00, 0x00},
129 {0x26, 0x25, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00},
130 {0x24, 0x23, 0x1f, 0x12, 0x00, 0x00, 0x00, 0x00},
131 {0x22, 0x21, 0x1d, 0x11, 0x00, 0x00, 0x00, 0x00},
132 {0x20, 0x20, 0x1b, 0x10, 0x00, 0x00, 0x00, 0x00},
133 {0x1f, 0x1e, 0x1a, 0x0f, 0x00, 0x00, 0x00, 0x00},
134 {0x1d, 0x1c, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00},
135 {0x1b, 0x1a, 0x17, 0x0e, 0x00, 0x00, 0x00, 0x00},
136 {0x1a, 0x19, 0x16, 0x0d, 0x00, 0x00, 0x00, 0x00},
137 {0x18, 0x17, 0x15, 0x0c, 0x00, 0x00, 0x00, 0x00},
138 {0x17, 0x16, 0x13, 0x0b, 0x00, 0x00, 0x00, 0x00},
139 {0x16, 0x15, 0x12, 0x0b, 0x00, 0x00, 0x00, 0x00},
140 {0x14, 0x14, 0x11, 0x0a, 0x00, 0x00, 0x00, 0x00},
141 {0x13, 0x13, 0x10, 0x0a, 0x00, 0x00, 0x00, 0x00},
142 {0x12, 0x12, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00},
143 {0x11, 0x11, 0x0f, 0x09, 0x00, 0x00, 0x00, 0x00},
144 {0x10, 0x10, 0x0e, 0x08, 0x00, 0x00, 0x00, 0x00},
145 {0x0f, 0x0f, 0x0d, 0x08, 0x00, 0x00, 0x00, 0x00},
146 {0x0e, 0x0e, 0x0c, 0x07, 0x00, 0x00, 0x00, 0x00},
147 {0x0d, 0x0d, 0x0c, 0x07, 0x00, 0x00, 0x00, 0x00},
148 {0x0d, 0x0c, 0x0b, 0x06, 0x00, 0x00, 0x00, 0x00},
149 {0x0c, 0x0c, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x00},
150 {0x0b, 0x0b, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x00},
151 {0x0b, 0x0a, 0x09, 0x05, 0x00, 0x00, 0x00, 0x00},
152 {0x0a, 0x0a, 0x09, 0x05, 0x00, 0x00, 0x00, 0x00},
153 {0x0a, 0x09, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00},
154 {0x09, 0x09, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00},
155 {0x09, 0x08, 0x07, 0x04, 0x00, 0x00, 0x00, 0x00}
186 static void rtl92d_dm_false_alarm_counter_statistics(
struct ieee80211_hw *
hw)
191 unsigned long flag = 0;
204 falsealm_cnt->
cnt_crc8_fail = ((ret_value & 0xffff0000) >> 16);
216 rtl92d_acquire_cckandrw_pagea_ctl(hw, &flag);
221 rtl92d_release_cckandrw_pagea_ctl(hw, &flag);
244 rtl92d_acquire_cckandrw_pagea_ctl(hw, &flag);
248 rtl92d_release_cckandrw_pagea_ctl(hw, &flag);
251 "Cnt_Fast_Fsync_fail = %x, Cnt_SB_Search_fail = %x\n",
255 "Cnt_Parity_Fail = %x, Cnt_Rate_Illegal = %x, Cnt_Crc8_fail = %x, Cnt_Mcs_fail = %x\n",
261 "Cnt_Ofdm_fail = %x, Cnt_Cck_fail = %x, Cnt_all = %x\n",
267 static void rtl92d_dm_find_minimum_rssi(
struct ieee80211_hw *hw)
275 (rtlpriv->
dm.UNDEC_SM_PWDB == 0)) {
278 "Not connected to any\n");
284 rtlpriv->
dm.UNDEC_SM_PWDB;
286 "AP Client PWDB = 0x%lx\n",
287 rtlpriv->
dm.UNDEC_SM_PWDB);
290 rtlpriv->
dm.undecorated_smoothed_pwdb;
292 "STA Default Port PWDB = 0x%x\n",
297 rtlpriv->
dm.UNDEC_SM_PWDB;
299 "AP Ext Port or disconnect PWDB = 0x%x\n",
307 static void rtl92d_dm_cck_packet_detection_thresh(
struct ieee80211_hw *hw)
311 unsigned long flag = 0;
334 rtl92d_acquire_cckandrw_pagea_ctl(hw, &flag);
336 rtl92d_release_cckandrw_pagea_ctl(hw, &flag);
338 rtl92d_acquire_cckandrw_pagea_ctl(hw, &flag);
340 rtl92d_release_cckandrw_pagea_ctl(hw, &flag);
346 "DIG_STA_CONNECT " :
"DIG_STA_DISCONNECT");
349 "Low RSSI " :
"High RSSI ");
361 "cur_igvalue = 0x%x, pre_igvalue = 0x%x, backoff_val = %d\n",
378 static void rtl92d_early_mode_enabled(
struct rtl_priv *rtlpriv)
410 if (rtlpriv->
rtlhal.earlymode_enable) {
411 rtl92d_early_mode_enabled(rtlpriv);
415 if (!rtlpriv->
dm.dm_initialgain_enable)
445 "dm_DIG() Before: large_fa_hit=%d, forbidden_igi=%x\n",
448 "dm_DIG() Before: Recover_cnt=%d, rx_gain_range_min=%x\n",
452 if (falsealm_cnt->
cnt_all > 10000) {
454 "dm_DIG(): Abnormally false alarm case\n");
493 "dm_DIG() After: large_fa_hit=%d, forbidden_igi=%x\n",
496 "dm_DIG() After: recover_cnt=%d, rx_gain_range_min=%x\n",
501 else if (value_igi < de_digtable->rx_gain_range_min)
506 rtl92d_dm_cck_packet_detection_thresh(hw);
510 static void rtl92d_dm_init_dynamic_txpower(
struct ieee80211_hw *hw)
514 rtlpriv->
dm.dynamic_txpower_enable =
true;
519 static void rtl92d_dm_dynamic_txpower(
struct ieee80211_hw *hw)
525 long undecorated_smoothed_pwdb;
527 if ((!rtlpriv->
dm.dynamic_txpower_enable)
533 (rtlpriv->
dm.UNDEC_SM_PWDB == 0)) {
535 "Not connected to any\n");
542 undecorated_smoothed_pwdb =
543 rtlpriv->
dm.UNDEC_SM_PWDB;
545 "IBSS Client PWDB = 0x%lx\n",
546 undecorated_smoothed_pwdb);
548 undecorated_smoothed_pwdb =
549 rtlpriv->
dm.undecorated_smoothed_pwdb;
551 "STA Default Port PWDB = 0x%lx\n",
552 undecorated_smoothed_pwdb);
555 undecorated_smoothed_pwdb =
556 rtlpriv->
dm.UNDEC_SM_PWDB;
559 "AP Ext Port PWDB = 0x%lx\n",
560 undecorated_smoothed_pwdb);
563 if (undecorated_smoothed_pwdb >= 0x33) {
564 rtlpriv->
dm.dynamic_txhighpower_lvl =
567 "5G:TxHighPwrLevel_Level2 (TxPwr=0x0)\n");
568 }
else if ((undecorated_smoothed_pwdb < 0x33)
569 && (undecorated_smoothed_pwdb >= 0x2b)) {
570 rtlpriv->
dm.dynamic_txhighpower_lvl =
573 "5G:TxHighPwrLevel_Level1 (TxPwr=0x10)\n");
574 }
else if (undecorated_smoothed_pwdb < 0x2b) {
575 rtlpriv->
dm.dynamic_txhighpower_lvl =
578 "5G:TxHighPwrLevel_Normal\n");
581 if (undecorated_smoothed_pwdb >=
583 rtlpriv->
dm.dynamic_txhighpower_lvl =
586 "TXHIGHPWRLEVEL_LEVEL1 (TxPwr=0x0)\n");
588 if ((undecorated_smoothed_pwdb <
590 && (undecorated_smoothed_pwdb >=
593 rtlpriv->
dm.dynamic_txhighpower_lvl =
596 "TXHIGHPWRLEVEL_LEVEL1 (TxPwr=0x10)\n");
597 }
else if (undecorated_smoothed_pwdb <
599 rtlpriv->
dm.dynamic_txhighpower_lvl =
602 "TXHIGHPWRLEVEL_NORMAL\n");
605 if ((rtlpriv->
dm.dynamic_txhighpower_lvl != rtlpriv->
dm.last_dtp_lvl)) {
607 "PHY_SetTxPowerLevel8192S() Channel = %d\n",
611 rtlpriv->
dm.last_dtp_lvl = rtlpriv->
dm.dynamic_txhighpower_lvl;
614 static void rtl92d_dm_pwdb_monitor(
struct ieee80211_hw *hw)
622 if (rtlpriv->
dm.useramask) {
623 u32 temp = rtlpriv->
dm.undecorated_smoothed_pwdb;
631 rtl_write_byte(rtlpriv, 0x4fe,
632 (
u8) rtlpriv->
dm.undecorated_smoothed_pwdb);
640 rtlpriv->
dm.current_turbo_edca =
false;
641 rtlpriv->
dm.is_any_nonbepkts =
false;
642 rtlpriv->
dm.is_cur_rdlstate =
false;
645 static void rtl92d_dm_check_edca_turbo(
struct ieee80211_hw *hw)
649 static u64 last_txok_cnt;
650 static u64 last_rxok_cnt;
653 u32 edca_be_ul = 0x5ea42b;
654 u32 edca_be_dl = 0x5ea42b;
657 rtlpriv->
dm.current_turbo_edca =
false;
663 if ((!rtlpriv->
dm.disable_framebursting) &&
668 if (!(edca_be_ul & 0xffff0000))
669 edca_be_ul |= 0x005e0000;
671 if (!(edca_be_dl & 0xffff0000))
672 edca_be_dl |= 0x005e0000;
675 if ((!rtlpriv->
dm.is_any_nonbepkts) &&
676 (!rtlpriv->
dm.disable_framebursting)) {
677 cur_txok_cnt = rtlpriv->
stats.txbytesunicast - last_txok_cnt;
678 cur_rxok_cnt = rtlpriv->
stats.rxbytesunicast - last_rxok_cnt;
679 if (cur_rxok_cnt > 4 * cur_txok_cnt) {
680 if (!rtlpriv->
dm.is_cur_rdlstate ||
681 !rtlpriv->
dm.current_turbo_edca) {
684 rtlpriv->
dm.is_cur_rdlstate =
true;
687 if (rtlpriv->
dm.is_cur_rdlstate ||
688 !rtlpriv->
dm.current_turbo_edca) {
691 rtlpriv->
dm.is_cur_rdlstate =
false;
694 rtlpriv->
dm.current_turbo_edca =
true;
696 if (rtlpriv->
dm.current_turbo_edca) {
700 rtlpriv->
dm.current_turbo_edca =
false;
705 rtlpriv->
dm.is_any_nonbepkts =
false;
706 last_txok_cnt = rtlpriv->
stats.txbytesunicast;
707 last_rxok_cnt = rtlpriv->
stats.rxbytesunicast;
710 static void rtl92d_dm_rxgain_tracking_thermalmeter(
struct ieee80211_hw *hw)
714 0x0f, 0x0f, 0x0d, 0x0c, 0x0b,
715 0x0a, 0x09, 0x08, 0x07, 0x06,
716 0x05, 0x04, 0x04, 0x03, 0x02
721 u4tmp = (index_mapping[(rtlpriv->
efuse.eeprom_thermalmeter -
722 rtlpriv->
dm.thermalvalue_rxgain)]) << 12;
724 "===> Rx Gain %x\n", u4tmp);
727 (rtlpriv->
phy.reg_rf3c[i] & (~(0xF000))) | u4tmp);
730 static void rtl92d_bandtype_2_4G(
struct ieee80211_hw *hw,
long *temp_cckg,
735 unsigned long flag = 0;
739 rtl92d_acquire_cckandrw_pagea_ctl(hw, &flag);
742 rtl92d_release_cckandrw_pagea_ctl(hw, &flag);
744 if (rtlpriv->
dm.cck_inch14) {
745 if (!
memcmp((
void *)&temp_cck,
746 (
void *)&cckswing_table_ch14[i][2], 4)) {
747 *cck_index_old = (
u8) i;
749 "Initial reg0x%x = 0x%lx, cck_index=0x%x, ch 14 %d\n",
752 rtlpriv->
dm.cck_inch14);
756 if (!
memcmp((
void *) &temp_cck,
757 &cckswing_table_ch1ch13[i][2], 4)) {
758 *cck_index_old = (
u8) i;
760 "Initial reg0x%x = 0x%lx, cck_index = 0x%x, ch14 %d\n",
763 rtlpriv->
dm.cck_inch14);
768 *temp_cckg = temp_cck;
771 static void rtl92d_bandtype_5G(
struct rtl_hal *rtlhal,
u8 *ofdm_index,
772 bool *internal_pa,
u8 thermalvalue,
u8 delta,
776 u8 index_mapping_pa[8][INDEX_MAPPING_NUM])
782 for (i = 0; i < rf; i++) {
805 if (delta > INDEX_MAPPING_NUM - 1)
806 index = index_mapping_pa[
offset]
807 [INDEX_MAPPING_NUM - 1];
812 if (delta > INDEX_MAPPING_NUM - 1)
814 index_mapping[
offset][INDEX_MAPPING_NUM - 1];
819 if (*internal_pa && thermalvalue > 0x12) {
820 ofdm_index[
i] = rtlpriv->
dm.ofdm_index[
i] -
821 ((delta / 2) * 3 + (delta % 2));
831 static void rtl92d_dm_txpower_tracking_callback_thermalmeter(
839 u8 offset, thermalvalue_avg_count = 0;
840 u32 thermalvalue_avg = 0;
841 bool internal_pa =
false;
842 long ele_a = 0, ele_d, temp_cck, val_x, value32;
843 long val_y, ele_c = 0;
846 u8 ofdm_index_old[2];
847 u8 cck_index_old = 0;
851 u8 ofdm_min_index = 6, ofdm_min_index_internal_pa = 3, rf;
856 {0, 1, 3, 6, 8, 9, 11, 13, 14, 16, 17, 18, 18},
858 {0, 2, 4, 5, 7, 10, 12, 14, 16, 18, 18, 18, 18},
860 {0, 2, 3, 6, 8, 9, 11, 13, 14, 16, 17, 18, 18},
862 {0, 2, 4, 5, 7, 10, 13, 16, 16, 18, 18, 18, 18},
864 {0, 1, 2, 3, 4, 5, 6, 7, 7, 8, 9, 10, 10},
868 {0, 1, 2, 4, 6, 7, 9, 11, 12, 14, 15, 16, 16},
870 {0, 2, 4, 5, 7, 10, 12, 14, 16, 18, 18, 18, 18},
872 {0, 1, 2, 3, 5, 6, 8, 10, 11, 13, 14, 15, 15},
874 {0, 2, 4, 5, 7, 10, 12, 14, 16, 18, 18, 18, 18},
876 {0, 1, 2, 4, 6, 7, 9, 11, 12, 14, 15, 16, 16},
878 {0, 2, 4, 5, 7, 10, 13, 16, 16, 18, 18, 18, 18},
880 {0, 1, 2, 3, 5, 6, 8, 9, 10, 12, 13, 14, 14},
882 {0, 2, 4, 5, 7, 10, 13, 16, 16, 18, 18, 18, 18},
885 rtlpriv->
dm.txpower_trackinginit =
true;
889 "Readback Thermal Meter = 0x%x pre thermal meter 0x%x eeprom_thermalmeter 0x%x\n",
903 ofdm_index_old[0] = (
u8) i;
906 "Initial pathA ele_d reg0x%x = 0x%lx, ofdm_index=0x%x\n",
908 ele_d, ofdm_index_old[0]);
918 ofdm_index_old[1] = (
u8) i;
921 "Initial pathB ele_d reg 0x%x = 0x%lx, ofdm_index = 0x%x\n",
929 rtl92d_bandtype_2_4G(hw, &temp_cck, &cck_index_old);
931 temp_cck = 0x090e1317;
935 if (!rtlpriv->
dm.thermalvalue) {
936 rtlpriv->
dm.thermalvalue =
938 rtlpriv->
dm.thermalvalue_lck = thermalvalue;
939 rtlpriv->
dm.thermalvalue_iqk = thermalvalue;
940 rtlpriv->
dm.thermalvalue_rxgain =
942 for (i = 0; i < rf; i++)
943 rtlpriv->
dm.ofdm_index[i] = ofdm_index_old[i];
944 rtlpriv->
dm.cck_index = cck_index_old;
947 for (i = 0; i < rf; i++)
948 rtlpriv->
dm.ofdm_index[i] = ofdm_index_old[i];
949 rtlpriv->
dm.cck_index = cck_index_old;
951 "reload ofdm index for band switch\n");
953 rtlpriv->
dm.thermalvalue_avg
954 [rtlpriv->
dm.thermalvalue_avg_index] = thermalvalue;
955 rtlpriv->
dm.thermalvalue_avg_index++;
957 rtlpriv->
dm.thermalvalue_avg_index = 0;
959 if (rtlpriv->
dm.thermalvalue_avg[i]) {
961 rtlpriv->
dm.thermalvalue_avg[
i];
962 thermalvalue_avg_count++;
965 if (thermalvalue_avg_count)
966 thermalvalue = (
u8) (thermalvalue_avg /
967 thermalvalue_avg_count);
973 rtlpriv->
dm.done_txpower =
false;
974 }
else if (rtlpriv->
dm.done_txpower) {
975 delta = (thermalvalue > rtlpriv->
dm.thermalvalue) ?
976 (thermalvalue - rtlpriv->
dm.thermalvalue) :
977 (rtlpriv->
dm.thermalvalue - thermalvalue);
983 delta_lck = (thermalvalue > rtlpriv->
dm.thermalvalue_lck) ?
984 (thermalvalue - rtlpriv->
dm.thermalvalue_lck) :
985 (rtlpriv->
dm.thermalvalue_lck - thermalvalue);
986 delta_iqk = (thermalvalue > rtlpriv->
dm.thermalvalue_iqk) ?
987 (thermalvalue - rtlpriv->
dm.thermalvalue_iqk) :
988 (rtlpriv->
dm.thermalvalue_iqk - thermalvalue);
990 (thermalvalue > rtlpriv->
dm.thermalvalue_rxgain) ?
991 (thermalvalue - rtlpriv->
dm.thermalvalue_rxgain) :
992 (rtlpriv->
dm.thermalvalue_rxgain - thermalvalue);
994 "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",
995 thermalvalue, rtlpriv->
dm.thermalvalue,
1000 rtlpriv->
dm.thermalvalue_lck = thermalvalue;
1003 if (delta > 0 && rtlpriv->
dm.txpower_track_control) {
1004 rtlpriv->
dm.done_txpower =
true;
1010 if (delta > INDEX_MAPPING_NUM - 1)
1011 index = index_mapping[
offset]
1012 [INDEX_MAPPING_NUM - 1];
1015 if (thermalvalue > rtlpriv->
dm.thermalvalue) {
1016 for (i = 0; i < rf; i++)
1017 ofdm_index[i] -= delta;
1020 for (i = 0; i < rf; i++)
1021 ofdm_index[i] += index;
1025 rtl92d_bandtype_5G(rtlhal, ofdm_index,
1026 &internal_pa, thermalvalue,
1027 delta, rf, rtlefuse, rtlpriv,
1028 rtlphy, index_mapping,
1029 index_mapping_internal_pa);
1033 "temp OFDM_A_index=0x%x, OFDM_B_index = 0x%x,cck_index=0x%x\n",
1034 rtlpriv->
dm.ofdm_index[0],
1035 rtlpriv->
dm.ofdm_index[1],
1036 rtlpriv->
dm.cck_index);
1039 "temp OFDM_A_index=0x%x,cck_index = 0x%x\n",
1040 rtlpriv->
dm.ofdm_index[0],
1041 rtlpriv->
dm.cck_index);
1043 for (i = 0; i < rf; i++) {
1044 if (ofdm_index[i] > OFDM_TABLE_SIZE_92D - 1)
1045 ofdm_index[
i] = OFDM_TABLE_SIZE_92D - 1;
1046 else if (ofdm_index[i] < ofdm_min_index)
1047 ofdm_index[
i] = ofdm_min_index;
1052 }
else if (internal_pa ||
1056 ofdm_min_index_internal_pa)
1058 ofdm_min_index_internal_pa;
1059 }
else if (cck_index < 0) {
1065 "new OFDM_A_index=0x%x, OFDM_B_index = 0x%x, cck_index=0x%x\n",
1066 ofdm_index[0], ofdm_index[1],
1070 "new OFDM_A_index=0x%x,cck_index = 0x%x\n",
1071 ofdm_index[0], cck_index);
1073 ele_d = (ofdmswing_table[(
u8) ofdm_index[0]] &
1076 [indexforchannel].value[0][0];
1078 [indexforchannel].value[0][1];
1080 if ((val_x & 0x00000200) != 0)
1081 val_x = val_x | 0xFFFFFC00;
1083 ((val_x * ele_d) >> 8) & 0x000003FF;
1086 if ((val_y & 0x00000200) != 0)
1087 val_y = val_y | 0xFFFFFC00;
1088 ele_c = ((val_y * ele_d) >> 8) & 0x000003FF;
1092 value32 = (ele_d << 22) | ((ele_c & 0x3F) <<
1097 value32 = (ele_c & 0x000003C0) >> 6;
1101 value32 = ((val_x * ele_d) >> 7) & 0x01;
1109 [(
u8)ofdm_index[0]]);
1117 "TxPwrTracking for interface %d path A: X = 0x%lx, Y = 0x%lx ele_A = 0x%lx ele_C = 0x%lx ele_D = 0x%lx 0xe94 = 0x%lx 0xe9c = 0x%lx\n",
1119 val_x, val_y, ele_a, ele_c, ele_d,
1124 if (!rtlpriv->
dm.cck_inch14) {
1125 rtl_write_byte(rtlpriv, 0xa22,
1126 cckswing_table_ch1ch13
1127 [(
u8)cck_index][0]);
1128 rtl_write_byte(rtlpriv, 0xa23,
1129 cckswing_table_ch1ch13
1130 [(
u8)cck_index][1]);
1131 rtl_write_byte(rtlpriv, 0xa24,
1132 cckswing_table_ch1ch13
1133 [(
u8)cck_index][2]);
1134 rtl_write_byte(rtlpriv, 0xa25,
1135 cckswing_table_ch1ch13
1136 [(
u8)cck_index][3]);
1137 rtl_write_byte(rtlpriv, 0xa26,
1138 cckswing_table_ch1ch13
1139 [(
u8)cck_index][4]);
1140 rtl_write_byte(rtlpriv, 0xa27,
1141 cckswing_table_ch1ch13
1142 [(
u8)cck_index][5]);
1143 rtl_write_byte(rtlpriv, 0xa28,
1144 cckswing_table_ch1ch13
1145 [(
u8)cck_index][6]);
1146 rtl_write_byte(rtlpriv, 0xa29,
1147 cckswing_table_ch1ch13
1148 [(
u8)cck_index][7]);
1150 rtl_write_byte(rtlpriv, 0xa22,
1152 [(
u8)cck_index][0]);
1153 rtl_write_byte(rtlpriv, 0xa23,
1155 [(
u8)cck_index][1]);
1156 rtl_write_byte(rtlpriv, 0xa24,
1158 [(
u8)cck_index][2]);
1159 rtl_write_byte(rtlpriv, 0xa25,
1161 [(
u8)cck_index][3]);
1162 rtl_write_byte(rtlpriv, 0xa26,
1164 [(
u8)cck_index][4]);
1165 rtl_write_byte(rtlpriv, 0xa27,
1167 [(
u8)cck_index][5]);
1168 rtl_write_byte(rtlpriv, 0xa28,
1170 [(
u8)cck_index][6]);
1171 rtl_write_byte(rtlpriv, 0xa29,
1173 [(
u8)cck_index][7]);
1177 ele_d = (ofdmswing_table[(
u8) ofdm_index[1]] &
1180 [indexforchannel].value[0][4];
1182 [indexforchannel].value[0][5];
1184 if ((val_x & 0x00000200) != 0)
1186 val_x = val_x | 0xFFFFFC00;
1187 ele_a = ((val_x * ele_d) >> 8) &
1190 if ((val_y & 0x00000200) != 0)
1195 ele_d) >> 8) & 0x00003FF;
1199 value32 = (ele_d << 22) |
1200 ((ele_c & 0x3F) << 16) |
1205 value32 = (ele_c & 0x000003C0) >> 6;
1208 value32 = ((val_x * ele_d) >> 7) & 0x01;
1216 [(
u8) ofdm_index[1]]);
1223 "TxPwrTracking path B: X = 0x%lx, Y = 0x%lx ele_A = 0x%lx ele_C = 0x%lx ele_D = 0x%lx 0xeb4 = 0x%lx 0xebc = 0x%lx\n",
1224 val_x, val_y, ele_a, ele_c,
1225 ele_d, val_x, val_y);
1228 "TxPwrTracking 0xc80 = 0x%x, 0xc94 = 0x%x RF 0x24 = 0x%x\n",
1234 if ((delta_iqk > rtlefuse->
delta_iqk) &&
1237 rtlpriv->
dm.thermalvalue_iqk = thermalvalue;
1242 rtlpriv->
dm.thermalvalue_rxgain = thermalvalue;
1243 rtl92d_dm_rxgain_tracking_thermalmeter(hw);
1245 if (rtlpriv->
dm.txpower_track_control)
1246 rtlpriv->
dm.thermalvalue = thermalvalue;
1252 static void rtl92d_dm_initialize_txpower_tracking(
struct ieee80211_hw *hw)
1256 rtlpriv->
dm.txpower_tracking =
true;
1257 rtlpriv->
dm.txpower_trackinginit =
false;
1258 rtlpriv->
dm.txpower_track_control =
true;
1260 "pMgntInfo->txpower_tracking = %d\n",
1261 rtlpriv->
dm.txpower_tracking);
1267 static u8 tm_trigger;
1269 if (!rtlpriv->
dm.txpower_tracking)
1276 "Trigger 92S Thermal Meter!!\n");
1281 "Schedule TxPowerTracking direct call!!\n");
1282 rtl92d_dm_txpower_tracking_callback_thermalmeter(hw);
1295 rtlpriv->
dm.useramask =
true;
1297 rtlpriv->
dm.useramask =
false;
1305 rtl92d_dm_diginit(hw);
1306 rtl92d_dm_init_dynamic_txpower(hw);
1309 rtl92d_dm_initialize_txpower_tracking(hw);
1316 bool fwps_awake =
true;
1328 rtl92d_dm_pwdb_monitor(hw);
1329 rtl92d_dm_false_alarm_counter_statistics(hw);
1330 rtl92d_dm_find_minimum_rssi(hw);
1333 rtl92d_dm_dynamic_txpower(hw);
1337 rtl92d_dm_check_edca_turbo(hw);