diff options
author | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2014-05-28 05:06:41 -0400 |
---|---|---|
committer | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2014-06-24 14:55:34 -0400 |
commit | a39979a8c3e71eac72f43568b2535da60099b8e4 (patch) | |
tree | e78e2f2ffeafc5035144710f0538355e14994b7e /drivers/net/wireless/iwlwifi | |
parent | 5daddc99024b952bb4e66452febd2175fff8d26e (diff) |
iwlwifi: mvm: BT Coex - allow to force the antenna allocation
This can be used for testing.
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/coex.c | 39 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/debugfs.c | 39 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/fw-api-coex.h | 6 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/mvm.h | 10 |
4 files changed, 94 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/coex.c b/drivers/net/wireless/iwlwifi/mvm/coex.c index c8c3b38228f0..b2003d82260a 100644 --- a/drivers/net/wireless/iwlwifi/mvm/coex.c +++ b/drivers/net/wireless/iwlwifi/mvm/coex.c | |||
@@ -106,6 +106,9 @@ static const u8 iwl_bt_prio_tbl[BT_COEX_PRIO_TBL_EVT_MAX] = { | |||
106 | 106 | ||
107 | static int iwl_send_bt_prio_tbl(struct iwl_mvm *mvm) | 107 | static int iwl_send_bt_prio_tbl(struct iwl_mvm *mvm) |
108 | { | 108 | { |
109 | if (unlikely(mvm->bt_force_ant_mode != BT_FORCE_ANT_DIS)) | ||
110 | return 0; | ||
111 | |||
109 | return iwl_mvm_send_cmd_pdu(mvm, BT_COEX_PRIO_TABLE, 0, | 112 | return iwl_mvm_send_cmd_pdu(mvm, BT_COEX_PRIO_TABLE, 0, |
110 | sizeof(struct iwl_bt_coex_prio_tbl_cmd), | 113 | sizeof(struct iwl_bt_coex_prio_tbl_cmd), |
111 | &iwl_bt_prio_tbl); | 114 | &iwl_bt_prio_tbl); |
@@ -578,6 +581,29 @@ int iwl_send_bt_init_conf(struct iwl_mvm *mvm) | |||
578 | return -ENOMEM; | 581 | return -ENOMEM; |
579 | cmd.data[0] = bt_cmd; | 582 | cmd.data[0] = bt_cmd; |
580 | 583 | ||
584 | lockdep_assert_held(&mvm->mutex); | ||
585 | |||
586 | if (unlikely(mvm->bt_force_ant_mode != BT_FORCE_ANT_DIS)) { | ||
587 | switch (mvm->bt_force_ant_mode) { | ||
588 | case BT_FORCE_ANT_AUTO: | ||
589 | flags = BT_COEX_AUTO; | ||
590 | break; | ||
591 | case BT_FORCE_ANT_BT: | ||
592 | flags = BT_COEX_BT; | ||
593 | break; | ||
594 | case BT_FORCE_ANT_WIFI: | ||
595 | flags = BT_COEX_WIFI; | ||
596 | break; | ||
597 | default: | ||
598 | WARN_ON(1); | ||
599 | flags = 0; | ||
600 | } | ||
601 | |||
602 | bt_cmd->flags = cpu_to_le32(flags); | ||
603 | bt_cmd->valid_bit_msk = cpu_to_le32(BT_VALID_ENABLE); | ||
604 | goto send_cmd; | ||
605 | } | ||
606 | |||
581 | bt_cmd->max_kill = 5; | 607 | bt_cmd->max_kill = 5; |
582 | bt_cmd->bt4_antenna_isolation_thr = BT_ANTENNA_COUPLING_THRESHOLD; | 608 | bt_cmd->bt4_antenna_isolation_thr = BT_ANTENNA_COUPLING_THRESHOLD; |
583 | bt_cmd->bt4_antenna_isolation = iwlwifi_mod_params.ant_coupling; | 609 | bt_cmd->bt4_antenna_isolation = iwlwifi_mod_params.ant_coupling; |
@@ -642,6 +668,7 @@ int iwl_send_bt_init_conf(struct iwl_mvm *mvm) | |||
642 | bt_cmd->kill_cts_msk = | 668 | bt_cmd->kill_cts_msk = |
643 | cpu_to_le32(iwl_bt_cts_kill_msk[BT_KILL_MSK_DEFAULT]); | 669 | cpu_to_le32(iwl_bt_cts_kill_msk[BT_KILL_MSK_DEFAULT]); |
644 | 670 | ||
671 | send_cmd: | ||
645 | memset(&mvm->last_bt_notif, 0, sizeof(mvm->last_bt_notif)); | 672 | memset(&mvm->last_bt_notif, 0, sizeof(mvm->last_bt_notif)); |
646 | memset(&mvm->last_bt_ci_cmd, 0, sizeof(mvm->last_bt_ci_cmd)); | 673 | memset(&mvm->last_bt_ci_cmd, 0, sizeof(mvm->last_bt_ci_cmd)); |
647 | 674 | ||
@@ -955,6 +982,10 @@ static void iwl_mvm_bt_coex_notif_handle(struct iwl_mvm *mvm) | |||
955 | struct iwl_bt_coex_ci_cmd cmd = {}; | 982 | struct iwl_bt_coex_ci_cmd cmd = {}; |
956 | u8 ci_bw_idx; | 983 | u8 ci_bw_idx; |
957 | 984 | ||
985 | /* Ignore updates if we are in force mode */ | ||
986 | if (unlikely(mvm->bt_force_ant_mode != BT_FORCE_ANT_DIS)) | ||
987 | return; | ||
988 | |||
958 | rcu_read_lock(); | 989 | rcu_read_lock(); |
959 | ieee80211_iterate_active_interfaces_atomic( | 990 | ieee80211_iterate_active_interfaces_atomic( |
960 | mvm->hw, IEEE80211_IFACE_ITER_NORMAL, | 991 | mvm->hw, IEEE80211_IFACE_ITER_NORMAL, |
@@ -1121,6 +1152,10 @@ void iwl_mvm_bt_rssi_event(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | |||
1121 | 1152 | ||
1122 | lockdep_assert_held(&mvm->mutex); | 1153 | lockdep_assert_held(&mvm->mutex); |
1123 | 1154 | ||
1155 | /* Ignore updates if we are in force mode */ | ||
1156 | if (unlikely(mvm->bt_force_ant_mode != BT_FORCE_ANT_DIS)) | ||
1157 | return; | ||
1158 | |||
1124 | /* | 1159 | /* |
1125 | * Rssi update while not associated - can happen since the statistics | 1160 | * Rssi update while not associated - can happen since the statistics |
1126 | * are handled asynchronously | 1161 | * are handled asynchronously |
@@ -1274,6 +1309,10 @@ int iwl_mvm_rx_ant_coupling_notif(struct iwl_mvm *mvm, | |||
1274 | 1309 | ||
1275 | lockdep_assert_held(&mvm->mutex); | 1310 | lockdep_assert_held(&mvm->mutex); |
1276 | 1311 | ||
1312 | /* Ignore updates if we are in force mode */ | ||
1313 | if (unlikely(mvm->bt_force_ant_mode != BT_FORCE_ANT_DIS)) | ||
1314 | return 0; | ||
1315 | |||
1277 | if (ant_isolation == mvm->last_ant_isol) | 1316 | if (ant_isolation == mvm->last_ant_isol) |
1278 | return 0; | 1317 | return 0; |
1279 | 1318 | ||
diff --git a/drivers/net/wireless/iwlwifi/mvm/debugfs.c b/drivers/net/wireless/iwlwifi/mvm/debugfs.c index 29ca72695eaa..602bbd29ec5a 100644 --- a/drivers/net/wireless/iwlwifi/mvm/debugfs.c +++ b/drivers/net/wireless/iwlwifi/mvm/debugfs.c | |||
@@ -455,6 +455,43 @@ iwl_dbgfs_bt_tx_prio_write(struct iwl_mvm *mvm, char *buf, | |||
455 | return count; | 455 | return count; |
456 | } | 456 | } |
457 | 457 | ||
458 | static ssize_t | ||
459 | iwl_dbgfs_bt_force_ant_write(struct iwl_mvm *mvm, char *buf, | ||
460 | size_t count, loff_t *ppos) | ||
461 | { | ||
462 | static const char * const modes_str[BT_FORCE_ANT_MAX] = { | ||
463 | [BT_FORCE_ANT_DIS] = "dis", | ||
464 | [BT_FORCE_ANT_AUTO] = "auto", | ||
465 | [BT_FORCE_ANT_BT] = "bt", | ||
466 | [BT_FORCE_ANT_WIFI] = "wifi", | ||
467 | }; | ||
468 | int ret, bt_force_ant_mode; | ||
469 | |||
470 | for (bt_force_ant_mode = 0; | ||
471 | bt_force_ant_mode < ARRAY_SIZE(modes_str); | ||
472 | bt_force_ant_mode++) { | ||
473 | if (!strcmp(buf, modes_str[bt_force_ant_mode])) | ||
474 | break; | ||
475 | } | ||
476 | |||
477 | if (bt_force_ant_mode >= ARRAY_SIZE(modes_str)) | ||
478 | return -EINVAL; | ||
479 | |||
480 | ret = 0; | ||
481 | mutex_lock(&mvm->mutex); | ||
482 | if (mvm->bt_force_ant_mode == bt_force_ant_mode) | ||
483 | goto out; | ||
484 | |||
485 | mvm->bt_force_ant_mode = bt_force_ant_mode; | ||
486 | IWL_DEBUG_COEX(mvm, "Force mode: %s\n", | ||
487 | modes_str[mvm->bt_force_ant_mode]); | ||
488 | ret = iwl_send_bt_init_conf(mvm); | ||
489 | |||
490 | out: | ||
491 | mutex_unlock(&mvm->mutex); | ||
492 | return ret ?: count; | ||
493 | } | ||
494 | |||
458 | #define PRINT_STATS_LE32(_str, _val) \ | 495 | #define PRINT_STATS_LE32(_str, _val) \ |
459 | pos += scnprintf(buf + pos, bufsz - pos, \ | 496 | pos += scnprintf(buf + pos, bufsz - pos, \ |
460 | fmt_table, _str, \ | 497 | fmt_table, _str, \ |
@@ -1101,6 +1138,7 @@ MVM_DEBUGFS_READ_FILE_OPS(drv_rx_stats); | |||
1101 | MVM_DEBUGFS_WRITE_FILE_OPS(fw_restart, 10); | 1138 | MVM_DEBUGFS_WRITE_FILE_OPS(fw_restart, 10); |
1102 | MVM_DEBUGFS_WRITE_FILE_OPS(fw_nmi, 10); | 1139 | MVM_DEBUGFS_WRITE_FILE_OPS(fw_nmi, 10); |
1103 | MVM_DEBUGFS_WRITE_FILE_OPS(bt_tx_prio, 10); | 1140 | MVM_DEBUGFS_WRITE_FILE_OPS(bt_tx_prio, 10); |
1141 | MVM_DEBUGFS_WRITE_FILE_OPS(bt_force_ant, 10); | ||
1104 | MVM_DEBUGFS_READ_WRITE_FILE_OPS(scan_ant_rxchain, 8); | 1142 | MVM_DEBUGFS_READ_WRITE_FILE_OPS(scan_ant_rxchain, 8); |
1105 | MVM_DEBUGFS_READ_WRITE_FILE_OPS(d0i3_refs, 8); | 1143 | MVM_DEBUGFS_READ_WRITE_FILE_OPS(d0i3_refs, 8); |
1106 | 1144 | ||
@@ -1142,6 +1180,7 @@ int iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, struct dentry *dbgfs_dir) | |||
1142 | MVM_DEBUGFS_ADD_FILE(fw_restart, mvm->debugfs_dir, S_IWUSR); | 1180 | MVM_DEBUGFS_ADD_FILE(fw_restart, mvm->debugfs_dir, S_IWUSR); |
1143 | MVM_DEBUGFS_ADD_FILE(fw_nmi, mvm->debugfs_dir, S_IWUSR); | 1181 | MVM_DEBUGFS_ADD_FILE(fw_nmi, mvm->debugfs_dir, S_IWUSR); |
1144 | MVM_DEBUGFS_ADD_FILE(bt_tx_prio, mvm->debugfs_dir, S_IWUSR); | 1182 | MVM_DEBUGFS_ADD_FILE(bt_tx_prio, mvm->debugfs_dir, S_IWUSR); |
1183 | MVM_DEBUGFS_ADD_FILE(bt_force_ant, mvm->debugfs_dir, S_IWUSR); | ||
1145 | MVM_DEBUGFS_ADD_FILE(scan_ant_rxchain, mvm->debugfs_dir, | 1184 | MVM_DEBUGFS_ADD_FILE(scan_ant_rxchain, mvm->debugfs_dir, |
1146 | S_IWUSR | S_IRUSR); | 1185 | S_IWUSR | S_IRUSR); |
1147 | MVM_DEBUGFS_ADD_FILE(prph_reg, mvm->debugfs_dir, S_IWUSR | S_IRUSR); | 1186 | MVM_DEBUGFS_ADD_FILE(prph_reg, mvm->debugfs_dir, S_IWUSR | S_IRUSR); |
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api-coex.h b/drivers/net/wireless/iwlwifi/mvm/fw-api-coex.h index 5fe82c29c8ad..98175ca05e9d 100644 --- a/drivers/net/wireless/iwlwifi/mvm/fw-api-coex.h +++ b/drivers/net/wireless/iwlwifi/mvm/fw-api-coex.h | |||
@@ -76,6 +76,9 @@ | |||
76 | * @BT_COEX_2W: | 76 | * @BT_COEX_2W: |
77 | * @BT_COEX_3W: | 77 | * @BT_COEX_3W: |
78 | * @BT_COEX_NW: | 78 | * @BT_COEX_NW: |
79 | * @BT_COEX_AUTO: | ||
80 | * @BT_COEX_BT: Antenna is for BT (manufacuring tests) | ||
81 | * @BT_COEX_WIFI: Antenna is for BT (manufacuring tests) | ||
79 | * @BT_COEX_SYNC2SCO: | 82 | * @BT_COEX_SYNC2SCO: |
80 | * @BT_COEX_CORUNNING: | 83 | * @BT_COEX_CORUNNING: |
81 | * @BT_COEX_MPLUT: | 84 | * @BT_COEX_MPLUT: |
@@ -89,6 +92,9 @@ enum iwl_bt_coex_flags { | |||
89 | BT_COEX_2W = 0x1 << BT_COEX_MODE_POS, | 92 | BT_COEX_2W = 0x1 << BT_COEX_MODE_POS, |
90 | BT_COEX_3W = 0x2 << BT_COEX_MODE_POS, | 93 | BT_COEX_3W = 0x2 << BT_COEX_MODE_POS, |
91 | BT_COEX_NW = 0x3 << BT_COEX_MODE_POS, | 94 | BT_COEX_NW = 0x3 << BT_COEX_MODE_POS, |
95 | BT_COEX_AUTO = 0x5 << BT_COEX_MODE_POS, | ||
96 | BT_COEX_BT = 0x6 << BT_COEX_MODE_POS, | ||
97 | BT_COEX_WIFI = 0x7 << BT_COEX_MODE_POS, | ||
92 | BT_COEX_SYNC2SCO = BIT(7), | 98 | BT_COEX_SYNC2SCO = BIT(7), |
93 | BT_COEX_CORUNNING = BIT(8), | 99 | BT_COEX_CORUNNING = BIT(8), |
94 | BT_COEX_MPLUT = BIT(9), | 100 | BT_COEX_MPLUT = BIT(9), |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h b/drivers/net/wireless/iwlwifi/mvm/mvm.h index fcc6c29482d0..472ef09c1f5f 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h | |||
@@ -235,6 +235,15 @@ enum iwl_mvm_ref_type { | |||
235 | IWL_MVM_REF_COUNT, | 235 | IWL_MVM_REF_COUNT, |
236 | }; | 236 | }; |
237 | 237 | ||
238 | enum iwl_bt_force_ant_mode { | ||
239 | BT_FORCE_ANT_DIS = 0, | ||
240 | BT_FORCE_ANT_AUTO, | ||
241 | BT_FORCE_ANT_BT, | ||
242 | BT_FORCE_ANT_WIFI, | ||
243 | |||
244 | BT_FORCE_ANT_MAX, | ||
245 | }; | ||
246 | |||
238 | /** | 247 | /** |
239 | * struct iwl_mvm_vif_bf_data - beacon filtering related data | 248 | * struct iwl_mvm_vif_bf_data - beacon filtering related data |
240 | * @bf_enabled: indicates if beacon filtering is enabled | 249 | * @bf_enabled: indicates if beacon filtering is enabled |
@@ -629,6 +638,7 @@ struct iwl_mvm { | |||
629 | u32 last_ant_isol; | 638 | u32 last_ant_isol; |
630 | u8 last_corun_lut; | 639 | u8 last_corun_lut; |
631 | u8 bt_tx_prio; | 640 | u8 bt_tx_prio; |
641 | enum iwl_bt_force_ant_mode bt_force_ant_mode; | ||
632 | 642 | ||
633 | /* Thermal Throttling and CTkill */ | 643 | /* Thermal Throttling and CTkill */ |
634 | struct iwl_mvm_tt_mgmt thermal_throttle; | 644 | struct iwl_mvm_tt_mgmt thermal_throttle; |