Skip to content

Commit e4065f1

Browse files
committed
thermal: gov_step_wise: Use trip thresholds instead of trip temperatures
In principle, the Step-Wise governor should take trip hysteresis into account. After all, once a trip has been crossed on the way up, mitigation is still needed until it is crossed on the way down. For this reason, make it use trip thresholds that are computed by the core when trips are crossed, so as to apply mitigations in the hysteresis rages of trips that were crossed on the way up, but have not been crossed on the way down yet. Signed-off-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Lukasz Luba <[email protected]> Acked-by: Daniel Lezcano <[email protected]>
1 parent a6ce8c7 commit e4065f1

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

drivers/thermal/gov_step_wise.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ static unsigned long get_target_state(struct thermal_instance *instance,
6262
}
6363

6464
static void thermal_zone_trip_update(struct thermal_zone_device *tz,
65-
const struct thermal_trip *trip)
65+
const struct thermal_trip *trip,
66+
int trip_threshold)
6667
{
6768
int trip_id = thermal_zone_trip_id(tz, trip);
6869
enum thermal_trend trend;
@@ -72,13 +73,13 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz,
7273

7374
trend = get_tz_trend(tz, trip);
7475

75-
if (tz->temperature >= trip->temperature) {
76+
if (tz->temperature >= trip_threshold) {
7677
throttle = true;
7778
trace_thermal_zone_trip(tz, trip_id, trip->type);
7879
}
7980

8081
dev_dbg(&tz->device, "Trip%d[type=%d,temp=%d]:trend=%d,throttle=%d\n",
81-
trip_id, trip->type, trip->temperature, trend, throttle);
82+
trip_id, trip->type, trip_threshold, trend, throttle);
8283

8384
list_for_each_entry(instance, &tz->thermal_instances, tz_node) {
8485
if (instance->trip != trip)
@@ -131,7 +132,7 @@ static void step_wise_manage(struct thermal_zone_device *tz)
131132
trip->type == THERMAL_TRIP_HOT)
132133
continue;
133134

134-
thermal_zone_trip_update(tz, trip);
135+
thermal_zone_trip_update(tz, trip, td->threshold);
135136
}
136137

137138
list_for_each_entry(instance, &tz->thermal_instances, tz_node)

0 commit comments

Comments
 (0)