aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wl1251
diff options
context:
space:
mode:
authorJarkko Nikula <jhnikula@gmail.com>2011-04-04 04:04:58 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-04-07 15:34:14 -0400
commit1e5f52de216a32986a5c3cbc358dbb2620a03047 (patch)
treee5294e3a2f61bd49994ea730d9d63cb2aa128a84 /drivers/net/wireless/wl1251
parenta0bbb58bcb70295ff05f870c93d34f9fbe614204 (diff)
wl1251: Add support for idle mode
On Nokia N900 the wl1251 consumes the most power when the interface is up but not associated to access point (that supports PSM). In terms of battery current consumption, the consumption is ~180 mA higher when the interface is up but not associated and only ~5 mA higher when associated compared to interface down and driver not loaded cases. This patch adds support for the mac80211 idle notifications. Chip is put into idle very much the same way when entering into PSM by utilizing the Extreme Low Power (ELP) mode. I.e. idle is entered by setting necessary conditions in wl1251_ps_set_mode followed by a call to wl1251_ps_elp_sleep. It seems it is just enough the authorize ELP mode followed by CMD_DISCONNECT (thanks to Kalle Valo about the idea to use it). Without disconnect command the chip remains somewhat active and stays consuming ~20 mA. Idle mode is left by same way than PSM. The wl1251_join call is used to revert the CMD_DISCONNECT. Without it association to AP doesn't work when trying second time. With this patch the interface up but not associated case the battery current consumption is less than 1 mA higher compared to interface down case. 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/wireless/wl1251')
-rw-r--r--drivers/net/wireless/wl1251/main.c16
-rw-r--r--drivers/net/wireless/wl1251/ps.c11
-rw-r--r--drivers/net/wireless/wl1251/wl1251.h1
3 files changed, 28 insertions, 0 deletions
diff --git a/drivers/net/wireless/wl1251/main.c b/drivers/net/wireless/wl1251/main.c
index 04a054915dbe..a14a48c99cdc 100644
--- a/drivers/net/wireless/wl1251/main.c
+++ b/drivers/net/wireless/wl1251/main.c
@@ -639,6 +639,22 @@ static int wl1251_op_config(struct ieee80211_hw *hw, u32 changed)
639 } 639 }
640 } 640 }
641 641
642 if (changed & IEEE80211_CONF_CHANGE_IDLE) {
643 if (conf->flags & IEEE80211_CONF_IDLE) {
644 ret = wl1251_ps_set_mode(wl, STATION_IDLE);
645 if (ret < 0)
646 goto out_sleep;
647 } else {
648 ret = wl1251_ps_set_mode(wl, STATION_ACTIVE_MODE);
649 if (ret < 0)
650 goto out_sleep;
651 ret = wl1251_join(wl, wl->bss_type, wl->channel,
652 wl->beacon_int, wl->dtim_period);
653 if (ret < 0)
654 goto out_sleep;
655 }
656 }
657
642 if (conf->power_level != wl->power_level) { 658 if (conf->power_level != wl->power_level) {
643 ret = wl1251_acx_tx_power(wl, conf->power_level); 659 ret = wl1251_acx_tx_power(wl, conf->power_level);
644 if (ret < 0) 660 if (ret < 0)
diff --git a/drivers/net/wireless/wl1251/ps.c b/drivers/net/wireless/wl1251/ps.c
index 97a5b8c82f01..db719f7d2692 100644
--- a/drivers/net/wireless/wl1251/ps.c
+++ b/drivers/net/wireless/wl1251/ps.c
@@ -136,6 +136,17 @@ int wl1251_ps_set_mode(struct wl1251 *wl, enum wl1251_station_mode mode)
136 if (ret < 0) 136 if (ret < 0)
137 return ret; 137 return ret;
138 break; 138 break;
139 case STATION_IDLE:
140 wl1251_debug(DEBUG_PSM, "entering idle");
141
142 ret = wl1251_acx_sleep_auth(wl, WL1251_PSM_ELP);
143 if (ret < 0)
144 return ret;
145
146 ret = wl1251_cmd_template_set(wl, CMD_DISCONNECT, NULL, 0);
147 if (ret < 0)
148 return ret;
149 break;
139 case STATION_ACTIVE_MODE: 150 case STATION_ACTIVE_MODE:
140 default: 151 default:
141 wl1251_debug(DEBUG_PSM, "leaving psm"); 152 wl1251_debug(DEBUG_PSM, "leaving psm");
diff --git a/drivers/net/wireless/wl1251/wl1251.h b/drivers/net/wireless/wl1251/wl1251.h
index bf245a87e80e..a77f1bbbed0a 100644
--- a/drivers/net/wireless/wl1251/wl1251.h
+++ b/drivers/net/wireless/wl1251/wl1251.h
@@ -132,6 +132,7 @@ enum wl1251_partition_type {
132enum wl1251_station_mode { 132enum wl1251_station_mode {
133 STATION_ACTIVE_MODE, 133 STATION_ACTIVE_MODE,
134 STATION_POWER_SAVE_MODE, 134 STATION_POWER_SAVE_MODE,
135 STATION_IDLE,
135}; 136};
136 137
137struct wl1251_partition { 138struct wl1251_partition {