iwlagn: Add power_level module parameter
authorWey-Yi Guy <wey-yi.w.guy@intel.com>
Sat, 11 Jun 2011 17:00:06 +0000 (10:00 -0700)
committerWey-Yi Guy <wey-yi.w.guy@intel.com>
Sat, 18 Jun 2011 15:23:30 +0000 (08:23 -0700)
Add power_level module parameter to set the default power save level.
Power save level has range from 1 - 5, default power save level is 1.

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
drivers/net/wireless/iwlwifi/iwl-agn-lib.c
drivers/net/wireless/iwlwifi/iwl-agn.c
drivers/net/wireless/iwlwifi/iwl-core.h
drivers/net/wireless/iwlwifi/iwl-power.c

index 52da53997d4ce4322e53392e48e9400ed052756c..efdab6506ae773de33b608ebab40b70ebf098131 100644 (file)
@@ -624,6 +624,7 @@ struct iwl_mod_params iwlagn_mod_params = {
        .plcp_check = true,
        .bt_coex_active = true,
        .no_sleep_autoadjust = true,
+       .power_level = IWL_POWER_INDEX_1,
        /* the rest are 0 by default */
 };
 
index b719628b4fc71647e7cfa0d8d4265e272468aaba..77ceb8deff7563a6f20d9c06b9eb8dc0f63a692a 100644 (file)
@@ -3831,6 +3831,11 @@ module_param_named(power_save, iwlagn_mod_params.power_save,
 MODULE_PARM_DESC(power_save,
                 "enable WiFi power management (default: disable)");
 
+module_param_named(power_level, iwlagn_mod_params.power_level,
+               int, S_IRUGO);
+MODULE_PARM_DESC(power_level,
+                "default power save level (range from 1 - 5, default: 1)");
+
 /*
  * For now, keep using power level 1 instead of automatically
  * adjusting ...
index 6238ac628020451315ab439efc7c5678c677dbc0..adf9f9b2efb52d4e3e6e8145df9cec55f460e796 100644 (file)
@@ -164,6 +164,7 @@ struct iwl_mod_params {
        int led_mode;           /* def: 0 = system default */
        bool no_sleep_autoadjust; /* def: true = disable autoadjust */
        bool power_save;        /* def: false = disable power save */
+       int power_level;        /* def: 1 = power level */
 };
 
 /*
index 970c514623b93f802788357b3136941808bc79c4..565e57e48be89bbfab06394f509b5bf0a8c0965a 100644 (file)
@@ -358,9 +358,15 @@ static void iwl_power_build_cmd(struct iwl_priv *priv,
                iwl_static_sleep_cmd(priv, cmd,
                                     priv->power_data.debug_sleep_level_override,
                                     dtimper);
-       else if (iwlagn_mod_params.no_sleep_autoadjust)
-               iwl_static_sleep_cmd(priv, cmd, IWL_POWER_INDEX_1, dtimper);
-       else
+       else if (iwlagn_mod_params.no_sleep_autoadjust) {
+               if (iwlagn_mod_params.power_level > IWL_POWER_INDEX_1 &&
+                   iwlagn_mod_params.power_level <= IWL_POWER_INDEX_5)
+                       iwl_static_sleep_cmd(priv, cmd,
+                               iwlagn_mod_params.power_level, dtimper);
+               else
+                       iwl_static_sleep_cmd(priv, cmd,
+                               IWL_POWER_INDEX_1, dtimper);
+       } else
                iwl_power_fill_sleep_cmd(priv, cmd,
                                         priv->hw->conf.dynamic_ps_timeout,
                                         priv->hw->conf.max_sleep_period);