iwlwifi: mvm: BT Coex - fix SYNC2SCO flags
[deliverable/linux.git] / drivers / net / wireless / iwlwifi / mvm / fw-api-bt-coex.h
CommitLineData
fb3ceb81
EG
1/******************************************************************************
2 *
3 * This file is provided under a dual BSD/GPLv2 license. When using or
4 * redistributing this file, you may do so under either license.
5 *
6 * GPL LICENSE SUMMARY
7 *
51368bf7 8 * Copyright(c) 2013 - 2014 Intel Corporation. All rights reserved.
fb3ceb81
EG
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
22 * USA
23 *
24 * The full GNU General Public License is included in this distribution
25 * in the file called COPYING.
26 *
27 * Contact Information:
28 * Intel Linux Wireless <ilw@linux.intel.com>
29 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
30 *
31 * BSD LICENSE
32 *
51368bf7 33 * Copyright(c) 2013 - 2014 Intel Corporation. All rights reserved.
fb3ceb81
EG
34 * All rights reserved.
35 *
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions
38 * are met:
39 *
40 * * Redistributions of source code must retain the above copyright
41 * notice, this list of conditions and the following disclaimer.
42 * * Redistributions in binary form must reproduce the above copyright
43 * notice, this list of conditions and the following disclaimer in
44 * the documentation and/or other materials provided with the
45 * distribution.
46 * * Neither the name Intel Corporation nor the names of its
47 * contributors may be used to endorse or promote products derived
48 * from this software without specific prior written permission.
49 *
50 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
51 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
52 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
53 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
54 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
55 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
56 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
57 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
58 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
59 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
60 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
61 *****************************************************************************/
62
63#ifndef __fw_api_bt_coex_h__
64#define __fw_api_bt_coex_h__
65
66#include <linux/types.h>
67#include <linux/bitops.h>
68
69#define BITS(nb) (BIT(nb) - 1)
70
71/**
72 * enum iwl_bt_coex_flags - flags for BT_COEX command
fb3ceb81
EG
73 * @BT_COEX_MODE_POS:
74 * @BT_COEX_MODE_MSK:
75 * @BT_COEX_DISABLE:
76 * @BT_COEX_2W:
77 * @BT_COEX_3W:
78 * @BT_COEX_NW:
741e703b 79 * @BT_COEX_SYNC2SCO:
7352cac0
EG
80 *
81 * The COEX_MODE must be set for each command. Even if it is not changed.
fb3ceb81
EG
82 */
83enum iwl_bt_coex_flags {
fb3ceb81
EG
84 BT_COEX_MODE_POS = 3,
85 BT_COEX_MODE_MSK = BITS(3) << BT_COEX_MODE_POS,
86 BT_COEX_DISABLE = 0x0 << BT_COEX_MODE_POS,
87 BT_COEX_2W = 0x1 << BT_COEX_MODE_POS,
88 BT_COEX_3W = 0x2 << BT_COEX_MODE_POS,
89 BT_COEX_NW = 0x3 << BT_COEX_MODE_POS,
741e703b 90 BT_COEX_SYNC2SCO = BIT(7),
fb3ceb81
EG
91};
92
93/*
94 * indicates what has changed in the BT_COEX command.
7352cac0
EG
95 * BT_VALID_ENABLE must be set for each command. Commands without this bit will
96 * discarded by the firmware
fb3ceb81
EG
97 */
98enum iwl_bt_coex_valid_bit_msk {
99 BT_VALID_ENABLE = BIT(0),
100 BT_VALID_BT_PRIO_BOOST = BIT(1),
101 BT_VALID_MAX_KILL = BIT(2),
102 BT_VALID_3W_TMRS = BIT(3),
103 BT_VALID_KILL_ACK = BIT(4),
104 BT_VALID_KILL_CTS = BIT(5),
105 BT_VALID_REDUCED_TX_POWER = BIT(6),
106 BT_VALID_LUT = BIT(7),
107 BT_VALID_WIFI_RX_SW_PRIO_BOOST = BIT(8),
108 BT_VALID_WIFI_TX_SW_PRIO_BOOST = BIT(9),
109 BT_VALID_MULTI_PRIO_LUT = BIT(10),
110 BT_VALID_TRM_KICK_FILTER = BIT(11),
111 BT_VALID_CORUN_LUT_20 = BIT(12),
112 BT_VALID_CORUN_LUT_40 = BIT(13),
113 BT_VALID_ANT_ISOLATION = BIT(14),
114 BT_VALID_ANT_ISOLATION_THRS = BIT(15),
dac94da8
EG
115 BT_VALID_TXTX_DELTA_FREQ_THRS = BIT(16),
116 BT_VALID_TXRX_MAX_FREQ_0 = BIT(17),
b9c509cc 117 BT_VALID_SYNC_TO_SCO = BIT(18),
fb3ceb81
EG
118};
119
120/**
121 * enum iwl_bt_reduced_tx_power - allows to reduce txpower for WiFi frames.
122 * @BT_REDUCED_TX_POWER_CTL: reduce Tx power for control frames
123 * @BT_REDUCED_TX_POWER_DATA: reduce Tx power for data frames
124 *
125 * This mechanism allows to have BT and WiFi run concurrently. Since WiFi
126 * reduces its Tx power, it can work along with BT, hence reducing the amount
127 * of WiFi frames being killed by BT.
128 */
129enum iwl_bt_reduced_tx_power {
130 BT_REDUCED_TX_POWER_CTL = BIT(0),
131 BT_REDUCED_TX_POWER_DATA = BIT(1),
132};
133
dac94da8
EG
134enum iwl_bt_coex_lut_type {
135 BT_COEX_TIGHT_LUT = 0,
136 BT_COEX_LOOSE_LUT,
137 BT_COEX_TX_DIS_LUT,
138
139 BT_COEX_MAX_LUT,
140};
141
fb3ceb81 142#define BT_COEX_LUT_SIZE (12)
dac94da8
EG
143#define BT_COEX_CORUN_LUT_SIZE (32)
144#define BT_COEX_MULTI_PRIO_LUT_SIZE (2)
145#define BT_COEX_BOOST_SIZE (4)
146#define BT_REDUCED_TX_POWER_BIT BIT(7)
fb3ceb81
EG
147
148/**
149 * struct iwl_bt_coex_cmd - bt coex configuration command
150 * @flags:&enum iwl_bt_coex_flags
fb3ceb81 151 * @max_kill:
fb3ceb81 152 * @bt_reduced_tx_power: enum %iwl_bt_reduced_tx_power
dac94da8
EG
153 * @bt4_antenna_isolation:
154 * @bt4_antenna_isolation_thr:
155 * @bt4_tx_tx_delta_freq_thr:
156 * @bt4_tx_rx_max_freq0:
157 * @bt_prio_boost:
fb3ceb81
EG
158 * @wifi_tx_prio_boost: SW boost of wifi tx priority
159 * @wifi_rx_prio_boost: SW boost of wifi rx priority
dac94da8
EG
160 * @kill_ack_msk:
161 * @kill_cts_msk:
162 * @decision_lut:
163 * @bt4_multiprio_lut:
164 * @bt4_corun_lut20:
165 * @bt4_corun_lut40:
166 * @valid_bit_msk: enum %iwl_bt_coex_valid_bit_msk
fb3ceb81
EG
167 *
168 * The structure is used for the BT_COEX command.
169 */
170struct iwl_bt_coex_cmd {
dac94da8 171 __le32 flags;
fb3ceb81 172 u8 max_kill;
dac94da8
EG
173 u8 bt_reduced_tx_power;
174 u8 reserved[2];
175
176 u8 bt4_antenna_isolation;
177 u8 bt4_antenna_isolation_thr;
178 u8 bt4_tx_tx_delta_freq_thr;
179 u8 bt4_tx_rx_max_freq0;
180
181 __le32 bt_prio_boost[BT_COEX_BOOST_SIZE];
182 __le32 wifi_tx_prio_boost;
183 __le32 wifi_rx_prio_boost;
fb3ceb81
EG
184 __le32 kill_ack_msk;
185 __le32 kill_cts_msk;
dac94da8
EG
186
187 __le32 decision_lut[BT_COEX_MAX_LUT][BT_COEX_LUT_SIZE];
188 __le32 bt4_multiprio_lut[BT_COEX_MULTI_PRIO_LUT_SIZE];
189 __le32 bt4_corun_lut20[BT_COEX_CORUN_LUT_SIZE];
190 __le32 bt4_corun_lut40[BT_COEX_CORUN_LUT_SIZE];
191
192 __le32 valid_bit_msk;
fb3ceb81
EG
193} __packed; /* BT_COEX_CMD_API_S_VER_3 */
194
dac94da8
EG
195/**
196 * struct iwl_bt_coex_ci_cmd - bt coex channel inhibition command
197 * @bt_primary_ci:
198 * @bt_secondary_ci:
199 * @co_run_bw_primary:
200 * @co_run_bw_secondary:
201 * @primary_ch_phy_id:
202 * @secondary_ch_phy_id:
203 *
204 * Used for BT_COEX_CI command
205 */
206struct iwl_bt_coex_ci_cmd {
207 __le64 bt_primary_ci;
208 __le64 bt_secondary_ci;
209
210 u8 co_run_bw_primary;
211 u8 co_run_bw_secondary;
212 u8 primary_ch_phy_id;
213 u8 secondary_ch_phy_id;
214} __packed; /* BT_CI_MSG_API_S_VER_1 */
215
fb3ceb81
EG
216#define BT_MBOX(n_dw, _msg, _pos, _nbits) \
217 BT_MBOX##n_dw##_##_msg##_POS = (_pos), \
218 BT_MBOX##n_dw##_##_msg = BITS(_nbits) << BT_MBOX##n_dw##_##_msg##_POS
219
220enum iwl_bt_mxbox_dw0 {
221 BT_MBOX(0, LE_SLAVE_LAT, 0, 3),
222 BT_MBOX(0, LE_PROF1, 3, 1),
223 BT_MBOX(0, LE_PROF2, 4, 1),
224 BT_MBOX(0, LE_PROF_OTHER, 5, 1),
225 BT_MBOX(0, CHL_SEQ_N, 8, 4),
226 BT_MBOX(0, INBAND_S, 13, 1),
227 BT_MBOX(0, LE_MIN_RSSI, 16, 4),
228 BT_MBOX(0, LE_SCAN, 20, 1),
229 BT_MBOX(0, LE_ADV, 21, 1),
230 BT_MBOX(0, LE_MAX_TX_POWER, 24, 4),
231 BT_MBOX(0, OPEN_CON_1, 28, 2),
232};
233
234enum iwl_bt_mxbox_dw1 {
235 BT_MBOX(1, BR_MAX_TX_POWER, 0, 4),
236 BT_MBOX(1, IP_SR, 4, 1),
237 BT_MBOX(1, LE_MSTR, 5, 1),
238 BT_MBOX(1, AGGR_TRFC_LD, 8, 6),
239 BT_MBOX(1, MSG_TYPE, 16, 3),
240 BT_MBOX(1, SSN, 19, 2),
241};
242
243enum iwl_bt_mxbox_dw2 {
244 BT_MBOX(2, SNIFF_ACT, 0, 3),
245 BT_MBOX(2, PAG, 3, 1),
246 BT_MBOX(2, INQUIRY, 4, 1),
247 BT_MBOX(2, CONN, 5, 1),
248 BT_MBOX(2, SNIFF_INTERVAL, 8, 5),
249 BT_MBOX(2, DISC, 13, 1),
250 BT_MBOX(2, SCO_TX_ACT, 16, 2),
251 BT_MBOX(2, SCO_RX_ACT, 18, 2),
252 BT_MBOX(2, ESCO_RE_TX, 20, 2),
253 BT_MBOX(2, SCO_DURATION, 24, 6),
254};
255
256enum iwl_bt_mxbox_dw3 {
257 BT_MBOX(3, SCO_STATE, 0, 1),
258 BT_MBOX(3, SNIFF_STATE, 1, 1),
259 BT_MBOX(3, A2DP_STATE, 2, 1),
260 BT_MBOX(3, ACL_STATE, 3, 1),
261 BT_MBOX(3, MSTR_STATE, 4, 1),
262 BT_MBOX(3, OBX_STATE, 5, 1),
263 BT_MBOX(3, OPEN_CON_2, 8, 2),
264 BT_MBOX(3, TRAFFIC_LOAD, 10, 2),
265 BT_MBOX(3, CHL_SEQN_LSB, 12, 1),
266 BT_MBOX(3, INBAND_P, 13, 1),
267 BT_MBOX(3, MSG_TYPE_2, 16, 3),
268 BT_MBOX(3, SSN_2, 19, 2),
269 BT_MBOX(3, UPDATE_REQUEST, 21, 1),
270};
271
272#define BT_MBOX_MSG(_notif, _num, _field) \
273 ((le32_to_cpu((_notif)->mbox_msg[(_num)]) & BT_MBOX##_num##_##_field)\
274 >> BT_MBOX##_num##_##_field##_POS)
275
dac94da8
EG
276enum iwl_bt_activity_grading {
277 BT_OFF = 0,
278 BT_ON_NO_CONNECTION = 1,
279 BT_LOW_TRAFFIC = 2,
280 BT_HIGH_TRAFFIC = 3,
281};
282
fb3ceb81
EG
283/**
284 * struct iwl_bt_coex_profile_notif - notification about BT coex
285 * @mbox_msg: message from BT to WiFi
dac94da8
EG
286 * @msg_idx: the index of the message
287 * @bt_status: 0 - off, 1 - on
288 * @bt_open_conn: number of BT connections open
289 * @bt_traffic_load: load of BT traffic
290 * @bt_agg_traffic_load: aggregated load of BT traffic
291 * @bt_ci_compliance: 0 - no CI compliance, 1 - CI compliant
292 * @primary_ch_lut: LUT used for primary channel
293 * @secondary_ch_lut: LUT used for secondary channel
294 * @bt_activity_grading: the activity of BT enum %iwl_bt_activity_grading
fb3ceb81
EG
295 */
296struct iwl_bt_coex_profile_notif {
297 __le32 mbox_msg[4];
dac94da8 298 __le32 msg_idx;
fb3ceb81
EG
299 u8 bt_status;
300 u8 bt_open_conn;
301 u8 bt_traffic_load;
302 u8 bt_agg_traffic_load;
303 u8 bt_ci_compliance;
304 u8 reserved[3];
dac94da8
EG
305
306 __le32 primary_ch_lut;
307 __le32 secondary_ch_lut;
308 __le32 bt_activity_grading;
fb3ceb81
EG
309} __packed; /* BT_COEX_PROFILE_NTFY_API_S_VER_2 */
310
311enum iwl_bt_coex_prio_table_event {
312 BT_COEX_PRIO_TBL_EVT_INIT_CALIB1 = 0,
313 BT_COEX_PRIO_TBL_EVT_INIT_CALIB2 = 1,
314 BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_LOW1 = 2,
315 BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_LOW2 = 3,
316 BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_HIGH1 = 4,
317 BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_HIGH2 = 5,
318 BT_COEX_PRIO_TBL_EVT_DTIM = 6,
319 BT_COEX_PRIO_TBL_EVT_SCAN52 = 7,
320 BT_COEX_PRIO_TBL_EVT_SCAN24 = 8,
321 BT_COEX_PRIO_TBL_EVT_IDLE = 9,
322 BT_COEX_PRIO_TBL_EVT_MAX = 16,
323}; /* BT_COEX_PRIO_TABLE_EVENTS_API_E_VER_1 */
324
325enum iwl_bt_coex_prio_table_prio {
326 BT_COEX_PRIO_TBL_DISABLED = 0,
327 BT_COEX_PRIO_TBL_PRIO_LOW = 1,
328 BT_COEX_PRIO_TBL_PRIO_HIGH = 2,
329 BT_COEX_PRIO_TBL_PRIO_BYPASS = 3,
330 BT_COEX_PRIO_TBL_PRIO_COEX_OFF = 4,
331 BT_COEX_PRIO_TBL_PRIO_COEX_ON = 5,
332 BT_COEX_PRIO_TBL_PRIO_COEX_IDLE = 6,
333 BT_COEX_PRIO_TBL_MAX = 8,
334}; /* BT_COEX_PRIO_TABLE_PRIORITIES_API_E_VER_1 */
335
336#define BT_COEX_PRIO_TBL_SHRD_ANT_POS (0)
337#define BT_COEX_PRIO_TBL_PRIO_POS (1)
338#define BT_COEX_PRIO_TBL_RESERVED_POS (4)
339
340/**
341 * struct iwl_bt_coex_prio_tbl_cmd - priority table for BT coex
342 * @prio_tbl:
343 */
344struct iwl_bt_coex_prio_tbl_cmd {
345 u8 prio_tbl[BT_COEX_PRIO_TBL_EVT_MAX];
346} __packed;
347
fb3ceb81 348#endif /* __fw_api_bt_coex_h__ */
This page took 0.099953 seconds and 5 git commands to generate.