blob: 204c1b13988b043c6e023e4479541a653fcb8ef9 [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:
Emmanuel Grumbachcb2f8272015-11-17 15:39:56 +020029 * Intel Linux Wireless <linuxwifi@intel.com>
Emmanuel Grumbachfb3ceb82013-01-14 15:04:01 +020030 * 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
Emmanuel Grumbachdac94da2013-06-18 07:35:27 +030073enum iwl_bt_coex_lut_type {
74 BT_COEX_TIGHT_LUT = 0,
75 BT_COEX_LOOSE_LUT,
76 BT_COEX_TX_DIS_LUT,
77
78 BT_COEX_MAX_LUT,
Emmanuel Grumbache78973e2014-04-02 09:23:13 +030079 BT_COEX_INVALID_LUT = 0xff,
80}; /* BT_COEX_DECISION_LUT_INDEX_API_E_VER_1 */
Emmanuel Grumbachdac94da2013-06-18 07:35:27 +030081
Emmanuel Grumbachdac94da2013-06-18 07:35:27 +030082#define BT_COEX_CORUN_LUT_SIZE (32)
Emmanuel Grumbachdac94da2013-06-18 07:35:27 +030083#define BT_REDUCED_TX_POWER_BIT BIT(7)
Emmanuel Grumbachfb3ceb82013-01-14 15:04:01 +020084
Emmanuel Grumbach430a3bb2014-04-02 09:55:16 +030085enum iwl_bt_coex_mode {
86 BT_COEX_DISABLE = 0x0,
87 BT_COEX_NW = 0x1,
88 BT_COEX_BT = 0x2,
89 BT_COEX_WIFI = 0x3,
90}; /* BT_COEX_MODES_E */
91
92enum iwl_bt_coex_enabled_modules {
93 BT_COEX_MPLUT_ENABLED = BIT(0),
94 BT_COEX_MPLUT_BOOST_ENABLED = BIT(1),
95 BT_COEX_SYNC2SCO_ENABLED = BIT(2),
96 BT_COEX_CORUN_ENABLED = BIT(3),
Emmanuel Grumbach261c0ec2014-06-11 15:37:25 +030097 BT_COEX_HIGH_BAND_RET = BIT(4),
Emmanuel Grumbach430a3bb2014-04-02 09:55:16 +030098}; /* BT_COEX_MODULES_ENABLE_E_VER_1 */
99
100/**
101 * struct iwl_bt_coex_cmd - bt coex configuration command
102 * @mode: enum %iwl_bt_coex_mode
103 * @enabled_modules: enum %iwl_bt_coex_enabled_modules
Emmanuel Grumbach430a3bb2014-04-02 09:55:16 +0300104 *
105 * The structure is used for the BT_COEX command.
106 */
107struct iwl_bt_coex_cmd {
108 __le32 mode;
109 __le32 enabled_modules;
Emmanuel Grumbach430a3bb2014-04-02 09:55:16 +0300110} __packed; /* BT_COEX_CMD_API_S_VER_6 */
111
112/**
113 * struct iwl_bt_coex_corun_lut_update - bt coex update the corun lut
114 * @corun_lut20: co-running 20 MHz LUT configuration
115 * @corun_lut40: co-running 40 MHz LUT configuration
116 *
117 * The structure is used for the BT_COEX_UPDATE_CORUN_LUT command.
118 */
119struct iwl_bt_coex_corun_lut_update_cmd {
120 __le32 corun_lut20[BT_COEX_CORUN_LUT_SIZE];
121 __le32 corun_lut40[BT_COEX_CORUN_LUT_SIZE];
122} __packed; /* BT_COEX_UPDATE_CORUN_LUT_API_S_VER_1 */
123
124/**
Emmanuel Grumbach430a3bb2014-04-02 09:55:16 +0300125 * struct iwl_bt_coex_reduced_txp_update_cmd
126 * @reduced_txp: bit BT_REDUCED_TX_POWER_BIT to enable / disable, rest of the
127 * bits are the sta_id (value)
128 */
129struct iwl_bt_coex_reduced_txp_update_cmd {
130 __le32 reduced_txp;
131} __packed; /* BT_COEX_UPDATE_REDUCED_TX_POWER_API_S_VER_1 */
132
Emmanuel Grumbachdac94da2013-06-18 07:35:27 +0300133/**
134 * struct iwl_bt_coex_ci_cmd - bt coex channel inhibition command
135 * @bt_primary_ci:
Emmanuel Grumbachdac94da2013-06-18 07:35:27 +0300136 * @primary_ch_phy_id:
Emmanuel Grumbach430a3bb2014-04-02 09:55:16 +0300137 * @bt_secondary_ci:
Emmanuel Grumbachdac94da2013-06-18 07:35:27 +0300138 * @secondary_ch_phy_id:
139 *
140 * Used for BT_COEX_CI command
141 */
Emmanuel Grumbach430a3bb2014-04-02 09:55:16 +0300142struct iwl_bt_coex_ci_cmd {
Emmanuel Grumbachdac94da2013-06-18 07:35:27 +0300143 __le64 bt_primary_ci;
Emmanuel Grumbach430a3bb2014-04-02 09:55:16 +0300144 __le32 primary_ch_phy_id;
Emmanuel Grumbachdac94da2013-06-18 07:35:27 +0300145
Emmanuel Grumbach430a3bb2014-04-02 09:55:16 +0300146 __le64 bt_secondary_ci;
147 __le32 secondary_ch_phy_id;
148} __packed; /* BT_CI_MSG_API_S_VER_2 */
Emmanuel Grumbachdac94da2013-06-18 07:35:27 +0300149
Emmanuel Grumbachfb3ceb82013-01-14 15:04:01 +0200150#define BT_MBOX(n_dw, _msg, _pos, _nbits) \
151 BT_MBOX##n_dw##_##_msg##_POS = (_pos), \
152 BT_MBOX##n_dw##_##_msg = BITS(_nbits) << BT_MBOX##n_dw##_##_msg##_POS
153
154enum iwl_bt_mxbox_dw0 {
155 BT_MBOX(0, LE_SLAVE_LAT, 0, 3),
156 BT_MBOX(0, LE_PROF1, 3, 1),
157 BT_MBOX(0, LE_PROF2, 4, 1),
158 BT_MBOX(0, LE_PROF_OTHER, 5, 1),
159 BT_MBOX(0, CHL_SEQ_N, 8, 4),
160 BT_MBOX(0, INBAND_S, 13, 1),
161 BT_MBOX(0, LE_MIN_RSSI, 16, 4),
162 BT_MBOX(0, LE_SCAN, 20, 1),
163 BT_MBOX(0, LE_ADV, 21, 1),
164 BT_MBOX(0, LE_MAX_TX_POWER, 24, 4),
165 BT_MBOX(0, OPEN_CON_1, 28, 2),
166};
167
168enum iwl_bt_mxbox_dw1 {
169 BT_MBOX(1, BR_MAX_TX_POWER, 0, 4),
170 BT_MBOX(1, IP_SR, 4, 1),
171 BT_MBOX(1, LE_MSTR, 5, 1),
172 BT_MBOX(1, AGGR_TRFC_LD, 8, 6),
173 BT_MBOX(1, MSG_TYPE, 16, 3),
174 BT_MBOX(1, SSN, 19, 2),
175};
176
177enum iwl_bt_mxbox_dw2 {
178 BT_MBOX(2, SNIFF_ACT, 0, 3),
179 BT_MBOX(2, PAG, 3, 1),
180 BT_MBOX(2, INQUIRY, 4, 1),
181 BT_MBOX(2, CONN, 5, 1),
182 BT_MBOX(2, SNIFF_INTERVAL, 8, 5),
183 BT_MBOX(2, DISC, 13, 1),
184 BT_MBOX(2, SCO_TX_ACT, 16, 2),
185 BT_MBOX(2, SCO_RX_ACT, 18, 2),
186 BT_MBOX(2, ESCO_RE_TX, 20, 2),
187 BT_MBOX(2, SCO_DURATION, 24, 6),
188};
189
190enum iwl_bt_mxbox_dw3 {
191 BT_MBOX(3, SCO_STATE, 0, 1),
192 BT_MBOX(3, SNIFF_STATE, 1, 1),
193 BT_MBOX(3, A2DP_STATE, 2, 1),
194 BT_MBOX(3, ACL_STATE, 3, 1),
195 BT_MBOX(3, MSTR_STATE, 4, 1),
196 BT_MBOX(3, OBX_STATE, 5, 1),
197 BT_MBOX(3, OPEN_CON_2, 8, 2),
198 BT_MBOX(3, TRAFFIC_LOAD, 10, 2),
199 BT_MBOX(3, CHL_SEQN_LSB, 12, 1),
200 BT_MBOX(3, INBAND_P, 13, 1),
201 BT_MBOX(3, MSG_TYPE_2, 16, 3),
202 BT_MBOX(3, SSN_2, 19, 2),
203 BT_MBOX(3, UPDATE_REQUEST, 21, 1),
204};
205
206#define BT_MBOX_MSG(_notif, _num, _field) \
207 ((le32_to_cpu((_notif)->mbox_msg[(_num)]) & BT_MBOX##_num##_##_field)\
208 >> BT_MBOX##_num##_##_field##_POS)
209
Emmanuel Grumbachdac94da2013-06-18 07:35:27 +0300210enum iwl_bt_activity_grading {
211 BT_OFF = 0,
212 BT_ON_NO_CONNECTION = 1,
213 BT_LOW_TRAFFIC = 2,
214 BT_HIGH_TRAFFIC = 3,
Emmanuel Grumbach1459f262014-07-06 09:34:38 +0300215
216 BT_MAX_AG,
Emmanuel Grumbache78973e2014-04-02 09:23:13 +0300217}; /* BT_COEX_BT_ACTIVITY_GRADING_API_E_VER_1 */
Emmanuel Grumbachdac94da2013-06-18 07:35:27 +0300218
Emmanuel Grumbach430a3bb2014-04-02 09:55:16 +0300219enum iwl_bt_ci_compliance {
220 BT_CI_COMPLIANCE_NONE = 0,
221 BT_CI_COMPLIANCE_PRIMARY = 1,
222 BT_CI_COMPLIANCE_SECONDARY = 2,
223 BT_CI_COMPLIANCE_BOTH = 3,
224}; /* BT_COEX_CI_COMPLIENCE_E_VER_1 */
225
Emmanuel Grumbach4c86f932014-06-30 10:26:02 +0300226#define IWL_COEX_IS_TTC_ON(_ttc_rrc_status, _phy_id) \
227 (_ttc_rrc_status & BIT(_phy_id))
228
229#define IWL_COEX_IS_RRC_ON(_ttc_rrc_status, _phy_id) \
230 ((_ttc_rrc_status >> 4) & BIT(_phy_id))
231
Emmanuel Grumbachfb3ceb82013-01-14 15:04:01 +0200232/**
233 * struct iwl_bt_coex_profile_notif - notification about BT coex
234 * @mbox_msg: message from BT to WiFi
Emmanuel Grumbachdac94da2013-06-18 07:35:27 +0300235 * @msg_idx: the index of the message
Emmanuel Grumbach430a3bb2014-04-02 09:55:16 +0300236 * @bt_ci_compliance: enum %iwl_bt_ci_compliance
237 * @primary_ch_lut: LUT used for primary channel enum %iwl_bt_coex_lut_type
238 * @secondary_ch_lut: LUT used for secondary channel enume %iwl_bt_coex_lut_type
Emmanuel Grumbachdac94da2013-06-18 07:35:27 +0300239 * @bt_activity_grading: the activity of BT enum %iwl_bt_activity_grading
Emmanuel Grumbach430a3bb2014-04-02 09:55:16 +0300240 * @ttc_rrc_status: is TTC or RRC enabled - one bit per PHY
Emmanuel Grumbachfb3ceb82013-01-14 15:04:01 +0200241 */
Emmanuel Grumbach430a3bb2014-04-02 09:55:16 +0300242struct iwl_bt_coex_profile_notif {
Emmanuel Grumbachfb3ceb82013-01-14 15:04:01 +0200243 __le32 mbox_msg[4];
Emmanuel Grumbachdac94da2013-06-18 07:35:27 +0300244 __le32 msg_idx;
Emmanuel Grumbach430a3bb2014-04-02 09:55:16 +0300245 __le32 bt_ci_compliance;
Emmanuel Grumbachdac94da2013-06-18 07:35:27 +0300246
247 __le32 primary_ch_lut;
248 __le32 secondary_ch_lut;
249 __le32 bt_activity_grading;
Emmanuel Grumbach430a3bb2014-04-02 09:55:16 +0300250 u8 ttc_rrc_status;
251 u8 reserved[3];
252} __packed; /* BT_COEX_PROFILE_NTFY_API_S_VER_4 */
Emmanuel Grumbachfb3ceb82013-01-14 15:04:01 +0200253
Emmanuel Grumbachfb3ceb82013-01-14 15:04:01 +0200254#endif /* __fw_api_bt_coex_h__ */