aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKalle Valo <kalle.valo@nokia.com>2009-06-12 07:16:26 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-10 14:57:47 -0400
commit01d9cfbdaadc64a46b57437c989bbad241074135 (patch)
tree8c3946f17ee1571515271ffa550c22a643b8bb33
parentcee4fd2712a3db21f432bdff14e59aed160453b2 (diff)
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: Kalle Valo <kalle.valo@nokia.com> Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com> Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/wl12xx/cmd.c13
-rw-r--r--drivers/net/wireless/wl12xx/debugfs.c5
-rw-r--r--drivers/net/wireless/wl12xx/main.c20
3 files changed, 25 insertions, 13 deletions
diff --git a/drivers/net/wireless/wl12xx/cmd.c b/drivers/net/wireless/wl12xx/cmd.c
index 04e8401fcbed..fb4e9962d2c2 100644
--- a/drivers/net/wireless/wl12xx/cmd.c
+++ b/drivers/net/wireless/wl12xx/cmd.c
@@ -32,8 +32,6 @@ int wl12xx_cmd_send(struct wl12xx *wl, u16 id, void *buf, size_t len)
32 32
33 WARN_ON(len % 4 != 0); 33 WARN_ON(len % 4 != 0);
34 34
35 wl12xx_ps_elp_wakeup(wl);
36
37 wl12xx_spi_mem_write(wl, wl->cmd_box_addr, buf, len); 35 wl12xx_spi_mem_write(wl, wl->cmd_box_addr, buf, len);
38 36
39 wl12xx_reg_write32(wl, ACX_REG_INTERRUPT_TRIG, INTR_TRIG_CMD); 37 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 wl->chip.intr_cmd_complete); 55 wl->chip.intr_cmd_complete);
58 56
59out: 57out:
60 wl12xx_ps_elp_sleep(wl);
61
62 return ret; 58 return ret;
63} 59}
64 60
@@ -91,13 +87,8 @@ int wl12xx_cmd_test(struct wl12xx *wl, void *buf, size_t buf_len, u8 answer)
91 * The answer would be a wl12xx_command, where the 87 * The answer would be a wl12xx_command, where the
92 * parameter array contains the actual answer. 88 * parameter array contains the actual answer.
93 */ 89 */
94
95 wl12xx_ps_elp_wakeup(wl);
96
97 wl12xx_spi_mem_read(wl, wl->cmd_box_addr, buf, buf_len); 90 wl12xx_spi_mem_read(wl, wl->cmd_box_addr, buf, buf_len);
98 91
99 wl12xx_ps_elp_sleep(wl);
100
101 cmd_answer = buf; 92 cmd_answer = buf;
102 93
103 if (cmd_answer->header.status != CMD_STATUS_SUCCESS) 94 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 goto out; 125 goto out;
135 } 126 }
136 127
137 wl12xx_ps_elp_wakeup(wl);
138
139 /* the interrogate command got in, we can read the answer */ 128 /* the interrogate command got in, we can read the answer */
140 wl12xx_spi_mem_read(wl, wl->cmd_box_addr, buf, len); 129 wl12xx_spi_mem_read(wl, wl->cmd_box_addr, buf, len);
141 130
142 wl12xx_ps_elp_sleep(wl);
143
144 acx = buf; 131 acx = buf;
145 if (acx->cmd.status != CMD_STATUS_SUCCESS) 132 if (acx->cmd.status != CMD_STATUS_SUCCESS)
146 wl12xx_error("INTERROGATE command error: %d", 133 wl12xx_error("INTERROGATE command error: %d",
diff --git a/drivers/net/wireless/wl12xx/debugfs.c b/drivers/net/wireless/wl12xx/debugfs.c
index cdb368ce4dae..3cc5460c11f3 100644
--- a/drivers/net/wireless/wl12xx/debugfs.c
+++ b/drivers/net/wireless/wl12xx/debugfs.c
@@ -27,6 +27,7 @@
27 27
28#include "wl12xx.h" 28#include "wl12xx.h"
29#include "acx.h" 29#include "acx.h"
30#include "ps.h"
30 31
31/* ms */ 32/* ms */
32#define WL12XX_DEBUGFS_STATS_LIFETIME 1000 33#define WL12XX_DEBUGFS_STATS_LIFETIME 1000
@@ -96,6 +97,8 @@ static void wl12xx_debugfs_update_stats(struct wl12xx *wl)
96{ 97{
97 mutex_lock(&wl->mutex); 98 mutex_lock(&wl->mutex);
98 99
100 wl12xx_ps_elp_wakeup(wl);
101
99 if (wl->state == WL12XX_STATE_ON && 102 if (wl->state == WL12XX_STATE_ON &&
100 time_after(jiffies, wl->stats.fw_stats_update + 103 time_after(jiffies, wl->stats.fw_stats_update +
101 msecs_to_jiffies(WL12XX_DEBUGFS_STATS_LIFETIME))) { 104 msecs_to_jiffies(WL12XX_DEBUGFS_STATS_LIFETIME))) {
@@ -103,6 +106,8 @@ static void wl12xx_debugfs_update_stats(struct wl12xx *wl)
103 wl->stats.fw_stats_update = jiffies; 106 wl->stats.fw_stats_update = jiffies;
104 } 107 }
105 108
109 wl12xx_ps_elp_sleep(wl);
110
106 mutex_unlock(&wl->mutex); 111 mutex_unlock(&wl->mutex);
107} 112}
108 113
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index 7ec174992787..894d5cc43d25 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -239,11 +239,14 @@ static void wl12xx_filter_work(struct work_struct *work)
239 if (wl->state == WL12XX_STATE_OFF) 239 if (wl->state == WL12XX_STATE_OFF)
240 goto out; 240 goto out;
241 241
242 wl12xx_ps_elp_wakeup(wl);
243
242 ret = wl12xx_cmd_join(wl, wl->bss_type, 1, 100, 0); 244 ret = wl12xx_cmd_join(wl, wl->bss_type, 1, 100, 0);
243 if (ret < 0) 245 if (ret < 0)
244 goto out; 246 goto out;
245 247
246out: 248out:
249 wl12xx_ps_elp_sleep(wl);
247 mutex_unlock(&wl->mutex); 250 mutex_unlock(&wl->mutex);
248} 251}
249 252
@@ -521,6 +524,8 @@ static int wl12xx_op_config(struct ieee80211_hw *hw, u32 changed)
521 524
522 mutex_lock(&wl->mutex); 525 mutex_lock(&wl->mutex);
523 526
527 wl12xx_ps_elp_wakeup(wl);
528
524 if (channel != wl->channel) { 529 if (channel != wl->channel) {
525 /* FIXME: use beacon interval provided by mac80211 */ 530 /* FIXME: use beacon interval provided by mac80211 */
526 ret = wl12xx_cmd_join(wl, wl->bss_type, 1, 100, 0); 531 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 } 569 }
565 570
566out: 571out:
572 wl12xx_ps_elp_sleep(wl);
567 mutex_unlock(&wl->mutex); 573 mutex_unlock(&wl->mutex);
568 return ret; 574 return ret;
569} 575}
@@ -702,6 +708,8 @@ static int wl12xx_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
702 708
703 mutex_lock(&wl->mutex); 709 mutex_lock(&wl->mutex);
704 710
711 wl12xx_ps_elp_wakeup(wl);
712
705 switch (cmd) { 713 switch (cmd) {
706 case SET_KEY: 714 case SET_KEY:
707 wl_cmd->key_action = KEY_ADD_OR_REPLACE; 715 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 } 760 }
753 761
754out_unlock: 762out_unlock:
763 wl12xx_ps_elp_sleep(wl);
755 mutex_unlock(&wl->mutex); 764 mutex_unlock(&wl->mutex);
756 765
757out: 766out:
@@ -946,7 +955,11 @@ static int wl12xx_op_hw_scan(struct ieee80211_hw *hw,
946 } 955 }
947 956
948 mutex_lock(&wl->mutex); 957 mutex_lock(&wl->mutex);
958 wl12xx_ps_elp_wakeup(wl);
959
949 ret = wl12xx_hw_scan(hw->priv, ssid, ssid_len, 1, 0, 13, 3); 960 ret = wl12xx_hw_scan(hw->priv, ssid, ssid_len, 1, 0, 13, 3);
961
962 wl12xx_ps_elp_sleep(wl);
950 mutex_unlock(&wl->mutex); 963 mutex_unlock(&wl->mutex);
951 964
952 return ret; 965 return ret;
@@ -959,11 +972,15 @@ static int wl12xx_op_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
959 972
960 mutex_lock(&wl->mutex); 973 mutex_lock(&wl->mutex);
961 974
975 wl12xx_ps_elp_wakeup(wl);
976
962 ret = wl12xx_acx_rts_threshold(wl, (u16) value); 977 ret = wl12xx_acx_rts_threshold(wl, (u16) value);
963 978
964 if (ret < 0) 979 if (ret < 0)
965 wl12xx_warning("wl12xx_op_set_rts_threshold failed: %d", ret); 980 wl12xx_warning("wl12xx_op_set_rts_threshold failed: %d", ret);
966 981
982 wl12xx_ps_elp_sleep(wl);
983
967 mutex_unlock(&wl->mutex); 984 mutex_unlock(&wl->mutex);
968 985
969 return ret; 986 return ret;
@@ -983,6 +1000,8 @@ static void wl12xx_op_bss_info_changed(struct ieee80211_hw *hw,
983 1000
984 mutex_lock(&wl->mutex); 1001 mutex_lock(&wl->mutex);
985 1002
1003 wl12xx_ps_elp_wakeup(wl);
1004
986 if (changed & BSS_CHANGED_ASSOC) { 1005 if (changed & BSS_CHANGED_ASSOC) {
987 if (bss_conf->assoc) { 1006 if (bss_conf->assoc) {
988 wl->aid = bss_conf->aid; 1007 wl->aid = bss_conf->aid;
@@ -1072,6 +1091,7 @@ static void wl12xx_op_bss_info_changed(struct ieee80211_hw *hw,
1072 } 1091 }
1073 1092
1074out: 1093out:
1094 wl12xx_ps_elp_sleep(wl);
1075 mutex_unlock(&wl->mutex); 1095 mutex_unlock(&wl->mutex);
1076} 1096}
1077 1097