Lines Matching +full:high +full:- +full:to +full:- +full:low
1 // SPDX-License-Identifier: GPL-2.0
35 mutex_lock(&tz->lock); in thermal_zone_for_each_trip()
37 mutex_unlock(&tz->lock); in thermal_zone_for_each_trip()
45 return tz->num_trips; in thermal_zone_get_num_trips()
50 * __thermal_zone_set_trips - Computes the next trip points for the driver
51 * @tz: a pointer to a thermal zone device structure
54 * the trip points. The result is the closer low and high trip points
55 * to the current temperature. These values are passed to the backend
56 * driver to let it set its own notification mechanism (usually an
59 * This function must be called with tz->lock held. Both tz and tz->ops
67 int low = -INT_MAX, high = INT_MAX; in __thermal_zone_set_trips() local
71 lockdep_assert_held(&tz->lock); in __thermal_zone_set_trips()
73 if (!tz->ops->set_trips) in __thermal_zone_set_trips()
80 trip_low = trip->temperature - trip->hysteresis; in __thermal_zone_set_trips()
82 if (trip_low < tz->temperature && trip_low > low) { in __thermal_zone_set_trips()
83 low = trip_low; in __thermal_zone_set_trips()
88 if (trip->temperature > tz->temperature && in __thermal_zone_set_trips()
89 trip->temperature < high) { in __thermal_zone_set_trips()
90 high = trip->temperature; in __thermal_zone_set_trips()
95 /* No need to change trip points */ in __thermal_zone_set_trips()
96 if (tz->prev_low_trip == low && tz->prev_high_trip == high) in __thermal_zone_set_trips()
100 * If "high" and "low" are the same, skip the change unless this is the in __thermal_zone_set_trips()
103 if (same_trip && (tz->prev_low_trip != -INT_MAX || in __thermal_zone_set_trips()
104 tz->prev_high_trip != INT_MAX)) in __thermal_zone_set_trips()
107 tz->prev_low_trip = low; in __thermal_zone_set_trips()
108 tz->prev_high_trip = high; in __thermal_zone_set_trips()
110 dev_dbg(&tz->device, in __thermal_zone_set_trips()
111 "new temperature boundaries: %d < x < %d\n", low, high); in __thermal_zone_set_trips()
117 ret = tz->ops->set_trips(tz, low, high); in __thermal_zone_set_trips()
119 dev_err(&tz->device, "Failed to set trips: %d\n", ret); in __thermal_zone_set_trips()
125 if (!tz || !tz->trips || trip_id < 0 || trip_id >= tz->num_trips || !trip) in __thermal_zone_get_trip()
126 return -EINVAL; in __thermal_zone_get_trip()
128 *trip = tz->trips[trip_id]; in __thermal_zone_get_trip()
138 mutex_lock(&tz->lock); in thermal_zone_get_trip()
140 mutex_unlock(&tz->lock); in thermal_zone_get_trip()
150 * Assume the trip to be located within the bounds of the thermal in thermal_zone_trip_id()
153 return trip - tz->trips; in thermal_zone_trip_id()
165 if (trip->temperature == temp) in thermal_zone_set_trip_temp()
168 trip->temperature = temp; in thermal_zone_set_trip_temp()