aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rtlwifi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/rtlwifi')
-rw-r--r--drivers/net/wireless/rtlwifi/base.c29
-rw-r--r--drivers/net/wireless/rtlwifi/base.h2
-rw-r--r--drivers/net/wireless/rtlwifi/cam.h10
-rw-r--r--drivers/net/wireless/rtlwifi/core.c10
-rw-r--r--drivers/net/wireless/rtlwifi/efuse.c18
-rw-r--r--drivers/net/wireless/rtlwifi/efuse.h29
-rw-r--r--drivers/net/wireless/rtlwifi/pci.c4
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8188ee/hw.c1
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8188ee/phy.c28
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8188ee/phy.h52
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8188ee/sw.c3
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8188ee/trx.c1
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c25
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c30
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192c/phy_common.h4
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/def.h2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/phy.h52
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/reg.h20
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/rf.h13
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/sw.c3
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192ce/trx.c1
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/mac.c187
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/rf.h13
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/sw.c3
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192cu/trx.c2
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192de/dm.c8
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192de/hw.c18
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192de/hw.h7
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192de/phy.c28
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192de/phy.h49
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192de/rf.h18
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192de/sw.c3
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192de/trx.c1
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/reg.h5
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8192se/trx.c1
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8723ae/phy.c29
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8723ae/phy.h62
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8723ae/rf.h13
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8723ae/sw.c3
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8723ae/trx.c1
-rw-r--r--drivers/net/wireless/rtlwifi/usb.c6
-rw-r--r--drivers/net/wireless/rtlwifi/wifi.h2
42 files changed, 212 insertions, 584 deletions
diff --git a/drivers/net/wireless/rtlwifi/base.c b/drivers/net/wireless/rtlwifi/base.c
index 8bb4a9a01a18..9a78e3daf742 100644
--- a/drivers/net/wireless/rtlwifi/base.c
+++ b/drivers/net/wireless/rtlwifi/base.c
@@ -1613,6 +1613,35 @@ err_free:
1613} 1613}
1614EXPORT_SYMBOL(rtl_send_smps_action); 1614EXPORT_SYMBOL(rtl_send_smps_action);
1615 1615
1616void rtl_phy_scan_operation_backup(struct ieee80211_hw *hw, u8 operation)
1617{
1618 struct rtl_priv *rtlpriv = rtl_priv(hw);
1619 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
1620 enum io_type iotype;
1621
1622 if (!is_hal_stop(rtlhal)) {
1623 switch (operation) {
1624 case SCAN_OPT_BACKUP:
1625 iotype = IO_CMD_PAUSE_DM_BY_SCAN;
1626 rtlpriv->cfg->ops->set_hw_reg(hw,
1627 HW_VAR_IO_CMD,
1628 (u8 *)&iotype);
1629 break;
1630 case SCAN_OPT_RESTORE:
1631 iotype = IO_CMD_RESUME_DM_BY_SCAN;
1632 rtlpriv->cfg->ops->set_hw_reg(hw,
1633 HW_VAR_IO_CMD,
1634 (u8 *)&iotype);
1635 break;
1636 default:
1637 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
1638 "Unknown Scan Backup operation.\n");
1639 break;
1640 }
1641 }
1642}
1643EXPORT_SYMBOL(rtl_phy_scan_operation_backup);
1644
1616/* There seem to be issues in mac80211 regarding when del ba frames can be 1645/* There seem to be issues in mac80211 regarding when del ba frames can be
1617 * received. As a work around, we make a fake del_ba if we receive a ba_req; 1646 * received. As a work around, we make a fake del_ba if we receive a ba_req;
1618 * however, rx_agg was opened to let mac80211 release some ba related 1647 * however, rx_agg was opened to let mac80211 release some ba related
diff --git a/drivers/net/wireless/rtlwifi/base.h b/drivers/net/wireless/rtlwifi/base.h
index 0e5fe0902daf..0cd07420777a 100644
--- a/drivers/net/wireless/rtlwifi/base.h
+++ b/drivers/net/wireless/rtlwifi/base.h
@@ -114,7 +114,6 @@ void rtl_init_rfkill(struct ieee80211_hw *hw);
114void rtl_deinit_rfkill(struct ieee80211_hw *hw); 114void rtl_deinit_rfkill(struct ieee80211_hw *hw);
115 115
116void rtl_beacon_statistic(struct ieee80211_hw *hw, struct sk_buff *skb); 116void rtl_beacon_statistic(struct ieee80211_hw *hw, struct sk_buff *skb);
117void rtl_watch_dog_timer_callback(unsigned long data);
118void rtl_deinit_deferred_work(struct ieee80211_hw *hw); 117void rtl_deinit_deferred_work(struct ieee80211_hw *hw);
119 118
120bool rtl_action_proc(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx); 119bool rtl_action_proc(struct ieee80211_hw *hw, struct sk_buff *skb, u8 is_tx);
@@ -153,5 +152,6 @@ int rtlwifi_rate_mapping(struct ieee80211_hw *hw,
153bool rtl_tx_mgmt_proc(struct ieee80211_hw *hw, struct sk_buff *skb); 152bool rtl_tx_mgmt_proc(struct ieee80211_hw *hw, struct sk_buff *skb);
154struct sk_buff *rtl_make_del_ba(struct ieee80211_hw *hw, 153struct sk_buff *rtl_make_del_ba(struct ieee80211_hw *hw,
155 u8 *sa, u8 *bssid, u16 tid); 154 u8 *sa, u8 *bssid, u16 tid);
155void rtl_phy_scan_operation_backup(struct ieee80211_hw *hw, u8 operation);
156 156
157#endif 157#endif
diff --git a/drivers/net/wireless/rtlwifi/cam.h b/drivers/net/wireless/rtlwifi/cam.h
index 35e00086a520..0105e6c1901e 100644
--- a/drivers/net/wireless/rtlwifi/cam.h
+++ b/drivers/net/wireless/rtlwifi/cam.h
@@ -41,12 +41,12 @@
41#define CAM_CONFIG_USEDK 1 41#define CAM_CONFIG_USEDK 1
42#define CAM_CONFIG_NO_USEDK 0 42#define CAM_CONFIG_NO_USEDK 0
43 43
44extern void rtl_cam_reset_all_entry(struct ieee80211_hw *hw); 44void rtl_cam_reset_all_entry(struct ieee80211_hw *hw);
45extern u8 rtl_cam_add_one_entry(struct ieee80211_hw *hw, u8 *mac_addr, 45u8 rtl_cam_add_one_entry(struct ieee80211_hw *hw, u8 *mac_addr,
46 u32 ul_key_id, u32 ul_entry_idx, u32 ul_enc_alg, 46 u32 ul_key_id, u32 ul_entry_idx, u32 ul_enc_alg,
47 u32 ul_default_key, u8 *key_content); 47 u32 ul_default_key, u8 *key_content);
48int rtl_cam_delete_one_entry(struct ieee80211_hw *hw, u8 *mac_addr, 48int rtl_cam_delete_one_entry(struct ieee80211_hw *hw, u8 *mac_addr,
49 u32 ul_key_id); 49 u32 ul_key_id);
50void rtl_cam_mark_invalid(struct ieee80211_hw *hw, u8 uc_index); 50void rtl_cam_mark_invalid(struct ieee80211_hw *hw, u8 uc_index);
51void rtl_cam_empty_entry(struct ieee80211_hw *hw, u8 uc_index); 51void rtl_cam_empty_entry(struct ieee80211_hw *hw, u8 uc_index);
52void rtl_cam_reset_sec_info(struct ieee80211_hw *hw); 52void rtl_cam_reset_sec_info(struct ieee80211_hw *hw);
diff --git a/drivers/net/wireless/rtlwifi/core.c b/drivers/net/wireless/rtlwifi/core.c
index 733b7ce7f0e2..210ce7cd94d8 100644
--- a/drivers/net/wireless/rtlwifi/core.c
+++ b/drivers/net/wireless/rtlwifi/core.c
@@ -115,7 +115,7 @@ static void rtl_op_stop(struct ieee80211_hw *hw)
115 mutex_lock(&rtlpriv->locks.conf_mutex); 115 mutex_lock(&rtlpriv->locks.conf_mutex);
116 116
117 mac->link_state = MAC80211_NOLINK; 117 mac->link_state = MAC80211_NOLINK;
118 memset(mac->bssid, 0, 6); 118 memset(mac->bssid, 0, ETH_ALEN);
119 mac->vendor = PEER_UNKNOWN; 119 mac->vendor = PEER_UNKNOWN;
120 120
121 /*reset sec info */ 121 /*reset sec info */
@@ -280,7 +280,7 @@ static void rtl_op_remove_interface(struct ieee80211_hw *hw,
280 mac->p2p = 0; 280 mac->p2p = 0;
281 mac->vif = NULL; 281 mac->vif = NULL;
282 mac->link_state = MAC80211_NOLINK; 282 mac->link_state = MAC80211_NOLINK;
283 memset(mac->bssid, 0, 6); 283 memset(mac->bssid, 0, ETH_ALEN);
284 mac->vendor = PEER_UNKNOWN; 284 mac->vendor = PEER_UNKNOWN;
285 mac->opmode = NL80211_IFTYPE_UNSPECIFIED; 285 mac->opmode = NL80211_IFTYPE_UNSPECIFIED;
286 rtlpriv->cfg->ops->set_network_type(hw, mac->opmode); 286 rtlpriv->cfg->ops->set_network_type(hw, mac->opmode);
@@ -721,7 +721,7 @@ static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
721 mac->link_state = MAC80211_LINKED; 721 mac->link_state = MAC80211_LINKED;
722 mac->cnt_after_linked = 0; 722 mac->cnt_after_linked = 0;
723 mac->assoc_id = bss_conf->aid; 723 mac->assoc_id = bss_conf->aid;
724 memcpy(mac->bssid, bss_conf->bssid, 6); 724 memcpy(mac->bssid, bss_conf->bssid, ETH_ALEN);
725 725
726 if (rtlpriv->cfg->ops->linked_set_reg) 726 if (rtlpriv->cfg->ops->linked_set_reg)
727 rtlpriv->cfg->ops->linked_set_reg(hw); 727 rtlpriv->cfg->ops->linked_set_reg(hw);
@@ -750,7 +750,7 @@ static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
750 if (ppsc->p2p_ps_info.p2p_ps_mode > P2P_PS_NONE) 750 if (ppsc->p2p_ps_info.p2p_ps_mode > P2P_PS_NONE)
751 rtl_p2p_ps_cmd(hw, P2P_PS_DISABLE); 751 rtl_p2p_ps_cmd(hw, P2P_PS_DISABLE);
752 mac->link_state = MAC80211_NOLINK; 752 mac->link_state = MAC80211_NOLINK;
753 memset(mac->bssid, 0, 6); 753 memset(mac->bssid, 0, ETH_ALEN);
754 mac->vendor = PEER_UNKNOWN; 754 mac->vendor = PEER_UNKNOWN;
755 755
756 if (rtlpriv->dm.supp_phymode_switch) { 756 if (rtlpriv->dm.supp_phymode_switch) {
@@ -826,7 +826,7 @@ static void rtl_op_bss_info_changed(struct ieee80211_hw *hw,
826 bss_conf->bssid); 826 bss_conf->bssid);
827 827
828 mac->vendor = PEER_UNKNOWN; 828 mac->vendor = PEER_UNKNOWN;
829 memcpy(mac->bssid, bss_conf->bssid, 6); 829 memcpy(mac->bssid, bss_conf->bssid, ETH_ALEN);
830 rtlpriv->cfg->ops->set_network_type(hw, vif->type); 830 rtlpriv->cfg->ops->set_network_type(hw, vif->type);
831 831
832 rcu_read_lock(); 832 rcu_read_lock();
diff --git a/drivers/net/wireless/rtlwifi/efuse.c b/drivers/net/wireless/rtlwifi/efuse.c
index 838a1ed3f194..ae13fb94b2e8 100644
--- a/drivers/net/wireless/rtlwifi/efuse.c
+++ b/drivers/net/wireless/rtlwifi/efuse.c
@@ -1203,20 +1203,18 @@ static void efuse_power_switch(struct ieee80211_hw *hw, u8 write, u8 pwrstate)
1203 1203
1204static u16 efuse_get_current_size(struct ieee80211_hw *hw) 1204static u16 efuse_get_current_size(struct ieee80211_hw *hw)
1205{ 1205{
1206 int continual = true;
1207 u16 efuse_addr = 0; 1206 u16 efuse_addr = 0;
1208 u8 hworden; 1207 u8 hworden;
1209 u8 efuse_data, word_cnts; 1208 u8 efuse_data, word_cnts;
1210 1209
1211 while (continual && efuse_one_byte_read(hw, efuse_addr, &efuse_data) 1210 while (efuse_one_byte_read(hw, efuse_addr, &efuse_data) &&
1212 && (efuse_addr < EFUSE_MAX_SIZE)) { 1211 efuse_addr < EFUSE_MAX_SIZE) {
1213 if (efuse_data != 0xFF) { 1212 if (efuse_data == 0xFF)
1214 hworden = efuse_data & 0x0F; 1213 break;
1215 word_cnts = efuse_calculate_word_cnts(hworden); 1214
1216 efuse_addr = efuse_addr + (word_cnts * 2) + 1; 1215 hworden = efuse_data & 0x0F;
1217 } else { 1216 word_cnts = efuse_calculate_word_cnts(hworden);
1218 continual = false; 1217 efuse_addr = efuse_addr + (word_cnts * 2) + 1;
1219 }
1220 } 1218 }
1221 1219
1222 return efuse_addr; 1220 return efuse_addr;
diff --git a/drivers/net/wireless/rtlwifi/efuse.h b/drivers/net/wireless/rtlwifi/efuse.h
index 395a326acfb4..1663b3afd41e 100644
--- a/drivers/net/wireless/rtlwifi/efuse.h
+++ b/drivers/net/wireless/rtlwifi/efuse.h
@@ -104,20 +104,19 @@ struct efuse_priv {
104 u8 tx_power_g[14]; 104 u8 tx_power_g[14];
105}; 105};
106 106
107extern void read_efuse_byte(struct ieee80211_hw *hw, u16 _offset, u8 *pbuf); 107void read_efuse_byte(struct ieee80211_hw *hw, u16 _offset, u8 *pbuf);
108extern void efuse_initialize(struct ieee80211_hw *hw); 108void efuse_initialize(struct ieee80211_hw *hw);
109extern u8 efuse_read_1byte(struct ieee80211_hw *hw, u16 address); 109u8 efuse_read_1byte(struct ieee80211_hw *hw, u16 address);
110extern void efuse_write_1byte(struct ieee80211_hw *hw, u16 address, u8 value); 110void efuse_write_1byte(struct ieee80211_hw *hw, u16 address, u8 value);
111extern void read_efuse(struct ieee80211_hw *hw, u16 _offset, 111void read_efuse(struct ieee80211_hw *hw, u16 _offset, u16 _size_byte, u8 *pbuf);
112 u16 _size_byte, u8 *pbuf); 112void efuse_shadow_read(struct ieee80211_hw *hw, u8 type, u16 offset,
113extern void efuse_shadow_read(struct ieee80211_hw *hw, u8 type, 113 u32 *value);
114 u16 offset, u32 *value); 114void efuse_shadow_write(struct ieee80211_hw *hw, u8 type, u16 offset,
115extern void efuse_shadow_write(struct ieee80211_hw *hw, u8 type, 115 u32 value);
116 u16 offset, u32 value); 116bool efuse_shadow_update(struct ieee80211_hw *hw);
117extern bool efuse_shadow_update(struct ieee80211_hw *hw); 117bool efuse_shadow_update_chk(struct ieee80211_hw *hw);
118extern bool efuse_shadow_update_chk(struct ieee80211_hw *hw); 118void rtl_efuse_shadow_map_update(struct ieee80211_hw *hw);
119extern void rtl_efuse_shadow_map_update(struct ieee80211_hw *hw); 119void efuse_force_write_vendor_Id(struct ieee80211_hw *hw);
120extern void efuse_force_write_vendor_Id(struct ieee80211_hw *hw); 120void efuse_re_pg_section(struct ieee80211_hw *hw, u8 section_idx);
121extern void efuse_re_pg_section(struct ieee80211_hw *hw, u8 section_idx);
122 121
123#endif 122#endif
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c
index 703f839af6ca..0f494444bcd1 100644
--- a/drivers/net/wireless/rtlwifi/pci.c
+++ b/drivers/net/wireless/rtlwifi/pci.c
@@ -736,7 +736,6 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
736 736
737 struct rtl_stats stats = { 737 struct rtl_stats stats = {
738 .signal = 0, 738 .signal = 0,
739 .noise = -98,
740 .rate = 0, 739 .rate = 0,
741 }; 740 };
742 int index = rtlpci->rx_ring[rx_queue_idx].idx; 741 int index = rtlpci->rx_ring[rx_queue_idx].idx;
@@ -2009,7 +2008,6 @@ fail2:
2009fail1: 2008fail1:
2010 if (hw) 2009 if (hw)
2011 ieee80211_free_hw(hw); 2010 ieee80211_free_hw(hw);
2012 pci_set_drvdata(pdev, NULL);
2013 pci_disable_device(pdev); 2011 pci_disable_device(pdev);
2014 2012
2015 return err; 2013 return err;
@@ -2064,8 +2062,6 @@ void rtl_pci_disconnect(struct pci_dev *pdev)
2064 2062
2065 rtl_pci_disable_aspm(hw); 2063 rtl_pci_disable_aspm(hw);
2066 2064
2067 pci_set_drvdata(pdev, NULL);
2068
2069 ieee80211_free_hw(hw); 2065 ieee80211_free_hw(hw);
2070} 2066}
2071EXPORT_SYMBOL(rtl_pci_disconnect); 2067EXPORT_SYMBOL(rtl_pci_disconnect);
diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/hw.c b/drivers/net/wireless/rtlwifi/rtl8188ee/hw.c
index b68cae3024fc..e06971be7df7 100644
--- a/drivers/net/wireless/rtlwifi/rtl8188ee/hw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8188ee/hw.c
@@ -143,6 +143,7 @@ static void _rtl88ee_set_fw_clock_on(struct ieee80211_hw *hw,
143 } else { 143 } else {
144 rtlhal->fw_clk_change_in_progress = false; 144 rtlhal->fw_clk_change_in_progress = false;
145 spin_unlock_bh(&rtlpriv->locks.fw_ps_lock); 145 spin_unlock_bh(&rtlpriv->locks.fw_ps_lock);
146 break;
146 } 147 }
147 } 148 }
148 149
diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/phy.c b/drivers/net/wireless/rtlwifi/rtl8188ee/phy.c
index e655c0473225..d67f9c731cc4 100644
--- a/drivers/net/wireless/rtlwifi/rtl8188ee/phy.c
+++ b/drivers/net/wireless/rtlwifi/rtl8188ee/phy.c
@@ -1136,34 +1136,6 @@ void rtl88e_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel)
1136 &bw40_pwr[0], channel); 1136 &bw40_pwr[0], channel);
1137} 1137}
1138 1138
1139void rtl88e_phy_scan_operation_backup(struct ieee80211_hw *hw, u8 operation)
1140{
1141 struct rtl_priv *rtlpriv = rtl_priv(hw);
1142 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
1143 enum io_type iotype;
1144
1145 if (!is_hal_stop(rtlhal)) {
1146 switch (operation) {
1147 case SCAN_OPT_BACKUP:
1148 iotype = IO_CMD_PAUSE_DM_BY_SCAN;
1149 rtlpriv->cfg->ops->set_hw_reg(hw,
1150 HW_VAR_IO_CMD,
1151 (u8 *)&iotype);
1152 break;
1153 case SCAN_OPT_RESTORE:
1154 iotype = IO_CMD_RESUME_DM_BY_SCAN;
1155 rtlpriv->cfg->ops->set_hw_reg(hw,
1156 HW_VAR_IO_CMD,
1157 (u8 *)&iotype);
1158 break;
1159 default:
1160 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
1161 "Unknown Scan Backup operation.\n");
1162 break;
1163 }
1164 }
1165}
1166
1167void rtl88e_phy_set_bw_mode_callback(struct ieee80211_hw *hw) 1139void rtl88e_phy_set_bw_mode_callback(struct ieee80211_hw *hw)
1168{ 1140{
1169 struct rtl_priv *rtlpriv = rtl_priv(hw); 1141 struct rtl_priv *rtlpriv = rtl_priv(hw);
diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/phy.h b/drivers/net/wireless/rtlwifi/rtl8188ee/phy.h
index f1acd6d27e44..89f0f1ef1465 100644
--- a/drivers/net/wireless/rtlwifi/rtl8188ee/phy.h
+++ b/drivers/net/wireless/rtlwifi/rtl8188ee/phy.h
@@ -200,37 +200,35 @@ enum _ANT_DIV_TYPE {
200 CGCS_RX_SW_ANTDIV = 0x05, 200 CGCS_RX_SW_ANTDIV = 0x05,
201}; 201};
202 202
203extern u32 rtl88e_phy_query_bb_reg(struct ieee80211_hw *hw, 203u32 rtl88e_phy_query_bb_reg(struct ieee80211_hw *hw,
204 u32 regaddr, u32 bitmask); 204 u32 regaddr, u32 bitmask);
205extern void rtl88e_phy_set_bb_reg(struct ieee80211_hw *hw, 205void rtl88e_phy_set_bb_reg(struct ieee80211_hw *hw,
206 u32 regaddr, u32 bitmask, u32 data); 206 u32 regaddr, u32 bitmask, u32 data);
207extern u32 rtl88e_phy_query_rf_reg(struct ieee80211_hw *hw, 207u32 rtl88e_phy_query_rf_reg(struct ieee80211_hw *hw,
208 enum radio_path rfpath, u32 regaddr, 208 enum radio_path rfpath, u32 regaddr,
209 u32 bitmask); 209 u32 bitmask);
210extern void rtl88e_phy_set_rf_reg(struct ieee80211_hw *hw, 210void rtl88e_phy_set_rf_reg(struct ieee80211_hw *hw,
211 enum radio_path rfpath, u32 regaddr, 211 enum radio_path rfpath, u32 regaddr,
212 u32 bitmask, u32 data); 212 u32 bitmask, u32 data);
213extern bool rtl88e_phy_mac_config(struct ieee80211_hw *hw); 213bool rtl88e_phy_mac_config(struct ieee80211_hw *hw);
214extern bool rtl88e_phy_bb_config(struct ieee80211_hw *hw); 214bool rtl88e_phy_bb_config(struct ieee80211_hw *hw);
215extern bool rtl88e_phy_rf_config(struct ieee80211_hw *hw); 215bool rtl88e_phy_rf_config(struct ieee80211_hw *hw);
216extern void rtl88e_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw); 216void rtl88e_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw);
217extern void rtl88e_phy_get_txpower_level(struct ieee80211_hw *hw, 217void rtl88e_phy_get_txpower_level(struct ieee80211_hw *hw,
218 long *powerlevel); 218 long *powerlevel);
219extern void rtl88e_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel); 219void rtl88e_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel);
220extern void rtl88e_phy_scan_operation_backup(struct ieee80211_hw *hw, 220void rtl88e_phy_set_bw_mode_callback(struct ieee80211_hw *hw);
221 u8 operation); 221void rtl88e_phy_set_bw_mode(struct ieee80211_hw *hw,
222extern void rtl88e_phy_set_bw_mode_callback(struct ieee80211_hw *hw); 222 enum nl80211_channel_type ch_type);
223extern void rtl88e_phy_set_bw_mode(struct ieee80211_hw *hw, 223void rtl88e_phy_sw_chnl_callback(struct ieee80211_hw *hw);
224 enum nl80211_channel_type ch_type); 224u8 rtl88e_phy_sw_chnl(struct ieee80211_hw *hw);
225extern void rtl88e_phy_sw_chnl_callback(struct ieee80211_hw *hw); 225void rtl88e_phy_iq_calibrate(struct ieee80211_hw *hw, bool b_recovery);
226extern u8 rtl88e_phy_sw_chnl(struct ieee80211_hw *hw);
227extern void rtl88e_phy_iq_calibrate(struct ieee80211_hw *hw, bool b_recovery);
228void rtl88e_phy_lc_calibrate(struct ieee80211_hw *hw); 226void rtl88e_phy_lc_calibrate(struct ieee80211_hw *hw);
229void rtl88e_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain); 227void rtl88e_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain);
230bool rtl88e_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, 228bool rtl88e_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
231 enum radio_path rfpath); 229 enum radio_path rfpath);
232bool rtl88e_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype); 230bool rtl88e_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype);
233extern bool rtl88e_phy_set_rf_power_state(struct ieee80211_hw *hw, 231bool rtl88e_phy_set_rf_power_state(struct ieee80211_hw *hw,
234 enum rf_pwrstate rfpwr_state); 232 enum rf_pwrstate rfpwr_state);
235 233
236#endif 234#endif
diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/sw.c b/drivers/net/wireless/rtlwifi/rtl8188ee/sw.c
index c254693a1e6a..347af1e4f438 100644
--- a/drivers/net/wireless/rtlwifi/rtl8188ee/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8188ee/sw.c
@@ -30,6 +30,7 @@
30#include "../wifi.h" 30#include "../wifi.h"
31#include "../core.h" 31#include "../core.h"
32#include "../pci.h" 32#include "../pci.h"
33#include "../base.h"
33#include "reg.h" 34#include "reg.h"
34#include "def.h" 35#include "def.h"
35#include "phy.h" 36#include "phy.h"
@@ -244,7 +245,7 @@ static struct rtl_hal_ops rtl8188ee_hal_ops = {
244 .set_bw_mode = rtl88e_phy_set_bw_mode, 245 .set_bw_mode = rtl88e_phy_set_bw_mode,
245 .switch_channel = rtl88e_phy_sw_chnl, 246 .switch_channel = rtl88e_phy_sw_chnl,
246 .dm_watchdog = rtl88e_dm_watchdog, 247 .dm_watchdog = rtl88e_dm_watchdog,
247 .scan_operation_backup = rtl88e_phy_scan_operation_backup, 248 .scan_operation_backup = rtl_phy_scan_operation_backup,
248 .set_rf_power_state = rtl88e_phy_set_rf_power_state, 249 .set_rf_power_state = rtl88e_phy_set_rf_power_state,
249 .led_control = rtl88ee_led_control, 250 .led_control = rtl88ee_led_control,
250 .set_desc = rtl88ee_set_desc, 251 .set_desc = rtl88ee_set_desc,
diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/trx.c b/drivers/net/wireless/rtlwifi/rtl8188ee/trx.c
index 68685a898257..aece6c9cccf1 100644
--- a/drivers/net/wireless/rtlwifi/rtl8188ee/trx.c
+++ b/drivers/net/wireless/rtlwifi/rtl8188ee/trx.c
@@ -478,7 +478,6 @@ bool rtl88ee_rx_query_desc(struct ieee80211_hw *hw,
478 478
479 /*rx_status->qual = status->signal; */ 479 /*rx_status->qual = status->signal; */
480 rx_status->signal = status->recvsignalpower + 10; 480 rx_status->signal = status->recvsignalpower + 10;
481 /*rx_status->noise = -status->noise; */
482 if (status->packet_report_type == TX_REPORT2) { 481 if (status->packet_report_type == TX_REPORT2) {
483 status->macid_valid_entry[0] = 482 status->macid_valid_entry[0] =
484 GET_RX_RPT2_DESC_MACID_VALID_1(pdesc); 483 GET_RX_RPT2_DESC_MACID_VALID_1(pdesc);
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c
index d2d57a27a7c1..e9caa5d4cff0 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c
@@ -541,29 +541,6 @@ EXPORT_SYMBOL(rtl92c_dm_write_dig);
541 541
542static void rtl92c_dm_pwdb_monitor(struct ieee80211_hw *hw) 542static void rtl92c_dm_pwdb_monitor(struct ieee80211_hw *hw)
543{ 543{
544 struct rtl_priv *rtlpriv = rtl_priv(hw);
545 long tmpentry_max_pwdb = 0, tmpentry_min_pwdb = 0xff;
546
547 u8 h2c_parameter[3] = { 0 };
548
549 return;
550
551 if (tmpentry_max_pwdb != 0) {
552 rtlpriv->dm.entry_max_undec_sm_pwdb = tmpentry_max_pwdb;
553 } else {
554 rtlpriv->dm.entry_max_undec_sm_pwdb = 0;
555 }
556
557 if (tmpentry_min_pwdb != 0xff) {
558 rtlpriv->dm.entry_min_undec_sm_pwdb = tmpentry_min_pwdb;
559 } else {
560 rtlpriv->dm.entry_min_undec_sm_pwdb = 0;
561 }
562
563 h2c_parameter[2] = (u8) (rtlpriv->dm.undec_sm_pwdb & 0xFF);
564 h2c_parameter[0] = 0;
565
566 rtl92c_fill_h2c_cmd(hw, H2C_RSSI_REPORT, 3, h2c_parameter);
567} 544}
568 545
569void rtl92c_dm_init_edca_turbo(struct ieee80211_hw *hw) 546void rtl92c_dm_init_edca_turbo(struct ieee80211_hw *hw)
@@ -673,7 +650,7 @@ static void rtl92c_dm_txpower_tracking_callback_thermalmeter(struct ieee80211_hw
673 s8 cck_index = 0; 650 s8 cck_index = 0;
674 int i; 651 int i;
675 bool is2t = IS_92C_SERIAL(rtlhal->version); 652 bool is2t = IS_92C_SERIAL(rtlhal->version);
676 s8 txpwr_level[2] = {0, 0}; 653 s8 txpwr_level[3] = {0, 0, 0};
677 u8 ofdm_min_index = 6, rf; 654 u8 ofdm_min_index = 6, rf;
678 655
679 rtlpriv->dm.txpower_trackinginit = true; 656 rtlpriv->dm.txpower_trackinginit = true;
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c
index 246e5352f2e1..0c0e78263a66 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c
@@ -592,36 +592,6 @@ long _rtl92c_phy_txpwr_idx_to_dbm(struct ieee80211_hw *hw,
592} 592}
593EXPORT_SYMBOL(_rtl92c_phy_txpwr_idx_to_dbm); 593EXPORT_SYMBOL(_rtl92c_phy_txpwr_idx_to_dbm);
594 594
595void rtl92c_phy_scan_operation_backup(struct ieee80211_hw *hw, u8 operation)
596{
597 struct rtl_priv *rtlpriv = rtl_priv(hw);
598 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
599 enum io_type iotype;
600
601 if (!is_hal_stop(rtlhal)) {
602 switch (operation) {
603 case SCAN_OPT_BACKUP:
604 iotype = IO_CMD_PAUSE_DM_BY_SCAN;
605 rtlpriv->cfg->ops->set_hw_reg(hw,
606 HW_VAR_IO_CMD,
607 (u8 *)&iotype);
608
609 break;
610 case SCAN_OPT_RESTORE:
611 iotype = IO_CMD_RESUME_DM_BY_SCAN;
612 rtlpriv->cfg->ops->set_hw_reg(hw,
613 HW_VAR_IO_CMD,
614 (u8 *)&iotype);
615 break;
616 default:
617 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
618 "Unknown Scan Backup operation\n");
619 break;
620 }
621 }
622}
623EXPORT_SYMBOL(rtl92c_phy_scan_operation_backup);
624
625void rtl92c_phy_set_bw_mode(struct ieee80211_hw *hw, 595void rtl92c_phy_set_bw_mode(struct ieee80211_hw *hw,
626 enum nl80211_channel_type ch_type) 596 enum nl80211_channel_type ch_type)
627{ 597{
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.h b/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.h
index cec10d696492..e79dabe9ba1d 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.h
@@ -39,9 +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
43#define MAX_TOLERANCE 5 42#define MAX_TOLERANCE 5
44#define IQK_DELAY_TIME 1
45 43
46#define APK_BB_REG_NUM 5 44#define APK_BB_REG_NUM 5
47#define APK_AFE_REG_NUM 16 45#define APK_AFE_REG_NUM 16
@@ -205,8 +203,6 @@ void rtl92c_phy_get_txpower_level(struct ieee80211_hw *hw,
205void rtl92c_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel); 203void rtl92c_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel);
206bool rtl92c_phy_update_txpower_dbm(struct ieee80211_hw *hw, 204bool rtl92c_phy_update_txpower_dbm(struct ieee80211_hw *hw,
207 long power_indbm); 205 long power_indbm);
208void rtl92c_phy_scan_operation_backup(struct ieee80211_hw *hw,
209 u8 operation);
210void rtl92c_phy_set_bw_mode(struct ieee80211_hw *hw, 206void rtl92c_phy_set_bw_mode(struct ieee80211_hw *hw,
211 enum nl80211_channel_type ch_type); 207 enum nl80211_channel_type ch_type);
212void rtl92c_phy_sw_chnl_callback(struct ieee80211_hw *hw); 208void rtl92c_phy_sw_chnl_callback(struct ieee80211_hw *hw);
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/def.h b/drivers/net/wireless/rtlwifi/rtl8192ce/def.h
index 3cfa1bb0f476..fa24de43ce79 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/def.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/def.h
@@ -152,8 +152,6 @@ enum version_8192c {
152#define IS_VENDOR_UMC_A_CUT(version) ((IS_CHIP_VENDOR_UMC(version)) ? \ 152#define IS_VENDOR_UMC_A_CUT(version) ((IS_CHIP_VENDOR_UMC(version)) ? \
153 ((GET_CVID_CUT_VERSION(version)) ? false : true) : false) 153 ((GET_CVID_CUT_VERSION(version)) ? false : true) : false)
154#define IS_CHIP_VER_B(version) ((version & CHIP_VER_B) ? true : false) 154#define IS_CHIP_VER_B(version) ((version & CHIP_VER_B) ? true : false)
155#define IS_VENDOR_UMC_A_CUT(version) ((IS_CHIP_VENDOR_UMC(version)) ? \
156 ((GET_CVID_CUT_VERSION(version)) ? false : true) : false)
157#define IS_92C_SERIAL(version) ((version & CHIP_92C_BITMASK) ? true : false) 155#define IS_92C_SERIAL(version) ((version & CHIP_92C_BITMASK) ? true : false)
158#define IS_CHIP_VENDOR_UMC(version) \ 156#define IS_CHIP_VENDOR_UMC(version) \
159 ((version & CHIP_VENDOR_UMC) ? true : false) 157 ((version & CHIP_VENDOR_UMC) ? true : false)
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/phy.h b/drivers/net/wireless/rtlwifi/rtl8192ce/phy.h
index d5e3b704f930..94486cca4000 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/phy.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/phy.h
@@ -39,9 +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
43#define MAX_TOLERANCE 5 42#define MAX_TOLERANCE 5
44#define IQK_DELAY_TIME 1
45 43
46#define APK_BB_REG_NUM 5 44#define APK_BB_REG_NUM 5
47#define APK_AFE_REG_NUM 16 45#define APK_AFE_REG_NUM 16
@@ -188,36 +186,29 @@ struct tx_power_struct {
188}; 186};
189 187
190bool rtl92c_phy_bb_config(struct ieee80211_hw *hw); 188bool rtl92c_phy_bb_config(struct ieee80211_hw *hw);
191u32 rtl92c_phy_query_bb_reg(struct ieee80211_hw *hw, 189u32 rtl92c_phy_query_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask);
192 u32 regaddr, u32 bitmask); 190void rtl92c_phy_set_bb_reg(struct ieee80211_hw *hw, u32 regaddr, u32 bitmask,
193void rtl92c_phy_set_bb_reg(struct ieee80211_hw *hw, 191 u32 data);
194 u32 regaddr, u32 bitmask, u32 data); 192u32 rtl92c_phy_query_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath,
195u32 rtl92c_phy_query_rf_reg(struct ieee80211_hw *hw, 193 u32 regaddr, u32 bitmask);
196 enum radio_path rfpath, u32 regaddr, 194void rtl92ce_phy_set_rf_reg(struct ieee80211_hw *hw, enum radio_path rfpath,
197 u32 bitmask); 195 u32 regaddr, u32 bitmask, u32 data);
198extern void rtl92ce_phy_set_rf_reg(struct ieee80211_hw *hw,
199 enum radio_path rfpath, u32 regaddr,
200 u32 bitmask, u32 data);
201bool rtl92c_phy_mac_config(struct ieee80211_hw *hw); 196bool rtl92c_phy_mac_config(struct ieee80211_hw *hw);
202bool rtl92ce_phy_bb_config(struct ieee80211_hw *hw); 197bool rtl92ce_phy_bb_config(struct ieee80211_hw *hw);
203bool rtl92c_phy_rf_config(struct ieee80211_hw *hw); 198bool rtl92c_phy_rf_config(struct ieee80211_hw *hw);
204bool rtl92c_phy_config_rf_with_feaderfile(struct ieee80211_hw *hw, 199bool rtl92c_phy_config_rf_with_feaderfile(struct ieee80211_hw *hw,
205 enum radio_path rfpath); 200 enum radio_path rfpath);
206void rtl92c_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw); 201void rtl92c_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw);
207void rtl92c_phy_get_txpower_level(struct ieee80211_hw *hw, 202void rtl92c_phy_get_txpower_level(struct ieee80211_hw *hw, long *powerlevel);
208 long *powerlevel);
209void rtl92c_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel); 203void rtl92c_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel);
210bool rtl92c_phy_update_txpower_dbm(struct ieee80211_hw *hw, 204bool rtl92c_phy_update_txpower_dbm(struct ieee80211_hw *hw,
211 long power_indbm); 205 long power_indbm);
212void rtl92c_phy_scan_operation_backup(struct ieee80211_hw *hw,
213 u8 operation);
214void rtl92c_phy_set_bw_mode(struct ieee80211_hw *hw, 206void rtl92c_phy_set_bw_mode(struct ieee80211_hw *hw,
215 enum nl80211_channel_type ch_type); 207 enum nl80211_channel_type ch_type);
216void rtl92c_phy_sw_chnl_callback(struct ieee80211_hw *hw); 208void rtl92c_phy_sw_chnl_callback(struct ieee80211_hw *hw);
217u8 rtl92c_phy_sw_chnl(struct ieee80211_hw *hw); 209u8 rtl92c_phy_sw_chnl(struct ieee80211_hw *hw);
218void rtl92c_phy_iq_calibrate(struct ieee80211_hw *hw, bool b_recovery); 210void rtl92c_phy_iq_calibrate(struct ieee80211_hw *hw, bool b_recovery);
219void rtl92c_phy_set_beacon_hw_reg(struct ieee80211_hw *hw, 211void rtl92c_phy_set_beacon_hw_reg(struct ieee80211_hw *hw, u16 beaconinterval);
220 u16 beaconinterval);
221void rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, char delta); 212void rtl92c_phy_ap_calibrate(struct ieee80211_hw *hw, char delta);
222void rtl92c_phy_lc_calibrate(struct ieee80211_hw *hw); 213void rtl92c_phy_lc_calibrate(struct ieee80211_hw *hw);
223void _rtl92ce_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t); 214void _rtl92ce_phy_lc_calibrate(struct ieee80211_hw *hw, bool is2t);
@@ -225,28 +216,25 @@ void rtl92c_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain);
225bool rtl92c_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, 216bool rtl92c_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
226 enum radio_path rfpath); 217 enum radio_path rfpath);
227bool rtl8192_phy_check_is_legal_rfpath(struct ieee80211_hw *hw, 218bool rtl8192_phy_check_is_legal_rfpath(struct ieee80211_hw *hw,
228 u32 rfpath); 219 u32 rfpath);
229bool rtl92c_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype);
230bool rtl92ce_phy_set_rf_power_state(struct ieee80211_hw *hw, 220bool rtl92ce_phy_set_rf_power_state(struct ieee80211_hw *hw,
231 enum rf_pwrstate rfpwr_state); 221 enum rf_pwrstate rfpwr_state);
232void rtl92ce_phy_set_rf_on(struct ieee80211_hw *hw); 222void rtl92ce_phy_set_rf_on(struct ieee80211_hw *hw);
233bool rtl92c_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype); 223bool rtl92c_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype);
234void rtl92c_phy_set_io(struct ieee80211_hw *hw); 224void rtl92c_phy_set_io(struct ieee80211_hw *hw);
235void rtl92c_bb_block_on(struct ieee80211_hw *hw); 225void rtl92c_bb_block_on(struct ieee80211_hw *hw);
236u32 _rtl92c_phy_rf_serial_read(struct ieee80211_hw *hw, 226u32 _rtl92c_phy_rf_serial_read(struct ieee80211_hw *hw, enum radio_path rfpath,
237 enum radio_path rfpath, u32 offset); 227 u32 offset);
238u32 _rtl92c_phy_fw_rf_serial_read(struct ieee80211_hw *hw, 228u32 _rtl92c_phy_fw_rf_serial_read(struct ieee80211_hw *hw,
239 enum radio_path rfpath, u32 offset); 229 enum radio_path rfpath, u32 offset);
240u32 _rtl92c_phy_calculate_bit_shift(u32 bitmask); 230u32 _rtl92c_phy_calculate_bit_shift(u32 bitmask);
241void _rtl92c_phy_rf_serial_write(struct ieee80211_hw *hw, 231void _rtl92c_phy_rf_serial_write(struct ieee80211_hw *hw,
242 enum radio_path rfpath, u32 offset, 232 enum radio_path rfpath, u32 offset, u32 data);
243 u32 data);
244void _rtl92c_phy_fw_rf_serial_write(struct ieee80211_hw *hw, 233void _rtl92c_phy_fw_rf_serial_write(struct ieee80211_hw *hw,
245 enum radio_path rfpath, u32 offset, 234 enum radio_path rfpath, u32 offset,
246 u32 data); 235 u32 data);
247void _rtl92c_store_pwrIndex_diffrate_offset(struct ieee80211_hw *hw, 236void _rtl92c_store_pwrIndex_diffrate_offset(struct ieee80211_hw *hw,
248 u32 regaddr, u32 bitmask, 237 u32 regaddr, u32 bitmask, u32 data);
249 u32 data);
250bool _rtl92ce_phy_config_mac_with_headerfile(struct ieee80211_hw *hw); 238bool _rtl92ce_phy_config_mac_with_headerfile(struct ieee80211_hw *hw);
251void _rtl92c_phy_init_bb_rf_register_definition(struct ieee80211_hw *hw); 239void _rtl92c_phy_init_bb_rf_register_definition(struct ieee80211_hw *hw);
252bool _rtl92c_phy_bb8192c_config_parafile(struct ieee80211_hw *hw); 240bool _rtl92c_phy_bb8192c_config_parafile(struct ieee80211_hw *hw);
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/reg.h b/drivers/net/wireless/rtlwifi/rtl8192ce/reg.h
index bd4aef74c056..8922ecb47ad2 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/reg.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/reg.h
@@ -560,7 +560,6 @@
560#define EEPROM_DEFAULT_TXPOWERLEVEL 0x22 560#define EEPROM_DEFAULT_TXPOWERLEVEL 0x22
561#define EEPROM_DEFAULT_HT40_2SDIFF 0x0 561#define EEPROM_DEFAULT_HT40_2SDIFF 0x0
562#define EEPROM_DEFAULT_HT20_DIFF 2 562#define EEPROM_DEFAULT_HT20_DIFF 2
563#define EEPROM_DEFAULT_LEGACYHTTXPOWERDIFF 0x3
564#define EEPROM_DEFAULT_HT40_PWRMAXOFFSET 0 563#define EEPROM_DEFAULT_HT40_PWRMAXOFFSET 0
565#define EEPROM_DEFAULT_HT20_PWRMAXOFFSET 0 564#define EEPROM_DEFAULT_HT20_PWRMAXOFFSET 0
566 565
@@ -639,17 +638,8 @@
639 638
640#define EEPROM_TXPWR_GROUP 0x6F 639#define EEPROM_TXPWR_GROUP 0x6F
641 640
642#define EEPROM_TSSI_A 0x76
643#define EEPROM_TSSI_B 0x77
644#define EEPROM_THERMAL_METER 0x78
645
646#define EEPROM_CHANNELPLAN 0x75 641#define EEPROM_CHANNELPLAN 0x75
647 642
648#define RF_OPTION1 0x79
649#define RF_OPTION2 0x7A
650#define RF_OPTION3 0x7B
651#define RF_OPTION4 0x7C
652
653#define STOPBECON BIT(6) 643#define STOPBECON BIT(6)
654#define STOPHIGHT BIT(5) 644#define STOPHIGHT BIT(5)
655#define STOPMGT BIT(4) 645#define STOPMGT BIT(4)
@@ -689,13 +679,6 @@
689#define RSV_CTRL 0x001C 679#define RSV_CTRL 0x001C
690#define RD_CTRL 0x0524 680#define RD_CTRL 0x0524
691 681
692#define REG_USB_INFO 0xFE17
693#define REG_USB_SPECIAL_OPTION 0xFE55
694
695#define REG_USB_DMA_AGG_TO 0xFE5B
696#define REG_USB_AGG_TO 0xFE5C
697#define REG_USB_AGG_TH 0xFE5D
698
699#define REG_USB_VID 0xFE60 682#define REG_USB_VID 0xFE60
700#define REG_USB_PID 0xFE62 683#define REG_USB_PID 0xFE62
701#define REG_USB_OPTIONAL 0xFE64 684#define REG_USB_OPTIONAL 0xFE64
@@ -1196,9 +1179,6 @@
1196#define POLLING_LLT_THRESHOLD 20 1179#define POLLING_LLT_THRESHOLD 20
1197#define POLLING_READY_TIMEOUT_COUNT 1000 1180#define POLLING_READY_TIMEOUT_COUNT 1000
1198 1181
1199#define MAX_MSS_DENSITY_2T 0x13
1200#define MAX_MSS_DENSITY_1T 0x0A
1201
1202#define EPROM_CMD_OPERATING_MODE_MASK ((1<<7)|(1<<6)) 1182#define EPROM_CMD_OPERATING_MODE_MASK ((1<<7)|(1<<6))
1203#define EPROM_CMD_CONFIG 0x3 1183#define EPROM_CMD_CONFIG 0x3
1204#define EPROM_CMD_LOAD 1 1184#define EPROM_CMD_LOAD 1
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/rf.h b/drivers/net/wireless/rtlwifi/rtl8192ce/rf.h
index 6c8d56efceae..d8fe68b389d2 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/rf.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/rf.h
@@ -34,11 +34,10 @@
34#define RF6052_MAX_REG 0x3F 34#define RF6052_MAX_REG 0x3F
35#define RF6052_MAX_PATH 2 35#define RF6052_MAX_PATH 2
36 36
37extern void rtl92ce_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, 37void rtl92ce_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, u8 bandwidth);
38 u8 bandwidth); 38void rtl92ce_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw,
39extern void rtl92ce_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw, 39 u8 *ppowerlevel);
40 u8 *ppowerlevel); 40void rtl92ce_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw,
41extern void rtl92ce_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw, 41 u8 *ppowerlevel, u8 channel);
42 u8 *ppowerlevel, u8 channel); 42bool rtl92ce_phy_rf6052_config(struct ieee80211_hw *hw);
43extern bool rtl92ce_phy_rf6052_config(struct ieee80211_hw *hw);
44#endif 43#endif
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c b/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c
index 14203561b6ee..b790320d2030 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c
@@ -30,6 +30,7 @@
30#include "../wifi.h" 30#include "../wifi.h"
31#include "../core.h" 31#include "../core.h"
32#include "../pci.h" 32#include "../pci.h"
33#include "../base.h"
33#include "reg.h" 34#include "reg.h"
34#include "def.h" 35#include "def.h"
35#include "phy.h" 36#include "phy.h"
@@ -219,7 +220,7 @@ static struct rtl_hal_ops rtl8192ce_hal_ops = {
219 .set_bw_mode = rtl92c_phy_set_bw_mode, 220 .set_bw_mode = rtl92c_phy_set_bw_mode,
220 .switch_channel = rtl92c_phy_sw_chnl, 221 .switch_channel = rtl92c_phy_sw_chnl,
221 .dm_watchdog = rtl92c_dm_watchdog, 222 .dm_watchdog = rtl92c_dm_watchdog,
222 .scan_operation_backup = rtl92c_phy_scan_operation_backup, 223 .scan_operation_backup = rtl_phy_scan_operation_backup,
223 .set_rf_power_state = rtl92c_phy_set_rf_power_state, 224 .set_rf_power_state = rtl92c_phy_set_rf_power_state,
224 .led_control = rtl92ce_led_control, 225 .led_control = rtl92ce_led_control,
225 .set_desc = rtl92ce_set_desc, 226 .set_desc = rtl92ce_set_desc,
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c b/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c
index 6ad23b413eb3..52abf0a862fa 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c
@@ -420,7 +420,6 @@ bool rtl92ce_rx_query_desc(struct ieee80211_hw *hw,
420 420
421 /*rx_status->qual = stats->signal; */ 421 /*rx_status->qual = stats->signal; */
422 rx_status->signal = stats->recvsignalpower + 10; 422 rx_status->signal = stats->recvsignalpower + 10;
423 /*rx_status->noise = -stats->noise; */
424 423
425 return true; 424 return true;
426} 425}
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c b/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c
index da4f587199ee..393685390f3e 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c
@@ -32,6 +32,7 @@
32#include "../usb.h" 32#include "../usb.h"
33#include "../ps.h" 33#include "../ps.h"
34#include "../cam.h" 34#include "../cam.h"
35#include "../stats.h"
35#include "reg.h" 36#include "reg.h"
36#include "def.h" 37#include "def.h"
37#include "phy.h" 38#include "phy.h"
@@ -738,16 +739,6 @@ static u8 _rtl92c_evm_db_to_percentage(char value)
738 return ret_val; 739 return ret_val;
739} 740}
740 741
741static long _rtl92c_translate_todbm(struct ieee80211_hw *hw,
742 u8 signal_strength_index)
743{
744 long signal_power;
745
746 signal_power = (long)((signal_strength_index + 1) >> 1);
747 signal_power -= 95;
748 return signal_power;
749}
750
751static long _rtl92c_signal_scale_mapping(struct ieee80211_hw *hw, 742static long _rtl92c_signal_scale_mapping(struct ieee80211_hw *hw,
752 long currsig) 743 long currsig)
753{ 744{
@@ -913,180 +904,6 @@ static void _rtl92c_query_rxphystatus(struct ieee80211_hw *hw,
913 (hw, total_rssi /= rf_rx_num)); 904 (hw, total_rssi /= rf_rx_num));
914} 905}
915 906
916static void _rtl92c_process_ui_rssi(struct ieee80211_hw *hw,
917 struct rtl_stats *pstats)
918{
919 struct rtl_priv *rtlpriv = rtl_priv(hw);
920 struct rtl_phy *rtlphy = &(rtlpriv->phy);
921 u8 rfpath;
922 u32 last_rssi, tmpval;
923
924 if (pstats->packet_toself || pstats->packet_beacon) {
925 rtlpriv->stats.rssi_calculate_cnt++;
926 if (rtlpriv->stats.ui_rssi.total_num++ >=
927 PHY_RSSI_SLID_WIN_MAX) {
928 rtlpriv->stats.ui_rssi.total_num =
929 PHY_RSSI_SLID_WIN_MAX;
930 last_rssi =
931 rtlpriv->stats.ui_rssi.elements[rtlpriv->
932 stats.ui_rssi.index];
933 rtlpriv->stats.ui_rssi.total_val -= last_rssi;
934 }
935 rtlpriv->stats.ui_rssi.total_val += pstats->signalstrength;
936 rtlpriv->stats.ui_rssi.elements[rtlpriv->stats.ui_rssi.
937 index++] = pstats->signalstrength;
938 if (rtlpriv->stats.ui_rssi.index >= PHY_RSSI_SLID_WIN_MAX)
939 rtlpriv->stats.ui_rssi.index = 0;
940 tmpval = rtlpriv->stats.ui_rssi.total_val /
941 rtlpriv->stats.ui_rssi.total_num;
942 rtlpriv->stats.signal_strength =
943 _rtl92c_translate_todbm(hw, (u8) tmpval);
944 pstats->rssi = rtlpriv->stats.signal_strength;
945 }
946 if (!pstats->is_cck && pstats->packet_toself) {
947 for (rfpath = RF90_PATH_A; rfpath < rtlphy->num_total_rfpath;
948 rfpath++) {
949 if (!rtl8192_phy_check_is_legal_rfpath(hw, rfpath))
950 continue;
951 if (rtlpriv->stats.rx_rssi_percentage[rfpath] == 0) {
952 rtlpriv->stats.rx_rssi_percentage[rfpath] =
953 pstats->rx_mimo_signalstrength[rfpath];
954 }
955 if (pstats->rx_mimo_signalstrength[rfpath] >
956 rtlpriv->stats.rx_rssi_percentage[rfpath]) {
957 rtlpriv->stats.rx_rssi_percentage[rfpath] =
958 ((rtlpriv->stats.
959 rx_rssi_percentage[rfpath] *
960 (RX_SMOOTH_FACTOR - 1)) +
961 (pstats->rx_mimo_signalstrength[rfpath])) /
962 (RX_SMOOTH_FACTOR);
963
964 rtlpriv->stats.rx_rssi_percentage[rfpath] =
965 rtlpriv->stats.rx_rssi_percentage[rfpath] +
966 1;
967 } else {
968 rtlpriv->stats.rx_rssi_percentage[rfpath] =
969 ((rtlpriv->stats.
970 rx_rssi_percentage[rfpath] *
971 (RX_SMOOTH_FACTOR - 1)) +
972 (pstats->rx_mimo_signalstrength[rfpath])) /
973 (RX_SMOOTH_FACTOR);
974 }
975 }
976 }
977}
978
979static void _rtl92c_update_rxsignalstatistics(struct ieee80211_hw *hw,
980 struct rtl_stats *pstats)
981{
982 struct rtl_priv *rtlpriv = rtl_priv(hw);
983 int weighting = 0;
984
985 if (rtlpriv->stats.recv_signal_power == 0)
986 rtlpriv->stats.recv_signal_power = pstats->recvsignalpower;
987 if (pstats->recvsignalpower > rtlpriv->stats.recv_signal_power)
988 weighting = 5;
989 else if (pstats->recvsignalpower < rtlpriv->stats.recv_signal_power)
990 weighting = (-5);
991 rtlpriv->stats.recv_signal_power =
992 (rtlpriv->stats.recv_signal_power * 5 +
993 pstats->recvsignalpower + weighting) / 6;
994}
995
996static void _rtl92c_process_pwdb(struct ieee80211_hw *hw,
997 struct rtl_stats *pstats)
998{
999 struct rtl_priv *rtlpriv = rtl_priv(hw);
1000 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
1001 long undec_sm_pwdb = 0;
1002
1003 if (mac->opmode == NL80211_IFTYPE_ADHOC) {
1004 return;
1005 } else {
1006 undec_sm_pwdb = rtlpriv->dm.undec_sm_pwdb;
1007 }
1008 if (pstats->packet_toself || pstats->packet_beacon) {
1009 if (undec_sm_pwdb < 0)
1010 undec_sm_pwdb = pstats->rx_pwdb_all;
1011 if (pstats->rx_pwdb_all > (u32) undec_sm_pwdb) {
1012 undec_sm_pwdb = (((undec_sm_pwdb) *
1013 (RX_SMOOTH_FACTOR - 1)) +
1014 (pstats->rx_pwdb_all)) / (RX_SMOOTH_FACTOR);
1015 undec_sm_pwdb += 1;
1016 } else {
1017 undec_sm_pwdb = (((undec_sm_pwdb) *
1018 (RX_SMOOTH_FACTOR - 1)) +
1019 (pstats->rx_pwdb_all)) / (RX_SMOOTH_FACTOR);
1020 }
1021 rtlpriv->dm.undec_sm_pwdb = undec_sm_pwdb;
1022 _rtl92c_update_rxsignalstatistics(hw, pstats);
1023 }
1024}
1025
1026static void _rtl92c_process_LINK_Q(struct ieee80211_hw *hw,
1027 struct rtl_stats *pstats)
1028{
1029 struct rtl_priv *rtlpriv = rtl_priv(hw);
1030 u32 last_evm = 0, n_stream, tmpval;
1031
1032 if (pstats->signalquality != 0) {
1033 if (pstats->packet_toself || pstats->packet_beacon) {
1034 if (rtlpriv->stats.LINK_Q.total_num++ >=
1035 PHY_LINKQUALITY_SLID_WIN_MAX) {
1036 rtlpriv->stats.LINK_Q.total_num =
1037 PHY_LINKQUALITY_SLID_WIN_MAX;
1038 last_evm =
1039 rtlpriv->stats.LINK_Q.elements
1040 [rtlpriv->stats.LINK_Q.index];
1041 rtlpriv->stats.LINK_Q.total_val -=
1042 last_evm;
1043 }
1044 rtlpriv->stats.LINK_Q.total_val +=
1045 pstats->signalquality;
1046 rtlpriv->stats.LINK_Q.elements
1047 [rtlpriv->stats.LINK_Q.index++] =
1048 pstats->signalquality;
1049 if (rtlpriv->stats.LINK_Q.index >=
1050 PHY_LINKQUALITY_SLID_WIN_MAX)
1051 rtlpriv->stats.LINK_Q.index = 0;
1052 tmpval = rtlpriv->stats.LINK_Q.total_val /
1053 rtlpriv->stats.LINK_Q.total_num;
1054 rtlpriv->stats.signal_quality = tmpval;
1055 rtlpriv->stats.last_sigstrength_inpercent = tmpval;
1056 for (n_stream = 0; n_stream < 2;
1057 n_stream++) {
1058 if (pstats->RX_SIGQ[n_stream] != -1) {
1059 if (!rtlpriv->stats.RX_EVM[n_stream]) {
1060 rtlpriv->stats.RX_EVM[n_stream]
1061 = pstats->RX_SIGQ[n_stream];
1062 }
1063 rtlpriv->stats.RX_EVM[n_stream] =
1064 ((rtlpriv->stats.RX_EVM
1065 [n_stream] *
1066 (RX_SMOOTH_FACTOR - 1)) +
1067 (pstats->RX_SIGQ
1068 [n_stream] * 1)) /
1069 (RX_SMOOTH_FACTOR);
1070 }
1071 }
1072 }
1073 } else {
1074 ;
1075 }
1076}
1077
1078static void _rtl92c_process_phyinfo(struct ieee80211_hw *hw,
1079 u8 *buffer,
1080 struct rtl_stats *pcurrent_stats)
1081{
1082 if (!pcurrent_stats->packet_matchbssid &&
1083 !pcurrent_stats->packet_beacon)
1084 return;
1085 _rtl92c_process_ui_rssi(hw, pcurrent_stats);
1086 _rtl92c_process_pwdb(hw, pcurrent_stats);
1087 _rtl92c_process_LINK_Q(hw, pcurrent_stats);
1088}
1089
1090void rtl92c_translate_rx_signal_stuff(struct ieee80211_hw *hw, 907void rtl92c_translate_rx_signal_stuff(struct ieee80211_hw *hw,
1091 struct sk_buff *skb, 908 struct sk_buff *skb,
1092 struct rtl_stats *pstats, 909 struct rtl_stats *pstats,
@@ -1123,5 +940,5 @@ void rtl92c_translate_rx_signal_stuff(struct ieee80211_hw *hw,
1123 _rtl92c_query_rxphystatus(hw, pstats, pdesc, p_drvinfo, 940 _rtl92c_query_rxphystatus(hw, pstats, pdesc, p_drvinfo,
1124 packet_matchbssid, packet_toself, 941 packet_matchbssid, packet_toself,
1125 packet_beacon); 942 packet_beacon);
1126 _rtl92c_process_phyinfo(hw, tmp_buf, pstats); 943 rtl_process_phyinfo(hw, tmp_buf, pstats);
1127} 944}
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/rf.h b/drivers/net/wireless/rtlwifi/rtl8192cu/rf.h
index 090fd33a158d..11b439d6b671 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/rf.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/rf.h
@@ -34,15 +34,14 @@
34#define RF6052_MAX_REG 0x3F 34#define RF6052_MAX_REG 0x3F
35#define RF6052_MAX_PATH 2 35#define RF6052_MAX_PATH 2
36 36
37extern void rtl92cu_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, 37void rtl92cu_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, u8 bandwidth);
38 u8 bandwidth); 38void rtl92c_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw,
39extern void rtl92c_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw, 39 u8 *ppowerlevel);
40 u8 *ppowerlevel); 40void rtl92c_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw,
41extern void rtl92c_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw, 41 u8 *ppowerlevel, u8 channel);
42 u8 *ppowerlevel, u8 channel);
43bool rtl92cu_phy_rf6052_config(struct ieee80211_hw *hw); 42bool rtl92cu_phy_rf6052_config(struct ieee80211_hw *hw);
44bool rtl92cu_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, 43bool rtl92cu_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
45 enum radio_path rfpath); 44 enum radio_path rfpath);
46void rtl92cu_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw, 45void rtl92cu_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw,
47 u8 *ppowerlevel); 46 u8 *ppowerlevel);
48void rtl92cu_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw, 47void rtl92cu_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw,
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
index 2bd598526217..9936de716ad5 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
@@ -31,6 +31,7 @@
31#include "../core.h" 31#include "../core.h"
32#include "../usb.h" 32#include "../usb.h"
33#include "../efuse.h" 33#include "../efuse.h"
34#include "../base.h"
34#include "reg.h" 35#include "reg.h"
35#include "def.h" 36#include "def.h"
36#include "phy.h" 37#include "phy.h"
@@ -117,7 +118,7 @@ static struct rtl_hal_ops rtl8192cu_hal_ops = {
117 .set_bw_mode = rtl92c_phy_set_bw_mode, 118 .set_bw_mode = rtl92c_phy_set_bw_mode,
118 .switch_channel = rtl92c_phy_sw_chnl, 119 .switch_channel = rtl92c_phy_sw_chnl,
119 .dm_watchdog = rtl92c_dm_watchdog, 120 .dm_watchdog = rtl92c_dm_watchdog,
120 .scan_operation_backup = rtl92c_phy_scan_operation_backup, 121 .scan_operation_backup = rtl_phy_scan_operation_backup,
121 .set_rf_power_state = rtl92cu_phy_set_rf_power_state, 122 .set_rf_power_state = rtl92cu_phy_set_rf_power_state,
122 .led_control = rtl92cu_led_control, 123 .led_control = rtl92cu_led_control,
123 .enable_hw_sec = rtl92cu_enable_hw_security_config, 124 .enable_hw_sec = rtl92cu_enable_hw_security_config,
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c
index 5a060e537fbe..25e50ffc44ec 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c
@@ -350,7 +350,6 @@ bool rtl92cu_rx_query_desc(struct ieee80211_hw *hw,
350 } 350 }
351 /*rx_status->qual = stats->signal; */ 351 /*rx_status->qual = stats->signal; */
352 rx_status->signal = stats->rssi + 10; 352 rx_status->signal = stats->rssi + 10;
353 /*rx_status->noise = -stats->noise; */
354 return true; 353 return true;
355} 354}
356 355
@@ -365,7 +364,6 @@ static void _rtl_rx_process(struct ieee80211_hw *hw, struct sk_buff *skb)
365 u8 *rxdesc; 364 u8 *rxdesc;
366 struct rtl_stats stats = { 365 struct rtl_stats stats = {
367 .signal = 0, 366 .signal = 0,
368 .noise = -98,
369 .rate = 0, 367 .rate = 0,
370 }; 368 };
371 struct rx_fwinfo_92c *p_drvinfo; 369 struct rx_fwinfo_92c *p_drvinfo;
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/dm.c b/drivers/net/wireless/rtlwifi/rtl8192de/dm.c
index f700f7a614b2..7908e1c85819 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192de/dm.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192de/dm.c
@@ -840,9 +840,9 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter(
840 bool internal_pa = false; 840 bool internal_pa = false;
841 long ele_a = 0, ele_d, temp_cck, val_x, value32; 841 long ele_a = 0, ele_d, temp_cck, val_x, value32;
842 long val_y, ele_c = 0; 842 long val_y, ele_c = 0;
843 u8 ofdm_index[2]; 843 u8 ofdm_index[3];
844 s8 cck_index = 0; 844 s8 cck_index = 0;
845 u8 ofdm_index_old[2] = {0, 0}; 845 u8 ofdm_index_old[3] = {0, 0, 0};
846 s8 cck_index_old = 0; 846 s8 cck_index_old = 0;
847 u8 index; 847 u8 index;
848 int i; 848 int i;
@@ -1118,6 +1118,10 @@ static void rtl92d_dm_txpower_tracking_callback_thermalmeter(
1118 val_x, val_y, ele_a, ele_c, ele_d, 1118 val_x, val_y, ele_a, ele_c, ele_d,
1119 val_x, val_y); 1119 val_x, val_y);
1120 1120
1121 if (cck_index >= CCK_TABLE_SIZE)
1122 cck_index = CCK_TABLE_SIZE - 1;
1123 if (cck_index < 0)
1124 cck_index = 0;
1121 if (rtlhal->current_bandtype == BAND_ON_2_4G) { 1125 if (rtlhal->current_bandtype == BAND_ON_2_4G) {
1122 /* Adjust CCK according to IQK result */ 1126 /* Adjust CCK according to IQK result */
1123 if (!rtlpriv->dm.cck_inch14) { 1127 if (!rtlpriv->dm.cck_inch14) {
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/hw.c b/drivers/net/wireless/rtlwifi/rtl8192de/hw.c
index 7dd8f6de0550..c4a7db9135d6 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192de/hw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192de/hw.c
@@ -1194,25 +1194,7 @@ void rtl92d_linked_set_reg(struct ieee80211_hw *hw)
1194 * mac80211 will send pkt when scan */ 1194 * mac80211 will send pkt when scan */
1195void rtl92de_set_qos(struct ieee80211_hw *hw, int aci) 1195void rtl92de_set_qos(struct ieee80211_hw *hw, int aci)
1196{ 1196{
1197 struct rtl_priv *rtlpriv = rtl_priv(hw);
1198 rtl92d_dm_init_edca_turbo(hw); 1197 rtl92d_dm_init_edca_turbo(hw);
1199 return;
1200 switch (aci) {
1201 case AC1_BK:
1202 rtl_write_dword(rtlpriv, REG_EDCA_BK_PARAM, 0xa44f);
1203 break;
1204 case AC0_BE:
1205 break;
1206 case AC2_VI:
1207 rtl_write_dword(rtlpriv, REG_EDCA_VI_PARAM, 0x5e4322);
1208 break;
1209 case AC3_VO:
1210 rtl_write_dword(rtlpriv, REG_EDCA_VO_PARAM, 0x2f3222);
1211 break;
1212 default:
1213 RT_ASSERT(false, "invalid aci: %d !\n", aci);
1214 break;
1215 }
1216} 1198}
1217 1199
1218void rtl92de_enable_interrupt(struct ieee80211_hw *hw) 1200void rtl92de_enable_interrupt(struct ieee80211_hw *hw)
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/hw.h b/drivers/net/wireless/rtlwifi/rtl8192de/hw.h
index 7c9f7a2f1e42..1bc7b1a96d4a 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192de/hw.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192de/hw.h
@@ -55,10 +55,9 @@ void rtl92de_set_key(struct ieee80211_hw *hw, u32 key_index,
55 u8 *p_macaddr, bool is_group, u8 enc_algo, 55 u8 *p_macaddr, bool is_group, u8 enc_algo,
56 bool is_wepkey, bool clear_all); 56 bool is_wepkey, bool clear_all);
57 57
58extern void rtl92de_write_dword_dbi(struct ieee80211_hw *hw, u16 offset, 58void rtl92de_write_dword_dbi(struct ieee80211_hw *hw, u16 offset, u32 value,
59 u32 value, u8 direct); 59 u8 direct);
60extern u32 rtl92de_read_dword_dbi(struct ieee80211_hw *hw, u16 offset, 60u32 rtl92de_read_dword_dbi(struct ieee80211_hw *hw, u16 offset, u8 direct);
61 u8 direct);
62void rtl92de_suspend(struct ieee80211_hw *hw); 61void rtl92de_suspend(struct ieee80211_hw *hw);
63void rtl92de_resume(struct ieee80211_hw *hw); 62void rtl92de_resume(struct ieee80211_hw *hw);
64void rtl92d_linked_set_reg(struct ieee80211_hw *hw); 63void rtl92d_linked_set_reg(struct ieee80211_hw *hw);
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/phy.c b/drivers/net/wireless/rtlwifi/rtl8192de/phy.c
index 840bac5fa2f8..13196cc4b1d3 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192de/phy.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192de/phy.c
@@ -1022,34 +1022,6 @@ void rtl92d_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel)
1022 rtl92d_phy_rf6052_set_ofdm_txpower(hw, &ofdmpowerlevel[0], channel); 1022 rtl92d_phy_rf6052_set_ofdm_txpower(hw, &ofdmpowerlevel[0], channel);
1023} 1023}
1024 1024
1025void rtl92d_phy_scan_operation_backup(struct ieee80211_hw *hw, u8 operation)
1026{
1027 struct rtl_priv *rtlpriv = rtl_priv(hw);
1028 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
1029 enum io_type iotype;
1030
1031 if (!is_hal_stop(rtlhal)) {
1032 switch (operation) {
1033 case SCAN_OPT_BACKUP:
1034 rtlhal->current_bandtypebackup =
1035 rtlhal->current_bandtype;
1036 iotype = IO_CMD_PAUSE_DM_BY_SCAN;
1037 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_IO_CMD,
1038 (u8 *)&iotype);
1039 break;
1040 case SCAN_OPT_RESTORE:
1041 iotype = IO_CMD_RESUME_DM_BY_SCAN;
1042 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_IO_CMD,
1043 (u8 *)&iotype);
1044 break;
1045 default:
1046 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
1047 "Unknown Scan Backup operation\n");
1048 break;
1049 }
1050 }
1051}
1052
1053void rtl92d_phy_set_bw_mode(struct ieee80211_hw *hw, 1025void rtl92d_phy_set_bw_mode(struct ieee80211_hw *hw,
1054 enum nl80211_channel_type ch_type) 1026 enum nl80211_channel_type ch_type)
1055{ 1027{
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/phy.h b/drivers/net/wireless/rtlwifi/rtl8192de/phy.h
index f074952bf25c..48d5c6835b6a 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192de/phy.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192de/phy.h
@@ -39,9 +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
43#define MAX_TOLERANCE 5 42#define MAX_TOLERANCE 5
44#define IQK_DELAY_TIME 1
45 43
46#define APK_BB_REG_NUM 5 44#define APK_BB_REG_NUM 5
47#define APK_AFE_REG_NUM 16 45#define APK_AFE_REG_NUM 16
@@ -127,34 +125,32 @@ static inline void rtl92d_release_cckandrw_pagea_ctl(struct ieee80211_hw *hw,
127 *flag); 125 *flag);
128} 126}
129 127
130extern u32 rtl92d_phy_query_bb_reg(struct ieee80211_hw *hw, 128u32 rtl92d_phy_query_bb_reg(struct ieee80211_hw *hw,
131 u32 regaddr, u32 bitmask); 129 u32 regaddr, u32 bitmask);
132extern void rtl92d_phy_set_bb_reg(struct ieee80211_hw *hw, 130void rtl92d_phy_set_bb_reg(struct ieee80211_hw *hw,
133 u32 regaddr, u32 bitmask, u32 data); 131 u32 regaddr, u32 bitmask, u32 data);
134extern u32 rtl92d_phy_query_rf_reg(struct ieee80211_hw *hw, 132u32 rtl92d_phy_query_rf_reg(struct ieee80211_hw *hw,
135 enum radio_path rfpath, u32 regaddr, 133 enum radio_path rfpath, u32 regaddr,
136 u32 bitmask); 134 u32 bitmask);
137extern void rtl92d_phy_set_rf_reg(struct ieee80211_hw *hw, 135void rtl92d_phy_set_rf_reg(struct ieee80211_hw *hw,
138 enum radio_path rfpath, u32 regaddr, 136 enum radio_path rfpath, u32 regaddr,
139 u32 bitmask, u32 data); 137 u32 bitmask, u32 data);
140extern bool rtl92d_phy_mac_config(struct ieee80211_hw *hw); 138bool rtl92d_phy_mac_config(struct ieee80211_hw *hw);
141extern bool rtl92d_phy_bb_config(struct ieee80211_hw *hw); 139bool rtl92d_phy_bb_config(struct ieee80211_hw *hw);
142extern bool rtl92d_phy_rf_config(struct ieee80211_hw *hw); 140bool rtl92d_phy_rf_config(struct ieee80211_hw *hw);
143extern bool rtl92c_phy_config_rf_with_feaderfile(struct ieee80211_hw *hw, 141bool rtl92c_phy_config_rf_with_feaderfile(struct ieee80211_hw *hw,
144 enum radio_path rfpath); 142 enum radio_path rfpath);
145extern void rtl92d_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw); 143void rtl92d_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw);
146extern void rtl92d_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel); 144void rtl92d_phy_set_txpower_level(struct ieee80211_hw *hw, u8 channel);
147extern void rtl92d_phy_scan_operation_backup(struct ieee80211_hw *hw, 145void rtl92d_phy_set_bw_mode(struct ieee80211_hw *hw,
148 u8 operation); 146 enum nl80211_channel_type ch_type);
149extern void rtl92d_phy_set_bw_mode(struct ieee80211_hw *hw, 147u8 rtl92d_phy_sw_chnl(struct ieee80211_hw *hw);
150 enum nl80211_channel_type ch_type);
151extern u8 rtl92d_phy_sw_chnl(struct ieee80211_hw *hw);
152bool rtl92d_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, 148bool rtl92d_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
153 enum rf_content content, 149 enum rf_content content,
154 enum radio_path rfpath); 150 enum radio_path rfpath);
155bool rtl92d_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype); 151bool rtl92d_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype);
156extern bool rtl92d_phy_set_rf_power_state(struct ieee80211_hw *hw, 152bool rtl92d_phy_set_rf_power_state(struct ieee80211_hw *hw,
157 enum rf_pwrstate rfpwr_state); 153 enum rf_pwrstate rfpwr_state);
158 154
159void rtl92d_phy_config_macphymode(struct ieee80211_hw *hw); 155void rtl92d_phy_config_macphymode(struct ieee80211_hw *hw);
160void rtl92d_phy_config_macphymode_info(struct ieee80211_hw *hw); 156void rtl92d_phy_config_macphymode_info(struct ieee80211_hw *hw);
@@ -173,6 +169,5 @@ void rtl92d_acquire_cckandrw_pagea_ctl(struct ieee80211_hw *hw,
173 unsigned long *flag); 169 unsigned long *flag);
174u8 rtl92d_get_rightchnlplace_for_iqk(u8 chnl); 170u8 rtl92d_get_rightchnlplace_for_iqk(u8 chnl);
175void rtl92d_phy_reload_iqk_setting(struct ieee80211_hw *hw, u8 channel); 171void rtl92d_phy_reload_iqk_setting(struct ieee80211_hw *hw, u8 channel);
176void rtl92d_phy_iq_calibrate(struct ieee80211_hw *hw);
177 172
178#endif 173#endif
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/rf.h b/drivers/net/wireless/rtlwifi/rtl8192de/rf.h
index 0fe1a48593e8..7303d12c266f 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192de/rf.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192de/rf.h
@@ -30,15 +30,13 @@
30#ifndef __RTL92D_RF_H__ 30#ifndef __RTL92D_RF_H__
31#define __RTL92D_RF_H__ 31#define __RTL92D_RF_H__
32 32
33extern void rtl92d_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, 33void rtl92d_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, u8 bandwidth);
34 u8 bandwidth); 34void rtl92d_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw,
35extern void rtl92d_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw, 35 u8 *ppowerlevel);
36 u8 *ppowerlevel); 36void rtl92d_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw,
37extern void rtl92d_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw, 37 u8 *ppowerlevel, u8 channel);
38 u8 *ppowerlevel, u8 channel); 38bool rtl92d_phy_rf6052_config(struct ieee80211_hw *hw);
39extern bool rtl92d_phy_rf6052_config(struct ieee80211_hw *hw); 39bool rtl92d_phy_enable_anotherphy(struct ieee80211_hw *hw, bool bmac0);
40extern bool rtl92d_phy_enable_anotherphy(struct ieee80211_hw *hw, bool bmac0); 40void rtl92d_phy_powerdown_anotherphy(struct ieee80211_hw *hw, bool bmac0);
41extern void rtl92d_phy_powerdown_anotherphy(struct ieee80211_hw *hw,
42 bool bmac0);
43 41
44#endif 42#endif
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/sw.c b/drivers/net/wireless/rtlwifi/rtl8192de/sw.c
index c18c04bf0c13..edab5a5351b5 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192de/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192de/sw.c
@@ -30,6 +30,7 @@
30#include "../wifi.h" 30#include "../wifi.h"
31#include "../core.h" 31#include "../core.h"
32#include "../pci.h" 32#include "../pci.h"
33#include "../base.h"
33#include "reg.h" 34#include "reg.h"
34#include "def.h" 35#include "def.h"
35#include "phy.h" 36#include "phy.h"
@@ -236,7 +237,7 @@ static struct rtl_hal_ops rtl8192de_hal_ops = {
236 .set_bw_mode = rtl92d_phy_set_bw_mode, 237 .set_bw_mode = rtl92d_phy_set_bw_mode,
237 .switch_channel = rtl92d_phy_sw_chnl, 238 .switch_channel = rtl92d_phy_sw_chnl,
238 .dm_watchdog = rtl92d_dm_watchdog, 239 .dm_watchdog = rtl92d_dm_watchdog,
239 .scan_operation_backup = rtl92d_phy_scan_operation_backup, 240 .scan_operation_backup = rtl_phy_scan_operation_backup,
240 .set_rf_power_state = rtl92d_phy_set_rf_power_state, 241 .set_rf_power_state = rtl92d_phy_set_rf_power_state,
241 .led_control = rtl92de_led_control, 242 .led_control = rtl92de_led_control,
242 .set_desc = rtl92de_set_desc, 243 .set_desc = rtl92de_set_desc,
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/trx.c b/drivers/net/wireless/rtlwifi/rtl8192de/trx.c
index b8ec718a0fab..945ddecf90c9 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192de/trx.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192de/trx.c
@@ -526,7 +526,6 @@ bool rtl92de_rx_query_desc(struct ieee80211_hw *hw, struct rtl_stats *stats,
526 } 526 }
527 /*rx_status->qual = stats->signal; */ 527 /*rx_status->qual = stats->signal; */
528 rx_status->signal = stats->rssi + 10; 528 rx_status->signal = stats->rssi + 10;
529 /*rx_status->noise = -stats->noise; */
530 return true; 529 return true;
531} 530}
532 531
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/reg.h b/drivers/net/wireless/rtlwifi/rtl8192se/reg.h
index 84d1181795b8..c81c83591940 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/reg.h
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/reg.h
@@ -425,14 +425,9 @@
425#define EXT_IMEM_CODE_DONE BIT(2) 425#define EXT_IMEM_CODE_DONE BIT(2)
426#define IMEM_CHK_RPT BIT(1) 426#define IMEM_CHK_RPT BIT(1)
427#define IMEM_CODE_DONE BIT(0) 427#define IMEM_CODE_DONE BIT(0)
428#define IMEM_CODE_DONE BIT(0)
429#define IMEM_CHK_RPT BIT(1)
430#define EMEM_CODE_DONE BIT(2) 428#define EMEM_CODE_DONE BIT(2)
431#define EMEM_CHK_RPT BIT(3) 429#define EMEM_CHK_RPT BIT(3)
432#define DMEM_CODE_DONE BIT(4)
433#define IMEM_RDY BIT(5) 430#define IMEM_RDY BIT(5)
434#define BASECHG BIT(6)
435#define FWRDY BIT(7)
436#define LOAD_FW_READY (IMEM_CODE_DONE | \ 431#define LOAD_FW_READY (IMEM_CODE_DONE | \
437 IMEM_CHK_RPT | \ 432 IMEM_CHK_RPT | \
438 EMEM_CODE_DONE | \ 433 EMEM_CODE_DONE | \
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/trx.c b/drivers/net/wireless/rtlwifi/rtl8192se/trx.c
index c7095118de6e..222d2e792ca6 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192se/trx.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192se/trx.c
@@ -330,7 +330,6 @@ bool rtl92se_rx_query_desc(struct ieee80211_hw *hw, struct rtl_stats *stats,
330 330
331 /*rx_status->qual = stats->signal; */ 331 /*rx_status->qual = stats->signal; */
332 rx_status->signal = stats->rssi + 10; 332 rx_status->signal = stats->rssi + 10;
333 /*rx_status->noise = -stats->noise; */
334 333
335 return true; 334 return true;
336} 335}
diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/phy.c b/drivers/net/wireless/rtlwifi/rtl8723ae/phy.c
index eafbb18dd48e..5d318a85eda4 100644
--- a/drivers/net/wireless/rtlwifi/rtl8723ae/phy.c
+++ b/drivers/net/wireless/rtlwifi/rtl8723ae/phy.c
@@ -934,35 +934,6 @@ static long _phy_txpwr_idx_to_dbm(struct ieee80211_hw *hw,
934 return pwrout_dbm; 934 return pwrout_dbm;
935} 935}
936 936
937void rtl8723ae_phy_scan_operation_backup(struct ieee80211_hw *hw, u8 operation)
938{
939 struct rtl_priv *rtlpriv = rtl_priv(hw);
940 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
941 enum io_type iotype;
942
943 if (!is_hal_stop(rtlhal)) {
944 switch (operation) {
945 case SCAN_OPT_BACKUP:
946 iotype = IO_CMD_PAUSE_DM_BY_SCAN;
947 rtlpriv->cfg->ops->set_hw_reg(hw,
948 HW_VAR_IO_CMD,
949 (u8 *)&iotype);
950
951 break;
952 case SCAN_OPT_RESTORE:
953 iotype = IO_CMD_RESUME_DM_BY_SCAN;
954 rtlpriv->cfg->ops->set_hw_reg(hw,
955 HW_VAR_IO_CMD,
956 (u8 *)&iotype);
957 break;
958 default:
959 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
960 "Unknown Scan Backup operation.\n");
961 break;
962 }
963 }
964}
965
966void rtl8723ae_phy_set_bw_mode_callback(struct ieee80211_hw *hw) 937void rtl8723ae_phy_set_bw_mode_callback(struct ieee80211_hw *hw)
967{ 938{
968 struct rtl_priv *rtlpriv = rtl_priv(hw); 939 struct rtl_priv *rtlpriv = rtl_priv(hw);
diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/phy.h b/drivers/net/wireless/rtlwifi/rtl8723ae/phy.h
index e7a59eba351a..007ebdbbe108 100644
--- a/drivers/net/wireless/rtlwifi/rtl8723ae/phy.h
+++ b/drivers/net/wireless/rtlwifi/rtl8723ae/phy.h
@@ -183,42 +183,40 @@ struct tx_power_struct {
183 u32 mcs_original_offset[4][16]; 183 u32 mcs_original_offset[4][16];
184}; 184};
185 185
186extern u32 rtl8723ae_phy_query_bb_reg(struct ieee80211_hw *hw, 186u32 rtl8723ae_phy_query_bb_reg(struct ieee80211_hw *hw,
187 u32 regaddr, u32 bitmask); 187 u32 regaddr, u32 bitmask);
188extern void rtl8723ae_phy_set_bb_reg(struct ieee80211_hw *hw, 188void rtl8723ae_phy_set_bb_reg(struct ieee80211_hw *hw,
189 u32 regaddr, u32 bitmask, u32 data); 189 u32 regaddr, u32 bitmask, u32 data);
190extern u32 rtl8723ae_phy_query_rf_reg(struct ieee80211_hw *hw, 190u32 rtl8723ae_phy_query_rf_reg(struct ieee80211_hw *hw,
191 enum radio_path rfpath, u32 regaddr, 191 enum radio_path rfpath, u32 regaddr,
192 u32 bitmask); 192 u32 bitmask);
193extern void rtl8723ae_phy_set_rf_reg(struct ieee80211_hw *hw, 193void rtl8723ae_phy_set_rf_reg(struct ieee80211_hw *hw,
194 enum radio_path rfpath, u32 regaddr, 194 enum radio_path rfpath, u32 regaddr,
195 u32 bitmask, u32 data); 195 u32 bitmask, u32 data);
196extern bool rtl8723ae_phy_mac_config(struct ieee80211_hw *hw); 196bool rtl8723ae_phy_mac_config(struct ieee80211_hw *hw);
197extern bool rtl8723ae_phy_bb_config(struct ieee80211_hw *hw); 197bool rtl8723ae_phy_bb_config(struct ieee80211_hw *hw);
198extern bool rtl8723ae_phy_rf_config(struct ieee80211_hw *hw); 198bool rtl8723ae_phy_rf_config(struct ieee80211_hw *hw);
199extern bool rtl92c_phy_config_rf_with_feaderfile(struct ieee80211_hw *hw, 199bool rtl92c_phy_config_rf_with_feaderfile(struct ieee80211_hw *hw,
200 enum radio_path rfpath); 200 enum radio_path rfpath);
201extern void rtl8723ae_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw); 201void rtl8723ae_phy_get_hw_reg_originalvalue(struct ieee80211_hw *hw);
202extern void rtl8723ae_phy_get_txpower_level(struct ieee80211_hw *hw, 202void rtl8723ae_phy_get_txpower_level(struct ieee80211_hw *hw,
203 long *powerlevel); 203 long *powerlevel);
204extern void rtl8723ae_phy_set_txpower_level(struct ieee80211_hw *hw, 204void rtl8723ae_phy_set_txpower_level(struct ieee80211_hw *hw,
205 u8 channel); 205 u8 channel);
206extern bool rtl8723ae_phy_update_txpower_dbm(struct ieee80211_hw *hw, 206bool rtl8723ae_phy_update_txpower_dbm(struct ieee80211_hw *hw,
207 long power_indbm); 207 long power_indbm);
208extern void rtl8723ae_phy_scan_operation_backup(struct ieee80211_hw *hw, 208void rtl8723ae_phy_set_bw_mode_callback(struct ieee80211_hw *hw);
209 u8 operation); 209void rtl8723ae_phy_set_bw_mode(struct ieee80211_hw *hw,
210extern void rtl8723ae_phy_set_bw_mode_callback(struct ieee80211_hw *hw); 210 enum nl80211_channel_type ch_type);
211extern void rtl8723ae_phy_set_bw_mode(struct ieee80211_hw *hw, 211void rtl8723ae_phy_sw_chnl_callback(struct ieee80211_hw *hw);
212 enum nl80211_channel_type ch_type); 212u8 rtl8723ae_phy_sw_chnl(struct ieee80211_hw *hw);
213extern void rtl8723ae_phy_sw_chnl_callback(struct ieee80211_hw *hw); 213void rtl8723ae_phy_iq_calibrate(struct ieee80211_hw *hw, bool recovery);
214extern u8 rtl8723ae_phy_sw_chnl(struct ieee80211_hw *hw);
215extern void rtl8723ae_phy_iq_calibrate(struct ieee80211_hw *hw, bool recovery);
216void rtl8723ae_phy_lc_calibrate(struct ieee80211_hw *hw); 214void rtl8723ae_phy_lc_calibrate(struct ieee80211_hw *hw);
217void rtl8723ae_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain); 215void rtl8723ae_phy_set_rfpath_switch(struct ieee80211_hw *hw, bool bmain);
218bool rtl8723ae_phy_config_rf_with_headerfile(struct ieee80211_hw *hw, 216bool rtl8723ae_phy_config_rf_with_headerfile(struct ieee80211_hw *hw,
219 enum radio_path rfpath); 217 enum radio_path rfpath);
220bool rtl8723ae_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype); 218bool rtl8723ae_phy_set_io_cmd(struct ieee80211_hw *hw, enum io_type iotype);
221extern bool rtl8723ae_phy_set_rf_power_state(struct ieee80211_hw *hw, 219bool rtl8723ae_phy_set_rf_power_state(struct ieee80211_hw *hw,
222 enum rf_pwrstate rfpwr_state); 220 enum rf_pwrstate rfpwr_state);
223 221
224#endif 222#endif
diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/rf.h b/drivers/net/wireless/rtlwifi/rtl8723ae/rf.h
index d0f9dd79abea..57f1933ee663 100644
--- a/drivers/net/wireless/rtlwifi/rtl8723ae/rf.h
+++ b/drivers/net/wireless/rtlwifi/rtl8723ae/rf.h
@@ -32,12 +32,11 @@
32 32
33#define RF6052_MAX_TX_PWR 0x3F 33#define RF6052_MAX_TX_PWR 0x3F
34 34
35extern void rtl8723ae_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, 35void rtl8723ae_phy_rf6052_set_bandwidth(struct ieee80211_hw *hw, u8 bandwidth);
36 u8 bandwidth); 36void rtl8723ae_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw,
37extern void rtl8723ae_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw, 37 u8 *ppowerlevel);
38 u8 *ppowerlevel); 38void rtl8723ae_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw,
39extern void rtl8723ae_phy_rf6052_set_ofdm_txpower(struct ieee80211_hw *hw, 39 u8 *ppowerlevel, u8 channel);
40 u8 *ppowerlevel, u8 channel); 40bool rtl8723ae_phy_rf6052_config(struct ieee80211_hw *hw);
41extern bool rtl8723ae_phy_rf6052_config(struct ieee80211_hw *hw);
42 41
43#endif 42#endif
diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c b/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c
index d9ee2efffe5f..62b204faf773 100644
--- a/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c
@@ -33,6 +33,7 @@
33 33
34#include "../core.h" 34#include "../core.h"
35#include "../pci.h" 35#include "../pci.h"
36#include "../base.h"
36#include "reg.h" 37#include "reg.h"
37#include "def.h" 38#include "def.h"
38#include "phy.h" 39#include "phy.h"
@@ -220,7 +221,7 @@ static struct rtl_hal_ops rtl8723ae_hal_ops = {
220 .set_bw_mode = rtl8723ae_phy_set_bw_mode, 221 .set_bw_mode = rtl8723ae_phy_set_bw_mode,
221 .switch_channel = rtl8723ae_phy_sw_chnl, 222 .switch_channel = rtl8723ae_phy_sw_chnl,
222 .dm_watchdog = rtl8723ae_dm_watchdog, 223 .dm_watchdog = rtl8723ae_dm_watchdog,
223 .scan_operation_backup = rtl8723ae_phy_scan_operation_backup, 224 .scan_operation_backup = rtl_phy_scan_operation_backup,
224 .set_rf_power_state = rtl8723ae_phy_set_rf_power_state, 225 .set_rf_power_state = rtl8723ae_phy_set_rf_power_state,
225 .led_control = rtl8723ae_led_control, 226 .led_control = rtl8723ae_led_control,
226 .set_desc = rtl8723ae_set_desc, 227 .set_desc = rtl8723ae_set_desc,
diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/trx.c b/drivers/net/wireless/rtlwifi/rtl8723ae/trx.c
index bcd82a1020a5..50b7be3f3a60 100644
--- a/drivers/net/wireless/rtlwifi/rtl8723ae/trx.c
+++ b/drivers/net/wireless/rtlwifi/rtl8723ae/trx.c
@@ -359,7 +359,6 @@ bool rtl8723ae_rx_query_desc(struct ieee80211_hw *hw,
359 359
360 /*rx_status->qual = status->signal; */ 360 /*rx_status->qual = status->signal; */
361 rx_status->signal = status->recvsignalpower + 10; 361 rx_status->signal = status->recvsignalpower + 10;
362 /*rx_status->noise = -status->noise; */
363 362
364 return true; 363 return true;
365} 364}
diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c
index e56778cac9bf..6e2b5c5c83c8 100644
--- a/drivers/net/wireless/rtlwifi/usb.c
+++ b/drivers/net/wireless/rtlwifi/usb.c
@@ -455,7 +455,6 @@ static void _rtl_usb_rx_process_agg(struct ieee80211_hw *hw,
455 struct ieee80211_rx_status rx_status = {0}; 455 struct ieee80211_rx_status rx_status = {0};
456 struct rtl_stats stats = { 456 struct rtl_stats stats = {
457 .signal = 0, 457 .signal = 0,
458 .noise = -98,
459 .rate = 0, 458 .rate = 0,
460 }; 459 };
461 460
@@ -498,7 +497,6 @@ static void _rtl_usb_rx_process_noagg(struct ieee80211_hw *hw,
498 struct ieee80211_rx_status rx_status = {0}; 497 struct ieee80211_rx_status rx_status = {0};
499 struct rtl_stats stats = { 498 struct rtl_stats stats = {
500 .signal = 0, 499 .signal = 0,
501 .noise = -98,
502 .rate = 0, 500 .rate = 0,
503 }; 501 };
504 502
@@ -582,12 +580,15 @@ static void _rtl_rx_work(unsigned long param)
582static unsigned int _rtl_rx_get_padding(struct ieee80211_hdr *hdr, 580static unsigned int _rtl_rx_get_padding(struct ieee80211_hdr *hdr,
583 unsigned int len) 581 unsigned int len)
584{ 582{
583#if NET_IP_ALIGN != 0
585 unsigned int padding = 0; 584 unsigned int padding = 0;
585#endif
586 586
587 /* make function no-op when possible */ 587 /* make function no-op when possible */
588 if (NET_IP_ALIGN == 0 || len < sizeof(*hdr)) 588 if (NET_IP_ALIGN == 0 || len < sizeof(*hdr))
589 return 0; 589 return 0;
590 590
591#if NET_IP_ALIGN != 0
591 /* alignment calculation as in lbtf_rx() / carl9170_rx_copy_data() */ 592 /* alignment calculation as in lbtf_rx() / carl9170_rx_copy_data() */
592 /* TODO: deduplicate common code, define helper function instead? */ 593 /* TODO: deduplicate common code, define helper function instead? */
593 594
@@ -608,6 +609,7 @@ static unsigned int _rtl_rx_get_padding(struct ieee80211_hdr *hdr,
608 padding ^= NET_IP_ALIGN; 609 padding ^= NET_IP_ALIGN;
609 610
610 return padding; 611 return padding;
612#endif
611} 613}
612 614
613#define __RADIO_TAP_SIZE_RSV 32 615#define __RADIO_TAP_SIZE_RSV 32
diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h
index 703258742d28..d224dc3bb092 100644
--- a/drivers/net/wireless/rtlwifi/wifi.h
+++ b/drivers/net/wireless/rtlwifi/wifi.h
@@ -192,8 +192,6 @@ enum hardware_type {
192(IS_HARDWARE_TYPE_8192DE(rtlhal) || IS_HARDWARE_TYPE_8192DU(rtlhal)) 192(IS_HARDWARE_TYPE_8192DE(rtlhal) || IS_HARDWARE_TYPE_8192DU(rtlhal))
193#define IS_HARDWARE_TYPE_8723(rtlhal) \ 193#define IS_HARDWARE_TYPE_8723(rtlhal) \
194(IS_HARDWARE_TYPE_8723E(rtlhal) || IS_HARDWARE_TYPE_8723U(rtlhal)) 194(IS_HARDWARE_TYPE_8723E(rtlhal) || IS_HARDWARE_TYPE_8723U(rtlhal))
195#define IS_HARDWARE_TYPE_8723U(rtlhal) \
196 (rtlhal->hw_type == HARDWARE_TYPE_RTL8723U)
197 195
198#define RX_HAL_IS_CCK_RATE(_pdesc)\ 196#define RX_HAL_IS_CCK_RATE(_pdesc)\
199 (_pdesc->rxmcs == DESC92_RATE1M || \ 197 (_pdesc->rxmcs == DESC92_RATE1M || \