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 {
39 WMI_ECHO_CMDID = 0x0001,
40 WMI_ACCESS_MEMORY_CMDID,
42 /* Commands to Target */
43 WMI_DISABLE_INTR_CMDID,
44 WMI_ENABLE_INTR_CMDID,
48 WMI_STOP_TX_DMA_CMDID,
49 WMI_STOP_DMA_RECV_CMDID,
50 WMI_ABORT_TX_DMA_CMDID,
52 WMI_DRAIN_TXQ_ALL_CMDID,
58 WMI_NODE_CREATE_CMDID,
59 WMI_NODE_REMOVE_CMDID,
62 WMI_BEACON_UPDATE_CMDID,
65 WMI_RC_STATE_CHANGE_CMDID,
66 WMI_RC_RATE_UPDATE_CMDID,
69 WMI_TARGET_IC_UPDATE_CMDID,
71 WMI_TX_AGGR_ENABLE_CMDID,
73 WMI_TGT_TXQ_ENABLE_CMDID,
74 WMI_AGGR_LIMIT_CMD = 0x0026,
78 WMI_TGT_RDY_EVENTID = 0x1001,
83 WMI_WLAN_TXCOMP_EVENTID,
88 #define MAX_CMD_NUMBER 62
90 struct register_write {
96 struct ath9k_htc_priv *drv_priv;
97 struct htc_target *htc;
98 enum htc_endpoint_id ctrl_epid;
99 struct mutex op_mutex;
100 struct completion cmd_wait;
101 enum wmi_cmd_id last_cmd_id;
107 struct sk_buff *wmi_skb;
111 struct register_write multi_write[MAX_CMD_NUMBER];
113 struct mutex multi_write_mutex;
116 struct wmi *ath9k_init_wmi(struct ath9k_htc_priv *priv);
117 void ath9k_deinit_wmi(struct ath9k_htc_priv *priv);
118 int ath9k_wmi_connect(struct htc_target *htc, struct wmi *wmi,
119 enum htc_endpoint_id *wmi_ctrl_epid);
120 int ath9k_wmi_cmd(struct wmi *wmi, enum wmi_cmd_id cmd_id,
121 u8 *cmd_buf, u32 cmd_len,
122 u8 *rsp_buf, u32 rsp_len,
124 void ath9k_wmi_tasklet(unsigned long data);
126 #define WMI_CMD(_wmi_cmd) \
128 ret = ath9k_wmi_cmd(priv->wmi, _wmi_cmd, NULL, 0, \
130 sizeof(cmd_rsp), HZ*2); \
133 #define WMI_CMD_BUF(_wmi_cmd, _buf) \
135 ret = ath9k_wmi_cmd(priv->wmi, _wmi_cmd, \
136 (u8 *) _buf, sizeof(*_buf), \
137 &cmd_rsp, sizeof(cmd_rsp), HZ*2); \