Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / drivers / net / wireless / intel / iwlwifi / fw / api / coex.h
blob87c1ddea75aef33544114018269bee97185fe9c4
1 /******************************************************************************
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.
6 * GPL LICENSE SUMMARY
8 * Copyright(c) 2013 - 2014 Intel Corporation. All rights reserved.
9 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
10 * Copyright(c) 2017 Intel Deutschland GmbH
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of version 2 of the GNU General Public License as
14 * published by the Free Software Foundation.
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
21 * The full GNU General Public License is included in this distribution
22 * in the file called COPYING.
24 * Contact Information:
25 * Intel Linux Wireless <linuxwifi@intel.com>
26 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
28 * BSD LICENSE
30 * Copyright(c) 2013 - 2014 Intel Corporation. All rights reserved.
31 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
32 * Copyright(c) 2017 Intel Deutschland GmbH
33 * All rights reserved.
35 * Redistribution and use in source and binary forms, with or without
36 * modification, are permitted provided that the following conditions
37 * are met:
39 * * Redistributions of source code must retain the above copyright
40 * notice, this list of conditions and the following disclaimer.
41 * * Redistributions in binary form must reproduce the above copyright
42 * notice, this list of conditions and the following disclaimer in
43 * the documentation and/or other materials provided with the
44 * distribution.
45 * * Neither the name Intel Corporation nor the names of its
46 * contributors may be used to endorse or promote products derived
47 * from this software without specific prior written permission.
49 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
50 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
51 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
52 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
53 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
54 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
55 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
56 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
57 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
58 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
59 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
60 *****************************************************************************/
62 #ifndef __iwl_fw_api_coex_h__
63 #define __iwl_fw_api_coex_h__
65 #include <linux/types.h>
66 #include <linux/bitops.h>
68 #define BITS(nb) (BIT(nb) - 1)
70 enum iwl_bt_coex_lut_type {
71 BT_COEX_TIGHT_LUT = 0,
72 BT_COEX_LOOSE_LUT,
73 BT_COEX_TX_DIS_LUT,
75 BT_COEX_MAX_LUT,
76 BT_COEX_INVALID_LUT = 0xff,
77 }; /* BT_COEX_DECISION_LUT_INDEX_API_E_VER_1 */
79 #define BT_REDUCED_TX_POWER_BIT BIT(7)
81 enum iwl_bt_coex_mode {
82 BT_COEX_DISABLE = 0x0,
83 BT_COEX_NW = 0x1,
84 BT_COEX_BT = 0x2,
85 BT_COEX_WIFI = 0x3,
86 }; /* BT_COEX_MODES_E */
88 enum iwl_bt_coex_enabled_modules {
89 BT_COEX_MPLUT_ENABLED = BIT(0),
90 BT_COEX_MPLUT_BOOST_ENABLED = BIT(1),
91 BT_COEX_SYNC2SCO_ENABLED = BIT(2),
92 BT_COEX_CORUN_ENABLED = BIT(3),
93 BT_COEX_HIGH_BAND_RET = BIT(4),
94 }; /* BT_COEX_MODULES_ENABLE_E_VER_1 */
96 /**
97 * struct iwl_bt_coex_cmd - bt coex configuration command
98 * @mode: &enum iwl_bt_coex_mode
99 * @enabled_modules: &enum iwl_bt_coex_enabled_modules
101 * The structure is used for the BT_COEX command.
103 struct iwl_bt_coex_cmd {
104 __le32 mode;
105 __le32 enabled_modules;
106 } __packed; /* BT_COEX_CMD_API_S_VER_6 */
109 * struct iwl_bt_coex_reduced_txp_update_cmd
110 * @reduced_txp: bit BT_REDUCED_TX_POWER_BIT to enable / disable, rest of the
111 * bits are the sta_id (value)
113 struct iwl_bt_coex_reduced_txp_update_cmd {
114 __le32 reduced_txp;
115 } __packed; /* BT_COEX_UPDATE_REDUCED_TX_POWER_API_S_VER_1 */
118 * struct iwl_bt_coex_ci_cmd - bt coex channel inhibition command
119 * @bt_primary_ci: primary channel inhibition bitmap
120 * @primary_ch_phy_id: primary channel PHY ID
121 * @bt_secondary_ci: secondary channel inhibition bitmap
122 * @secondary_ch_phy_id: secondary channel PHY ID
124 * Used for BT_COEX_CI command
126 struct iwl_bt_coex_ci_cmd {
127 __le64 bt_primary_ci;
128 __le32 primary_ch_phy_id;
130 __le64 bt_secondary_ci;
131 __le32 secondary_ch_phy_id;
132 } __packed; /* BT_CI_MSG_API_S_VER_2 */
134 #define BT_MBOX(n_dw, _msg, _pos, _nbits) \
135 BT_MBOX##n_dw##_##_msg##_POS = (_pos), \
136 BT_MBOX##n_dw##_##_msg = BITS(_nbits) << BT_MBOX##n_dw##_##_msg##_POS
138 enum iwl_bt_mxbox_dw0 {
139 BT_MBOX(0, LE_SLAVE_LAT, 0, 3),
140 BT_MBOX(0, LE_PROF1, 3, 1),
141 BT_MBOX(0, LE_PROF2, 4, 1),
142 BT_MBOX(0, LE_PROF_OTHER, 5, 1),
143 BT_MBOX(0, CHL_SEQ_N, 8, 4),
144 BT_MBOX(0, INBAND_S, 13, 1),
145 BT_MBOX(0, LE_MIN_RSSI, 16, 4),
146 BT_MBOX(0, LE_SCAN, 20, 1),
147 BT_MBOX(0, LE_ADV, 21, 1),
148 BT_MBOX(0, LE_MAX_TX_POWER, 24, 4),
149 BT_MBOX(0, OPEN_CON_1, 28, 2),
152 enum iwl_bt_mxbox_dw1 {
153 BT_MBOX(1, BR_MAX_TX_POWER, 0, 4),
154 BT_MBOX(1, IP_SR, 4, 1),
155 BT_MBOX(1, LE_MSTR, 5, 1),
156 BT_MBOX(1, AGGR_TRFC_LD, 8, 6),
157 BT_MBOX(1, MSG_TYPE, 16, 3),
158 BT_MBOX(1, SSN, 19, 2),
161 enum iwl_bt_mxbox_dw2 {
162 BT_MBOX(2, SNIFF_ACT, 0, 3),
163 BT_MBOX(2, PAG, 3, 1),
164 BT_MBOX(2, INQUIRY, 4, 1),
165 BT_MBOX(2, CONN, 5, 1),
166 BT_MBOX(2, SNIFF_INTERVAL, 8, 5),
167 BT_MBOX(2, DISC, 13, 1),
168 BT_MBOX(2, SCO_TX_ACT, 16, 2),
169 BT_MBOX(2, SCO_RX_ACT, 18, 2),
170 BT_MBOX(2, ESCO_RE_TX, 20, 2),
171 BT_MBOX(2, SCO_DURATION, 24, 6),
174 enum iwl_bt_mxbox_dw3 {
175 BT_MBOX(3, SCO_STATE, 0, 1),
176 BT_MBOX(3, SNIFF_STATE, 1, 1),
177 BT_MBOX(3, A2DP_STATE, 2, 1),
178 BT_MBOX(3, ACL_STATE, 3, 1),
179 BT_MBOX(3, MSTR_STATE, 4, 1),
180 BT_MBOX(3, OBX_STATE, 5, 1),
181 BT_MBOX(3, A2DP_SRC, 6, 1),
182 BT_MBOX(3, OPEN_CON_2, 8, 2),
183 BT_MBOX(3, TRAFFIC_LOAD, 10, 2),
184 BT_MBOX(3, CHL_SEQN_LSB, 12, 1),
185 BT_MBOX(3, INBAND_P, 13, 1),
186 BT_MBOX(3, MSG_TYPE_2, 16, 3),
187 BT_MBOX(3, SSN_2, 19, 2),
188 BT_MBOX(3, UPDATE_REQUEST, 21, 1),
191 #define BT_MBOX_MSG(_notif, _num, _field) \
192 ((le32_to_cpu((_notif)->mbox_msg[(_num)]) & BT_MBOX##_num##_##_field)\
193 >> BT_MBOX##_num##_##_field##_POS)
195 #define BT_MBOX_PRINT(_num, _field, _end) \
196 pos += scnprintf(buf + pos, bufsz - pos, \
197 "\t%s: %d%s", \
198 #_field, \
199 BT_MBOX_MSG(notif, _num, _field), \
200 true ? "\n" : ", ");
201 enum iwl_bt_activity_grading {
202 BT_OFF = 0,
203 BT_ON_NO_CONNECTION = 1,
204 BT_LOW_TRAFFIC = 2,
205 BT_HIGH_TRAFFIC = 3,
207 BT_MAX_AG,
208 }; /* BT_COEX_BT_ACTIVITY_GRADING_API_E_VER_1 */
210 enum iwl_bt_ci_compliance {
211 BT_CI_COMPLIANCE_NONE = 0,
212 BT_CI_COMPLIANCE_PRIMARY = 1,
213 BT_CI_COMPLIANCE_SECONDARY = 2,
214 BT_CI_COMPLIANCE_BOTH = 3,
215 }; /* BT_COEX_CI_COMPLIENCE_E_VER_1 */
218 * struct iwl_bt_coex_profile_notif - notification about BT coex
219 * @mbox_msg: message from BT to WiFi
220 * @msg_idx: the index of the message
221 * @bt_ci_compliance: enum %iwl_bt_ci_compliance
222 * @primary_ch_lut: LUT used for primary channel &enum iwl_bt_coex_lut_type
223 * @secondary_ch_lut: LUT used for secondary channel &enum iwl_bt_coex_lut_type
224 * @bt_activity_grading: the activity of BT &enum iwl_bt_activity_grading
225 * @ttc_status: is TTC enabled - one bit per PHY
226 * @rrc_status: is RRC enabled - one bit per PHY
227 * @reserved: reserved
229 struct iwl_bt_coex_profile_notif {
230 __le32 mbox_msg[4];
231 __le32 msg_idx;
232 __le32 bt_ci_compliance;
234 __le32 primary_ch_lut;
235 __le32 secondary_ch_lut;
236 __le32 bt_activity_grading;
237 u8 ttc_status;
238 u8 rrc_status;
239 __le16 reserved;
240 } __packed; /* BT_COEX_PROFILE_NTFY_API_S_VER_4 */
242 #endif /* __iwl_fw_api_coex_h__ */