aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2x00config.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00config.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00config.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00config.c b/drivers/net/wireless/rt2x00/rt2x00config.c
index f78726404592..555180d8f4aa 100644
--- a/drivers/net/wireless/rt2x00/rt2x00config.c
+++ b/drivers/net/wireless/rt2x00/rt2x00config.c
@@ -100,6 +100,10 @@ void rt2x00lib_config_erp(struct rt2x00_dev *rt2x00dev,
100 erp.basic_rates = bss_conf->basic_rates; 100 erp.basic_rates = bss_conf->basic_rates;
101 erp.beacon_int = bss_conf->beacon_int; 101 erp.beacon_int = bss_conf->beacon_int;
102 102
103 /* Update the AID, this is needed for dynamic PS support */
104 rt2x00dev->aid = bss_conf->assoc ? bss_conf->aid : 0;
105 rt2x00dev->last_beacon = bss_conf->timestamp;
106
103 /* Update global beacon interval time, this is needed for PS support */ 107 /* Update global beacon interval time, this is needed for PS support */
104 rt2x00dev->beacon_int = bss_conf->beacon_int; 108 rt2x00dev->beacon_int = bss_conf->beacon_int;
105 109
@@ -204,6 +208,9 @@ void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
204{ 208{
205 struct rt2x00lib_conf libconf; 209 struct rt2x00lib_conf libconf;
206 u16 hw_value; 210 u16 hw_value;
211 u16 autowake_timeout;
212 u16 beacon_int;
213 u16 beacon_diff;
207 214
208 memset(&libconf, 0, sizeof(libconf)); 215 memset(&libconf, 0, sizeof(libconf));
209 216
@@ -227,6 +234,10 @@ void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
227 sizeof(libconf.channel)); 234 sizeof(libconf.channel));
228 } 235 }
229 236
237 if (test_bit(REQUIRE_PS_AUTOWAKE, &rt2x00dev->cap_flags) &&
238 (ieee80211_flags & IEEE80211_CONF_CHANGE_PS))
239 cancel_delayed_work_sync(&rt2x00dev->autowakeup_work);
240
230 /* 241 /*
231 * Start configuration. 242 * Start configuration.
232 */ 243 */
@@ -239,6 +250,26 @@ void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
239 if (ieee80211_flags & IEEE80211_CONF_CHANGE_CHANNEL) 250 if (ieee80211_flags & IEEE80211_CONF_CHANGE_CHANNEL)
240 rt2x00link_reset_tuner(rt2x00dev, false); 251 rt2x00link_reset_tuner(rt2x00dev, false);
241 252
253 if (test_bit(REQUIRE_PS_AUTOWAKE, &rt2x00dev->cap_flags) &&
254 (ieee80211_flags & IEEE80211_CONF_CHANGE_PS) &&
255 (conf->flags & IEEE80211_CONF_PS)) {
256 beacon_diff = (long)jiffies - (long)rt2x00dev->last_beacon;
257 beacon_int = msecs_to_jiffies(rt2x00dev->beacon_int);
258
259 if (beacon_diff > beacon_int)
260 beacon_diff = 0;
261
262 autowake_timeout = (conf->max_sleep_period * beacon_int) - beacon_diff;
263 queue_delayed_work(rt2x00dev->workqueue,
264 &rt2x00dev->autowakeup_work,
265 autowake_timeout - 15);
266 }
267
268 if (conf->flags & IEEE80211_CONF_PS)
269 set_bit(CONFIG_POWERSAVING, &rt2x00dev->flags);
270 else
271 clear_bit(CONFIG_POWERSAVING, &rt2x00dev->flags);
272
242 rt2x00dev->curr_band = conf->channel->band; 273 rt2x00dev->curr_band = conf->channel->band;
243 rt2x00dev->curr_freq = conf->channel->center_freq; 274 rt2x00dev->curr_freq = conf->channel->center_freq;
244 rt2x00dev->tx_power = conf->power_level; 275 rt2x00dev->tx_power = conf->power_level;