aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rs.c14
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debugfs.c7
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-power.c78
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-power.h50
6 files changed, 76 insertions, 76 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
index 0c3ed23ed775..21331552ff2c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
@@ -1401,7 +1401,7 @@ static int rs_move_legacy_other(struct iwl_priv *priv,
1401 if (!iwl_ht_enabled(priv)) 1401 if (!iwl_ht_enabled(priv))
1402 /* stay in Legacy */ 1402 /* stay in Legacy */
1403 tbl->action = IWL_LEGACY_SWITCH_ANTENNA1; 1403 tbl->action = IWL_LEGACY_SWITCH_ANTENNA1;
1404 else if (iwl_tx_ant_restriction(priv) == IWL_TX_SINGLE && 1404 else if (iwl_tx_ant_restriction(priv) == IWL_ANT_OK_SINGLE &&
1405 tbl->action > IWL_LEGACY_SWITCH_SISO) 1405 tbl->action > IWL_LEGACY_SWITCH_SISO)
1406 tbl->action = IWL_LEGACY_SWITCH_SISO; 1406 tbl->action = IWL_LEGACY_SWITCH_SISO;
1407 for (; ;) { 1407 for (; ;) {
@@ -1535,7 +1535,7 @@ static int rs_move_siso_to_other(struct iwl_priv *priv,
1535 u8 update_search_tbl_counter = 0; 1535 u8 update_search_tbl_counter = 0;
1536 int ret; 1536 int ret;
1537 1537
1538 if (iwl_tx_ant_restriction(priv) == IWL_TX_SINGLE && 1538 if (iwl_tx_ant_restriction(priv) == IWL_ANT_OK_SINGLE &&
1539 tbl->action > IWL_SISO_SWITCH_ANTENNA2) { 1539 tbl->action > IWL_SISO_SWITCH_ANTENNA2) {
1540 /* stay in SISO */ 1540 /* stay in SISO */
1541 tbl->action = IWL_SISO_SWITCH_ANTENNA1; 1541 tbl->action = IWL_SISO_SWITCH_ANTENNA1;
@@ -1674,7 +1674,7 @@ static int rs_move_mimo2_to_other(struct iwl_priv *priv,
1674 u8 update_search_tbl_counter = 0; 1674 u8 update_search_tbl_counter = 0;
1675 int ret; 1675 int ret;
1676 1676
1677 if ((iwl_tx_ant_restriction(priv) == IWL_TX_SINGLE) && 1677 if ((iwl_tx_ant_restriction(priv) == IWL_ANT_OK_SINGLE) &&
1678 (tbl->action < IWL_MIMO2_SWITCH_SISO_A || 1678 (tbl->action < IWL_MIMO2_SWITCH_SISO_A ||
1679 tbl->action > IWL_MIMO2_SWITCH_SISO_C)) { 1679 tbl->action > IWL_MIMO2_SWITCH_SISO_C)) {
1680 /* switch in SISO */ 1680 /* switch in SISO */
@@ -1816,7 +1816,7 @@ static int rs_move_mimo3_to_other(struct iwl_priv *priv,
1816 int ret; 1816 int ret;
1817 u8 update_search_tbl_counter = 0; 1817 u8 update_search_tbl_counter = 0;
1818 1818
1819 if ((iwl_tx_ant_restriction(priv) == IWL_TX_SINGLE) && 1819 if ((iwl_tx_ant_restriction(priv) == IWL_ANT_OK_SINGLE) &&
1820 (tbl->action < IWL_MIMO3_SWITCH_SISO_A || 1820 (tbl->action < IWL_MIMO3_SWITCH_SISO_A ||
1821 tbl->action > IWL_MIMO3_SWITCH_SISO_C)) { 1821 tbl->action > IWL_MIMO3_SWITCH_SISO_C)) {
1822 /* switch in SISO */ 1822 /* switch in SISO */
@@ -2202,7 +2202,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
2202 2202
2203 /* If we are searching for better modulation mode, check success. */ 2203 /* If we are searching for better modulation mode, check success. */
2204 if (lq_sta->search_better_tbl && 2204 if (lq_sta->search_better_tbl &&
2205 (iwl_tx_ant_restriction(priv) == IWL_TX_MULTI)) { 2205 (iwl_tx_ant_restriction(priv) == IWL_ANT_OK_MULTI)) {
2206 /* If good success, continue using the "search" mode; 2206 /* If good success, continue using the "search" mode;
2207 * no need to send new link quality command, since we're 2207 * no need to send new link quality command, since we're
2208 * continuing to use the setup that we've been trying. */ 2208 * continuing to use the setup that we've been trying. */
@@ -2332,7 +2332,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
2332 scale_action = 0; 2332 scale_action = 0;
2333 if (!iwl_ht_enabled(priv) && !is_legacy(tbl->lq_type)) 2333 if (!iwl_ht_enabled(priv) && !is_legacy(tbl->lq_type))
2334 scale_action = -1; 2334 scale_action = -1;
2335 if (iwl_tx_ant_restriction(priv) != IWL_TX_MULTI && 2335 if (iwl_tx_ant_restriction(priv) != IWL_ANT_OK_MULTI &&
2336 (is_mimo2(tbl->lq_type) || is_mimo3(tbl->lq_type))) 2336 (is_mimo2(tbl->lq_type) || is_mimo3(tbl->lq_type)))
2337 scale_action = -1; 2337 scale_action = -1;
2338 switch (scale_action) { 2338 switch (scale_action) {
@@ -2368,7 +2368,7 @@ lq_update:
2368 rate = rs_update_rate_tbl(priv, lq_sta, 2368 rate = rs_update_rate_tbl(priv, lq_sta,
2369 tbl, index, is_green); 2369 tbl, index, is_green);
2370 2370
2371 if (iwl_tx_ant_restriction(priv) == IWL_TX_MULTI) { 2371 if (iwl_tx_ant_restriction(priv) == IWL_ANT_OK_MULTI) {
2372 /* Should we stay with this modulation mode, 2372 /* Should we stay with this modulation mode,
2373 * or search for a new one? */ 2373 * or search for a new one? */
2374 rs_stay_in_table(lq_sta); 2374 rs_stay_in_table(lq_sta);
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 79170a9037a1..22961e906cb1 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -2214,7 +2214,7 @@ void iwl_rf_kill_ct_config(struct iwl_priv *priv)
2214 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, 2214 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR,
2215 CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT); 2215 CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT);
2216 spin_unlock_irqrestore(&priv->lock, flags); 2216 spin_unlock_irqrestore(&priv->lock, flags);
2217 priv->power_data.ct_kill_toggle = false; 2217 priv->thermal_throttle.ct_kill_toggle = false;
2218 2218
2219 switch (priv->hw_rev & CSR_HW_REV_TYPE_MSK) { 2219 switch (priv->hw_rev & CSR_HW_REV_TYPE_MSK) {
2220 case CSR_HW_REV_TYPE_1000: 2220 case CSR_HW_REV_TYPE_1000:
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
index 1ad4ff6bfff7..7b578d41101f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
@@ -704,7 +704,7 @@ static ssize_t iwl_dbgfs_thermal_throttling_read(struct file *file,
704 size_t count, loff_t *ppos) 704 size_t count, loff_t *ppos)
705{ 705{
706 struct iwl_priv *priv = (struct iwl_priv *)file->private_data; 706 struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
707 struct iwl_tt_mgmt *tt = &priv->power_data.tt; 707 struct iwl_tt_mgmt *tt = &priv->thermal_throttle;
708 struct iwl_tt_restriction *restriction; 708 struct iwl_tt_restriction *restriction;
709 char buf[100]; 709 char buf[100];
710 int pos = 0; 710 int pos = 0;
@@ -713,12 +713,11 @@ static ssize_t iwl_dbgfs_thermal_throttling_read(struct file *file,
713 713
714 pos += scnprintf(buf + pos, bufsz - pos, 714 pos += scnprintf(buf + pos, bufsz - pos,
715 "Thermal Throttling Mode: %s\n", 715 "Thermal Throttling Mode: %s\n",
716 (priv->power_data.adv_tt) 716 tt->advanced_tt ? "Advance" : "Legacy");
717 ? "Advance" : "Legacy");
718 pos += scnprintf(buf + pos, bufsz - pos, 717 pos += scnprintf(buf + pos, bufsz - pos,
719 "Thermal Throttling State: %d\n", 718 "Thermal Throttling State: %d\n",
720 tt->state); 719 tt->state);
721 if (priv->power_data.adv_tt) { 720 if (tt->advanced_tt) {
722 restriction = tt->restriction + tt->state; 721 restriction = tt->restriction + tt->state;
723 pos += scnprintf(buf + pos, bufsz - pos, 722 pos += scnprintf(buf + pos, bufsz - pos,
724 "Tx mode: %d\n", 723 "Tx mode: %d\n",
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index 35d07a813252..1aa2ae6d0756 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -1111,6 +1111,7 @@ struct iwl_priv {
1111 struct isr_statistics isr_stats; 1111 struct isr_statistics isr_stats;
1112 1112
1113 struct iwl_power_mgr power_data; 1113 struct iwl_power_mgr power_data;
1114 struct iwl_tt_mgmt thermal_throttle;
1114 1115
1115 struct iwl_notif_statistics statistics; 1116 struct iwl_notif_statistics statistics;
1116 unsigned long last_statistics_time; 1117 unsigned long last_statistics_time;
diff --git a/drivers/net/wireless/iwlwifi/iwl-power.c b/drivers/net/wireless/iwlwifi/iwl-power.c
index 9e8916d15ecf..27ad59d8643e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-power.c
+++ b/drivers/net/wireless/iwlwifi/iwl-power.c
@@ -132,10 +132,10 @@ static const struct iwl_tt_trans tt_range_3[IWL_TI_STATE_MAX - 1] = {
132 132
133/* Advance Thermal Throttling default restriction table */ 133/* Advance Thermal Throttling default restriction table */
134static const struct iwl_tt_restriction restriction_range[IWL_TI_STATE_MAX] = { 134static const struct iwl_tt_restriction restriction_range[IWL_TI_STATE_MAX] = {
135 {IWL_TX_MULTI, true, IWL_RX_MULTI}, 135 {IWL_ANT_OK_MULTI, IWL_ANT_OK_MULTI, true },
136 {IWL_TX_SINGLE, true, IWL_RX_MULTI}, 136 {IWL_ANT_OK_SINGLE, IWL_ANT_OK_MULTI, true },
137 {IWL_TX_SINGLE, false, IWL_RX_SINGLE}, 137 {IWL_ANT_OK_SINGLE, IWL_ANT_OK_SINGLE, false },
138 {IWL_TX_NONE, false, IWL_RX_NONE} 138 {IWL_ANT_OK_NONE, IWL_ANT_OK_NONE, false }
139}; 139};
140 140
141/* set card power command */ 141/* set card power command */
@@ -251,7 +251,7 @@ int iwl_power_update_mode(struct iwl_priv *priv, bool force)
251{ 251{
252 struct iwl_power_mgr *setting = &(priv->power_data); 252 struct iwl_power_mgr *setting = &(priv->power_data);
253 int ret = 0; 253 int ret = 0;
254 struct iwl_tt_mgmt *tt = &priv->power_data.tt; 254 struct iwl_tt_mgmt *tt = &priv->thermal_throttle;
255 u16 uninitialized_var(final_mode); 255 u16 uninitialized_var(final_mode);
256 bool update_chains; 256 bool update_chains;
257 257
@@ -317,35 +317,35 @@ EXPORT_SYMBOL(iwl_power_set_user_mode);
317 317
318bool iwl_ht_enabled(struct iwl_priv *priv) 318bool iwl_ht_enabled(struct iwl_priv *priv)
319{ 319{
320 struct iwl_tt_mgmt *tt = &priv->power_data.tt; 320 struct iwl_tt_mgmt *tt = &priv->thermal_throttle;
321 struct iwl_tt_restriction *restriction; 321 struct iwl_tt_restriction *restriction;
322 322
323 if (!priv->power_data.adv_tt) 323 if (!priv->thermal_throttle.advanced_tt)
324 return true; 324 return true;
325 restriction = tt->restriction + tt->state; 325 restriction = tt->restriction + tt->state;
326 return restriction->is_ht; 326 return restriction->is_ht;
327} 327}
328EXPORT_SYMBOL(iwl_ht_enabled); 328EXPORT_SYMBOL(iwl_ht_enabled);
329 329
330u8 iwl_tx_ant_restriction(struct iwl_priv *priv) 330enum iwl_antenna_ok iwl_tx_ant_restriction(struct iwl_priv *priv)
331{ 331{
332 struct iwl_tt_mgmt *tt = &priv->power_data.tt; 332 struct iwl_tt_mgmt *tt = &priv->thermal_throttle;
333 struct iwl_tt_restriction *restriction; 333 struct iwl_tt_restriction *restriction;
334 334
335 if (!priv->power_data.adv_tt) 335 if (!priv->thermal_throttle.advanced_tt)
336 return IWL_TX_MULTI; 336 return IWL_ANT_OK_MULTI;
337 restriction = tt->restriction + tt->state; 337 restriction = tt->restriction + tt->state;
338 return restriction->tx_stream; 338 return restriction->tx_stream;
339} 339}
340EXPORT_SYMBOL(iwl_tx_ant_restriction); 340EXPORT_SYMBOL(iwl_tx_ant_restriction);
341 341
342u8 iwl_rx_ant_restriction(struct iwl_priv *priv) 342enum iwl_antenna_ok iwl_rx_ant_restriction(struct iwl_priv *priv)
343{ 343{
344 struct iwl_tt_mgmt *tt = &priv->power_data.tt; 344 struct iwl_tt_mgmt *tt = &priv->thermal_throttle;
345 struct iwl_tt_restriction *restriction; 345 struct iwl_tt_restriction *restriction;
346 346
347 if (!priv->power_data.adv_tt) 347 if (!priv->thermal_throttle.advanced_tt)
348 return IWL_RX_MULTI; 348 return IWL_ANT_OK_MULTI;
349 restriction = tt->restriction + tt->state; 349 restriction = tt->restriction + tt->state;
350 return restriction->rx_stream; 350 return restriction->rx_stream;
351} 351}
@@ -364,21 +364,21 @@ EXPORT_SYMBOL(iwl_rx_ant_restriction);
364static void iwl_tt_check_exit_ct_kill(unsigned long data) 364static void iwl_tt_check_exit_ct_kill(unsigned long data)
365{ 365{
366 struct iwl_priv *priv = (struct iwl_priv *)data; 366 struct iwl_priv *priv = (struct iwl_priv *)data;
367 struct iwl_tt_mgmt *tt = &priv->power_data.tt; 367 struct iwl_tt_mgmt *tt = &priv->thermal_throttle;
368 unsigned long flags; 368 unsigned long flags;
369 369
370 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 370 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
371 return; 371 return;
372 372
373 if (tt->state == IWL_TI_CT_KILL) { 373 if (tt->state == IWL_TI_CT_KILL) {
374 if (priv->power_data.ct_kill_toggle) { 374 if (priv->thermal_throttle.ct_kill_toggle) {
375 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, 375 iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR,
376 CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT); 376 CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT);
377 priv->power_data.ct_kill_toggle = false; 377 priv->thermal_throttle.ct_kill_toggle = false;
378 } else { 378 } else {
379 iwl_write32(priv, CSR_UCODE_DRV_GP1_SET, 379 iwl_write32(priv, CSR_UCODE_DRV_GP1_SET,
380 CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT); 380 CSR_UCODE_DRV_GP1_REG_BIT_CT_KILL_EXIT);
381 priv->power_data.ct_kill_toggle = true; 381 priv->thermal_throttle.ct_kill_toggle = true;
382 } 382 }
383 iwl_read32(priv, CSR_UCODE_DRV_GP1); 383 iwl_read32(priv, CSR_UCODE_DRV_GP1);
384 spin_lock_irqsave(&priv->reg_lock, flags); 384 spin_lock_irqsave(&priv->reg_lock, flags);
@@ -389,7 +389,7 @@ static void iwl_tt_check_exit_ct_kill(unsigned long data)
389 /* Reschedule the ct_kill timer to occur in 389 /* Reschedule the ct_kill timer to occur in
390 * CT_KILL_EXIT_DURATION seconds to ensure we get a 390 * CT_KILL_EXIT_DURATION seconds to ensure we get a
391 * thermal update */ 391 * thermal update */
392 mod_timer(&priv->power_data.ct_kill_exit_tm, jiffies + 392 mod_timer(&priv->thermal_throttle.ct_kill_exit_tm, jiffies +
393 CT_KILL_EXIT_DURATION * HZ); 393 CT_KILL_EXIT_DURATION * HZ);
394 } 394 }
395} 395}
@@ -403,7 +403,7 @@ static void iwl_perform_ct_kill_task(struct iwl_priv *priv,
403 ieee80211_stop_queues(priv->hw); 403 ieee80211_stop_queues(priv->hw);
404 IWL_DEBUG_POWER(priv, 404 IWL_DEBUG_POWER(priv,
405 "Schedule 5 seconds CT_KILL Timer\n"); 405 "Schedule 5 seconds CT_KILL Timer\n");
406 mod_timer(&priv->power_data.ct_kill_exit_tm, jiffies + 406 mod_timer(&priv->thermal_throttle.ct_kill_exit_tm, jiffies +
407 CT_KILL_EXIT_DURATION * HZ); 407 CT_KILL_EXIT_DURATION * HZ);
408 } else { 408 } else {
409 IWL_DEBUG_POWER(priv, "Wake all queues\n"); 409 IWL_DEBUG_POWER(priv, "Wake all queues\n");
@@ -427,7 +427,7 @@ static void iwl_perform_ct_kill_task(struct iwl_priv *priv,
427 */ 427 */
428static void iwl_legacy_tt_handler(struct iwl_priv *priv, s32 temp) 428static void iwl_legacy_tt_handler(struct iwl_priv *priv, s32 temp)
429{ 429{
430 struct iwl_tt_mgmt *tt = &priv->power_data.tt; 430 struct iwl_tt_mgmt *tt = &priv->thermal_throttle;
431 enum iwl_tt_state old_state; 431 enum iwl_tt_state old_state;
432 struct iwl_power_mgr *setting = &priv->power_data; 432 struct iwl_power_mgr *setting = &priv->power_data;
433 433
@@ -531,7 +531,7 @@ static void iwl_legacy_tt_handler(struct iwl_priv *priv, s32 temp)
531 */ 531 */
532static void iwl_advance_tt_handler(struct iwl_priv *priv, s32 temp) 532static void iwl_advance_tt_handler(struct iwl_priv *priv, s32 temp)
533{ 533{
534 struct iwl_tt_mgmt *tt = &priv->power_data.tt; 534 struct iwl_tt_mgmt *tt = &priv->thermal_throttle;
535 int i; 535 int i;
536 bool changed = false; 536 bool changed = false;
537 enum iwl_tt_state old_state; 537 enum iwl_tt_state old_state;
@@ -655,7 +655,7 @@ static void iwl_advance_tt_handler(struct iwl_priv *priv, s32 temp)
655static void iwl_bg_ct_enter(struct work_struct *work) 655static void iwl_bg_ct_enter(struct work_struct *work)
656{ 656{
657 struct iwl_priv *priv = container_of(work, struct iwl_priv, ct_enter); 657 struct iwl_priv *priv = container_of(work, struct iwl_priv, ct_enter);
658 struct iwl_tt_mgmt *tt = &priv->power_data.tt; 658 struct iwl_tt_mgmt *tt = &priv->thermal_throttle;
659 659
660 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 660 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
661 return; 661 return;
@@ -666,7 +666,7 @@ static void iwl_bg_ct_enter(struct work_struct *work)
666 if (tt->state != IWL_TI_CT_KILL) { 666 if (tt->state != IWL_TI_CT_KILL) {
667 IWL_ERR(priv, "Device reached critical temperature " 667 IWL_ERR(priv, "Device reached critical temperature "
668 "- ucode going to sleep!\n"); 668 "- ucode going to sleep!\n");
669 if (!priv->power_data.adv_tt) 669 if (!priv->thermal_throttle.advanced_tt)
670 iwl_legacy_tt_handler(priv, 670 iwl_legacy_tt_handler(priv,
671 IWL_MINIMAL_POWER_THRESHOLD); 671 IWL_MINIMAL_POWER_THRESHOLD);
672 else 672 else
@@ -683,7 +683,7 @@ static void iwl_bg_ct_enter(struct work_struct *work)
683static void iwl_bg_ct_exit(struct work_struct *work) 683static void iwl_bg_ct_exit(struct work_struct *work)
684{ 684{
685 struct iwl_priv *priv = container_of(work, struct iwl_priv, ct_exit); 685 struct iwl_priv *priv = container_of(work, struct iwl_priv, ct_exit);
686 struct iwl_tt_mgmt *tt = &priv->power_data.tt; 686 struct iwl_tt_mgmt *tt = &priv->thermal_throttle;
687 687
688 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 688 if (test_bit(STATUS_EXIT_PENDING, &priv->status))
689 return; 689 return;
@@ -692,13 +692,13 @@ static void iwl_bg_ct_exit(struct work_struct *work)
692 return; 692 return;
693 693
694 /* stop ct_kill_exit_tm timer */ 694 /* stop ct_kill_exit_tm timer */
695 del_timer_sync(&priv->power_data.ct_kill_exit_tm); 695 del_timer_sync(&priv->thermal_throttle.ct_kill_exit_tm);
696 696
697 if (tt->state == IWL_TI_CT_KILL) { 697 if (tt->state == IWL_TI_CT_KILL) {
698 IWL_ERR(priv, 698 IWL_ERR(priv,
699 "Device temperature below critical" 699 "Device temperature below critical"
700 "- ucode awake!\n"); 700 "- ucode awake!\n");
701 if (!priv->power_data.adv_tt) 701 if (!priv->thermal_throttle.advanced_tt)
702 iwl_legacy_tt_handler(priv, 702 iwl_legacy_tt_handler(priv,
703 IWL_REDUCED_PERFORMANCE_THRESHOLD_2); 703 IWL_REDUCED_PERFORMANCE_THRESHOLD_2);
704 else 704 else
@@ -737,7 +737,7 @@ static void iwl_bg_tt_work(struct work_struct *work)
737 if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) == CSR_HW_REV_TYPE_4965) 737 if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) == CSR_HW_REV_TYPE_4965)
738 temp = KELVIN_TO_CELSIUS(priv->temperature); 738 temp = KELVIN_TO_CELSIUS(priv->temperature);
739 739
740 if (!priv->power_data.adv_tt) 740 if (!priv->thermal_throttle.advanced_tt)
741 iwl_legacy_tt_handler(priv, temp); 741 iwl_legacy_tt_handler(priv, temp);
742 else 742 else
743 iwl_advance_tt_handler(priv, temp); 743 iwl_advance_tt_handler(priv, temp);
@@ -760,7 +760,7 @@ EXPORT_SYMBOL(iwl_tt_handler);
760 */ 760 */
761void iwl_tt_initialize(struct iwl_priv *priv) 761void iwl_tt_initialize(struct iwl_priv *priv)
762{ 762{
763 struct iwl_tt_mgmt *tt = &priv->power_data.tt; 763 struct iwl_tt_mgmt *tt = &priv->thermal_throttle;
764 struct iwl_power_mgr *setting = &priv->power_data; 764 struct iwl_power_mgr *setting = &priv->power_data;
765 int size = sizeof(struct iwl_tt_trans) * (IWL_TI_STATE_MAX - 1); 765 int size = sizeof(struct iwl_tt_trans) * (IWL_TI_STATE_MAX - 1);
766 struct iwl_tt_trans *transaction; 766 struct iwl_tt_trans *transaction;
@@ -772,9 +772,9 @@ void iwl_tt_initialize(struct iwl_priv *priv)
772 tt->state = IWL_TI_0; 772 tt->state = IWL_TI_0;
773 tt->sys_power_mode = setting->power_mode; 773 tt->sys_power_mode = setting->power_mode;
774 tt->tt_power_mode = tt->sys_power_mode; 774 tt->tt_power_mode = tt->sys_power_mode;
775 init_timer(&priv->power_data.ct_kill_exit_tm); 775 init_timer(&priv->thermal_throttle.ct_kill_exit_tm);
776 priv->power_data.ct_kill_exit_tm.data = (unsigned long)priv; 776 priv->thermal_throttle.ct_kill_exit_tm.data = (unsigned long)priv;
777 priv->power_data.ct_kill_exit_tm.function = iwl_tt_check_exit_ct_kill; 777 priv->thermal_throttle.ct_kill_exit_tm.function = iwl_tt_check_exit_ct_kill;
778 778
779 /* setup deferred ct kill work */ 779 /* setup deferred ct kill work */
780 INIT_WORK(&priv->tt_work, iwl_bg_tt_work); 780 INIT_WORK(&priv->tt_work, iwl_bg_tt_work);
@@ -792,7 +792,7 @@ void iwl_tt_initialize(struct iwl_priv *priv)
792 GFP_KERNEL); 792 GFP_KERNEL);
793 if (!tt->restriction || !tt->transaction) { 793 if (!tt->restriction || !tt->transaction) {
794 IWL_ERR(priv, "Fallback to Legacy Throttling\n"); 794 IWL_ERR(priv, "Fallback to Legacy Throttling\n");
795 priv->power_data.adv_tt = false; 795 priv->thermal_throttle.advanced_tt = false;
796 kfree(tt->restriction); 796 kfree(tt->restriction);
797 tt->restriction = NULL; 797 tt->restriction = NULL;
798 kfree(tt->transaction); 798 kfree(tt->transaction);
@@ -814,12 +814,12 @@ void iwl_tt_initialize(struct iwl_priv *priv)
814 IWL_TI_STATE_MAX; 814 IWL_TI_STATE_MAX;
815 memcpy(tt->restriction, 815 memcpy(tt->restriction,
816 &restriction_range[0], size); 816 &restriction_range[0], size);
817 priv->power_data.adv_tt = true; 817 priv->thermal_throttle.advanced_tt = true;
818 } 818 }
819 break; 819 break;
820 default: 820 default:
821 IWL_DEBUG_POWER(priv, "Legacy Thermal Throttling\n"); 821 IWL_DEBUG_POWER(priv, "Legacy Thermal Throttling\n");
822 priv->power_data.adv_tt = false; 822 priv->thermal_throttle.advanced_tt = false;
823 break; 823 break;
824 } 824 }
825} 825}
@@ -828,15 +828,15 @@ EXPORT_SYMBOL(iwl_tt_initialize);
828/* cleanup thermal throttling management related memory and timer */ 828/* cleanup thermal throttling management related memory and timer */
829void iwl_tt_exit(struct iwl_priv *priv) 829void iwl_tt_exit(struct iwl_priv *priv)
830{ 830{
831 struct iwl_tt_mgmt *tt = &priv->power_data.tt; 831 struct iwl_tt_mgmt *tt = &priv->thermal_throttle;
832 832
833 /* stop ct_kill_exit_tm timer if activated */ 833 /* stop ct_kill_exit_tm timer if activated */
834 del_timer_sync(&priv->power_data.ct_kill_exit_tm); 834 del_timer_sync(&priv->thermal_throttle.ct_kill_exit_tm);
835 cancel_work_sync(&priv->tt_work); 835 cancel_work_sync(&priv->tt_work);
836 cancel_work_sync(&priv->ct_enter); 836 cancel_work_sync(&priv->ct_enter);
837 cancel_work_sync(&priv->ct_exit); 837 cancel_work_sync(&priv->ct_exit);
838 838
839 if (priv->power_data.adv_tt) { 839 if (priv->thermal_throttle.advanced_tt) {
840 /* free advance thermal throttling memory */ 840 /* free advance thermal throttling memory */
841 kfree(tt->restriction); 841 kfree(tt->restriction);
842 tt->restriction = NULL; 842 tt->restriction = NULL;
diff --git a/drivers/net/wireless/iwlwifi/iwl-power.h b/drivers/net/wireless/iwlwifi/iwl-power.h
index 3d49b7a45b74..15e3eabd2e84 100644
--- a/drivers/net/wireless/iwlwifi/iwl-power.h
+++ b/drivers/net/wireless/iwlwifi/iwl-power.h
@@ -37,13 +37,11 @@ struct iwl_priv;
37#define IWL_ABSOLUTE_MAX 0xFFFFFFFF 37#define IWL_ABSOLUTE_MAX 0xFFFFFFFF
38#define IWL_TT_INCREASE_MARGIN 5 38#define IWL_TT_INCREASE_MARGIN 5
39 39
40/* Tx/Rx restrictions */ 40enum iwl_antenna_ok {
41#define IWL_TX_MULTI 0x02 41 IWL_ANT_OK_NONE,
42#define IWL_TX_SINGLE 0x01 42 IWL_ANT_OK_SINGLE,
43#define IWL_TX_NONE 0x00 43 IWL_ANT_OK_MULTI,
44#define IWL_RX_MULTI 0x02 44};
45#define IWL_RX_SINGLE 0x01
46#define IWL_RX_NONE 0x00
47 45
48/* Thermal Throttling State Machine states */ 46/* Thermal Throttling State Machine states */
49enum iwl_tt_state { 47enum iwl_tt_state {
@@ -55,27 +53,30 @@ enum iwl_tt_state {
55}; 53};
56 54
57/** 55/**
58 * struct iwl_tt_restriction - Thermal Throttling restriction table used 56 * struct iwl_tt_restriction - Thermal Throttling restriction table
59 * by advance thermal throttling management
60 * based on the current thermal throttling state, determine
61 * number of tx/rx streams; and the status of HT operation
62 * @tx_stream: number of tx stream allowed 57 * @tx_stream: number of tx stream allowed
63 * @is_ht: ht enable/disable 58 * @is_ht: ht enable/disable
64 * @rx_stream: number of rx stream allowed 59 * @rx_stream: number of rx stream allowed
60 *
61 * This table is used by advance thermal throttling management
62 * based on the current thermal throttling state, and determines
63 * the number of tx/rx streams and the status of HT operation.
65 */ 64 */
66struct iwl_tt_restriction { 65struct iwl_tt_restriction {
67 u8 tx_stream; 66 enum iwl_antenna_ok tx_stream;
67 enum iwl_antenna_ok rx_stream;
68 bool is_ht; 68 bool is_ht;
69 u8 rx_stream;
70}; 69};
71 70
72/** 71/**
73 * struct iwl_tt_trans - Thermal Throttling transaction table; used by 72 * struct iwl_tt_trans - Thermal Throttling transaction table
74 * advance thermal throttling algorithm to determine next
75 * thermal state to go based on the current temperature
76 * @next_state: next thermal throttling mode 73 * @next_state: next thermal throttling mode
77 * @tt_low: low temperature threshold to change state 74 * @tt_low: low temperature threshold to change state
78 * @tt_high: high temperature threshold to change state 75 * @tt_high: high temperature threshold to change state
76 *
77 * This is used by the advanced thermal throttling algorithm
78 * to determine the next thermal state to go based on the
79 * current temperature.
79 */ 80 */
80struct iwl_tt_trans { 81struct iwl_tt_trans {
81 enum iwl_tt_state next_state; 82 enum iwl_tt_state next_state;
@@ -85,6 +86,7 @@ struct iwl_tt_trans {
85 86
86/** 87/**
87 * struct iwl_tt_mgnt - Thermal Throttling Management structure 88 * struct iwl_tt_mgnt - Thermal Throttling Management structure
89 * @advanced_tt: advanced thermal throttle required
88 * @state: current Thermal Throttling state 90 * @state: current Thermal Throttling state
89 * @tt_power_mode: Thermal Throttling power mode index 91 * @tt_power_mode: Thermal Throttling power mode index
90 * being used to set power level when 92 * being used to set power level when
@@ -99,16 +101,21 @@ struct iwl_tt_trans {
99 * should be used in tt state; and can HT be enabled or not 101 * should be used in tt state; and can HT be enabled or not
100 * @iwl_tt_trans: ptr to adv trans table, used by advance thermal throttling 102 * @iwl_tt_trans: ptr to adv trans table, used by advance thermal throttling
101 * state transaction 103 * state transaction
104 * @ct_kill_toggle: used to toggle the CSR bit when checking uCode temperature
105 * @ct_kill_exit_tm: timer to exit thermal kill
102 */ 106 */
103struct iwl_tt_mgmt { 107struct iwl_tt_mgmt {
104 enum iwl_tt_state state; 108 enum iwl_tt_state state;
109 bool advanced_tt;
105 u8 tt_power_mode; 110 u8 tt_power_mode;
106 u8 sys_power_mode; 111 u8 sys_power_mode;
112 bool ct_kill_toggle;
107#ifdef CONFIG_IWLWIFI_DEBUG 113#ifdef CONFIG_IWLWIFI_DEBUG
108 s32 tt_previous_temp; 114 s32 tt_previous_temp;
109#endif 115#endif
110 struct iwl_tt_restriction *restriction; 116 struct iwl_tt_restriction *restriction;
111 struct iwl_tt_trans *transaction; 117 struct iwl_tt_trans *transaction;
118 struct timer_list ct_kill_exit_tm;
112}; 119};
113 120
114enum { 121enum {
@@ -137,20 +144,13 @@ struct iwl_power_mgr {
137 u8 power_mode; 144 u8 power_mode;
138 u8 user_power_setting; /* set by user through sysfs */ 145 u8 user_power_setting; /* set by user through sysfs */
139 u8 power_disabled; /* set by mac80211's CONF_PS */ 146 u8 power_disabled; /* set by mac80211's CONF_PS */
140 struct iwl_tt_mgmt tt; /* Thermal Throttling Management */
141 bool adv_tt; /* false: legacy mode */
142 /* true: advance mode */
143 bool ct_kill_toggle; /* use to toggle the CSR bit when
144 * checking uCode temperature
145 */
146 struct timer_list ct_kill_exit_tm;
147}; 147};
148 148
149int iwl_power_update_mode(struct iwl_priv *priv, bool force); 149int iwl_power_update_mode(struct iwl_priv *priv, bool force);
150int iwl_power_set_user_mode(struct iwl_priv *priv, u16 mode); 150int iwl_power_set_user_mode(struct iwl_priv *priv, u16 mode);
151bool iwl_ht_enabled(struct iwl_priv *priv); 151bool iwl_ht_enabled(struct iwl_priv *priv);
152u8 iwl_tx_ant_restriction(struct iwl_priv *priv); 152enum iwl_antenna_ok iwl_tx_ant_restriction(struct iwl_priv *priv);
153u8 iwl_rx_ant_restriction(struct iwl_priv *priv); 153enum iwl_antenna_ok iwl_rx_ant_restriction(struct iwl_priv *priv);
154void iwl_tt_enter_ct_kill(struct iwl_priv *priv); 154void iwl_tt_enter_ct_kill(struct iwl_priv *priv);
155void iwl_tt_exit_ct_kill(struct iwl_priv *priv); 155void iwl_tt_exit_ct_kill(struct iwl_priv *priv);
156void iwl_tt_handler(struct iwl_priv *priv); 156void iwl_tt_handler(struct iwl_priv *priv);