Commit dae728fe authored by Eyal Shapira's avatar Eyal Shapira Committed by Luciano Coelho

wl12xx: Set different wake up conditions in case of suspend

Added ability to set different wake up conditions for suspend/resume.
Set default values to wake up every 3 DTIMs while suspended
and every 1 DTIM while resumed
Signed-off-by: default avatarEyal Shapira <eyal@wizery.com>
Signed-off-by: default avatarEliad Peller <eliad@wizery.com>
Signed-off-by: default avatarLuciano Coelho <coelho@ti.com>
parent 26612c43
...@@ -34,12 +34,14 @@ ...@@ -34,12 +34,14 @@
#include "reg.h" #include "reg.h"
#include "ps.h" #include "ps.h"
int wl1271_acx_wake_up_conditions(struct wl1271 *wl, struct wl12xx_vif *wlvif) int wl1271_acx_wake_up_conditions(struct wl1271 *wl, struct wl12xx_vif *wlvif,
u8 wake_up_event, u8 listen_interval)
{ {
struct acx_wake_up_condition *wake_up; struct acx_wake_up_condition *wake_up;
int ret; int ret;
wl1271_debug(DEBUG_ACX, "acx wake up conditions"); wl1271_debug(DEBUG_ACX, "acx wake up conditions (wake_up_event %d listen_interval %d)",
wake_up_event, listen_interval);
wake_up = kzalloc(sizeof(*wake_up), GFP_KERNEL); wake_up = kzalloc(sizeof(*wake_up), GFP_KERNEL);
if (!wake_up) { if (!wake_up) {
...@@ -48,8 +50,8 @@ int wl1271_acx_wake_up_conditions(struct wl1271 *wl, struct wl12xx_vif *wlvif) ...@@ -48,8 +50,8 @@ int wl1271_acx_wake_up_conditions(struct wl1271 *wl, struct wl12xx_vif *wlvif)
} }
wake_up->role_id = wlvif->role_id; wake_up->role_id = wlvif->role_id;
wake_up->wake_up_event = wl->conf.conn.wake_up_event; wake_up->wake_up_event = wake_up_event;
wake_up->listen_interval = wl->conf.conn.listen_interval; wake_up->listen_interval = listen_interval;
ret = wl1271_cmd_configure(wl, ACX_WAKE_UP_CONDITIONS, ret = wl1271_cmd_configure(wl, ACX_WAKE_UP_CONDITIONS,
wake_up, sizeof(*wake_up)); wake_up, sizeof(*wake_up));
......
...@@ -1226,7 +1226,8 @@ enum { ...@@ -1226,7 +1226,8 @@ enum {
int wl1271_acx_wake_up_conditions(struct wl1271 *wl, int wl1271_acx_wake_up_conditions(struct wl1271 *wl,
struct wl12xx_vif *wlvif); struct wl12xx_vif *wlvif,
u8 wake_up_event, u8 listen_interval);
int wl1271_acx_sleep_auth(struct wl1271 *wl, u8 sleep_auth); int wl1271_acx_sleep_auth(struct wl1271 *wl, u8 sleep_auth);
int wl1271_acx_tx_power(struct wl1271 *wl, struct wl12xx_vif *wlvif, int wl1271_acx_tx_power(struct wl1271 *wl, struct wl12xx_vif *wlvif,
int power); int power);
......
...@@ -818,6 +818,19 @@ struct conf_conn_settings { ...@@ -818,6 +818,19 @@ struct conf_conn_settings {
*/ */
u8 listen_interval; u8 listen_interval;
/*
* Firmware wakeup conditions during suspend
* Range: CONF_WAKE_UP_EVENT_*
*/
u8 suspend_wake_up_event;
/*
* Listen interval during suspend.
* Currently will be in DTIMs (1-10)
*
*/
u8 suspend_listen_interval;
/* /*
* Enable or disable the beacon filtering. * Enable or disable the beacon filtering.
* *
......
...@@ -221,6 +221,8 @@ static struct conf_drv_settings default_conf = { ...@@ -221,6 +221,8 @@ static struct conf_drv_settings default_conf = {
.conn = { .conn = {
.wake_up_event = CONF_WAKE_UP_EVENT_DTIM, .wake_up_event = CONF_WAKE_UP_EVENT_DTIM,
.listen_interval = 1, .listen_interval = 1,
.suspend_wake_up_event = CONF_WAKE_UP_EVENT_N_DTIM,
.suspend_listen_interval = 3,
.bcn_filt_mode = CONF_BCN_FILT_MODE_ENABLED, .bcn_filt_mode = CONF_BCN_FILT_MODE_ENABLED,
.bcn_filt_ie_count = 2, .bcn_filt_ie_count = 2,
.bcn_filt_ie = { .bcn_filt_ie = {
...@@ -1574,6 +1576,35 @@ static struct notifier_block wl1271_dev_notifier = { ...@@ -1574,6 +1576,35 @@ static struct notifier_block wl1271_dev_notifier = {
}; };
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int wl1271_configure_suspend_sta(struct wl1271 *wl,
struct wl12xx_vif *wlvif)
{
int ret = 0;
mutex_lock(&wl->mutex);
if (!test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags))
goto out_unlock;
ret = wl1271_ps_elp_wakeup(wl);
if (ret < 0)
goto out_unlock;
ret = wl1271_acx_wake_up_conditions(wl, wlvif,
wl->conf.conn.suspend_wake_up_event,
wl->conf.conn.suspend_listen_interval);
if (ret < 0)
wl1271_error("suspend: set wake up conditions failed: %d", ret);
wl1271_ps_elp_sleep(wl);
out_unlock:
mutex_unlock(&wl->mutex);
return ret;
}
static int wl1271_configure_suspend_ap(struct wl1271 *wl, static int wl1271_configure_suspend_ap(struct wl1271 *wl,
struct wl12xx_vif *wlvif) struct wl12xx_vif *wlvif)
...@@ -1601,6 +1632,8 @@ static int wl1271_configure_suspend_ap(struct wl1271 *wl, ...@@ -1601,6 +1632,8 @@ static int wl1271_configure_suspend_ap(struct wl1271 *wl,
static int wl1271_configure_suspend(struct wl1271 *wl, static int wl1271_configure_suspend(struct wl1271 *wl,
struct wl12xx_vif *wlvif) struct wl12xx_vif *wlvif)
{ {
if (wlvif->bss_type == BSS_TYPE_STA_BSS)
return wl1271_configure_suspend_sta(wl, wlvif);
if (wlvif->bss_type == BSS_TYPE_AP_BSS) if (wlvif->bss_type == BSS_TYPE_AP_BSS)
return wl1271_configure_suspend_ap(wl, wlvif); return wl1271_configure_suspend_ap(wl, wlvif);
return 0; return 0;
...@@ -1609,10 +1642,11 @@ static int wl1271_configure_suspend(struct wl1271 *wl, ...@@ -1609,10 +1642,11 @@ static int wl1271_configure_suspend(struct wl1271 *wl,
static void wl1271_configure_resume(struct wl1271 *wl, static void wl1271_configure_resume(struct wl1271 *wl,
struct wl12xx_vif *wlvif) struct wl12xx_vif *wlvif)
{ {
int ret; int ret = 0;
bool is_ap = wlvif->bss_type == BSS_TYPE_AP_BSS; bool is_ap = wlvif->bss_type == BSS_TYPE_AP_BSS;
bool is_sta = wlvif->bss_type == BSS_TYPE_STA_BSS;
if (!is_ap) if ((!is_ap) && (!is_sta))
return; return;
mutex_lock(&wl->mutex); mutex_lock(&wl->mutex);
...@@ -1620,7 +1654,18 @@ static void wl1271_configure_resume(struct wl1271 *wl, ...@@ -1620,7 +1654,18 @@ static void wl1271_configure_resume(struct wl1271 *wl,
if (ret < 0) if (ret < 0)
goto out; goto out;
wl1271_acx_beacon_filter_opt(wl, wlvif, false); if (is_sta) {
ret = wl1271_acx_wake_up_conditions(wl, wlvif,
wl->conf.conn.wake_up_event,
wl->conf.conn.listen_interval);
if (ret < 0)
wl1271_error("resume: wake up conditions failed: %d",
ret);
} else if (is_ap) {
ret = wl1271_acx_beacon_filter_opt(wl, wlvif, false);
}
wl1271_ps_elp_sleep(wl); wl1271_ps_elp_sleep(wl);
out: out:
......
...@@ -170,7 +170,9 @@ int wl1271_ps_set_mode(struct wl1271 *wl, struct wl12xx_vif *wlvif, ...@@ -170,7 +170,9 @@ int wl1271_ps_set_mode(struct wl1271 *wl, struct wl12xx_vif *wlvif,
wl1271_debug(DEBUG_PSM, "entering psm (mode=%d,timeout=%u)", wl1271_debug(DEBUG_PSM, "entering psm (mode=%d,timeout=%u)",
mode, timeout); mode, timeout);
ret = wl1271_acx_wake_up_conditions(wl, wlvif); ret = wl1271_acx_wake_up_conditions(wl, wlvif,
wl->conf.conn.wake_up_event,
wl->conf.conn.listen_interval);
if (ret < 0) { if (ret < 0) {
wl1271_error("couldn't set wake up conditions"); wl1271_error("couldn't set wake up conditions");
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment