diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2009-07-01 15:26:57 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-07-10 15:01:51 -0400 |
commit | bc92afd92088ab41223383cc6863ab4792533c54 (patch) | |
tree | a31d14843f5a63a4a4561bb2ac59e83f4550433c /drivers | |
parent | f21293549f60f88c74fcb9944737f11048896dc4 (diff) |
cfg80211: implement iwpower
Just on/off and timeout, and with a hacky cfg80211 method
until we figure out what we want, though this is probably
sufficient as we want to use pm_qos for wifi everywhere.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/iwmc3200wifi/cfg80211.c | 22 | ||||
-rw-r--r-- | drivers/net/wireless/iwmc3200wifi/wext.c | 47 |
2 files changed, 24 insertions, 45 deletions
diff --git a/drivers/net/wireless/iwmc3200wifi/cfg80211.c b/drivers/net/wireless/iwmc3200wifi/cfg80211.c index d0629d4757d7..54bebba8e27e 100644 --- a/drivers/net/wireless/iwmc3200wifi/cfg80211.c +++ b/drivers/net/wireless/iwmc3200wifi/cfg80211.c | |||
@@ -522,6 +522,27 @@ static int iwm_cfg80211_get_txpower(struct wiphy *wiphy, int *dbm) | |||
522 | return 0; | 522 | return 0; |
523 | } | 523 | } |
524 | 524 | ||
525 | static int iwm_cfg80211_set_power_mgmt(struct wiphy *wiphy, | ||
526 | struct net_device *dev, | ||
527 | bool enabled, int timeout) | ||
528 | { | ||
529 | struct iwm_priv *iwm = wiphy_to_iwm(wiphy); | ||
530 | u32 power_index; | ||
531 | |||
532 | if (enabled) | ||
533 | power_index = IWM_POWER_INDEX_DEFAULT; | ||
534 | else | ||
535 | power_index = IWM_POWER_INDEX_MIN; | ||
536 | |||
537 | if (power_index == iwm->conf.power_index) | ||
538 | return 0; | ||
539 | |||
540 | iwm->conf.power_index = power_index; | ||
541 | |||
542 | return iwm_umac_set_config_fix(iwm, UMAC_PARAM_TBL_CFG_FIX, | ||
543 | CFG_POWER_INDEX, iwm->conf.power_index); | ||
544 | } | ||
545 | |||
525 | static struct cfg80211_ops iwm_cfg80211_ops = { | 546 | static struct cfg80211_ops iwm_cfg80211_ops = { |
526 | .change_virtual_intf = iwm_cfg80211_change_iface, | 547 | .change_virtual_intf = iwm_cfg80211_change_iface, |
527 | .add_key = iwm_cfg80211_add_key, | 548 | .add_key = iwm_cfg80211_add_key, |
@@ -534,6 +555,7 @@ static struct cfg80211_ops iwm_cfg80211_ops = { | |||
534 | .leave_ibss = iwm_cfg80211_leave_ibss, | 555 | .leave_ibss = iwm_cfg80211_leave_ibss, |
535 | .set_tx_power = iwm_cfg80211_set_txpower, | 556 | .set_tx_power = iwm_cfg80211_set_txpower, |
536 | .get_tx_power = iwm_cfg80211_get_txpower, | 557 | .get_tx_power = iwm_cfg80211_get_txpower, |
558 | .set_power_mgmt = iwm_cfg80211_set_power_mgmt, | ||
537 | }; | 559 | }; |
538 | 560 | ||
539 | struct wireless_dev *iwm_wdev_alloc(int sizeof_bus, struct device *dev) | 561 | struct wireless_dev *iwm_wdev_alloc(int sizeof_bus, struct device *dev) |
diff --git a/drivers/net/wireless/iwmc3200wifi/wext.c b/drivers/net/wireless/iwmc3200wifi/wext.c index 973457383c11..2e7eaf96cf93 100644 --- a/drivers/net/wireless/iwmc3200wifi/wext.c +++ b/drivers/net/wireless/iwmc3200wifi/wext.c | |||
@@ -238,49 +238,6 @@ static int iwm_set_wpa_version(struct iwm_priv *iwm, u8 wpa_version) | |||
238 | return 0; | 238 | return 0; |
239 | } | 239 | } |
240 | 240 | ||
241 | static int iwm_wext_siwpower(struct net_device *dev, | ||
242 | struct iw_request_info *info, | ||
243 | struct iw_param *wrq, char *extra) | ||
244 | { | ||
245 | struct iwm_priv *iwm = ndev_to_iwm(dev); | ||
246 | u32 power_index; | ||
247 | |||
248 | if (wrq->disabled) { | ||
249 | power_index = IWM_POWER_INDEX_MIN; | ||
250 | goto set; | ||
251 | } else | ||
252 | power_index = IWM_POWER_INDEX_DEFAULT; | ||
253 | |||
254 | switch (wrq->flags & IW_POWER_MODE) { | ||
255 | case IW_POWER_ON: | ||
256 | case IW_POWER_MODE: | ||
257 | case IW_POWER_ALL_R: | ||
258 | break; | ||
259 | default: | ||
260 | return -EINVAL; | ||
261 | } | ||
262 | |||
263 | set: | ||
264 | if (power_index == iwm->conf.power_index) | ||
265 | return 0; | ||
266 | |||
267 | iwm->conf.power_index = power_index; | ||
268 | |||
269 | return iwm_umac_set_config_fix(iwm, UMAC_PARAM_TBL_CFG_FIX, | ||
270 | CFG_POWER_INDEX, iwm->conf.power_index); | ||
271 | } | ||
272 | |||
273 | static int iwm_wext_giwpower(struct net_device *dev, | ||
274 | struct iw_request_info *info, | ||
275 | union iwreq_data *wrqu, char *extra) | ||
276 | { | ||
277 | struct iwm_priv *iwm = ndev_to_iwm(dev); | ||
278 | |||
279 | wrqu->power.disabled = (iwm->conf.power_index == IWM_POWER_INDEX_MIN); | ||
280 | |||
281 | return 0; | ||
282 | } | ||
283 | |||
284 | static int iwm_set_key_mgt(struct iwm_priv *iwm, u8 key_mgt) | 241 | static int iwm_set_key_mgt(struct iwm_priv *iwm, u8 key_mgt) |
285 | { | 242 | { |
286 | u8 *auth_type = &iwm->umac_profile->sec.auth_type; | 243 | u8 *auth_type = &iwm->umac_profile->sec.auth_type; |
@@ -458,8 +415,8 @@ static const iw_handler iwm_handlers[] = | |||
458 | (iw_handler) NULL, /* SIOCGIWRETRY */ | 415 | (iw_handler) NULL, /* SIOCGIWRETRY */ |
459 | (iw_handler) cfg80211_wext_siwencode, /* SIOCSIWENCODE */ | 416 | (iw_handler) cfg80211_wext_siwencode, /* SIOCSIWENCODE */ |
460 | (iw_handler) cfg80211_wext_giwencode, /* SIOCGIWENCODE */ | 417 | (iw_handler) cfg80211_wext_giwencode, /* SIOCGIWENCODE */ |
461 | (iw_handler) iwm_wext_siwpower, /* SIOCSIWPOWER */ | 418 | (iw_handler) cfg80211_wext_siwpower, /* SIOCSIWPOWER */ |
462 | (iw_handler) iwm_wext_giwpower, /* SIOCGIWPOWER */ | 419 | (iw_handler) cfg80211_wext_giwpower, /* SIOCGIWPOWER */ |
463 | (iw_handler) NULL, /* -- hole -- */ | 420 | (iw_handler) NULL, /* -- hole -- */ |
464 | (iw_handler) NULL, /* -- hole -- */ | 421 | (iw_handler) NULL, /* -- hole -- */ |
465 | (iw_handler) NULL, /* SIOCSIWGENIE */ | 422 | (iw_handler) NULL, /* SIOCSIWGENIE */ |