madwifi: fix the long standing bug that is triggered by nodes getting a timeout on...
[openwrt.git] / package / mac80211 / patches / 309-rt2x00-Add-powersaving-support-rt2800usb.patch
1 From fa9b7fc2e662e086a7c0e045e541f773bf34c555 Mon Sep 17 00:00:00 2001
2 From: Ivo van Doorn <IvDoorn@gmail.com>
3 Date: Sat, 10 Jan 2009 14:31:00 +0100
4 Subject: [PATCH] rt2x00: Add powersaving support (rt2800usb)
5
6 Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
7 ---
8 drivers/net/wireless/rt2x00/rt2800usb.c | 36 ++++++++++++++++++++++++++++++-
9 1 files changed, 35 insertions(+), 1 deletions(-)
10
11 --- a/drivers/net/wireless/rt2x00/rt2800usb.c
12 +++ b/drivers/net/wireless/rt2x00/rt2800usb.c
13 @@ -860,6 +860,36 @@ static void rt2800usb_config_duration(st
14 rt2x00usb_register_write(rt2x00dev, BCN_TIME_CFG, reg);
15 }
16
17 +static void rt2800usb_config_ps(struct rt2x00_dev *rt2x00dev,
18 + struct rt2x00lib_conf *libconf)
19 +{
20 + enum dev_state state =
21 + (libconf->conf->flags & IEEE80211_CONF_PS) ?
22 + STATE_SLEEP : STATE_AWAKE;
23 + u32 reg;
24 +
25 + if (state == STATE_SLEEP) {
26 + rt2x00usb_register_write(rt2x00dev, AUTOWAKEUP_CFG, 0);
27 +
28 + rt2x00usb_register_read(rt2x00dev, AUTOWAKEUP_CFG, &reg);
29 + rt2x00_set_field32(&reg, AUTOWAKEUP_CFG_AUTO_LEAD_TIME, 5);
30 + rt2x00_set_field32(&reg, AUTOWAKEUP_CFG_TBCN_BEFORE_WAKE,
31 + libconf->conf->listen_interval - 1);
32 + rt2x00_set_field32(&reg, AUTOWAKEUP_CFG_AUTOWAKE, 1);
33 + rt2x00usb_register_write(rt2x00dev, AUTOWAKEUP_CFG, reg);
34 +
35 + rt2800usb_mcu_request(rt2x00dev, MCU_SLEEP, 0xff, 0, 0);
36 + } else {
37 + rt2800usb_mcu_request(rt2x00dev, MCU_WAKEUP, 0xff, 0, 0);
38 +
39 + rt2x00usb_register_read(rt2x00dev, AUTOWAKEUP_CFG, &reg);
40 + rt2x00_set_field32(&reg, AUTOWAKEUP_CFG_AUTO_LEAD_TIME, 0);
41 + rt2x00_set_field32(&reg, AUTOWAKEUP_CFG_TBCN_BEFORE_WAKE, 0);
42 + rt2x00_set_field32(&reg, AUTOWAKEUP_CFG_AUTOWAKE, 0);
43 + rt2x00usb_register_write(rt2x00dev, AUTOWAKEUP_CFG, reg);
44 + }
45 +}
46 +
47 static void rt2800usb_config(struct rt2x00_dev *rt2x00dev,
48 struct rt2x00lib_conf *libconf,
49 const unsigned int flags)
50 @@ -876,6 +906,8 @@ static void rt2800usb_config(struct rt2x
51 rt2800usb_config_retry_limit(rt2x00dev, libconf);
52 if (flags & IEEE80211_CONF_CHANGE_BEACON_INTERVAL)
53 rt2800usb_config_duration(rt2x00dev, libconf);
54 + if (flags & IEEE80211_CONF_CHANGE_PS)
55 + rt2800usb_config_ps(rt2x00dev, libconf);
56 }
57
58 /*
59 @@ -2112,7 +2144,9 @@ static int rt2800usb_probe_hw_mode(struc
60 */
61 rt2x00dev->hw->flags =
62 IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
63 - IEEE80211_HW_SIGNAL_DBM;
64 + IEEE80211_HW_SIGNAL_DBM |
65 + IEEE80211_HW_SUPPORTS_PS |
66 + IEEE80211_HW_PS_NULLFUNC_STACK;
67 rt2x00dev->hw->extra_tx_headroom = TXD_DESC_SIZE + TXINFO_DESC_SIZE;
68
69 SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
This page took 0.047312 seconds and 5 git commands to generate.