aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEliad Peller <eliad@wizery.com>2011-10-11 05:49:15 -0400
committerLuciano Coelho <coelho@ti.com>2011-10-11 08:04:23 -0400
commita4e4130dcea01f3e0dfcbfeaf0d815b971e6e515 (patch)
treebfc84bbad4246630300677ef4b8a9a1098b3a7a7
parenta32d0cdfcb7e5d41f210e13cbc78dc86a5a85a08 (diff)
wl12xx: configure sleep_policy according to active roles
If there is an active AP role, stay always on. Otherwise, allow chip to enter elp. (Note that this is a global configuration, so if the device is already configured according to our policy, we don't have to configure it again) Signed-off-by: Eliad Peller <eliad@wizery.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
-rw-r--r--drivers/net/wireless/wl12xx/init.c29
-rw-r--r--drivers/net/wireless/wl12xx/main.c10
-rw-r--r--drivers/net/wireless/wl12xx/wl12xx.h2
3 files changed, 30 insertions, 11 deletions
diff --git a/drivers/net/wireless/wl12xx/init.c b/drivers/net/wireless/wl12xx/init.c
index 80e89e319879..4af7e2fb52fd 100644
--- a/drivers/net/wireless/wl12xx/init.c
+++ b/drivers/net/wireless/wl12xx/init.c
@@ -343,11 +343,6 @@ static int wl1271_sta_hw_init(struct wl1271 *wl, struct wl12xx_vif *wlvif)
343 if (ret < 0) 343 if (ret < 0)
344 return ret; 344 return ret;
345 345
346 /* Configure for ELP power saving */
347 ret = wl1271_acx_sleep_auth(wl, WL1271_PSM_ELP);
348 if (ret < 0)
349 return ret;
350
351 ret = wl1271_acx_sta_rate_policies(wl, wlvif); 346 ret = wl1271_acx_sta_rate_policies(wl, wlvif);
352 if (ret < 0) 347 if (ret < 0)
353 return ret; 348 return ret;
@@ -382,11 +377,6 @@ static int wl1271_ap_hw_init(struct wl1271 *wl, struct wl12xx_vif *wlvif)
382{ 377{
383 int ret; 378 int ret;
384 379
385 /* Configure for power always on */
386 ret = wl1271_acx_sleep_auth(wl, WL1271_PSM_CAM);
387 if (ret < 0)
388 return ret;
389
390 ret = wl1271_init_ap_rates(wl, wlvif); 380 ret = wl1271_init_ap_rates(wl, wlvif);
391 if (ret < 0) 381 if (ret < 0)
392 return ret; 382 return ret;
@@ -577,9 +567,26 @@ int wl1271_init_vif_specific(struct wl1271 *wl, struct ieee80211_vif *vif)
577 struct conf_tx_ac_category *conf_ac; 567 struct conf_tx_ac_category *conf_ac;
578 struct conf_tx_tid *conf_tid; 568 struct conf_tx_tid *conf_tid;
579 bool is_ap = (wlvif->bss_type == BSS_TYPE_AP_BSS); 569 bool is_ap = (wlvif->bss_type == BSS_TYPE_AP_BSS);
580
581 int ret, i; 570 int ret, i;
582 571
572 /*
573 * consider all existing roles before configuring psm.
574 * TODO: reconfigure on interface removal.
575 */
576 if (!wl->ap_count) {
577 if (is_ap) {
578 /* Configure for power always on */
579 ret = wl1271_acx_sleep_auth(wl, WL1271_PSM_CAM);
580 if (ret < 0)
581 return ret;
582 } else if (!wl->sta_count) {
583 /* Configure for ELP power saving */
584 ret = wl1271_acx_sleep_auth(wl, WL1271_PSM_ELP);
585 if (ret < 0)
586 return ret;
587 }
588 }
589
583 /* Mode specific init */ 590 /* Mode specific init */
584 if (is_ap) { 591 if (is_ap) {
585 ret = wl1271_ap_hw_init(wl, wlvif); 592 ret = wl1271_ap_hw_init(wl, wlvif);
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index 0623f5dc02ca..b52deac368f4 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -2117,6 +2117,11 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw,
2117 wl->vif = vif; 2117 wl->vif = vif;
2118 list_add(&wlvif->list, &wl->wlvif_list); 2118 list_add(&wlvif->list, &wl->wlvif_list);
2119 set_bit(WL1271_FLAG_IF_INITIALIZED, &wl->flags); 2119 set_bit(WL1271_FLAG_IF_INITIALIZED, &wl->flags);
2120
2121 if (wlvif->bss_type == BSS_TYPE_AP_BSS)
2122 wl->ap_count++;
2123 else
2124 wl->sta_count++;
2120out: 2125out:
2121 mutex_unlock(&wl->mutex); 2126 mutex_unlock(&wl->mutex);
2122 2127
@@ -2188,6 +2193,11 @@ deinit:
2188 wlvif->role_id = WL12XX_INVALID_ROLE_ID; 2193 wlvif->role_id = WL12XX_INVALID_ROLE_ID;
2189 wlvif->dev_role_id = WL12XX_INVALID_ROLE_ID; 2194 wlvif->dev_role_id = WL12XX_INVALID_ROLE_ID;
2190 2195
2196 if (wlvif->bss_type == BSS_TYPE_AP_BSS)
2197 wl->ap_count--;
2198 else
2199 wl->sta_count--;
2200
2191 mutex_unlock(&wl->mutex); 2201 mutex_unlock(&wl->mutex);
2192 cancel_delayed_work_sync(&wlvif->pspoll_work); 2202 cancel_delayed_work_sync(&wlvif->pspoll_work);
2193 2203
diff --git a/drivers/net/wireless/wl12xx/wl12xx.h b/drivers/net/wireless/wl12xx/wl12xx.h
index 55561c597ad9..fd78f8c1ebcc 100644
--- a/drivers/net/wireless/wl12xx/wl12xx.h
+++ b/drivers/net/wireless/wl12xx/wl12xx.h
@@ -395,6 +395,8 @@ struct wl1271 {
395 unsigned long roc_map[BITS_TO_LONGS(WL12XX_MAX_ROLES)]; 395 unsigned long roc_map[BITS_TO_LONGS(WL12XX_MAX_ROLES)];
396 396
397 struct list_head wlvif_list; 397 struct list_head wlvif_list;
398 u8 sta_count;
399 u8 ap_count;
398 400
399 struct wl1271_acx_mem_map *target_mem_map; 401 struct wl1271_acx_mem_map *target_mem_map;
400 402