mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 02:50:49 +09:00
thermal: power_allocator: Add support to get PID constant from dt
Change-Id: Ibabdad4ba2df6df26d75483dd35b6c51572befe8 Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user