aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
diff options
context:
space:
mode:
authorChaya Rachel Ivgi <chaya.rachel.ivgi@intel.com>2016-02-14 07:03:10 -0500
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>2016-03-09 14:05:13 -0500
commitb358993b3f582f43a6098028b5b08d084dff4d24 (patch)
tree5c70d0ad409f7768327b9cc5b23f19d5299b0f8f /drivers/net/wireless/intel/iwlwifi/mvm/tt.c
parent416cb2467bba25a6729b95e1ada0254a9477a360 (diff)
iwlwifi: mvm: return the cooling state index instead of the budget
iwl_mvm_tcool_get_cur_state is the function that returns the cooling state index to the sysfs handler. This function returns mvm->cooling_dev.cur_state but that variable was set to the budget and not the cooling state index. Fix that. Add a missing blank line while at it. Signed-off-by: Chaya Rachel Ivgi <chaya.rachel.ivgi@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Diffstat (limited to 'drivers/net/wireless/intel/iwlwifi/mvm/tt.c')
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/tt.c56
1 files changed, 29 insertions, 27 deletions
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
index ce0c6fd183bb..f1f28255a3a6 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/tt.c
@@ -510,11 +510,35 @@ static const struct iwl_tt_params iwl_mvm_default_tt_params = {
510 .support_tx_backoff = true, 510 .support_tx_backoff = true,
511}; 511};
512 512
513int iwl_mvm_ctdp_command(struct iwl_mvm *mvm, u32 op, u32 budget) 513/* budget in mWatt */
514static const u32 iwl_mvm_cdev_budgets[] = {
515 2000, /* cooling state 0 */
516 1800, /* cooling state 1 */
517 1600, /* cooling state 2 */
518 1400, /* cooling state 3 */
519 1200, /* cooling state 4 */
520 1000, /* cooling state 5 */
521 900, /* cooling state 6 */
522 800, /* cooling state 7 */
523 700, /* cooling state 8 */
524 650, /* cooling state 9 */
525 600, /* cooling state 10 */
526 550, /* cooling state 11 */
527 500, /* cooling state 12 */
528 450, /* cooling state 13 */
529 400, /* cooling state 14 */
530 350, /* cooling state 15 */
531 300, /* cooling state 16 */
532 250, /* cooling state 17 */
533 200, /* cooling state 18 */
534 150, /* cooling state 19 */
535};
536
537int iwl_mvm_ctdp_command(struct iwl_mvm *mvm, u32 op, u32 state)
514{ 538{
515 struct iwl_mvm_ctdp_cmd cmd = { 539 struct iwl_mvm_ctdp_cmd cmd = {
516 .operation = cpu_to_le32(op), 540 .operation = cpu_to_le32(op),
517 .budget = cpu_to_le32(budget), 541 .budget = cpu_to_le32(iwl_mvm_cdev_budgets[state]),
518 .window_size = 0, 542 .window_size = 0,
519 }; 543 };
520 int ret; 544 int ret;
@@ -534,7 +558,7 @@ int iwl_mvm_ctdp_command(struct iwl_mvm *mvm, u32 op, u32 budget)
534 switch (op) { 558 switch (op) {
535 case CTDP_CMD_OPERATION_START: 559 case CTDP_CMD_OPERATION_START:
536#ifdef CONFIG_THERMAL 560#ifdef CONFIG_THERMAL
537 mvm->cooling_dev.cur_state = budget; 561 mvm->cooling_dev.cur_state = state;
538#endif /* CONFIG_THERMAL */ 562#endif /* CONFIG_THERMAL */
539 break; 563 break;
540 case CTDP_CMD_OPERATION_REPORT: 564 case CTDP_CMD_OPERATION_REPORT:
@@ -759,29 +783,6 @@ static void iwl_mvm_thermal_zone_register(struct iwl_mvm *mvm)
759 mvm->tz_device.temp_trips[i] = S16_MIN; 783 mvm->tz_device.temp_trips[i] = S16_MIN;
760} 784}
761 785
762static const u32 iwl_mvm_cdev_budgets[] = {
763 2000, /* cooling state 0 */
764 1800, /* cooling state 1 */
765 1600, /* cooling state 2 */
766 1400, /* cooling state 3 */
767 1200, /* cooling state 4 */
768 1000, /* cooling state 5 */
769 900, /* cooling state 6 */
770 800, /* cooling state 7 */
771 700, /* cooling state 8 */
772 650, /* cooling state 9 */
773 600, /* cooling state 10 */
774 550, /* cooling state 11 */
775 500, /* cooling state 12 */
776 450, /* cooling state 13 */
777 400, /* cooling state 14 */
778 350, /* cooling state 15 */
779 300, /* cooling state 16 */
780 250, /* cooling state 17 */
781 200, /* cooling state 18 */
782 150, /* cooling state 19 */
783};
784
785static int iwl_mvm_tcool_get_max_state(struct thermal_cooling_device *cdev, 786static int iwl_mvm_tcool_get_max_state(struct thermal_cooling_device *cdev,
786 unsigned long *state) 787 unsigned long *state)
787{ 788{
@@ -799,6 +800,7 @@ static int iwl_mvm_tcool_get_cur_state(struct thermal_cooling_device *cdev,
799 return -EBUSY; 800 return -EBUSY;
800 801
801 *state = mvm->cooling_dev.cur_state; 802 *state = mvm->cooling_dev.cur_state;
803
802 return 0; 804 return 0;
803} 805}
804 806
@@ -822,7 +824,7 @@ static int iwl_mvm_tcool_set_cur_state(struct thermal_cooling_device *cdev,
822 } 824 }
823 825
824 ret = iwl_mvm_ctdp_command(mvm, CTDP_CMD_OPERATION_START, 826 ret = iwl_mvm_ctdp_command(mvm, CTDP_CMD_OPERATION_START,
825 iwl_mvm_cdev_budgets[new_state]); 827 new_state);
826 828
827unlock: 829unlock:
828 mutex_unlock(&mvm->mutex); 830 mutex_unlock(&mvm->mutex);