diff options
author | Mohamed Abbas <mohamed.abbas@intel.com> | 2008-07-18 01:52:57 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-08-04 15:09:06 -0400 |
commit | ca579617d81baf5865498eb5fae58e453ee77c2c (patch) | |
tree | 2d2aff22644a2369c1f0cb524a8c8457103d738d /drivers | |
parent | adf044c8778de98dae29c5ce9973b7e43964674f (diff) |
iwlwifi: add power save to 5000 HW
This patch adds support for power save for 5000 HW.
Signed-off-by: Mohamed Abbas <mohamed.abbas@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965.c | 13 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-5000.c | 1 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-commands.h | 4 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-core.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-dev.h | 3 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-power.c | 18 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-power.h | 2 |
7 files changed, 18 insertions, 24 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index ba2df1ba32d2..ea23c7629575 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c | |||
@@ -875,18 +875,6 @@ static int iwl4965_hw_set_hw_params(struct iwl_priv *priv) | |||
875 | return 0; | 875 | return 0; |
876 | } | 876 | } |
877 | 877 | ||
878 | /* set card power command */ | ||
879 | static int iwl4965_set_power(struct iwl_priv *priv, | ||
880 | void *cmd) | ||
881 | { | ||
882 | int ret = 0; | ||
883 | |||
884 | ret = iwl_send_cmd_pdu_async(priv, POWER_TABLE_CMD, | ||
885 | sizeof(struct iwl4965_powertable_cmd), | ||
886 | cmd, NULL); | ||
887 | return ret; | ||
888 | } | ||
889 | |||
890 | static s32 iwl4965_math_div_round(s32 num, s32 denom, s32 *res) | 878 | static s32 iwl4965_math_div_round(s32 num, s32 denom, s32 *res) |
891 | { | 879 | { |
892 | s32 sign = 1; | 880 | s32 sign = 1; |
@@ -2440,7 +2428,6 @@ static struct iwl_lib_ops iwl4965_lib = { | |||
2440 | .check_version = iwl4965_eeprom_check_version, | 2428 | .check_version = iwl4965_eeprom_check_version, |
2441 | .query_addr = iwlcore_eeprom_query_addr, | 2429 | .query_addr = iwlcore_eeprom_query_addr, |
2442 | }, | 2430 | }, |
2443 | .set_power = iwl4965_set_power, | ||
2444 | .send_tx_power = iwl4965_send_tx_power, | 2431 | .send_tx_power = iwl4965_send_tx_power, |
2445 | .update_chain_flags = iwl4965_update_chain_flags, | 2432 | .update_chain_flags = iwl4965_update_chain_flags, |
2446 | .temperature = iwl4965_temperature_calib, | 2433 | .temperature = iwl4965_temperature_calib, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index 878d6193b232..f91c54b5ff53 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
@@ -1474,6 +1474,7 @@ static struct iwl_lib_ops iwl5000_lib = { | |||
1474 | .alive_notify = iwl5000_alive_notify, | 1474 | .alive_notify = iwl5000_alive_notify, |
1475 | .send_tx_power = iwl5000_send_tx_power, | 1475 | .send_tx_power = iwl5000_send_tx_power, |
1476 | .temperature = iwl5000_temperature, | 1476 | .temperature = iwl5000_temperature, |
1477 | .update_chain_flags = iwl4965_update_chain_flags, | ||
1477 | .apm_ops = { | 1478 | .apm_ops = { |
1478 | .init = iwl5000_apm_init, | 1479 | .init = iwl5000_apm_init, |
1479 | .reset = iwl5000_apm_reset, | 1480 | .reset = iwl5000_apm_reset, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h index e9bb1de0ce3f..6f3555ffe527 100644 --- a/drivers/net/wireless/iwlwifi/iwl-commands.h +++ b/drivers/net/wireless/iwlwifi/iwl-commands.h | |||
@@ -1993,7 +1993,7 @@ struct iwl4965_spectrum_notification { | |||
1993 | *****************************************************************************/ | 1993 | *****************************************************************************/ |
1994 | 1994 | ||
1995 | /** | 1995 | /** |
1996 | * struct iwl4965_powertable_cmd - Power Table Command | 1996 | * struct iwl_powertable_cmd - Power Table Command |
1997 | * @flags: See below: | 1997 | * @flags: See below: |
1998 | * | 1998 | * |
1999 | * POWER_TABLE_CMD = 0x77 (command, has simple generic response) | 1999 | * POWER_TABLE_CMD = 0x77 (command, has simple generic response) |
@@ -2027,7 +2027,7 @@ struct iwl4965_spectrum_notification { | |||
2027 | #define IWL_POWER_PCI_PM_MSK __constant_cpu_to_le16(1 << 3) | 2027 | #define IWL_POWER_PCI_PM_MSK __constant_cpu_to_le16(1 << 3) |
2028 | #define IWL_POWER_FAST_PD __constant_cpu_to_le16(1 << 4) | 2028 | #define IWL_POWER_FAST_PD __constant_cpu_to_le16(1 << 4) |
2029 | 2029 | ||
2030 | struct iwl4965_powertable_cmd { | 2030 | struct iwl_powertable_cmd { |
2031 | __le16 flags; | 2031 | __le16 flags; |
2032 | u8 keep_alive_seconds; | 2032 | u8 keep_alive_seconds; |
2033 | u8 debug_flags; | 2033 | u8 debug_flags; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h index db66114f1e56..eaefa42f37c5 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-core.h | |||
@@ -139,7 +139,6 @@ struct iwl_lib_ops { | |||
139 | int (*set_pwr_src)(struct iwl_priv *priv, enum iwl_pwr_src src); | 139 | int (*set_pwr_src)(struct iwl_priv *priv, enum iwl_pwr_src src); |
140 | } apm_ops; | 140 | } apm_ops; |
141 | /* power */ | 141 | /* power */ |
142 | int (*set_power)(struct iwl_priv *priv, void *cmd); | ||
143 | int (*send_tx_power) (struct iwl_priv *priv); | 142 | int (*send_tx_power) (struct iwl_priv *priv); |
144 | void (*update_chain_flags)(struct iwl_priv *priv); | 143 | void (*update_chain_flags)(struct iwl_priv *priv); |
145 | void (*temperature) (struct iwl_priv *priv); | 144 | void (*temperature) (struct iwl_priv *priv); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index 4d789e353e3a..010ed69e0e50 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h | |||
@@ -283,7 +283,7 @@ struct iwl_cmd { | |||
283 | u32 val32; | 283 | u32 val32; |
284 | struct iwl4965_bt_cmd bt; | 284 | struct iwl4965_bt_cmd bt; |
285 | struct iwl4965_rxon_time_cmd rxon_time; | 285 | struct iwl4965_rxon_time_cmd rxon_time; |
286 | struct iwl4965_powertable_cmd powertable; | 286 | struct iwl_powertable_cmd powertable; |
287 | struct iwl_qosparam_cmd qosparam; | 287 | struct iwl_qosparam_cmd qosparam; |
288 | struct iwl_tx_cmd tx; | 288 | struct iwl_tx_cmd tx; |
289 | struct iwl4965_tx_beacon_cmd tx_beacon; | 289 | struct iwl4965_tx_beacon_cmd tx_beacon; |
@@ -590,6 +590,7 @@ extern unsigned int iwl4965_fill_beacon_frame(struct iwl_priv *priv, | |||
590 | const u8 *dest, int left); | 590 | const u8 *dest, int left); |
591 | extern void iwl4965_update_chain_flags(struct iwl_priv *priv); | 591 | extern void iwl4965_update_chain_flags(struct iwl_priv *priv); |
592 | int iwl4965_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src); | 592 | int iwl4965_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src); |
593 | extern int iwl4965_set_power(struct iwl_priv *priv, void *cmd); | ||
593 | 594 | ||
594 | extern const u8 iwl_bcast_addr[ETH_ALEN]; | 595 | extern const u8 iwl_bcast_addr[ETH_ALEN]; |
595 | 596 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-power.c b/drivers/net/wireless/iwlwifi/iwl-power.c index 2e71803e09ba..e3c71beb01ef 100644 --- a/drivers/net/wireless/iwlwifi/iwl-power.c +++ b/drivers/net/wireless/iwlwifi/iwl-power.c | |||
@@ -112,6 +112,13 @@ static struct iwl_power_vec_entry range_2[IWL_POWER_AC] = { | |||
112 | {{SLP, SLP_TOUT(25), SLP_TOUT(25), SLP_VEC(4, 7, 10, 10, 0xFF)}, 0} | 112 | {{SLP, SLP_TOUT(25), SLP_TOUT(25), SLP_VEC(4, 7, 10, 10, 0xFF)}, 0} |
113 | }; | 113 | }; |
114 | 114 | ||
115 | /* set card power command */ | ||
116 | static int iwl_set_power(struct iwl_priv *priv, void *cmd) | ||
117 | { | ||
118 | return iwl_send_cmd_pdu_async(priv, POWER_TABLE_CMD, | ||
119 | sizeof(struct iwl_powertable_cmd), | ||
120 | cmd, NULL); | ||
121 | } | ||
115 | /* decide the right power level according to association status | 122 | /* decide the right power level according to association status |
116 | * and battery status | 123 | * and battery status |
117 | */ | 124 | */ |
@@ -162,7 +169,7 @@ static int iwl_power_init_handle(struct iwl_priv *priv) | |||
162 | if (ret != 0) | 169 | if (ret != 0) |
163 | return 0; | 170 | return 0; |
164 | else { | 171 | else { |
165 | struct iwl4965_powertable_cmd *cmd; | 172 | struct iwl_powertable_cmd *cmd; |
166 | 173 | ||
167 | IWL_DEBUG_POWER("adjust power command flags\n"); | 174 | IWL_DEBUG_POWER("adjust power command flags\n"); |
168 | 175 | ||
@@ -180,7 +187,7 @@ static int iwl_power_init_handle(struct iwl_priv *priv) | |||
180 | 187 | ||
181 | /* adjust power command according to dtim period and power level*/ | 188 | /* adjust power command according to dtim period and power level*/ |
182 | static int iwl_update_power_command(struct iwl_priv *priv, | 189 | static int iwl_update_power_command(struct iwl_priv *priv, |
183 | struct iwl4965_powertable_cmd *cmd, | 190 | struct iwl_powertable_cmd *cmd, |
184 | u16 mode) | 191 | u16 mode) |
185 | { | 192 | { |
186 | int ret = 0, i; | 193 | int ret = 0, i; |
@@ -204,7 +211,7 @@ static int iwl_update_power_command(struct iwl_priv *priv, | |||
204 | range = &pow_data->pwr_range_2[0]; | 211 | range = &pow_data->pwr_range_2[0]; |
205 | 212 | ||
206 | period = pow_data->dtim_period; | 213 | period = pow_data->dtim_period; |
207 | memcpy(cmd, &range[mode].cmd, sizeof(struct iwl4965_powertable_cmd)); | 214 | memcpy(cmd, &range[mode].cmd, sizeof(struct iwl_powertable_cmd)); |
208 | 215 | ||
209 | if (period == 0) { | 216 | if (period == 0) { |
210 | period = 1; | 217 | period = 1; |
@@ -280,7 +287,7 @@ int iwl_power_update_mode(struct iwl_priv *priv, u8 refresh) | |||
280 | 287 | ||
281 | if (!iwl_is_rfkill(priv) && !setting->power_disabled && | 288 | if (!iwl_is_rfkill(priv) && !setting->power_disabled && |
282 | ((setting->power_mode != final_mode) || refresh)) { | 289 | ((setting->power_mode != final_mode) || refresh)) { |
283 | struct iwl4965_powertable_cmd cmd; | 290 | struct iwl_powertable_cmd cmd; |
284 | 291 | ||
285 | if (final_mode != IWL_POWER_MODE_CAM) | 292 | if (final_mode != IWL_POWER_MODE_CAM) |
286 | set_bit(STATUS_POWER_PMI, &priv->status); | 293 | set_bit(STATUS_POWER_PMI, &priv->status); |
@@ -291,8 +298,7 @@ int iwl_power_update_mode(struct iwl_priv *priv, u8 refresh) | |||
291 | if (final_mode == IWL_POWER_INDEX_5) | 298 | if (final_mode == IWL_POWER_INDEX_5) |
292 | cmd.flags |= IWL_POWER_FAST_PD; | 299 | cmd.flags |= IWL_POWER_FAST_PD; |
293 | 300 | ||
294 | if (priv->cfg->ops->lib->set_power) | 301 | ret = iwl_set_power(priv, &cmd); |
295 | ret = priv->cfg->ops->lib->set_power(priv, &cmd); | ||
296 | 302 | ||
297 | if (final_mode == IWL_POWER_MODE_CAM) | 303 | if (final_mode == IWL_POWER_MODE_CAM) |
298 | clear_bit(STATUS_POWER_PMI, &priv->status); | 304 | clear_bit(STATUS_POWER_PMI, &priv->status); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-power.h b/drivers/net/wireless/iwlwifi/iwl-power.h index b066724a1c2b..801f6143a42c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-power.h +++ b/drivers/net/wireless/iwlwifi/iwl-power.h | |||
@@ -46,7 +46,7 @@ struct iwl_priv; | |||
46 | /* Power management (not Tx power) structures */ | 46 | /* Power management (not Tx power) structures */ |
47 | 47 | ||
48 | struct iwl_power_vec_entry { | 48 | struct iwl_power_vec_entry { |
49 | struct iwl4965_powertable_cmd cmd; | 49 | struct iwl_powertable_cmd cmd; |
50 | u8 no_dtim; | 50 | u8 no_dtim; |
51 | }; | 51 | }; |
52 | 52 | ||