diff options
author | Jarkko Nikula <jhnikula@gmail.com> | 2011-04-04 04:04:57 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-04-07 15:34:14 -0400 |
commit | a0bbb58bcb70295ff05f870c93d34f9fbe614204 (patch) | |
tree | 63eaefe05ef883aef37a4b6ecd121ae0ec9f0471 /drivers/net | |
parent | ffbd308dce898a857de76d17cc05748505cf4ece (diff) |
wl1251: Prepare for idle mode support
RFC for WL1251 idle mode support brought a few issues that are worth to
update before adding the idle mode support.
Since the idle mode can reuse the code that is now used in Power Save Mode
(PSM), the flag psm in struct wl1251 is changed to variable station_mode
to be able to distinguish between PSM and idle modes.
As the station mode is different than the power power save mode command
that is sent to chip, the enum wl1251_cmd_ps_mod values are used only when
communicating with the chip and new enum wl1251_station_mode values are used
inside the driver.
Confusing comment about psm and elp relation is removed since the PSM is
actually activated by putting the chip into Entreme Low Power (ELP) mode.
Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
Acked-by: Kalle Valo <kvalo@adurom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/wl1251/cmd.h | 4 | ||||
-rw-r--r-- | drivers/net/wireless/wl1251/event.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/wl1251/main.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/wl1251/ps.c | 14 | ||||
-rw-r--r-- | drivers/net/wireless/wl1251/ps.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/wl1251/wl1251.h | 8 |
6 files changed, 22 insertions, 18 deletions
diff --git a/drivers/net/wireless/wl1251/cmd.h b/drivers/net/wireless/wl1251/cmd.h index e5c74c631374..79ca5273c9e9 100644 --- a/drivers/net/wireless/wl1251/cmd.h +++ b/drivers/net/wireless/wl1251/cmd.h | |||
@@ -313,8 +313,8 @@ struct wl1251_cmd_vbm_update { | |||
313 | } __packed; | 313 | } __packed; |
314 | 314 | ||
315 | enum wl1251_cmd_ps_mode { | 315 | enum wl1251_cmd_ps_mode { |
316 | STATION_ACTIVE_MODE, | 316 | CHIP_ACTIVE_MODE, |
317 | STATION_POWER_SAVE_MODE | 317 | CHIP_POWER_SAVE_MODE |
318 | }; | 318 | }; |
319 | 319 | ||
320 | struct wl1251_cmd_ps_params { | 320 | struct wl1251_cmd_ps_params { |
diff --git a/drivers/net/wireless/wl1251/event.c b/drivers/net/wireless/wl1251/event.c index dfc4579acb06..9f15ccaf8f05 100644 --- a/drivers/net/wireless/wl1251/event.c +++ b/drivers/net/wireless/wl1251/event.c | |||
@@ -68,14 +68,16 @@ static int wl1251_event_process(struct wl1251 *wl, struct event_mailbox *mbox) | |||
68 | if (vector & BSS_LOSE_EVENT_ID) { | 68 | if (vector & BSS_LOSE_EVENT_ID) { |
69 | wl1251_debug(DEBUG_EVENT, "BSS_LOSE_EVENT"); | 69 | wl1251_debug(DEBUG_EVENT, "BSS_LOSE_EVENT"); |
70 | 70 | ||
71 | if (wl->psm_requested && wl->psm) { | 71 | if (wl->psm_requested && |
72 | wl->station_mode != STATION_ACTIVE_MODE) { | ||
72 | ret = wl1251_ps_set_mode(wl, STATION_ACTIVE_MODE); | 73 | ret = wl1251_ps_set_mode(wl, STATION_ACTIVE_MODE); |
73 | if (ret < 0) | 74 | if (ret < 0) |
74 | return ret; | 75 | return ret; |
75 | } | 76 | } |
76 | } | 77 | } |
77 | 78 | ||
78 | if (vector & SYNCHRONIZATION_TIMEOUT_EVENT_ID && wl->psm) { | 79 | if (vector & SYNCHRONIZATION_TIMEOUT_EVENT_ID && |
80 | wl->station_mode != STATION_ACTIVE_MODE) { | ||
79 | wl1251_debug(DEBUG_EVENT, "SYNCHRONIZATION_TIMEOUT_EVENT"); | 81 | wl1251_debug(DEBUG_EVENT, "SYNCHRONIZATION_TIMEOUT_EVENT"); |
80 | 82 | ||
81 | /* indicate to the stack, that beacons have been lost */ | 83 | /* indicate to the stack, that beacons have been lost */ |
diff --git a/drivers/net/wireless/wl1251/main.c b/drivers/net/wireless/wl1251/main.c index 12c9e635a6d6..04a054915dbe 100644 --- a/drivers/net/wireless/wl1251/main.c +++ b/drivers/net/wireless/wl1251/main.c | |||
@@ -497,7 +497,7 @@ static void wl1251_op_stop(struct ieee80211_hw *hw) | |||
497 | wl->rx_last_id = 0; | 497 | wl->rx_last_id = 0; |
498 | wl->next_tx_complete = 0; | 498 | wl->next_tx_complete = 0; |
499 | wl->elp = false; | 499 | wl->elp = false; |
500 | wl->psm = 0; | 500 | wl->station_mode = STATION_ACTIVE_MODE; |
501 | wl->tx_queue_stopped = false; | 501 | wl->tx_queue_stopped = false; |
502 | wl->power_level = WL1251_DEFAULT_POWER_LEVEL; | 502 | wl->power_level = WL1251_DEFAULT_POWER_LEVEL; |
503 | wl->rssi_thold = 0; | 503 | wl->rssi_thold = 0; |
@@ -632,7 +632,7 @@ static int wl1251_op_config(struct ieee80211_hw *hw, u32 changed) | |||
632 | 632 | ||
633 | wl->psm_requested = false; | 633 | wl->psm_requested = false; |
634 | 634 | ||
635 | if (wl->psm) { | 635 | if (wl->station_mode != STATION_ACTIVE_MODE) { |
636 | ret = wl1251_ps_set_mode(wl, STATION_ACTIVE_MODE); | 636 | ret = wl1251_ps_set_mode(wl, STATION_ACTIVE_MODE); |
637 | if (ret < 0) | 637 | if (ret < 0) |
638 | goto out_sleep; | 638 | goto out_sleep; |
@@ -1384,7 +1384,7 @@ struct ieee80211_hw *wl1251_alloc_hw(void) | |||
1384 | wl->rx_config = WL1251_DEFAULT_RX_CONFIG; | 1384 | wl->rx_config = WL1251_DEFAULT_RX_CONFIG; |
1385 | wl->rx_filter = WL1251_DEFAULT_RX_FILTER; | 1385 | wl->rx_filter = WL1251_DEFAULT_RX_FILTER; |
1386 | wl->elp = false; | 1386 | wl->elp = false; |
1387 | wl->psm = 0; | 1387 | wl->station_mode = STATION_ACTIVE_MODE; |
1388 | wl->psm_requested = false; | 1388 | wl->psm_requested = false; |
1389 | wl->tx_queue_stopped = false; | 1389 | wl->tx_queue_stopped = false; |
1390 | wl->power_level = WL1251_DEFAULT_POWER_LEVEL; | 1390 | wl->power_level = WL1251_DEFAULT_POWER_LEVEL; |
diff --git a/drivers/net/wireless/wl1251/ps.c b/drivers/net/wireless/wl1251/ps.c index 9cc514703d2a..97a5b8c82f01 100644 --- a/drivers/net/wireless/wl1251/ps.c +++ b/drivers/net/wireless/wl1251/ps.c | |||
@@ -39,7 +39,7 @@ void wl1251_elp_work(struct work_struct *work) | |||
39 | 39 | ||
40 | mutex_lock(&wl->mutex); | 40 | mutex_lock(&wl->mutex); |
41 | 41 | ||
42 | if (wl->elp || !wl->psm) | 42 | if (wl->elp || wl->station_mode == STATION_ACTIVE_MODE) |
43 | goto out; | 43 | goto out; |
44 | 44 | ||
45 | wl1251_debug(DEBUG_PSM, "chip to elp"); | 45 | wl1251_debug(DEBUG_PSM, "chip to elp"); |
@@ -57,7 +57,7 @@ void wl1251_ps_elp_sleep(struct wl1251 *wl) | |||
57 | { | 57 | { |
58 | unsigned long delay; | 58 | unsigned long delay; |
59 | 59 | ||
60 | if (wl->psm) { | 60 | if (wl->station_mode != STATION_ACTIVE_MODE) { |
61 | delay = msecs_to_jiffies(ELP_ENTRY_DELAY); | 61 | delay = msecs_to_jiffies(ELP_ENTRY_DELAY); |
62 | ieee80211_queue_delayed_work(wl->hw, &wl->elp_work, delay); | 62 | ieee80211_queue_delayed_work(wl->hw, &wl->elp_work, delay); |
63 | } | 63 | } |
@@ -104,7 +104,7 @@ int wl1251_ps_elp_wakeup(struct wl1251 *wl) | |||
104 | return 0; | 104 | return 0; |
105 | } | 105 | } |
106 | 106 | ||
107 | int wl1251_ps_set_mode(struct wl1251 *wl, enum wl1251_cmd_ps_mode mode) | 107 | int wl1251_ps_set_mode(struct wl1251 *wl, enum wl1251_station_mode mode) |
108 | { | 108 | { |
109 | int ret; | 109 | int ret; |
110 | 110 | ||
@@ -128,15 +128,13 @@ int wl1251_ps_set_mode(struct wl1251 *wl, enum wl1251_cmd_ps_mode mode) | |||
128 | if (ret < 0) | 128 | if (ret < 0) |
129 | return ret; | 129 | return ret; |
130 | 130 | ||
131 | ret = wl1251_cmd_ps_mode(wl, STATION_POWER_SAVE_MODE); | 131 | ret = wl1251_cmd_ps_mode(wl, CHIP_POWER_SAVE_MODE); |
132 | if (ret < 0) | 132 | if (ret < 0) |
133 | return ret; | 133 | return ret; |
134 | 134 | ||
135 | ret = wl1251_acx_sleep_auth(wl, WL1251_PSM_ELP); | 135 | ret = wl1251_acx_sleep_auth(wl, WL1251_PSM_ELP); |
136 | if (ret < 0) | 136 | if (ret < 0) |
137 | return ret; | 137 | return ret; |
138 | |||
139 | wl->psm = 1; | ||
140 | break; | 138 | break; |
141 | case STATION_ACTIVE_MODE: | 139 | case STATION_ACTIVE_MODE: |
142 | default: | 140 | default: |
@@ -163,13 +161,13 @@ int wl1251_ps_set_mode(struct wl1251 *wl, enum wl1251_cmd_ps_mode mode) | |||
163 | if (ret < 0) | 161 | if (ret < 0) |
164 | return ret; | 162 | return ret; |
165 | 163 | ||
166 | ret = wl1251_cmd_ps_mode(wl, STATION_ACTIVE_MODE); | 164 | ret = wl1251_cmd_ps_mode(wl, CHIP_ACTIVE_MODE); |
167 | if (ret < 0) | 165 | if (ret < 0) |
168 | return ret; | 166 | return ret; |
169 | 167 | ||
170 | wl->psm = 0; | ||
171 | break; | 168 | break; |
172 | } | 169 | } |
170 | wl->station_mode = mode; | ||
173 | 171 | ||
174 | return ret; | 172 | return ret; |
175 | } | 173 | } |
diff --git a/drivers/net/wireless/wl1251/ps.h b/drivers/net/wireless/wl1251/ps.h index 55c3dda75e69..75efad246d67 100644 --- a/drivers/net/wireless/wl1251/ps.h +++ b/drivers/net/wireless/wl1251/ps.h | |||
@@ -26,7 +26,7 @@ | |||
26 | #include "wl1251.h" | 26 | #include "wl1251.h" |
27 | #include "acx.h" | 27 | #include "acx.h" |
28 | 28 | ||
29 | int wl1251_ps_set_mode(struct wl1251 *wl, enum wl1251_cmd_ps_mode mode); | 29 | int wl1251_ps_set_mode(struct wl1251 *wl, enum wl1251_station_mode mode); |
30 | void wl1251_ps_elp_sleep(struct wl1251 *wl); | 30 | void wl1251_ps_elp_sleep(struct wl1251 *wl); |
31 | int wl1251_ps_elp_wakeup(struct wl1251 *wl); | 31 | int wl1251_ps_elp_wakeup(struct wl1251 *wl); |
32 | void wl1251_elp_work(struct work_struct *work); | 32 | void wl1251_elp_work(struct work_struct *work); |
diff --git a/drivers/net/wireless/wl1251/wl1251.h b/drivers/net/wireless/wl1251/wl1251.h index bb23cd522b22..bf245a87e80e 100644 --- a/drivers/net/wireless/wl1251/wl1251.h +++ b/drivers/net/wireless/wl1251/wl1251.h | |||
@@ -129,6 +129,11 @@ enum wl1251_partition_type { | |||
129 | PART_TABLE_LEN | 129 | PART_TABLE_LEN |
130 | }; | 130 | }; |
131 | 131 | ||
132 | enum wl1251_station_mode { | ||
133 | STATION_ACTIVE_MODE, | ||
134 | STATION_POWER_SAVE_MODE, | ||
135 | }; | ||
136 | |||
132 | struct wl1251_partition { | 137 | struct wl1251_partition { |
133 | u32 size; | 138 | u32 size; |
134 | u32 start; | 139 | u32 start; |
@@ -358,8 +363,7 @@ struct wl1251 { | |||
358 | 363 | ||
359 | struct delayed_work elp_work; | 364 | struct delayed_work elp_work; |
360 | 365 | ||
361 | /* we can be in psm, but not in elp, we have to differentiate */ | 366 | enum wl1251_station_mode station_mode; |
362 | bool psm; | ||
363 | 367 | ||
364 | /* PSM mode requested */ | 368 | /* PSM mode requested */ |
365 | bool psm_requested; | 369 | bool psm_requested; |