diff options
Diffstat (limited to 'drivers/net/wireless/rtlwifi/rtl8192c')
| -rw-r--r-- | drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c | 523 | ||||
| -rw-r--r-- | drivers/net/wireless/rtlwifi/rtl8192c/dm_common.h | 2 | ||||
| -rw-r--r-- | drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c | 81 | ||||
| -rw-r--r-- | drivers/net/wireless/rtlwifi/rtl8192c/fw_common.h | 4 | ||||
| -rw-r--r-- | drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c | 128 | ||||
| -rw-r--r-- | drivers/net/wireless/rtlwifi/rtl8192c/phy_common.h | 76 |
6 files changed, 609 insertions, 205 deletions
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c index c228b9ee3711..97183829b9be 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c +++ b/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c | |||
| @@ -28,10 +28,26 @@ | |||
| 28 | *****************************************************************************/ | 28 | *****************************************************************************/ |
| 29 | 29 | ||
| 30 | #include "dm_common.h" | 30 | #include "dm_common.h" |
| 31 | #include "phy_common.h" | ||
| 32 | #include "../pci.h" | ||
| 33 | #include "../base.h" | ||
| 31 | 34 | ||
| 32 | struct dig_t dm_digtable; | 35 | struct dig_t dm_digtable; |
| 33 | static struct ps_t dm_pstable; | 36 | static struct ps_t dm_pstable; |
| 34 | 37 | ||
| 38 | #define BT_RSSI_STATE_NORMAL_POWER BIT_OFFSET_LEN_MASK_32(0, 1) | ||
| 39 | #define BT_RSSI_STATE_AMDPU_OFF BIT_OFFSET_LEN_MASK_32(1, 1) | ||
| 40 | #define BT_RSSI_STATE_SPECIAL_LOW BIT_OFFSET_LEN_MASK_32(2, 1) | ||
| 41 | #define BT_RSSI_STATE_BG_EDCA_LOW BIT_OFFSET_LEN_MASK_32(3, 1) | ||
| 42 | #define BT_RSSI_STATE_TXPOWER_LOW BIT_OFFSET_LEN_MASK_32(4, 1) | ||
| 43 | |||
| 44 | #define RTLPRIV (struct rtl_priv *) | ||
| 45 | #define GET_UNDECORATED_AVERAGE_RSSI(_priv) \ | ||
| 46 | ((RTLPRIV(_priv))->mac80211.opmode == \ | ||
| 47 | NL80211_IFTYPE_ADHOC) ? \ | ||
| 48 | ((RTLPRIV(_priv))->dm.entry_min_undecoratedsmoothed_pwdb) : \ | ||
| 49 | ((RTLPRIV(_priv))->dm.undecorated_smoothed_pwdb) | ||
| 50 | |||
| 35 | static const u32 ofdmswing_table[OFDM_TABLE_SIZE] = { | 51 | static const u32 ofdmswing_table[OFDM_TABLE_SIZE] = { |
| 36 | 0x7f8001fe, | 52 | 0x7f8001fe, |
| 37 | 0x788001e2, | 53 | 0x788001e2, |
| @@ -304,7 +320,7 @@ static void rtl92c_dm_ctrl_initgain_by_rssi(struct ieee80211_hw *hw) | |||
| 304 | 320 | ||
| 305 | static void rtl92c_dm_initial_gain_multi_sta(struct ieee80211_hw *hw) | 321 | static void rtl92c_dm_initial_gain_multi_sta(struct ieee80211_hw *hw) |
| 306 | { | 322 | { |
| 307 | static u8 binitialized; /* initialized to false */ | 323 | static u8 initialized; /* initialized to false */ |
| 308 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 324 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
| 309 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); | 325 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); |
| 310 | long rssi_strength = rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; | 326 | long rssi_strength = rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; |
| @@ -315,11 +331,11 @@ static void rtl92c_dm_initial_gain_multi_sta(struct ieee80211_hw *hw) | |||
| 315 | 331 | ||
| 316 | if ((multi_sta == false) || (dm_digtable.cursta_connectctate != | 332 | if ((multi_sta == false) || (dm_digtable.cursta_connectctate != |
| 317 | DIG_STA_DISCONNECT)) { | 333 | DIG_STA_DISCONNECT)) { |
| 318 | binitialized = false; | 334 | initialized = false; |
| 319 | dm_digtable.dig_ext_port_stage = DIG_EXT_PORT_STAGE_MAX; | 335 | dm_digtable.dig_ext_port_stage = DIG_EXT_PORT_STAGE_MAX; |
| 320 | return; | 336 | return; |
| 321 | } else if (binitialized == false) { | 337 | } else if (initialized == false) { |
| 322 | binitialized = true; | 338 | initialized = true; |
| 323 | dm_digtable.dig_ext_port_stage = DIG_EXT_PORT_STAGE_0; | 339 | dm_digtable.dig_ext_port_stage = DIG_EXT_PORT_STAGE_0; |
| 324 | dm_digtable.cur_igvalue = 0x20; | 340 | dm_digtable.cur_igvalue = 0x20; |
| 325 | rtl92c_dm_write_dig(hw); | 341 | rtl92c_dm_write_dig(hw); |
| @@ -461,10 +477,7 @@ static void rtl92c_dm_ctrl_initgain_by_twoport(struct ieee80211_hw *hw) | |||
| 461 | if (mac->act_scanning == true) | 477 | if (mac->act_scanning == true) |
| 462 | return; | 478 | return; |
| 463 | 479 | ||
| 464 | if ((mac->link_state > MAC80211_NOLINK) && | 480 | if (mac->link_state >= MAC80211_LINKED) |
| 465 | (mac->link_state < MAC80211_LINKED)) | ||
| 466 | dm_digtable.cursta_connectctate = DIG_STA_BEFORE_CONNECT; | ||
| 467 | else if (mac->link_state >= MAC80211_LINKED) | ||
| 468 | dm_digtable.cursta_connectctate = DIG_STA_CONNECT; | 481 | dm_digtable.cursta_connectctate = DIG_STA_CONNECT; |
| 469 | else | 482 | else |
| 470 | dm_digtable.cursta_connectctate = DIG_STA_DISCONNECT; | 483 | dm_digtable.cursta_connectctate = DIG_STA_DISCONNECT; |
| @@ -562,23 +575,42 @@ EXPORT_SYMBOL(rtl92c_dm_init_edca_turbo); | |||
| 562 | static void rtl92c_dm_check_edca_turbo(struct ieee80211_hw *hw) | 575 | static void rtl92c_dm_check_edca_turbo(struct ieee80211_hw *hw) |
| 563 | { | 576 | { |
| 564 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 577 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
| 578 | struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); | ||
| 565 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); | 579 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); |
| 580 | |||
| 566 | static u64 last_txok_cnt; | 581 | static u64 last_txok_cnt; |
| 567 | static u64 last_rxok_cnt; | 582 | static u64 last_rxok_cnt; |
| 568 | u64 cur_txok_cnt; | 583 | static u32 last_bt_edca_ul; |
| 569 | u64 cur_rxok_cnt; | 584 | static u32 last_bt_edca_dl; |
| 585 | u64 cur_txok_cnt = 0; | ||
| 586 | u64 cur_rxok_cnt = 0; | ||
| 570 | u32 edca_be_ul = 0x5ea42b; | 587 | u32 edca_be_ul = 0x5ea42b; |
| 571 | u32 edca_be_dl = 0x5ea42b; | 588 | u32 edca_be_dl = 0x5ea42b; |
| 589 | bool bt_change_edca = false; | ||
| 572 | 590 | ||
| 573 | if (mac->opmode == NL80211_IFTYPE_ADHOC) | 591 | if ((last_bt_edca_ul != rtlpcipriv->bt_coexist.bt_edca_ul) || |
| 574 | goto dm_checkedcaturbo_exit; | 592 | (last_bt_edca_dl != rtlpcipriv->bt_coexist.bt_edca_dl)) { |
| 593 | rtlpriv->dm.current_turbo_edca = false; | ||
| 594 | last_bt_edca_ul = rtlpcipriv->bt_coexist.bt_edca_ul; | ||
| 595 | last_bt_edca_dl = rtlpcipriv->bt_coexist.bt_edca_dl; | ||
| 596 | } | ||
| 597 | |||
| 598 | if (rtlpcipriv->bt_coexist.bt_edca_ul != 0) { | ||
| 599 | edca_be_ul = rtlpcipriv->bt_coexist.bt_edca_ul; | ||
| 600 | bt_change_edca = true; | ||
| 601 | } | ||
| 602 | |||
| 603 | if (rtlpcipriv->bt_coexist.bt_edca_dl != 0) { | ||
| 604 | edca_be_ul = rtlpcipriv->bt_coexist.bt_edca_dl; | ||
| 605 | bt_change_edca = true; | ||
| 606 | } | ||
| 575 | 607 | ||
| 576 | if (mac->link_state != MAC80211_LINKED) { | 608 | if (mac->link_state != MAC80211_LINKED) { |
| 577 | rtlpriv->dm.current_turbo_edca = false; | 609 | rtlpriv->dm.current_turbo_edca = false; |
| 578 | return; | 610 | return; |
| 579 | } | 611 | } |
| 580 | 612 | ||
| 581 | if (!mac->ht_enable) { /*FIX MERGE */ | 613 | if ((!mac->ht_enable) && (!rtlpcipriv->bt_coexist.bt_coexistence)) { |
| 582 | if (!(edca_be_ul & 0xffff0000)) | 614 | if (!(edca_be_ul & 0xffff0000)) |
| 583 | edca_be_ul |= 0x005e0000; | 615 | edca_be_ul |= 0x005e0000; |
| 584 | 616 | ||
| @@ -586,10 +618,12 @@ static void rtl92c_dm_check_edca_turbo(struct ieee80211_hw *hw) | |||
| 586 | edca_be_dl |= 0x005e0000; | 618 | edca_be_dl |= 0x005e0000; |
| 587 | } | 619 | } |
| 588 | 620 | ||
| 589 | if ((!rtlpriv->dm.is_any_nonbepkts) && | 621 | if ((bt_change_edca) || ((!rtlpriv->dm.is_any_nonbepkts) && |
| 590 | (!rtlpriv->dm.disable_framebursting)) { | 622 | (!rtlpriv->dm.disable_framebursting))) { |
| 623 | |||
| 591 | cur_txok_cnt = rtlpriv->stats.txbytesunicast - last_txok_cnt; | 624 | cur_txok_cnt = rtlpriv->stats.txbytesunicast - last_txok_cnt; |
| 592 | cur_rxok_cnt = rtlpriv->stats.rxbytesunicast - last_rxok_cnt; | 625 | cur_rxok_cnt = rtlpriv->stats.rxbytesunicast - last_rxok_cnt; |
| 626 | |||
| 593 | if (cur_rxok_cnt > 4 * cur_txok_cnt) { | 627 | if (cur_rxok_cnt > 4 * cur_txok_cnt) { |
| 594 | if (!rtlpriv->dm.is_cur_rdlstate || | 628 | if (!rtlpriv->dm.is_cur_rdlstate || |
| 595 | !rtlpriv->dm.current_turbo_edca) { | 629 | !rtlpriv->dm.current_turbo_edca) { |
| @@ -618,7 +652,6 @@ static void rtl92c_dm_check_edca_turbo(struct ieee80211_hw *hw) | |||
| 618 | } | 652 | } |
| 619 | } | 653 | } |
| 620 | 654 | ||
| 621 | dm_checkedcaturbo_exit: | ||
| 622 | rtlpriv->dm.is_any_nonbepkts = false; | 655 | rtlpriv->dm.is_any_nonbepkts = false; |
| 623 | last_txok_cnt = rtlpriv->stats.txbytesunicast; | 656 | last_txok_cnt = rtlpriv->stats.txbytesunicast; |
| 624 | last_rxok_cnt = rtlpriv->stats.rxbytesunicast; | 657 | last_rxok_cnt = rtlpriv->stats.rxbytesunicast; |
| @@ -633,14 +666,14 @@ static void rtl92c_dm_txpower_tracking_callback_thermalmeter(struct ieee80211_hw | |||
| 633 | struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); | 666 | struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); |
| 634 | u8 thermalvalue, delta, delta_lck, delta_iqk; | 667 | u8 thermalvalue, delta, delta_lck, delta_iqk; |
| 635 | long ele_a, ele_d, temp_cck, val_x, value32; | 668 | long ele_a, ele_d, temp_cck, val_x, value32; |
| 636 | long val_y, ele_c; | 669 | long val_y, ele_c = 0; |
| 637 | u8 ofdm_index[2], cck_index = 0, ofdm_index_old[2], cck_index_old = 0; | 670 | u8 ofdm_index[2], cck_index = 0, ofdm_index_old[2], cck_index_old = 0; |
| 638 | int i; | 671 | int i; |
| 639 | bool is2t = IS_92C_SERIAL(rtlhal->version); | 672 | bool is2t = IS_92C_SERIAL(rtlhal->version); |
| 640 | u8 txpwr_level[2] = {0, 0}; | 673 | u8 txpwr_level[2] = {0, 0}; |
| 641 | u8 ofdm_min_index = 6, rf; | 674 | u8 ofdm_min_index = 6, rf; |
| 642 | 675 | ||
| 643 | rtlpriv->dm.txpower_trackingInit = true; | 676 | rtlpriv->dm.txpower_trackinginit = true; |
| 644 | RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, | 677 | RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, |
| 645 | ("rtl92c_dm_txpower_tracking_callback_thermalmeter\n")); | 678 | ("rtl92c_dm_txpower_tracking_callback_thermalmeter\n")); |
| 646 | 679 | ||
| @@ -683,7 +716,6 @@ static void rtl92c_dm_txpower_tracking_callback_thermalmeter(struct ieee80211_hw | |||
| 683 | for (i = 0; i < OFDM_TABLE_LENGTH; i++) { | 716 | for (i = 0; i < OFDM_TABLE_LENGTH; i++) { |
| 684 | if (ele_d == (ofdmswing_table[i] & | 717 | if (ele_d == (ofdmswing_table[i] & |
| 685 | MASKOFDM_D)) { | 718 | MASKOFDM_D)) { |
| 686 | ofdm_index_old[1] = (u8) i; | ||
| 687 | 719 | ||
| 688 | RT_TRACE(rtlpriv, COMP_POWER_TRACKING, | 720 | RT_TRACE(rtlpriv, COMP_POWER_TRACKING, |
| 689 | DBG_LOUD, | 721 | DBG_LOUD, |
| @@ -1062,7 +1094,7 @@ static void rtl92c_dm_initialize_txpower_tracking_thermalmeter( | |||
| 1062 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 1094 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
| 1063 | 1095 | ||
| 1064 | rtlpriv->dm.txpower_tracking = true; | 1096 | rtlpriv->dm.txpower_tracking = true; |
| 1065 | rtlpriv->dm.txpower_trackingInit = false; | 1097 | rtlpriv->dm.txpower_trackinginit = false; |
| 1066 | 1098 | ||
| 1067 | RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, | 1099 | RT_TRACE(rtlpriv, COMP_POWER_TRACKING, DBG_LOUD, |
| 1068 | ("pMgntInfo->txpower_tracking = %d\n", | 1100 | ("pMgntInfo->txpower_tracking = %d\n", |
| @@ -1132,6 +1164,7 @@ static void rtl92c_dm_refresh_rate_adaptive_mask(struct ieee80211_hw *hw) | |||
| 1132 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); | 1164 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); |
| 1133 | struct rate_adaptive *p_ra = &(rtlpriv->ra); | 1165 | struct rate_adaptive *p_ra = &(rtlpriv->ra); |
| 1134 | u32 low_rssithresh_for_ra, high_rssithresh_for_ra; | 1166 | u32 low_rssithresh_for_ra, high_rssithresh_for_ra; |
| 1167 | struct ieee80211_sta *sta = NULL; | ||
| 1135 | 1168 | ||
| 1136 | if (is_hal_stop(rtlhal)) { | 1169 | if (is_hal_stop(rtlhal)) { |
| 1137 | RT_TRACE(rtlpriv, COMP_RATE, DBG_LOUD, | 1170 | RT_TRACE(rtlpriv, COMP_RATE, DBG_LOUD, |
| @@ -1145,8 +1178,8 @@ static void rtl92c_dm_refresh_rate_adaptive_mask(struct ieee80211_hw *hw) | |||
| 1145 | return; | 1178 | return; |
| 1146 | } | 1179 | } |
| 1147 | 1180 | ||
| 1148 | if (mac->link_state == MAC80211_LINKED) { | 1181 | if (mac->link_state == MAC80211_LINKED && |
| 1149 | 1182 | mac->opmode == NL80211_IFTYPE_STATION) { | |
| 1150 | switch (p_ra->pre_ratr_state) { | 1183 | switch (p_ra->pre_ratr_state) { |
| 1151 | case DM_RATR_STA_HIGH: | 1184 | case DM_RATR_STA_HIGH: |
| 1152 | high_rssithresh_for_ra = 50; | 1185 | high_rssithresh_for_ra = 50; |
| @@ -1185,10 +1218,13 @@ static void rtl92c_dm_refresh_rate_adaptive_mask(struct ieee80211_hw *hw) | |||
| 1185 | ("PreState = %d, CurState = %d\n", | 1218 | ("PreState = %d, CurState = %d\n", |
| 1186 | p_ra->pre_ratr_state, p_ra->ratr_state)); | 1219 | p_ra->pre_ratr_state, p_ra->ratr_state)); |
| 1187 | 1220 | ||
| 1188 | rtlpriv->cfg->ops->update_rate_mask(hw, | 1221 | rcu_read_lock(); |
| 1222 | sta = ieee80211_find_sta(mac->vif, mac->bssid); | ||
| 1223 | rtlpriv->cfg->ops->update_rate_tbl(hw, sta, | ||
| 1189 | p_ra->ratr_state); | 1224 | p_ra->ratr_state); |
| 1190 | 1225 | ||
| 1191 | p_ra->pre_ratr_state = p_ra->ratr_state; | 1226 | p_ra->pre_ratr_state = p_ra->ratr_state; |
| 1227 | rcu_read_unlock(); | ||
| 1192 | } | 1228 | } |
| 1193 | } | 1229 | } |
| 1194 | } | 1230 | } |
| @@ -1202,51 +1238,6 @@ static void rtl92c_dm_init_dynamic_bb_powersaving(struct ieee80211_hw *hw) | |||
| 1202 | dm_pstable.rssi_val_min = 0; | 1238 | dm_pstable.rssi_val_min = 0; |
| 1203 | } | 1239 | } |
| 1204 | 1240 | ||
| 1205 | static void rtl92c_dm_1r_cca(struct ieee80211_hw *hw) | ||
| 1206 | { | ||
| 1207 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
| 1208 | struct rtl_phy *rtlphy = &(rtlpriv->phy); | ||
| 1209 | |||
| 1210 | if (dm_pstable.rssi_val_min != 0) { | ||
| 1211 | if (dm_pstable.pre_ccastate == CCA_2R) { | ||
| 1212 | if (dm_pstable.rssi_val_min >= 35) | ||
| 1213 | dm_pstable.cur_ccasate = CCA_1R; | ||
| 1214 | else | ||
| 1215 | dm_pstable.cur_ccasate = CCA_2R; | ||
| 1216 | } else { | ||
| 1217 | if (dm_pstable.rssi_val_min <= 30) | ||
| 1218 | dm_pstable.cur_ccasate = CCA_2R; | ||
| 1219 | else | ||
| 1220 | dm_pstable.cur_ccasate = CCA_1R; | ||
| 1221 | } | ||
| 1222 | } else { | ||
| 1223 | dm_pstable.cur_ccasate = CCA_MAX; | ||
| 1224 | } | ||
| 1225 | |||
| 1226 | if (dm_pstable.pre_ccastate != dm_pstable.cur_ccasate) { | ||
| 1227 | if (dm_pstable.cur_ccasate == CCA_1R) { | ||
| 1228 | if (get_rf_type(rtlphy) == RF_2T2R) { | ||
| 1229 | rtl_set_bbreg(hw, ROFDM0_TRXPATHENABLE, | ||
| 1230 | MASKBYTE0, 0x13); | ||
| 1231 | rtl_set_bbreg(hw, 0xe70, MASKBYTE3, 0x20); | ||
| 1232 | } else { | ||
| 1233 | rtl_set_bbreg(hw, ROFDM0_TRXPATHENABLE, | ||
| 1234 | MASKBYTE0, 0x23); | ||
| 1235 | rtl_set_bbreg(hw, 0xe70, 0x7fc00000, 0x10c); | ||
| 1236 | } | ||
| 1237 | } else { | ||
| 1238 | rtl_set_bbreg(hw, ROFDM0_TRXPATHENABLE, MASKBYTE0, | ||
| 1239 | 0x33); | ||
| 1240 | rtl_set_bbreg(hw, 0xe70, MASKBYTE3, 0x63); | ||
| 1241 | } | ||
| 1242 | dm_pstable.pre_ccastate = dm_pstable.cur_ccasate; | ||
| 1243 | } | ||
| 1244 | |||
| 1245 | RT_TRACE(rtlpriv, DBG_LOUD, DBG_LOUD, ("CCAStage = %s\n", | ||
| 1246 | (dm_pstable.cur_ccasate == | ||
| 1247 | 0) ? "1RCCA" : "2RCCA")); | ||
| 1248 | } | ||
| 1249 | |||
| 1250 | void rtl92c_dm_rf_saving(struct ieee80211_hw *hw, u8 bforce_in_normal) | 1241 | void rtl92c_dm_rf_saving(struct ieee80211_hw *hw, u8 bforce_in_normal) |
| 1251 | { | 1242 | { |
| 1252 | static u8 initialize; | 1243 | static u8 initialize; |
| @@ -1352,7 +1343,9 @@ static void rtl92c_dm_dynamic_bb_powersaving(struct ieee80211_hw *hw) | |||
| 1352 | } | 1343 | } |
| 1353 | 1344 | ||
| 1354 | if (IS_92C_SERIAL(rtlhal->version)) | 1345 | if (IS_92C_SERIAL(rtlhal->version)) |
| 1355 | rtl92c_dm_1r_cca(hw); | 1346 | ;/* rtl92c_dm_1r_cca(hw); */ |
| 1347 | else | ||
| 1348 | rtl92c_dm_rf_saving(hw, false); | ||
| 1356 | } | 1349 | } |
| 1357 | 1350 | ||
| 1358 | void rtl92c_dm_init(struct ieee80211_hw *hw) | 1351 | void rtl92c_dm_init(struct ieee80211_hw *hw) |
| @@ -1369,6 +1362,84 @@ void rtl92c_dm_init(struct ieee80211_hw *hw) | |||
| 1369 | } | 1362 | } |
| 1370 | EXPORT_SYMBOL(rtl92c_dm_init); | 1363 | EXPORT_SYMBOL(rtl92c_dm_init); |
| 1371 | 1364 | ||
| 1365 | void rtl92c_dm_dynamic_txpower(struct ieee80211_hw *hw) | ||
| 1366 | { | ||
| 1367 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
| 1368 | struct rtl_phy *rtlphy = &(rtlpriv->phy); | ||
| 1369 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); | ||
| 1370 | long undecorated_smoothed_pwdb; | ||
| 1371 | |||
| 1372 | if (!rtlpriv->dm.dynamic_txpower_enable) | ||
| 1373 | return; | ||
| 1374 | |||
| 1375 | if (rtlpriv->dm.dm_flag & HAL_DM_HIPWR_DISABLE) { | ||
| 1376 | rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL; | ||
| 1377 | return; | ||
| 1378 | } | ||
| 1379 | |||
| 1380 | if ((mac->link_state < MAC80211_LINKED) && | ||
| 1381 | (rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb == 0)) { | ||
| 1382 | RT_TRACE(rtlpriv, COMP_POWER, DBG_TRACE, | ||
| 1383 | ("Not connected to any\n")); | ||
| 1384 | |||
| 1385 | rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL; | ||
| 1386 | |||
| 1387 | rtlpriv->dm.last_dtp_lvl = TXHIGHPWRLEVEL_NORMAL; | ||
| 1388 | return; | ||
| 1389 | } | ||
| 1390 | |||
| 1391 | if (mac->link_state >= MAC80211_LINKED) { | ||
| 1392 | if (mac->opmode == NL80211_IFTYPE_ADHOC) { | ||
| 1393 | undecorated_smoothed_pwdb = | ||
| 1394 | rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; | ||
| 1395 | RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, | ||
| 1396 | ("AP Client PWDB = 0x%lx\n", | ||
| 1397 | undecorated_smoothed_pwdb)); | ||
| 1398 | } else { | ||
| 1399 | undecorated_smoothed_pwdb = | ||
| 1400 | rtlpriv->dm.undecorated_smoothed_pwdb; | ||
| 1401 | RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, | ||
| 1402 | ("STA Default Port PWDB = 0x%lx\n", | ||
| 1403 | undecorated_smoothed_pwdb)); | ||
| 1404 | } | ||
| 1405 | } else { | ||
| 1406 | undecorated_smoothed_pwdb = | ||
| 1407 | rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; | ||
| 1408 | |||
| 1409 | RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, | ||
| 1410 | ("AP Ext Port PWDB = 0x%lx\n", | ||
| 1411 | undecorated_smoothed_pwdb)); | ||
| 1412 | } | ||
| 1413 | |||
| 1414 | if (undecorated_smoothed_pwdb >= TX_POWER_NEAR_FIELD_THRESH_LVL2) { | ||
| 1415 | rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_LEVEL1; | ||
| 1416 | RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, | ||
| 1417 | ("TXHIGHPWRLEVEL_LEVEL1 (TxPwr=0x0)\n")); | ||
| 1418 | } else if ((undecorated_smoothed_pwdb < | ||
| 1419 | (TX_POWER_NEAR_FIELD_THRESH_LVL2 - 3)) && | ||
| 1420 | (undecorated_smoothed_pwdb >= | ||
| 1421 | TX_POWER_NEAR_FIELD_THRESH_LVL1)) { | ||
| 1422 | |||
| 1423 | rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_LEVEL1; | ||
| 1424 | RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, | ||
| 1425 | ("TXHIGHPWRLEVEL_LEVEL1 (TxPwr=0x10)\n")); | ||
| 1426 | } else if (undecorated_smoothed_pwdb < | ||
| 1427 | (TX_POWER_NEAR_FIELD_THRESH_LVL1 - 5)) { | ||
| 1428 | rtlpriv->dm.dynamic_txhighpower_lvl = TXHIGHPWRLEVEL_NORMAL; | ||
| 1429 | RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, | ||
| 1430 | ("TXHIGHPWRLEVEL_NORMAL\n")); | ||
| 1431 | } | ||
| 1432 | |||
| 1433 | if ((rtlpriv->dm.dynamic_txhighpower_lvl != rtlpriv->dm.last_dtp_lvl)) { | ||
| 1434 | RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, | ||
| 1435 | ("PHY_SetTxPowerLevel8192S() Channel = %d\n", | ||
| 1436 | rtlphy->current_channel)); | ||
| 1437 | rtl92c_phy_set_txpower_level(hw, rtlphy->current_channel); | ||
| 1438 | } | ||
| 1439 | |||
| 1440 | rtlpriv->dm.last_dtp_lvl = rtlpriv->dm.dynamic_txhighpower_lvl; | ||
| 1441 | } | ||
| 1442 | |||
| 1372 | void rtl92c_dm_watchdog(struct ieee80211_hw *hw) | 1443 | void rtl92c_dm_watchdog(struct ieee80211_hw *hw) |
| 1373 | { | 1444 | { |
| 1374 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 1445 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
| @@ -1388,11 +1459,321 @@ void rtl92c_dm_watchdog(struct ieee80211_hw *hw) | |||
| 1388 | rtl92c_dm_dig(hw); | 1459 | rtl92c_dm_dig(hw); |
| 1389 | rtl92c_dm_false_alarm_counter_statistics(hw); | 1460 | rtl92c_dm_false_alarm_counter_statistics(hw); |
| 1390 | rtl92c_dm_dynamic_bb_powersaving(hw); | 1461 | rtl92c_dm_dynamic_bb_powersaving(hw); |
| 1391 | rtlpriv->cfg->ops->dm_dynamic_txpower(hw); | 1462 | rtl92c_dm_dynamic_txpower(hw); |
| 1392 | rtl92c_dm_check_txpower_tracking(hw); | 1463 | rtl92c_dm_check_txpower_tracking(hw); |
| 1393 | rtl92c_dm_refresh_rate_adaptive_mask(hw); | 1464 | rtl92c_dm_refresh_rate_adaptive_mask(hw); |
| 1465 | rtl92c_dm_bt_coexist(hw); | ||
| 1394 | rtl92c_dm_check_edca_turbo(hw); | 1466 | rtl92c_dm_check_edca_turbo(hw); |
| 1395 | |||
| 1396 | } | 1467 | } |
| 1397 | } | 1468 | } |
| 1398 | EXPORT_SYMBOL(rtl92c_dm_watchdog); | 1469 | EXPORT_SYMBOL(rtl92c_dm_watchdog); |
| 1470 | |||
| 1471 | u8 rtl92c_bt_rssi_state_change(struct ieee80211_hw *hw) | ||
| 1472 | { | ||
| 1473 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
| 1474 | struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); | ||
| 1475 | long undecorated_smoothed_pwdb; | ||
| 1476 | u8 curr_bt_rssi_state = 0x00; | ||
| 1477 | |||
| 1478 | if (rtlpriv->mac80211.link_state == MAC80211_LINKED) { | ||
| 1479 | undecorated_smoothed_pwdb = | ||
| 1480 | GET_UNDECORATED_AVERAGE_RSSI(rtlpriv); | ||
| 1481 | } else { | ||
| 1482 | if (rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb == 0) | ||
| 1483 | undecorated_smoothed_pwdb = 100; | ||
| 1484 | else | ||
| 1485 | undecorated_smoothed_pwdb = | ||
| 1486 | rtlpriv->dm.entry_min_undecoratedsmoothed_pwdb; | ||
| 1487 | } | ||
| 1488 | |||
| 1489 | /* Check RSSI to determine HighPower/NormalPower state for | ||
| 1490 | * BT coexistence. */ | ||
| 1491 | if (undecorated_smoothed_pwdb >= 67) | ||
| 1492 | curr_bt_rssi_state &= (~BT_RSSI_STATE_NORMAL_POWER); | ||
| 1493 | else if (undecorated_smoothed_pwdb < 62) | ||
| 1494 | curr_bt_rssi_state |= BT_RSSI_STATE_NORMAL_POWER; | ||
| 1495 | |||
| 1496 | /* Check RSSI to determine AMPDU setting for BT coexistence. */ | ||
| 1497 | if (undecorated_smoothed_pwdb >= 40) | ||
| 1498 | curr_bt_rssi_state &= (~BT_RSSI_STATE_AMDPU_OFF); | ||
| 1499 | else if (undecorated_smoothed_pwdb <= 32) | ||
| 1500 | curr_bt_rssi_state |= BT_RSSI_STATE_AMDPU_OFF; | ||
| 1501 | |||
| 1502 | /* Marked RSSI state. It will be used to determine BT coexistence | ||
| 1503 | * setting later. */ | ||
| 1504 | if (undecorated_smoothed_pwdb < 35) | ||
| 1505 | curr_bt_rssi_state |= BT_RSSI_STATE_SPECIAL_LOW; | ||
| 1506 | else | ||
| 1507 | curr_bt_rssi_state &= (~BT_RSSI_STATE_SPECIAL_LOW); | ||
| 1508 | |||
| 1509 | /* Set Tx Power according to BT status. */ | ||
| 1510 | if (undecorated_smoothed_pwdb >= 30) | ||
| 1511 | curr_bt_rssi_state |= BT_RSSI_STATE_TXPOWER_LOW; | ||
| 1512 | else if (undecorated_smoothed_pwdb < 25) | ||
| 1513 | curr_bt_rssi_state &= (~BT_RSSI_STATE_TXPOWER_LOW); | ||
| 1514 | |||
| 1515 | /* Check BT state related to BT_Idle in B/G mode. */ | ||
| 1516 | if (undecorated_smoothed_pwdb < 15) | ||
| 1517 | curr_bt_rssi_state |= BT_RSSI_STATE_BG_EDCA_LOW; | ||
| 1518 | else | ||
| 1519 | curr_bt_rssi_state &= (~BT_RSSI_STATE_BG_EDCA_LOW); | ||
| 1520 | |||
| 1521 | if (curr_bt_rssi_state != rtlpcipriv->bt_coexist.bt_rssi_state) { | ||
| 1522 | rtlpcipriv->bt_coexist.bt_rssi_state = curr_bt_rssi_state; | ||
| 1523 | return true; | ||
| 1524 | } else { | ||
| 1525 | return false; | ||
| 1526 | } | ||
| 1527 | } | ||
| 1528 | EXPORT_SYMBOL(rtl92c_bt_rssi_state_change); | ||
| 1529 | |||
| 1530 | static bool rtl92c_bt_state_change(struct ieee80211_hw *hw) | ||
| 1531 | { | ||
| 1532 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
| 1533 | struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); | ||
| 1534 | |||
| 1535 | u32 polling, ratio_tx, ratio_pri; | ||
| 1536 | u32 bt_tx, bt_pri; | ||
| 1537 | u8 bt_state; | ||
| 1538 | u8 cur_service_type; | ||
| 1539 | |||
| 1540 | if (rtlpriv->mac80211.link_state < MAC80211_LINKED) | ||
| 1541 | return false; | ||
| 1542 | |||
| 1543 | bt_state = rtl_read_byte(rtlpriv, 0x4fd); | ||
| 1544 | bt_tx = rtl_read_dword(rtlpriv, 0x488); | ||
| 1545 | bt_tx = bt_tx & 0x00ffffff; | ||
| 1546 | bt_pri = rtl_read_dword(rtlpriv, 0x48c); | ||
| 1547 | bt_pri = bt_pri & 0x00ffffff; | ||
| 1548 | polling = rtl_read_dword(rtlpriv, 0x490); | ||
| 1549 | |||
| 1550 | if (bt_tx == 0xffffffff && bt_pri == 0xffffffff && | ||
| 1551 | polling == 0xffffffff && bt_state == 0xff) | ||
| 1552 | return false; | ||
| 1553 | |||
| 1554 | bt_state &= BIT_OFFSET_LEN_MASK_32(0, 1); | ||
| 1555 | if (bt_state != rtlpcipriv->bt_coexist.bt_cur_state) { | ||
| 1556 | rtlpcipriv->bt_coexist.bt_cur_state = bt_state; | ||
| 1557 | |||
| 1558 | if (rtlpcipriv->bt_coexist.reg_bt_sco == 3) { | ||
| 1559 | rtlpcipriv->bt_coexist.bt_service = BT_IDLE; | ||
| 1560 | |||
| 1561 | bt_state = bt_state | | ||
| 1562 | ((rtlpcipriv->bt_coexist.bt_ant_isolation == 1) ? | ||
| 1563 | 0 : BIT_OFFSET_LEN_MASK_32(1, 1)) | | ||
| 1564 | BIT_OFFSET_LEN_MASK_32(2, 1); | ||
| 1565 | rtl_write_byte(rtlpriv, 0x4fd, bt_state); | ||
| 1566 | } | ||
| 1567 | return true; | ||
| 1568 | } | ||
| 1569 | |||
| 1570 | ratio_tx = bt_tx * 1000 / polling; | ||
| 1571 | ratio_pri = bt_pri * 1000 / polling; | ||
| 1572 | rtlpcipriv->bt_coexist.ratio_tx = ratio_tx; | ||
| 1573 | rtlpcipriv->bt_coexist.ratio_pri = ratio_pri; | ||
| 1574 | |||
| 1575 | if (bt_state && rtlpcipriv->bt_coexist.reg_bt_sco == 3) { | ||
| 1576 | |||
| 1577 | if ((ratio_tx < 30) && (ratio_pri < 30)) | ||
| 1578 | cur_service_type = BT_IDLE; | ||
| 1579 | else if ((ratio_pri > 110) && (ratio_pri < 250)) | ||
| 1580 | cur_service_type = BT_SCO; | ||
| 1581 | else if ((ratio_tx >= 200) && (ratio_pri >= 200)) | ||
| 1582 | cur_service_type = BT_BUSY; | ||
| 1583 | else if ((ratio_tx >= 350) && (ratio_tx < 500)) | ||
| 1584 | cur_service_type = BT_OTHERBUSY; | ||
| 1585 | else if (ratio_tx >= 500) | ||
| 1586 | cur_service_type = BT_PAN; | ||
| 1587 | else | ||
| 1588 | cur_service_type = BT_OTHER_ACTION; | ||
| 1589 | |||
| 1590 | if (cur_service_type != rtlpcipriv->bt_coexist.bt_service) { | ||
| 1591 | rtlpcipriv->bt_coexist.bt_service = cur_service_type; | ||
| 1592 | bt_state = bt_state | | ||
| 1593 | ((rtlpcipriv->bt_coexist.bt_ant_isolation == 1) ? | ||
| 1594 | 0 : BIT_OFFSET_LEN_MASK_32(1, 1)) | | ||
| 1595 | ((rtlpcipriv->bt_coexist.bt_service != BT_IDLE) ? | ||
| 1596 | 0 : BIT_OFFSET_LEN_MASK_32(2, 1)); | ||
| 1597 | |||
| 1598 | /* Add interrupt migration when bt is not ini | ||
| 1599 | * idle state (no traffic). */ | ||
| 1600 | if (rtlpcipriv->bt_coexist.bt_service != BT_IDLE) { | ||
| 1601 | rtl_write_word(rtlpriv, 0x504, 0x0ccc); | ||
| 1602 | rtl_write_byte(rtlpriv, 0x506, 0x54); | ||
| 1603 | rtl_write_byte(rtlpriv, 0x507, 0x54); | ||
| 1604 | } else { | ||
| 1605 | rtl_write_byte(rtlpriv, 0x506, 0x00); | ||
| 1606 | rtl_write_byte(rtlpriv, 0x507, 0x00); | ||
| 1607 | } | ||
| 1608 | |||
| 1609 | rtl_write_byte(rtlpriv, 0x4fd, bt_state); | ||
| 1610 | return true; | ||
| 1611 | } | ||
| 1612 | } | ||
| 1613 | |||
| 1614 | return false; | ||
| 1615 | |||
| 1616 | } | ||
| 1617 | |||
| 1618 | static bool rtl92c_bt_wifi_connect_change(struct ieee80211_hw *hw) | ||
| 1619 | { | ||
| 1620 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
| 1621 | static bool media_connect; | ||
| 1622 | |||
| 1623 | if (rtlpriv->mac80211.link_state < MAC80211_LINKED) { | ||
| 1624 | media_connect = false; | ||
| 1625 | } else { | ||
| 1626 | if (!media_connect) { | ||
| 1627 | media_connect = true; | ||
| 1628 | return true; | ||
| 1629 | } | ||
| 1630 | media_connect = true; | ||
| 1631 | } | ||
| 1632 | |||
| 1633 | return false; | ||
| 1634 | } | ||
| 1635 | |||
| 1636 | static void rtl92c_bt_set_normal(struct ieee80211_hw *hw) | ||
| 1637 | { | ||
| 1638 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
| 1639 | struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); | ||
| 1640 | |||
| 1641 | |||
| 1642 | if (rtlpcipriv->bt_coexist.bt_service == BT_OTHERBUSY) { | ||
| 1643 | rtlpcipriv->bt_coexist.bt_edca_ul = 0x5ea72b; | ||
| 1644 | rtlpcipriv->bt_coexist.bt_edca_dl = 0x5ea72b; | ||
| 1645 | } else if (rtlpcipriv->bt_coexist.bt_service == BT_BUSY) { | ||
| 1646 | rtlpcipriv->bt_coexist.bt_edca_ul = 0x5eb82f; | ||
| 1647 | rtlpcipriv->bt_coexist.bt_edca_dl = 0x5eb82f; | ||
| 1648 | } else if (rtlpcipriv->bt_coexist.bt_service == BT_SCO) { | ||
| 1649 | if (rtlpcipriv->bt_coexist.ratio_tx > 160) { | ||
| 1650 | rtlpcipriv->bt_coexist.bt_edca_ul = 0x5ea72f; | ||
| 1651 | rtlpcipriv->bt_coexist.bt_edca_dl = 0x5ea72f; | ||
| 1652 | } else { | ||
| 1653 | rtlpcipriv->bt_coexist.bt_edca_ul = 0x5ea32b; | ||
| 1654 | rtlpcipriv->bt_coexist.bt_edca_dl = 0x5ea42b; | ||
| 1655 | } | ||
| 1656 | } else { | ||
| 1657 | rtlpcipriv->bt_coexist.bt_edca_ul = 0; | ||
| 1658 | rtlpcipriv->bt_coexist.bt_edca_dl = 0; | ||
| 1659 | } | ||
| 1660 | |||
| 1661 | if ((rtlpcipriv->bt_coexist.bt_service != BT_IDLE) && | ||
| 1662 | (rtlpriv->mac80211.mode == WIRELESS_MODE_G || | ||
| 1663 | (rtlpriv->mac80211.mode == (WIRELESS_MODE_G | WIRELESS_MODE_B))) && | ||
| 1664 | (rtlpcipriv->bt_coexist.bt_rssi_state & | ||
| 1665 | BT_RSSI_STATE_BG_EDCA_LOW)) { | ||
| 1666 | rtlpcipriv->bt_coexist.bt_edca_ul = 0x5eb82b; | ||
| 1667 | rtlpcipriv->bt_coexist.bt_edca_dl = 0x5eb82b; | ||
| 1668 | } | ||
| 1669 | } | ||
| 1670 | |||
| 1671 | static void rtl92c_bt_ant_isolation(struct ieee80211_hw *hw) | ||
| 1672 | { | ||
| 1673 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
| 1674 | struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); | ||
| 1675 | |||
| 1676 | |||
| 1677 | /* Only enable HW BT coexist when BT in "Busy" state. */ | ||
| 1678 | if (rtlpriv->mac80211.vendor == PEER_CISCO && | ||
| 1679 | rtlpcipriv->bt_coexist.bt_service == BT_OTHER_ACTION) { | ||
| 1680 | rtl_write_byte(rtlpriv, REG_GPIO_MUXCFG, 0xa0); | ||
| 1681 | } else { | ||
| 1682 | if ((rtlpcipriv->bt_coexist.bt_service == BT_BUSY) && | ||
| 1683 | (rtlpcipriv->bt_coexist.bt_rssi_state & | ||
| 1684 | BT_RSSI_STATE_NORMAL_POWER)) { | ||
| 1685 | rtl_write_byte(rtlpriv, REG_GPIO_MUXCFG, 0xa0); | ||
| 1686 | } else if ((rtlpcipriv->bt_coexist.bt_service == | ||
| 1687 | BT_OTHER_ACTION) && (rtlpriv->mac80211.mode < | ||
| 1688 | WIRELESS_MODE_N_24G) && | ||
| 1689 | (rtlpcipriv->bt_coexist.bt_rssi_state & | ||
| 1690 | BT_RSSI_STATE_SPECIAL_LOW)) { | ||
| 1691 | rtl_write_byte(rtlpriv, REG_GPIO_MUXCFG, 0xa0); | ||
| 1692 | } else if (rtlpcipriv->bt_coexist.bt_service == BT_PAN) { | ||
| 1693 | rtl_write_byte(rtlpriv, REG_GPIO_MUXCFG, 0x00); | ||
| 1694 | } else { | ||
| 1695 | rtl_write_byte(rtlpriv, REG_GPIO_MUXCFG, 0x00); | ||
| 1696 | } | ||
| 1697 | } | ||
| 1698 | |||
| 1699 | if (rtlpcipriv->bt_coexist.bt_service == BT_PAN) | ||
| 1700 | rtl_write_dword(rtlpriv, REG_GPIO_PIN_CTRL, 0x10100); | ||
| 1701 | else | ||
| 1702 | rtl_write_dword(rtlpriv, REG_GPIO_PIN_CTRL, 0x0); | ||
| 1703 | |||
| 1704 | if (rtlpcipriv->bt_coexist.bt_rssi_state & | ||
| 1705 | BT_RSSI_STATE_NORMAL_POWER) { | ||
| 1706 | rtl92c_bt_set_normal(hw); | ||
| 1707 | } else { | ||
| 1708 | rtlpcipriv->bt_coexist.bt_edca_ul = 0; | ||
| 1709 | rtlpcipriv->bt_coexist.bt_edca_dl = 0; | ||
| 1710 | } | ||
| 1711 | |||
| 1712 | if (rtlpcipriv->bt_coexist.bt_service != BT_IDLE) { | ||
| 1713 | rtlpriv->cfg->ops->set_rfreg(hw, | ||
| 1714 | RF90_PATH_A, | ||
| 1715 | 0x1e, | ||
| 1716 | 0xf0, 0xf); | ||
| 1717 | } else { | ||
| 1718 | rtlpriv->cfg->ops->set_rfreg(hw, | ||
| 1719 | RF90_PATH_A, 0x1e, 0xf0, | ||
| 1720 | rtlpcipriv->bt_coexist.bt_rfreg_origin_1e); | ||
| 1721 | } | ||
| 1722 | |||
| 1723 | if (!rtlpriv->dm.dynamic_txpower_enable) { | ||
| 1724 | if (rtlpcipriv->bt_coexist.bt_service != BT_IDLE) { | ||
| 1725 | if (rtlpcipriv->bt_coexist.bt_rssi_state & | ||
| 1726 | BT_RSSI_STATE_TXPOWER_LOW) { | ||
| 1727 | rtlpriv->dm.dynamic_txhighpower_lvl = | ||
| 1728 | TXHIGHPWRLEVEL_BT2; | ||
| 1729 | } else { | ||
| 1730 | rtlpriv->dm.dynamic_txhighpower_lvl = | ||
| 1731 | TXHIGHPWRLEVEL_BT1; | ||
| 1732 | } | ||
| 1733 | } else { | ||
| 1734 | rtlpriv->dm.dynamic_txhighpower_lvl = | ||
| 1735 | TXHIGHPWRLEVEL_NORMAL; | ||
| 1736 | } | ||
| 1737 | rtl92c_phy_set_txpower_level(hw, | ||
| 1738 | rtlpriv->phy.current_channel); | ||
| 1739 | } | ||
| 1740 | } | ||
| 1741 | |||
| 1742 | static void rtl92c_check_bt_change(struct ieee80211_hw *hw) | ||
| 1743 | { | ||
| 1744 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
| 1745 | struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); | ||
| 1746 | |||
| 1747 | if (rtlpcipriv->bt_coexist.bt_cur_state) { | ||
| 1748 | if (rtlpcipriv->bt_coexist.bt_ant_isolation) | ||
| 1749 | rtl92c_bt_ant_isolation(hw); | ||
| 1750 | } else { | ||
| 1751 | rtl_write_byte(rtlpriv, REG_GPIO_MUXCFG, 0x00); | ||
| 1752 | rtlpriv->cfg->ops->set_rfreg(hw, RF90_PATH_A, 0x1e, 0xf0, | ||
| 1753 | rtlpcipriv->bt_coexist.bt_rfreg_origin_1e); | ||
| 1754 | |||
| 1755 | rtlpcipriv->bt_coexist.bt_edca_ul = 0; | ||
| 1756 | rtlpcipriv->bt_coexist.bt_edca_dl = 0; | ||
| 1757 | } | ||
| 1758 | } | ||
| 1759 | |||
| 1760 | void rtl92c_dm_bt_coexist(struct ieee80211_hw *hw) | ||
| 1761 | { | ||
| 1762 | struct rtl_pci_priv *rtlpcipriv = rtl_pcipriv(hw); | ||
| 1763 | |||
| 1764 | bool wifi_connect_change; | ||
| 1765 | bool bt_state_change; | ||
| 1766 | bool rssi_state_change; | ||
| 1767 | |||
| 1768 | if ((rtlpcipriv->bt_coexist.bt_coexistence) && | ||
| 1769 | (rtlpcipriv->bt_coexist.bt_coexist_type == BT_CSR_BC4)) { | ||
| 1770 | |||
| 1771 | wifi_connect_change = rtl92c_bt_wifi_connect_change(hw); | ||
| 1772 | bt_state_change = rtl92c_bt_state_change(hw); | ||
| 1773 | rssi_state_change = rtl92c_bt_rssi_state_change(hw); | ||
| 1774 | |||
| 1775 | if (wifi_connect_change || bt_state_change || rssi_state_change) | ||
| 1776 | rtl92c_check_bt_change(hw); | ||
| 1777 | } | ||
| 1778 | } | ||
| 1779 | EXPORT_SYMBOL(rtl92c_dm_bt_coexist); | ||
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.h b/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.h index b9cbb0a3c03f..b9736d3e9a39 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.h +++ b/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.h | |||
| @@ -200,5 +200,7 @@ void rtl92c_dm_rf_saving(struct ieee80211_hw *hw, u8 bforce_in_normal); | |||
| 200 | void rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, char delta); | 200 | void rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, char delta); |
| 201 | void rtl92c_phy_lc_calibrate(struct ieee80211_hw *hw); | 201 | void rtl92c_phy_lc_calibrate(struct ieee80211_hw *hw); |
| 202 | void rtl92c_phy_iq_calibrate(struct ieee80211_hw *hw, bool recovery); | 202 | void rtl92c_phy_iq_calibrate(struct ieee80211_hw *hw, bool recovery); |
| 203 | void rtl92c_dm_dynamic_txpower(struct ieee80211_hw *hw); | ||
| 204 | void rtl92c_dm_bt_coexist(struct ieee80211_hw *hw); | ||
| 203 | 205 | ||
| 204 | #endif | 206 | #endif |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c index bc9d24134ac4..50303e1adff1 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c +++ b/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c | |||
| @@ -223,29 +223,15 @@ int rtl92c_download_fw(struct ieee80211_hw *hw) | |||
| 223 | u8 *pfwdata; | 223 | u8 *pfwdata; |
| 224 | u32 fwsize; | 224 | u32 fwsize; |
| 225 | enum version_8192c version = rtlhal->version; | 225 | enum version_8192c version = rtlhal->version; |
| 226 | const struct firmware *firmware; | ||
| 227 | 226 | ||
| 228 | printk(KERN_INFO "rtl8192c: Loading firmware file %s\n", | 227 | printk(KERN_INFO "rtl8192c: Loading firmware file %s\n", |
| 229 | rtlpriv->cfg->fw_name); | 228 | rtlpriv->cfg->fw_name); |
| 230 | if (request_firmware(&firmware, rtlpriv->cfg->fw_name, | 229 | if (!rtlhal->pfirmware) |
| 231 | rtlpriv->io.dev)) { | ||
| 232 | printk(KERN_ERR "rtl8192c: Firmware loading failed\n"); | ||
| 233 | return 1; | 230 | return 1; |
| 234 | } | ||
| 235 | |||
| 236 | if (firmware->size > 0x4000) { | ||
| 237 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, | ||
| 238 | ("Firmware is too big!\n")); | ||
| 239 | release_firmware(firmware); | ||
| 240 | return 1; | ||
| 241 | } | ||
| 242 | |||
| 243 | memcpy(rtlhal->pfirmware, firmware->data, firmware->size); | ||
| 244 | fwsize = firmware->size; | ||
| 245 | release_firmware(firmware); | ||
| 246 | 231 | ||
| 247 | pfwheader = (struct rtl92c_firmware_header *)rtlhal->pfirmware; | 232 | pfwheader = (struct rtl92c_firmware_header *)rtlhal->pfirmware; |
| 248 | pfwdata = (u8 *) rtlhal->pfirmware; | 233 | pfwdata = (u8 *) rtlhal->pfirmware; |
| 234 | fwsize = rtlhal->fwsize; | ||
| 249 | 235 | ||
| 250 | if (IS_FW_HEADER_EXIST(pfwheader)) { | 236 | if (IS_FW_HEADER_EXIST(pfwheader)) { |
| 251 | RT_TRACE(rtlpriv, COMP_FW, DBG_DMESG, | 237 | RT_TRACE(rtlpriv, COMP_FW, DBG_DMESG, |
| @@ -553,6 +539,39 @@ void rtl92c_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode) | |||
| 553 | } | 539 | } |
| 554 | EXPORT_SYMBOL(rtl92c_set_fw_pwrmode_cmd); | 540 | EXPORT_SYMBOL(rtl92c_set_fw_pwrmode_cmd); |
| 555 | 541 | ||
| 542 | static bool _rtl92c_cmd_send_packet(struct ieee80211_hw *hw, | ||
| 543 | struct sk_buff *skb) | ||
| 544 | { | ||
| 545 | struct rtl_priv *rtlpriv = rtl_priv(hw); | ||
| 546 | struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw)); | ||
| 547 | struct rtl8192_tx_ring *ring; | ||
| 548 | struct rtl_tx_desc *pdesc; | ||
| 549 | u8 own; | ||
| 550 | unsigned long flags; | ||
| 551 | struct sk_buff *pskb = NULL; | ||
| 552 | |||
| 553 | ring = &rtlpci->tx_ring[BEACON_QUEUE]; | ||
| 554 | |||
| 555 | pskb = __skb_dequeue(&ring->queue); | ||
| 556 | if (pskb) | ||
| 557 | kfree_skb(pskb); | ||
| 558 | |||
| 559 | spin_lock_irqsave(&rtlpriv->locks.irq_th_lock, flags); | ||
| 560 | |||
| 561 | pdesc = &ring->desc[0]; | ||
| 562 | own = (u8) rtlpriv->cfg->ops->get_desc((u8 *) pdesc, true, HW_DESC_OWN); | ||
| 563 | |||
| 564 | rtlpriv->cfg->ops->fill_tx_cmddesc(hw, (u8 *) pdesc, 1, 1, skb); | ||
| 565 | |||
| 566 | __skb_queue_tail(&ring->queue, skb); | ||
| 567 | |||
| 568 | spin_unlock_irqrestore(&rtlpriv->locks.irq_th_lock, flags); | ||
| 569 | |||
| 570 | rtlpriv->cfg->ops->tx_polling(hw, BEACON_QUEUE); | ||
| 571 | |||
| 572 | return true; | ||
| 573 | } | ||
| 574 | |||
| 556 | #define BEACON_PG 0 /*->1*/ | 575 | #define BEACON_PG 0 /*->1*/ |
| 557 | #define PSPOLL_PG 2 | 576 | #define PSPOLL_PG 2 |
| 558 | #define NULL_PG 3 | 577 | #define NULL_PG 3 |
| @@ -670,7 +689,7 @@ static u8 reserved_page_packet[TOTAL_RESERVED_PKT_LEN] = { | |||
| 670 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 689 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 671 | }; | 690 | }; |
| 672 | 691 | ||
| 673 | void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished) | 692 | void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool dl_finished) |
| 674 | { | 693 | { |
| 675 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 694 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
| 676 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); | 695 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); |
| @@ -679,12 +698,12 @@ void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished) | |||
| 679 | u32 totalpacketlen; | 698 | u32 totalpacketlen; |
| 680 | bool rtstatus; | 699 | bool rtstatus; |
| 681 | u8 u1RsvdPageLoc[3] = {0}; | 700 | u8 u1RsvdPageLoc[3] = {0}; |
| 682 | bool b_dlok = false; | 701 | bool dlok = false; |
| 683 | 702 | ||
| 684 | u8 *beacon; | 703 | u8 *beacon; |
| 685 | u8 *p_pspoll; | 704 | u8 *pspoll; |
| 686 | u8 *nullfunc; | 705 | u8 *nullfunc; |
| 687 | u8 *p_probersp; | 706 | u8 *probersp; |
| 688 | /*--------------------------------------------------------- | 707 | /*--------------------------------------------------------- |
| 689 | (1) beacon | 708 | (1) beacon |
| 690 | ---------------------------------------------------------*/ | 709 | ---------------------------------------------------------*/ |
| @@ -695,10 +714,10 @@ void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished) | |||
| 695 | /*------------------------------------------------------- | 714 | /*------------------------------------------------------- |
| 696 | (2) ps-poll | 715 | (2) ps-poll |
| 697 | --------------------------------------------------------*/ | 716 | --------------------------------------------------------*/ |
| 698 | p_pspoll = &reserved_page_packet[PSPOLL_PG * 128]; | 717 | pspoll = &reserved_page_packet[PSPOLL_PG * 128]; |
| 699 | SET_80211_PS_POLL_AID(p_pspoll, (mac->assoc_id | 0xc000)); | 718 | SET_80211_PS_POLL_AID(pspoll, (mac->assoc_id | 0xc000)); |
| 700 | SET_80211_PS_POLL_BSSID(p_pspoll, mac->bssid); | 719 | SET_80211_PS_POLL_BSSID(pspoll, mac->bssid); |
| 701 | SET_80211_PS_POLL_TA(p_pspoll, mac->mac_addr); | 720 | SET_80211_PS_POLL_TA(pspoll, mac->mac_addr); |
| 702 | 721 | ||
| 703 | SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(u1RsvdPageLoc, PSPOLL_PG); | 722 | SET_H2CCMD_RSVDPAGE_LOC_PSPOLL(u1RsvdPageLoc, PSPOLL_PG); |
| 704 | 723 | ||
| @@ -715,10 +734,10 @@ void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished) | |||
| 715 | /*--------------------------------------------------------- | 734 | /*--------------------------------------------------------- |
| 716 | (4) probe response | 735 | (4) probe response |
| 717 | ----------------------------------------------------------*/ | 736 | ----------------------------------------------------------*/ |
| 718 | p_probersp = &reserved_page_packet[PROBERSP_PG * 128]; | 737 | probersp = &reserved_page_packet[PROBERSP_PG * 128]; |
| 719 | SET_80211_HDR_ADDRESS1(p_probersp, mac->bssid); | 738 | SET_80211_HDR_ADDRESS1(probersp, mac->bssid); |
| 720 | SET_80211_HDR_ADDRESS2(p_probersp, mac->mac_addr); | 739 | SET_80211_HDR_ADDRESS2(probersp, mac->mac_addr); |
| 721 | SET_80211_HDR_ADDRESS3(p_probersp, mac->bssid); | 740 | SET_80211_HDR_ADDRESS3(probersp, mac->bssid); |
| 722 | 741 | ||
| 723 | SET_H2CCMD_RSVDPAGE_LOC_PROBE_RSP(u1RsvdPageLoc, PROBERSP_PG); | 742 | SET_H2CCMD_RSVDPAGE_LOC_PROBE_RSP(u1RsvdPageLoc, PROBERSP_PG); |
| 724 | 743 | ||
| @@ -736,12 +755,12 @@ void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished) | |||
| 736 | memcpy((u8 *) skb_put(skb, totalpacketlen), | 755 | memcpy((u8 *) skb_put(skb, totalpacketlen), |
| 737 | &reserved_page_packet, totalpacketlen); | 756 | &reserved_page_packet, totalpacketlen); |
| 738 | 757 | ||
| 739 | rtstatus = rtlpriv->cfg->ops->cmd_send_packet(hw, skb); | 758 | rtstatus = _rtl92c_cmd_send_packet(hw, skb); |
| 740 | 759 | ||
| 741 | if (rtstatus) | 760 | if (rtstatus) |
| 742 | b_dlok = true; | 761 | dlok = true; |
| 743 | 762 | ||
| 744 | if (b_dlok) { | 763 | if (dlok) { |
| 745 | RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, | 764 | RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, |
| 746 | ("Set RSVD page location to Fw.\n")); | 765 | ("Set RSVD page location to Fw.\n")); |
| 747 | RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG, | 766 | RT_PRINT_DATA(rtlpriv, COMP_CMD, DBG_DMESG, |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.h b/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.h index 3db33bd14666..3d5823c12621 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.h +++ b/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.h | |||
| @@ -27,8 +27,8 @@ | |||
| 27 | * | 27 | * |
| 28 | *****************************************************************************/ | 28 | *****************************************************************************/ |
| 29 | 29 | ||
| 30 | #ifndef __RTL92C__FW__H__ | 30 | #ifndef __RTL92C__FW__COMMON__H__ |
| 31 | #define __RTL92C__FW__H__ | 31 | #define __RTL92C__FW__COMMON__H__ |
| 32 | 32 | ||
| 33 | #define FW_8192C_SIZE 0x3000 | 33 | #define FW_8192C_SIZE 0x3000 |
| 34 | #define FW_8192C_START_ADDRESS 0x1000 | 34 | #define FW_8192C_START_ADDRESS 0x1000 |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c index a70228278398..c5424cad43cb 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c +++ b/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c | |||
| @@ -78,27 +78,29 @@ void rtl92c_phy_set_bb_reg(struct ieee80211_hw *hw, | |||
| 78 | RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("regaddr(%#x), bitmask(%#x)," | 78 | RT_TRACE(rtlpriv, COMP_RF, DBG_TRACE, ("regaddr(%#x), bitmask(%#x)," |
| 79 | " data(%#x)\n", regaddr, bitmask, | 79 | " data(%#x)\n", regaddr, bitmask, |
| 80 | data)); | 80 | data)); |
| 81 | |||
| 81 | } | 82 | } |
| 82 | EXPORT_SYMBOL(rtl92c_phy_set_bb_reg); | 83 | EXPORT_SYMBOL(rtl92c_phy_set_bb_reg); |
| 83 | 84 | ||
| 84 | u32 _rtl92c_phy_fw_rf_serial_read(struct ieee80211_hw *hw, | 85 | u32 _rtl92c_phy_fw_rf_serial_read(struct ieee80211_hw *hw, |
| 85 | enum radio_path rfpath, u32 offset) | 86 | enum radio_path rfpath, u32 offset) |
| 86 | { | 87 | { |
| 87 | RT_ASSERT(false, ("deprecated!\n")); | 88 | RT_ASSERT(false, ("deprecated!\n")); |
| 88 | return 0; | 89 | return 0; |
| 90 | |||
| 89 | } | 91 | } |
| 90 | EXPORT_SYMBOL(_rtl92c_phy_fw_rf_serial_read); | 92 | EXPORT_SYMBOL(_rtl92c_phy_fw_rf_serial_read); |
| 91 | 93 | ||
| 92 | void _rtl92c_phy_fw_rf_serial_write(struct ieee80211_hw *hw, | 94 | void _rtl92c_phy_fw_rf_serial_write(struct ieee80211_hw *hw, |
| 93 | enum radio_path rfpath, u32 offset, | 95 | enum radio_path rfpath, u32 offset, |
| 94 | u32 data) | 96 | u32 data) |
| 95 | { | 97 | { |
| 96 | RT_ASSERT(false, ("deprecated!\n")); | 98 | RT_ASSERT(false, ("deprecated!\n")); |
| 97 | } | 99 | } |
| 98 | EXPORT_SYMBOL(_rtl92c_phy_fw_rf_serial_write); | 100 | EXPORT_SYMBOL(_rtl92c_phy_fw_rf_serial_write); |
| 99 | 101 | ||
| 100 | u32 _rtl92c_phy_rf_serial_read(struct ieee80211_hw *hw, | 102 | u32 _rtl92c_phy_rf_serial_read(struct ieee80211_hw *hw, |
| 101 | enum radio_path rfpath, u32 offset) | 103 | enum radio_path rfpath, u32 offset) |
| 102 | { | 104 | { |
| 103 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 105 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
| 104 | struct rtl_phy *rtlphy = &(rtlpriv->phy); | 106 | struct rtl_phy *rtlphy = &(rtlpriv->phy); |
| @@ -149,8 +151,8 @@ u32 _rtl92c_phy_rf_serial_read(struct ieee80211_hw *hw, | |||
| 149 | EXPORT_SYMBOL(_rtl92c_phy_rf_serial_read); | 151 | EXPORT_SYMBOL(_rtl92c_phy_rf_serial_read); |
| 150 | 152 | ||
| 151 | void _rtl92c_phy_rf_serial_write(struct ieee80211_hw *hw, | 153 | void _rtl92c_phy_rf_serial_write(struct ieee80211_hw *hw, |
| 152 | enum radio_path rfpath, u32 offset, | 154 | enum radio_path rfpath, u32 offset, |
| 153 | u32 data) | 155 | u32 data) |
| 154 | { | 156 | { |
| 155 | u32 data_and_addr; | 157 | u32 data_and_addr; |
| 156 | u32 newoffset; | 158 | u32 newoffset; |
| @@ -197,6 +199,7 @@ static void _rtl92c_phy_bb_config_1t(struct ieee80211_hw *hw) | |||
| 197 | rtl_set_bbreg(hw, 0xe80, 0x0c000000, 0x2); | 199 | rtl_set_bbreg(hw, 0xe80, 0x0c000000, 0x2); |
| 198 | rtl_set_bbreg(hw, 0xe88, 0x0c000000, 0x2); | 200 | rtl_set_bbreg(hw, 0xe88, 0x0c000000, 0x2); |
| 199 | } | 201 | } |
| 202 | |||
| 200 | bool rtl92c_phy_rf_config(struct ieee80211_hw *hw) | 203 | bool rtl92c_phy_rf_config(struct ieee80211_hw *hw) |
| 201 | { | 204 | { |
| 202 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 205 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
| @@ -241,13 +244,14 @@ bool _rtl92c_phy_bb8192c_config_parafile(struct ieee80211_hw *hw) | |||
| 241 | rtlphy->cck_high_power = (bool) (rtl_get_bbreg(hw, | 244 | rtlphy->cck_high_power = (bool) (rtl_get_bbreg(hw, |
| 242 | RFPGA0_XA_HSSIPARAMETER2, | 245 | RFPGA0_XA_HSSIPARAMETER2, |
| 243 | 0x200)); | 246 | 0x200)); |
| 247 | |||
| 244 | return true; | 248 | return true; |
| 245 | } | 249 | } |
| 246 | EXPORT_SYMBOL(_rtl92c_phy_bb8192c_config_parafile); | 250 | EXPORT_SYMBOL(_rtl92c_phy_bb8192c_config_parafile); |
| 247 | 251 | ||
| 248 | void _rtl92c_store_pwrIndex_diffrate_offset(struct ieee80211_hw *hw, | 252 | void _rtl92c_store_pwrIndex_diffrate_offset(struct ieee80211_hw *hw, |
| 249 | u32 regaddr, u32 bitmask, | 253 | u32 regaddr, u32 bitmask, |
| 250 | u32 data) | 254 | u32 data) |
| 251 | { | 255 | { |
| 252 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 256 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
| 253 | struct rtl_phy *rtlphy = &(rtlpriv->phy); | 257 | struct rtl_phy *rtlphy = &(rtlpriv->phy); |
| @@ -317,61 +321,48 @@ void _rtl92c_store_pwrIndex_diffrate_offset(struct ieee80211_hw *hw, | |||
| 317 | } | 321 | } |
| 318 | if (regaddr == RTXAGC_B_RATE54_24) { | 322 | if (regaddr == RTXAGC_B_RATE54_24) { |
| 319 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][9] = data; | 323 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][9] = data; |
| 320 | |||
| 321 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, | 324 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, |
| 322 | ("MCSTxPowerLevelOriginalOffset[%d][9] = 0x%x\n", | 325 | ("MCSTxPowerLevelOriginalOffset[%d][9] = 0x%x\n", |
| 323 | rtlphy->pwrgroup_cnt, | 326 | rtlphy->pwrgroup_cnt, |
| 324 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][9])); | 327 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][9])); |
| 325 | } | 328 | } |
| 326 | |||
| 327 | if (regaddr == RTXAGC_B_CCK1_55_MCS32) { | 329 | if (regaddr == RTXAGC_B_CCK1_55_MCS32) { |
| 328 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][14] = data; | 330 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][14] = data; |
| 329 | |||
| 330 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, | 331 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, |
| 331 | ("MCSTxPowerLevelOriginalOffset[%d][14] = 0x%x\n", | 332 | ("MCSTxPowerLevelOriginalOffset[%d][14] = 0x%x\n", |
| 332 | rtlphy->pwrgroup_cnt, | 333 | rtlphy->pwrgroup_cnt, |
| 333 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][14])); | 334 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][14])); |
| 334 | } | 335 | } |
| 335 | |||
| 336 | if (regaddr == RTXAGC_B_CCK11_A_CCK2_11 && bitmask == 0x000000ff) { | 336 | if (regaddr == RTXAGC_B_CCK11_A_CCK2_11 && bitmask == 0x000000ff) { |
| 337 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][15] = data; | 337 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][15] = data; |
| 338 | |||
| 339 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, | 338 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, |
| 340 | ("MCSTxPowerLevelOriginalOffset[%d][15] = 0x%x\n", | 339 | ("MCSTxPowerLevelOriginalOffset[%d][15] = 0x%x\n", |
| 341 | rtlphy->pwrgroup_cnt, | 340 | rtlphy->pwrgroup_cnt, |
| 342 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][15])); | 341 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][15])); |
| 343 | } | 342 | } |
| 344 | |||
| 345 | if (regaddr == RTXAGC_B_MCS03_MCS00) { | 343 | if (regaddr == RTXAGC_B_MCS03_MCS00) { |
| 346 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][10] = data; | 344 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][10] = data; |
| 347 | |||
| 348 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, | 345 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, |
| 349 | ("MCSTxPowerLevelOriginalOffset[%d][10] = 0x%x\n", | 346 | ("MCSTxPowerLevelOriginalOffset[%d][10] = 0x%x\n", |
| 350 | rtlphy->pwrgroup_cnt, | 347 | rtlphy->pwrgroup_cnt, |
| 351 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][10])); | 348 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][10])); |
| 352 | } | 349 | } |
| 353 | |||
| 354 | if (regaddr == RTXAGC_B_MCS07_MCS04) { | 350 | if (regaddr == RTXAGC_B_MCS07_MCS04) { |
| 355 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][11] = data; | 351 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][11] = data; |
| 356 | |||
| 357 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, | 352 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, |
| 358 | ("MCSTxPowerLevelOriginalOffset[%d][11] = 0x%x\n", | 353 | ("MCSTxPowerLevelOriginalOffset[%d][11] = 0x%x\n", |
| 359 | rtlphy->pwrgroup_cnt, | 354 | rtlphy->pwrgroup_cnt, |
| 360 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][11])); | 355 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][11])); |
| 361 | } | 356 | } |
| 362 | |||
| 363 | if (regaddr == RTXAGC_B_MCS11_MCS08) { | 357 | if (regaddr == RTXAGC_B_MCS11_MCS08) { |
| 364 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][12] = data; | 358 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][12] = data; |
| 365 | |||
| 366 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, | 359 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, |
| 367 | ("MCSTxPowerLevelOriginalOffset[%d][12] = 0x%x\n", | 360 | ("MCSTxPowerLevelOriginalOffset[%d][12] = 0x%x\n", |
| 368 | rtlphy->pwrgroup_cnt, | 361 | rtlphy->pwrgroup_cnt, |
| 369 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][12])); | 362 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][12])); |
| 370 | } | 363 | } |
| 371 | |||
| 372 | if (regaddr == RTXAGC_B_MCS15_MCS12) { | 364 | if (regaddr == RTXAGC_B_MCS15_MCS12) { |
| 373 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][13] = data; | 365 | rtlphy->MCS_TXPWR[rtlphy->pwrgroup_cnt][13] = data; |
| 374 | |||
| 375 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, | 366 | RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE, |
| 376 | ("MCSTxPowerLevelOriginalOffset[%d][13] = 0x%x\n", | 367 | ("MCSTxPowerLevelOriginalOffset[%d][13] = 0x%x\n", |
| 377 | rtlphy->pwrgroup_cnt, | 368 | rtlphy->pwrgroup_cnt, |
| @@ -583,6 +574,7 @@ static void _rtl92c_ccxpower_index_check(struct ieee80211_hw *hw, | |||
| 583 | 574 | ||
| 584 | rtlphy->cur_cck_txpwridx = cckpowerlevel[0]; | 575 | rtlphy->cur_cck_txpwridx = cckpowerlevel[0]; |
| 585 | rtlphy->cur_ofdm24g_txpwridx = ofdmpowerlevel[0]; | 576 | rtlphy->cur_ofdm24g_txpwridx = ofdmpowerlevel[0]; |
| 577 | |||
| 586 | } | 578 | } |
| 587 | 579 | ||
| 588 | void rtl92c_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel) | 580 | void rtl92c_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel) |
| @@ -611,7 +603,6 @@ bool rtl92c_phy_update_txpower_dbm(struct ieee80211_hw *hw, long power_indbm) | |||
| 611 | struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); | 603 | struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); |
| 612 | u8 idx; | 604 | u8 idx; |
| 613 | u8 rf_path; | 605 | u8 rf_path; |
| 614 | |||
| 615 | u8 ccktxpwridx = _rtl92c_phy_dbm_to_txpwr_Idx(hw, | 606 | u8 ccktxpwridx = _rtl92c_phy_dbm_to_txpwr_Idx(hw, |
| 616 | WIRELESS_MODE_B, | 607 | WIRELESS_MODE_B, |
| 617 | power_indbm); | 608 | power_indbm); |
| @@ -639,11 +630,6 @@ bool rtl92c_phy_update_txpower_dbm(struct ieee80211_hw *hw, long power_indbm) | |||
| 639 | } | 630 | } |
| 640 | EXPORT_SYMBOL(rtl92c_phy_update_txpower_dbm); | 631 | EXPORT_SYMBOL(rtl92c_phy_update_txpower_dbm); |
| 641 | 632 | ||
| 642 | void rtl92c_phy_set_beacon_hw_reg(struct ieee80211_hw *hw, u16 beaconinterval) | ||
| 643 | { | ||
| 644 | } | ||
| 645 | EXPORT_SYMBOL(rtl92c_phy_set_beacon_hw_reg); | ||
| 646 | |||
| 647 | u8 _rtl92c_phy_dbm_to_txpwr_Idx(struct ieee80211_hw *hw, | 633 | u8 _rtl92c_phy_dbm_to_txpwr_Idx(struct ieee80211_hw *hw, |
| 648 | enum wireless_mode wirelessmode, | 634 | enum wireless_mode wirelessmode, |
| 649 | long power_indbm) | 635 | long power_indbm) |
| @@ -741,9 +727,9 @@ void rtl92c_phy_set_bw_mode(struct ieee80211_hw *hw, | |||
| 741 | if (rtlphy->set_bwmode_inprogress) | 727 | if (rtlphy->set_bwmode_inprogress) |
| 742 | return; | 728 | return; |
| 743 | rtlphy->set_bwmode_inprogress = true; | 729 | rtlphy->set_bwmode_inprogress = true; |
| 744 | if ((!is_hal_stop(rtlhal)) && !(RT_CANNOT_IO(hw))) | 730 | if ((!is_hal_stop(rtlhal)) && !(RT_CANNOT_IO(hw))) { |
| 745 | rtlpriv->cfg->ops->phy_set_bw_mode_callback(hw); | 731 | rtlphy->set_bwmode_inprogress = false; |
| 746 | else { | 732 | } else { |
| 747 | RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, | 733 | RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING, |
| 748 | ("FALSE driver sleep or unload\n")); | 734 | ("FALSE driver sleep or unload\n")); |
| 749 | rtlphy->set_bwmode_inprogress = false; | 735 | rtlphy->set_bwmode_inprogress = false; |
| @@ -773,8 +759,9 @@ void rtl92c_phy_sw_chnl_callback(struct ieee80211_hw *hw) | |||
| 773 | mdelay(delay); | 759 | mdelay(delay); |
| 774 | else | 760 | else |
| 775 | continue; | 761 | continue; |
| 776 | } else | 762 | } else { |
| 777 | rtlphy->sw_chnl_inprogress = false; | 763 | rtlphy->sw_chnl_inprogress = false; |
| 764 | } | ||
| 778 | break; | 765 | break; |
| 779 | } while (true); | 766 | } while (true); |
| 780 | RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, ("<==\n")); | 767 | RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, ("<==\n")); |
| @@ -811,9 +798,32 @@ u8 rtl92c_phy_sw_chnl(struct ieee80211_hw *hw) | |||
| 811 | } | 798 | } |
| 812 | EXPORT_SYMBOL(rtl92c_phy_sw_chnl); | 799 | EXPORT_SYMBOL(rtl92c_phy_sw_chnl); |
| 813 | 800 | ||
| 814 | static bool _rtl92c_phy_sw_chnl_step_by_step(struct ieee80211_hw *hw, | 801 | static bool _rtl92c_phy_set_sw_chnl_cmdarray(struct swchnlcmd *cmdtable, |
| 815 | u8 channel, u8 *stage, u8 *step, | 802 | u32 cmdtableidx, u32 cmdtablesz, |
| 816 | u32 *delay) | 803 | enum swchnlcmd_id cmdid, |
| 804 | u32 para1, u32 para2, u32 msdelay) | ||
| 805 | { | ||
| 806 | struct swchnlcmd *pcmd; | ||
| 807 | |||
| 808 | if (cmdtable == NULL) { | ||
| 809 | RT_ASSERT(false, ("cmdtable cannot be NULL.\n")); | ||
| 810 | return false; | ||
| 811 | } | ||
| 812 | |||
| 813 | if (cmdtableidx >= cmdtablesz) | ||
| 814 | return false; | ||
| 815 | |||
| 816 | pcmd = cmdtable + cmdtableidx; | ||
| 817 | pcmd->cmdid = cmdid; | ||
| 818 | pcmd->para1 = para1; | ||
| 819 | pcmd->para2 = para2; | ||
| 820 | pcmd->msdelay = msdelay; | ||
| 821 | return true; | ||
| 822 | } | ||
| 823 | |||
| 824 | bool _rtl92c_phy_sw_chnl_step_by_step(struct ieee80211_hw *hw, | ||
| 825 | u8 channel, u8 *stage, u8 *step, | ||
| 826 | u32 *delay) | ||
| 817 | { | 827 | { |
| 818 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 828 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
| 819 | struct rtl_phy *rtlphy = &(rtlpriv->phy); | 829 | struct rtl_phy *rtlphy = &(rtlpriv->phy); |
| @@ -917,29 +927,6 @@ static bool _rtl92c_phy_sw_chnl_step_by_step(struct ieee80211_hw *hw, | |||
| 917 | return false; | 927 | return false; |
| 918 | } | 928 | } |
| 919 | 929 | ||
| 920 | static bool _rtl92c_phy_set_sw_chnl_cmdarray(struct swchnlcmd *cmdtable, | ||
| 921 | u32 cmdtableidx, u32 cmdtablesz, | ||
| 922 | enum swchnlcmd_id cmdid, | ||
| 923 | u32 para1, u32 para2, u32 msdelay) | ||
| 924 | { | ||
| 925 | struct swchnlcmd *pcmd; | ||
| 926 | |||
| 927 | if (cmdtable == NULL) { | ||
| 928 | RT_ASSERT(false, ("cmdtable cannot be NULL.\n")); | ||
| 929 | return false; | ||
| 930 | } | ||
| 931 | |||
| 932 | if (cmdtableidx >= cmdtablesz) | ||
| 933 | return false; | ||
| 934 | |||
| 935 | pcmd = cmdtable + cmdtableidx; | ||
| 936 | pcmd->cmdid = cmdid; | ||
| 937 | pcmd->para1 = para1; | ||
| 938 | pcmd->para2 = para2; | ||
| 939 | pcmd->msdelay = msdelay; | ||
| 940 | return true; | ||
| 941 | } | ||
| 942 | |||
| 943 | bool rtl8192_phy_check_is_legal_rfpath(struct ieee80211_hw *hw, u32 rfpath) | 930 | bool rtl8192_phy_check_is_legal_rfpath(struct ieee80211_hw *hw, u32 rfpath) |
| 944 | { | 931 | { |
| 945 | return true; | 932 | return true; |
| @@ -1002,13 +989,13 @@ static u8 _rtl92c_phy_path_b_iqk(struct ieee80211_hw *hw) | |||
| 1002 | reg_ebc = rtl_get_bbreg(hw, 0xebc, MASKDWORD); | 989 | reg_ebc = rtl_get_bbreg(hw, 0xebc, MASKDWORD); |
| 1003 | reg_ec4 = rtl_get_bbreg(hw, 0xec4, MASKDWORD); | 990 | reg_ec4 = rtl_get_bbreg(hw, 0xec4, MASKDWORD); |
| 1004 | reg_ecc = rtl_get_bbreg(hw, 0xecc, MASKDWORD); | 991 | reg_ecc = rtl_get_bbreg(hw, 0xecc, MASKDWORD); |
| 992 | |||
| 1005 | if (!(reg_eac & BIT(31)) && | 993 | if (!(reg_eac & BIT(31)) && |
| 1006 | (((reg_eb4 & 0x03FF0000) >> 16) != 0x142) && | 994 | (((reg_eb4 & 0x03FF0000) >> 16) != 0x142) && |
| 1007 | (((reg_ebc & 0x03FF0000) >> 16) != 0x42)) | 995 | (((reg_ebc & 0x03FF0000) >> 16) != 0x42)) |
| 1008 | result |= 0x01; | 996 | result |= 0x01; |
| 1009 | else | 997 | else |
| 1010 | return result; | 998 | return result; |
| 1011 | |||
| 1012 | if (!(reg_eac & BIT(30)) && | 999 | if (!(reg_eac & BIT(30)) && |
| 1013 | (((reg_ec4 & 0x03FF0000) >> 16) != 0x132) && | 1000 | (((reg_ec4 & 0x03FF0000) >> 16) != 0x132) && |
| 1014 | (((reg_ecc & 0x03FF0000) >> 16) != 0x36)) | 1001 | (((reg_ecc & 0x03FF0000) >> 16) != 0x36)) |
| @@ -1023,9 +1010,9 @@ static void _rtl92c_phy_path_a_fill_iqk_matrix(struct ieee80211_hw *hw, | |||
| 1023 | u32 oldval_0, x, tx0_a, reg; | 1010 | u32 oldval_0, x, tx0_a, reg; |
| 1024 | long y, tx0_c; | 1011 | long y, tx0_c; |
| 1025 | 1012 | ||
| 1026 | if (final_candidate == 0xFF) | 1013 | if (final_candidate == 0xFF) { |
| 1027 | return; | 1014 | return; |
| 1028 | else if (iqk_ok) { | 1015 | } else if (iqk_ok) { |
| 1029 | oldval_0 = (rtl_get_bbreg(hw, ROFDM0_XATXIQIMBALANCE, | 1016 | oldval_0 = (rtl_get_bbreg(hw, ROFDM0_XATXIQIMBALANCE, |
| 1030 | MASKDWORD) >> 22) & 0x3FF; | 1017 | MASKDWORD) >> 22) & 0x3FF; |
| 1031 | x = result[final_candidate][0]; | 1018 | x = result[final_candidate][0]; |
| @@ -1063,9 +1050,9 @@ static void _rtl92c_phy_path_b_fill_iqk_matrix(struct ieee80211_hw *hw, | |||
| 1063 | u32 oldval_1, x, tx1_a, reg; | 1050 | u32 oldval_1, x, tx1_a, reg; |
| 1064 | long y, tx1_c; | 1051 | long y, tx1_c; |
| 1065 | 1052 | ||
| 1066 | if (final_candidate == 0xFF) | 1053 | if (final_candidate == 0xFF) { |
| 1067 | return; | 1054 | return; |
| 1068 | else if (iqk_ok) { | 1055 | } else if (iqk_ok) { |
| 1069 | oldval_1 = (rtl_get_bbreg(hw, ROFDM0_XBTXIQIMBALANCE, | 1056 | oldval_1 = (rtl_get_bbreg(hw, ROFDM0_XBTXIQIMBALANCE, |
| 1070 | MASKDWORD) >> 22) & 0x3FF; | 1057 | MASKDWORD) >> 22) & 0x3FF; |
| 1071 | x = result[final_candidate][4]; | 1058 | x = result[final_candidate][4]; |
| @@ -1282,6 +1269,7 @@ static void _rtl92c_phy_iq_calibrate(struct ieee80211_hw *hw, | |||
| 1282 | RFPGA0_XA_HSSIPARAMETER1, | 1269 | RFPGA0_XA_HSSIPARAMETER1, |
| 1283 | BIT(8)); | 1270 | BIT(8)); |
| 1284 | } | 1271 | } |
| 1272 | |||
| 1285 | if (!rtlphy->rfpi_enable) | 1273 | if (!rtlphy->rfpi_enable) |
| 1286 | _rtl92c_phy_pi_mode_switch(hw, true); | 1274 | _rtl92c_phy_pi_mode_switch(hw, true); |
| 1287 | if (t == 0) { | 1275 | if (t == 0) { |
| @@ -1317,9 +1305,10 @@ static void _rtl92c_phy_iq_calibrate(struct ieee80211_hw *hw, | |||
| 1317 | 0x3FF0000) >> 16; | 1305 | 0x3FF0000) >> 16; |
| 1318 | break; | 1306 | break; |
| 1319 | } else if (i == (retrycount - 1) && patha_ok == 0x01) | 1307 | } else if (i == (retrycount - 1) && patha_ok == 0x01) |
| 1308 | |||
| 1320 | result[t][0] = (rtl_get_bbreg(hw, 0xe94, | 1309 | result[t][0] = (rtl_get_bbreg(hw, 0xe94, |
| 1321 | MASKDWORD) & 0x3FF0000) >> | 1310 | MASKDWORD) & 0x3FF0000) >> |
| 1322 | 16; | 1311 | 16; |
| 1323 | result[t][1] = | 1312 | result[t][1] = |
| 1324 | (rtl_get_bbreg(hw, 0xe9c, MASKDWORD) & 0x3FF0000) >> 16; | 1313 | (rtl_get_bbreg(hw, 0xe9c, MASKDWORD) & 0x3FF0000) >> 16; |
| 1325 | 1314 | ||
| @@ -1375,8 +1364,7 @@ static void _rtl92c_phy_iq_calibrate(struct ieee80211_hw *hw, | |||
| 1375 | static void _rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, | 1364 | static void _rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, |
| 1376 | char delta, bool is2t) | 1365 | char delta, bool is2t) |
| 1377 | { | 1366 | { |
| 1378 | /* This routine is deliberately dummied out for later fixes */ | 1367 | #if 0 /* This routine is deliberately dummied out for later fixes */ |
| 1379 | #if 0 | ||
| 1380 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 1368 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
| 1381 | struct rtl_phy *rtlphy = &(rtlpriv->phy); | 1369 | struct rtl_phy *rtlphy = &(rtlpriv->phy); |
| 1382 | struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); | 1370 | struct rtl_efuse *rtlefuse = rtl_efuse(rtl_priv(hw)); |
| @@ -1434,7 +1422,7 @@ static void _rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, | |||
| 1434 | 0x04db25a4, 0x0b1b25a4 | 1422 | 0x04db25a4, 0x0b1b25a4 |
| 1435 | }; | 1423 | }; |
| 1436 | 1424 | ||
| 1437 | u32 apk_offset[PATH_NUM] = { 0xb68, 0xb6c }; | 1425 | const u32 apk_offset[PATH_NUM] = { 0xb68, 0xb6c }; |
| 1438 | 1426 | ||
| 1439 | u32 apk_normal_offset[PATH_NUM] = { 0xb28, 0xb98 }; | 1427 | u32 apk_normal_offset[PATH_NUM] = { 0xb28, 0xb98 }; |
| 1440 | 1428 | ||
| @@ -1463,13 +1451,15 @@ static void _rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, | |||
| 1463 | 0x00050006 | 1451 | 0x00050006 |
| 1464 | }; | 1452 | }; |
| 1465 | 1453 | ||
| 1466 | const u32 apk_result[PATH_NUM][APK_BB_REG_NUM]; | 1454 | u32 apk_result[PATH_NUM][APK_BB_REG_NUM]; |
| 1467 | 1455 | ||
| 1468 | long bb_offset, delta_v, delta_offset; | 1456 | long bb_offset, delta_v, delta_offset; |
| 1469 | 1457 | ||
| 1470 | if (!is2t) | 1458 | if (!is2t) |
| 1471 | pathbound = 1; | 1459 | pathbound = 1; |
| 1472 | 1460 | ||
| 1461 | return; | ||
| 1462 | |||
| 1473 | for (index = 0; index < PATH_NUM; index++) { | 1463 | for (index = 0; index < PATH_NUM; index++) { |
| 1474 | apk_offset[index] = apk_normal_offset[index]; | 1464 | apk_offset[index] = apk_normal_offset[index]; |
| 1475 | apk_value[index] = apk_normal_value[index]; | 1465 | apk_value[index] = apk_normal_value[index]; |
| @@ -1730,8 +1720,7 @@ static void _rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, | |||
| 1730 | 0x08)); | 1720 | 0x08)); |
| 1731 | 1721 | ||
| 1732 | } | 1722 | } |
| 1733 | 1723 | rtlphy->b_apk_done = true; | |
| 1734 | rtlphy->apk_done = true; | ||
| 1735 | #endif | 1724 | #endif |
| 1736 | } | 1725 | } |
| 1737 | 1726 | ||
| @@ -1758,6 +1747,7 @@ static void _rtl92c_phy_set_rfpath_switch(struct ieee80211_hw *hw, | |||
| 1758 | rtl_set_bbreg(hw, RFPGA0_XA_RFINTERFACEOE, 0x300, 0x1); | 1747 | rtl_set_bbreg(hw, RFPGA0_XA_RFINTERFACEOE, 0x300, 0x1); |
| 1759 | 1748 | ||
| 1760 | } | 1749 | } |
| 1750 | |||
| 1761 | } | 1751 | } |
| 1762 | 1752 | ||
| 1763 | #undef IQK_ADDA_REG_NUM | 1753 | #undef IQK_ADDA_REG_NUM |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.h b/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.h index 53ffb0981586..9a264c0d6127 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.h +++ b/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.h | |||
| @@ -27,8 +27,8 @@ | |||
| 27 | * | 27 | * |
| 28 | *****************************************************************************/ | 28 | *****************************************************************************/ |
| 29 | 29 | ||
| 30 | #ifndef __RTL92C_PHY_H__ | 30 | #ifndef __RTL92C_PHY_COMMON_H__ |
| 31 | #define __RTL92C_PHY_H__ | 31 | #define __RTL92C_PHY_COMMON_H__ |
| 32 | 32 | ||
| 33 | #define MAX_PRECMD_CNT 16 | 33 | #define MAX_PRECMD_CNT 16 |
| 34 | #define MAX_RFDEPENDCMD_CNT 16 | 34 | #define MAX_RFDEPENDCMD_CNT 16 |
| @@ -39,6 +39,7 @@ | |||
| 39 | #define RT_CANNOT_IO(hw) false | 39 | #define RT_CANNOT_IO(hw) false |
| 40 | #define HIGHPOWER_RADIOA_ARRAYLEN 22 | 40 | #define HIGHPOWER_RADIOA_ARRAYLEN 22 |
| 41 | 41 | ||
| 42 | #define IQK_ADDA_REG_NUM 16 | ||
| 42 | #define MAX_TOLERANCE 5 | 43 | #define MAX_TOLERANCE 5 |
| 43 | #define IQK_DELAY_TIME 1 | 44 | #define IQK_DELAY_TIME 1 |
| 44 | 45 | ||
| @@ -56,6 +57,7 @@ | |||
| 56 | #define IQK_ADDA_REG_NUM 16 | 57 | #define IQK_ADDA_REG_NUM 16 |
| 57 | #define IQK_MAC_REG_NUM 4 | 58 | #define IQK_MAC_REG_NUM 4 |
| 58 | 59 | ||
| 60 | #define IQK_DELAY_TIME 1 | ||
| 59 | #define RF90_PATH_MAX 2 | 61 | #define RF90_PATH_MAX 2 |
| 60 | 62 | ||
| 61 | #define CT_OFFSET_MAC_ADDR 0X16 | 63 | #define CT_OFFSET_MAC_ADDR 0X16 |
| @@ -77,6 +79,7 @@ | |||
| 77 | 79 | ||
| 78 | #define RTL92C_MAX_PATH_NUM 2 | 80 | #define RTL92C_MAX_PATH_NUM 2 |
| 79 | #define LLT_LAST_ENTRY_OF_TX_PKT_BUFFER 255 | 81 | #define LLT_LAST_ENTRY_OF_TX_PKT_BUFFER 255 |
| 82 | |||
| 80 | enum swchnlcmd_id { | 83 | enum swchnlcmd_id { |
| 81 | CMDID_END, | 84 | CMDID_END, |
| 82 | CMDID_SET_TXPOWEROWER_LEVEL, | 85 | CMDID_SET_TXPOWEROWER_LEVEL, |
| @@ -184,45 +187,41 @@ struct tx_power_struct { | |||
| 184 | u32 mcs_original_offset[4][16]; | 187 | u32 mcs_original_offset[4][16]; |
| 185 | }; | 188 | }; |
| 186 | 189 | ||
| 187 | extern u32 rtl92c_phy_query_bb_reg(struct ieee80211_hw *hw, | 190 | u32 rtl92c_phy_query_bb_reg(struct ieee80211_hw *hw, |
| 188 | u32 regaddr, u32 bitmask); | 191 | u32 regaddr, u32 bitmask); |
| 189 | extern void rtl92c_phy_set_bb_reg(struct ieee80211_hw *hw, | 192 | void rtl92c_phy_set_bb_reg(struct ieee80211_hw *hw, |
| 190 | u32 regaddr, u32 bitmask, u32 data); | 193 | u32 regaddr, u32 bitmask, u32 data); |
| 191 | extern u32 rtl92c_phy_query_rf_reg(struct ieee80211_hw *hw, | 194 | u32 rtl92c_phy_query_rf_reg(struct ieee80211_hw *hw, |
| 192 | enum radio_path rfpath, u32 regaddr, | 195 | enum radio_path rfpath, u32 regaddr, |
| 193 | u32 bitmask); | 196 | u32 bitmask); |
| 194 | extern void rtl92c_phy_set_rf_reg(struct ieee80211_hw *hw, | 197 | bool rtl92c_phy_mac_config(struct ieee80211_hw *hw); |
| 195 | enum radio_path rfpath, u32 regaddr, | 198 | bool rtl92c_phy_bb_config(struct ieee80211_hw *hw); |
| 196 | u32 bitmask, u32 data); | 199 | bool rtl92c_phy_rf_config(struct ieee80211_hw *hw); |
| 197 | extern bool rtl92c_phy_mac_config(struct ieee80211_hw *hw); | 200 | bool rtl92c_phy_config_rf_with_feaderfile(struct ieee80211_hw *hw, |
| 198 | extern bool rtl92c_phy_bb_config(struct ieee80211_hw *hw); | ||
| 199 | extern bool rtl92c_phy_rf_config(struct ieee80211_hw *hw); | ||
| 200 | extern bool rtl92c_phy_config_rf_with_feaderfile(struct ieee80211_hw *hw, | ||
| 201 | enum radio_path rfpath); | 201 | enum radio_path rfpath); |
| 202 | extern void rtl92c_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw); | 202 | void rtl92c_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw); |
| 203 | extern void rtl92c_phy_get_txpower_level(struct ieee80211_hw *hw, | 203 | void rtl92c_phy_get_txpower_level(struct ieee80211_hw *hw, |
| 204 | long *powerlevel); | 204 | long *powerlevel); |
| 205 | extern void rtl92c_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel); | 205 | void rtl92c_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel); |
| 206 | extern bool rtl92c_phy_update_txpower_dbm(struct ieee80211_hw *hw, | 206 | bool rtl92c_phy_update_txpower_dbm(struct ieee80211_hw *hw, |
| 207 | long power_indbm); | 207 | long power_indbm); |
| 208 | extern void rtl92c_phy_scan_operation_backup(struct ieee80211_hw *hw, | 208 | void rtl92c_phy_scan_operation_backup(struct ieee80211_hw *hw, |
| 209 | u8 operation); | 209 | u8 operation); |
| 210 | extern void rtl92c_phy_set_bw_mode_callback(struct ieee80211_hw *hw); | 210 | void rtl92c_phy_set_bw_mode(struct ieee80211_hw *hw, |
| 211 | extern void rtl92c_phy_set_bw_mode(struct ieee80211_hw *hw, | ||
| 212 | enum nl80211_channel_type ch_type); | 211 | enum nl80211_channel_type ch_type); |
| 213 | extern void rtl92c_phy_sw_chnl_callback(struct ieee80211_hw *hw); | 212 | void rtl92c_phy_sw_chnl_callback(struct ieee80211_hw *hw); |
| 214 | extern u8 rtl92c_phy_sw_chnl(struct ieee80211_hw *hw); | 213 | u8 rtl92c_phy_sw_chnl(struct ieee80211_hw *hw); |
| 215 | extern void rtl92c_phy_iq_calibrate(struct ieee80211_hw *hw, bool b_recovery); | 214 | void rtl92c_phy_iq_calibrate(struct ieee80211_hw *hw, bool b_recovery); |
| 216 | extern void rtl92c_phy_set_beacon_hw_reg(struct ieee80211_hw *hw, | 215 | void rtl92c_phy_set_beacon_hw_reg(struct ieee80211_hw *hw, |
| 217 | u16 beaconinterval); | 216 | u16 beaconinterval); |
| 218 | void rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, char delta); | 217 | void rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, char delta); |
| 219 | void rtl92c_phy_lc_calibrate(struct ieee80211_hw *hw); | 218 | void rtl92c_phy_lc_calibrate(struct ieee80211_hw *hw); |
| 220 | void rtl92c_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain); | 219 | void rtl92c_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain); |
| 221 | bool rtl92c_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, | 220 | bool rtl92c_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, |
| 222 | enum radio_path rfpath); | 221 | enum radio_path rfpath); |
| 223 | extern bool rtl8192_phy_check_is_legal_rfpath(struct ieee80211_hw *hw, | 222 | bool rtl8192_phy_check_is_legal_rfpath(struct ieee80211_hw *hw, |
| 224 | u32 rfpath); | 223 | u32 rfpath); |
| 225 | extern bool rtl92c_phy_set_rf_power_state(struct ieee80211_hw *hw, | 224 | bool rtl92c_phy_set_rf_power_state(struct ieee80211_hw *hw, |
| 226 | enum rf_pwrstate rfpwr_state); | 225 | enum rf_pwrstate rfpwr_state); |
| 227 | void rtl92ce_phy_set_rf_on(struct ieee80211_hw *hw); | 226 | void rtl92ce_phy_set_rf_on(struct ieee80211_hw *hw); |
| 228 | void rtl92c_phy_set_io(struct ieee80211_hw *hw); | 227 | void rtl92c_phy_set_io(struct ieee80211_hw *hw); |
| @@ -235,12 +234,25 @@ u8 _rtl92c_phy_dbm_to_txpwr_Idx(struct ieee80211_hw *hw, | |||
| 235 | enum wireless_mode wirelessmode, | 234 | enum wireless_mode wirelessmode, |
| 236 | long power_indbm); | 235 | long power_indbm); |
| 237 | void _rtl92c_phy_init_bb_rf_register_definition(struct ieee80211_hw *hw); | 236 | void _rtl92c_phy_init_bb_rf_register_definition(struct ieee80211_hw *hw); |
| 238 | static bool _rtl92c_phy_set_sw_chnl_cmdarray(struct swchnlcmd *cmdtable, | 237 | void _rtl92c_phy_set_rf_sleep(struct ieee80211_hw *hw); |
| 239 | u32 cmdtableidx, u32 cmdtablesz, | 238 | bool _rtl92c_phy_sw_chnl_step_by_step(struct ieee80211_hw *hw, |
| 240 | enum swchnlcmd_id cmdid, u32 para1, | 239 | u8 channel, u8 *stage, u8 *step, |
| 241 | u32 para2, u32 msdelay); | 240 | u32 *delay); |
| 242 | static bool _rtl92c_phy_sw_chnl_step_by_step(struct ieee80211_hw *hw, | 241 | u8 rtl92c_bt_rssi_state_change(struct ieee80211_hw *hw); |
| 243 | u8 channel, u8 *stage, u8 *step, | 242 | u32 _rtl92c_phy_fw_rf_serial_read(struct ieee80211_hw *hw, |
| 244 | u32 *delay); | 243 | enum radio_path rfpath, u32 offset); |
| 244 | void _rtl92c_phy_fw_rf_serial_write(struct ieee80211_hw *hw, | ||
| 245 | enum radio_path rfpath, u32 offset, | ||
| 246 | u32 data); | ||
| 247 | u32 _rtl92c_phy_rf_serial_read(struct ieee80211_hw *hw, | ||
| 248 | enum radio_path rfpath, u32 offset); | ||
| 249 | void _rtl92c_phy_rf_serial_write(struct ieee80211_hw *hw, | ||
| 250 | enum radio_path rfpath, u32 offset, | ||
| 251 | u32 data); | ||
| 252 | bool _rtl92c_phy_bb8192c_config_parafile(struct ieee80211_hw *hw); | ||
| 253 | void _rtl92c_store_pwrIndex_diffrate_offset(struct ieee80211_hw *hw, | ||
| 254 | u32 regaddr, u32 bitmask, | ||
| 255 | u32 data); | ||
| 256 | bool rtl92c_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype); | ||
| 245 | 257 | ||
| 246 | #endif | 258 | #endif |
