Lines Matching refs:tz

93 static int of_thermal_get_temp(struct thermal_zone_device *tz,  in of_thermal_get_temp()  argument
96 struct __thermal_zone *data = tz->devdata; in of_thermal_get_temp()
114 int of_thermal_get_ntrips(struct thermal_zone_device *tz) in of_thermal_get_ntrips() argument
116 struct __thermal_zone *data = tz->devdata; in of_thermal_get_ntrips()
135 bool of_thermal_is_trip_valid(struct thermal_zone_device *tz, int trip) in of_thermal_is_trip_valid() argument
137 struct __thermal_zone *data = tz->devdata; in of_thermal_is_trip_valid()
157 of_thermal_get_trip_points(struct thermal_zone_device *tz) in of_thermal_get_trip_points() argument
159 struct __thermal_zone *data = tz->devdata; in of_thermal_get_trip_points()
179 static int of_thermal_set_emul_temp(struct thermal_zone_device *tz, in of_thermal_set_emul_temp() argument
182 struct __thermal_zone *data = tz->devdata; in of_thermal_set_emul_temp()
190 static int of_thermal_get_trend(struct thermal_zone_device *tz, int trip, in of_thermal_get_trend() argument
193 struct __thermal_zone *data = tz->devdata; in of_thermal_get_trend()
270 static int of_thermal_get_mode(struct thermal_zone_device *tz, in of_thermal_get_mode() argument
273 struct __thermal_zone *data = tz->devdata; in of_thermal_get_mode()
280 static int of_thermal_set_mode(struct thermal_zone_device *tz, in of_thermal_set_mode() argument
283 struct __thermal_zone *data = tz->devdata; in of_thermal_set_mode()
285 mutex_lock(&tz->lock); in of_thermal_set_mode()
288 tz->polling_delay = data->polling_delay; in of_thermal_set_mode()
290 tz->polling_delay = 0; in of_thermal_set_mode()
292 mutex_unlock(&tz->lock); in of_thermal_set_mode()
295 thermal_zone_device_update(tz); in of_thermal_set_mode()
300 static int of_thermal_get_trip_type(struct thermal_zone_device *tz, int trip, in of_thermal_get_trip_type() argument
303 struct __thermal_zone *data = tz->devdata; in of_thermal_get_trip_type()
313 static int of_thermal_get_trip_temp(struct thermal_zone_device *tz, int trip, in of_thermal_get_trip_temp() argument
316 struct __thermal_zone *data = tz->devdata; in of_thermal_get_trip_temp()
326 static int of_thermal_set_trip_temp(struct thermal_zone_device *tz, int trip, in of_thermal_set_trip_temp() argument
329 struct __thermal_zone *data = tz->devdata; in of_thermal_set_trip_temp()
340 static int of_thermal_get_trip_hyst(struct thermal_zone_device *tz, int trip, in of_thermal_get_trip_hyst() argument
343 struct __thermal_zone *data = tz->devdata; in of_thermal_get_trip_hyst()
353 static int of_thermal_set_trip_hyst(struct thermal_zone_device *tz, int trip, in of_thermal_set_trip_hyst() argument
356 struct __thermal_zone *data = tz->devdata; in of_thermal_set_trip_hyst()
367 static int of_thermal_get_crit_temp(struct thermal_zone_device *tz, in of_thermal_get_crit_temp() argument
370 struct __thermal_zone *data = tz->devdata; in of_thermal_get_crit_temp()
405 struct __thermal_zone *tz; in thermal_zone_of_add_sensor() local
411 tz = tzd->devdata; in thermal_zone_of_add_sensor()
417 tz->ops = ops; in thermal_zone_of_add_sensor()
418 tz->sensor_data = data; in thermal_zone_of_add_sensor()
540 struct __thermal_zone *tz; in thermal_zone_of_sensor_unregister() local
545 tz = tzd->devdata; in thermal_zone_of_sensor_unregister()
548 if (!tz) in thermal_zone_of_sensor_unregister()
556 tz->ops = NULL; in thermal_zone_of_sensor_unregister()
557 tz->sensor_data = NULL; in thermal_zone_of_sensor_unregister()
733 struct __thermal_zone *tz; in thermal_of_build_thermal_zone() local
742 tz = kzalloc(sizeof(*tz), GFP_KERNEL); in thermal_of_build_thermal_zone()
743 if (!tz) in thermal_of_build_thermal_zone()
751 tz->passive_delay = prop; in thermal_of_build_thermal_zone()
758 tz->polling_delay = prop; in thermal_of_build_thermal_zone()
767 tz->slope = coef[0]; in thermal_of_build_thermal_zone()
768 tz->offset = coef[1]; in thermal_of_build_thermal_zone()
770 tz->slope = 1; in thermal_of_build_thermal_zone()
771 tz->offset = 0; in thermal_of_build_thermal_zone()
781 tz->ntrips = of_get_child_count(child); in thermal_of_build_thermal_zone()
782 if (tz->ntrips == 0) /* must have at least one child */ in thermal_of_build_thermal_zone()
785 tz->trips = kzalloc(tz->ntrips * sizeof(*tz->trips), GFP_KERNEL); in thermal_of_build_thermal_zone()
786 if (!tz->trips) { in thermal_of_build_thermal_zone()
793 ret = thermal_of_populate_trip(gchild, &tz->trips[i++]); in thermal_of_build_thermal_zone()
807 tz->num_tbps = of_get_child_count(child); in thermal_of_build_thermal_zone()
808 if (tz->num_tbps == 0) in thermal_of_build_thermal_zone()
811 tz->tbps = kzalloc(tz->num_tbps * sizeof(*tz->tbps), GFP_KERNEL); in thermal_of_build_thermal_zone()
812 if (!tz->tbps) { in thermal_of_build_thermal_zone()
819 ret = thermal_of_populate_bind_params(gchild, &tz->tbps[i++], in thermal_of_build_thermal_zone()
820 tz->trips, tz->ntrips); in thermal_of_build_thermal_zone()
827 tz->mode = THERMAL_DEVICE_DISABLED; in thermal_of_build_thermal_zone()
829 return tz; in thermal_of_build_thermal_zone()
832 for (i = 0; i < tz->num_tbps; i++) in thermal_of_build_thermal_zone()
833 of_node_put(tz->tbps[i].cooling_device); in thermal_of_build_thermal_zone()
834 kfree(tz->tbps); in thermal_of_build_thermal_zone()
836 for (i = 0; i < tz->ntrips; i++) in thermal_of_build_thermal_zone()
837 of_node_put(tz->trips[i].np); in thermal_of_build_thermal_zone()
838 kfree(tz->trips); in thermal_of_build_thermal_zone()
841 kfree(tz); in thermal_of_build_thermal_zone()
847 static inline void of_thermal_free_zone(struct __thermal_zone *tz) in of_thermal_free_zone() argument
851 for (i = 0; i < tz->num_tbps; i++) in of_thermal_free_zone()
852 of_node_put(tz->tbps[i].cooling_device); in of_thermal_free_zone()
853 kfree(tz->tbps); in of_thermal_free_zone()
854 for (i = 0; i < tz->ntrips; i++) in of_thermal_free_zone()
855 of_node_put(tz->trips[i].np); in of_thermal_free_zone()
856 kfree(tz->trips); in of_thermal_free_zone()
857 kfree(tz); in of_thermal_free_zone()
875 struct __thermal_zone *tz; in of_parse_thermal_zones() local
894 tz = thermal_of_build_thermal_zone(child); in of_parse_thermal_zones()
895 if (IS_ERR(tz)) { in of_parse_thermal_zones()
898 PTR_ERR(tz)); in of_parse_thermal_zones()
918 for (i = 0; i < tz->ntrips; i++) in of_parse_thermal_zones()
922 tzp->slope = tz->slope; in of_parse_thermal_zones()
923 tzp->offset = tz->offset; in of_parse_thermal_zones()
925 zone = thermal_zone_device_register(child->name, tz->ntrips, in of_parse_thermal_zones()
926 mask, tz, in of_parse_thermal_zones()
928 tz->passive_delay, in of_parse_thermal_zones()
929 tz->polling_delay); in of_parse_thermal_zones()
935 of_thermal_free_zone(tz); in of_parse_thermal_zones()
946 of_thermal_free_zone(tz); in of_parse_thermal_zones()