aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wl1251
diff options
context:
space:
mode:
authorDavid Gnedt <david.gnedt@davizone.at>2011-01-30 14:10:57 -0500
committerJohn W. Linville <linville@tuxdriver.com>2011-02-03 16:42:44 -0500
commitc3e334d29484423e78009790a3d3fa78da8b43a1 (patch)
treee7625921c13441f17962ba94acabc421d3da2ff6 /drivers/net/wireless/wl1251
parentbb4793b3c6370a1fed86978c6590241d770cb43e (diff)
wl1251: enable beacon early termination while in power-saving mode
Port the beacon early termination feature from wl1251 driver version included in the Maemo Fremantle kernel. It is enabled when going to power-saving mode and disabled when leaving power-saving mode. Signed-off-by: David Gnedt <david.gnedt@davizone.at> 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/acx.c28
-rw-r--r--drivers/net/wireless/wl1251/acx.h27
-rw-r--r--drivers/net/wireless/wl1251/ps.c11
-rw-r--r--drivers/net/wireless/wl1251/wl1251.h2
4 files changed, 68 insertions, 0 deletions
diff --git a/drivers/net/wireless/wl1251/acx.c b/drivers/net/wireless/wl1251/acx.c
index 64a0214cfb2..8c943661f2d 100644
--- a/drivers/net/wireless/wl1251/acx.c
+++ b/drivers/net/wireless/wl1251/acx.c
@@ -978,6 +978,34 @@ out:
978 return ret; 978 return ret;
979} 979}
980 980
981int wl1251_acx_bet_enable(struct wl1251 *wl, enum wl1251_acx_bet_mode mode,
982 u8 max_consecutive)
983{
984 struct wl1251_acx_bet_enable *acx;
985 int ret;
986
987 wl1251_debug(DEBUG_ACX, "acx bet enable");
988
989 acx = kzalloc(sizeof(*acx), GFP_KERNEL);
990 if (!acx) {
991 ret = -ENOMEM;
992 goto out;
993 }
994
995 acx->enable = mode;
996 acx->max_consecutive = max_consecutive;
997
998 ret = wl1251_cmd_configure(wl, ACX_BET_ENABLE, acx, sizeof(*acx));
999 if (ret < 0) {
1000 wl1251_warning("wl1251 acx bet enable failed: %d", ret);
1001 goto out;
1002 }
1003
1004out:
1005 kfree(acx);
1006 return ret;
1007}
1008
981int wl1251_acx_ac_cfg(struct wl1251 *wl, u8 ac, u8 cw_min, u16 cw_max, 1009int wl1251_acx_ac_cfg(struct wl1251 *wl, u8 ac, u8 cw_min, u16 cw_max,
982 u8 aifs, u16 txop) 1010 u8 aifs, u16 txop)
983{ 1011{
diff --git a/drivers/net/wireless/wl1251/acx.h b/drivers/net/wireless/wl1251/acx.h
index efcc3aaca14..6a19f38958f 100644
--- a/drivers/net/wireless/wl1251/acx.h
+++ b/drivers/net/wireless/wl1251/acx.h
@@ -1164,6 +1164,31 @@ struct wl1251_acx_wr_tbtt_and_dtim {
1164 u8 padding; 1164 u8 padding;
1165} __packed; 1165} __packed;
1166 1166
1167enum wl1251_acx_bet_mode {
1168 WL1251_ACX_BET_DISABLE = 0,
1169 WL1251_ACX_BET_ENABLE = 1,
1170};
1171
1172struct wl1251_acx_bet_enable {
1173 struct acx_header header;
1174
1175 /*
1176 * Specifies if beacon early termination procedure is enabled or
1177 * disabled, see enum wl1251_acx_bet_mode.
1178 */
1179 u8 enable;
1180
1181 /*
1182 * Specifies the maximum number of consecutive beacons that may be
1183 * early terminated. After this number is reached at least one full
1184 * beacon must be correctly received in FW before beacon ET
1185 * resumes. Range 0 - 255.
1186 */
1187 u8 max_consecutive;
1188
1189 u8 padding[2];
1190} __packed;
1191
1167struct wl1251_acx_ac_cfg { 1192struct wl1251_acx_ac_cfg {
1168 struct acx_header header; 1193 struct acx_header header;
1169 1194
@@ -1401,6 +1426,8 @@ int wl1251_acx_tsf_info(struct wl1251 *wl, u64 *mactime);
1401int wl1251_acx_rate_policies(struct wl1251 *wl); 1426int wl1251_acx_rate_policies(struct wl1251 *wl);
1402int wl1251_acx_mem_cfg(struct wl1251 *wl); 1427int wl1251_acx_mem_cfg(struct wl1251 *wl);
1403int wl1251_acx_wr_tbtt_and_dtim(struct wl1251 *wl, u16 tbtt, u8 dtim); 1428int wl1251_acx_wr_tbtt_and_dtim(struct wl1251 *wl, u16 tbtt, u8 dtim);
1429int wl1251_acx_bet_enable(struct wl1251 *wl, enum wl1251_acx_bet_mode mode,
1430 u8 max_consecutive);
1404int wl1251_acx_ac_cfg(struct wl1251 *wl, u8 ac, u8 cw_min, u16 cw_max, 1431int wl1251_acx_ac_cfg(struct wl1251 *wl, u8 ac, u8 cw_min, u16 cw_max,
1405 u8 aifs, u16 txop); 1432 u8 aifs, u16 txop);
1406int wl1251_acx_tid_cfg(struct wl1251 *wl, u8 queue, 1433int wl1251_acx_tid_cfg(struct wl1251 *wl, u8 queue,
diff --git a/drivers/net/wireless/wl1251/ps.c b/drivers/net/wireless/wl1251/ps.c
index 5ed47c8373d..9ba23ede51b 100644
--- a/drivers/net/wireless/wl1251/ps.c
+++ b/drivers/net/wireless/wl1251/ps.c
@@ -153,6 +153,11 @@ int wl1251_ps_set_mode(struct wl1251 *wl, enum wl1251_cmd_ps_mode mode)
153 if (ret < 0) 153 if (ret < 0)
154 return ret; 154 return ret;
155 155
156 ret = wl1251_acx_bet_enable(wl, WL1251_ACX_BET_ENABLE,
157 WL1251_DEFAULT_BET_CONSECUTIVE);
158 if (ret < 0)
159 return ret;
160
156 ret = wl1251_cmd_ps_mode(wl, STATION_POWER_SAVE_MODE); 161 ret = wl1251_cmd_ps_mode(wl, STATION_POWER_SAVE_MODE);
157 if (ret < 0) 162 if (ret < 0)
158 return ret; 163 return ret;
@@ -170,6 +175,12 @@ int wl1251_ps_set_mode(struct wl1251 *wl, enum wl1251_cmd_ps_mode mode)
170 if (ret < 0) 175 if (ret < 0)
171 return ret; 176 return ret;
172 177
178 /* disable BET */
179 ret = wl1251_acx_bet_enable(wl, WL1251_ACX_BET_DISABLE,
180 WL1251_DEFAULT_BET_CONSECUTIVE);
181 if (ret < 0)
182 return ret;
183
173 /* disable beacon filtering */ 184 /* disable beacon filtering */
174 ret = wl1251_acx_beacon_filter_opt(wl, false); 185 ret = wl1251_acx_beacon_filter_opt(wl, false);
175 if (ret < 0) 186 if (ret < 0)
diff --git a/drivers/net/wireless/wl1251/wl1251.h b/drivers/net/wireless/wl1251/wl1251.h
index c0ce2c8b43b..462ac5b2058 100644
--- a/drivers/net/wireless/wl1251/wl1251.h
+++ b/drivers/net/wireless/wl1251/wl1251.h
@@ -410,6 +410,8 @@ void wl1251_disable_interrupts(struct wl1251 *wl);
410 410
411#define WL1251_DEFAULT_CHANNEL 0 411#define WL1251_DEFAULT_CHANNEL 0
412 412
413#define WL1251_DEFAULT_BET_CONSECUTIVE 10
414
413#define CHIP_ID_1251_PG10 (0x7010101) 415#define CHIP_ID_1251_PG10 (0x7010101)
414#define CHIP_ID_1251_PG11 (0x7020101) 416#define CHIP_ID_1251_PG11 (0x7020101)
415#define CHIP_ID_1251_PG12 (0x7030101) 417#define CHIP_ID_1251_PG12 (0x7030101)