Commit 01d9cfbd authored by Kalle Valo's avatar Kalle Valo Committed by John W. Linville

wl12xx: optimise elp wakeup and sleep calls

The wakeup call was done too deep in code path, it's better to wakeup
chip from higher levels. This will also reduce wakeup calls significantly.
Signed-off-by: default avatarKalle Valo <kalle.valo@nokia.com>
Reviewed-by: default avatarLuciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: default avatarLuciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent cee4fd27
...@@ -32,8 +32,6 @@ int wl12xx_cmd_send(struct wl12xx *wl, u16 id, void *buf, size_t len) ...@@ -32,8 +32,6 @@ int wl12xx_cmd_send(struct wl12xx *wl, u16 id, void *buf, size_t len)
WARN_ON(len % 4 != 0); WARN_ON(len % 4 != 0);
wl12xx_ps_elp_wakeup(wl);
wl12xx_spi_mem_write(wl, wl->cmd_box_addr, buf, len); wl12xx_spi_mem_write(wl, wl->cmd_box_addr, buf, len);
wl12xx_reg_write32(wl, ACX_REG_INTERRUPT_TRIG, INTR_TRIG_CMD); wl12xx_reg_write32(wl, ACX_REG_INTERRUPT_TRIG, INTR_TRIG_CMD);
...@@ -57,8 +55,6 @@ int wl12xx_cmd_send(struct wl12xx *wl, u16 id, void *buf, size_t len) ...@@ -57,8 +55,6 @@ int wl12xx_cmd_send(struct wl12xx *wl, u16 id, void *buf, size_t len)
wl->chip.intr_cmd_complete); wl->chip.intr_cmd_complete);
out: out:
wl12xx_ps_elp_sleep(wl);
return ret; return ret;
} }
...@@ -91,13 +87,8 @@ int wl12xx_cmd_test(struct wl12xx *wl, void *buf, size_t buf_len, u8 answer) ...@@ -91,13 +87,8 @@ int wl12xx_cmd_test(struct wl12xx *wl, void *buf, size_t buf_len, u8 answer)
* The answer would be a wl12xx_command, where the * The answer would be a wl12xx_command, where the
* parameter array contains the actual answer. * parameter array contains the actual answer.
*/ */
wl12xx_ps_elp_wakeup(wl);
wl12xx_spi_mem_read(wl, wl->cmd_box_addr, buf, buf_len); wl12xx_spi_mem_read(wl, wl->cmd_box_addr, buf, buf_len);
wl12xx_ps_elp_sleep(wl);
cmd_answer = buf; cmd_answer = buf;
if (cmd_answer->header.status != CMD_STATUS_SUCCESS) if (cmd_answer->header.status != CMD_STATUS_SUCCESS)
...@@ -134,13 +125,9 @@ int wl12xx_cmd_interrogate(struct wl12xx *wl, u16 id, void *buf, size_t len) ...@@ -134,13 +125,9 @@ int wl12xx_cmd_interrogate(struct wl12xx *wl, u16 id, void *buf, size_t len)
goto out; goto out;
} }
wl12xx_ps_elp_wakeup(wl);
/* the interrogate command got in, we can read the answer */ /* the interrogate command got in, we can read the answer */
wl12xx_spi_mem_read(wl, wl->cmd_box_addr, buf, len); wl12xx_spi_mem_read(wl, wl->cmd_box_addr, buf, len);
wl12xx_ps_elp_sleep(wl);
acx = buf; acx = buf;
if (acx->cmd.status != CMD_STATUS_SUCCESS) if (acx->cmd.status != CMD_STATUS_SUCCESS)
wl12xx_error("INTERROGATE command error: %d", wl12xx_error("INTERROGATE command error: %d",
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "wl12xx.h" #include "wl12xx.h"
#include "acx.h" #include "acx.h"
#include "ps.h"
/* ms */ /* ms */
#define WL12XX_DEBUGFS_STATS_LIFETIME 1000 #define WL12XX_DEBUGFS_STATS_LIFETIME 1000
...@@ -96,6 +97,8 @@ static void wl12xx_debugfs_update_stats(struct wl12xx *wl) ...@@ -96,6 +97,8 @@ static void wl12xx_debugfs_update_stats(struct wl12xx *wl)
{ {
mutex_lock(&wl->mutex); mutex_lock(&wl->mutex);
wl12xx_ps_elp_wakeup(wl);
if (wl->state == WL12XX_STATE_ON && if (wl->state == WL12XX_STATE_ON &&
time_after(jiffies, wl->stats.fw_stats_update + time_after(jiffies, wl->stats.fw_stats_update +
msecs_to_jiffies(WL12XX_DEBUGFS_STATS_LIFETIME))) { msecs_to_jiffies(WL12XX_DEBUGFS_STATS_LIFETIME))) {
...@@ -103,6 +106,8 @@ static void wl12xx_debugfs_update_stats(struct wl12xx *wl) ...@@ -103,6 +106,8 @@ static void wl12xx_debugfs_update_stats(struct wl12xx *wl)
wl->stats.fw_stats_update = jiffies; wl->stats.fw_stats_update = jiffies;
} }
wl12xx_ps_elp_sleep(wl);
mutex_unlock(&wl->mutex); mutex_unlock(&wl->mutex);
} }
......
...@@ -239,11 +239,14 @@ static void wl12xx_filter_work(struct work_struct *work) ...@@ -239,11 +239,14 @@ static void wl12xx_filter_work(struct work_struct *work)
if (wl->state == WL12XX_STATE_OFF) if (wl->state == WL12XX_STATE_OFF)
goto out; goto out;
wl12xx_ps_elp_wakeup(wl);
ret = wl12xx_cmd_join(wl, wl->bss_type, 1, 100, 0); ret = wl12xx_cmd_join(wl, wl->bss_type, 1, 100, 0);
if (ret < 0) if (ret < 0)
goto out; goto out;
out: out:
wl12xx_ps_elp_sleep(wl);
mutex_unlock(&wl->mutex); mutex_unlock(&wl->mutex);
} }
...@@ -521,6 +524,8 @@ static int wl12xx_op_config(struct ieee80211_hw *hw, u32 changed) ...@@ -521,6 +524,8 @@ static int wl12xx_op_config(struct ieee80211_hw *hw, u32 changed)
mutex_lock(&wl->mutex); mutex_lock(&wl->mutex);
wl12xx_ps_elp_wakeup(wl);
if (channel != wl->channel) { if (channel != wl->channel) {
/* FIXME: use beacon interval provided by mac80211 */ /* FIXME: use beacon interval provided by mac80211 */
ret = wl12xx_cmd_join(wl, wl->bss_type, 1, 100, 0); ret = wl12xx_cmd_join(wl, wl->bss_type, 1, 100, 0);
...@@ -564,6 +569,7 @@ static int wl12xx_op_config(struct ieee80211_hw *hw, u32 changed) ...@@ -564,6 +569,7 @@ static int wl12xx_op_config(struct ieee80211_hw *hw, u32 changed)
} }
out: out:
wl12xx_ps_elp_sleep(wl);
mutex_unlock(&wl->mutex); mutex_unlock(&wl->mutex);
return ret; return ret;
} }
...@@ -702,6 +708,8 @@ static int wl12xx_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, ...@@ -702,6 +708,8 @@ static int wl12xx_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
mutex_lock(&wl->mutex); mutex_lock(&wl->mutex);
wl12xx_ps_elp_wakeup(wl);
switch (cmd) { switch (cmd) {
case SET_KEY: case SET_KEY:
wl_cmd->key_action = KEY_ADD_OR_REPLACE; wl_cmd->key_action = KEY_ADD_OR_REPLACE;
...@@ -752,6 +760,7 @@ static int wl12xx_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, ...@@ -752,6 +760,7 @@ static int wl12xx_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
} }
out_unlock: out_unlock:
wl12xx_ps_elp_sleep(wl);
mutex_unlock(&wl->mutex); mutex_unlock(&wl->mutex);
out: out:
...@@ -946,7 +955,11 @@ static int wl12xx_op_hw_scan(struct ieee80211_hw *hw, ...@@ -946,7 +955,11 @@ static int wl12xx_op_hw_scan(struct ieee80211_hw *hw,
} }
mutex_lock(&wl->mutex); mutex_lock(&wl->mutex);
wl12xx_ps_elp_wakeup(wl);
ret = wl12xx_hw_scan(hw->priv, ssid, ssid_len, 1, 0, 13, 3); ret = wl12xx_hw_scan(hw->priv, ssid, ssid_len, 1, 0, 13, 3);
wl12xx_ps_elp_sleep(wl);
mutex_unlock(&wl->mutex); mutex_unlock(&wl->mutex);
return ret; return ret;
...@@ -959,11 +972,15 @@ static int wl12xx_op_set_rts_threshold(struct ieee80211_hw *hw, u32 value) ...@@ -959,11 +972,15 @@ static int wl12xx_op_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
mutex_lock(&wl->mutex); mutex_lock(&wl->mutex);
wl12xx_ps_elp_wakeup(wl);
ret = wl12xx_acx_rts_threshold(wl, (u16) value); ret = wl12xx_acx_rts_threshold(wl, (u16) value);
if (ret < 0) if (ret < 0)
wl12xx_warning("wl12xx_op_set_rts_threshold failed: %d", ret); wl12xx_warning("wl12xx_op_set_rts_threshold failed: %d", ret);
wl12xx_ps_elp_sleep(wl);
mutex_unlock(&wl->mutex); mutex_unlock(&wl->mutex);
return ret; return ret;
...@@ -983,6 +1000,8 @@ static void wl12xx_op_bss_info_changed(struct ieee80211_hw *hw, ...@@ -983,6 +1000,8 @@ static void wl12xx_op_bss_info_changed(struct ieee80211_hw *hw,
mutex_lock(&wl->mutex); mutex_lock(&wl->mutex);
wl12xx_ps_elp_wakeup(wl);
if (changed & BSS_CHANGED_ASSOC) { if (changed & BSS_CHANGED_ASSOC) {
if (bss_conf->assoc) { if (bss_conf->assoc) {
wl->aid = bss_conf->aid; wl->aid = bss_conf->aid;
...@@ -1072,6 +1091,7 @@ static void wl12xx_op_bss_info_changed(struct ieee80211_hw *hw, ...@@ -1072,6 +1091,7 @@ static void wl12xx_op_bss_info_changed(struct ieee80211_hw *hw,
} }
out: out:
wl12xx_ps_elp_sleep(wl);
mutex_unlock(&wl->mutex); mutex_unlock(&wl->mutex);
} }
......
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