Lines Matching +full:cooling +full:- +full:levels

1 // SPDX-License-Identifier: GPL-2.0-only
3 * fair_share.c - A simple weight based Thermal governor
22 int trip_level = -1; in get_trip_level()
25 if (td->threshold > tz->temperature) in get_trip_level()
30 if (!level_td || td->threshold > level_td->threshold) in get_trip_level()
38 trace_thermal_zone_trip(tz, thermal_zone_trip_id(tz, &level_td->trip), in get_trip_level()
39 level_td->trip.type); in get_trip_level()
45 * fair_share_throttle - throttles devices associated with the given zone
51 * throttle state of the cooling devices associated with the given zone.
54 * P1. max_state: Maximum throttle state exposed by the cooling device.
56 * How 'effective' the 'i'th device is, in cooling the given zone.
60 * whereas the throttling is at full swing if we trip critical levels.
61 * new_state of cooling device = P3 * P2 * P1
71 list_for_each_entry(instance, &tz->thermal_instances, tz_node) { in fair_share_throttle()
72 if (instance->trip != trip) in fair_share_throttle()
75 total_weight += instance->weight; in fair_share_throttle()
79 list_for_each_entry(instance, &tz->thermal_instances, tz_node) { in fair_share_throttle()
80 struct thermal_cooling_device *cdev = instance->cdev; in fair_share_throttle()
84 if (instance->trip != trip) in fair_share_throttle()
88 dividend *= cdev->max_state; in fair_share_throttle()
89 divisor = tz->num_trips; in fair_share_throttle()
91 dividend *= instance->weight; in fair_share_throttle()
96 instance->target = div_u64(dividend, divisor); in fair_share_throttle()
98 mutex_lock(&cdev->lock); in fair_share_throttle()
100 mutex_unlock(&cdev->lock); in fair_share_throttle()
109 lockdep_assert_held(&tz->lock); in fair_share_manage()
112 const struct thermal_trip *trip = &td->trip; in fair_share_manage()
114 if (trip->temperature == THERMAL_TEMP_INVALID || in fair_share_manage()
115 trip->type == THERMAL_TRIP_CRITICAL || in fair_share_manage()
116 trip->type == THERMAL_TRIP_HOT) in fair_share_manage()