rtlwifi: Correct power save capability while init mac80211
authorPing-Ke Shih <pkshih@realtek.com>
Sun, 18 Jun 2017 16:12:42 +0000 (11:12 -0500)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 21 Jun 2017 15:28:01 +0000 (18:28 +0300)
Since the driver itself will enter power saving mode dynamically
according to the traffic, we set hw capability SUPPORTS_PS and
SUPPORTS_DYNAMIC_PS in case of fwctrl_lps.

The process IEEE80211_CONF_CHANGE_PS in op_config is used by
SW-LPS only, so we add constraints to avoid errors.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: vincent_fann <vincent_fann@realtek.com>
Signed-off-by: shaofu <shaofu@realtek.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/realtek/rtlwifi/base.c
drivers/net/wireless/realtek/rtlwifi/core.c

index bdc379178e87955c5456028a43657f97862670af..6415ec03008f23ca0be83a36a9d92ce5d0b6fc4b 100644 (file)
@@ -405,6 +405,10 @@ static void _rtl_init_mac80211(struct ieee80211_hw *hw)
                ieee80211_hw_set(hw, SUPPORTS_PS);
                ieee80211_hw_set(hw, PS_NULLFUNC_STACK);
        }
+       if (rtlpriv->psc.fwctrl_lps) {
+               ieee80211_hw_set(hw, SUPPORTS_PS);
+               ieee80211_hw_set(hw, SUPPORTS_DYNAMIC_PS);
+       }
        hw->wiphy->interface_modes =
            BIT(NL80211_IFTYPE_AP) |
            BIT(NL80211_IFTYPE_STATION) |
index a4f8e326a2bc171cd4c00bed64d24c240b5c3ee7..5053d8c73e2985c858307961cd1394c02592a7f6 100644 (file)
@@ -629,7 +629,8 @@ static int rtl_op_config(struct ieee80211_hw *hw, u32 changed)
        }
 
        /*For LPS */
-       if (changed & IEEE80211_CONF_CHANGE_PS) {
+       if ((changed & IEEE80211_CONF_CHANGE_PS) &&
+           rtlpriv->psc.swctrl_lps && !rtlpriv->psc.fwctrl_lps) {
                cancel_delayed_work(&rtlpriv->works.ps_work);
                cancel_delayed_work(&rtlpriv->works.ps_rfon_wq);
                if (conf->flags & IEEE80211_CONF_PS) {