Lines Matching refs:tz

26 int get_tz_trend(struct thermal_zone_device *tz, int trip)
30 if (tz->emul_temperature || !tz->ops->get_trend ||
31 tz->ops->get_trend(tz, trip, &trend)) {
32 if (tz->temperature > tz->last_temperature)
34 else if (tz->temperature < tz->last_temperature)
45 get_thermal_instance(struct thermal_zone_device *tz,
51 mutex_lock(&tz->lock);
54 list_for_each_entry(pos, &tz->thermal_instances, tz_node) {
55 if (pos->tz == tz && pos->trip == trip && pos->cdev == cdev) {
62 mutex_unlock(&tz->lock);
70 * @tz: a valid pointer to a struct thermal_zone_device
78 int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp)
85 if (!tz || IS_ERR(tz) || !tz->ops->get_temp)
88 mutex_lock(&tz->lock);
90 ret = tz->ops->get_temp(tz, temp);
92 if (IS_ENABLED(CONFIG_THERMAL_EMULATION) && tz->emul_temperature) {
93 for (count = 0; count < tz->trips; count++) {
94 ret = tz->ops->get_trip_type(tz, count, &type);
96 ret = tz->ops->get_trip_temp(tz, count,
108 *temp = tz->emul_temperature;
111 mutex_unlock(&tz->lock);
119 * @tz: a pointer to a thermal zone device structure
129 void thermal_zone_set_trips(struct thermal_zone_device *tz)
136 mutex_lock(&tz->lock);
138 if (!tz->ops->set_trips || !tz->ops->get_trip_hyst)
141 for (i = 0; i < tz->trips; i++) {
144 tz->ops->get_trip_temp(tz, i, &trip_temp);
145 tz->ops->get_trip_hyst(tz, i, &hysteresis);
149 if (trip_low < tz->temperature && trip_low > low)
152 if (trip_temp > tz->temperature && trip_temp < high)
157 if (tz->prev_low_trip == low && tz->prev_high_trip == high)
160 tz->prev_low_trip = low;
161 tz->prev_high_trip = high;
163 dev_dbg(&tz->device,
170 ret = tz->ops->set_trips(tz, low, high);
172 dev_err(&tz->device, "Failed to set trips: %d\n", ret);
175 mutex_unlock(&tz->lock);
203 instance->tz->id, instance->target);
221 * @tz: thermal zone device with the slope attribute
226 int thermal_zone_get_slope(struct thermal_zone_device *tz)
228 if (tz && tz->tzp)
229 return tz->tzp->slope;
236 * @tz: thermal zone device with the offset attribute
241 int thermal_zone_get_offset(struct thermal_zone_device *tz)
243 if (tz && tz->tzp)
244 return tz->tzp->offset;