30 #include <linux/export.h>
43 rtlpriv->
intf_ops->reset_trx_ring(hw);
45 if (is_hal_stop(rtlhal))
47 "Driver is already down!\n");
50 if (rtlpriv->
cfg->ops->hw_init(hw))
55 rtlpriv->
cfg->ops->enable_interrupt(hw);
72 rtlpriv->
cfg->ops->disable_interrupt(hw);
76 rtlpriv->
cfg->ops->hw_disable(hw);
88 bool actionallowed =
false;
90 switch (state_toset) {
101 actionallowed =
true;
113 actionallowed =
true;
118 actionallowed =
true;
123 "switch case not processed\n");
128 rtlpriv->
cfg->ops->set_rf_power_state(hw, state_toset);
130 return actionallowed;
147 rtlpriv->
intf_ops->disable_aspm(hw);
179 "not station return\n");
186 if (is_hal_stop(rtlhal))
189 if (rtlpriv->
sec.being_setkey)
205 if (rtstate ==
ERFON &&
210 "IPSEnter(): Turn off RF\n");
216 _rtl_ps_inactive_ps(hw);
250 if (rtstate !=
ERFON &&
257 _rtl_ps_inactive_ps(hw);
261 spin_unlock_irqrestore(&rtlpriv->
locks.ips_lock, flags);
281 if (ps_timediff < 2000) {
283 "Delay enter Fw LPS for DHCP, ARP, or EAPOL exchanging state\n");
302 u8 rpwm_val, fw_pwrmode;
327 bool fw_current_inps;
330 "FW LPS leave ps_mode:%x\n",
337 rtlpriv->
cfg->ops->set_hw_reg(hw,
340 fw_current_inps =
false;
342 rtlpriv->
cfg->ops->set_hw_reg(hw,
344 (
u8 *) (&fw_current_inps));
347 if (rtl_get_fwlps_doze(hw)) {
349 "FW LPS enter ps_mode:%x\n",
353 fw_current_inps =
true;
354 rtlpriv->
cfg->ops->set_hw_reg(hw,
356 (
u8 *) (&fw_current_inps));
357 rtlpriv->
cfg->ops->set_hw_reg(hw,
361 rtlpriv->
cfg->ops->set_hw_reg(hw,
382 if (rtlpriv->
sec.being_setkey)
404 "Enter 802.11 power save mode...\n");
406 rtl_lps_set_psmode(hw,
EAUTOPS);
426 rtlpriv->
cfg->ops->enable_interrupt(hw);
431 rtlpriv->
intf_ops->disable_aspm(hw);
436 "Busy Traffic,Leave 802.11 power save..\n");
438 rtl_lps_set_psmode(hw,
EACTIVE);
459 if (!rtlpriv->
psc.swctrl_lps)
465 if (!rtlpriv->
psc.sw_ps_enabled)
468 if (rtlpriv->
psc.fwctrl_lps)
492 if (tim[1] <
sizeof(*tim_ie))
504 u_buffed = ieee80211_check_tim(tim_ie, tim_len,
509 rtlpriv->
psc.multi_buffered = m_buffed;
521 "u_bufferd: %x, m_buffered: %x\n", u_buffed, m_buffed);
531 if (!rtlpriv->
psc.swctrl_lps)
538 rtlpriv->
intf_ops->disable_aspm(hw);
563 if (!rtlpriv->
psc.sw_ps_enabled)
566 if ((rtlpriv->
sec.being_setkey) ||
593 if (rtlpriv->
psc.dtim_counter == 0) {
594 if (hw->
conf.ps_dtim_period == 1)
595 sleep_intv = hw->
conf.ps_dtim_period * 2;
597 sleep_intv = hw->
conf.ps_dtim_period;
599 sleep_intv = rtlpriv->
psc.dtim_counter;
609 "dtim_counter:%x will sleep :%d beacon_intv\n",
610 rtlpriv->
psc.dtim_counter, sleep_intv);
614 MSECS(sleep_intv * mac->
vif->bss_conf.beacon_int - 40));
630 if (rtlpriv->
psc.state_inap) {
633 if (rtlpriv->
psc.state && !ps) {
635 rtlpriv->
psc.last_action);
642 rtlpriv->
psc.state =
ps;