diff options
author | Esti Kummer <stkumer@localhost.localdomain> | 2008-07-18 01:52:58 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-08-04 15:09:06 -0400 |
commit | 298df1f62aa69881528bf0f1c3c14395bc447846 (patch) | |
tree | 0b372342e79a1ef5746179d57fe6c7c5ada9496b /drivers/net/wireless/iwlwifi/iwl-power.c | |
parent | ca579617d81baf5865498eb5fae58e453ee77c2c (diff) |
iwlwifi: corrects power_level in sysfs
This patch corrects power_level in sysfs.
Signed-off-by: Esti Kummer <ester.kummer@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/net/wireless/iwlwifi/iwl-power.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-power.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-power.c b/drivers/net/wireless/iwlwifi/iwl-power.c index e3c71beb01ef..028e3053c0ca 100644 --- a/drivers/net/wireless/iwlwifi/iwl-power.c +++ b/drivers/net/wireless/iwlwifi/iwl-power.c | |||
@@ -82,7 +82,7 @@ | |||
82 | 82 | ||
83 | /* default power management (not Tx power) table values */ | 83 | /* default power management (not Tx power) table values */ |
84 | /* for tim 0-10 */ | 84 | /* for tim 0-10 */ |
85 | static struct iwl_power_vec_entry range_0[IWL_POWER_AC] = { | 85 | static struct iwl_power_vec_entry range_0[IWL_POWER_MAX] = { |
86 | {{NOSLP, SLP_TOUT(0), SLP_TOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, | 86 | {{NOSLP, SLP_TOUT(0), SLP_TOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, |
87 | {{SLP, SLP_TOUT(200), SLP_TOUT(500), SLP_VEC(1, 2, 2, 2, 0xFF)}, 0}, | 87 | {{SLP, SLP_TOUT(200), SLP_TOUT(500), SLP_VEC(1, 2, 2, 2, 0xFF)}, 0}, |
88 | {{SLP, SLP_TOUT(200), SLP_TOUT(300), SLP_VEC(1, 2, 2, 2, 0xFF)}, 0}, | 88 | {{SLP, SLP_TOUT(200), SLP_TOUT(300), SLP_VEC(1, 2, 2, 2, 0xFF)}, 0}, |
@@ -93,7 +93,7 @@ static struct iwl_power_vec_entry range_0[IWL_POWER_AC] = { | |||
93 | 93 | ||
94 | 94 | ||
95 | /* for tim = 3-10 */ | 95 | /* for tim = 3-10 */ |
96 | static struct iwl_power_vec_entry range_1[IWL_POWER_AC] = { | 96 | static struct iwl_power_vec_entry range_1[IWL_POWER_MAX] = { |
97 | {{NOSLP, SLP_TOUT(0), SLP_TOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, | 97 | {{NOSLP, SLP_TOUT(0), SLP_TOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, |
98 | {{SLP, SLP_TOUT(200), SLP_TOUT(500), SLP_VEC(1, 2, 3, 4, 4)}, 0}, | 98 | {{SLP, SLP_TOUT(200), SLP_TOUT(500), SLP_VEC(1, 2, 3, 4, 4)}, 0}, |
99 | {{SLP, SLP_TOUT(200), SLP_TOUT(300), SLP_VEC(1, 2, 3, 4, 7)}, 0}, | 99 | {{SLP, SLP_TOUT(200), SLP_TOUT(300), SLP_VEC(1, 2, 3, 4, 7)}, 0}, |
@@ -103,7 +103,7 @@ static struct iwl_power_vec_entry range_1[IWL_POWER_AC] = { | |||
103 | }; | 103 | }; |
104 | 104 | ||
105 | /* for tim > 11 */ | 105 | /* for tim > 11 */ |
106 | static struct iwl_power_vec_entry range_2[IWL_POWER_AC] = { | 106 | static struct iwl_power_vec_entry range_2[IWL_POWER_MAX] = { |
107 | {{NOSLP, SLP_TOUT(0), SLP_TOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, | 107 | {{NOSLP, SLP_TOUT(0), SLP_TOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, |
108 | {{SLP, SLP_TOUT(200), SLP_TOUT(500), SLP_VEC(1, 2, 3, 4, 0xFF)}, 0}, | 108 | {{SLP, SLP_TOUT(200), SLP_TOUT(500), SLP_VEC(1, 2, 3, 4, 0xFF)}, 0}, |
109 | {{SLP, SLP_TOUT(200), SLP_TOUT(300), SLP_VEC(2, 4, 6, 7, 0xFF)}, 0}, | 109 | {{SLP, SLP_TOUT(200), SLP_TOUT(300), SLP_VEC(2, 4, 6, 7, 0xFF)}, 0}, |
@@ -124,7 +124,7 @@ static int iwl_set_power(struct iwl_priv *priv, void *cmd) | |||
124 | */ | 124 | */ |
125 | static u16 iwl_get_auto_power_mode(struct iwl_priv *priv) | 125 | static u16 iwl_get_auto_power_mode(struct iwl_priv *priv) |
126 | { | 126 | { |
127 | u16 mode = priv->power_data.user_power_setting; | 127 | u16 mode; |
128 | 128 | ||
129 | switch (priv->power_data.user_power_setting) { | 129 | switch (priv->power_data.user_power_setting) { |
130 | case IWL_POWER_AUTO: | 130 | case IWL_POWER_AUTO: |
@@ -136,12 +136,16 @@ static u16 iwl_get_auto_power_mode(struct iwl_priv *priv) | |||
136 | else | 136 | else |
137 | mode = IWL_POWER_ON_AC_DISASSOC; | 137 | mode = IWL_POWER_ON_AC_DISASSOC; |
138 | break; | 138 | break; |
139 | /* FIXME: remove battery and ac from here */ | ||
139 | case IWL_POWER_BATTERY: | 140 | case IWL_POWER_BATTERY: |
140 | mode = IWL_POWER_INDEX_3; | 141 | mode = IWL_POWER_INDEX_3; |
141 | break; | 142 | break; |
142 | case IWL_POWER_AC: | 143 | case IWL_POWER_AC: |
143 | mode = IWL_POWER_MODE_CAM; | 144 | mode = IWL_POWER_MODE_CAM; |
144 | break; | 145 | break; |
146 | default: | ||
147 | mode = priv->power_data.user_power_setting; | ||
148 | break; | ||
145 | } | 149 | } |
146 | return mode; | 150 | return mode; |
147 | } | 151 | } |
@@ -151,7 +155,7 @@ static int iwl_power_init_handle(struct iwl_priv *priv) | |||
151 | { | 155 | { |
152 | int ret = 0, i; | 156 | int ret = 0, i; |
153 | struct iwl_power_mgr *pow_data; | 157 | struct iwl_power_mgr *pow_data; |
154 | int size = sizeof(struct iwl_power_vec_entry) * IWL_POWER_AC; | 158 | int size = sizeof(struct iwl_power_vec_entry) * IWL_POWER_MAX; |
155 | u16 pci_pm; | 159 | u16 pci_pm; |
156 | 160 | ||
157 | IWL_DEBUG_POWER("Initialize power \n"); | 161 | IWL_DEBUG_POWER("Initialize power \n"); |
@@ -173,7 +177,7 @@ static int iwl_power_init_handle(struct iwl_priv *priv) | |||
173 | 177 | ||
174 | IWL_DEBUG_POWER("adjust power command flags\n"); | 178 | IWL_DEBUG_POWER("adjust power command flags\n"); |
175 | 179 | ||
176 | for (i = 0; i < IWL_POWER_AC; i++) { | 180 | for (i = 0; i < IWL_POWER_MAX; i++) { |
177 | cmd = &pow_data->pwr_range_0[i].cmd; | 181 | cmd = &pow_data->pwr_range_0[i].cmd; |
178 | 182 | ||
179 | if (pci_pm & 0x1) | 183 | if (pci_pm & 0x1) |
@@ -265,17 +269,18 @@ int iwl_power_update_mode(struct iwl_priv *priv, u8 refresh) | |||
265 | * else user level */ | 269 | * else user level */ |
266 | 270 | ||
267 | switch (setting->system_power_setting) { | 271 | switch (setting->system_power_setting) { |
268 | case IWL_POWER_AUTO: | 272 | case IWL_POWER_SYS_AUTO: |
269 | final_mode = iwl_get_auto_power_mode(priv); | 273 | final_mode = iwl_get_auto_power_mode(priv); |
270 | break; | 274 | break; |
271 | case IWL_POWER_BATTERY: | 275 | case IWL_POWER_SYS_BATTERY: |
272 | final_mode = IWL_POWER_INDEX_3; | 276 | final_mode = IWL_POWER_INDEX_3; |
273 | break; | 277 | break; |
274 | case IWL_POWER_AC: | 278 | case IWL_POWER_SYS_AC: |
275 | final_mode = IWL_POWER_MODE_CAM; | 279 | final_mode = IWL_POWER_MODE_CAM; |
276 | break; | 280 | break; |
277 | default: | 281 | default: |
278 | final_mode = setting->system_power_setting; | 282 | final_mode = IWL_POWER_INDEX_3; |
283 | WARN_ON(1); | ||
279 | } | 284 | } |
280 | 285 | ||
281 | if (setting->critical_power_setting > final_mode) | 286 | if (setting->critical_power_setting > final_mode) |
@@ -394,7 +399,7 @@ void iwl_power_initialize(struct iwl_priv *priv) | |||
394 | iwl_power_init_handle(priv); | 399 | iwl_power_init_handle(priv); |
395 | priv->power_data.user_power_setting = IWL_POWER_AUTO; | 400 | priv->power_data.user_power_setting = IWL_POWER_AUTO; |
396 | priv->power_data.power_disabled = 0; | 401 | priv->power_data.power_disabled = 0; |
397 | priv->power_data.system_power_setting = IWL_POWER_AUTO; | 402 | priv->power_data.system_power_setting = IWL_POWER_SYS_AUTO; |
398 | priv->power_data.is_battery_active = 0; | 403 | priv->power_data.is_battery_active = 0; |
399 | priv->power_data.power_disabled = 0; | 404 | priv->power_data.power_disabled = 0; |
400 | priv->power_data.critical_power_setting = 0; | 405 | priv->power_data.critical_power_setting = 0; |