thermal_zone_device_set_polling(tz, tz->polling_delay_jiffies);
}
+static struct thermal_governor *thermal_get_tz_governor(struct thermal_zone_device *tz)
+{
+ if (tz->governor)
+ return tz->governor;
+
+ return def_governor;
+}
+
static void handle_non_critical_trips(struct thermal_zone_device *tz,
const struct thermal_trip *trip)
{
- tz->governor ? tz->governor->throttle(tz, trip) :
- def_governor->throttle(tz, trip);
+ struct thermal_governor *governor = thermal_get_tz_governor(tz);
+
+ if (governor->throttle)
+ governor->throttle(tz, trip);
}
void thermal_governor_update_tz(struct thermal_zone_device *tz,
void __thermal_zone_device_update(struct thermal_zone_device *tz,
enum thermal_notify_event event)
{
+ struct thermal_governor *governor = thermal_get_tz_governor(tz);
struct thermal_trip_desc *td;
LIST_HEAD(way_down_list);
LIST_HEAD(way_up_list);
list_for_each_entry(td, &way_up_list, notify_list_node) {
thermal_notify_tz_trip_up(tz, &td->trip);
thermal_debug_tz_trip_up(tz, &td->trip);
+ if (governor->trip_crossed)
+ governor->trip_crossed(tz, &td->trip, true);
}
list_sort(NULL, &way_down_list, thermal_trip_notify_cmp);
list_for_each_entry(td, &way_down_list, notify_list_node) {
thermal_notify_tz_trip_down(tz, &td->trip);
thermal_debug_tz_trip_down(tz, &td->trip);
+ if (governor->trip_crossed)
+ governor->trip_crossed(tz, &td->trip, false);
}
monitor_thermal_zone(tz);
* otherwise it fails.
* @unbind_from_tz: callback called when a governor is unbound from a
* thermal zone.
+ * @trip_crossed: called for trip points that have just been crossed
* @throttle: callback called for every trip point even if temperature is
* below the trip point temperature
* @update_tz: callback called when thermal zone internals have changed, e.g.
const char *name;
int (*bind_to_tz)(struct thermal_zone_device *tz);
void (*unbind_from_tz)(struct thermal_zone_device *tz);
+ void (*trip_crossed)(struct thermal_zone_device *tz,
+ const struct thermal_trip *trip,
+ bool crossed_up);
int (*throttle)(struct thermal_zone_device *tz,
const struct thermal_trip *trip);
void (*update_tz)(struct thermal_zone_device *tz,