thermal: step_wise: set throttle target within thermal instance limits
authorAndrew Bresticker <abrestic@chromium.org>
Tue, 9 Apr 2013 21:59:47 +0000 (21:59 +0000)
committerZhang Rui <rui.zhang@intel.com>
Thu, 11 Apr 2013 23:23:50 +0000 (07:23 +0800)
commite79fe642cc21ac922226b5ea9b7975bf329d4e7a
tree67236d2b6ff05132b7fc6ae74b66c3f8b34ce3dc
parent8837295a73f3500b32e18f9862c7bdde0b958648
thermal: step_wise: set throttle target within thermal instance limits

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.  This is necessary because, in the THREAML_TREND_RAISING and
THERMAL_TREND_DROPPING cases, the current state may only be incremented
or decremented by one even if it is outside the bounds of the thermal
instance.  This might occur, for example, if the CPU is heating up
and hits a thermal trip point for the first time when it's frequency
is much higher than the range specified by the thermal instance
corresponding to the trip point.

Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
drivers/thermal/step_wise.c