Lines Matching full:tz
25 int get_tz_trend(struct thermal_zone_device *tz, int trip_index) in get_tz_trend() argument
27 struct thermal_trip *trip = tz->trips ? &tz->trips[trip_index] : NULL; in get_tz_trend()
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()
44 get_thermal_instance(struct thermal_zone_device *tz, in get_thermal_instance() argument
51 mutex_lock(&tz->lock); in get_thermal_instance()
54 trip = &tz->trips[trip_index]; in get_thermal_instance()
56 list_for_each_entry(pos, &tz->thermal_instances, tz_node) { in get_thermal_instance()
57 if (pos->tz == tz && pos->trip == trip && pos->cdev == cdev) { in get_thermal_instance()
64 mutex_unlock(&tz->lock); in get_thermal_instance()
72 * @tz: a valid pointer to a struct thermal_zone_device
78 * Both tz and tz->ops must be valid pointers when calling this function,
79 * and the tz->ops->get_temp callback must be provided.
80 * The function must be called under tz->lock.
84 int __thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp) in __thermal_zone_get_temp() argument
91 lockdep_assert_held(&tz->lock); in __thermal_zone_get_temp()
93 ret = tz->ops->get_temp(tz, temp); in __thermal_zone_get_temp()
95 if (IS_ENABLED(CONFIG_THERMAL_EMULATION) && tz->emul_temperature) { in __thermal_zone_get_temp()
96 for (count = 0; count < tz->num_trips; count++) { in __thermal_zone_get_temp()
97 ret = __thermal_zone_get_trip(tz, count, &trip); in __thermal_zone_get_temp()
110 *temp = tz->emul_temperature; in __thermal_zone_get_temp()
114 dev_dbg(&tz->device, "Failed to get temperature: %d\n", ret); in __thermal_zone_get_temp()
121 * @tz: a valid pointer to a struct thermal_zone_device
129 int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp) in thermal_zone_get_temp() argument
133 if (IS_ERR_OR_NULL(tz)) in thermal_zone_get_temp()
136 mutex_lock(&tz->lock); in thermal_zone_get_temp()
138 if (!tz->ops->get_temp) { in thermal_zone_get_temp()
143 if (device_is_registered(&tz->device)) in thermal_zone_get_temp()
144 ret = __thermal_zone_get_temp(tz, temp); in thermal_zone_get_temp()
149 mutex_unlock(&tz->lock); in thermal_zone_get_temp()
173 instance->tz->id, instance->target); in __thermal_cdev_update()
204 * @tz: thermal zone device with the slope attribute
209 int thermal_zone_get_slope(struct thermal_zone_device *tz) in thermal_zone_get_slope() argument
211 if (tz && tz->tzp) in thermal_zone_get_slope()
212 return tz->tzp->slope; in thermal_zone_get_slope()
219 * @tz: thermal zone device with the offset attribute
224 int thermal_zone_get_offset(struct thermal_zone_device *tz) in thermal_zone_get_offset() argument
226 if (tz && tz->tzp) in thermal_zone_get_offset()
227 return tz->tzp->offset; in thermal_zone_get_offset()