Re: [PATCH 3/3] thermal/core: Fix thermal trip cross point

From: Daniel Lezcano
Date: Fri Jul 08 2022 - 06:49:05 EST


On 08/07/2022 05:56, Zhang Rui wrote:

[ ... ]

+ if (tz->last_temperature < trip_temp && tz->temperature >=
trip_temp &&
+ trip != tz->prev_trip) {
+ thermal_notify_tz_trip_up(tz->id, trip, tz-
temperature);
+ tz->prev_trip = trip;
+
+ } else if (tz->last_temperature >= trip_low_temp && tz-
temperature < trip_low_temp &&
+ trip == tz->prev_trip) {
+ thermal_notify_tz_trip_down(tz->id, trip, tz-
temperature);
+ tz->prev_trip = trip - 1;

Say, let's assume hysteresis is Zero,
When the temperature increases and we do thermal_notify_tz_trip_up()
for trip 0 and trip 1, tz->prev_trip is set to 1 in this case.
And then the temperature drops below trip 0, we don't have chance to do
thermal_notify_tz_trip_down() for trip 0, because we always handle the
trips in ascending order, and tz->prev_trip is 1 when we do
handle_thermal_trip(0).
Well actually you are right, I reproduced the scenario with temperature emulation. I'll investigate how to handle this case.

Thanks for spotting this



<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog