Emmanuel Grumbach | fb3ceb8 | 2013-01-14 15:04:01 +0200 | [diff] [blame] | 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 | * |
Emmanuel Grumbach | 51368bf | 2013-12-30 13:15:54 +0200 | [diff] [blame] | 8 | * Copyright(c) 2013 - 2014 Intel Corporation. All rights reserved. |
Johannes Berg | 8b4139d | 2014-07-24 14:05:26 +0200 | [diff] [blame] | 9 | * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH |
Johannes Berg | acf91dd | 2017-05-16 16:15:42 +0200 | [diff] [blame] | 10 | * Copyright(c) 2017 Intel Deutschland GmbH |
Emmanuel Grumbach | fb3ceb8 | 2013-01-14 15:04:01 +0200 | [diff] [blame] | 11 | * |
| 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. |
| 15 | * |
| 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. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, |
| 24 | * USA |
| 25 | * |
| 26 | * The full GNU General Public License is included in this distribution |
| 27 | * in the file called COPYING. |
| 28 | * |
| 29 | * Contact Information: |
Emmanuel Grumbach | cb2f827 | 2015-11-17 15:39:56 +0200 | [diff] [blame] | 30 | * Intel Linux Wireless <linuxwifi@intel.com> |
Emmanuel Grumbach | fb3ceb8 | 2013-01-14 15:04:01 +0200 | [diff] [blame] | 31 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
| 32 | * |
| 33 | * BSD LICENSE |
| 34 | * |
Emmanuel Grumbach | 51368bf | 2013-12-30 13:15:54 +0200 | [diff] [blame] | 35 | * Copyright(c) 2013 - 2014 Intel Corporation. All rights reserved. |
Johannes Berg | 8b4139d | 2014-07-24 14:05:26 +0200 | [diff] [blame] | 36 | * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH |
Johannes Berg | acf91dd | 2017-05-16 16:15:42 +0200 | [diff] [blame] | 37 | * Copyright(c) 2017 Intel Deutschland GmbH |
Emmanuel Grumbach | fb3ceb8 | 2013-01-14 15:04:01 +0200 | [diff] [blame] | 38 | * All rights reserved. |
| 39 | * |
| 40 | * Redistribution and use in source and binary forms, with or without |
| 41 | * modification, are permitted provided that the following conditions |
| 42 | * are met: |
| 43 | * |
| 44 | * * Redistributions of source code must retain the above copyright |
| 45 | * notice, this list of conditions and the following disclaimer. |
| 46 | * * Redistributions in binary form must reproduce the above copyright |
| 47 | * notice, this list of conditions and the following disclaimer in |
| 48 | * the documentation and/or other materials provided with the |
| 49 | * distribution. |
| 50 | * * Neither the name Intel Corporation nor the names of its |
| 51 | * contributors may be used to endorse or promote products derived |
| 52 | * from this software without specific prior written permission. |
| 53 | * |
| 54 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 55 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 56 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 57 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 58 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 59 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 60 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 61 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 62 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 63 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 64 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 65 | *****************************************************************************/ |
| 66 | |
| 67 | #ifndef __fw_api_bt_coex_h__ |
| 68 | #define __fw_api_bt_coex_h__ |
| 69 | |
| 70 | #include <linux/types.h> |
| 71 | #include <linux/bitops.h> |
| 72 | |
| 73 | #define BITS(nb) (BIT(nb) - 1) |
| 74 | |
Emmanuel Grumbach | dac94da | 2013-06-18 07:35:27 +0300 | [diff] [blame] | 75 | enum iwl_bt_coex_lut_type { |
| 76 | BT_COEX_TIGHT_LUT = 0, |
| 77 | BT_COEX_LOOSE_LUT, |
| 78 | BT_COEX_TX_DIS_LUT, |
| 79 | |
| 80 | BT_COEX_MAX_LUT, |
Emmanuel Grumbach | e78973e | 2014-04-02 09:23:13 +0300 | [diff] [blame] | 81 | BT_COEX_INVALID_LUT = 0xff, |
| 82 | }; /* BT_COEX_DECISION_LUT_INDEX_API_E_VER_1 */ |
Emmanuel Grumbach | dac94da | 2013-06-18 07:35:27 +0300 | [diff] [blame] | 83 | |
Emmanuel Grumbach | dac94da | 2013-06-18 07:35:27 +0300 | [diff] [blame] | 84 | #define BT_COEX_CORUN_LUT_SIZE (32) |
Emmanuel Grumbach | dac94da | 2013-06-18 07:35:27 +0300 | [diff] [blame] | 85 | #define BT_REDUCED_TX_POWER_BIT BIT(7) |
Emmanuel Grumbach | fb3ceb8 | 2013-01-14 15:04:01 +0200 | [diff] [blame] | 86 | |
Emmanuel Grumbach | 430a3bb | 2014-04-02 09:55:16 +0300 | [diff] [blame] | 87 | enum iwl_bt_coex_mode { |
| 88 | BT_COEX_DISABLE = 0x0, |
| 89 | BT_COEX_NW = 0x1, |
| 90 | BT_COEX_BT = 0x2, |
| 91 | BT_COEX_WIFI = 0x3, |
| 92 | }; /* BT_COEX_MODES_E */ |
| 93 | |
| 94 | enum iwl_bt_coex_enabled_modules { |
| 95 | BT_COEX_MPLUT_ENABLED = BIT(0), |
| 96 | BT_COEX_MPLUT_BOOST_ENABLED = BIT(1), |
| 97 | BT_COEX_SYNC2SCO_ENABLED = BIT(2), |
| 98 | BT_COEX_CORUN_ENABLED = BIT(3), |
Emmanuel Grumbach | 261c0ec | 2014-06-11 15:37:25 +0300 | [diff] [blame] | 99 | BT_COEX_HIGH_BAND_RET = BIT(4), |
Emmanuel Grumbach | 430a3bb | 2014-04-02 09:55:16 +0300 | [diff] [blame] | 100 | }; /* BT_COEX_MODULES_ENABLE_E_VER_1 */ |
| 101 | |
| 102 | /** |
| 103 | * struct iwl_bt_coex_cmd - bt coex configuration command |
Johannes Berg | 6762586 | 2017-03-14 11:01:27 +0100 | [diff] [blame] | 104 | * @mode: &enum iwl_bt_coex_mode |
| 105 | * @enabled_modules: &enum iwl_bt_coex_enabled_modules |
Emmanuel Grumbach | 430a3bb | 2014-04-02 09:55:16 +0300 | [diff] [blame] | 106 | * |
| 107 | * The structure is used for the BT_COEX command. |
| 108 | */ |
| 109 | struct iwl_bt_coex_cmd { |
| 110 | __le32 mode; |
| 111 | __le32 enabled_modules; |
Emmanuel Grumbach | 430a3bb | 2014-04-02 09:55:16 +0300 | [diff] [blame] | 112 | } __packed; /* BT_COEX_CMD_API_S_VER_6 */ |
| 113 | |
| 114 | /** |
| 115 | * struct iwl_bt_coex_corun_lut_update - bt coex update the corun lut |
| 116 | * @corun_lut20: co-running 20 MHz LUT configuration |
| 117 | * @corun_lut40: co-running 40 MHz LUT configuration |
| 118 | * |
| 119 | * The structure is used for the BT_COEX_UPDATE_CORUN_LUT command. |
| 120 | */ |
| 121 | struct iwl_bt_coex_corun_lut_update_cmd { |
| 122 | __le32 corun_lut20[BT_COEX_CORUN_LUT_SIZE]; |
| 123 | __le32 corun_lut40[BT_COEX_CORUN_LUT_SIZE]; |
| 124 | } __packed; /* BT_COEX_UPDATE_CORUN_LUT_API_S_VER_1 */ |
| 125 | |
| 126 | /** |
Emmanuel Grumbach | 430a3bb | 2014-04-02 09:55:16 +0300 | [diff] [blame] | 127 | * struct iwl_bt_coex_reduced_txp_update_cmd |
| 128 | * @reduced_txp: bit BT_REDUCED_TX_POWER_BIT to enable / disable, rest of the |
| 129 | * bits are the sta_id (value) |
| 130 | */ |
| 131 | struct iwl_bt_coex_reduced_txp_update_cmd { |
| 132 | __le32 reduced_txp; |
| 133 | } __packed; /* BT_COEX_UPDATE_REDUCED_TX_POWER_API_S_VER_1 */ |
| 134 | |
Emmanuel Grumbach | dac94da | 2013-06-18 07:35:27 +0300 | [diff] [blame] | 135 | /** |
| 136 | * struct iwl_bt_coex_ci_cmd - bt coex channel inhibition command |
Johannes Berg | acf91dd | 2017-05-16 16:15:42 +0200 | [diff] [blame] | 137 | * @bt_primary_ci: primary channel inhibition bitmap |
| 138 | * @primary_ch_phy_id: primary channel PHY ID |
| 139 | * @bt_secondary_ci: secondary channel inhibition bitmap |
| 140 | * @secondary_ch_phy_id: secondary channel PHY ID |
Emmanuel Grumbach | dac94da | 2013-06-18 07:35:27 +0300 | [diff] [blame] | 141 | * |
| 142 | * Used for BT_COEX_CI command |
| 143 | */ |
Emmanuel Grumbach | 430a3bb | 2014-04-02 09:55:16 +0300 | [diff] [blame] | 144 | struct iwl_bt_coex_ci_cmd { |
Emmanuel Grumbach | dac94da | 2013-06-18 07:35:27 +0300 | [diff] [blame] | 145 | __le64 bt_primary_ci; |
Emmanuel Grumbach | 430a3bb | 2014-04-02 09:55:16 +0300 | [diff] [blame] | 146 | __le32 primary_ch_phy_id; |
Emmanuel Grumbach | dac94da | 2013-06-18 07:35:27 +0300 | [diff] [blame] | 147 | |
Emmanuel Grumbach | 430a3bb | 2014-04-02 09:55:16 +0300 | [diff] [blame] | 148 | __le64 bt_secondary_ci; |
| 149 | __le32 secondary_ch_phy_id; |
| 150 | } __packed; /* BT_CI_MSG_API_S_VER_2 */ |
Emmanuel Grumbach | dac94da | 2013-06-18 07:35:27 +0300 | [diff] [blame] | 151 | |
Emmanuel Grumbach | fb3ceb8 | 2013-01-14 15:04:01 +0200 | [diff] [blame] | 152 | #define BT_MBOX(n_dw, _msg, _pos, _nbits) \ |
| 153 | BT_MBOX##n_dw##_##_msg##_POS = (_pos), \ |
| 154 | BT_MBOX##n_dw##_##_msg = BITS(_nbits) << BT_MBOX##n_dw##_##_msg##_POS |
| 155 | |
| 156 | enum iwl_bt_mxbox_dw0 { |
| 157 | BT_MBOX(0, LE_SLAVE_LAT, 0, 3), |
| 158 | BT_MBOX(0, LE_PROF1, 3, 1), |
| 159 | BT_MBOX(0, LE_PROF2, 4, 1), |
| 160 | BT_MBOX(0, LE_PROF_OTHER, 5, 1), |
| 161 | BT_MBOX(0, CHL_SEQ_N, 8, 4), |
| 162 | BT_MBOX(0, INBAND_S, 13, 1), |
| 163 | BT_MBOX(0, LE_MIN_RSSI, 16, 4), |
| 164 | BT_MBOX(0, LE_SCAN, 20, 1), |
| 165 | BT_MBOX(0, LE_ADV, 21, 1), |
| 166 | BT_MBOX(0, LE_MAX_TX_POWER, 24, 4), |
| 167 | BT_MBOX(0, OPEN_CON_1, 28, 2), |
| 168 | }; |
| 169 | |
| 170 | enum iwl_bt_mxbox_dw1 { |
| 171 | BT_MBOX(1, BR_MAX_TX_POWER, 0, 4), |
| 172 | BT_MBOX(1, IP_SR, 4, 1), |
| 173 | BT_MBOX(1, LE_MSTR, 5, 1), |
| 174 | BT_MBOX(1, AGGR_TRFC_LD, 8, 6), |
| 175 | BT_MBOX(1, MSG_TYPE, 16, 3), |
| 176 | BT_MBOX(1, SSN, 19, 2), |
| 177 | }; |
| 178 | |
| 179 | enum iwl_bt_mxbox_dw2 { |
| 180 | BT_MBOX(2, SNIFF_ACT, 0, 3), |
| 181 | BT_MBOX(2, PAG, 3, 1), |
| 182 | BT_MBOX(2, INQUIRY, 4, 1), |
| 183 | BT_MBOX(2, CONN, 5, 1), |
| 184 | BT_MBOX(2, SNIFF_INTERVAL, 8, 5), |
| 185 | BT_MBOX(2, DISC, 13, 1), |
| 186 | BT_MBOX(2, SCO_TX_ACT, 16, 2), |
| 187 | BT_MBOX(2, SCO_RX_ACT, 18, 2), |
| 188 | BT_MBOX(2, ESCO_RE_TX, 20, 2), |
| 189 | BT_MBOX(2, SCO_DURATION, 24, 6), |
| 190 | }; |
| 191 | |
| 192 | enum iwl_bt_mxbox_dw3 { |
| 193 | BT_MBOX(3, SCO_STATE, 0, 1), |
| 194 | BT_MBOX(3, SNIFF_STATE, 1, 1), |
| 195 | BT_MBOX(3, A2DP_STATE, 2, 1), |
| 196 | BT_MBOX(3, ACL_STATE, 3, 1), |
| 197 | BT_MBOX(3, MSTR_STATE, 4, 1), |
| 198 | BT_MBOX(3, OBX_STATE, 5, 1), |
| 199 | BT_MBOX(3, OPEN_CON_2, 8, 2), |
| 200 | BT_MBOX(3, TRAFFIC_LOAD, 10, 2), |
| 201 | BT_MBOX(3, CHL_SEQN_LSB, 12, 1), |
| 202 | BT_MBOX(3, INBAND_P, 13, 1), |
| 203 | BT_MBOX(3, MSG_TYPE_2, 16, 3), |
| 204 | BT_MBOX(3, SSN_2, 19, 2), |
| 205 | BT_MBOX(3, UPDATE_REQUEST, 21, 1), |
| 206 | }; |
| 207 | |
| 208 | #define BT_MBOX_MSG(_notif, _num, _field) \ |
| 209 | ((le32_to_cpu((_notif)->mbox_msg[(_num)]) & BT_MBOX##_num##_##_field)\ |
| 210 | >> BT_MBOX##_num##_##_field##_POS) |
| 211 | |
Emmanuel Grumbach | dac94da | 2013-06-18 07:35:27 +0300 | [diff] [blame] | 212 | enum iwl_bt_activity_grading { |
| 213 | BT_OFF = 0, |
| 214 | BT_ON_NO_CONNECTION = 1, |
| 215 | BT_LOW_TRAFFIC = 2, |
| 216 | BT_HIGH_TRAFFIC = 3, |
Emmanuel Grumbach | 1459f26 | 2014-07-06 09:34:38 +0300 | [diff] [blame] | 217 | |
| 218 | BT_MAX_AG, |
Emmanuel Grumbach | e78973e | 2014-04-02 09:23:13 +0300 | [diff] [blame] | 219 | }; /* BT_COEX_BT_ACTIVITY_GRADING_API_E_VER_1 */ |
Emmanuel Grumbach | dac94da | 2013-06-18 07:35:27 +0300 | [diff] [blame] | 220 | |
Emmanuel Grumbach | 430a3bb | 2014-04-02 09:55:16 +0300 | [diff] [blame] | 221 | enum iwl_bt_ci_compliance { |
| 222 | BT_CI_COMPLIANCE_NONE = 0, |
| 223 | BT_CI_COMPLIANCE_PRIMARY = 1, |
| 224 | BT_CI_COMPLIANCE_SECONDARY = 2, |
| 225 | BT_CI_COMPLIANCE_BOTH = 3, |
| 226 | }; /* BT_COEX_CI_COMPLIENCE_E_VER_1 */ |
| 227 | |
Emmanuel Grumbach | 4c86f93 | 2014-06-30 10:26:02 +0300 | [diff] [blame] | 228 | #define IWL_COEX_IS_TTC_ON(_ttc_rrc_status, _phy_id) \ |
| 229 | (_ttc_rrc_status & BIT(_phy_id)) |
| 230 | |
| 231 | #define IWL_COEX_IS_RRC_ON(_ttc_rrc_status, _phy_id) \ |
| 232 | ((_ttc_rrc_status >> 4) & BIT(_phy_id)) |
| 233 | |
Emmanuel Grumbach | fb3ceb8 | 2013-01-14 15:04:01 +0200 | [diff] [blame] | 234 | /** |
| 235 | * struct iwl_bt_coex_profile_notif - notification about BT coex |
| 236 | * @mbox_msg: message from BT to WiFi |
Emmanuel Grumbach | dac94da | 2013-06-18 07:35:27 +0300 | [diff] [blame] | 237 | * @msg_idx: the index of the message |
Emmanuel Grumbach | 430a3bb | 2014-04-02 09:55:16 +0300 | [diff] [blame] | 238 | * @bt_ci_compliance: enum %iwl_bt_ci_compliance |
Johannes Berg | 6762586 | 2017-03-14 11:01:27 +0100 | [diff] [blame] | 239 | * @primary_ch_lut: LUT used for primary channel &enum iwl_bt_coex_lut_type |
| 240 | * @secondary_ch_lut: LUT used for secondary channel &enum iwl_bt_coex_lut_type |
| 241 | * @bt_activity_grading: the activity of BT &enum iwl_bt_activity_grading |
Emmanuel Grumbach | 430a3bb | 2014-04-02 09:55:16 +0300 | [diff] [blame] | 242 | * @ttc_rrc_status: is TTC or RRC enabled - one bit per PHY |
Johannes Berg | acf91dd | 2017-05-16 16:15:42 +0200 | [diff] [blame] | 243 | * @reserved: reserved |
Emmanuel Grumbach | fb3ceb8 | 2013-01-14 15:04:01 +0200 | [diff] [blame] | 244 | */ |
Emmanuel Grumbach | 430a3bb | 2014-04-02 09:55:16 +0300 | [diff] [blame] | 245 | struct iwl_bt_coex_profile_notif { |
Emmanuel Grumbach | fb3ceb8 | 2013-01-14 15:04:01 +0200 | [diff] [blame] | 246 | __le32 mbox_msg[4]; |
Emmanuel Grumbach | dac94da | 2013-06-18 07:35:27 +0300 | [diff] [blame] | 247 | __le32 msg_idx; |
Emmanuel Grumbach | 430a3bb | 2014-04-02 09:55:16 +0300 | [diff] [blame] | 248 | __le32 bt_ci_compliance; |
Emmanuel Grumbach | dac94da | 2013-06-18 07:35:27 +0300 | [diff] [blame] | 249 | |
| 250 | __le32 primary_ch_lut; |
| 251 | __le32 secondary_ch_lut; |
| 252 | __le32 bt_activity_grading; |
Emmanuel Grumbach | 430a3bb | 2014-04-02 09:55:16 +0300 | [diff] [blame] | 253 | u8 ttc_rrc_status; |
| 254 | u8 reserved[3]; |
| 255 | } __packed; /* BT_COEX_PROFILE_NTFY_API_S_VER_4 */ |
Emmanuel Grumbach | fb3ceb8 | 2013-01-14 15:04:01 +0200 | [diff] [blame] | 256 | |
Emmanuel Grumbach | fb3ceb8 | 2013-01-14 15:04:01 +0200 | [diff] [blame] | 257 | #endif /* __fw_api_bt_coex_h__ */ |