1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ 2 /* 3 * Copyright (C) 2013-2014, 2018-2019 Intel Corporation 4 * Copyright (C) 2013-2014 Intel Mobile Communications GmbH 5 * Copyright (C) 2017 Intel Deutschland GmbH 6 */ 7 #ifndef __iwl_fw_api_coex_h__ 8 #define __iwl_fw_api_coex_h__ 9 10 #include <linux/types.h> 11 #include <linux/bitops.h> 12 13 #define BITS(nb) (BIT(nb) - 1) 14 15 enum iwl_bt_coex_lut_type { 16 BT_COEX_TIGHT_LUT = 0, 17 BT_COEX_LOOSE_LUT, 18 BT_COEX_TX_DIS_LUT, 19 20 BT_COEX_MAX_LUT, 21 BT_COEX_INVALID_LUT = 0xff, 22 }; /* BT_COEX_DECISION_LUT_INDEX_API_E_VER_1 */ 23 24 #define BT_REDUCED_TX_POWER_BIT BIT(7) 25 26 enum iwl_bt_coex_mode { 27 BT_COEX_DISABLE = 0x0, 28 BT_COEX_NW = 0x1, 29 BT_COEX_BT = 0x2, 30 BT_COEX_WIFI = 0x3, 31 }; /* BT_COEX_MODES_E */ 32 33 enum iwl_bt_coex_enabled_modules { 34 BT_COEX_MPLUT_ENABLED = BIT(0), 35 BT_COEX_MPLUT_BOOST_ENABLED = BIT(1), 36 BT_COEX_SYNC2SCO_ENABLED = BIT(2), 37 BT_COEX_CORUN_ENABLED = BIT(3), 38 BT_COEX_HIGH_BAND_RET = BIT(4), 39 }; /* BT_COEX_MODULES_ENABLE_E_VER_1 */ 40 41 /** 42 * struct iwl_bt_coex_cmd - bt coex configuration command 43 * @mode: &enum iwl_bt_coex_mode 44 * @enabled_modules: &enum iwl_bt_coex_enabled_modules 45 * 46 * The structure is used for the BT_COEX command. 47 */ 48 struct iwl_bt_coex_cmd { 49 __le32 mode; 50 __le32 enabled_modules; 51 } __packed; /* BT_COEX_CMD_API_S_VER_6 */ 52 53 /** 54 * struct iwl_bt_coex_reduced_txp_update_cmd 55 * @reduced_txp: bit BT_REDUCED_TX_POWER_BIT to enable / disable, rest of the 56 * bits are the sta_id (value) 57 */ 58 struct iwl_bt_coex_reduced_txp_update_cmd { 59 __le32 reduced_txp; 60 } __packed; /* BT_COEX_UPDATE_REDUCED_TX_POWER_API_S_VER_1 */ 61 62 /** 63 * struct iwl_bt_coex_ci_cmd - bt coex channel inhibition command 64 * @bt_primary_ci: primary channel inhibition bitmap 65 * @primary_ch_phy_id: primary channel PHY ID 66 * @bt_secondary_ci: secondary channel inhibition bitmap 67 * @secondary_ch_phy_id: secondary channel PHY ID 68 * 69 * Used for BT_COEX_CI command 70 */ 71 struct iwl_bt_coex_ci_cmd { 72 __le64 bt_primary_ci; 73 __le32 primary_ch_phy_id; 74 75 __le64 bt_secondary_ci; 76 __le32 secondary_ch_phy_id; 77 } __packed; /* BT_CI_MSG_API_S_VER_2 */ 78 79 #define BT_MBOX(n_dw, _msg, _pos, _nbits) \ 80 BT_MBOX##n_dw##_##_msg##_POS = (_pos), \ 81 BT_MBOX##n_dw##_##_msg = BITS(_nbits) << BT_MBOX##n_dw##_##_msg##_POS 82 83 enum iwl_bt_mxbox_dw0 { 84 BT_MBOX(0, LE_SLAVE_LAT, 0, 3), 85 BT_MBOX(0, LE_PROF1, 3, 1), 86 BT_MBOX(0, LE_PROF2, 4, 1), 87 BT_MBOX(0, LE_PROF_OTHER, 5, 1), 88 BT_MBOX(0, CHL_SEQ_N, 8, 4), 89 BT_MBOX(0, INBAND_S, 13, 1), 90 BT_MBOX(0, LE_MIN_RSSI, 16, 4), 91 BT_MBOX(0, LE_SCAN, 20, 1), 92 BT_MBOX(0, LE_ADV, 21, 1), 93 BT_MBOX(0, LE_MAX_TX_POWER, 24, 4), 94 BT_MBOX(0, OPEN_CON_1, 28, 2), 95 }; 96 97 enum iwl_bt_mxbox_dw1 { 98 BT_MBOX(1, BR_MAX_TX_POWER, 0, 4), 99 BT_MBOX(1, IP_SR, 4, 1), 100 BT_MBOX(1, LE_MSTR, 5, 1), 101 BT_MBOX(1, AGGR_TRFC_LD, 8, 6), 102 BT_MBOX(1, MSG_TYPE, 16, 3), 103 BT_MBOX(1, SSN, 19, 2), 104 }; 105 106 enum iwl_bt_mxbox_dw2 { 107 BT_MBOX(2, SNIFF_ACT, 0, 3), 108 BT_MBOX(2, PAG, 3, 1), 109 BT_MBOX(2, INQUIRY, 4, 1), 110 BT_MBOX(2, CONN, 5, 1), 111 BT_MBOX(2, SNIFF_INTERVAL, 8, 5), 112 BT_MBOX(2, DISC, 13, 1), 113 BT_MBOX(2, SCO_TX_ACT, 16, 2), 114 BT_MBOX(2, SCO_RX_ACT, 18, 2), 115 BT_MBOX(2, ESCO_RE_TX, 20, 2), 116 BT_MBOX(2, SCO_DURATION, 24, 6), 117 }; 118 119 enum iwl_bt_mxbox_dw3 { 120 BT_MBOX(3, SCO_STATE, 0, 1), 121 BT_MBOX(3, SNIFF_STATE, 1, 1), 122 BT_MBOX(3, A2DP_STATE, 2, 1), 123 BT_MBOX(3, ACL_STATE, 3, 1), 124 BT_MBOX(3, MSTR_STATE, 4, 1), 125 BT_MBOX(3, OBX_STATE, 5, 1), 126 BT_MBOX(3, A2DP_SRC, 6, 1), 127 BT_MBOX(3, OPEN_CON_2, 8, 2), 128 BT_MBOX(3, TRAFFIC_LOAD, 10, 2), 129 BT_MBOX(3, CHL_SEQN_LSB, 12, 1), 130 BT_MBOX(3, INBAND_P, 13, 1), 131 BT_MBOX(3, MSG_TYPE_2, 16, 3), 132 BT_MBOX(3, SSN_2, 19, 2), 133 BT_MBOX(3, UPDATE_REQUEST, 21, 1), 134 }; 135 136 #define BT_MBOX_MSG(_notif, _num, _field) \ 137 ((le32_to_cpu((_notif)->mbox_msg[(_num)]) & BT_MBOX##_num##_##_field)\ 138 >> BT_MBOX##_num##_##_field##_POS) 139 140 #define BT_MBOX_PRINT(_num, _field, _end) \ 141 pos += scnprintf(buf + pos, bufsz - pos, \ 142 "\t%s: %d%s", \ 143 #_field, \ 144 BT_MBOX_MSG(notif, _num, _field), \ 145 true ? "\n" : ", ") 146 enum iwl_bt_activity_grading { 147 BT_OFF = 0, 148 BT_ON_NO_CONNECTION = 1, 149 BT_LOW_TRAFFIC = 2, 150 BT_HIGH_TRAFFIC = 3, 151 BT_VERY_HIGH_TRAFFIC = 4, 152 153 BT_MAX_AG, 154 }; /* BT_COEX_BT_ACTIVITY_GRADING_API_E_VER_1 */ 155 156 enum iwl_bt_ci_compliance { 157 BT_CI_COMPLIANCE_NONE = 0, 158 BT_CI_COMPLIANCE_PRIMARY = 1, 159 BT_CI_COMPLIANCE_SECONDARY = 2, 160 BT_CI_COMPLIANCE_BOTH = 3, 161 }; /* BT_COEX_CI_COMPLIENCE_E_VER_1 */ 162 163 /** 164 * struct iwl_bt_coex_profile_notif - notification about BT coex 165 * @mbox_msg: message from BT to WiFi 166 * @msg_idx: the index of the message 167 * @bt_ci_compliance: enum %iwl_bt_ci_compliance 168 * @primary_ch_lut: LUT used for primary channel &enum iwl_bt_coex_lut_type 169 * @secondary_ch_lut: LUT used for secondary channel &enum iwl_bt_coex_lut_type 170 * @bt_activity_grading: the activity of BT &enum iwl_bt_activity_grading 171 * @ttc_status: is TTC enabled - one bit per PHY 172 * @rrc_status: is RRC enabled - one bit per PHY 173 * @reserved: reserved 174 */ 175 struct iwl_bt_coex_profile_notif { 176 __le32 mbox_msg[4]; 177 __le32 msg_idx; 178 __le32 bt_ci_compliance; 179 180 __le32 primary_ch_lut; 181 __le32 secondary_ch_lut; 182 __le32 bt_activity_grading; 183 u8 ttc_status; 184 u8 rrc_status; 185 __le16 reserved; 186 } __packed; /* BT_COEX_PROFILE_NTFY_API_S_VER_4 */ 187 188 #endif /* __iwl_fw_api_coex_h__ */ 189