summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOctav Zlatior <octav.zlatior@theobroma-systems.com>2015-06-08 16:38:50 +0200
committerKlaus Goger <klaus.goger@theobroma-systems.com>2015-07-30 18:53:03 +0200
commit13766185a81306060b6c722739b6c0ee6b254563 (patch)
tree76aa348e2e2b7050b1b7aa45a54c4595fc1082ba
parent0af64655d7cc9caa2742fbed522a0e80f53dde07 (diff)
thermal: adds step-wise frequency capping
Frequency capping forces the cooling state to a minimum, defined by the device tree. This forces the frequency to stay below a maximum determined by the operating points as long as we are above a thermal trip point. Signed-off-by: Octav Zlatior <octav.zlatior@theobroma-systems.com>
-rw-r--r--drivers/thermal/Kconfig11
-rw-r--r--drivers/thermal/step_wise.c11
2 files changed, 22 insertions, 0 deletions
diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index e03f79700de1..ca5079558cd4 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -92,6 +92,17 @@ config THERMAL_GOV_STEP_WISE
Enable this to manage platform thermals using a simple linear
governor.
+config THERMAL_STEP_WISE_FREQUENCY_CAPPING
+ bool
+ prompt "Use frequency capping with step-wise"
+ depends on THERMAL_GOV_STEP_WISE
+ default n
+ help
+ This forces the cooling state to a minimum defined in the
+ device tree, virtually forcing the frequency to stay below
+ the corresponding operating point while a thermal trip
+ point is activated.
+
config THERMAL_GOV_BANG_BANG
bool "Bang Bang thermal governor"
default n
diff --git a/drivers/thermal/step_wise.c b/drivers/thermal/step_wise.c
index 5a0f12d08e8b..04f4d21dcda7 100644
--- a/drivers/thermal/step_wise.c
+++ b/drivers/thermal/step_wise.c
@@ -81,9 +81,20 @@ static unsigned long get_target_state(struct thermal_instance *instance,
if (!throttle)
next_target = THERMAL_NO_TARGET;
} else {
+#ifdef CONFIG_THERMAL_STEP_WISE_FREQUENCY_CAPPING
+ if (!throttle) {
+ next_target = cur_state - 1;
+ if (next_target > instance->upper)
+ next_target = instance->upper;
+ }
+ else
+ next_target = cur_state > instance->upper ?
+ instance->upper : cur_state;
+#else
next_target = cur_state - 1;
if (next_target > instance->upper)
next_target = instance->upper;
+#endif
}
break;
case THERMAL_TREND_DROP_FULL: