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