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