summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/thermal/of-thermal.c12
-rw-r--r--drivers/thermal/power_allocator.c6
-rw-r--r--include/linux/thermal.h6
3 files changed, 21 insertions, 3 deletions
diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c
index ef6101b8b5de..2f7e814be930 100644
--- a/drivers/thermal/of-thermal.c
+++ b/drivers/thermal/of-thermal.c
@@ -1009,6 +1009,18 @@ int __init of_parse_thermal_zones(void)
if (!of_property_read_u32(child, "sustainable-power", &prop))
tzp->sustainable_power = prop;
+ if (!of_property_read_u32(child, "k_pu", &prop)) {
+ tzp->k_pu = prop;
+ tzp->is_k_pu_available = true;
+ }
+ if (!of_property_read_u32(child, "k_po", &prop)) {
+ tzp->k_po = prop;
+ tzp->is_k_po_available = true;
+ }
+ if (!of_property_read_u32(child, "k_i", &prop)) {
+ tzp->k_i = prop;
+ tzp->is_k_i_available = true;
+ }
for (i = 0; i < tz->ntrips; i++)
mask |= 1 << i;
diff --git a/drivers/thermal/power_allocator.c b/drivers/thermal/power_allocator.c
index d86450a142e9..ee475f5458c3 100644
--- a/drivers/thermal/power_allocator.c
+++ b/drivers/thermal/power_allocator.c
@@ -155,15 +155,15 @@ static void estimate_pid_constants(struct thermal_zone_device *tz,
if (!temperature_threshold)
return;
- if (!tz->tzp->k_po || force)
+ if (!tz->tzp->is_k_po_available || force)
tz->tzp->k_po = int_to_frac(sustainable_power) /
temperature_threshold;
- if (!tz->tzp->k_pu || force)
+ if (!tz->tzp->is_k_pu_available || force)
tz->tzp->k_pu = int_to_frac(2 * sustainable_power) /
temperature_threshold;
- if (!tz->tzp->k_i || force)
+ if (!tz->tzp->is_k_i_available || force)
tz->tzp->k_i = int_to_frac(10) / 1000;
/*
* The default for k_d and integral_cutoff is 0, so we can
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index 5b0718c850ce..e132714398c7 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -300,15 +300,21 @@ struct thermal_zone_params {
*/
s32 k_po;
+ bool is_k_po_available;
+
/*
* Proportional parameter of the PID controller when
* undershooting
*/
s32 k_pu;
+ bool is_k_pu_available;
+
/* Integral parameter of the PID controller */
s32 k_i;
+ bool is_k_i_available;
+
/* Derivative parameter of the PID controller */
s32 k_d;