2 * Copyright (c) 2010 Atheros Communications Inc.
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21 struct wmi_event_txrate
{
35 WMI_ECHO_CMDID
= 0x0001,
36 WMI_ACCESS_MEMORY_CMDID
,
38 /* Commands to Target */
39 WMI_DISABLE_INTR_CMDID
,
40 WMI_ENABLE_INTR_CMDID
,
44 WMI_STOP_TX_DMA_CMDID
,
45 WMI_STOP_DMA_RECV_CMDID
,
46 WMI_ABORT_TX_DMA_CMDID
,
48 WMI_DRAIN_TXQ_ALL_CMDID
,
54 WMI_NODE_CREATE_CMDID
,
55 WMI_NODE_REMOVE_CMDID
,
58 WMI_BEACON_UPDATE_CMDID
,
61 WMI_RC_STATE_CHANGE_CMDID
,
62 WMI_RC_RATE_UPDATE_CMDID
,
65 WMI_TARGET_IC_UPDATE_CMDID
,
67 WMI_TX_AGGR_ENABLE_CMDID
,
69 WMI_TGT_TXQ_ENABLE_CMDID
,
70 WMI_AGGR_LIMIT_CMD
= 0x0026,
74 WMI_TGT_RDY_EVENTID
= 0x1001,
79 WMI_WLAN_TXCOMP_EVENTID
,
84 #define MAX_CMD_NUMBER 62
86 struct register_write
{
92 struct ath9k_htc_priv
*drv_priv
;
93 struct htc_target
*htc
;
94 enum htc_endpoint_id ctrl_epid
;
95 struct mutex op_mutex
;
96 struct completion cmd_wait
;
97 enum wmi_cmd_id last_cmd_id
;
107 struct register_write multi_write
[MAX_CMD_NUMBER
];
109 struct mutex multi_write_mutex
;
112 struct wmi
*ath9k_init_wmi(struct ath9k_htc_priv
*priv
);
113 void ath9k_deinit_wmi(struct ath9k_htc_priv
*priv
);
114 int ath9k_wmi_connect(struct htc_target
*htc
, struct wmi
*wmi
,
115 enum htc_endpoint_id
*wmi_ctrl_epid
);
116 int ath9k_wmi_cmd(struct wmi
*wmi
, enum wmi_cmd_id cmd_id
,
117 u8
*cmd_buf
, u32 cmd_len
,
118 u8
*rsp_buf
, u32 rsp_len
,
120 void ath9k_swba_tasklet(unsigned long data
);
121 void ath9k_fatal_work(struct work_struct
*work
);
123 #define WMI_CMD(_wmi_cmd) \
125 ret = ath9k_wmi_cmd(priv->wmi, _wmi_cmd, NULL, 0, \
127 sizeof(cmd_rsp), HZ*2); \
130 #define WMI_CMD_BUF(_wmi_cmd, _buf) \
132 ret = ath9k_wmi_cmd(priv->wmi, _wmi_cmd, \
133 (u8 *) _buf, sizeof(*_buf), \
134 &cmd_rsp, sizeof(cmd_rsp), HZ*2); \