Skip to content

Commit 976f441

Browse files
committed
thermal: core: Introduce .manage() callback for thermal governors
Introduce a new thermal governor callback called .manage() that will be invoked once per thermal zone update after processing all of the trip points in the core. This will allow governors that look at multiple trip points together to check all of them in a consistent configuration, so they don't need to play tricks with skipping .throttle() invocations that they are not interested in and they can avoid carrying out the same computations for multiple times in one cycle. Signed-off-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Lukasz Luba <[email protected]> Acked-by: Daniel Lezcano <[email protected]>
1 parent 0ae204a commit 976f441

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

drivers/thermal/thermal_core.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,9 @@ void __thermal_zone_device_update(struct thermal_zone_device *tz,
516516
governor->trip_crossed(tz, &td->trip, false);
517517
}
518518

519+
if (governor->manage)
520+
governor->manage(tz);
521+
519522
monitor_thermal_zone(tz);
520523
}
521524

drivers/thermal/thermal_core.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ struct thermal_trip_desc {
3131
* @unbind_from_tz: callback called when a governor is unbound from a
3232
* thermal zone.
3333
* @trip_crossed: called for trip points that have just been crossed
34+
* @manage: called on thermal zone temperature updates
3435
* @throttle: callback called for every trip point even if temperature is
3536
* below the trip point temperature
3637
* @update_tz: callback called when thermal zone internals have changed, e.g.
@@ -44,6 +45,7 @@ struct thermal_governor {
4445
void (*trip_crossed)(struct thermal_zone_device *tz,
4546
const struct thermal_trip *trip,
4647
bool crossed_up);
48+
void (*manage)(struct thermal_zone_device *tz);
4749
int (*throttle)(struct thermal_zone_device *tz,
4850
const struct thermal_trip *trip);
4951
void (*update_tz)(struct thermal_zone_device *tz,

0 commit comments

Comments
 (0)