iwlwifi: mvm: always send power table command
authorAlexander Bondar <alexander.bondar@intel.com>
Tue, 5 Mar 2013 10:54:00 +0000 (12:54 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 3 Apr 2013 20:49:16 +0000 (22:49 +0200)
The driver distinguishes between power management and device's power
down enablement. Power management enablement depends both on driver's
module power parameters and mac80211 decision. The device's power down
depends only on driver's module power parameters. Change the driver to
always send Power Table command to enable or disable both power
management and device's power down.

Signed-off-by: Alexander Bondar <alexander.bondar@intel.com>
Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/iwlwifi/mvm/power.c

index f66694c617e606ee5b5d77b192fe9da9c0cf1ba5..0c0771361951e7aa92667e855e492afc48373f76 100644 (file)
@@ -86,12 +86,16 @@ static void iwl_mvm_power_build_cmd(struct iwl_mvm *mvm,
        int keep_alive;
        bool radar_detect = false;
 
-       if ((!vif->bss_conf.ps) ||
-           (iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_CAM))
+       if ((iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_CAM) ||
+           !iwlwifi_mod_params.power_save)
                return;
 
-       cmd->flags |= cpu_to_le16(POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK |
-                                 POWER_FLAGS_POWER_SAVE_ENA_MSK);
+       cmd->flags |= cpu_to_le16(POWER_FLAGS_POWER_SAVE_ENA_MSK);
+
+       if (!vif->bss_conf.ps)
+               return;
+
+       cmd->flags |= cpu_to_le16(POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK);
 
        dtimper = hw->conf.ps_dtim_period ?: 1;
 
@@ -132,11 +136,6 @@ int iwl_mvm_power_update_mode(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
 {
        struct iwl_powertable_cmd cmd = {};
 
-       if (!iwlwifi_mod_params.power_save) {
-               IWL_DEBUG_POWER(mvm, "Power management is not allowed\n");
-               return 0;
-       }
-
        if (vif->type != NL80211_IFTYPE_STATION || vif->p2p)
                return 0;
 
@@ -165,14 +164,13 @@ int iwl_mvm_power_disable(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
 {
        struct iwl_powertable_cmd cmd = {};
 
-       if (!iwlwifi_mod_params.power_save) {
-               IWL_DEBUG_POWER(mvm, "Power management is not allowed\n");
-               return 0;
-       }
-
        if (vif->type != NL80211_IFTYPE_STATION || vif->p2p)
                return 0;
 
+       if ((iwlmvm_mod_params.power_scheme != IWL_POWER_SCHEME_CAM) &&
+           iwlwifi_mod_params.power_save)
+               cmd.flags |= cpu_to_le16(POWER_FLAGS_POWER_SAVE_ENA_MSK);
+
        IWL_DEBUG_POWER(mvm,
                        "Sending power table command power level %d, flags = 0x%X\n",
                        iwlmvm_mod_params.power_scheme, le16_to_cpu(cmd.flags));