thermal: gov_power_allocator: Avoid overwriting PID coefficients from setup time
authorDi Shen <di.shen@unisoc.com>
Wed, 7 Feb 2024 02:09:23 +0000 (10:09 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 12 Feb 2024 13:13:36 +0000 (14:13 +0100)
commit0fac6893ff6c08d6fab6f56b9550a2c4cee589fd
treeca4656f22b85f3d9dea2afce0756502d7f73705a
parentccd975daa807543a0050ab0a84f8581e3aae62a6
thermal: gov_power_allocator: Avoid overwriting PID coefficients from setup time

When the PID coefficients k_* are set via sysfs before the IPA
algorithm is triggered then the coefficients would be overwritten after
IPA throttle() is called. The old configuration values might be
different than the new values estimated by the IPA internal algorithm.

There might be a time delay when this overwriting happens. It
depends on the thermal zone temperature value. The temperature value
needs to cross the first trip point value then IPA algorithms start
operating. Although, the PID coefficients setup time should not be
affected or linked to any later operating phase and values must not be
overwritten.

This patch initializes params->sustainable_power when the governor
binds to thermal zone to avoid overwriting k_*. The basic function won't
be affected, as the k_* still can be estimated if the sustainable_power
is modified.

Signed-off-by: Di Shen <di.shen@unisoc.com>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/thermal/gov_power_allocator.c