lkml.org 
[lkml]   [2013]   [Apr]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] thermal: step_wise: set throttle target within thermal instance limits
Date
When selecting a target cooling state in get_target_state(), make sure
that the state is at least as high as the minimum when the temperature
is rising and at least as low as the maximum when the temperature is
falling. Previously the cooling level would only be incremented or
decremented by one in these cases.

Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
---
drivers/thermal/step_wise.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/thermal/step_wise.c b/drivers/thermal/step_wise.c
index 0cd5e9f..49992a4 100644
--- a/drivers/thermal/step_wise.c
+++ b/drivers/thermal/step_wise.c
@@ -47,9 +47,13 @@ static unsigned long get_target_state(struct thermal_instance *instance,
if (trend == THERMAL_TREND_RAISING) {
cur_state = cur_state < instance->upper ?
(cur_state + 1) : instance->upper;
+ if (cur_state < instance->lower)
+ cur_state = instance->lower;
} else if (trend == THERMAL_TREND_DROPPING) {
cur_state = cur_state > instance->lower ?
(cur_state - 1) : instance->lower;
+ if (cur_state > instance->upper)
+ cur_state = instance->upper;
}

return cur_state;
--
1.8.1.3


\
 
 \ /
  Last update: 2013-04-09 02:41    [W:0.035 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site