Skip to content

Commit a6ce8c7

Browse files
committed
thermal: gov_step_wise: Use .manage() callback instead of .throttle()
Make the Step-Wise governor use the new .manage() callback instead of .throttle(). Even though using .throttle() is not particularly problematic for the Step-Wise governor, using .manage() instead still allows it to reduce overhead by updating all of the cooling devices once after setting target values for all of the thermal instances. Signed-off-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Lukasz Luba <[email protected]> Acked-by: Daniel Lezcano <[email protected]>
1 parent ca0e972 commit a6ce8c7

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed

drivers/thermal/gov_step_wise.c

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -109,34 +109,37 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz,
109109
}
110110
}
111111

112-
/**
113-
* step_wise_throttle - throttles devices associated with the given zone
114-
* @tz: thermal_zone_device
115-
* @trip: trip point
116-
*
117-
* Throttling Logic: This uses the trend of the thermal zone to throttle.
118-
* If the thermal zone is 'heating up' this throttles all the cooling
119-
* devices associated with the zone and its particular trip point, by one
120-
* step. If the zone is 'cooling down' it brings back the performance of
121-
* the devices by one step.
122-
*/
123-
static int step_wise_throttle(struct thermal_zone_device *tz,
124-
const struct thermal_trip *trip)
112+
static void step_wise_manage(struct thermal_zone_device *tz)
125113
{
114+
const struct thermal_trip_desc *td;
126115
struct thermal_instance *instance;
127116

128117
lockdep_assert_held(&tz->lock);
129118

130-
thermal_zone_trip_update(tz, trip);
119+
/*
120+
* Throttling Logic: Use the trend of the thermal zone to throttle.
121+
* If the thermal zone is 'heating up', throttle all of the cooling
122+
* devices associated with each trip point by one step. If the zone
123+
* is 'cooling down', it brings back the performance of the devices
124+
* by one step.
125+
*/
126+
for_each_trip_desc(tz, td) {
127+
const struct thermal_trip *trip = &td->trip;
128+
129+
if (trip->temperature == THERMAL_TEMP_INVALID ||
130+
trip->type == THERMAL_TRIP_CRITICAL ||
131+
trip->type == THERMAL_TRIP_HOT)
132+
continue;
133+
134+
thermal_zone_trip_update(tz, trip);
135+
}
131136

132137
list_for_each_entry(instance, &tz->thermal_instances, tz_node)
133138
thermal_cdev_update(instance->cdev);
134-
135-
return 0;
136139
}
137140

138141
static struct thermal_governor thermal_gov_step_wise = {
139-
.name = "step_wise",
140-
.throttle = step_wise_throttle,
142+
.name = "step_wise",
143+
.manage = step_wise_manage,
141144
};
142145
THERMAL_GOVERNOR_DECLARE(thermal_gov_step_wise);

0 commit comments

Comments
 (0)