aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEyal Shapira <eyal@wizery.com>2012-02-02 12:06:45 -0500
committerLuciano Coelho <coelho@ti.com>2012-02-15 01:38:33 -0500
commit5c0dc2fcfec606cf9f2d28ff31bbeb0a6225b27a (patch)
treebe845615117febc537aa6a11f0fe5a79ca064467
parent59a10c66d0a1970d3f8a7e65bb1f03dec3aae3c5 (diff)
wl12xx: add forced_ps mode
For certain WiFi certification tests forcing PS is necessary. Since DPS is now enabled in the FW and this can't be achieved by using netlatency this required a new config option. Signed-off-by: Eyal Shapira <eyal@wizery.com> Signed-off-by: Eliad Peller <eliad@wizery.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
-rw-r--r--drivers/net/wireless/wl12xx/conf.h6
-rw-r--r--drivers/net/wireless/wl12xx/debugfs.c2
-rw-r--r--drivers/net/wireless/wl12xx/main.c25
-rw-r--r--drivers/net/wireless/wl12xx/ps.c10
-rw-r--r--drivers/net/wireless/wl12xx/wl12xx.h2
5 files changed, 32 insertions, 13 deletions
diff --git a/drivers/net/wireless/wl12xx/conf.h b/drivers/net/wireless/wl12xx/conf.h
index 80eafadc389d..823535cdf150 100644
--- a/drivers/net/wireless/wl12xx/conf.h
+++ b/drivers/net/wireless/wl12xx/conf.h
@@ -943,6 +943,12 @@ struct conf_conn_settings {
943 u16 dynamic_ps_timeout; 943 u16 dynamic_ps_timeout;
944 944
945 /* 945 /*
946 * Specifies whether dynamic PS should be disabled and PSM forced.
947 * This is required for certain WiFi certification tests.
948 */
949 u8 forced_ps;
950
951 /*
946 * 952 *
947 * Specifies the interval of the connection keep-alive null-func 953 * Specifies the interval of the connection keep-alive null-func
948 * frame in ms. 954 * frame in ms.
diff --git a/drivers/net/wireless/wl12xx/debugfs.c b/drivers/net/wireless/wl12xx/debugfs.c
index 15353fac0707..02da445ea98a 100644
--- a/drivers/net/wireless/wl12xx/debugfs.c
+++ b/drivers/net/wireless/wl12xx/debugfs.c
@@ -358,7 +358,7 @@ static ssize_t dynamic_ps_timeout_write(struct file *file,
358 */ 358 */
359 359
360 wl12xx_for_each_wlvif_sta(wl, wlvif) { 360 wl12xx_for_each_wlvif_sta(wl, wlvif) {
361 if (test_bit(WLVIF_FLAG_IN_AUTO_PS, &wlvif->flags)) 361 if (test_bit(WLVIF_FLAG_IN_PS, &wlvif->flags))
362 wl1271_ps_set_mode(wl, wlvif, STATION_AUTO_PS_MODE); 362 wl1271_ps_set_mode(wl, wlvif, STATION_AUTO_PS_MODE);
363 } 363 }
364 364
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index fa61dfd2084c..b828149a1655 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -247,6 +247,7 @@ static struct conf_drv_settings default_conf = {
247 .psm_exit_retries = 16, 247 .psm_exit_retries = 16,
248 .psm_entry_nullfunc_retries = 3, 248 .psm_entry_nullfunc_retries = 3,
249 .dynamic_ps_timeout = 100, 249 .dynamic_ps_timeout = 100,
250 .forced_ps = false,
250 .keep_alive_interval = 55000, 251 .keep_alive_interval = 55000,
251 .max_listen_interval = 20, 252 .max_listen_interval = 20,
252 }, 253 },
@@ -2510,17 +2511,29 @@ static int wl12xx_config_vif(struct wl1271 *wl, struct wl12xx_vif *wlvif,
2510 2511
2511 if ((conf->flags & IEEE80211_CONF_PS) && 2512 if ((conf->flags & IEEE80211_CONF_PS) &&
2512 test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags) && 2513 test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags) &&
2513 !test_bit(WLVIF_FLAG_IN_AUTO_PS, &wlvif->flags)) { 2514 !test_bit(WLVIF_FLAG_IN_PS, &wlvif->flags)) {
2514 2515
2515 wl1271_debug(DEBUG_PSM, "auto ps enabled"); 2516 int ps_mode;
2517 char *ps_mode_str;
2518
2519 if (wl->conf.conn.forced_ps) {
2520 ps_mode = STATION_POWER_SAVE_MODE;
2521 ps_mode_str = "forced";
2522 } else {
2523 ps_mode = STATION_AUTO_PS_MODE;
2524 ps_mode_str = "auto";
2525 }
2526
2527 wl1271_debug(DEBUG_PSM, "%s ps enabled", ps_mode_str);
2528
2529 ret = wl1271_ps_set_mode(wl, wlvif, ps_mode);
2516 2530
2517 ret = wl1271_ps_set_mode(wl, wlvif,
2518 STATION_AUTO_PS_MODE);
2519 if (ret < 0) 2531 if (ret < 0)
2520 wl1271_warning("enter auto ps failed %d", ret); 2532 wl1271_warning("enter %s ps failed %d",
2533 ps_mode_str, ret);
2521 2534
2522 } else if (!(conf->flags & IEEE80211_CONF_PS) && 2535 } else if (!(conf->flags & IEEE80211_CONF_PS) &&
2523 test_bit(WLVIF_FLAG_IN_AUTO_PS, &wlvif->flags)) { 2536 test_bit(WLVIF_FLAG_IN_PS, &wlvif->flags)) {
2524 2537
2525 wl1271_debug(DEBUG_PSM, "auto ps disabled"); 2538 wl1271_debug(DEBUG_PSM, "auto ps disabled");
2526 2539
diff --git a/drivers/net/wireless/wl12xx/ps.c b/drivers/net/wireless/wl12xx/ps.c
index d1979223ad28..23d67501c50a 100644
--- a/drivers/net/wireless/wl12xx/ps.c
+++ b/drivers/net/wireless/wl12xx/ps.c
@@ -56,7 +56,7 @@ void wl1271_elp_work(struct work_struct *work)
56 if (wlvif->bss_type == BSS_TYPE_AP_BSS) 56 if (wlvif->bss_type == BSS_TYPE_AP_BSS)
57 goto out; 57 goto out;
58 58
59 if (!test_bit(WLVIF_FLAG_IN_AUTO_PS, &wlvif->flags) && 59 if (!test_bit(WLVIF_FLAG_IN_PS, &wlvif->flags) &&
60 test_bit(WLVIF_FLAG_IN_USE, &wlvif->flags)) 60 test_bit(WLVIF_FLAG_IN_USE, &wlvif->flags))
61 goto out; 61 goto out;
62 } 62 }
@@ -84,7 +84,7 @@ void wl1271_ps_elp_sleep(struct wl1271 *wl)
84 if (wlvif->bss_type == BSS_TYPE_AP_BSS) 84 if (wlvif->bss_type == BSS_TYPE_AP_BSS)
85 return; 85 return;
86 86
87 if (!test_bit(WLVIF_FLAG_IN_AUTO_PS, &wlvif->flags) && 87 if (!test_bit(WLVIF_FLAG_IN_PS, &wlvif->flags) &&
88 test_bit(WLVIF_FLAG_IN_USE, &wlvif->flags)) 88 test_bit(WLVIF_FLAG_IN_USE, &wlvif->flags))
89 return; 89 return;
90 } 90 }
@@ -167,6 +167,7 @@ int wl1271_ps_set_mode(struct wl1271 *wl, struct wl12xx_vif *wlvif,
167 167
168 switch (mode) { 168 switch (mode) {
169 case STATION_AUTO_PS_MODE: 169 case STATION_AUTO_PS_MODE:
170 case STATION_POWER_SAVE_MODE:
170 wl1271_debug(DEBUG_PSM, "entering psm (mode=%d,timeout=%u)", 171 wl1271_debug(DEBUG_PSM, "entering psm (mode=%d,timeout=%u)",
171 mode, timeout); 172 mode, timeout);
172 173
@@ -182,7 +183,7 @@ int wl1271_ps_set_mode(struct wl1271 *wl, struct wl12xx_vif *wlvif,
182 if (ret < 0) 183 if (ret < 0)
183 return ret; 184 return ret;
184 185
185 set_bit(WLVIF_FLAG_IN_AUTO_PS, &wlvif->flags); 186 set_bit(WLVIF_FLAG_IN_PS, &wlvif->flags);
186 187
187 /* enable beacon early termination. Not relevant for 5GHz */ 188 /* enable beacon early termination. Not relevant for 5GHz */
188 if (wlvif->band == IEEE80211_BAND_2GHZ) { 189 if (wlvif->band == IEEE80211_BAND_2GHZ) {
@@ -205,9 +206,8 @@ int wl1271_ps_set_mode(struct wl1271 *wl, struct wl12xx_vif *wlvif,
205 if (ret < 0) 206 if (ret < 0)
206 return ret; 207 return ret;
207 208
208 clear_bit(WLVIF_FLAG_IN_AUTO_PS, &wlvif->flags); 209 clear_bit(WLVIF_FLAG_IN_PS, &wlvif->flags);
209 break; 210 break;
210 case STATION_POWER_SAVE_MODE:
211 default: 211 default:
212 wl1271_warning("trying to set ps to unsupported mode %d", mode); 212 wl1271_warning("trying to set ps to unsupported mode %d", mode);
213 ret = -EINVAL; 213 ret = -EINVAL;
diff --git a/drivers/net/wireless/wl12xx/wl12xx.h b/drivers/net/wireless/wl12xx/wl12xx.h
index 9baed6be6a31..61c58c13fa90 100644
--- a/drivers/net/wireless/wl12xx/wl12xx.h
+++ b/drivers/net/wireless/wl12xx/wl12xx.h
@@ -254,7 +254,7 @@ enum wl12xx_vif_flags {
254 WLVIF_FLAG_STA_ASSOCIATED, 254 WLVIF_FLAG_STA_ASSOCIATED,
255 WLVIF_FLAG_IBSS_JOINED, 255 WLVIF_FLAG_IBSS_JOINED,
256 WLVIF_FLAG_AP_STARTED, 256 WLVIF_FLAG_AP_STARTED,
257 WLVIF_FLAG_IN_AUTO_PS, 257 WLVIF_FLAG_IN_PS,
258 WLVIF_FLAG_STA_STATE_SENT, 258 WLVIF_FLAG_STA_STATE_SENT,
259 WLVIF_FLAG_RX_STREAMING_STARTED, 259 WLVIF_FLAG_RX_STREAMING_STARTED,
260 WLVIF_FLAG_PSPOLL_FAILURE, 260 WLVIF_FLAG_PSPOLL_FAILURE,