summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManaf Meethalavalappu Pallikunhi <manafm@codeaurora.org>2021-11-03 01:30:40 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-12-08 08:46:54 +0100
commitad4d6cd6a2e3bcf409868f25be250c7b319e8a2c (patch)
tree1487ffeeff1d176536c416aa6766d810ecc976fa
parente4e7b95df3e224ff2a1f9c7bc25c5e2fa81ce7d8 (diff)
downloadlinux-ad4d6cd6a2e3bcf409868f25be250c7b319e8a2c.tar.gz
linux-ad4d6cd6a2e3bcf409868f25be250c7b319e8a2c.tar.bz2
linux-ad4d6cd6a2e3bcf409868f25be250c7b319e8a2c.zip
thermal: core: Reset previous low and high trip during thermal zone init
[ Upstream commit 99b63316c39988039965693f5f43d8b4ccb1c86c ] During the suspend is in process, thermal_zone_device_update bails out thermal zone re-evaluation for any sensor trip violation without setting next valid trip to that sensor. It assumes during resume it will re-evaluate same thermal zone and update trip. But when it is in suspend temperature goes down and on resume path while updating thermal zone if temperature is less than previously violated trip, thermal zone set trip function evaluates the same previous high and previous low trip as new high and low trip. Since there is no change in high/low trip, it bails out from thermal zone set trip API without setting any trip. It leads to a case where sensor high trip or low trip is disabled forever even though thermal zone has a valid high or low trip. During thermal zone device init, reset thermal zone previous high and low trip. It resolves above mentioned scenario. Signed-off-by: Manaf Meethalavalappu Pallikunhi <manafm@codeaurora.org> Reviewed-by: Thara Gopinath <thara.gopinath@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/thermal/thermal_core.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 94820f25a15f..8374b8078b7d 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -457,6 +457,8 @@ static void thermal_zone_device_init(struct thermal_zone_device *tz)
{
struct thermal_instance *pos;
tz->temperature = THERMAL_TEMP_INVALID;
+ tz->prev_low_trip = -INT_MAX;
+ tz->prev_high_trip = INT_MAX;
list_for_each_entry(pos, &tz->thermal_instances, tz_node)
pos->initialized = false;
}