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 /net/mac80211/cfg.c | |
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 'net/mac80211/cfg.c')
-rw-r--r-- | net/mac80211/cfg.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 03de4024597a..8c7b2cdbeeda 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -1388,6 +1388,31 @@ int ieee80211_testmode_cmd(struct wiphy *wiphy, void *data, int len) | |||
1388 | } | 1388 | } |
1389 | #endif | 1389 | #endif |
1390 | 1390 | ||
1391 | static int ieee80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, | ||
1392 | bool enabled, int timeout) | ||
1393 | { | ||
1394 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
1395 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
1396 | struct ieee80211_conf *conf = &local->hw.conf; | ||
1397 | |||
1398 | if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_PS)) | ||
1399 | return -EOPNOTSUPP; | ||
1400 | |||
1401 | if (enabled == sdata->u.mgd.powersave && | ||
1402 | timeout == conf->dynamic_ps_timeout) | ||
1403 | return 0; | ||
1404 | |||
1405 | sdata->u.mgd.powersave = enabled; | ||
1406 | conf->dynamic_ps_timeout = timeout; | ||
1407 | |||
1408 | if (local->hw.flags & IEEE80211_HW_SUPPORTS_DYNAMIC_PS) | ||
1409 | ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS); | ||
1410 | |||
1411 | ieee80211_recalc_ps(local, -1); | ||
1412 | |||
1413 | return 0; | ||
1414 | } | ||
1415 | |||
1391 | struct cfg80211_ops mac80211_config_ops = { | 1416 | struct cfg80211_ops mac80211_config_ops = { |
1392 | .add_virtual_intf = ieee80211_add_iface, | 1417 | .add_virtual_intf = ieee80211_add_iface, |
1393 | .del_virtual_intf = ieee80211_del_iface, | 1418 | .del_virtual_intf = ieee80211_del_iface, |
@@ -1431,4 +1456,5 @@ struct cfg80211_ops mac80211_config_ops = { | |||
1431 | .get_tx_power = ieee80211_get_tx_power, | 1456 | .get_tx_power = ieee80211_get_tx_power, |
1432 | .rfkill_poll = ieee80211_rfkill_poll, | 1457 | .rfkill_poll = ieee80211_rfkill_poll, |
1433 | CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd) | 1458 | CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd) |
1459 | .set_power_mgmt = ieee80211_set_power_mgmt, | ||
1434 | }; | 1460 | }; |