Skip to content

Commit

Permalink
drivers: thermal: step_wise: avoid throttling at hysteresis temperatu…
Browse files Browse the repository at this point in the history
…re after dropping below it

Signed-off-by: Serge Schneider <serge@raspberrypi.org>
  • Loading branch information
XECDesign authored and popcornmix committed Nov 16, 2023
1 parent 6646f74 commit 29d2bdf
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions drivers/thermal/gov_step_wise.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,12 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip_id
trace_thermal_zone_trip(tz, trip_id, trip.type);
}

tz->ops->get_trip_temp(tz, trip_id, &trip_temp);
hyst_temp = trip_temp;
hyst_temp = trip_temp = trip.temperature;
if (tz->ops->get_trip_hyst) {
tz->ops->get_trip_hyst(tz, trip_id, &hyst_temp);
hyst_temp = trip_temp - hyst_temp;
}
tz->ops->get_trip_type(tz, trip_id, &trip_type);
trip_type = trip.type;

dev_dbg(&tz->device,
"Trip%d[type=%d,temp=%d,hyst=%d]:trend=%d,throttle=%d\n",
Expand All @@ -122,9 +121,9 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip_id
*/
if (tz->temperature >= trip_temp ||
(tz->temperature >= hyst_temp &&
old_target != THERMAL_NO_TARGET)) {
old_target == instance->upper)) {
throttle = true;
trace_thermal_zone_trip(tz, trip, trip_type);
trace_thermal_zone_trip(tz, trip_id, trip_type);
}

instance->target = get_target_state(instance, trend, throttle);
Expand Down

0 comments on commit 29d2bdf

Please sign in to comment.