Lines Matching refs:tz
89 static int of_thermal_get_temp(struct thermal_zone_device *tz, in of_thermal_get_temp() argument
92 struct __thermal_zone *data = tz->devdata; in of_thermal_get_temp()
110 int of_thermal_get_ntrips(struct thermal_zone_device *tz) in of_thermal_get_ntrips() argument
112 struct __thermal_zone *data = tz->devdata; in of_thermal_get_ntrips()
131 bool of_thermal_is_trip_valid(struct thermal_zone_device *tz, int trip) in of_thermal_is_trip_valid() argument
133 struct __thermal_zone *data = tz->devdata; in of_thermal_is_trip_valid()
153 of_thermal_get_trip_points(struct thermal_zone_device *tz) in of_thermal_get_trip_points() argument
155 struct __thermal_zone *data = tz->devdata; in of_thermal_get_trip_points()
175 static int of_thermal_set_emul_temp(struct thermal_zone_device *tz, in of_thermal_set_emul_temp() argument
178 struct __thermal_zone *data = tz->devdata; in of_thermal_set_emul_temp()
186 static int of_thermal_get_trend(struct thermal_zone_device *tz, int trip, in of_thermal_get_trend() argument
189 struct __thermal_zone *data = tz->devdata; in of_thermal_get_trend()
265 static int of_thermal_get_mode(struct thermal_zone_device *tz, in of_thermal_get_mode() argument
268 struct __thermal_zone *data = tz->devdata; in of_thermal_get_mode()
275 static int of_thermal_set_mode(struct thermal_zone_device *tz, in of_thermal_set_mode() argument
278 struct __thermal_zone *data = tz->devdata; in of_thermal_set_mode()
280 mutex_lock(&tz->lock); in of_thermal_set_mode()
283 tz->polling_delay = data->polling_delay; in of_thermal_set_mode()
285 tz->polling_delay = 0; in of_thermal_set_mode()
287 mutex_unlock(&tz->lock); in of_thermal_set_mode()
290 thermal_zone_device_update(tz); in of_thermal_set_mode()
295 static int of_thermal_get_trip_type(struct thermal_zone_device *tz, int trip, in of_thermal_get_trip_type() argument
298 struct __thermal_zone *data = tz->devdata; in of_thermal_get_trip_type()
308 static int of_thermal_get_trip_temp(struct thermal_zone_device *tz, int trip, in of_thermal_get_trip_temp() argument
311 struct __thermal_zone *data = tz->devdata; in of_thermal_get_trip_temp()
321 static int of_thermal_set_trip_temp(struct thermal_zone_device *tz, int trip, in of_thermal_set_trip_temp() argument
324 struct __thermal_zone *data = tz->devdata; in of_thermal_set_trip_temp()
335 static int of_thermal_get_trip_hyst(struct thermal_zone_device *tz, int trip, in of_thermal_get_trip_hyst() argument
338 struct __thermal_zone *data = tz->devdata; in of_thermal_get_trip_hyst()
348 static int of_thermal_set_trip_hyst(struct thermal_zone_device *tz, int trip, in of_thermal_set_trip_hyst() argument
351 struct __thermal_zone *data = tz->devdata; in of_thermal_set_trip_hyst()
362 static int of_thermal_get_crit_temp(struct thermal_zone_device *tz, in of_thermal_get_crit_temp() argument
365 struct __thermal_zone *data = tz->devdata; in of_thermal_get_crit_temp()
400 struct __thermal_zone *tz; in thermal_zone_of_add_sensor() local
406 tz = tzd->devdata; in thermal_zone_of_add_sensor()
412 tz->ops = ops; in thermal_zone_of_add_sensor()
413 tz->sensor_data = data; in thermal_zone_of_add_sensor()
535 struct __thermal_zone *tz; in thermal_zone_of_sensor_unregister() local
540 tz = tzd->devdata; in thermal_zone_of_sensor_unregister()
543 if (!tz) in thermal_zone_of_sensor_unregister()
551 tz->ops = NULL; in thermal_zone_of_sensor_unregister()
552 tz->sensor_data = NULL; in thermal_zone_of_sensor_unregister()
728 struct __thermal_zone *tz; in thermal_of_build_thermal_zone() local
737 tz = kzalloc(sizeof(*tz), GFP_KERNEL); in thermal_of_build_thermal_zone()
738 if (!tz) in thermal_of_build_thermal_zone()
746 tz->passive_delay = prop; in thermal_of_build_thermal_zone()
753 tz->polling_delay = prop; in thermal_of_build_thermal_zone()
762 tz->ntrips = of_get_child_count(child); in thermal_of_build_thermal_zone()
763 if (tz->ntrips == 0) /* must have at least one child */ in thermal_of_build_thermal_zone()
766 tz->trips = kzalloc(tz->ntrips * sizeof(*tz->trips), GFP_KERNEL); in thermal_of_build_thermal_zone()
767 if (!tz->trips) { in thermal_of_build_thermal_zone()
774 ret = thermal_of_populate_trip(gchild, &tz->trips[i++]); in thermal_of_build_thermal_zone()
788 tz->num_tbps = of_get_child_count(child); in thermal_of_build_thermal_zone()
789 if (tz->num_tbps == 0) in thermal_of_build_thermal_zone()
792 tz->tbps = kzalloc(tz->num_tbps * sizeof(*tz->tbps), GFP_KERNEL); in thermal_of_build_thermal_zone()
793 if (!tz->tbps) { in thermal_of_build_thermal_zone()
800 ret = thermal_of_populate_bind_params(gchild, &tz->tbps[i++], in thermal_of_build_thermal_zone()
801 tz->trips, tz->ntrips); in thermal_of_build_thermal_zone()
808 tz->mode = THERMAL_DEVICE_DISABLED; in thermal_of_build_thermal_zone()
810 return tz; in thermal_of_build_thermal_zone()
813 for (i = 0; i < tz->num_tbps; i++) in thermal_of_build_thermal_zone()
814 of_node_put(tz->tbps[i].cooling_device); in thermal_of_build_thermal_zone()
815 kfree(tz->tbps); in thermal_of_build_thermal_zone()
817 for (i = 0; i < tz->ntrips; i++) in thermal_of_build_thermal_zone()
818 of_node_put(tz->trips[i].np); in thermal_of_build_thermal_zone()
819 kfree(tz->trips); in thermal_of_build_thermal_zone()
822 kfree(tz); in thermal_of_build_thermal_zone()
828 static inline void of_thermal_free_zone(struct __thermal_zone *tz) in of_thermal_free_zone() argument
832 for (i = 0; i < tz->num_tbps; i++) in of_thermal_free_zone()
833 of_node_put(tz->tbps[i].cooling_device); in of_thermal_free_zone()
834 kfree(tz->tbps); in of_thermal_free_zone()
835 for (i = 0; i < tz->ntrips; i++) in of_thermal_free_zone()
836 of_node_put(tz->trips[i].np); in of_thermal_free_zone()
837 kfree(tz->trips); in of_thermal_free_zone()
838 kfree(tz); in of_thermal_free_zone()
856 struct __thermal_zone *tz; in of_parse_thermal_zones() local
873 tz = thermal_of_build_thermal_zone(child); in of_parse_thermal_zones()
874 if (IS_ERR(tz)) { in of_parse_thermal_zones()
877 PTR_ERR(tz)); in of_parse_thermal_zones()
894 zone = thermal_zone_device_register(child->name, tz->ntrips, in of_parse_thermal_zones()
895 0, tz, in of_parse_thermal_zones()
897 tz->passive_delay, in of_parse_thermal_zones()
898 tz->polling_delay); in of_parse_thermal_zones()
904 of_thermal_free_zone(tz); in of_parse_thermal_zones()
915 of_thermal_free_zone(tz); in of_parse_thermal_zones()