Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
0002 /*
0003  * Copyright (C) 2013-2014, 2018-2019 Intel Corporation
0004  * Copyright (C) 2013-2014 Intel Mobile Communications GmbH
0005  * Copyright (C) 2017 Intel Deutschland GmbH
0006  */
0007 #ifndef __iwl_fw_api_coex_h__
0008 #define __iwl_fw_api_coex_h__
0009 
0010 #include <linux/types.h>
0011 #include <linux/bitops.h>
0012 
0013 #define BITS(nb) (BIT(nb) - 1)
0014 
0015 enum iwl_bt_coex_lut_type {
0016     BT_COEX_TIGHT_LUT = 0,
0017     BT_COEX_LOOSE_LUT,
0018     BT_COEX_TX_DIS_LUT,
0019 
0020     BT_COEX_MAX_LUT,
0021     BT_COEX_INVALID_LUT = 0xff,
0022 }; /* BT_COEX_DECISION_LUT_INDEX_API_E_VER_1 */
0023 
0024 #define BT_REDUCED_TX_POWER_BIT BIT(7)
0025 
0026 enum iwl_bt_coex_mode {
0027     BT_COEX_DISABLE         = 0x0,
0028     BT_COEX_NW          = 0x1,
0029     BT_COEX_BT          = 0x2,
0030     BT_COEX_WIFI            = 0x3,
0031 }; /* BT_COEX_MODES_E */
0032 
0033 enum iwl_bt_coex_enabled_modules {
0034     BT_COEX_MPLUT_ENABLED       = BIT(0),
0035     BT_COEX_MPLUT_BOOST_ENABLED = BIT(1),
0036     BT_COEX_SYNC2SCO_ENABLED    = BIT(2),
0037     BT_COEX_CORUN_ENABLED       = BIT(3),
0038     BT_COEX_HIGH_BAND_RET       = BIT(4),
0039 }; /* BT_COEX_MODULES_ENABLE_E_VER_1 */
0040 
0041 /**
0042  * struct iwl_bt_coex_cmd - bt coex configuration command
0043  * @mode: &enum iwl_bt_coex_mode
0044  * @enabled_modules: &enum iwl_bt_coex_enabled_modules
0045  *
0046  * The structure is used for the BT_COEX command.
0047  */
0048 struct iwl_bt_coex_cmd {
0049     __le32 mode;
0050     __le32 enabled_modules;
0051 } __packed; /* BT_COEX_CMD_API_S_VER_6 */
0052 
0053 /**
0054  * struct iwl_bt_coex_reduced_txp_update_cmd
0055  * @reduced_txp: bit BT_REDUCED_TX_POWER_BIT to enable / disable, rest of the
0056  *  bits are the sta_id (value)
0057  */
0058 struct iwl_bt_coex_reduced_txp_update_cmd {
0059     __le32 reduced_txp;
0060 } __packed; /* BT_COEX_UPDATE_REDUCED_TX_POWER_API_S_VER_1 */
0061 
0062 /**
0063  * struct iwl_bt_coex_ci_cmd - bt coex channel inhibition command
0064  * @bt_primary_ci: primary channel inhibition bitmap
0065  * @primary_ch_phy_id: primary channel PHY ID
0066  * @bt_secondary_ci: secondary channel inhibition bitmap
0067  * @secondary_ch_phy_id: secondary channel PHY ID
0068  *
0069  * Used for BT_COEX_CI command
0070  */
0071 struct iwl_bt_coex_ci_cmd {
0072     __le64 bt_primary_ci;
0073     __le32 primary_ch_phy_id;
0074 
0075     __le64 bt_secondary_ci;
0076     __le32 secondary_ch_phy_id;
0077 } __packed; /* BT_CI_MSG_API_S_VER_2 */
0078 
0079 #define BT_MBOX(n_dw, _msg, _pos, _nbits)   \
0080     BT_MBOX##n_dw##_##_msg##_POS = (_pos),  \
0081     BT_MBOX##n_dw##_##_msg = BITS(_nbits) << BT_MBOX##n_dw##_##_msg##_POS
0082 
0083 enum iwl_bt_mxbox_dw0 {
0084     BT_MBOX(0, LE_SLAVE_LAT, 0, 3),
0085     BT_MBOX(0, LE_PROF1, 3, 1),
0086     BT_MBOX(0, LE_PROF2, 4, 1),
0087     BT_MBOX(0, LE_PROF_OTHER, 5, 1),
0088     BT_MBOX(0, CHL_SEQ_N, 8, 4),
0089     BT_MBOX(0, INBAND_S, 13, 1),
0090     BT_MBOX(0, LE_MIN_RSSI, 16, 4),
0091     BT_MBOX(0, LE_SCAN, 20, 1),
0092     BT_MBOX(0, LE_ADV, 21, 1),
0093     BT_MBOX(0, LE_MAX_TX_POWER, 24, 4),
0094     BT_MBOX(0, OPEN_CON_1, 28, 2),
0095 };
0096 
0097 enum iwl_bt_mxbox_dw1 {
0098     BT_MBOX(1, BR_MAX_TX_POWER, 0, 4),
0099     BT_MBOX(1, IP_SR, 4, 1),
0100     BT_MBOX(1, LE_MSTR, 5, 1),
0101     BT_MBOX(1, AGGR_TRFC_LD, 8, 6),
0102     BT_MBOX(1, MSG_TYPE, 16, 3),
0103     BT_MBOX(1, SSN, 19, 2),
0104 };
0105 
0106 enum iwl_bt_mxbox_dw2 {
0107     BT_MBOX(2, SNIFF_ACT, 0, 3),
0108     BT_MBOX(2, PAG, 3, 1),
0109     BT_MBOX(2, INQUIRY, 4, 1),
0110     BT_MBOX(2, CONN, 5, 1),
0111     BT_MBOX(2, SNIFF_INTERVAL, 8, 5),
0112     BT_MBOX(2, DISC, 13, 1),
0113     BT_MBOX(2, SCO_TX_ACT, 16, 2),
0114     BT_MBOX(2, SCO_RX_ACT, 18, 2),
0115     BT_MBOX(2, ESCO_RE_TX, 20, 2),
0116     BT_MBOX(2, SCO_DURATION, 24, 6),
0117 };
0118 
0119 enum iwl_bt_mxbox_dw3 {
0120     BT_MBOX(3, SCO_STATE, 0, 1),
0121     BT_MBOX(3, SNIFF_STATE, 1, 1),
0122     BT_MBOX(3, A2DP_STATE, 2, 1),
0123     BT_MBOX(3, ACL_STATE, 3, 1),
0124     BT_MBOX(3, MSTR_STATE, 4, 1),
0125     BT_MBOX(3, OBX_STATE, 5, 1),
0126     BT_MBOX(3, A2DP_SRC, 6, 1),
0127     BT_MBOX(3, OPEN_CON_2, 8, 2),
0128     BT_MBOX(3, TRAFFIC_LOAD, 10, 2),
0129     BT_MBOX(3, CHL_SEQN_LSB, 12, 1),
0130     BT_MBOX(3, INBAND_P, 13, 1),
0131     BT_MBOX(3, MSG_TYPE_2, 16, 3),
0132     BT_MBOX(3, SSN_2, 19, 2),
0133     BT_MBOX(3, UPDATE_REQUEST, 21, 1),
0134 };
0135 
0136 #define BT_MBOX_MSG(_notif, _num, _field)                    \
0137     ((le32_to_cpu((_notif)->mbox_msg[(_num)]) & BT_MBOX##_num##_##_field)\
0138     >> BT_MBOX##_num##_##_field##_POS)
0139 
0140 #define BT_MBOX_PRINT(_num, _field, _end)                   \
0141             pos += scnprintf(buf + pos, bufsz - pos,        \
0142                      "\t%s: %d%s",              \
0143                      #_field,               \
0144                      BT_MBOX_MSG(notif, _num, _field),  \
0145                      true ? "\n" : ", ")
0146 enum iwl_bt_activity_grading {
0147     BT_OFF          = 0,
0148     BT_ON_NO_CONNECTION = 1,
0149     BT_LOW_TRAFFIC      = 2,
0150     BT_HIGH_TRAFFIC     = 3,
0151     BT_VERY_HIGH_TRAFFIC    = 4,
0152 
0153     BT_MAX_AG,
0154 }; /* BT_COEX_BT_ACTIVITY_GRADING_API_E_VER_1 */
0155 
0156 enum iwl_bt_ci_compliance {
0157     BT_CI_COMPLIANCE_NONE       = 0,
0158     BT_CI_COMPLIANCE_PRIMARY    = 1,
0159     BT_CI_COMPLIANCE_SECONDARY  = 2,
0160     BT_CI_COMPLIANCE_BOTH       = 3,
0161 }; /* BT_COEX_CI_COMPLIENCE_E_VER_1 */
0162 
0163 /**
0164  * struct iwl_bt_coex_profile_notif - notification about BT coex
0165  * @mbox_msg: message from BT to WiFi
0166  * @msg_idx: the index of the message
0167  * @bt_ci_compliance: enum %iwl_bt_ci_compliance
0168  * @primary_ch_lut: LUT used for primary channel &enum iwl_bt_coex_lut_type
0169  * @secondary_ch_lut: LUT used for secondary channel &enum iwl_bt_coex_lut_type
0170  * @bt_activity_grading: the activity of BT &enum iwl_bt_activity_grading
0171  * @ttc_status: is TTC enabled - one bit per PHY
0172  * @rrc_status: is RRC enabled - one bit per PHY
0173  * @reserved: reserved
0174  */
0175 struct iwl_bt_coex_profile_notif {
0176     __le32 mbox_msg[4];
0177     __le32 msg_idx;
0178     __le32 bt_ci_compliance;
0179 
0180     __le32 primary_ch_lut;
0181     __le32 secondary_ch_lut;
0182     __le32 bt_activity_grading;
0183     u8 ttc_status;
0184     u8 rrc_status;
0185     __le16 reserved;
0186 } __packed; /* BT_COEX_PROFILE_NTFY_API_S_VER_4 */
0187 
0188 #endif /* __iwl_fw_api_coex_h__ */