iwlwifi: mvm: BT Coex - prepare towards new API
A new API is coming. This new API is not backward
compatible. So we need to keep the old commands to be able
to work with the former API.
Move all the current code into a new file: coex_legacy.
If a firmware with the new API is detected, we currently
just bail out since the implementation of the new API will
come in future patches.
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
diff --git a/drivers/net/wireless/iwlwifi/mvm/coex.c b/drivers/net/wireless/iwlwifi/mvm/coex.c
index 7e0388a..f471de3 100644
--- a/drivers/net/wireless/iwlwifi/mvm/coex.c
+++ b/drivers/net/wireless/iwlwifi/mvm/coex.c
@@ -561,7 +561,7 @@
int iwl_send_bt_init_conf(struct iwl_mvm *mvm)
{
- struct iwl_bt_coex_cmd *bt_cmd;
+ struct iwl_bt_coex_cmd_old *bt_cmd;
struct iwl_host_cmd cmd = {
.id = BT_CONFIG,
.len = { sizeof(*bt_cmd), },
@@ -570,6 +570,12 @@
int ret;
u32 flags;
+ if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_BT_COEX_SPLIT))
+ return iwl_send_bt_init_conf_old(mvm);
+
+ /* TODO */
+ return 0;
+
ret = iwl_send_bt_prio_tbl(mvm);
if (ret)
return ret;
@@ -584,13 +590,13 @@
if (unlikely(mvm->bt_force_ant_mode != BT_FORCE_ANT_DIS)) {
switch (mvm->bt_force_ant_mode) {
case BT_FORCE_ANT_AUTO:
- flags = BT_COEX_AUTO;
+ flags = BT_COEX_AUTO_OLD;
break;
case BT_FORCE_ANT_BT:
- flags = BT_COEX_BT;
+ flags = BT_COEX_BT_OLD;
break;
case BT_FORCE_ANT_WIFI:
- flags = BT_COEX_WIFI;
+ flags = BT_COEX_WIFI_OLD;
break;
default:
WARN_ON(1);
@@ -611,7 +617,7 @@
bt_cmd->override_secondary_lut = BT_COEX_INVALID_LUT;
flags = iwlwifi_mod_params.bt_coex_active ?
- BT_COEX_NW : BT_COEX_DISABLE;
+ BT_COEX_NW_OLD : BT_COEX_DISABLE_OLD;
bt_cmd->flags = cpu_to_le32(flags);
bt_cmd->valid_bit_msk = cpu_to_le32(BT_VALID_ENABLE |
@@ -680,8 +686,8 @@
bool reduced_tx_power)
{
enum iwl_bt_kill_msk bt_kill_msk;
- struct iwl_bt_coex_cmd *bt_cmd;
- struct iwl_bt_coex_profile_notif *notif = &mvm->last_bt_notif;
+ struct iwl_bt_coex_cmd_old *bt_cmd;
+ struct iwl_bt_coex_profile_notif_old *notif = &mvm->last_bt_notif;
struct iwl_host_cmd cmd = {
.id = BT_CONFIG,
.data[0] = &bt_cmd,
@@ -722,7 +728,7 @@
if (!bt_cmd)
return -ENOMEM;
cmd.data[0] = bt_cmd;
- bt_cmd->flags = cpu_to_le32(BT_COEX_NW);
+ bt_cmd->flags = cpu_to_le32(BT_COEX_NW_OLD);
bt_cmd->kill_ack_msk = cpu_to_le32(iwl_bt_ack_kill_msk[bt_kill_msk]);
bt_cmd->kill_cts_msk = cpu_to_le32(iwl_bt_cts_kill_msk[bt_kill_msk]);
@@ -743,7 +749,7 @@
static int iwl_mvm_bt_coex_reduced_txp(struct iwl_mvm *mvm, u8 sta_id,
bool enable)
{
- struct iwl_bt_coex_cmd *bt_cmd;
+ struct iwl_bt_coex_cmd_old *bt_cmd;
/* Send ASYNC since this can be sent from an atomic context */
struct iwl_host_cmd cmd = {
.id = BT_CONFIG,
@@ -766,7 +772,7 @@
if (!bt_cmd)
return -ENOMEM;
cmd.data[0] = bt_cmd;
- bt_cmd->flags = cpu_to_le32(BT_COEX_NW);
+ bt_cmd->flags = cpu_to_le32(BT_COEX_NW_OLD);
bt_cmd->valid_bit_msk =
cpu_to_le32(BT_VALID_ENABLE | BT_VALID_REDUCED_TX_POWER);
@@ -787,7 +793,7 @@
}
struct iwl_bt_iterator_data {
- struct iwl_bt_coex_profile_notif *notif;
+ struct iwl_bt_coex_profile_notif_old *notif;
struct iwl_mvm *mvm;
u32 num_bss_ifaces;
bool reduced_tx_power;
@@ -977,7 +983,7 @@
.notif = &mvm->last_bt_notif,
.reduced_tx_power = true,
};
- struct iwl_bt_coex_ci_cmd cmd = {};
+ struct iwl_bt_coex_ci_cmd_old cmd = {};
u8 ci_bw_idx;
/* Ignore updates if we are in force mode */
@@ -1063,8 +1069,13 @@
struct iwl_device_cmd *dev_cmd)
{
struct iwl_rx_packet *pkt = rxb_addr(rxb);
- struct iwl_bt_coex_profile_notif *notif = (void *)pkt->data;
+ struct iwl_bt_coex_profile_notif_old *notif = (void *)pkt->data;
+ if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_BT_COEX_SPLIT))
+ return iwl_mvm_rx_bt_coex_notif_old(mvm, rxb, dev_cmd);
+
+ /* TODO */
+ return 0;
IWL_DEBUG_COEX(mvm, "BT Coex Notification received\n");
IWL_DEBUG_COEX(mvm, "\tBT status: %s\n",
@@ -1148,6 +1159,14 @@
};
int ret;
+ if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_BT_COEX_SPLIT)) {
+ iwl_mvm_bt_rssi_event_old(mvm, vif, rssi_event);
+ return;
+ }
+
+ /* TODO */
+ return;
+
lockdep_assert_held(&mvm->mutex);
/* Ignore updates if we are in force mode */
@@ -1206,6 +1225,12 @@
struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
enum iwl_bt_coex_lut_type lut_type;
+ if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_BT_COEX_SPLIT))
+ return iwl_mvm_coex_agg_time_limit_old(mvm, sta);
+
+ /* TODO */
+ return LINK_QUAL_AGG_TIME_LIMIT_DEF;
+
if (le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) <
BT_HIGH_TRAFFIC)
return LINK_QUAL_AGG_TIME_LIMIT_DEF;
@@ -1228,6 +1253,12 @@
struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
enum iwl_bt_coex_lut_type lut_type;
+ if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_BT_COEX_SPLIT))
+ return iwl_mvm_coex_agg_time_limit_old(mvm, sta);
+
+ return true;
+
+ /* TODO */
if (mvm->last_bt_notif.ttc_enabled)
return true;
@@ -1248,6 +1279,9 @@
bool iwl_mvm_bt_coex_is_shared_ant_avail(struct iwl_mvm *mvm)
{
+ if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_BT_COEX_SPLIT))
+ return iwl_mvm_bt_coex_is_shared_ant_avail_old(mvm);
+
return le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) == BT_OFF;
}
@@ -1256,6 +1290,12 @@
{
u32 bt_activity = le32_to_cpu(mvm->last_bt_notif.bt_activity_grading);
+ if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_BT_COEX_SPLIT))
+ return iwl_mvm_bt_coex_is_tpc_allowed_old(mvm, band);
+
+ /* TODO */
+ return false;
+
if (band != IEEE80211_BAND_2GHZ)
return false;
@@ -1296,6 +1336,14 @@
void iwl_mvm_bt_coex_vif_change(struct iwl_mvm *mvm)
{
+ if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_BT_COEX_SPLIT)) {
+ iwl_mvm_bt_coex_vif_change_old(mvm);
+ return;
+ }
+
+ /* TODO */
+ return;
+
iwl_mvm_bt_coex_notif_handle(mvm);
}
@@ -1309,13 +1357,19 @@
int ret;
u8 lut;
- struct iwl_bt_coex_cmd *bt_cmd;
+ struct iwl_bt_coex_cmd_old *bt_cmd;
struct iwl_host_cmd cmd = {
.id = BT_CONFIG,
.len = { sizeof(*bt_cmd), },
.dataflags = { IWL_HCMD_DFL_NOCOPY, },
};
+ if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_BT_COEX_SPLIT))
+ return iwl_mvm_rx_ant_coupling_notif_old(mvm, rxb, dev_cmd);
+
+ /* TODO */
+ return 0;
+
if (!IWL_MVM_BT_COEX_CORUNNING)
return 0;
@@ -1354,7 +1408,7 @@
return 0;
cmd.data[0] = bt_cmd;
- bt_cmd->flags = cpu_to_le32(BT_COEX_NW);
+ bt_cmd->flags = cpu_to_le32(BT_COEX_NW_OLD);
bt_cmd->valid_bit_msk |= cpu_to_le32(BT_VALID_ENABLE |
BT_VALID_CORUN_LUT_20 |
BT_VALID_CORUN_LUT_40);