Commit 430a3bba authored by Emmanuel Grumbach's avatar Emmanuel Grumbach

iwlwifi: mvm: BT Coex - new API

Start the new BT Coex implementation.
Don't react to notifications for now - only the initial
configuration is implemented. The rest will happen in next
patches.
Since coex.c now uses the new the new structures in all
functions, we need to adapt the code to compile, even if it
doesn't run yet.
Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
parent 0ea8d043
This diff is collapsed.
...@@ -316,7 +316,7 @@ static ssize_t iwl_dbgfs_bt_notif_read(struct file *file, char __user *user_buf, ...@@ -316,7 +316,7 @@ static ssize_t iwl_dbgfs_bt_notif_read(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
struct iwl_mvm *mvm = file->private_data; struct iwl_mvm *mvm = file->private_data;
struct iwl_bt_coex_profile_notif_old *notif = &mvm->last_bt_notif; struct iwl_bt_coex_profile_notif *notif = &mvm->last_bt_notif;
char *buf; char *buf;
int ret, pos = 0, bufsz = sizeof(char) * 1024; int ret, pos = 0, bufsz = sizeof(char) * 1024;
...@@ -378,14 +378,6 @@ static ssize_t iwl_dbgfs_bt_notif_read(struct file *file, char __user *user_buf, ...@@ -378,14 +378,6 @@ static ssize_t iwl_dbgfs_bt_notif_read(struct file *file, char __user *user_buf,
BT_MBOX_PRINT(3, SSN_2, false); BT_MBOX_PRINT(3, SSN_2, false);
BT_MBOX_PRINT(3, UPDATE_REQUEST, true); BT_MBOX_PRINT(3, UPDATE_REQUEST, true);
pos += scnprintf(buf+pos, bufsz-pos, "bt_status = %d\n",
notif->bt_status);
pos += scnprintf(buf+pos, bufsz-pos, "bt_open_conn = %d\n",
notif->bt_open_conn);
pos += scnprintf(buf+pos, bufsz-pos, "bt_traffic_load = %d\n",
notif->bt_traffic_load);
pos += scnprintf(buf+pos, bufsz-pos, "bt_agg_traffic_load = %d\n",
notif->bt_agg_traffic_load);
pos += scnprintf(buf+pos, bufsz-pos, "bt_ci_compliance = %d\n", pos += scnprintf(buf+pos, bufsz-pos, "bt_ci_compliance = %d\n",
notif->bt_ci_compliance); notif->bt_ci_compliance);
pos += scnprintf(buf+pos, bufsz-pos, "primary_ch_lut = %d\n", pos += scnprintf(buf+pos, bufsz-pos, "primary_ch_lut = %d\n",
...@@ -411,7 +403,7 @@ static ssize_t iwl_dbgfs_bt_cmd_read(struct file *file, char __user *user_buf, ...@@ -411,7 +403,7 @@ static ssize_t iwl_dbgfs_bt_cmd_read(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
struct iwl_mvm *mvm = file->private_data; struct iwl_mvm *mvm = file->private_data;
struct iwl_bt_coex_ci_cmd_old *cmd = &mvm->last_bt_ci_cmd; struct iwl_bt_coex_ci_cmd *cmd = &mvm->last_bt_ci_cmd;
char buf[256]; char buf[256];
int bufsz = sizeof(buf); int bufsz = sizeof(buf);
int pos = 0; int pos = 0;
...@@ -420,13 +412,11 @@ static ssize_t iwl_dbgfs_bt_cmd_read(struct file *file, char __user *user_buf, ...@@ -420,13 +412,11 @@ static ssize_t iwl_dbgfs_bt_cmd_read(struct file *file, char __user *user_buf,
pos += scnprintf(buf+pos, bufsz-pos, "Channel inhibition CMD\n"); pos += scnprintf(buf+pos, bufsz-pos, "Channel inhibition CMD\n");
pos += scnprintf(buf+pos, bufsz-pos, pos += scnprintf(buf+pos, bufsz-pos,
"\tPrimary Channel Bitmap 0x%016llx Fat: %d\n", "\tPrimary Channel Bitmap 0x%016llx\n",
le64_to_cpu(cmd->bt_primary_ci), le64_to_cpu(cmd->bt_primary_ci));
!!cmd->co_run_bw_primary);
pos += scnprintf(buf+pos, bufsz-pos, pos += scnprintf(buf+pos, bufsz-pos,
"\tSecondary Channel Bitmap 0x%016llx Fat: %d\n", "\tSecondary Channel Bitmap 0x%016llx\n",
le64_to_cpu(cmd->bt_secondary_ci), le64_to_cpu(cmd->bt_secondary_ci));
!!cmd->co_run_bw_secondary);
pos += scnprintf(buf+pos, bufsz-pos, "BT Configuration CMD\n"); pos += scnprintf(buf+pos, bufsz-pos, "BT Configuration CMD\n");
pos += scnprintf(buf+pos, bufsz-pos, "\tACK Kill Mask 0x%08x\n", pos += scnprintf(buf+pos, bufsz-pos, "\tACK Kill Mask 0x%08x\n",
......
...@@ -208,26 +208,116 @@ struct iwl_bt_coex_cmd_old { ...@@ -208,26 +208,116 @@ struct iwl_bt_coex_cmd_old {
__le32 valid_bit_msk; __le32 valid_bit_msk;
} __packed; /* BT_COEX_CMD_API_S_VER_5 */ } __packed; /* BT_COEX_CMD_API_S_VER_5 */
enum iwl_bt_coex_mode {
BT_COEX_DISABLE = 0x0,
BT_COEX_NW = 0x1,
BT_COEX_BT = 0x2,
BT_COEX_WIFI = 0x3,
}; /* BT_COEX_MODES_E */
enum iwl_bt_coex_enabled_modules {
BT_COEX_MPLUT_ENABLED = BIT(0),
BT_COEX_MPLUT_BOOST_ENABLED = BIT(1),
BT_COEX_SYNC2SCO_ENABLED = BIT(2),
BT_COEX_CORUN_ENABLED = BIT(3),
}; /* BT_COEX_MODULES_ENABLE_E_VER_1 */
/**
* struct iwl_bt_coex_cmd - bt coex configuration command
* @mode: enum %iwl_bt_coex_mode
* @enabled_modules: enum %iwl_bt_coex_enabled_modules
* @max_kill: max count of Tx retries due to kill from PTA
* @override_primary_lut: enum %iwl_bt_coex_lut_type: BT_COEX_INVALID_LUT
* should be set by default
* @override_secondary_lut: enum %iwl_bt_coex_lut_type: BT_COEX_INVALID_LUT
* should be set by default
* @bt4_antenna_isolation_thr: antenna threshold value
* @bt4_tx_tx_delta_freq_thr: TxTx delta frequency
* @bt4_tx_rx_max_freq0: TxRx max frequency
* @multiprio_lut: multi priority LUT configuration
* @mplut_prio_boost: BT priority boost registers
* @decision_lut: PTA decision LUT, per Prio-Ch
*
* The structure is used for the BT_COEX command.
*/
struct iwl_bt_coex_cmd {
__le32 mode;
__le32 enabled_modules;
__le32 max_kill;
__le32 override_primary_lut;
__le32 override_secondary_lut;
__le32 bt4_antenna_isolation_thr;
__le32 bt4_tx_tx_delta_freq_thr;
__le32 bt4_tx_rx_max_freq0;
__le32 multiprio_lut[BT_COEX_MULTI_PRIO_LUT_SIZE];
__le32 mplut_prio_boost[BT_COEX_BOOST_SIZE];
__le32 decision_lut[BT_COEX_MAX_LUT][BT_COEX_LUT_SIZE];
} __packed; /* BT_COEX_CMD_API_S_VER_6 */
/**
* struct iwl_bt_coex_corun_lut_update - bt coex update the corun lut
* @corun_lut20: co-running 20 MHz LUT configuration
* @corun_lut40: co-running 40 MHz LUT configuration
*
* The structure is used for the BT_COEX_UPDATE_CORUN_LUT command.
*/
struct iwl_bt_coex_corun_lut_update_cmd {
__le32 corun_lut20[BT_COEX_CORUN_LUT_SIZE];
__le32 corun_lut40[BT_COEX_CORUN_LUT_SIZE];
} __packed; /* BT_COEX_UPDATE_CORUN_LUT_API_S_VER_1 */
/**
* struct iwl_bt_coex_sw_boost - SW boost values
* @wifi_tx_prio_boost: SW boost of wifi tx priority
* @wifi_rx_prio_boost: SW boost of wifi rx priority
* @kill_ack_msk: kill ACK mask. 1 - Tx ACK, 0 - kill Tx of ACK.
* @kill_cts_msk: kill CTS mask. 1 - Tx CTS, 0 - kill Tx of CTS.
*/
struct iwl_bt_coex_sw_boost {
__le32 wifi_tx_prio_boost;
__le32 wifi_rx_prio_boost;
__le32 kill_ack_msk;
__le32 kill_cts_msk;
};
/**
* struct iwl_bt_coex_sw_boost_update_cmd - command to update the SW boost
* @boost_values: check struct %iwl_bt_coex_sw_boost - one for each channel
* primary / secondary / low priority
*/
struct iwl_bt_coex_sw_boost_update_cmd {
struct iwl_bt_coex_sw_boost boost_values[3];
} __packed; /* BT_COEX_UPDATE_SW_BOOST_S_VER_1 */
/**
* struct iwl_bt_coex_reduced_txp_update_cmd
* @reduced_txp: bit BT_REDUCED_TX_POWER_BIT to enable / disable, rest of the
* bits are the sta_id (value)
*/
struct iwl_bt_coex_reduced_txp_update_cmd {
__le32 reduced_txp;
} __packed; /* BT_COEX_UPDATE_REDUCED_TX_POWER_API_S_VER_1 */
/** /**
* struct iwl_bt_coex_ci_cmd - bt coex channel inhibition command * struct iwl_bt_coex_ci_cmd - bt coex channel inhibition command
* @bt_primary_ci: * @bt_primary_ci:
* @bt_secondary_ci:
* @co_run_bw_primary:
* @co_run_bw_secondary:
* @primary_ch_phy_id: * @primary_ch_phy_id:
* @bt_secondary_ci:
* @secondary_ch_phy_id: * @secondary_ch_phy_id:
* *
* Used for BT_COEX_CI command * Used for BT_COEX_CI command
*/ */
struct iwl_bt_coex_ci_cmd_old { struct iwl_bt_coex_ci_cmd {
__le64 bt_primary_ci; __le64 bt_primary_ci;
__le64 bt_secondary_ci; __le32 primary_ch_phy_id;
u8 co_run_bw_primary; __le64 bt_secondary_ci;
u8 co_run_bw_secondary; __le32 secondary_ch_phy_id;
u8 primary_ch_phy_id; } __packed; /* BT_CI_MSG_API_S_VER_2 */
u8 secondary_ch_phy_id;
} __packed; /* BT_CI_MSG_API_S_VER_1 */
#define BT_MBOX(n_dw, _msg, _pos, _nbits) \ #define BT_MBOX(n_dw, _msg, _pos, _nbits) \
BT_MBOX##n_dw##_##_msg##_POS = (_pos), \ BT_MBOX##n_dw##_##_msg##_POS = (_pos), \
...@@ -296,35 +386,34 @@ enum iwl_bt_activity_grading { ...@@ -296,35 +386,34 @@ enum iwl_bt_activity_grading {
BT_HIGH_TRAFFIC = 3, BT_HIGH_TRAFFIC = 3,
}; /* BT_COEX_BT_ACTIVITY_GRADING_API_E_VER_1 */ }; /* BT_COEX_BT_ACTIVITY_GRADING_API_E_VER_1 */
enum iwl_bt_ci_compliance {
BT_CI_COMPLIANCE_NONE = 0,
BT_CI_COMPLIANCE_PRIMARY = 1,
BT_CI_COMPLIANCE_SECONDARY = 2,
BT_CI_COMPLIANCE_BOTH = 3,
}; /* BT_COEX_CI_COMPLIENCE_E_VER_1 */
/** /**
* struct iwl_bt_coex_profile_notif - notification about BT coex * struct iwl_bt_coex_profile_notif - notification about BT coex
* @mbox_msg: message from BT to WiFi * @mbox_msg: message from BT to WiFi
* @msg_idx: the index of the message * @msg_idx: the index of the message
* @bt_status: 0 - off, 1 - on * @bt_ci_compliance: enum %iwl_bt_ci_compliance
* @bt_open_conn: number of BT connections open * @primary_ch_lut: LUT used for primary channel enum %iwl_bt_coex_lut_type
* @bt_traffic_load: load of BT traffic * @secondary_ch_lut: LUT used for secondary channel enume %iwl_bt_coex_lut_type
* @bt_agg_traffic_load: aggregated load of BT traffic
* @bt_ci_compliance: 0 - no CI compliance, 1 - CI compliant
* @ttc_enabled: true if ttc has been enabled by the firmware
* @primary_ch_lut: LUT used for primary channel
* @secondary_ch_lut: LUT used for secondary channel
* @bt_activity_grading: the activity of BT enum %iwl_bt_activity_grading * @bt_activity_grading: the activity of BT enum %iwl_bt_activity_grading
* @ttc_rrc_status: is TTC or RRC enabled - one bit per PHY
*/ */
struct iwl_bt_coex_profile_notif_old { struct iwl_bt_coex_profile_notif {
__le32 mbox_msg[4]; __le32 mbox_msg[4];
__le32 msg_idx; __le32 msg_idx;
u8 bt_status; __le32 bt_ci_compliance;
u8 bt_open_conn;
u8 bt_traffic_load;
u8 bt_agg_traffic_load;
u8 bt_ci_compliance;
u8 ttc_enabled;
__le16 reserved;
__le32 primary_ch_lut; __le32 primary_ch_lut;
__le32 secondary_ch_lut; __le32 secondary_ch_lut;
__le32 bt_activity_grading; __le32 bt_activity_grading;
} __packed; /* BT_COEX_PROFILE_NTFY_API_S_VER_3 */ u8 ttc_rrc_status;
u8 reserved[3];
} __packed; /* BT_COEX_PROFILE_NTFY_API_S_VER_4 */
enum iwl_bt_coex_prio_table_event { enum iwl_bt_coex_prio_table_event {
BT_COEX_PRIO_TBL_EVT_INIT_CALIB1 = 0, BT_COEX_PRIO_TBL_EVT_INIT_CALIB1 = 0,
...@@ -363,4 +452,54 @@ struct iwl_bt_coex_prio_tbl_cmd { ...@@ -363,4 +452,54 @@ struct iwl_bt_coex_prio_tbl_cmd {
u8 prio_tbl[BT_COEX_PRIO_TBL_EVT_MAX]; u8 prio_tbl[BT_COEX_PRIO_TBL_EVT_MAX];
} __packed; } __packed;
/**
* struct iwl_bt_coex_ci_cmd_old - bt coex channel inhibition command
* @bt_primary_ci:
* @bt_secondary_ci:
* @co_run_bw_primary:
* @co_run_bw_secondary:
* @primary_ch_phy_id:
* @secondary_ch_phy_id:
*
* Used for BT_COEX_CI command
*/
struct iwl_bt_coex_ci_cmd_old {
__le64 bt_primary_ci;
__le64 bt_secondary_ci;
u8 co_run_bw_primary;
u8 co_run_bw_secondary;
u8 primary_ch_phy_id;
u8 secondary_ch_phy_id;
} __packed; /* BT_CI_MSG_API_S_VER_1 */
/**
* struct iwl_bt_coex_profile_notif_old - notification about BT coex
* @mbox_msg: message from BT to WiFi
* @msg_idx: the index of the message
* @bt_status: 0 - off, 1 - on
* @bt_open_conn: number of BT connections open
* @bt_traffic_load: load of BT traffic
* @bt_agg_traffic_load: aggregated load of BT traffic
* @bt_ci_compliance: 0 - no CI compliance, 1 - CI compliant
* @primary_ch_lut: LUT used for primary channel
* @secondary_ch_lut: LUT used for secondary channel
* @bt_activity_grading: the activity of BT enum %iwl_bt_activity_grading
*/
struct iwl_bt_coex_profile_notif_old {
__le32 mbox_msg[4];
__le32 msg_idx;
u8 bt_status;
u8 bt_open_conn;
u8 bt_traffic_load;
u8 bt_agg_traffic_load;
u8 bt_ci_compliance;
u8 ttc_enabled;
__le16 reserved;
__le32 primary_ch_lut;
__le32 secondary_ch_lut;
__le32 bt_activity_grading;
} __packed; /* BT_COEX_PROFILE_NTFY_API_S_VER_3 */
#endif /* __fw_api_bt_coex_h__ */ #endif /* __fw_api_bt_coex_h__ */
...@@ -163,7 +163,6 @@ enum { ...@@ -163,7 +163,6 @@ enum {
BEACON_NOTIFICATION = 0x90, BEACON_NOTIFICATION = 0x90,
BEACON_TEMPLATE_CMD = 0x91, BEACON_TEMPLATE_CMD = 0x91,
TX_ANT_CONFIGURATION_CMD = 0x98, TX_ANT_CONFIGURATION_CMD = 0x98,
BT_CONFIG = 0x9b,
STATISTICS_NOTIFICATION = 0x9d, STATISTICS_NOTIFICATION = 0x9d,
EOSP_NOTIFICATION = 0x9e, EOSP_NOTIFICATION = 0x9e,
REDUCE_TX_POWER_CMD = 0x9f, REDUCE_TX_POWER_CMD = 0x9f,
...@@ -185,6 +184,10 @@ enum { ...@@ -185,6 +184,10 @@ enum {
BT_COEX_PRIO_TABLE = 0xcc, BT_COEX_PRIO_TABLE = 0xcc,
BT_COEX_PROT_ENV = 0xcd, BT_COEX_PROT_ENV = 0xcd,
BT_PROFILE_NOTIFICATION = 0xce, BT_PROFILE_NOTIFICATION = 0xce,
BT_CONFIG = 0x9b,
BT_COEX_UPDATE_SW_BOOST = 0x5a,
BT_COEX_UPDATE_CORUN_LUT = 0x5b,
BT_COEX_UPDATE_REDUCED_TXP = 0x5c,
BT_COEX_CI = 0x5d, BT_COEX_CI = 0x5d,
REPLY_SF_CFG_CMD = 0xd1, REPLY_SF_CFG_CMD = 0xd1,
......
...@@ -633,8 +633,8 @@ struct iwl_mvm { ...@@ -633,8 +633,8 @@ struct iwl_mvm {
struct iwl_bt_coex_profile_notif_old last_bt_notif_old; struct iwl_bt_coex_profile_notif_old last_bt_notif_old;
struct iwl_bt_coex_ci_cmd_old last_bt_ci_cmd_old; struct iwl_bt_coex_ci_cmd_old last_bt_ci_cmd_old;
struct iwl_bt_coex_profile_notif_old last_bt_notif; struct iwl_bt_coex_profile_notif last_bt_notif;
struct iwl_bt_coex_ci_cmd_old last_bt_ci_cmd; struct iwl_bt_coex_ci_cmd last_bt_ci_cmd;
u32 last_ant_isol; u32 last_ant_isol;
u8 last_corun_lut; u8 last_corun_lut;
......
...@@ -324,6 +324,9 @@ static const char *const iwl_mvm_cmd_strings[REPLY_MAX] = { ...@@ -324,6 +324,9 @@ static const char *const iwl_mvm_cmd_strings[REPLY_MAX] = {
CMD(REPLY_THERMAL_MNG_BACKOFF), CMD(REPLY_THERMAL_MNG_BACKOFF),
CMD(MAC_PM_POWER_TABLE), CMD(MAC_PM_POWER_TABLE),
CMD(BT_COEX_CI), CMD(BT_COEX_CI),
CMD(BT_COEX_UPDATE_SW_BOOST),
CMD(BT_COEX_UPDATE_CORUN_LUT),
CMD(BT_COEX_UPDATE_REDUCED_TXP),
CMD(PSM_UAPSD_AP_MISBEHAVING_NOTIFICATION), CMD(PSM_UAPSD_AP_MISBEHAVING_NOTIFICATION),
CMD(ANTENNA_COUPLING_NOTIFICATION), CMD(ANTENNA_COUPLING_NOTIFICATION),
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment