diff options
| -rw-r--r-- | drivers/thermal/intel_powerclamp.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/thermal/intel_powerclamp.c b/drivers/thermal/intel_powerclamp.c index 015ce2eb6eb7..0e4dc0afcfd2 100644 --- a/drivers/thermal/intel_powerclamp.c +++ b/drivers/thermal/intel_powerclamp.c | |||
| @@ -388,7 +388,7 @@ static int clamp_thread(void *arg) | |||
| 388 | int sleeptime; | 388 | int sleeptime; |
| 389 | unsigned long target_jiffies; | 389 | unsigned long target_jiffies; |
| 390 | unsigned int guard; | 390 | unsigned int guard; |
| 391 | unsigned int compensation = 0; | 391 | unsigned int compensated_ratio; |
| 392 | int interval; /* jiffies to sleep for each attempt */ | 392 | int interval; /* jiffies to sleep for each attempt */ |
| 393 | unsigned int duration_jiffies = msecs_to_jiffies(duration); | 393 | unsigned int duration_jiffies = msecs_to_jiffies(duration); |
| 394 | unsigned int window_size_now; | 394 | unsigned int window_size_now; |
| @@ -409,8 +409,11 @@ static int clamp_thread(void *arg) | |||
| 409 | * c-states, thus we need to compensate the injected idle ratio | 409 | * c-states, thus we need to compensate the injected idle ratio |
| 410 | * to achieve the actual target reported by the HW. | 410 | * to achieve the actual target reported by the HW. |
| 411 | */ | 411 | */ |
| 412 | compensation = get_compensation(target_ratio); | 412 | compensated_ratio = target_ratio + |
| 413 | interval = duration_jiffies*100/(target_ratio+compensation); | 413 | get_compensation(target_ratio); |
| 414 | if (compensated_ratio <= 0) | ||
| 415 | compensated_ratio = 1; | ||
| 416 | interval = duration_jiffies * 100 / compensated_ratio; | ||
| 414 | 417 | ||
| 415 | /* align idle time */ | 418 | /* align idle time */ |
| 416 | target_jiffies = roundup(jiffies, interval); | 419 | target_jiffies = roundup(jiffies, interval); |
| @@ -647,8 +650,8 @@ static int powerclamp_set_cur_state(struct thermal_cooling_device *cdev, | |||
| 647 | goto exit_set; | 650 | goto exit_set; |
| 648 | } else if (set_target_ratio > 0 && new_target_ratio == 0) { | 651 | } else if (set_target_ratio > 0 && new_target_ratio == 0) { |
| 649 | pr_info("Stop forced idle injection\n"); | 652 | pr_info("Stop forced idle injection\n"); |
| 650 | set_target_ratio = 0; | ||
| 651 | end_power_clamp(); | 653 | end_power_clamp(); |
| 654 | set_target_ratio = 0; | ||
| 652 | } else /* adjust currently running */ { | 655 | } else /* adjust currently running */ { |
| 653 | set_target_ratio = new_target_ratio; | 656 | set_target_ratio = new_target_ratio; |
| 654 | /* make new set_target_ratio visible to other cpus */ | 657 | /* make new set_target_ratio visible to other cpus */ |
