aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wl12xx/wl1251_acx.c
diff options
context:
space:
mode:
authorKalle Valo <kalle.valo@nokia.com>2009-06-12 07:17:19 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-10 14:57:49 -0400
commitef2f8d45771490de5b8373c25e983ee1e3aee9ea (patch)
tree0ddf8a416ab891a371ddcaf914c059387d65fe07 /drivers/net/wireless/wl12xx/wl1251_acx.c
parentc731837855a9dcc2ec0c5367b0e16ad975aaed16 (diff)
wl1251: add wl1251 prefix to all 1251 files
Now that all 1271 files are split, we can add wl1251_ prefix to the files. Signed-off-by: Kalle Valo <kalle.valo@nokia.com> Reviewed-by: Vidhya Govindan <vidhya.govindan@nokia.com> Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/wl12xx/wl1251_acx.c')
-rw-r--r--drivers/net/wireless/wl12xx/wl1251_acx.c841
1 files changed, 841 insertions, 0 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1251_acx.c b/drivers/net/wireless/wl12xx/wl1251_acx.c
new file mode 100644
index 000000000000..cecc1fade3dc
--- /dev/null
+++ b/drivers/net/wireless/wl12xx/wl1251_acx.c
@@ -0,0 +1,841 @@
1#include "wl1251_acx.h"
2
3#include <linux/module.h>
4#include <linux/crc7.h>
5#include <linux/spi/spi.h>
6
7#include "wl12xx.h"
8#include "wl12xx_80211.h"
9#include "reg.h"
10#include "wl1251_spi.h"
11#include "wl1251_ps.h"
12
13int wl12xx_acx_frame_rates(struct wl12xx *wl, u8 ctrl_rate, u8 ctrl_mod,
14 u8 mgt_rate, u8 mgt_mod)
15{
16 struct acx_fw_gen_frame_rates *rates;
17 int ret;
18
19 wl12xx_debug(DEBUG_ACX, "acx frame rates");
20
21 rates = kzalloc(sizeof(*rates), GFP_KERNEL);
22 if (!rates) {
23 ret = -ENOMEM;
24 goto out;
25 }
26
27 rates->tx_ctrl_frame_rate = ctrl_rate;
28 rates->tx_ctrl_frame_mod = ctrl_mod;
29 rates->tx_mgt_frame_rate = mgt_rate;
30 rates->tx_mgt_frame_mod = mgt_mod;
31
32 ret = wl12xx_cmd_configure(wl, ACX_FW_GEN_FRAME_RATES,
33 rates, sizeof(*rates));
34 if (ret < 0) {
35 wl12xx_error("Failed to set FW rates and modulation");
36 goto out;
37 }
38
39out:
40 kfree(rates);
41 return ret;
42}
43
44
45int wl12xx_acx_station_id(struct wl12xx *wl)
46{
47 struct acx_dot11_station_id *mac;
48 int ret, i;
49
50 wl12xx_debug(DEBUG_ACX, "acx dot11_station_id");
51
52 mac = kzalloc(sizeof(*mac), GFP_KERNEL);
53 if (!mac) {
54 ret = -ENOMEM;
55 goto out;
56 }
57
58 for (i = 0; i < ETH_ALEN; i++)
59 mac->mac[i] = wl->mac_addr[ETH_ALEN - 1 - i];
60
61 ret = wl12xx_cmd_configure(wl, DOT11_STATION_ID, mac, sizeof(*mac));
62 if (ret < 0)
63 goto out;
64
65out:
66 kfree(mac);
67 return ret;
68}
69
70int wl12xx_acx_default_key(struct wl12xx *wl, u8 key_id)
71{
72 struct acx_dot11_default_key *default_key;
73 int ret;
74
75 wl12xx_debug(DEBUG_ACX, "acx dot11_default_key (%d)", key_id);
76
77 default_key = kzalloc(sizeof(*default_key), GFP_KERNEL);
78 if (!default_key) {
79 ret = -ENOMEM;
80 goto out;
81 }
82
83 default_key->id = key_id;
84
85 ret = wl12xx_cmd_configure(wl, DOT11_DEFAULT_KEY,
86 default_key, sizeof(*default_key));
87 if (ret < 0) {
88 wl12xx_error("Couldnt set default key");
89 goto out;
90 }
91
92 wl->default_key = key_id;
93
94out:
95 kfree(default_key);
96 return ret;
97}
98
99int wl12xx_acx_wake_up_conditions(struct wl12xx *wl, u8 wake_up_event,
100 u8 listen_interval)
101{
102 struct acx_wake_up_condition *wake_up;
103 int ret;
104
105 wl12xx_debug(DEBUG_ACX, "acx wake up conditions");
106
107 wake_up = kzalloc(sizeof(*wake_up), GFP_KERNEL);
108 if (!wake_up) {
109 ret = -ENOMEM;
110 goto out;
111 }
112
113 wake_up->wake_up_event = wake_up_event;
114 wake_up->listen_interval = listen_interval;
115
116 ret = wl12xx_cmd_configure(wl, ACX_WAKE_UP_CONDITIONS,
117 wake_up, sizeof(*wake_up));
118 if (ret < 0) {
119 wl12xx_warning("could not set wake up conditions: %d", ret);
120 goto out;
121 }
122
123out:
124 kfree(wake_up);
125 return ret;
126}
127
128int wl12xx_acx_sleep_auth(struct wl12xx *wl, u8 sleep_auth)
129{
130 struct acx_sleep_auth *auth;
131 int ret;
132
133 wl12xx_debug(DEBUG_ACX, "acx sleep auth");
134
135 auth = kzalloc(sizeof(*auth), GFP_KERNEL);
136 if (!auth) {
137 ret = -ENOMEM;
138 goto out;
139 }
140
141 auth->sleep_auth = sleep_auth;
142
143 ret = wl12xx_cmd_configure(wl, ACX_SLEEP_AUTH, auth, sizeof(*auth));
144 if (ret < 0)
145 return ret;
146
147out:
148 kfree(auth);
149 return ret;
150}
151
152int wl12xx_acx_fw_version(struct wl12xx *wl, char *buf, size_t len)
153{
154 struct acx_revision *rev;
155 int ret;
156
157 wl12xx_debug(DEBUG_ACX, "acx fw rev");
158
159 rev = kzalloc(sizeof(*rev), GFP_KERNEL);
160 if (!rev) {
161 ret = -ENOMEM;
162 goto out;
163 }
164
165 ret = wl12xx_cmd_interrogate(wl, ACX_FW_REV, rev, sizeof(*rev));
166 if (ret < 0) {
167 wl12xx_warning("ACX_FW_REV interrogate failed");
168 goto out;
169 }
170
171 /* be careful with the buffer sizes */
172 strncpy(buf, rev->fw_version, min(len, sizeof(rev->fw_version)));
173
174 /*
175 * if the firmware version string is exactly
176 * sizeof(rev->fw_version) long or fw_len is less than
177 * sizeof(rev->fw_version) it won't be null terminated
178 */
179 buf[min(len, sizeof(rev->fw_version)) - 1] = '\0';
180
181out:
182 kfree(rev);
183 return ret;
184}
185
186int wl12xx_acx_tx_power(struct wl12xx *wl, int power)
187{
188 struct acx_current_tx_power *acx;
189 int ret;
190
191 wl12xx_debug(DEBUG_ACX, "acx dot11_cur_tx_pwr");
192
193 if (power < 0 || power > 25)
194 return -EINVAL;
195
196 acx = kzalloc(sizeof(*acx), GFP_KERNEL);
197 if (!acx) {
198 ret = -ENOMEM;
199 goto out;
200 }
201
202 acx->current_tx_power = power * 10;
203
204 ret = wl12xx_cmd_configure(wl, DOT11_CUR_TX_PWR, acx, sizeof(*acx));
205 if (ret < 0) {
206 wl12xx_warning("configure of tx power failed: %d", ret);
207 goto out;
208 }
209
210out:
211 kfree(acx);
212 return ret;
213}
214
215int wl12xx_acx_feature_cfg(struct wl12xx *wl)
216{
217 struct acx_feature_config *feature;
218 int ret;
219
220 wl12xx_debug(DEBUG_ACX, "acx feature cfg");
221
222 feature = kzalloc(sizeof(*feature), GFP_KERNEL);
223 if (!feature) {
224 ret = -ENOMEM;
225 goto out;
226 }
227
228 /* DF_ENCRYPTION_DISABLE and DF_SNIFF_MODE_ENABLE are disabled */
229 feature->data_flow_options = 0;
230 feature->options = 0;
231
232 ret = wl12xx_cmd_configure(wl, ACX_FEATURE_CFG,
233 feature, sizeof(*feature));
234 if (ret < 0) {
235 wl12xx_error("Couldnt set HW encryption");
236 goto out;
237 }
238
239out:
240 kfree(feature);
241 return ret;
242}
243
244int wl12xx_acx_mem_map(struct wl12xx *wl, struct acx_header *mem_map,
245 size_t len)
246{
247 int ret;
248
249 wl12xx_debug(DEBUG_ACX, "acx mem map");
250
251 ret = wl12xx_cmd_interrogate(wl, ACX_MEM_MAP, mem_map, len);
252 if (ret < 0)
253 return ret;
254
255 return 0;
256}
257
258int wl12xx_acx_data_path_params(struct wl12xx *wl,
259 struct acx_data_path_params_resp *resp)
260{
261 struct acx_data_path_params *params;
262 int ret;
263
264 wl12xx_debug(DEBUG_ACX, "acx data path params");
265
266 params = kzalloc(sizeof(*params), GFP_KERNEL);
267 if (!params) {
268 ret = -ENOMEM;
269 goto out;
270 }
271
272 params->rx_packet_ring_chunk_size = DP_RX_PACKET_RING_CHUNK_SIZE;
273 params->tx_packet_ring_chunk_size = DP_TX_PACKET_RING_CHUNK_SIZE;
274
275 params->rx_packet_ring_chunk_num = DP_RX_PACKET_RING_CHUNK_NUM;
276 params->tx_packet_ring_chunk_num = DP_TX_PACKET_RING_CHUNK_NUM;
277
278 params->tx_complete_threshold = 1;
279
280 params->tx_complete_ring_depth = FW_TX_CMPLT_BLOCK_SIZE;
281
282 params->tx_complete_timeout = DP_TX_COMPLETE_TIME_OUT;
283
284 ret = wl12xx_cmd_configure(wl, ACX_DATA_PATH_PARAMS,
285 params, sizeof(*params));
286 if (ret < 0)
287 goto out;
288
289 /* FIXME: shouldn't this be ACX_DATA_PATH_RESP_PARAMS? */
290 ret = wl12xx_cmd_interrogate(wl, ACX_DATA_PATH_PARAMS,
291 resp, sizeof(*resp));
292
293 if (ret < 0) {
294 wl12xx_warning("failed to read data path parameters: %d", ret);
295 goto out;
296 } else if (resp->header.cmd.status != CMD_STATUS_SUCCESS) {
297 wl12xx_warning("data path parameter acx status failed");
298 ret = -EIO;
299 goto out;
300 }
301
302out:
303 kfree(params);
304 return ret;
305}
306
307int wl12xx_acx_rx_msdu_life_time(struct wl12xx *wl, u32 life_time)
308{
309 struct acx_rx_msdu_lifetime *acx;
310 int ret;
311
312 wl12xx_debug(DEBUG_ACX, "acx rx msdu life time");
313
314 acx = kzalloc(sizeof(*acx), GFP_KERNEL);
315 if (!acx) {
316 ret = -ENOMEM;
317 goto out;
318 }
319
320 acx->lifetime = life_time;
321 ret = wl12xx_cmd_configure(wl, DOT11_RX_MSDU_LIFE_TIME,
322 acx, sizeof(*acx));
323 if (ret < 0) {
324 wl12xx_warning("failed to set rx msdu life time: %d", ret);
325 goto out;
326 }
327
328out:
329 kfree(acx);
330 return ret;
331}
332
333int wl12xx_acx_rx_config(struct wl12xx *wl, u32 config, u32 filter)
334{
335 struct acx_rx_config *rx_config;
336 int ret;
337
338 wl12xx_debug(DEBUG_ACX, "acx rx config");
339
340 rx_config = kzalloc(sizeof(*rx_config), GFP_KERNEL);
341 if (!rx_config) {
342 ret = -ENOMEM;
343 goto out;
344 }
345
346 rx_config->config_options = config;
347 rx_config->filter_options = filter;
348
349 ret = wl12xx_cmd_configure(wl, ACX_RX_CFG,
350 rx_config, sizeof(*rx_config));
351 if (ret < 0) {
352 wl12xx_warning("failed to set rx config: %d", ret);
353 goto out;
354 }
355
356out:
357 kfree(rx_config);
358 return ret;
359}
360
361int wl12xx_acx_pd_threshold(struct wl12xx *wl)
362{
363 struct acx_packet_detection *pd;
364 int ret;
365
366 wl12xx_debug(DEBUG_ACX, "acx data pd threshold");
367
368 pd = kzalloc(sizeof(*pd), GFP_KERNEL);
369 if (!pd) {
370 ret = -ENOMEM;
371 goto out;
372 }
373
374 /* FIXME: threshold value not set */
375
376 ret = wl12xx_cmd_configure(wl, ACX_PD_THRESHOLD, pd, sizeof(*pd));
377 if (ret < 0) {
378 wl12xx_warning("failed to set pd threshold: %d", ret);
379 goto out;
380 }
381
382out:
383 kfree(pd);
384 return 0;
385}
386
387int wl12xx_acx_slot(struct wl12xx *wl, enum acx_slot_type slot_time)
388{
389 struct acx_slot *slot;
390 int ret;
391
392 wl12xx_debug(DEBUG_ACX, "acx slot");
393
394 slot = kzalloc(sizeof(*slot), GFP_KERNEL);
395 if (!slot) {
396 ret = -ENOMEM;
397 goto out;
398 }
399
400 slot->wone_index = STATION_WONE_INDEX;
401 slot->slot_time = slot_time;
402
403 ret = wl12xx_cmd_configure(wl, ACX_SLOT, slot, sizeof(*slot));
404 if (ret < 0) {
405 wl12xx_warning("failed to set slot time: %d", ret);
406 goto out;
407 }
408
409out:
410 kfree(slot);
411 return ret;
412}
413
414int wl12xx_acx_group_address_tbl(struct wl12xx *wl)
415{
416 struct acx_dot11_grp_addr_tbl *acx;
417 int ret;
418
419 wl12xx_debug(DEBUG_ACX, "acx group address tbl");
420
421 acx = kzalloc(sizeof(*acx), GFP_KERNEL);
422 if (!acx) {
423 ret = -ENOMEM;
424 goto out;
425 }
426
427 /* MAC filtering */
428 acx->enabled = 0;
429 acx->num_groups = 0;
430 memset(acx->mac_table, 0, ADDRESS_GROUP_MAX_LEN);
431
432 ret = wl12xx_cmd_configure(wl, DOT11_GROUP_ADDRESS_TBL,
433 acx, sizeof(*acx));
434 if (ret < 0) {
435 wl12xx_warning("failed to set group addr table: %d", ret);
436 goto out;
437 }
438
439out:
440 kfree(acx);
441 return ret;
442}
443
444int wl12xx_acx_service_period_timeout(struct wl12xx *wl)
445{
446 struct acx_rx_timeout *rx_timeout;
447 int ret;
448
449 rx_timeout = kzalloc(sizeof(*rx_timeout), GFP_KERNEL);
450 if (!rx_timeout) {
451 ret = -ENOMEM;
452 goto out;
453 }
454
455 wl12xx_debug(DEBUG_ACX, "acx service period timeout");
456
457 rx_timeout->ps_poll_timeout = RX_TIMEOUT_PS_POLL_DEF;
458 rx_timeout->upsd_timeout = RX_TIMEOUT_UPSD_DEF;
459
460 ret = wl12xx_cmd_configure(wl, ACX_SERVICE_PERIOD_TIMEOUT,
461 rx_timeout, sizeof(*rx_timeout));
462 if (ret < 0) {
463 wl12xx_warning("failed to set service period timeout: %d",
464 ret);
465 goto out;
466 }
467
468out:
469 kfree(rx_timeout);
470 return ret;
471}
472
473int wl12xx_acx_rts_threshold(struct wl12xx *wl, u16 rts_threshold)
474{
475 struct acx_rts_threshold *rts;
476 int ret;
477
478 wl12xx_debug(DEBUG_ACX, "acx rts threshold");
479
480 rts = kzalloc(sizeof(*rts), GFP_KERNEL);
481 if (!rts) {
482 ret = -ENOMEM;
483 goto out;
484 }
485
486 rts->threshold = rts_threshold;
487
488 ret = wl12xx_cmd_configure(wl, DOT11_RTS_THRESHOLD, rts, sizeof(*rts));
489 if (ret < 0) {
490 wl12xx_warning("failed to set rts threshold: %d", ret);
491 goto out;
492 }
493
494out:
495 kfree(rts);
496 return ret;
497}
498
499int wl12xx_acx_beacon_filter_opt(struct wl12xx *wl)
500{
501 struct acx_beacon_filter_option *beacon_filter;
502 int ret;
503
504 wl12xx_debug(DEBUG_ACX, "acx beacon filter opt");
505
506 beacon_filter = kzalloc(sizeof(*beacon_filter), GFP_KERNEL);
507 if (!beacon_filter) {
508 ret = -ENOMEM;
509 goto out;
510 }
511
512 beacon_filter->enable = 0;
513 beacon_filter->max_num_beacons = 0;
514
515 ret = wl12xx_cmd_configure(wl, ACX_BEACON_FILTER_OPT,
516 beacon_filter, sizeof(*beacon_filter));
517 if (ret < 0) {
518 wl12xx_warning("failed to set beacon filter opt: %d", ret);
519 goto out;
520 }
521
522out:
523 kfree(beacon_filter);
524 return ret;
525}
526
527int wl12xx_acx_beacon_filter_table(struct wl12xx *wl)
528{
529 struct acx_beacon_filter_ie_table *ie_table;
530 int ret;
531
532 wl12xx_debug(DEBUG_ACX, "acx beacon filter table");
533
534 ie_table = kzalloc(sizeof(*ie_table), GFP_KERNEL);
535 if (!ie_table) {
536 ret = -ENOMEM;
537 goto out;
538 }
539
540 ie_table->num_ie = 0;
541 memset(ie_table->table, 0, BEACON_FILTER_TABLE_MAX_SIZE);
542
543 ret = wl12xx_cmd_configure(wl, ACX_BEACON_FILTER_TABLE,
544 ie_table, sizeof(*ie_table));
545 if (ret < 0) {
546 wl12xx_warning("failed to set beacon filter table: %d", ret);
547 goto out;
548 }
549
550out:
551 kfree(ie_table);
552 return ret;
553}
554
555int wl12xx_acx_sg_enable(struct wl12xx *wl)
556{
557 struct acx_bt_wlan_coex *pta;
558 int ret;
559
560 wl12xx_debug(DEBUG_ACX, "acx sg enable");
561
562 pta = kzalloc(sizeof(*pta), GFP_KERNEL);
563 if (!pta) {
564 ret = -ENOMEM;
565 goto out;
566 }
567
568 pta->enable = SG_ENABLE;
569
570 ret = wl12xx_cmd_configure(wl, ACX_SG_ENABLE, pta, sizeof(*pta));
571 if (ret < 0) {
572 wl12xx_warning("failed to set softgemini enable: %d", ret);
573 goto out;
574 }
575
576out:
577 kfree(pta);
578 return ret;
579}
580
581int wl12xx_acx_sg_cfg(struct wl12xx *wl)
582{
583 struct acx_bt_wlan_coex_param *param;
584 int ret;
585
586 wl12xx_debug(DEBUG_ACX, "acx sg cfg");
587
588 param = kzalloc(sizeof(*param), GFP_KERNEL);
589 if (!param) {
590 ret = -ENOMEM;
591 goto out;
592 }
593
594 /* BT-WLAN coext parameters */
595 param->min_rate = RATE_INDEX_24MBPS;
596 param->bt_hp_max_time = PTA_BT_HP_MAXTIME_DEF;
597 param->wlan_hp_max_time = PTA_WLAN_HP_MAX_TIME_DEF;
598 param->sense_disable_timer = PTA_SENSE_DISABLE_TIMER_DEF;
599 param->rx_time_bt_hp = PTA_PROTECTIVE_RX_TIME_DEF;
600 param->tx_time_bt_hp = PTA_PROTECTIVE_TX_TIME_DEF;
601 param->rx_time_bt_hp_fast = PTA_PROTECTIVE_RX_TIME_FAST_DEF;
602 param->tx_time_bt_hp_fast = PTA_PROTECTIVE_TX_TIME_FAST_DEF;
603 param->wlan_cycle_fast = PTA_CYCLE_TIME_FAST_DEF;
604 param->bt_anti_starvation_period = PTA_ANTI_STARVE_PERIOD_DEF;
605 param->next_bt_lp_packet = PTA_TIMEOUT_NEXT_BT_LP_PACKET_DEF;
606 param->wake_up_beacon = PTA_TIME_BEFORE_BEACON_DEF;
607 param->hp_dm_max_guard_time = PTA_HPDM_MAX_TIME_DEF;
608 param->next_wlan_packet = PTA_TIME_OUT_NEXT_WLAN_DEF;
609 param->antenna_type = PTA_ANTENNA_TYPE_DEF;
610 param->signal_type = PTA_SIGNALING_TYPE_DEF;
611 param->afh_leverage_on = PTA_AFH_LEVERAGE_ON_DEF;
612 param->quiet_cycle_num = PTA_NUMBER_QUIET_CYCLE_DEF;
613 param->max_cts = PTA_MAX_NUM_CTS_DEF;
614 param->wlan_packets_num = PTA_NUMBER_OF_WLAN_PACKETS_DEF;
615 param->bt_packets_num = PTA_NUMBER_OF_BT_PACKETS_DEF;
616 param->missed_rx_avalanche = PTA_RX_FOR_AVALANCHE_DEF;
617 param->wlan_elp_hp = PTA_ELP_HP_DEF;
618 param->bt_anti_starvation_cycles = PTA_ANTI_STARVE_NUM_CYCLE_DEF;
619 param->ack_mode_dual_ant = PTA_ACK_MODE_DEF;
620 param->pa_sd_enable = PTA_ALLOW_PA_SD_DEF;
621 param->pta_auto_mode_enable = PTA_AUTO_MODE_NO_CTS_DEF;
622 param->bt_hp_respected_num = PTA_BT_HP_RESPECTED_DEF;
623
624 ret = wl12xx_cmd_configure(wl, ACX_SG_CFG, param, sizeof(*param));
625 if (ret < 0) {
626 wl12xx_warning("failed to set sg config: %d", ret);
627 goto out;
628 }
629
630out:
631 kfree(param);
632 return ret;
633}
634
635int wl12xx_acx_cca_threshold(struct wl12xx *wl)
636{
637 struct acx_energy_detection *detection;
638 int ret;
639
640 wl12xx_debug(DEBUG_ACX, "acx cca threshold");
641
642 detection = kzalloc(sizeof(*detection), GFP_KERNEL);
643 if (!detection) {
644 ret = -ENOMEM;
645 goto out;
646 }
647
648 detection->rx_cca_threshold = CCA_THRSH_DISABLE_ENERGY_D;
649 detection->tx_energy_detection = 0;
650
651 ret = wl12xx_cmd_configure(wl, ACX_CCA_THRESHOLD,
652 detection, sizeof(*detection));
653 if (ret < 0) {
654 wl12xx_warning("failed to set cca threshold: %d", ret);
655 return ret;
656 }
657
658out:
659 kfree(detection);
660 return ret;
661}
662
663int wl12xx_acx_bcn_dtim_options(struct wl12xx *wl)
664{
665 struct acx_beacon_broadcast *bb;
666 int ret;
667
668 wl12xx_debug(DEBUG_ACX, "acx bcn dtim options");
669
670 bb = kzalloc(sizeof(*bb), GFP_KERNEL);
671 if (!bb) {
672 ret = -ENOMEM;
673 goto out;
674 }
675
676 bb->beacon_rx_timeout = BCN_RX_TIMEOUT_DEF_VALUE;
677 bb->broadcast_timeout = BROADCAST_RX_TIMEOUT_DEF_VALUE;
678 bb->rx_broadcast_in_ps = RX_BROADCAST_IN_PS_DEF_VALUE;
679 bb->ps_poll_threshold = CONSECUTIVE_PS_POLL_FAILURE_DEF;
680
681 ret = wl12xx_cmd_configure(wl, ACX_BCN_DTIM_OPTIONS, bb, sizeof(*bb));
682 if (ret < 0) {
683 wl12xx_warning("failed to set rx config: %d", ret);
684 goto out;
685 }
686
687out:
688 kfree(bb);
689 return ret;
690}
691
692int wl12xx_acx_aid(struct wl12xx *wl, u16 aid)
693{
694 struct acx_aid *acx_aid;
695 int ret;
696
697 wl12xx_debug(DEBUG_ACX, "acx aid");
698
699 acx_aid = kzalloc(sizeof(*acx_aid), GFP_KERNEL);
700 if (!acx_aid) {
701 ret = -ENOMEM;
702 goto out;
703 }
704
705 acx_aid->aid = aid;
706
707 ret = wl12xx_cmd_configure(wl, ACX_AID, acx_aid, sizeof(*acx_aid));
708 if (ret < 0) {
709 wl12xx_warning("failed to set aid: %d", ret);
710 goto out;
711 }
712
713out:
714 kfree(acx_aid);
715 return ret;
716}
717
718int wl12xx_acx_event_mbox_mask(struct wl12xx *wl, u32 event_mask)
719{
720 struct acx_event_mask *mask;
721 int ret;
722
723 wl12xx_debug(DEBUG_ACX, "acx event mbox mask");
724
725 mask = kzalloc(sizeof(*mask), GFP_KERNEL);
726 if (!mask) {
727 ret = -ENOMEM;
728 goto out;
729 }
730
731 /* high event mask is unused */
732 mask->high_event_mask = 0xffffffff;
733
734 mask->event_mask = event_mask;
735
736 ret = wl12xx_cmd_configure(wl, ACX_EVENT_MBOX_MASK,
737 mask, sizeof(*mask));
738 if (ret < 0) {
739 wl12xx_warning("failed to set acx_event_mbox_mask: %d", ret);
740 goto out;
741 }
742
743out:
744 kfree(mask);
745 return ret;
746}
747
748int wl12xx_acx_set_preamble(struct wl12xx *wl, enum acx_preamble_type preamble)
749{
750 struct acx_preamble *acx;
751 int ret;
752
753 wl12xx_debug(DEBUG_ACX, "acx_set_preamble");
754
755 acx = kzalloc(sizeof(*acx), GFP_KERNEL);
756 if (!acx) {
757 ret = -ENOMEM;
758 goto out;
759 }
760
761 acx->preamble = preamble;
762
763 ret = wl12xx_cmd_configure(wl, ACX_PREAMBLE_TYPE, acx, sizeof(*acx));
764 if (ret < 0) {
765 wl12xx_warning("Setting of preamble failed: %d", ret);
766 goto out;
767 }
768
769out:
770 kfree(acx);
771 return ret;
772}
773
774int wl12xx_acx_cts_protect(struct wl12xx *wl,
775 enum acx_ctsprotect_type ctsprotect)
776{
777 struct acx_ctsprotect *acx;
778 int ret;
779
780 wl12xx_debug(DEBUG_ACX, "acx_set_ctsprotect");
781
782 acx = kzalloc(sizeof(*acx), GFP_KERNEL);
783 if (!acx) {
784 ret = -ENOMEM;
785 goto out;
786 }
787
788 acx->ctsprotect = ctsprotect;
789
790 ret = wl12xx_cmd_configure(wl, ACX_CTS_PROTECTION, acx, sizeof(*acx));
791 if (ret < 0) {
792 wl12xx_warning("Setting of ctsprotect failed: %d", ret);
793 goto out;
794 }
795
796out:
797 kfree(acx);
798 return ret;
799}
800
801int wl12xx_acx_tsf_info(struct wl12xx *wl, u64 *mactime)
802{
803 struct acx_tsf_info *tsf_info;
804 int ret;
805
806 tsf_info = kzalloc(sizeof(*tsf_info), GFP_KERNEL);
807 if (!tsf_info) {
808 ret = -ENOMEM;
809 goto out;
810 }
811
812 ret = wl12xx_cmd_interrogate(wl, ACX_TSF_INFO,
813 tsf_info, sizeof(*tsf_info));
814 if (ret < 0) {
815 wl12xx_warning("ACX_FW_REV interrogate failed");
816 goto out;
817 }
818
819 *mactime = tsf_info->current_tsf_lsb |
820 (tsf_info->current_tsf_msb << 31);
821
822out:
823 kfree(tsf_info);
824 return ret;
825}
826
827int wl12xx_acx_statistics(struct wl12xx *wl, struct acx_statistics *stats)
828{
829 int ret;
830
831 wl12xx_debug(DEBUG_ACX, "acx statistics");
832
833 ret = wl12xx_cmd_interrogate(wl, ACX_STATISTICS, stats,
834 sizeof(*stats));
835 if (ret < 0) {
836 wl12xx_warning("acx statistics failed: %d", ret);
837 return -ENOMEM;
838 }
839
840 return 0;
841}