blob: 816883f9ff94f541906cb945d0bf8002f8f3770b [file] [log] [blame]
Emmanuel Grumbachfb3ceb82013-01-14 15:04:01 +02001/******************************************************************************
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 *
Emmanuel Grumbach51368bf2013-12-30 13:15:54 +02008 * Copyright(c) 2013 - 2014 Intel Corporation. All rights reserved.
Johannes Berg8b4139d2014-07-24 14:05:26 +02009 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
Emmanuel Grumbachfb3ceb82013-01-14 15:04:01 +020010 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of version 2 of the GNU General Public License as
13 * published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
23 * USA
24 *
25 * The full GNU General Public License is included in this distribution
26 * in the file called COPYING.
27 *
28 * Contact Information:
29 * Intel Linux Wireless <ilw@linux.intel.com>
30 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
31 *
32 * BSD LICENSE
33 *
Emmanuel Grumbach51368bf2013-12-30 13:15:54 +020034 * Copyright(c) 2013 - 2014 Intel Corporation. All rights reserved.
Johannes Berg8b4139d2014-07-24 14:05:26 +020035 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
Emmanuel Grumbachfb3ceb82013-01-14 15:04:01 +020036 * All rights reserved.
37 *
38 * Redistribution and use in source and binary forms, with or without
39 * modification, are permitted provided that the following conditions
40 * are met:
41 *
42 * * Redistributions of source code must retain the above copyright
43 * notice, this list of conditions and the following disclaimer.
44 * * Redistributions in binary form must reproduce the above copyright
45 * notice, this list of conditions and the following disclaimer in
46 * the documentation and/or other materials provided with the
47 * distribution.
48 * * Neither the name Intel Corporation nor the names of its
49 * contributors may be used to endorse or promote products derived
50 * from this software without specific prior written permission.
51 *
52 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
53 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
54 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
55 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
56 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
57 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
58 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
59 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
60 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
61 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
62 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
63 *****************************************************************************/
64
65#ifndef __fw_api_bt_coex_h__
66#define __fw_api_bt_coex_h__
67
68#include <linux/types.h>
69#include <linux/bitops.h>
70
71#define BITS(nb) (BIT(nb) - 1)
72
73/**
74 * enum iwl_bt_coex_flags - flags for BT_COEX command
Emmanuel Grumbachfb3ceb82013-01-14 15:04:01 +020075 * @BT_COEX_MODE_POS:
76 * @BT_COEX_MODE_MSK:
Emmanuel Grumbach0ea8d042014-04-02 09:31:36 +030077 * @BT_COEX_DISABLE_OLD:
78 * @BT_COEX_2W_OLD:
79 * @BT_COEX_3W_OLD:
80 * @BT_COEX_NW_OLD:
81 * @BT_COEX_AUTO_OLD:
82 * @BT_COEX_BT_OLD: Antenna is for BT (manufacuring tests)
83 * @BT_COEX_WIFI_OLD: Antenna is for BT (manufacuring tests)
Emmanuel Grumbach741e7032014-01-27 12:12:50 +020084 * @BT_COEX_SYNC2SCO:
Emmanuel Grumbachb9fae2d2014-02-17 11:24:10 +020085 * @BT_COEX_CORUNNING:
Emmanuel Grumbachcdb00562014-03-16 21:55:43 +020086 * @BT_COEX_MPLUT:
Emmanuel Grumbach7352cac2013-10-14 18:52:23 +030087 *
88 * The COEX_MODE must be set for each command. Even if it is not changed.
Emmanuel Grumbachfb3ceb82013-01-14 15:04:01 +020089 */
90enum iwl_bt_coex_flags {
Emmanuel Grumbachfb3ceb82013-01-14 15:04:01 +020091 BT_COEX_MODE_POS = 3,
92 BT_COEX_MODE_MSK = BITS(3) << BT_COEX_MODE_POS,
Emmanuel Grumbach0ea8d042014-04-02 09:31:36 +030093 BT_COEX_DISABLE_OLD = 0x0 << BT_COEX_MODE_POS,
94 BT_COEX_2W_OLD = 0x1 << BT_COEX_MODE_POS,
95 BT_COEX_3W_OLD = 0x2 << BT_COEX_MODE_POS,
96 BT_COEX_NW_OLD = 0x3 << BT_COEX_MODE_POS,
97 BT_COEX_AUTO_OLD = 0x5 << BT_COEX_MODE_POS,
98 BT_COEX_BT_OLD = 0x6 << BT_COEX_MODE_POS,
99 BT_COEX_WIFI_OLD = 0x7 << BT_COEX_MODE_POS,
Emmanuel Grumbach741e7032014-01-27 12:12:50 +0200100 BT_COEX_SYNC2SCO = BIT(7),
Emmanuel Grumbachb9fae2d2014-02-17 11:24:10 +0200101 BT_COEX_CORUNNING = BIT(8),
Emmanuel Grumbachcdb00562014-03-16 21:55:43 +0200102 BT_COEX_MPLUT = BIT(9),
Emmanuel Grumbachfb3ceb82013-01-14 15:04:01 +0200103};
104
105/*
106 * indicates what has changed in the BT_COEX command.
Emmanuel Grumbach7352cac2013-10-14 18:52:23 +0300107 * BT_VALID_ENABLE must be set for each command. Commands without this bit will
108 * discarded by the firmware
Emmanuel Grumbachfb3ceb82013-01-14 15:04:01 +0200109 */
110enum iwl_bt_coex_valid_bit_msk {
111 BT_VALID_ENABLE = BIT(0),
112 BT_VALID_BT_PRIO_BOOST = BIT(1),
113 BT_VALID_MAX_KILL = BIT(2),
114 BT_VALID_3W_TMRS = BIT(3),
115 BT_VALID_KILL_ACK = BIT(4),
116 BT_VALID_KILL_CTS = BIT(5),
117 BT_VALID_REDUCED_TX_POWER = BIT(6),
118 BT_VALID_LUT = BIT(7),
119 BT_VALID_WIFI_RX_SW_PRIO_BOOST = BIT(8),
120 BT_VALID_WIFI_TX_SW_PRIO_BOOST = BIT(9),
121 BT_VALID_MULTI_PRIO_LUT = BIT(10),
122 BT_VALID_TRM_KICK_FILTER = BIT(11),
123 BT_VALID_CORUN_LUT_20 = BIT(12),
124 BT_VALID_CORUN_LUT_40 = BIT(13),
125 BT_VALID_ANT_ISOLATION = BIT(14),
126 BT_VALID_ANT_ISOLATION_THRS = BIT(15),
Emmanuel Grumbachdac94da2013-06-18 07:35:27 +0300127 BT_VALID_TXTX_DELTA_FREQ_THRS = BIT(16),
128 BT_VALID_TXRX_MAX_FREQ_0 = BIT(17),
Emmanuel Grumbachb9c509c2013-11-28 14:58:20 +0200129 BT_VALID_SYNC_TO_SCO = BIT(18),
Emmanuel Grumbachfb3ceb82013-01-14 15:04:01 +0200130};
131
132/**
133 * enum iwl_bt_reduced_tx_power - allows to reduce txpower for WiFi frames.
134 * @BT_REDUCED_TX_POWER_CTL: reduce Tx power for control frames
135 * @BT_REDUCED_TX_POWER_DATA: reduce Tx power for data frames
136 *
137 * This mechanism allows to have BT and WiFi run concurrently. Since WiFi
138 * reduces its Tx power, it can work along with BT, hence reducing the amount
139 * of WiFi frames being killed by BT.
140 */
141enum iwl_bt_reduced_tx_power {
142 BT_REDUCED_TX_POWER_CTL = BIT(0),
143 BT_REDUCED_TX_POWER_DATA = BIT(1),
144};
145
Emmanuel Grumbachdac94da2013-06-18 07:35:27 +0300146enum iwl_bt_coex_lut_type {
147 BT_COEX_TIGHT_LUT = 0,
148 BT_COEX_LOOSE_LUT,
149 BT_COEX_TX_DIS_LUT,
150
151 BT_COEX_MAX_LUT,
Emmanuel Grumbache78973e2014-04-02 09:23:13 +0300152 BT_COEX_INVALID_LUT = 0xff,
153}; /* BT_COEX_DECISION_LUT_INDEX_API_E_VER_1 */
Emmanuel Grumbachdac94da2013-06-18 07:35:27 +0300154
Emmanuel Grumbachfb3ceb82013-01-14 15:04:01 +0200155#define BT_COEX_LUT_SIZE (12)
Emmanuel Grumbachdac94da2013-06-18 07:35:27 +0300156#define BT_COEX_CORUN_LUT_SIZE (32)
157#define BT_COEX_MULTI_PRIO_LUT_SIZE (2)
158#define BT_COEX_BOOST_SIZE (4)
159#define BT_REDUCED_TX_POWER_BIT BIT(7)
Emmanuel Grumbachfb3ceb82013-01-14 15:04:01 +0200160
161/**
Emmanuel Grumbach0ea8d042014-04-02 09:31:36 +0300162 * struct iwl_bt_coex_cmd_old - bt coex configuration command
Emmanuel Grumbachfb3ceb82013-01-14 15:04:01 +0200163 * @flags:&enum iwl_bt_coex_flags
Emmanuel Grumbachfb3ceb82013-01-14 15:04:01 +0200164 * @max_kill:
Emmanuel Grumbachfb3ceb82013-01-14 15:04:01 +0200165 * @bt_reduced_tx_power: enum %iwl_bt_reduced_tx_power
Emmanuel Grumbache78973e2014-04-02 09:23:13 +0300166 * @override_primary_lut: enum %iwl_bt_coex_lut_type: BT_COEX_INVALID_LUT
167 * should be set by default
168 * @override_secondary_lut: enum %iwl_bt_coex_lut_type: BT_COEX_INVALID_LUT
169 * should be set by default
170 * @bt4_antenna_isolation: antenna isolation
171 * @bt4_antenna_isolation_thr: antenna threshold value
172 * @bt4_tx_tx_delta_freq_thr: TxTx delta frequency
173 * @bt4_tx_rx_max_freq0: TxRx max frequency
174 * @bt_prio_boost: BT priority boost registers
Emmanuel Grumbachfb3ceb82013-01-14 15:04:01 +0200175 * @wifi_tx_prio_boost: SW boost of wifi tx priority
176 * @wifi_rx_prio_boost: SW boost of wifi rx priority
Emmanuel Grumbache78973e2014-04-02 09:23:13 +0300177 * @kill_ack_msk: kill ACK mask. 1 - Tx ACK, 0 - kill Tx of ACK.
178 * @kill_cts_msk: kill CTS mask. 1 - Tx CTS, 0 - kill Tx of CTS.
179 * @decision_lut: PTA decision LUT, per Prio-Ch
180 * @bt4_multiprio_lut: multi priority LUT configuration
181 * @bt4_corun_lut20: co-running 20 MHz LUT configuration
182 * @bt4_corun_lut40: co-running 40 MHz LUT configuration
Emmanuel Grumbachdac94da2013-06-18 07:35:27 +0300183 * @valid_bit_msk: enum %iwl_bt_coex_valid_bit_msk
Emmanuel Grumbachfb3ceb82013-01-14 15:04:01 +0200184 *
185 * The structure is used for the BT_COEX command.
186 */
Emmanuel Grumbach0ea8d042014-04-02 09:31:36 +0300187struct iwl_bt_coex_cmd_old {
Emmanuel Grumbachdac94da2013-06-18 07:35:27 +0300188 __le32 flags;
Emmanuel Grumbachfb3ceb82013-01-14 15:04:01 +0200189 u8 max_kill;
Emmanuel Grumbachdac94da2013-06-18 07:35:27 +0300190 u8 bt_reduced_tx_power;
Emmanuel Grumbache78973e2014-04-02 09:23:13 +0300191 u8 override_primary_lut;
192 u8 override_secondary_lut;
Emmanuel Grumbachdac94da2013-06-18 07:35:27 +0300193
194 u8 bt4_antenna_isolation;
195 u8 bt4_antenna_isolation_thr;
196 u8 bt4_tx_tx_delta_freq_thr;
197 u8 bt4_tx_rx_max_freq0;
198
199 __le32 bt_prio_boost[BT_COEX_BOOST_SIZE];
200 __le32 wifi_tx_prio_boost;
201 __le32 wifi_rx_prio_boost;
Emmanuel Grumbachfb3ceb82013-01-14 15:04:01 +0200202 __le32 kill_ack_msk;
203 __le32 kill_cts_msk;
Emmanuel Grumbachdac94da2013-06-18 07:35:27 +0300204
205 __le32 decision_lut[BT_COEX_MAX_LUT][BT_COEX_LUT_SIZE];
206 __le32 bt4_multiprio_lut[BT_COEX_MULTI_PRIO_LUT_SIZE];
207 __le32 bt4_corun_lut20[BT_COEX_CORUN_LUT_SIZE];
208 __le32 bt4_corun_lut40[BT_COEX_CORUN_LUT_SIZE];
209
210 __le32 valid_bit_msk;
Emmanuel Grumbache78973e2014-04-02 09:23:13 +0300211} __packed; /* BT_COEX_CMD_API_S_VER_5 */
Emmanuel Grumbachfb3ceb82013-01-14 15:04:01 +0200212
Emmanuel Grumbach430a3bb2014-04-02 09:55:16 +0300213enum iwl_bt_coex_mode {
214 BT_COEX_DISABLE = 0x0,
215 BT_COEX_NW = 0x1,
216 BT_COEX_BT = 0x2,
217 BT_COEX_WIFI = 0x3,
218}; /* BT_COEX_MODES_E */
219
220enum iwl_bt_coex_enabled_modules {
221 BT_COEX_MPLUT_ENABLED = BIT(0),
222 BT_COEX_MPLUT_BOOST_ENABLED = BIT(1),
223 BT_COEX_SYNC2SCO_ENABLED = BIT(2),
224 BT_COEX_CORUN_ENABLED = BIT(3),
Emmanuel Grumbach261c0ec2014-06-11 15:37:25 +0300225 BT_COEX_HIGH_BAND_RET = BIT(4),
Emmanuel Grumbach430a3bb2014-04-02 09:55:16 +0300226}; /* BT_COEX_MODULES_ENABLE_E_VER_1 */
227
228/**
229 * struct iwl_bt_coex_cmd - bt coex configuration command
230 * @mode: enum %iwl_bt_coex_mode
231 * @enabled_modules: enum %iwl_bt_coex_enabled_modules
232 * @max_kill: max count of Tx retries due to kill from PTA
233 * @override_primary_lut: enum %iwl_bt_coex_lut_type: BT_COEX_INVALID_LUT
234 * should be set by default
235 * @override_secondary_lut: enum %iwl_bt_coex_lut_type: BT_COEX_INVALID_LUT
236 * should be set by default
237 * @bt4_antenna_isolation_thr: antenna threshold value
238 * @bt4_tx_tx_delta_freq_thr: TxTx delta frequency
239 * @bt4_tx_rx_max_freq0: TxRx max frequency
240 * @multiprio_lut: multi priority LUT configuration
241 * @mplut_prio_boost: BT priority boost registers
242 * @decision_lut: PTA decision LUT, per Prio-Ch
243 *
244 * The structure is used for the BT_COEX command.
245 */
246struct iwl_bt_coex_cmd {
247 __le32 mode;
248 __le32 enabled_modules;
249
250 __le32 max_kill;
251 __le32 override_primary_lut;
252 __le32 override_secondary_lut;
253 __le32 bt4_antenna_isolation_thr;
254
255 __le32 bt4_tx_tx_delta_freq_thr;
256 __le32 bt4_tx_rx_max_freq0;
257
258 __le32 multiprio_lut[BT_COEX_MULTI_PRIO_LUT_SIZE];
259 __le32 mplut_prio_boost[BT_COEX_BOOST_SIZE];
260
261 __le32 decision_lut[BT_COEX_MAX_LUT][BT_COEX_LUT_SIZE];
262} __packed; /* BT_COEX_CMD_API_S_VER_6 */
263
264/**
265 * struct iwl_bt_coex_corun_lut_update - bt coex update the corun lut
266 * @corun_lut20: co-running 20 MHz LUT configuration
267 * @corun_lut40: co-running 40 MHz LUT configuration
268 *
269 * The structure is used for the BT_COEX_UPDATE_CORUN_LUT command.
270 */
271struct iwl_bt_coex_corun_lut_update_cmd {
272 __le32 corun_lut20[BT_COEX_CORUN_LUT_SIZE];
273 __le32 corun_lut40[BT_COEX_CORUN_LUT_SIZE];
274} __packed; /* BT_COEX_UPDATE_CORUN_LUT_API_S_VER_1 */
275
276/**
277 * struct iwl_bt_coex_sw_boost - SW boost values
278 * @wifi_tx_prio_boost: SW boost of wifi tx priority
279 * @wifi_rx_prio_boost: SW boost of wifi rx priority
280 * @kill_ack_msk: kill ACK mask. 1 - Tx ACK, 0 - kill Tx of ACK.
281 * @kill_cts_msk: kill CTS mask. 1 - Tx CTS, 0 - kill Tx of CTS.
282 */
283struct iwl_bt_coex_sw_boost {
284 __le32 wifi_tx_prio_boost;
285 __le32 wifi_rx_prio_boost;
286 __le32 kill_ack_msk;
287 __le32 kill_cts_msk;
288};
289
290/**
291 * struct iwl_bt_coex_sw_boost_update_cmd - command to update the SW boost
292 * @boost_values: check struct %iwl_bt_coex_sw_boost - one for each channel
293 * primary / secondary / low priority
294 */
295struct iwl_bt_coex_sw_boost_update_cmd {
296 struct iwl_bt_coex_sw_boost boost_values[3];
297} __packed; /* BT_COEX_UPDATE_SW_BOOST_S_VER_1 */
298
299/**
300 * struct iwl_bt_coex_reduced_txp_update_cmd
301 * @reduced_txp: bit BT_REDUCED_TX_POWER_BIT to enable / disable, rest of the
302 * bits are the sta_id (value)
303 */
304struct iwl_bt_coex_reduced_txp_update_cmd {
305 __le32 reduced_txp;
306} __packed; /* BT_COEX_UPDATE_REDUCED_TX_POWER_API_S_VER_1 */
307
Emmanuel Grumbachdac94da2013-06-18 07:35:27 +0300308/**
309 * struct iwl_bt_coex_ci_cmd - bt coex channel inhibition command
310 * @bt_primary_ci:
Emmanuel Grumbachdac94da2013-06-18 07:35:27 +0300311 * @primary_ch_phy_id:
Emmanuel Grumbach430a3bb2014-04-02 09:55:16 +0300312 * @bt_secondary_ci:
Emmanuel Grumbachdac94da2013-06-18 07:35:27 +0300313 * @secondary_ch_phy_id:
314 *
315 * Used for BT_COEX_CI command
316 */
Emmanuel Grumbach430a3bb2014-04-02 09:55:16 +0300317struct iwl_bt_coex_ci_cmd {
Emmanuel Grumbachdac94da2013-06-18 07:35:27 +0300318 __le64 bt_primary_ci;
Emmanuel Grumbach430a3bb2014-04-02 09:55:16 +0300319 __le32 primary_ch_phy_id;
Emmanuel Grumbachdac94da2013-06-18 07:35:27 +0300320
Emmanuel Grumbach430a3bb2014-04-02 09:55:16 +0300321 __le64 bt_secondary_ci;
322 __le32 secondary_ch_phy_id;
323} __packed; /* BT_CI_MSG_API_S_VER_2 */
Emmanuel Grumbachdac94da2013-06-18 07:35:27 +0300324
Emmanuel Grumbachfb3ceb82013-01-14 15:04:01 +0200325#define BT_MBOX(n_dw, _msg, _pos, _nbits) \
326 BT_MBOX##n_dw##_##_msg##_POS = (_pos), \
327 BT_MBOX##n_dw##_##_msg = BITS(_nbits) << BT_MBOX##n_dw##_##_msg##_POS
328
329enum iwl_bt_mxbox_dw0 {
330 BT_MBOX(0, LE_SLAVE_LAT, 0, 3),
331 BT_MBOX(0, LE_PROF1, 3, 1),
332 BT_MBOX(0, LE_PROF2, 4, 1),
333 BT_MBOX(0, LE_PROF_OTHER, 5, 1),
334 BT_MBOX(0, CHL_SEQ_N, 8, 4),
335 BT_MBOX(0, INBAND_S, 13, 1),
336 BT_MBOX(0, LE_MIN_RSSI, 16, 4),
337 BT_MBOX(0, LE_SCAN, 20, 1),
338 BT_MBOX(0, LE_ADV, 21, 1),
339 BT_MBOX(0, LE_MAX_TX_POWER, 24, 4),
340 BT_MBOX(0, OPEN_CON_1, 28, 2),
341};
342
343enum iwl_bt_mxbox_dw1 {
344 BT_MBOX(1, BR_MAX_TX_POWER, 0, 4),
345 BT_MBOX(1, IP_SR, 4, 1),
346 BT_MBOX(1, LE_MSTR, 5, 1),
347 BT_MBOX(1, AGGR_TRFC_LD, 8, 6),
348 BT_MBOX(1, MSG_TYPE, 16, 3),
349 BT_MBOX(1, SSN, 19, 2),
350};
351
352enum iwl_bt_mxbox_dw2 {
353 BT_MBOX(2, SNIFF_ACT, 0, 3),
354 BT_MBOX(2, PAG, 3, 1),
355 BT_MBOX(2, INQUIRY, 4, 1),
356 BT_MBOX(2, CONN, 5, 1),
357 BT_MBOX(2, SNIFF_INTERVAL, 8, 5),
358 BT_MBOX(2, DISC, 13, 1),
359 BT_MBOX(2, SCO_TX_ACT, 16, 2),
360 BT_MBOX(2, SCO_RX_ACT, 18, 2),
361 BT_MBOX(2, ESCO_RE_TX, 20, 2),
362 BT_MBOX(2, SCO_DURATION, 24, 6),
363};
364
365enum iwl_bt_mxbox_dw3 {
366 BT_MBOX(3, SCO_STATE, 0, 1),
367 BT_MBOX(3, SNIFF_STATE, 1, 1),
368 BT_MBOX(3, A2DP_STATE, 2, 1),
369 BT_MBOX(3, ACL_STATE, 3, 1),
370 BT_MBOX(3, MSTR_STATE, 4, 1),
371 BT_MBOX(3, OBX_STATE, 5, 1),
372 BT_MBOX(3, OPEN_CON_2, 8, 2),
373 BT_MBOX(3, TRAFFIC_LOAD, 10, 2),
374 BT_MBOX(3, CHL_SEQN_LSB, 12, 1),
375 BT_MBOX(3, INBAND_P, 13, 1),
376 BT_MBOX(3, MSG_TYPE_2, 16, 3),
377 BT_MBOX(3, SSN_2, 19, 2),
378 BT_MBOX(3, UPDATE_REQUEST, 21, 1),
379};
380
381#define BT_MBOX_MSG(_notif, _num, _field) \
382 ((le32_to_cpu((_notif)->mbox_msg[(_num)]) & BT_MBOX##_num##_##_field)\
383 >> BT_MBOX##_num##_##_field##_POS)
384
Emmanuel Grumbachdac94da2013-06-18 07:35:27 +0300385enum iwl_bt_activity_grading {
386 BT_OFF = 0,
387 BT_ON_NO_CONNECTION = 1,
388 BT_LOW_TRAFFIC = 2,
389 BT_HIGH_TRAFFIC = 3,
Emmanuel Grumbach1459f262014-07-06 09:34:38 +0300390
391 BT_MAX_AG,
Emmanuel Grumbache78973e2014-04-02 09:23:13 +0300392}; /* BT_COEX_BT_ACTIVITY_GRADING_API_E_VER_1 */
Emmanuel Grumbachdac94da2013-06-18 07:35:27 +0300393
Emmanuel Grumbach430a3bb2014-04-02 09:55:16 +0300394enum iwl_bt_ci_compliance {
395 BT_CI_COMPLIANCE_NONE = 0,
396 BT_CI_COMPLIANCE_PRIMARY = 1,
397 BT_CI_COMPLIANCE_SECONDARY = 2,
398 BT_CI_COMPLIANCE_BOTH = 3,
399}; /* BT_COEX_CI_COMPLIENCE_E_VER_1 */
400
Emmanuel Grumbach4c86f932014-06-30 10:26:02 +0300401#define IWL_COEX_IS_TTC_ON(_ttc_rrc_status, _phy_id) \
402 (_ttc_rrc_status & BIT(_phy_id))
403
404#define IWL_COEX_IS_RRC_ON(_ttc_rrc_status, _phy_id) \
405 ((_ttc_rrc_status >> 4) & BIT(_phy_id))
406
Emmanuel Grumbachfb3ceb82013-01-14 15:04:01 +0200407/**
408 * struct iwl_bt_coex_profile_notif - notification about BT coex
409 * @mbox_msg: message from BT to WiFi
Emmanuel Grumbachdac94da2013-06-18 07:35:27 +0300410 * @msg_idx: the index of the message
Emmanuel Grumbach430a3bb2014-04-02 09:55:16 +0300411 * @bt_ci_compliance: enum %iwl_bt_ci_compliance
412 * @primary_ch_lut: LUT used for primary channel enum %iwl_bt_coex_lut_type
413 * @secondary_ch_lut: LUT used for secondary channel enume %iwl_bt_coex_lut_type
Emmanuel Grumbachdac94da2013-06-18 07:35:27 +0300414 * @bt_activity_grading: the activity of BT enum %iwl_bt_activity_grading
Emmanuel Grumbach430a3bb2014-04-02 09:55:16 +0300415 * @ttc_rrc_status: is TTC or RRC enabled - one bit per PHY
Emmanuel Grumbachfb3ceb82013-01-14 15:04:01 +0200416 */
Emmanuel Grumbach430a3bb2014-04-02 09:55:16 +0300417struct iwl_bt_coex_profile_notif {
Emmanuel Grumbachfb3ceb82013-01-14 15:04:01 +0200418 __le32 mbox_msg[4];
Emmanuel Grumbachdac94da2013-06-18 07:35:27 +0300419 __le32 msg_idx;
Emmanuel Grumbach430a3bb2014-04-02 09:55:16 +0300420 __le32 bt_ci_compliance;
Emmanuel Grumbachdac94da2013-06-18 07:35:27 +0300421
422 __le32 primary_ch_lut;
423 __le32 secondary_ch_lut;
424 __le32 bt_activity_grading;
Emmanuel Grumbach430a3bb2014-04-02 09:55:16 +0300425 u8 ttc_rrc_status;
426 u8 reserved[3];
427} __packed; /* BT_COEX_PROFILE_NTFY_API_S_VER_4 */
Emmanuel Grumbachfb3ceb82013-01-14 15:04:01 +0200428
429enum iwl_bt_coex_prio_table_event {
430 BT_COEX_PRIO_TBL_EVT_INIT_CALIB1 = 0,
431 BT_COEX_PRIO_TBL_EVT_INIT_CALIB2 = 1,
432 BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_LOW1 = 2,
433 BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_LOW2 = 3,
434 BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_HIGH1 = 4,
435 BT_COEX_PRIO_TBL_EVT_PERIODIC_CALIB_HIGH2 = 5,
436 BT_COEX_PRIO_TBL_EVT_DTIM = 6,
437 BT_COEX_PRIO_TBL_EVT_SCAN52 = 7,
438 BT_COEX_PRIO_TBL_EVT_SCAN24 = 8,
439 BT_COEX_PRIO_TBL_EVT_IDLE = 9,
440 BT_COEX_PRIO_TBL_EVT_MAX = 16,
441}; /* BT_COEX_PRIO_TABLE_EVENTS_API_E_VER_1 */
442
443enum iwl_bt_coex_prio_table_prio {
444 BT_COEX_PRIO_TBL_DISABLED = 0,
445 BT_COEX_PRIO_TBL_PRIO_LOW = 1,
446 BT_COEX_PRIO_TBL_PRIO_HIGH = 2,
447 BT_COEX_PRIO_TBL_PRIO_BYPASS = 3,
448 BT_COEX_PRIO_TBL_PRIO_COEX_OFF = 4,
449 BT_COEX_PRIO_TBL_PRIO_COEX_ON = 5,
450 BT_COEX_PRIO_TBL_PRIO_COEX_IDLE = 6,
451 BT_COEX_PRIO_TBL_MAX = 8,
452}; /* BT_COEX_PRIO_TABLE_PRIORITIES_API_E_VER_1 */
453
454#define BT_COEX_PRIO_TBL_SHRD_ANT_POS (0)
455#define BT_COEX_PRIO_TBL_PRIO_POS (1)
456#define BT_COEX_PRIO_TBL_RESERVED_POS (4)
457
458/**
459 * struct iwl_bt_coex_prio_tbl_cmd - priority table for BT coex
460 * @prio_tbl:
461 */
462struct iwl_bt_coex_prio_tbl_cmd {
463 u8 prio_tbl[BT_COEX_PRIO_TBL_EVT_MAX];
464} __packed;
465
Emmanuel Grumbach430a3bb2014-04-02 09:55:16 +0300466/**
467 * struct iwl_bt_coex_ci_cmd_old - bt coex channel inhibition command
468 * @bt_primary_ci:
469 * @bt_secondary_ci:
470 * @co_run_bw_primary:
471 * @co_run_bw_secondary:
472 * @primary_ch_phy_id:
473 * @secondary_ch_phy_id:
474 *
475 * Used for BT_COEX_CI command
476 */
477struct iwl_bt_coex_ci_cmd_old {
478 __le64 bt_primary_ci;
479 __le64 bt_secondary_ci;
480
481 u8 co_run_bw_primary;
482 u8 co_run_bw_secondary;
483 u8 primary_ch_phy_id;
484 u8 secondary_ch_phy_id;
485} __packed; /* BT_CI_MSG_API_S_VER_1 */
486
487/**
488 * struct iwl_bt_coex_profile_notif_old - notification about BT coex
489 * @mbox_msg: message from BT to WiFi
490 * @msg_idx: the index of the message
491 * @bt_status: 0 - off, 1 - on
492 * @bt_open_conn: number of BT connections open
493 * @bt_traffic_load: load of BT traffic
494 * @bt_agg_traffic_load: aggregated load of BT traffic
495 * @bt_ci_compliance: 0 - no CI compliance, 1 - CI compliant
496 * @primary_ch_lut: LUT used for primary channel
497 * @secondary_ch_lut: LUT used for secondary channel
498 * @bt_activity_grading: the activity of BT enum %iwl_bt_activity_grading
499 */
500struct iwl_bt_coex_profile_notif_old {
501 __le32 mbox_msg[4];
502 __le32 msg_idx;
503 u8 bt_status;
504 u8 bt_open_conn;
505 u8 bt_traffic_load;
506 u8 bt_agg_traffic_load;
507 u8 bt_ci_compliance;
508 u8 ttc_enabled;
509 __le16 reserved;
510
511 __le32 primary_ch_lut;
512 __le32 secondary_ch_lut;
513 __le32 bt_activity_grading;
514} __packed; /* BT_COEX_PROFILE_NTFY_API_S_VER_3 */
515
Emmanuel Grumbachfb3ceb82013-01-14 15:04:01 +0200516#endif /* __fw_api_bt_coex_h__ */