1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
3 * Copyright (C) 2023-2024 Intel Corporation
4 * Copyright (C) 2013-2014, 2018-2019 Intel Corporation
5 * Copyright (C) 2013-2014 Intel Mobile Communications GmbH
6 * Copyright (C) 2017 Intel Deutschland GmbH
8 #ifndef __iwl_fw_api_coex_h__
9 #define __iwl_fw_api_coex_h__
11 #include <linux/types.h>
12 #include <linux/bitops.h>
14 #define BITS(nb) (BIT(nb) - 1)
16 enum iwl_bt_coex_lut_type {
17 BT_COEX_TIGHT_LUT = 0,
22 BT_COEX_INVALID_LUT = 0xff,
23 }; /* BT_COEX_DECISION_LUT_INDEX_API_E_VER_1 */
25 #define BT_REDUCED_TX_POWER_BIT BIT(7)
27 enum iwl_bt_coex_mode {
28 BT_COEX_DISABLE = 0x0,
32 }; /* BT_COEX_MODES_E */
34 enum iwl_bt_coex_enabled_modules {
35 BT_COEX_MPLUT_ENABLED = BIT(0),
36 BT_COEX_MPLUT_BOOST_ENABLED = BIT(1),
37 BT_COEX_SYNC2SCO_ENABLED = BIT(2),
38 BT_COEX_CORUN_ENABLED = BIT(3),
39 BT_COEX_HIGH_BAND_RET = BIT(4),
40 }; /* BT_COEX_MODULES_ENABLE_E_VER_1 */
43 * struct iwl_bt_coex_cmd - bt coex configuration command
44 * @mode: &enum iwl_bt_coex_mode
45 * @enabled_modules: &enum iwl_bt_coex_enabled_modules
47 * The structure is used for the BT_COEX command.
49 struct iwl_bt_coex_cmd {
51 __le32 enabled_modules;
52 } __packed; /* BT_COEX_CMD_API_S_VER_6 */
55 * struct iwl_bt_coex_reduced_txp_update_cmd
56 * @reduced_txp: bit BT_REDUCED_TX_POWER_BIT to enable / disable, rest of the
57 * bits are the sta_id (value)
59 struct iwl_bt_coex_reduced_txp_update_cmd {
61 } __packed; /* BT_COEX_UPDATE_REDUCED_TX_POWER_API_S_VER_1 */
64 * struct iwl_bt_coex_ci_cmd - bt coex channel inhibition command
65 * @bt_primary_ci: primary channel inhibition bitmap
66 * @primary_ch_phy_id: primary channel PHY ID
67 * @bt_secondary_ci: secondary channel inhibition bitmap
68 * @secondary_ch_phy_id: secondary channel PHY ID
70 * Used for BT_COEX_CI command
72 struct iwl_bt_coex_ci_cmd {
74 __le32 primary_ch_phy_id;
76 __le64 bt_secondary_ci;
77 __le32 secondary_ch_phy_id;
78 } __packed; /* BT_CI_MSG_API_S_VER_2 */
80 enum iwl_bt_activity_grading {
82 BT_ON_NO_CONNECTION = 1,
85 BT_VERY_HIGH_TRAFFIC = 4,
88 }; /* BT_COEX_BT_ACTIVITY_GRADING_API_E_VER_1 */
90 enum iwl_bt_ci_compliance {
91 BT_CI_COMPLIANCE_NONE = 0,
92 BT_CI_COMPLIANCE_PRIMARY = 1,
93 BT_CI_COMPLIANCE_SECONDARY = 2,
94 BT_CI_COMPLIANCE_BOTH = 3,
95 }; /* BT_COEX_CI_COMPLIENCE_E_VER_1 */
98 * struct iwl_bt_coex_prof_old_notif - notification about BT coex
99 * @mbox_msg: message from BT to WiFi
100 * @msg_idx: the index of the message
101 * @bt_ci_compliance: enum %iwl_bt_ci_compliance
102 * @primary_ch_lut: LUT used for primary channel &enum iwl_bt_coex_lut_type
103 * @secondary_ch_lut: LUT used for secondary channel &enum iwl_bt_coex_lut_type
104 * @bt_activity_grading: the activity of BT &enum iwl_bt_activity_grading
105 * @ttc_status: is TTC enabled - one bit per PHY
106 * @rrc_status: is RRC enabled - one bit per PHY
107 * The following fields are only for version 5, and are reserved in version 4:
108 * @wifi_loss_low_rssi: The predicted lost WiFi rate (% of air time that BT is
109 * utilizing) when the RSSI is low (<= -65 dBm)
110 * @wifi_loss_mid_high_rssi: The predicted lost WiFi rate (% of air time that
111 * BT is utilizing) when the RSSI is mid/high (>= -65 dBm)
113 struct iwl_bt_coex_prof_old_notif {
116 __le32 bt_ci_compliance;
118 __le32 primary_ch_lut;
119 __le32 secondary_ch_lut;
120 __le32 bt_activity_grading;
123 u8 wifi_loss_low_rssi;
124 u8 wifi_loss_mid_high_rssi;
125 } __packed; /* BT_COEX_PROFILE_NTFY_API_S_VER_4
126 * BT_COEX_PROFILE_NTFY_API_S_VER_5
130 * enum iwl_bt_coex_subcmd_ids - coex configuration command IDs
132 enum iwl_bt_coex_subcmd_ids {
134 *@PROFILE_NOTIF: &struct iwl_bt_coex_profile_notif
136 PROFILE_NOTIF = 0xFF,
139 #define COEX_NUM_BAND 3
140 #define COEX_NUM_CHAINS 2
143 * struct iwl_bt_coex_profile_notif - notification about BT coex
144 * @wifi_loss_low_rssi: The predicted lost WiFi rate (% of air time that BT is
145 * utilizing) when the RSSI is low (<= -65 dBm)
146 * @wifi_loss_mid_high_rssi: The predicted lost WiFi rate (% of air time that
147 * BT is utilizing) when the RSSI is mid/high (>= -65 dBm)
149 struct iwl_bt_coex_profile_notif {
150 u8 wifi_loss_low_rssi[COEX_NUM_BAND][COEX_NUM_CHAINS];
151 u8 wifi_loss_mid_high_rssi[COEX_NUM_BAND][COEX_NUM_CHAINS];
152 } __packed; /* BT_COEX_BT_PROFILE_NTF_API_S_VER_1 */
154 #endif /* __iwl_fw_api_coex_h__ */