aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wl12xx/wl1271_event.c
diff options
context:
space:
mode:
authorJuuso Oikarinen <juuso.oikarinen@nokia.com>2010-02-18 06:25:36 -0500
committerJohn W. Linville <linville@tuxdriver.com>2010-02-19 15:52:42 -0500
commitd8c42c0c282a5edd9ea2eef4c929d9cec2798653 (patch)
tree63af39e5de1c1c878d3abc72e42c380289704f39 /drivers/net/wireless/wl12xx/wl1271_event.c
parente2117cea27c6b27e1a379acac5eb0433eeb7033a (diff)
wl1271: Fix PSM entry
Currently the PSM entry function assumes successful operation, and enables ELP, BET and beacon filtering right away. This is bad, because the PSM entry may fail due to environmental issues, which will cause the ELP, BET and beacon filtering to be illegally enabled (because FW remains in active state.) Fix this by enabling ELP, BET and beacon filtering only after successful entry, and by ensuring the firmware is in active mode after the failure. Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com> Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/wl12xx/wl1271_event.c')
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_event.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271_event.c b/drivers/net/wireless/wl12xx/wl1271_event.c
index 0a145afc9905..cecbae2ded35 100644
--- a/drivers/net/wireless/wl12xx/wl1271_event.c
+++ b/drivers/net/wireless/wl12xx/wl1271_event.c
@@ -78,24 +78,55 @@ static int wl1271_event_ps_report(struct wl1271 *wl,
78 78
79 switch (mbox->ps_status) { 79 switch (mbox->ps_status) {
80 case EVENT_ENTER_POWER_SAVE_FAIL: 80 case EVENT_ENTER_POWER_SAVE_FAIL:
81 wl1271_debug(DEBUG_PSM, "PSM entry failed");
82
81 if (!test_bit(WL1271_FLAG_PSM, &wl->flags)) { 83 if (!test_bit(WL1271_FLAG_PSM, &wl->flags)) {
84 /* remain in active mode */
82 wl->psm_entry_retry = 0; 85 wl->psm_entry_retry = 0;
83 break; 86 break;
84 } 87 }
85 88
86 if (wl->psm_entry_retry < wl->conf.conn.psm_entry_retries) { 89 if (wl->psm_entry_retry < wl->conf.conn.psm_entry_retries) {
87 wl->psm_entry_retry++; 90 wl->psm_entry_retry++;
88 ret = wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE); 91 ret = wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE,
92 true);
89 } else { 93 } else {
90 wl1271_error("PSM entry failed, giving up.\n"); 94 wl1271_error("PSM entry failed, giving up.\n");
95 /* make sure the firmware goes into active mode */
96 ret = wl1271_ps_set_mode(wl, STATION_ACTIVE_MODE,
97 false);
91 wl->psm_entry_retry = 0; 98 wl->psm_entry_retry = 0;
92 } 99 }
93 break; 100 break;
94 case EVENT_ENTER_POWER_SAVE_SUCCESS: 101 case EVENT_ENTER_POWER_SAVE_SUCCESS:
95 wl->psm_entry_retry = 0; 102 wl->psm_entry_retry = 0;
103
104 /* enable beacon filtering */
105 ret = wl1271_acx_beacon_filter_opt(wl, true);
106 if (ret < 0)
107 break;
108
109 /* enable beacon early termination */
110 ret = wl1271_acx_bet_enable(wl, true);
111 if (ret < 0)
112 break;
113
114 /* go to extremely low power mode */
115 wl1271_ps_elp_sleep(wl);
116 if (ret < 0)
117 break;
96 break; 118 break;
97 case EVENT_EXIT_POWER_SAVE_FAIL: 119 case EVENT_EXIT_POWER_SAVE_FAIL:
98 wl1271_info("PSM exit failed"); 120 wl1271_debug(DEBUG_PSM, "PSM exit failed");
121
122 if (test_bit(WL1271_FLAG_PSM, &wl->flags)) {
123 wl->psm_entry_retry = 0;
124 break;
125 }
126
127 /* make sure the firmware goes to active mode */
128 ret = wl1271_ps_set_mode(wl, STATION_ACTIVE_MODE,
129 false);
99 break; 130 break;
100 case EVENT_EXIT_POWER_SAVE_SUCCESS: 131 case EVENT_EXIT_POWER_SAVE_SUCCESS:
101 default: 132 default: