aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLarry Finger <Larry.Finger@lwfinger.net>2014-09-22 10:39:23 -0400
committerJohn W. Linville <linville@tuxdriver.com>2014-09-26 17:22:28 -0400
commitd3feae41a3473a0f7b431d6af4e092865d586e52 (patch)
tree43302b96adb47881f637a8a201c6a0a573aaa180
parent3c67b8f9f3b5bb1207c9bb198e5ef04ff56921dd (diff)
rtlwifi: Update power-save routines for 062814 driver
Realtek released a new version of the drivers on 06/28/2014. This patch implements the new power-save code. These changes also force corresponding changes in the drivers. Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/rtlwifi/ps.c283
-rw-r--r--drivers/net/wireless/rtlwifi/ps.h71
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8188ee/Makefile1
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8188ee/hw.c17
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8188ee/pwrseq.h18
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8188ee/pwrseqcmd.c1
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8188ee/pwrseqcmd.h4
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8723ae/Makefile1
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8723ae/hw.c1
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8723ae/pwrseqcmd.c1
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8723be/Makefile1
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8723be/hw.c15
-rw-r--r--drivers/net/wireless/rtlwifi/rtl8723be/pwrseqcmd.c1
13 files changed, 162 insertions, 253 deletions
diff --git a/drivers/net/wireless/rtlwifi/ps.c b/drivers/net/wireless/rtlwifi/ps.c
index 50504942ded1..b69321d45f04 100644
--- a/drivers/net/wireless/rtlwifi/ps.c
+++ b/drivers/net/wireless/rtlwifi/ps.c
@@ -11,10 +11,6 @@
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details. 12 * more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
17 *
18 * The full GNU General Public License is included in this distribution in the 14 * The full GNU General Public License is included in this distribution in the
19 * file called LICENSE. 15 * file called LICENSE.
20 * 16 *
@@ -27,110 +23,11 @@
27 * 23 *
28 *****************************************************************************/ 24 *****************************************************************************/
29 25
30#include <linux/export.h>
31#include "wifi.h" 26#include "wifi.h"
32#include "base.h" 27#include "base.h"
33#include "ps.h" 28#include "ps.h"
34 29#include <linux/export.h>
35/* Description: 30#include "btcoexist/rtl_btc.h"
36 * This routine deals with the Power Configuration CMD
37 * parsing for RTL8723/RTL8188E Series IC.
38 * Assumption:
39 * We should follow specific format that was released from HW SD.
40 */
41bool rtl_hal_pwrseqcmdparsing(struct rtl_priv *rtlpriv, u8 cut_version,
42 u8 faversion, u8 interface_type,
43 struct wlan_pwr_cfg pwrcfgcmd[])
44{
45 struct wlan_pwr_cfg cfg_cmd = {0};
46 bool polling_bit = false;
47 u32 ary_idx = 0;
48 u8 value = 0;
49 u32 offset = 0;
50 u32 polling_count = 0;
51 u32 max_polling_cnt = 5000;
52
53 do {
54 cfg_cmd = pwrcfgcmd[ary_idx];
55 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
56 "rtl_hal_pwrseqcmdparsing(): offset(%#x),cut_msk(%#x), famsk(%#x),"
57 "interface_msk(%#x), base(%#x), cmd(%#x), msk(%#x), value(%#x)\n",
58 GET_PWR_CFG_OFFSET(cfg_cmd),
59 GET_PWR_CFG_CUT_MASK(cfg_cmd),
60 GET_PWR_CFG_FAB_MASK(cfg_cmd),
61 GET_PWR_CFG_INTF_MASK(cfg_cmd),
62 GET_PWR_CFG_BASE(cfg_cmd), GET_PWR_CFG_CMD(cfg_cmd),
63 GET_PWR_CFG_MASK(cfg_cmd), GET_PWR_CFG_VALUE(cfg_cmd));
64
65 if ((GET_PWR_CFG_FAB_MASK(cfg_cmd)&faversion) &&
66 (GET_PWR_CFG_CUT_MASK(cfg_cmd)&cut_version) &&
67 (GET_PWR_CFG_INTF_MASK(cfg_cmd)&interface_type)) {
68 switch (GET_PWR_CFG_CMD(cfg_cmd)) {
69 case PWR_CMD_READ:
70 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
71 "rtl_hal_pwrseqcmdparsing(): PWR_CMD_READ\n");
72 break;
73 case PWR_CMD_WRITE:
74 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
75 "rtl_hal_pwrseqcmdparsing(): PWR_CMD_WRITE\n");
76 offset = GET_PWR_CFG_OFFSET(cfg_cmd);
77
78 /*Read the value from system register*/
79 value = rtl_read_byte(rtlpriv, offset);
80 value &= (~(GET_PWR_CFG_MASK(cfg_cmd)));
81 value |= (GET_PWR_CFG_VALUE(cfg_cmd) &
82 GET_PWR_CFG_MASK(cfg_cmd));
83
84 /*Write the value back to sytem register*/
85 rtl_write_byte(rtlpriv, offset, value);
86 break;
87 case PWR_CMD_POLLING:
88 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
89 "rtl_hal_pwrseqcmdparsing(): PWR_CMD_POLLING\n");
90 polling_bit = false;
91 offset = GET_PWR_CFG_OFFSET(cfg_cmd);
92
93 do {
94 value = rtl_read_byte(rtlpriv, offset);
95
96 value &= GET_PWR_CFG_MASK(cfg_cmd);
97 if (value ==
98 (GET_PWR_CFG_VALUE(cfg_cmd)
99 & GET_PWR_CFG_MASK(cfg_cmd)))
100 polling_bit = true;
101 else
102 udelay(10);
103
104 if (polling_count++ > max_polling_cnt)
105 return false;
106 } while (!polling_bit);
107 break;
108 case PWR_CMD_DELAY:
109 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
110 "rtl_hal_pwrseqcmdparsing(): PWR_CMD_DELAY\n");
111 if (GET_PWR_CFG_VALUE(cfg_cmd) ==
112 PWRSEQ_DELAY_US)
113 udelay(GET_PWR_CFG_OFFSET(cfg_cmd));
114 else
115 mdelay(GET_PWR_CFG_OFFSET(cfg_cmd));
116 break;
117 case PWR_CMD_END:
118 RT_TRACE(rtlpriv, COMP_INIT, DBG_TRACE,
119 "rtl_hal_pwrseqcmdparsing(): PWR_CMD_END\n");
120 return true;
121 default:
122 RT_ASSERT(false,
123 "rtl_hal_pwrseqcmdparsing(): Unknown CMD!!\n");
124 break;
125 }
126
127 }
128 ary_idx++;
129 } while (1);
130
131 return true;
132}
133EXPORT_SYMBOL(rtl_hal_pwrseqcmdparsing);
134 31
135bool rtl_ps_enable_nic(struct ieee80211_hw *hw) 32bool rtl_ps_enable_nic(struct ieee80211_hw *hw)
136{ 33{
@@ -181,11 +78,49 @@ EXPORT_SYMBOL(rtl_ps_disable_nic);
181 78
182bool rtl_ps_set_rf_state(struct ieee80211_hw *hw, 79bool rtl_ps_set_rf_state(struct ieee80211_hw *hw,
183 enum rf_pwrstate state_toset, 80 enum rf_pwrstate state_toset,
184 u32 changesource) 81 u32 changesource, bool protect_or_not)
185{ 82{
186 struct rtl_priv *rtlpriv = rtl_priv(hw); 83 struct rtl_priv *rtlpriv = rtl_priv(hw);
187 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); 84 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
85 enum rf_pwrstate rtstate;
188 bool actionallowed = false; 86 bool actionallowed = false;
87 u16 rfwait_cnt = 0;
88
89 if (protect_or_not)
90 goto no_protect;
91
92 /*Only one thread can change
93 *the RF state at one time, and others
94 *should wait to be executed.
95 */
96 while (true) {
97 spin_lock(&rtlpriv->locks.rf_ps_lock);
98 if (ppsc->rfchange_inprogress) {
99 spin_unlock(&rtlpriv->locks.rf_ps_lock);
100
101 RT_TRACE(rtlpriv, COMP_ERR, DBG_WARNING,
102 "RF Change in progress! Wait to set..state_toset(%d).\n",
103 state_toset);
104
105 /* Set RF after the previous action is done. */
106 while (ppsc->rfchange_inprogress) {
107 rfwait_cnt++;
108 mdelay(1);
109 /*Wait too long, return false to avoid
110 *to be stuck here.
111 */
112 if (rfwait_cnt > 100)
113 return false;
114 }
115 } else {
116 ppsc->rfchange_inprogress = true;
117 spin_unlock(&rtlpriv->locks.rf_ps_lock);
118 break;
119 }
120 }
121
122no_protect:
123 rtstate = ppsc->rfpwr_state;
189 124
190 switch (state_toset) { 125 switch (state_toset) {
191 case ERFON: 126 case ERFON:
@@ -227,6 +162,12 @@ bool rtl_ps_set_rf_state(struct ieee80211_hw *hw,
227 if (actionallowed) 162 if (actionallowed)
228 rtlpriv->cfg->ops->set_rf_power_state(hw, state_toset); 163 rtlpriv->cfg->ops->set_rf_power_state(hw, state_toset);
229 164
165 if (!protect_or_not) {
166 spin_lock(&rtlpriv->locks.rf_ps_lock);
167 ppsc->rfchange_inprogress = false;
168 spin_unlock(&rtlpriv->locks.rf_ps_lock);
169 }
170
230 return actionallowed; 171 return actionallowed;
231} 172}
232EXPORT_SYMBOL(rtl_ps_set_rf_state); 173EXPORT_SYMBOL(rtl_ps_set_rf_state);
@@ -249,12 +190,13 @@ static void _rtl_ps_inactive_ps(struct ieee80211_hw *hw)
249 } 190 }
250 } 191 }
251 192
252 rtl_ps_set_rf_state(hw, ppsc->inactive_pwrstate, RF_CHANGE_BY_IPS); 193 rtl_ps_set_rf_state(hw, ppsc->inactive_pwrstate,
194 RF_CHANGE_BY_IPS, false);
253 195
254 if (ppsc->inactive_pwrstate == ERFOFF && 196 if (ppsc->inactive_pwrstate == ERFOFF &&
255 rtlhal->interface == INTF_PCI) { 197 rtlhal->interface == INTF_PCI) {
256 if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_ASPM && 198 if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_ASPM &&
257 !RT_IN_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM)) { 199 !RT_IN_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM)) {
258 rtlpriv->intf_ops->enable_aspm(hw); 200 rtlpriv->intf_ops->enable_aspm(hw);
259 RT_SET_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM); 201 RT_SET_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM);
260 } 202 }
@@ -318,6 +260,11 @@ void rtl_ips_nic_off_wq_callback(void *data)
318 ppsc->inactive_pwrstate = ERFOFF; 260 ppsc->inactive_pwrstate = ERFOFF;
319 ppsc->in_powersavemode = true; 261 ppsc->in_powersavemode = true;
320 262
263 /* call before RF off */
264 if (rtlpriv->cfg->ops->get_btc_status())
265 rtlpriv->btcoexist.btc_ops->btc_ips_notify(rtlpriv,
266 ppsc->inactive_pwrstate);
267
321 /*rtl_pci_reset_trx_ring(hw); */ 268 /*rtl_pci_reset_trx_ring(hw); */
322 _rtl_ps_inactive_ps(hw); 269 _rtl_ps_inactive_ps(hw);
323 } 270 }
@@ -328,10 +275,9 @@ void rtl_ips_nic_off(struct ieee80211_hw *hw)
328{ 275{
329 struct rtl_priv *rtlpriv = rtl_priv(hw); 276 struct rtl_priv *rtlpriv = rtl_priv(hw);
330 277
331 /* 278 /* because when link with ap, mac80211 will ask us
332 *because when link with ap, mac80211 will ask us 279 * to disable nic quickly after scan before linking,
333 *to disable nic quickly after scan before linking, 280 * this will cause link failed, so we delay 100ms here
334 *this will cause link failed, so we delay 100ms here
335 */ 281 */
336 queue_delayed_work(rtlpriv->works.rtl_wq, 282 queue_delayed_work(rtlpriv->works.rtl_wq,
337 &rtlpriv->works.ips_nic_off_wq, MSECS(100)); 283 &rtlpriv->works.ips_nic_off_wq, MSECS(100));
@@ -343,16 +289,12 @@ void rtl_ips_nic_off(struct ieee80211_hw *hw)
343void rtl_ips_nic_on(struct ieee80211_hw *hw) 289void rtl_ips_nic_on(struct ieee80211_hw *hw)
344{ 290{
345 struct rtl_priv *rtlpriv = rtl_priv(hw); 291 struct rtl_priv *rtlpriv = rtl_priv(hw);
346 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
347 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); 292 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
348 enum rf_pwrstate rtstate; 293 enum rf_pwrstate rtstate;
349 unsigned long flags;
350
351 if (mac->opmode != NL80211_IFTYPE_STATION)
352 return;
353 294
354 spin_lock_irqsave(&rtlpriv->locks.ips_lock, flags); 295 cancel_delayed_work(&rtlpriv->works.ips_nic_off_wq);
355 296
297 spin_lock(&rtlpriv->locks.ips_lock);
356 if (ppsc->inactiveps) { 298 if (ppsc->inactiveps) {
357 rtstate = ppsc->rfpwr_state; 299 rtstate = ppsc->rfpwr_state;
358 300
@@ -362,12 +304,14 @@ void rtl_ips_nic_on(struct ieee80211_hw *hw)
362 304
363 ppsc->inactive_pwrstate = ERFON; 305 ppsc->inactive_pwrstate = ERFON;
364 ppsc->in_powersavemode = false; 306 ppsc->in_powersavemode = false;
365
366 _rtl_ps_inactive_ps(hw); 307 _rtl_ps_inactive_ps(hw);
308 /* call after RF on */
309 if (rtlpriv->cfg->ops->get_btc_status())
310 rtlpriv->btcoexist.btc_ops->btc_ips_notify(rtlpriv,
311 ppsc->inactive_pwrstate);
367 } 312 }
368 } 313 }
369 314 spin_unlock(&rtlpriv->locks.ips_lock);
370 spin_unlock_irqrestore(&rtlpriv->locks.ips_lock, flags);
371} 315}
372EXPORT_SYMBOL_GPL(rtl_ips_nic_on); 316EXPORT_SYMBOL_GPL(rtl_ips_nic_on);
373 317
@@ -404,7 +348,7 @@ static bool rtl_get_fwlps_doze(struct ieee80211_hw *hw)
404} 348}
405 349
406/* Change current and default preamble mode.*/ 350/* Change current and default preamble mode.*/
407static void rtl_lps_set_psmode(struct ieee80211_hw *hw, u8 rt_psmode) 351void rtl_lps_set_psmode(struct ieee80211_hw *hw, u8 rt_psmode)
408{ 352{
409 struct rtl_priv *rtlpriv = rtl_priv(hw); 353 struct rtl_priv *rtlpriv = rtl_priv(hw);
410 struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); 354 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
@@ -437,21 +381,24 @@ static void rtl_lps_set_psmode(struct ieee80211_hw *hw, u8 rt_psmode)
437 if (ppsc->dot11_psmode == EACTIVE) { 381 if (ppsc->dot11_psmode == EACTIVE) {
438 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, 382 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG,
439 "FW LPS leave ps_mode:%x\n", 383 "FW LPS leave ps_mode:%x\n",
440 FW_PS_ACTIVE_MODE); 384 FW_PS_ACTIVE_MODE);
441 enter_fwlps = false; 385 enter_fwlps = false;
442 ppsc->pwr_mode = FW_PS_ACTIVE_MODE; 386 ppsc->pwr_mode = FW_PS_ACTIVE_MODE;
443 ppsc->smart_ps = 0; 387 ppsc->smart_ps = 0;
444 rtlpriv->cfg->ops->set_hw_reg(hw, 388 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_FW_LPS_ACTION,
445 HW_VAR_FW_LPS_ACTION, 389 (u8 *)(&enter_fwlps));
446 (u8 *)(&enter_fwlps));
447 if (ppsc->p2p_ps_info.opp_ps) 390 if (ppsc->p2p_ps_info.opp_ps)
448 rtl_p2p_ps_cmd(hw, P2P_PS_ENABLE); 391 rtl_p2p_ps_cmd(hw , P2P_PS_ENABLE);
449 392
393 if (rtlpriv->cfg->ops->get_btc_status())
394 rtlpriv->btcoexist.btc_ops->btc_lps_notify(rtlpriv, rt_psmode);
450 } else { 395 } else {
451 if (rtl_get_fwlps_doze(hw)) { 396 if (rtl_get_fwlps_doze(hw)) {
452 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG, 397 RT_TRACE(rtlpriv, COMP_RF, DBG_DMESG,
453 "FW LPS enter ps_mode:%x\n", 398 "FW LPS enter ps_mode:%x\n",
454 ppsc->fwctrl_psmode); 399 ppsc->fwctrl_psmode);
400 if (rtlpriv->cfg->ops->get_btc_status())
401 rtlpriv->btcoexist.btc_ops->btc_lps_notify(rtlpriv, rt_psmode);
455 enter_fwlps = true; 402 enter_fwlps = true;
456 ppsc->pwr_mode = ppsc->fwctrl_psmode; 403 ppsc->pwr_mode = ppsc->fwctrl_psmode;
457 ppsc->smart_ps = 2; 404 ppsc->smart_ps = 2;
@@ -473,6 +420,7 @@ void rtl_lps_enter(struct ieee80211_hw *hw)
473 struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); 420 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
474 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); 421 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
475 struct rtl_priv *rtlpriv = rtl_priv(hw); 422 struct rtl_priv *rtlpriv = rtl_priv(hw);
423 unsigned long flag;
476 424
477 if (!ppsc->fwctrl_lps) 425 if (!ppsc->fwctrl_lps)
478 return; 426 return;
@@ -493,7 +441,7 @@ void rtl_lps_enter(struct ieee80211_hw *hw)
493 if (mac->link_state != MAC80211_LINKED) 441 if (mac->link_state != MAC80211_LINKED)
494 return; 442 return;
495 443
496 mutex_lock(&rtlpriv->locks.ps_mutex); 444 spin_lock_irqsave(&rtlpriv->locks.lps_lock, flag);
497 445
498 /* Idle for a while if we connect to AP a while ago. */ 446 /* Idle for a while if we connect to AP a while ago. */
499 if (mac->cnt_after_linked >= 2) { 447 if (mac->cnt_after_linked >= 2) {
@@ -505,8 +453,9 @@ void rtl_lps_enter(struct ieee80211_hw *hw)
505 } 453 }
506 } 454 }
507 455
508 mutex_unlock(&rtlpriv->locks.ps_mutex); 456 spin_unlock_irqrestore(&rtlpriv->locks.lps_lock, flag);
509} 457}
458EXPORT_SYMBOL(rtl_lps_enter);
510 459
511/*Leave the leisure power save mode.*/ 460/*Leave the leisure power save mode.*/
512void rtl_lps_leave(struct ieee80211_hw *hw) 461void rtl_lps_leave(struct ieee80211_hw *hw)
@@ -514,14 +463,15 @@ void rtl_lps_leave(struct ieee80211_hw *hw)
514 struct rtl_priv *rtlpriv = rtl_priv(hw); 463 struct rtl_priv *rtlpriv = rtl_priv(hw);
515 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); 464 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
516 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); 465 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
466 unsigned long flag;
517 467
518 mutex_lock(&rtlpriv->locks.ps_mutex); 468 spin_lock_irqsave(&rtlpriv->locks.lps_lock, flag);
519 469
520 if (ppsc->fwctrl_lps) { 470 if (ppsc->fwctrl_lps) {
521 if (ppsc->dot11_psmode != EACTIVE) { 471 if (ppsc->dot11_psmode != EACTIVE) {
522 472
523 /*FIX ME */ 473 /*FIX ME */
524 rtlpriv->cfg->ops->enable_interrupt(hw); 474 /*rtlpriv->cfg->ops->enable_interrupt(hw); */
525 475
526 if (ppsc->reg_rfps_level & RT_RF_LPS_LEVEL_ASPM && 476 if (ppsc->reg_rfps_level & RT_RF_LPS_LEVEL_ASPM &&
527 RT_IN_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM) && 477 RT_IN_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM) &&
@@ -536,8 +486,9 @@ void rtl_lps_leave(struct ieee80211_hw *hw)
536 rtl_lps_set_psmode(hw, EACTIVE); 486 rtl_lps_set_psmode(hw, EACTIVE);
537 } 487 }
538 } 488 }
539 mutex_unlock(&rtlpriv->locks.ps_mutex); 489 spin_unlock_irqrestore(&rtlpriv->locks.lps_lock, flag);
540} 490}
491EXPORT_SYMBOL(rtl_lps_leave);
541 492
542/* For sw LPS*/ 493/* For sw LPS*/
543void rtl_swlps_beacon(struct ieee80211_hw *hw, void *data, unsigned int len) 494void rtl_swlps_beacon(struct ieee80211_hw *hw, void *data, unsigned int len)
@@ -613,7 +564,7 @@ void rtl_swlps_beacon(struct ieee80211_hw *hw, void *data, unsigned int len)
613 /* back to low-power land. and delay is 564 /* back to low-power land. and delay is
614 * prevent null power save frame tx fail */ 565 * prevent null power save frame tx fail */
615 queue_delayed_work(rtlpriv->works.rtl_wq, 566 queue_delayed_work(rtlpriv->works.rtl_wq,
616 &rtlpriv->works.ps_work, MSECS(5)); 567 &rtlpriv->works.ps_work, MSECS(5));
617 } else { 568 } else {
618 RT_TRACE(rtlpriv, COMP_POWER, DBG_DMESG, 569 RT_TRACE(rtlpriv, COMP_POWER, DBG_DMESG,
619 "u_bufferd: %x, m_buffered: %x\n", u_buffed, m_buffed); 570 "u_bufferd: %x, m_buffered: %x\n", u_buffed, m_buffed);
@@ -626,6 +577,7 @@ void rtl_swlps_rf_awake(struct ieee80211_hw *hw)
626 struct rtl_priv *rtlpriv = rtl_priv(hw); 577 struct rtl_priv *rtlpriv = rtl_priv(hw);
627 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); 578 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
628 struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); 579 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
580 unsigned long flag;
629 581
630 if (!rtlpriv->psc.swctrl_lps) 582 if (!rtlpriv->psc.swctrl_lps)
631 return; 583 return;
@@ -633,14 +585,14 @@ void rtl_swlps_rf_awake(struct ieee80211_hw *hw)
633 return; 585 return;
634 586
635 if (ppsc->reg_rfps_level & RT_RF_LPS_LEVEL_ASPM && 587 if (ppsc->reg_rfps_level & RT_RF_LPS_LEVEL_ASPM &&
636 RT_IN_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM)) { 588 RT_IN_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM)) {
637 rtlpriv->intf_ops->disable_aspm(hw); 589 rtlpriv->intf_ops->disable_aspm(hw);
638 RT_CLEAR_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM); 590 RT_CLEAR_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM);
639 } 591 }
640 592
641 mutex_lock(&rtlpriv->locks.ps_mutex); 593 spin_lock_irqsave(&rtlpriv->locks.lps_lock, flag);
642 rtl_ps_set_rf_state(hw, ERFON, RF_CHANGE_BY_PS); 594 rtl_ps_set_rf_state(hw, ERFON, RF_CHANGE_BY_PS, false);
643 mutex_unlock(&rtlpriv->locks.ps_mutex); 595 spin_unlock_irqrestore(&rtlpriv->locks.lps_lock, flag);
644} 596}
645 597
646void rtl_swlps_rfon_wq_callback(void *data) 598void rtl_swlps_rfon_wq_callback(void *data)
@@ -657,6 +609,7 @@ void rtl_swlps_rf_sleep(struct ieee80211_hw *hw)
657 struct rtl_priv *rtlpriv = rtl_priv(hw); 609 struct rtl_priv *rtlpriv = rtl_priv(hw);
658 struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); 610 struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
659 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw)); 611 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
612 unsigned long flag;
660 u8 sleep_intv; 613 u8 sleep_intv;
661 614
662 if (!rtlpriv->psc.sw_ps_enabled) 615 if (!rtlpriv->psc.sw_ps_enabled)
@@ -673,12 +626,19 @@ void rtl_swlps_rf_sleep(struct ieee80211_hw *hw)
673 if (rtlpriv->link_info.busytraffic) 626 if (rtlpriv->link_info.busytraffic)
674 return; 627 return;
675 628
676 mutex_lock(&rtlpriv->locks.ps_mutex); 629 spin_lock(&rtlpriv->locks.rf_ps_lock);
677 rtl_ps_set_rf_state(hw, ERFSLEEP, RF_CHANGE_BY_PS); 630 if (rtlpriv->psc.rfchange_inprogress) {
678 mutex_unlock(&rtlpriv->locks.ps_mutex); 631 spin_unlock(&rtlpriv->locks.rf_ps_lock);
632 return;
633 }
634 spin_unlock(&rtlpriv->locks.rf_ps_lock);
635
636 spin_lock_irqsave(&rtlpriv->locks.lps_lock, flag);
637 rtl_ps_set_rf_state(hw, ERFSLEEP, RF_CHANGE_BY_PS , false);
638 spin_unlock_irqrestore(&rtlpriv->locks.lps_lock, flag);
679 639
680 if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_ASPM && 640 if (ppsc->reg_rfps_level & RT_RF_OFF_LEVL_ASPM &&
681 !RT_IN_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM)) { 641 !RT_IN_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM)) {
682 rtlpriv->intf_ops->enable_aspm(hw); 642 rtlpriv->intf_ops->enable_aspm(hw);
683 RT_SET_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM); 643 RT_SET_PS_LEVEL(ppsc, RT_PS_LEVEL_ASPM);
684 } 644 }
@@ -706,7 +666,7 @@ void rtl_swlps_rf_sleep(struct ieee80211_hw *hw)
706 * awake before every dtim */ 666 * awake before every dtim */
707 RT_TRACE(rtlpriv, COMP_POWER, DBG_DMESG, 667 RT_TRACE(rtlpriv, COMP_POWER, DBG_DMESG,
708 "dtim_counter:%x will sleep :%d beacon_intv\n", 668 "dtim_counter:%x will sleep :%d beacon_intv\n",
709 rtlpriv->psc.dtim_counter, sleep_intv); 669 rtlpriv->psc.dtim_counter, sleep_intv);
710 670
711 /* we tested that 40ms is enough for sw & hw sw delay */ 671 /* we tested that 40ms is enough for sw & hw sw delay */
712 queue_delayed_work(rtlpriv->works.rtl_wq, &rtlpriv->works.ps_rfon_wq, 672 queue_delayed_work(rtlpriv->works.rtl_wq, &rtlpriv->works.ps_rfon_wq,
@@ -744,7 +704,7 @@ void rtl_swlps_wq_callback(void *data)
744 704
745 if (rtlpriv->psc.state && !ps) { 705 if (rtlpriv->psc.state && !ps) {
746 rtlpriv->psc.sleep_ms = jiffies_to_msecs(jiffies - 706 rtlpriv->psc.sleep_ms = jiffies_to_msecs(jiffies -
747 rtlpriv->psc.last_action); 707 rtlpriv->psc.last_action);
748 } 708 }
749 709
750 if (ps) 710 if (ps)
@@ -764,7 +724,7 @@ static void rtl_p2p_noa_ie(struct ieee80211_hw *hw, void *data,
764 u8 *pos, *end, *ie; 724 u8 *pos, *end, *ie;
765 u16 noa_len; 725 u16 noa_len;
766 static u8 p2p_oui_ie_type[4] = {0x50, 0x6f, 0x9a, 0x09}; 726 static u8 p2p_oui_ie_type[4] = {0x50, 0x6f, 0x9a, 0x09};
767 u8 noa_num, index, i, noa_index = 0; 727 u8 noa_num, index , i, noa_index = 0;
768 bool find_p2p_ie = false , find_p2p_ps_ie = false; 728 bool find_p2p_ie = false , find_p2p_ps_ie = false;
769 pos = (u8 *)mgmt->u.beacon.variable; 729 pos = (u8 *)mgmt->u.beacon.variable;
770 end = data + len; 730 end = data + len;
@@ -814,7 +774,7 @@ static void rtl_p2p_noa_ie(struct ieee80211_hw *hw, void *data,
814 index = 5; 774 index = 5;
815 for (i = 0; i < noa_num; i++) { 775 for (i = 0; i < noa_num; i++) {
816 p2pinfo->noa_count_type[i] = 776 p2pinfo->noa_count_type[i] =
817 READEF1BYTE(ie+index); 777 READEF1BYTE(ie+index);
818 index += 1; 778 index += 1;
819 p2pinfo->noa_duration[i] = 779 p2pinfo->noa_duration[i] =
820 READEF4BYTE((__le32 *)ie+index); 780 READEF4BYTE((__le32 *)ie+index);
@@ -842,7 +802,7 @@ static void rtl_p2p_noa_ie(struct ieee80211_hw *hw, void *data,
842 rtl_p2p_ps_cmd(hw, P2P_PS_DISABLE); 802 rtl_p2p_ps_cmd(hw, P2P_PS_DISABLE);
843 } 803 }
844 } 804 }
845 break; 805 break;
846 } 806 }
847 ie += 3 + noa_len; 807 ie += 3 + noa_len;
848 } 808 }
@@ -860,7 +820,7 @@ static void rtl_p2p_action_ie(struct ieee80211_hw *hw, void *data,
860 struct rtl_priv *rtlpriv = rtl_priv(hw); 820 struct rtl_priv *rtlpriv = rtl_priv(hw);
861 struct ieee80211_mgmt *mgmt = data; 821 struct ieee80211_mgmt *mgmt = data;
862 struct rtl_p2p_ps_info *p2pinfo = &(rtlpriv->psc.p2p_ps_info); 822 struct rtl_p2p_ps_info *p2pinfo = &(rtlpriv->psc.p2p_ps_info);
863 u8 noa_num, index, i, noa_index = 0; 823 u8 noa_num, index , i , noa_index = 0;
864 u8 *pos, *end, *ie; 824 u8 *pos, *end, *ie;
865 u16 noa_len; 825 u16 noa_len;
866 static u8 p2p_oui_ie_type[4] = {0x50, 0x6f, 0x9a, 0x09}; 826 static u8 p2p_oui_ie_type[4] = {0x50, 0x6f, 0x9a, 0x09};
@@ -906,7 +866,7 @@ static void rtl_p2p_action_ie(struct ieee80211_hw *hw, void *data,
906 index = 5; 866 index = 5;
907 for (i = 0; i < noa_num; i++) { 867 for (i = 0; i < noa_num; i++) {
908 p2pinfo->noa_count_type[i] = 868 p2pinfo->noa_count_type[i] =
909 READEF1BYTE(ie+index); 869 READEF1BYTE(ie+index);
910 index += 1; 870 index += 1;
911 p2pinfo->noa_duration[i] = 871 p2pinfo->noa_duration[i] =
912 READEF4BYTE((__le32 *)ie+index); 872 READEF4BYTE((__le32 *)ie+index);
@@ -934,37 +894,37 @@ static void rtl_p2p_action_ie(struct ieee80211_hw *hw, void *data,
934 rtl_p2p_ps_cmd(hw, P2P_PS_DISABLE); 894 rtl_p2p_ps_cmd(hw, P2P_PS_DISABLE);
935 } 895 }
936 } 896 }
937 break; 897 break;
938 } 898 }
939 ie += 3 + noa_len; 899 ie += 3 + noa_len;
940 } 900 }
941} 901}
942 902
943void rtl_p2p_ps_cmd(struct ieee80211_hw *hw, u8 p2p_ps_state) 903void rtl_p2p_ps_cmd(struct ieee80211_hw *hw , u8 p2p_ps_state)
944{ 904{
945 struct rtl_priv *rtlpriv = rtl_priv(hw); 905 struct rtl_priv *rtlpriv = rtl_priv(hw);
946 struct rtl_ps_ctl *rtlps = rtl_psc(rtl_priv(hw)); 906 struct rtl_ps_ctl *rtlps = rtl_psc(rtl_priv(hw));
947 struct rtl_p2p_ps_info *p2pinfo = &(rtlpriv->psc.p2p_ps_info); 907 struct rtl_p2p_ps_info *p2pinfo = &(rtlpriv->psc.p2p_ps_info);
948 908
949 RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, " p2p state %x\n", p2p_ps_state); 909 RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, " p2p state %x\n" , p2p_ps_state);
950 switch (p2p_ps_state) { 910 switch (p2p_ps_state) {
951 case P2P_PS_DISABLE: 911 case P2P_PS_DISABLE:
952 p2pinfo->p2p_ps_state = p2p_ps_state; 912 p2pinfo->p2p_ps_state = p2p_ps_state;
953 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_H2C_FW_P2P_PS_OFFLOAD, 913 rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_H2C_FW_P2P_PS_OFFLOAD,
954 &p2p_ps_state); 914 &p2p_ps_state);
955
956 p2pinfo->noa_index = 0; 915 p2pinfo->noa_index = 0;
957 p2pinfo->ctwindow = 0; 916 p2pinfo->ctwindow = 0;
958 p2pinfo->opp_ps = 0; 917 p2pinfo->opp_ps = 0;
959 p2pinfo->noa_num = 0; 918 p2pinfo->noa_num = 0;
960 p2pinfo->p2p_ps_mode = P2P_PS_NONE; 919 p2pinfo->p2p_ps_mode = P2P_PS_NONE;
961 if (rtlps->fw_current_inpsmode == true) { 920 if (rtlps->fw_current_inpsmode) {
962 if (rtlps->smart_ps == 0) { 921 if (rtlps->smart_ps == 0) {
963 rtlps->smart_ps = 2; 922 rtlps->smart_ps = 2;
964 rtlpriv->cfg->ops->set_hw_reg(hw, 923 rtlpriv->cfg->ops->set_hw_reg(hw,
965 HW_VAR_H2C_FW_PWRMODE, 924 HW_VAR_H2C_FW_PWRMODE,
966 &rtlps->pwr_mode); 925 &rtlps->pwr_mode);
967 } 926 }
927
968 } 928 }
969 break; 929 break;
970 case P2P_PS_ENABLE: 930 case P2P_PS_ENABLE:
@@ -982,6 +942,7 @@ void rtl_p2p_ps_cmd(struct ieee80211_hw *hw, u8 p2p_ps_state)
982 rtlpriv->cfg->ops->set_hw_reg(hw, 942 rtlpriv->cfg->ops->set_hw_reg(hw,
983 HW_VAR_H2C_FW_P2P_PS_OFFLOAD, 943 HW_VAR_H2C_FW_P2P_PS_OFFLOAD,
984 &p2p_ps_state); 944 &p2p_ps_state);
945
985 } 946 }
986 break; 947 break;
987 case P2P_PS_SCAN: 948 case P2P_PS_SCAN:
@@ -998,12 +959,16 @@ void rtl_p2p_ps_cmd(struct ieee80211_hw *hw, u8 p2p_ps_state)
998 break; 959 break;
999 } 960 }
1000 RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, 961 RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD,
1001 "ctwindow %x oppps %x\n", p2pinfo->ctwindow, p2pinfo->opp_ps); 962 "ctwindow %x oppps %x\n",
963 p2pinfo->ctwindow , p2pinfo->opp_ps);
1002 RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, 964 RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD,
1003 "count %x duration %x index %x interval %x start time %x noa num %x\n", 965 "count %x duration %x index %x interval %x start time %x noa num %x\n",
1004 p2pinfo->noa_count_type[0], p2pinfo->noa_duration[0], 966 p2pinfo->noa_count_type[0],
1005 p2pinfo->noa_index, p2pinfo->noa_interval[0], 967 p2pinfo->noa_duration[0],
1006 p2pinfo->noa_start_time[0], p2pinfo->noa_num); 968 p2pinfo->noa_index,
969 p2pinfo->noa_interval[0],
970 p2pinfo->noa_start_time[0],
971 p2pinfo->noa_num);
1007 RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, "end\n"); 972 RT_TRACE(rtlpriv, COMP_FW, DBG_LOUD, "end\n");
1008} 973}
1009 974
@@ -1032,8 +997,8 @@ void rtl_p2p_info(struct ieee80211_hw *hw, void *data, unsigned int len)
1032 return; 997 return;
1033 998
1034 if (ieee80211_is_action(hdr->frame_control)) 999 if (ieee80211_is_action(hdr->frame_control))
1035 rtl_p2p_action_ie(hw, data, len - FCS_LEN); 1000 rtl_p2p_action_ie(hw , data , len - FCS_LEN);
1036 else 1001 else
1037 rtl_p2p_noa_ie(hw, data, len - FCS_LEN); 1002 rtl_p2p_noa_ie(hw , data , len - FCS_LEN);
1038} 1003}
1039EXPORT_SYMBOL_GPL(rtl_p2p_info); 1004EXPORT_SYMBOL_GPL(rtl_p2p_info);
diff --git a/drivers/net/wireless/rtlwifi/ps.h b/drivers/net/wireless/rtlwifi/ps.h
index 3bd41f958974..29dfc514212d 100644
--- a/drivers/net/wireless/rtlwifi/ps.h
+++ b/drivers/net/wireless/rtlwifi/ps.h
@@ -11,10 +11,6 @@
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details. 12 * more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
17 *
18 * The full GNU General Public License is included in this distribution in the 14 * The full GNU General Public License is included in this distribution in the
19 * file called LICENSE. 15 * file called LICENSE.
20 * 16 *
@@ -32,68 +28,9 @@
32 28
33#define MAX_SW_LPS_SLEEP_INTV 5 29#define MAX_SW_LPS_SLEEP_INTV 5
34 30
35/*---------------------------------------------
36 * 3 The value of cmd: 4 bits
37 *---------------------------------------------
38 */
39#define PWR_CMD_READ 0x00
40#define PWR_CMD_WRITE 0x01
41#define PWR_CMD_POLLING 0x02
42#define PWR_CMD_DELAY 0x03
43#define PWR_CMD_END 0x04
44
45/* define the base address of each block */
46#define PWR_BASEADDR_MAC 0x00
47#define PWR_BASEADDR_USB 0x01
48#define PWR_BASEADDR_PCIE 0x02
49#define PWR_BASEADDR_SDIO 0x03
50
51#define PWR_FAB_ALL_MSK (BIT(0)|BIT(1)|BIT(2)|BIT(3))
52#define PWR_CUT_TESTCHIP_MSK BIT(0)
53#define PWR_CUT_A_MSK BIT(1)
54#define PWR_CUT_B_MSK BIT(2)
55#define PWR_CUT_C_MSK BIT(3)
56#define PWR_CUT_D_MSK BIT(4)
57#define PWR_CUT_E_MSK BIT(5)
58#define PWR_CUT_F_MSK BIT(6)
59#define PWR_CUT_G_MSK BIT(7)
60#define PWR_CUT_ALL_MSK 0xFF
61#define PWR_INTF_SDIO_MSK BIT(0)
62#define PWR_INTF_USB_MSK BIT(1)
63#define PWR_INTF_PCI_MSK BIT(2)
64#define PWR_INTF_ALL_MSK (BIT(0)|BIT(1)|BIT(2)|BIT(3))
65
66enum pwrseq_delay_unit {
67 PWRSEQ_DELAY_US,
68 PWRSEQ_DELAY_MS,
69};
70
71struct wlan_pwr_cfg {
72 u16 offset;
73 u8 cut_msk;
74 u8 fab_msk:4;
75 u8 interface_msk:4;
76 u8 base:4;
77 u8 cmd:4;
78 u8 msk;
79 u8 value;
80};
81
82#define GET_PWR_CFG_OFFSET(__PWR_CMD) (__PWR_CMD.offset)
83#define GET_PWR_CFG_CUT_MASK(__PWR_CMD) (__PWR_CMD.cut_msk)
84#define GET_PWR_CFG_FAB_MASK(__PWR_CMD) (__PWR_CMD.fab_msk)
85#define GET_PWR_CFG_INTF_MASK(__PWR_CMD) (__PWR_CMD.interface_msk)
86#define GET_PWR_CFG_BASE(__PWR_CMD) (__PWR_CMD.base)
87#define GET_PWR_CFG_CMD(__PWR_CMD) (__PWR_CMD.cmd)
88#define GET_PWR_CFG_MASK(__PWR_CMD) (__PWR_CMD.msk)
89#define GET_PWR_CFG_VALUE(__PWR_CMD) (__PWR_CMD.value)
90
91bool rtl_hal_pwrseqcmdparsing(struct rtl_priv *rtlpriv, u8 cut_version,
92 u8 fab_version, u8 interface_type,
93 struct wlan_pwr_cfg pwrcfgcmd[]);
94
95bool rtl_ps_set_rf_state(struct ieee80211_hw *hw, 31bool rtl_ps_set_rf_state(struct ieee80211_hw *hw,
96 enum rf_pwrstate state_toset, u32 changesource); 32 enum rf_pwrstate state_toset, u32 changesource,
33 bool protect_or_not);
97bool rtl_ps_enable_nic(struct ieee80211_hw *hw); 34bool rtl_ps_enable_nic(struct ieee80211_hw *hw);
98bool rtl_ps_disable_nic(struct ieee80211_hw *hw); 35bool rtl_ps_disable_nic(struct ieee80211_hw *hw);
99void rtl_ips_nic_off(struct ieee80211_hw *hw); 36void rtl_ips_nic_off(struct ieee80211_hw *hw);
@@ -102,12 +39,14 @@ void rtl_ips_nic_off_wq_callback(void *data);
102void rtl_lps_enter(struct ieee80211_hw *hw); 39void rtl_lps_enter(struct ieee80211_hw *hw);
103void rtl_lps_leave(struct ieee80211_hw *hw); 40void rtl_lps_leave(struct ieee80211_hw *hw);
104 41
42void rtl_lps_set_psmode(struct ieee80211_hw *hw, u8 rt_psmode);
43
105void rtl_swlps_beacon(struct ieee80211_hw *hw, void *data, unsigned int len); 44void rtl_swlps_beacon(struct ieee80211_hw *hw, void *data, unsigned int len);
106void rtl_swlps_wq_callback(void *data); 45void rtl_swlps_wq_callback(void *data);
107void rtl_swlps_rfon_wq_callback(void *data); 46void rtl_swlps_rfon_wq_callback(void *data);
108void rtl_swlps_rf_awake(struct ieee80211_hw *hw); 47void rtl_swlps_rf_awake(struct ieee80211_hw *hw);
109void rtl_swlps_rf_sleep(struct ieee80211_hw *hw); 48void rtl_swlps_rf_sleep(struct ieee80211_hw *hw);
110void rtl_p2p_ps_cmd(struct ieee80211_hw *hw, u8 p2p_ps_state); 49void rtl_p2p_ps_cmd(struct ieee80211_hw *hw , u8 p2p_ps_state);
111void rtl_p2p_info(struct ieee80211_hw *hw, void *data, unsigned int len); 50void rtl_p2p_info(struct ieee80211_hw *hw, void *data, unsigned int len);
112void rtl_lps_change_work_callback(struct work_struct *work); 51void rtl_lps_change_work_callback(struct work_struct *work);
113 52
diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/Makefile b/drivers/net/wireless/rtlwifi/rtl8188ee/Makefile
index a85419a37651..5b194e97f4b3 100644
--- a/drivers/net/wireless/rtlwifi/rtl8188ee/Makefile
+++ b/drivers/net/wireless/rtlwifi/rtl8188ee/Makefile
@@ -5,6 +5,7 @@ rtl8188ee-objs := \
5 led.o \ 5 led.o \
6 phy.o \ 6 phy.o \
7 pwrseq.o \ 7 pwrseq.o \
8 pwrseqcmd.o \
8 rf.o \ 9 rf.o \
9 sw.o \ 10 sw.o \
10 table.o \ 11 table.o \
diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/hw.c b/drivers/net/wireless/rtlwifi/rtl8188ee/hw.c
index d840ad7bdf65..ba639bb7457c 100644
--- a/drivers/net/wireless/rtlwifi/rtl8188ee/hw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8188ee/hw.c
@@ -41,6 +41,7 @@
41#include "fw.h" 41#include "fw.h"
42#include "led.h" 42#include "led.h"
43#include "hw.h" 43#include "hw.h"
44#include "pwrseqcmd.h"
44#include "pwrseq.h" 45#include "pwrseq.h"
45 46
46#define LLT_CONFIG 5 47#define LLT_CONFIG 5
@@ -809,9 +810,9 @@ static bool _rtl88ee_init_mac(struct ieee80211_hw *hw)
809 810
810 rtl_write_byte(rtlpriv, REG_RSV_CTRL, 0x00); 811 rtl_write_byte(rtlpriv, REG_RSV_CTRL, 0x00);
811 /* HW Power on sequence */ 812 /* HW Power on sequence */
812 if (!rtl_hal_pwrseqcmdparsing(rtlpriv, PWR_CUT_ALL_MSK, 813 if (!rtl88_hal_pwrseqcmdparsing(rtlpriv, PWR_CUT_ALL_MSK,
813 PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK, 814 PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,
814 Rtl8188E_NIC_ENABLE_FLOW)) { 815 RTL8188E_NIC_ENABLE_FLOW)) {
815 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 816 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
816 "init MAC Fail as rtl_hal_pwrseqcmdparsing\n"); 817 "init MAC Fail as rtl_hal_pwrseqcmdparsing\n");
817 return false; 818 return false;
@@ -1352,9 +1353,9 @@ static void _rtl88ee_poweroff_adapter(struct ieee80211_hw *hw)
1352 } 1353 }
1353 rtl_write_byte(rtlpriv, REG_PCIE_CTRL_REG+1, 0xFF); 1354 rtl_write_byte(rtlpriv, REG_PCIE_CTRL_REG+1, 0xFF);
1354 1355
1355 rtl_hal_pwrseqcmdparsing(rtlpriv, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, 1356 rtl88_hal_pwrseqcmdparsing(rtlpriv, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK,
1356 PWR_INTF_PCI_MSK, 1357 PWR_INTF_PCI_MSK,
1357 Rtl8188E_NIC_LPS_ENTER_FLOW); 1358 RTL8188E_NIC_LPS_ENTER_FLOW);
1358 1359
1359 rtl_write_byte(rtlpriv, REG_RF_CTRL, 0x00); 1360 rtl_write_byte(rtlpriv, REG_RF_CTRL, 0x00);
1360 1361
@@ -1368,8 +1369,8 @@ static void _rtl88ee_poweroff_adapter(struct ieee80211_hw *hw)
1368 u1b_tmp = rtl_read_byte(rtlpriv, REG_32K_CTRL); 1369 u1b_tmp = rtl_read_byte(rtlpriv, REG_32K_CTRL);
1369 rtl_write_byte(rtlpriv, REG_32K_CTRL, (u1b_tmp & (~BIT(0)))); 1370 rtl_write_byte(rtlpriv, REG_32K_CTRL, (u1b_tmp & (~BIT(0))));
1370 1371
1371 rtl_hal_pwrseqcmdparsing(rtlpriv, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, 1372 rtl88_hal_pwrseqcmdparsing(rtlpriv, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK,
1372 PWR_INTF_PCI_MSK, Rtl8188E_NIC_DISABLE_FLOW); 1373 PWR_INTF_PCI_MSK, RTL8188E_NIC_DISABLE_FLOW);
1373 1374
1374 u1b_tmp = rtl_read_byte(rtlpriv, REG_RSV_CTRL+1); 1375 u1b_tmp = rtl_read_byte(rtlpriv, REG_RSV_CTRL+1);
1375 rtl_write_byte(rtlpriv, REG_RSV_CTRL+1, (u1b_tmp & (~BIT(3)))); 1376 rtl_write_byte(rtlpriv, REG_RSV_CTRL+1, (u1b_tmp & (~BIT(3))));
diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/pwrseq.h b/drivers/net/wireless/rtlwifi/rtl8188ee/pwrseq.h
index 32e135ab9a63..45c7f4ada9fb 100644
--- a/drivers/net/wireless/rtlwifi/rtl8188ee/pwrseq.h
+++ b/drivers/net/wireless/rtlwifi/rtl8188ee/pwrseq.h
@@ -313,14 +313,14 @@ extern struct wlan_pwr_cfg rtl8188e_leave_lps_flow
313 RTL8188E_TRANS_END_STEPS]; 313 RTL8188E_TRANS_END_STEPS];
314 314
315/* RTL8723 Power Configuration CMDs for PCIe interface */ 315/* RTL8723 Power Configuration CMDs for PCIe interface */
316#define Rtl8188E_NIC_PWR_ON_FLOW rtl8188e_power_on_flow 316#define RTL8188E_NIC_PWR_ON_FLOW rtl8188e_power_on_flow
317#define Rtl8188E_NIC_RF_OFF_FLOW rtl8188e_radio_off_flow 317#define RTL8188E_NIC_RF_OFF_FLOW rtl8188e_radio_off_flow
318#define Rtl8188E_NIC_DISABLE_FLOW rtl8188e_card_disable_flow 318#define RTL8188E_NIC_DISABLE_FLOW rtl8188e_card_disable_flow
319#define Rtl8188E_NIC_ENABLE_FLOW rtl8188e_card_enable_flow 319#define RTL8188E_NIC_ENABLE_FLOW rtl8188e_card_enable_flow
320#define Rtl8188E_NIC_SUSPEND_FLOW rtl8188e_suspend_flow 320#define RTL8188E_NIC_SUSPEND_FLOW rtl8188e_suspend_flow
321#define Rtl8188E_NIC_RESUME_FLOW rtl8188e_resume_flow 321#define RTL8188E_NIC_RESUME_FLOW rtl8188e_resume_flow
322#define Rtl8188E_NIC_PDN_FLOW rtl8188e_hwpdn_flow 322#define RTL8188E_NIC_PDN_FLOW rtl8188e_hwpdn_flow
323#define Rtl8188E_NIC_LPS_ENTER_FLOW rtl8188e_enter_lps_flow 323#define RTL8188E_NIC_LPS_ENTER_FLOW rtl8188e_enter_lps_flow
324#define Rtl8188E_NIC_LPS_LEAVE_FLOW rtl8188e_leave_lps_flow 324#define RTL8188E_NIC_LPS_LEAVE_FLOW rtl8188e_leave_lps_flow
325 325
326#endif 326#endif
diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/pwrseqcmd.c b/drivers/net/wireless/rtlwifi/rtl8188ee/pwrseqcmd.c
index 0f9314205526..3a95ddb3257f 100644
--- a/drivers/net/wireless/rtlwifi/rtl8188ee/pwrseqcmd.c
+++ b/drivers/net/wireless/rtlwifi/rtl8188ee/pwrseqcmd.c
@@ -27,6 +27,7 @@
27 * 27 *
28 *****************************************************************************/ 28 *****************************************************************************/
29 29
30#include "pwrseqcmd.h"
30#include "pwrseq.h" 31#include "pwrseq.h"
31 32
32 33
diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/pwrseqcmd.h b/drivers/net/wireless/rtlwifi/rtl8188ee/pwrseqcmd.h
index d9ae280bb1a2..a6cdb0d851a9 100644
--- a/drivers/net/wireless/rtlwifi/rtl8188ee/pwrseqcmd.h
+++ b/drivers/net/wireless/rtlwifi/rtl8188ee/pwrseqcmd.h
@@ -11,10 +11,6 @@
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details. 12 * more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
17 *
18 * The full GNU General Public License is included in this distribution in the 14 * The full GNU General Public License is included in this distribution in the
19 * file called LICENSE. 15 * file called LICENSE.
20 * 16 *
diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/Makefile b/drivers/net/wireless/rtlwifi/rtl8723ae/Makefile
index 9c34a85fdb89..4ed731f09b1f 100644
--- a/drivers/net/wireless/rtlwifi/rtl8723ae/Makefile
+++ b/drivers/net/wireless/rtlwifi/rtl8723ae/Makefile
@@ -10,6 +10,7 @@ rtl8723ae-objs := \
10 led.o \ 10 led.o \
11 phy.o \ 11 phy.o \
12 pwrseq.o \ 12 pwrseq.o \
13 pwrseqcmd.o \
13 rf.o \ 14 rf.o \
14 sw.o \ 15 sw.o \
15 table.o \ 16 table.o \
diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/hw.c b/drivers/net/wireless/rtlwifi/rtl8723ae/hw.c
index 662a079f76f3..dd8e76cb03aa 100644
--- a/drivers/net/wireless/rtlwifi/rtl8723ae/hw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8723ae/hw.c
@@ -43,6 +43,7 @@
43#include "../rtl8723com/fw_common.h" 43#include "../rtl8723com/fw_common.h"
44#include "led.h" 44#include "led.h"
45#include "hw.h" 45#include "hw.h"
46#include "pwrseqcmd.h"
46#include "pwrseq.h" 47#include "pwrseq.h"
47#include "btc.h" 48#include "btc.h"
48 49
diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/pwrseqcmd.c b/drivers/net/wireless/rtlwifi/rtl8723ae/pwrseqcmd.c
index 2044b5936b7f..239eb4473dd1 100644
--- a/drivers/net/wireless/rtlwifi/rtl8723ae/pwrseqcmd.c
+++ b/drivers/net/wireless/rtlwifi/rtl8723ae/pwrseqcmd.c
@@ -27,6 +27,7 @@
27 * 27 *
28 *****************************************************************************/ 28 *****************************************************************************/
29 29
30#include "pwrseqcmd.h"
30#include "pwrseq.h" 31#include "pwrseq.h"
31 32
32/* Description: 33/* Description:
diff --git a/drivers/net/wireless/rtlwifi/rtl8723be/Makefile b/drivers/net/wireless/rtlwifi/rtl8723be/Makefile
index 59e416abd93a..4a75aab0539a 100644
--- a/drivers/net/wireless/rtlwifi/rtl8723be/Makefile
+++ b/drivers/net/wireless/rtlwifi/rtl8723be/Makefile
@@ -8,6 +8,7 @@ rtl8723be-objs := \
8 led.o \ 8 led.o \
9 phy.o \ 9 phy.o \
10 pwrseq.o \ 10 pwrseq.o \
11 pwrseqcmd.o \
11 rf.o \ 12 rf.o \
12 sw.o \ 13 sw.o \
13 table.o \ 14 table.o \
diff --git a/drivers/net/wireless/rtlwifi/rtl8723be/hw.c b/drivers/net/wireless/rtlwifi/rtl8723be/hw.c
index 3cd286930fe0..1b939183f39d 100644
--- a/drivers/net/wireless/rtlwifi/rtl8723be/hw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8723be/hw.c
@@ -39,6 +39,7 @@
39#include "../rtl8723com/fw_common.h" 39#include "../rtl8723com/fw_common.h"
40#include "led.h" 40#include "led.h"
41#include "hw.h" 41#include "hw.h"
42#include "pwrseqcmd.h"
42#include "pwrseq.h" 43#include "pwrseq.h"
43#include "../btcoexist/rtl_btc.h" 44#include "../btcoexist/rtl_btc.h"
44 45
@@ -814,9 +815,9 @@ static bool _rtl8723be_init_mac(struct ieee80211_hw *hw)
814 mac_func_enable = false; 815 mac_func_enable = false;
815 816
816 /* HW Power on sequence */ 817 /* HW Power on sequence */
817 if (!rtl_hal_pwrseqcmdparsing(rtlpriv, PWR_CUT_ALL_MSK, 818 if (!rtlbe_hal_pwrseqcmdparsing(rtlpriv, PWR_CUT_ALL_MSK,
818 PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK, 819 PWR_FAB_ALL_MSK, PWR_INTF_PCI_MSK,
819 RTL8723_NIC_ENABLE_FLOW)) { 820 RTL8723_NIC_ENABLE_FLOW)) {
820 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, 821 RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
821 "init MAC Fail as power on failure\n"); 822 "init MAC Fail as power on failure\n");
822 return false; 823 return false;
@@ -1305,8 +1306,8 @@ static void _rtl8723be_poweroff_adapter(struct ieee80211_hw *hw)
1305 1306
1306 /* Combo (PCIe + USB) Card and PCIe-MF Card */ 1307 /* Combo (PCIe + USB) Card and PCIe-MF Card */
1307 /* 1. Run LPS WL RFOFF flow */ 1308 /* 1. Run LPS WL RFOFF flow */
1308 rtl_hal_pwrseqcmdparsing(rtlpriv, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, 1309 rtlbe_hal_pwrseqcmdparsing(rtlpriv, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK,
1309 PWR_INTF_PCI_MSK, RTL8723_NIC_LPS_ENTER_FLOW); 1310 PWR_INTF_PCI_MSK, RTL8723_NIC_LPS_ENTER_FLOW);
1310 1311
1311 /* 2. 0x1F[7:0] = 0 */ 1312 /* 2. 0x1F[7:0] = 0 */
1312 /* turn off RF */ 1313 /* turn off RF */
@@ -1324,8 +1325,8 @@ static void _rtl8723be_poweroff_adapter(struct ieee80211_hw *hw)
1324 rtl_write_byte(rtlpriv, REG_MCUFWDL, 0x00); 1325 rtl_write_byte(rtlpriv, REG_MCUFWDL, 0x00);
1325 1326
1326 /* HW card disable configuration. */ 1327 /* HW card disable configuration. */
1327 rtl_hal_pwrseqcmdparsing(rtlpriv, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, 1328 rtlbe_hal_pwrseqcmdparsing(rtlpriv, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK,
1328 PWR_INTF_PCI_MSK, RTL8723_NIC_DISABLE_FLOW); 1329 PWR_INTF_PCI_MSK, RTL8723_NIC_DISABLE_FLOW);
1329 1330
1330 /* Reset MCU IO Wrapper */ 1331 /* Reset MCU IO Wrapper */
1331 u1b_tmp = rtl_read_byte(rtlpriv, REG_RSV_CTRL + 1); 1332 u1b_tmp = rtl_read_byte(rtlpriv, REG_RSV_CTRL + 1);
diff --git a/drivers/net/wireless/rtlwifi/rtl8723be/pwrseqcmd.c b/drivers/net/wireless/rtlwifi/rtl8723be/pwrseqcmd.c
index 4573310c707f..cf57a4964ad3 100644
--- a/drivers/net/wireless/rtlwifi/rtl8723be/pwrseqcmd.c
+++ b/drivers/net/wireless/rtlwifi/rtl8723be/pwrseqcmd.c
@@ -23,6 +23,7 @@
23 * 23 *
24 *****************************************************************************/ 24 *****************************************************************************/
25 25
26#include "pwrseqcmd.h"
26#include "pwrseq.h" 27#include "pwrseq.h"
27 28
28/* Description: 29/* Description: