Lines Matching refs:tz
89 static void bind_previous_governor(struct thermal_zone_device *tz, in bind_previous_governor() argument
92 if (tz->governor && tz->governor->bind_to_tz) { in bind_previous_governor()
93 if (tz->governor->bind_to_tz(tz)) { in bind_previous_governor()
94 dev_err(&tz->device, in bind_previous_governor()
96 failed_gov_name, tz->governor->name, tz->type); in bind_previous_governor()
97 tz->governor = NULL; in bind_previous_governor()
111 static int thermal_set_governor(struct thermal_zone_device *tz, in thermal_set_governor() argument
116 if (tz->governor && tz->governor->unbind_from_tz) in thermal_set_governor()
117 tz->governor->unbind_from_tz(tz); in thermal_set_governor()
120 ret = new_gov->bind_to_tz(tz); in thermal_set_governor()
122 bind_previous_governor(tz, new_gov->name); in thermal_set_governor()
128 tz->governor = new_gov; in thermal_set_governor()
233 int get_tz_trend(struct thermal_zone_device *tz, int trip) in get_tz_trend() argument
237 if (tz->emul_temperature || !tz->ops->get_trend || in get_tz_trend()
238 tz->ops->get_trend(tz, trip, &trend)) { in get_tz_trend()
239 if (tz->temperature > tz->last_temperature) in get_tz_trend()
241 else if (tz->temperature < tz->last_temperature) in get_tz_trend()
251 struct thermal_instance *get_thermal_instance(struct thermal_zone_device *tz, in get_thermal_instance() argument
257 mutex_lock(&tz->lock); in get_thermal_instance()
260 list_for_each_entry(pos, &tz->thermal_instances, tz_node) { in get_thermal_instance()
261 if (pos->tz == tz && pos->trip == trip && pos->cdev == cdev) { in get_thermal_instance()
268 mutex_unlock(&tz->lock); in get_thermal_instance()
274 static void print_bind_err_msg(struct thermal_zone_device *tz, in print_bind_err_msg() argument
277 dev_err(&tz->device, "binding zone %s with cdev %s failed:%d\n", in print_bind_err_msg()
278 tz->type, cdev->type, ret); in print_bind_err_msg()
281 static void __bind(struct thermal_zone_device *tz, int mask, in __bind() argument
288 for (i = 0; i < tz->trips; i++) { in __bind()
298 ret = thermal_zone_bind_cooling_device(tz, i, cdev, in __bind()
302 print_bind_err_msg(tz, cdev, ret); in __bind()
307 static void __unbind(struct thermal_zone_device *tz, int mask, in __unbind() argument
312 for (i = 0; i < tz->trips; i++) in __unbind()
314 thermal_zone_unbind_cooling_device(tz, i, cdev); in __unbind()
355 static void bind_tz(struct thermal_zone_device *tz) in bind_tz() argument
359 const struct thermal_zone_params *tzp = tz->tzp; in bind_tz()
361 if (!tzp && !tz->ops->bind) in bind_tz()
367 if (tz->ops->bind) { in bind_tz()
369 ret = tz->ops->bind(tz, pos); in bind_tz()
371 print_bind_err_msg(tz, pos, ret); in bind_tz()
383 if (tzp->tbp[i].match(tz, pos)) in bind_tz()
386 __bind(tz, tzp->tbp[i].trip_mask, pos, in bind_tz()
395 static void thermal_zone_device_set_polling(struct thermal_zone_device *tz, in thermal_zone_device_set_polling() argument
399 mod_delayed_work(system_freezable_wq, &tz->poll_queue, in thermal_zone_device_set_polling()
402 mod_delayed_work(system_freezable_wq, &tz->poll_queue, in thermal_zone_device_set_polling()
405 cancel_delayed_work(&tz->poll_queue); in thermal_zone_device_set_polling()
408 static void monitor_thermal_zone(struct thermal_zone_device *tz) in monitor_thermal_zone() argument
410 mutex_lock(&tz->lock); in monitor_thermal_zone()
412 if (tz->passive) in monitor_thermal_zone()
413 thermal_zone_device_set_polling(tz, tz->passive_delay); in monitor_thermal_zone()
414 else if (tz->polling_delay) in monitor_thermal_zone()
415 thermal_zone_device_set_polling(tz, tz->polling_delay); in monitor_thermal_zone()
417 thermal_zone_device_set_polling(tz, 0); in monitor_thermal_zone()
419 mutex_unlock(&tz->lock); in monitor_thermal_zone()
422 static void handle_non_critical_trips(struct thermal_zone_device *tz, in handle_non_critical_trips() argument
425 tz->governor ? tz->governor->throttle(tz, trip) : in handle_non_critical_trips()
426 def_governor->throttle(tz, trip); in handle_non_critical_trips()
429 static void handle_critical_trips(struct thermal_zone_device *tz, in handle_critical_trips() argument
434 tz->ops->get_trip_temp(tz, trip, &trip_temp); in handle_critical_trips()
437 if (trip_temp <= 0 || tz->temperature < trip_temp) in handle_critical_trips()
440 trace_thermal_zone_trip(tz, trip, trip_type); in handle_critical_trips()
442 if (tz->ops->notify) in handle_critical_trips()
443 tz->ops->notify(tz, trip, trip_type); in handle_critical_trips()
446 dev_emerg(&tz->device, in handle_critical_trips()
448 tz->temperature / 1000); in handle_critical_trips()
453 static void handle_thermal_trip(struct thermal_zone_device *tz, int trip) in handle_thermal_trip() argument
458 if (test_bit(trip, &tz->trips_disabled)) in handle_thermal_trip()
461 tz->ops->get_trip_type(tz, trip, &type); in handle_thermal_trip()
464 handle_critical_trips(tz, trip, type); in handle_thermal_trip()
466 handle_non_critical_trips(tz, trip, type); in handle_thermal_trip()
471 monitor_thermal_zone(tz); in handle_thermal_trip()
484 int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp) in thermal_zone_get_temp() argument
491 if (!tz || IS_ERR(tz) || !tz->ops->get_temp) in thermal_zone_get_temp()
494 mutex_lock(&tz->lock); in thermal_zone_get_temp()
496 ret = tz->ops->get_temp(tz, temp); in thermal_zone_get_temp()
498 if (IS_ENABLED(CONFIG_THERMAL_EMULATION) && tz->emul_temperature) { in thermal_zone_get_temp()
499 for (count = 0; count < tz->trips; count++) { in thermal_zone_get_temp()
500 ret = tz->ops->get_trip_type(tz, count, &type); in thermal_zone_get_temp()
502 ret = tz->ops->get_trip_temp(tz, count, in thermal_zone_get_temp()
514 *temp = tz->emul_temperature; in thermal_zone_get_temp()
517 mutex_unlock(&tz->lock); in thermal_zone_get_temp()
523 static void update_temperature(struct thermal_zone_device *tz) in update_temperature() argument
527 ret = thermal_zone_get_temp(tz, &temp); in update_temperature()
530 dev_warn(&tz->device, in update_temperature()
536 mutex_lock(&tz->lock); in update_temperature()
537 tz->last_temperature = tz->temperature; in update_temperature()
538 tz->temperature = temp; in update_temperature()
539 mutex_unlock(&tz->lock); in update_temperature()
541 trace_thermal_temperature(tz); in update_temperature()
542 if (tz->last_temperature == THERMAL_TEMP_INVALID) in update_temperature()
543 dev_dbg(&tz->device, "last_temperature N/A, current_temperature=%d\n", in update_temperature()
544 tz->temperature); in update_temperature()
546 dev_dbg(&tz->device, "last_temperature=%d, current_temperature=%d\n", in update_temperature()
547 tz->last_temperature, tz->temperature); in update_temperature()
550 static void thermal_zone_device_reset(struct thermal_zone_device *tz) in thermal_zone_device_reset() argument
554 tz->temperature = THERMAL_TEMP_INVALID; in thermal_zone_device_reset()
555 tz->passive = 0; in thermal_zone_device_reset()
556 list_for_each_entry(pos, &tz->thermal_instances, tz_node) in thermal_zone_device_reset()
560 void thermal_zone_device_update(struct thermal_zone_device *tz) in thermal_zone_device_update() argument
567 if (!tz->ops->get_temp) in thermal_zone_device_update()
570 update_temperature(tz); in thermal_zone_device_update()
572 for (count = 0; count < tz->trips; count++) in thermal_zone_device_update()
573 handle_thermal_trip(tz, count); in thermal_zone_device_update()
579 struct thermal_zone_device *tz = container_of(work, struct in thermal_zone_device_check() local
582 thermal_zone_device_update(tz); in thermal_zone_device_check()
593 struct thermal_zone_device *tz = to_thermal_zone(dev); in type_show() local
595 return sprintf(buf, "%s\n", tz->type); in type_show()
601 struct thermal_zone_device *tz = to_thermal_zone(dev); in temp_show() local
604 ret = thermal_zone_get_temp(tz, &temperature); in temp_show()
615 struct thermal_zone_device *tz = to_thermal_zone(dev); in mode_show() local
619 if (!tz->ops->get_mode) in mode_show()
622 result = tz->ops->get_mode(tz, &mode); in mode_show()
634 struct thermal_zone_device *tz = to_thermal_zone(dev); in mode_store() local
637 if (!tz->ops->set_mode) in mode_store()
641 result = tz->ops->set_mode(tz, THERMAL_DEVICE_ENABLED); in mode_store()
643 result = tz->ops->set_mode(tz, THERMAL_DEVICE_DISABLED); in mode_store()
657 struct thermal_zone_device *tz = to_thermal_zone(dev); in trip_point_type_show() local
661 if (!tz->ops->get_trip_type) in trip_point_type_show()
667 result = tz->ops->get_trip_type(tz, trip, &type); in trip_point_type_show()
689 struct thermal_zone_device *tz = to_thermal_zone(dev); in trip_point_temp_store() local
693 if (!tz->ops->set_trip_temp) in trip_point_temp_store()
702 ret = tz->ops->set_trip_temp(tz, trip, temperature); in trip_point_temp_store()
711 struct thermal_zone_device *tz = to_thermal_zone(dev); in trip_point_temp_show() local
715 if (!tz->ops->get_trip_temp) in trip_point_temp_show()
721 ret = tz->ops->get_trip_temp(tz, trip, &temperature); in trip_point_temp_show()
733 struct thermal_zone_device *tz = to_thermal_zone(dev); in trip_point_hyst_store() local
737 if (!tz->ops->set_trip_hyst) in trip_point_hyst_store()
751 ret = tz->ops->set_trip_hyst(tz, trip, temperature); in trip_point_hyst_store()
760 struct thermal_zone_device *tz = to_thermal_zone(dev); in trip_point_hyst_show() local
764 if (!tz->ops->get_trip_hyst) in trip_point_hyst_show()
770 ret = tz->ops->get_trip_hyst(tz, trip, &temperature); in trip_point_hyst_show()
779 struct thermal_zone_device *tz = to_thermal_zone(dev); in passive_store() local
792 if (state && !tz->forced_passive) { in passive_store()
797 thermal_zone_bind_cooling_device(tz, in passive_store()
804 if (!tz->passive_delay) in passive_store()
805 tz->passive_delay = 1000; in passive_store()
806 } else if (!state && tz->forced_passive) { in passive_store()
811 thermal_zone_unbind_cooling_device(tz, in passive_store()
816 tz->passive_delay = 0; in passive_store()
819 tz->forced_passive = state; in passive_store()
821 thermal_zone_device_update(tz); in passive_store()
830 struct thermal_zone_device *tz = to_thermal_zone(dev); in passive_show() local
832 return sprintf(buf, "%d\n", tz->forced_passive); in passive_show()
840 struct thermal_zone_device *tz = to_thermal_zone(dev); in policy_store() local
847 mutex_lock(&tz->lock); in policy_store()
853 ret = thermal_set_governor(tz, gov); in policy_store()
858 mutex_unlock(&tz->lock); in policy_store()
866 struct thermal_zone_device *tz = to_thermal_zone(dev); in policy_show() local
868 return sprintf(buf, "%s\n", tz->governor->name); in policy_show()
896 struct thermal_zone_device *tz = to_thermal_zone(dev); in emul_temp_store() local
903 if (!tz->ops->set_emul_temp) { in emul_temp_store()
904 mutex_lock(&tz->lock); in emul_temp_store()
905 tz->emul_temperature = temperature; in emul_temp_store()
906 mutex_unlock(&tz->lock); in emul_temp_store()
908 ret = tz->ops->set_emul_temp(tz, temperature); in emul_temp_store()
912 thermal_zone_device_update(tz); in emul_temp_store()
922 struct thermal_zone_device *tz = to_thermal_zone(dev); in sustainable_power_show() local
924 if (tz->tzp) in sustainable_power_show()
925 return sprintf(buf, "%u\n", tz->tzp->sustainable_power); in sustainable_power_show()
934 struct thermal_zone_device *tz = to_thermal_zone(dev); in sustainable_power_store() local
937 if (!tz->tzp) in sustainable_power_store()
943 tz->tzp->sustainable_power = sustainable_power; in sustainable_power_store()
955 struct thermal_zone_device *tz = to_thermal_zone(dev); \
957 if (tz->tzp) \
958 return sprintf(buf, "%u\n", tz->tzp->name); \
967 struct thermal_zone_device *tz = to_thermal_zone(dev); \
970 if (!tz->tzp) \
976 tz->tzp->name = value; \
1031 struct thermal_zone_device *tz, u32 *max_power) in power_actor_get_max_power() argument
1036 return cdev->ops->state2power(cdev, tz, 0, max_power); in power_actor_get_max_power()
1052 struct thermal_zone_device *tz, u32 *min_power) in power_actor_get_min_power() argument
1064 return cdev->ops->state2power(cdev, tz, max_state, min_power); in power_actor_get_min_power()
1087 ret = cdev->ops->power2state(cdev, instance->tz, power, &state); in power_actor_set_power()
1258 int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz, in thermal_zone_bind_cooling_device() argument
1271 if (trip >= tz->trips || (trip < 0 && trip != THERMAL_TRIPS_NONE)) in thermal_zone_bind_cooling_device()
1275 if (pos1 == tz) in thermal_zone_bind_cooling_device()
1283 if (tz != pos1 || cdev != pos2) in thermal_zone_bind_cooling_device()
1301 dev->tz = tz; in thermal_zone_bind_cooling_device()
1309 result = get_idr(&tz->idr, &tz->lock, &dev->id); in thermal_zone_bind_cooling_device()
1315 sysfs_create_link(&tz->device.kobj, &cdev->device.kobj, dev->name); in thermal_zone_bind_cooling_device()
1324 result = device_create_file(&tz->device, &dev->attr); in thermal_zone_bind_cooling_device()
1334 result = device_create_file(&tz->device, &dev->weight_attr); in thermal_zone_bind_cooling_device()
1338 mutex_lock(&tz->lock); in thermal_zone_bind_cooling_device()
1340 list_for_each_entry(pos, &tz->thermal_instances, tz_node) in thermal_zone_bind_cooling_device()
1341 if (pos->tz == tz && pos->trip == trip && pos->cdev == cdev) { in thermal_zone_bind_cooling_device()
1346 list_add_tail(&dev->tz_node, &tz->thermal_instances); in thermal_zone_bind_cooling_device()
1348 atomic_set(&tz->need_update, 1); in thermal_zone_bind_cooling_device()
1351 mutex_unlock(&tz->lock); in thermal_zone_bind_cooling_device()
1356 device_remove_file(&tz->device, &dev->weight_attr); in thermal_zone_bind_cooling_device()
1358 device_remove_file(&tz->device, &dev->attr); in thermal_zone_bind_cooling_device()
1360 sysfs_remove_link(&tz->device.kobj, dev->name); in thermal_zone_bind_cooling_device()
1362 release_idr(&tz->idr, &tz->lock, dev->id); in thermal_zone_bind_cooling_device()
1383 int thermal_zone_unbind_cooling_device(struct thermal_zone_device *tz, in thermal_zone_unbind_cooling_device() argument
1389 mutex_lock(&tz->lock); in thermal_zone_unbind_cooling_device()
1391 list_for_each_entry_safe(pos, next, &tz->thermal_instances, tz_node) { in thermal_zone_unbind_cooling_device()
1392 if (pos->tz == tz && pos->trip == trip && pos->cdev == cdev) { in thermal_zone_unbind_cooling_device()
1396 mutex_unlock(&tz->lock); in thermal_zone_unbind_cooling_device()
1401 mutex_unlock(&tz->lock); in thermal_zone_unbind_cooling_device()
1406 device_remove_file(&tz->device, &pos->weight_attr); in thermal_zone_unbind_cooling_device()
1407 device_remove_file(&tz->device, &pos->attr); in thermal_zone_unbind_cooling_device()
1408 sysfs_remove_link(&tz->device.kobj, pos->name); in thermal_zone_unbind_cooling_device()
1409 release_idr(&tz->idr, &tz->lock, pos->id); in thermal_zone_unbind_cooling_device()
1417 struct thermal_zone_device *tz; in thermal_release() local
1422 tz = to_thermal_zone(dev); in thermal_release()
1423 kfree(tz); in thermal_release()
1568 struct thermal_zone_device *tz; in thermal_cooling_device_unregister() local
1586 list_for_each_entry(tz, &thermal_tz_list, node) { in thermal_cooling_device_unregister()
1587 if (tz->ops->unbind) { in thermal_cooling_device_unregister()
1588 tz->ops->unbind(tz, cdev); in thermal_cooling_device_unregister()
1592 if (!tz->tzp || !tz->tzp->tbp) in thermal_cooling_device_unregister()
1595 tzp = tz->tzp; in thermal_cooling_device_unregister()
1598 __unbind(tz, tzp->tbp[i].trip_mask, cdev); in thermal_cooling_device_unregister()
1630 instance->tz->id, instance->target); in thermal_cdev_update()
1656 void thermal_notify_framework(struct thermal_zone_device *tz, int trip) in thermal_notify_framework() argument
1658 handle_thermal_trip(tz, trip); in thermal_notify_framework()
1672 static int create_trip_attrs(struct thermal_zone_device *tz, int mask) in create_trip_attrs() argument
1675 int size = sizeof(struct thermal_attr) * tz->trips; in create_trip_attrs()
1677 tz->trip_type_attrs = kzalloc(size, GFP_KERNEL); in create_trip_attrs()
1678 if (!tz->trip_type_attrs) in create_trip_attrs()
1681 tz->trip_temp_attrs = kzalloc(size, GFP_KERNEL); in create_trip_attrs()
1682 if (!tz->trip_temp_attrs) { in create_trip_attrs()
1683 kfree(tz->trip_type_attrs); in create_trip_attrs()
1687 if (tz->ops->get_trip_hyst) { in create_trip_attrs()
1688 tz->trip_hyst_attrs = kzalloc(size, GFP_KERNEL); in create_trip_attrs()
1689 if (!tz->trip_hyst_attrs) { in create_trip_attrs()
1690 kfree(tz->trip_type_attrs); in create_trip_attrs()
1691 kfree(tz->trip_temp_attrs); in create_trip_attrs()
1697 for (indx = 0; indx < tz->trips; indx++) { in create_trip_attrs()
1699 snprintf(tz->trip_type_attrs[indx].name, THERMAL_NAME_LENGTH, in create_trip_attrs()
1702 sysfs_attr_init(&tz->trip_type_attrs[indx].attr.attr); in create_trip_attrs()
1703 tz->trip_type_attrs[indx].attr.attr.name = in create_trip_attrs()
1704 tz->trip_type_attrs[indx].name; in create_trip_attrs()
1705 tz->trip_type_attrs[indx].attr.attr.mode = S_IRUGO; in create_trip_attrs()
1706 tz->trip_type_attrs[indx].attr.show = trip_point_type_show; in create_trip_attrs()
1708 device_create_file(&tz->device, in create_trip_attrs()
1709 &tz->trip_type_attrs[indx].attr); in create_trip_attrs()
1712 snprintf(tz->trip_temp_attrs[indx].name, THERMAL_NAME_LENGTH, in create_trip_attrs()
1715 sysfs_attr_init(&tz->trip_temp_attrs[indx].attr.attr); in create_trip_attrs()
1716 tz->trip_temp_attrs[indx].attr.attr.name = in create_trip_attrs()
1717 tz->trip_temp_attrs[indx].name; in create_trip_attrs()
1718 tz->trip_temp_attrs[indx].attr.attr.mode = S_IRUGO; in create_trip_attrs()
1719 tz->trip_temp_attrs[indx].attr.show = trip_point_temp_show; in create_trip_attrs()
1722 tz->trip_temp_attrs[indx].attr.attr.mode |= S_IWUSR; in create_trip_attrs()
1723 tz->trip_temp_attrs[indx].attr.store = in create_trip_attrs()
1727 device_create_file(&tz->device, in create_trip_attrs()
1728 &tz->trip_temp_attrs[indx].attr); in create_trip_attrs()
1731 if (!tz->ops->get_trip_hyst) in create_trip_attrs()
1733 snprintf(tz->trip_hyst_attrs[indx].name, THERMAL_NAME_LENGTH, in create_trip_attrs()
1736 sysfs_attr_init(&tz->trip_hyst_attrs[indx].attr.attr); in create_trip_attrs()
1737 tz->trip_hyst_attrs[indx].attr.attr.name = in create_trip_attrs()
1738 tz->trip_hyst_attrs[indx].name; in create_trip_attrs()
1739 tz->trip_hyst_attrs[indx].attr.attr.mode = S_IRUGO; in create_trip_attrs()
1740 tz->trip_hyst_attrs[indx].attr.show = trip_point_hyst_show; in create_trip_attrs()
1741 if (tz->ops->set_trip_hyst) { in create_trip_attrs()
1742 tz->trip_hyst_attrs[indx].attr.attr.mode |= S_IWUSR; in create_trip_attrs()
1743 tz->trip_hyst_attrs[indx].attr.store = in create_trip_attrs()
1747 device_create_file(&tz->device, in create_trip_attrs()
1748 &tz->trip_hyst_attrs[indx].attr); in create_trip_attrs()
1753 static void remove_trip_attrs(struct thermal_zone_device *tz) in remove_trip_attrs() argument
1757 for (indx = 0; indx < tz->trips; indx++) { in remove_trip_attrs()
1758 device_remove_file(&tz->device, in remove_trip_attrs()
1759 &tz->trip_type_attrs[indx].attr); in remove_trip_attrs()
1760 device_remove_file(&tz->device, in remove_trip_attrs()
1761 &tz->trip_temp_attrs[indx].attr); in remove_trip_attrs()
1762 if (tz->ops->get_trip_hyst) in remove_trip_attrs()
1763 device_remove_file(&tz->device, in remove_trip_attrs()
1764 &tz->trip_hyst_attrs[indx].attr); in remove_trip_attrs()
1766 kfree(tz->trip_type_attrs); in remove_trip_attrs()
1767 kfree(tz->trip_temp_attrs); in remove_trip_attrs()
1768 kfree(tz->trip_hyst_attrs); in remove_trip_attrs()
1801 struct thermal_zone_device *tz; in thermal_zone_device_register() local
1821 tz = kzalloc(sizeof(struct thermal_zone_device), GFP_KERNEL); in thermal_zone_device_register()
1822 if (!tz) in thermal_zone_device_register()
1825 INIT_LIST_HEAD(&tz->thermal_instances); in thermal_zone_device_register()
1826 idr_init(&tz->idr); in thermal_zone_device_register()
1827 mutex_init(&tz->lock); in thermal_zone_device_register()
1828 result = get_idr(&thermal_tz_idr, &thermal_idr_lock, &tz->id); in thermal_zone_device_register()
1830 kfree(tz); in thermal_zone_device_register()
1834 strlcpy(tz->type, type ? : "", sizeof(tz->type)); in thermal_zone_device_register()
1835 tz->ops = ops; in thermal_zone_device_register()
1836 tz->tzp = tzp; in thermal_zone_device_register()
1837 tz->device.class = &thermal_class; in thermal_zone_device_register()
1838 tz->devdata = devdata; in thermal_zone_device_register()
1839 tz->trips = trips; in thermal_zone_device_register()
1840 tz->passive_delay = passive_delay; in thermal_zone_device_register()
1841 tz->polling_delay = polling_delay; in thermal_zone_device_register()
1843 atomic_set(&tz->need_update, 1); in thermal_zone_device_register()
1845 dev_set_name(&tz->device, "thermal_zone%d", tz->id); in thermal_zone_device_register()
1846 result = device_register(&tz->device); in thermal_zone_device_register()
1848 release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id); in thermal_zone_device_register()
1849 kfree(tz); in thermal_zone_device_register()
1855 result = device_create_file(&tz->device, &dev_attr_type); in thermal_zone_device_register()
1860 result = device_create_file(&tz->device, &dev_attr_temp); in thermal_zone_device_register()
1865 result = device_create_file(&tz->device, &dev_attr_mode); in thermal_zone_device_register()
1870 result = create_trip_attrs(tz, mask); in thermal_zone_device_register()
1875 if (tz->ops->get_trip_type(tz, count, &trip_type)) in thermal_zone_device_register()
1876 set_bit(count, &tz->trips_disabled); in thermal_zone_device_register()
1879 if (tz->ops->get_trip_temp(tz, count, &trip_temp)) in thermal_zone_device_register()
1880 set_bit(count, &tz->trips_disabled); in thermal_zone_device_register()
1883 set_bit(count, &tz->trips_disabled); in thermal_zone_device_register()
1887 result = device_create_file(&tz->device, &dev_attr_passive); in thermal_zone_device_register()
1893 result = device_create_file(&tz->device, &dev_attr_emul_temp); in thermal_zone_device_register()
1899 result = device_create_file(&tz->device, &dev_attr_policy); in thermal_zone_device_register()
1904 result = create_tzp_attrs(&tz->device); in thermal_zone_device_register()
1909 result = device_create_file(&tz->device, &dev_attr_available_policies); in thermal_zone_device_register()
1916 if (tz->tzp) in thermal_zone_device_register()
1917 governor = __find_governor(tz->tzp->governor_name); in thermal_zone_device_register()
1921 result = thermal_set_governor(tz, governor); in thermal_zone_device_register()
1929 if (!tz->tzp || !tz->tzp->no_hwmon) { in thermal_zone_device_register()
1930 result = thermal_add_hwmon_sysfs(tz); in thermal_zone_device_register()
1936 list_add_tail(&tz->node, &thermal_tz_list); in thermal_zone_device_register()
1940 bind_tz(tz); in thermal_zone_device_register()
1942 INIT_DELAYED_WORK(&(tz->poll_queue), thermal_zone_device_check); in thermal_zone_device_register()
1944 thermal_zone_device_reset(tz); in thermal_zone_device_register()
1946 if (atomic_cmpxchg(&tz->need_update, 1, 0)) in thermal_zone_device_register()
1947 thermal_zone_device_update(tz); in thermal_zone_device_register()
1949 return tz; in thermal_zone_device_register()
1952 release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id); in thermal_zone_device_register()
1953 device_unregister(&tz->device); in thermal_zone_device_register()
1962 void thermal_zone_device_unregister(struct thermal_zone_device *tz) in thermal_zone_device_unregister() argument
1969 if (!tz) in thermal_zone_device_unregister()
1972 tzp = tz->tzp; in thermal_zone_device_unregister()
1976 if (pos == tz) in thermal_zone_device_unregister()
1978 if (pos != tz) { in thermal_zone_device_unregister()
1983 list_del(&tz->node); in thermal_zone_device_unregister()
1987 if (tz->ops->unbind) { in thermal_zone_device_unregister()
1988 tz->ops->unbind(tz, cdev); in thermal_zone_device_unregister()
1997 __unbind(tz, tzp->tbp[i].trip_mask, cdev); in thermal_zone_device_unregister()
2005 thermal_zone_device_set_polling(tz, 0); in thermal_zone_device_unregister()
2007 if (tz->type[0]) in thermal_zone_device_unregister()
2008 device_remove_file(&tz->device, &dev_attr_type); in thermal_zone_device_unregister()
2009 device_remove_file(&tz->device, &dev_attr_temp); in thermal_zone_device_unregister()
2010 if (tz->ops->get_mode) in thermal_zone_device_unregister()
2011 device_remove_file(&tz->device, &dev_attr_mode); in thermal_zone_device_unregister()
2012 device_remove_file(&tz->device, &dev_attr_policy); in thermal_zone_device_unregister()
2013 device_remove_file(&tz->device, &dev_attr_available_policies); in thermal_zone_device_unregister()
2014 remove_trip_attrs(tz); in thermal_zone_device_unregister()
2015 thermal_set_governor(tz, NULL); in thermal_zone_device_unregister()
2017 thermal_remove_hwmon_sysfs(tz); in thermal_zone_device_unregister()
2018 release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id); in thermal_zone_device_unregister()
2019 idr_destroy(&tz->idr); in thermal_zone_device_unregister()
2020 mutex_destroy(&tz->lock); in thermal_zone_device_unregister()
2021 device_unregister(&tz->device); in thermal_zone_device_unregister()
2078 int thermal_generate_netlink_event(struct thermal_zone_device *tz, in thermal_generate_netlink_event() argument
2089 if (!tz) in thermal_generate_netlink_event()
2126 thermal_event->orig = tz->id; in thermal_generate_netlink_event()
2135 dev_err(&tz->device, "Failed to send netlink event:%d", result); in thermal_generate_netlink_event()
2190 struct thermal_zone_device *tz; in thermal_pm_notify() local
2202 list_for_each_entry(tz, &thermal_tz_list, node) { in thermal_pm_notify()
2203 thermal_zone_device_reset(tz); in thermal_pm_notify()
2204 thermal_zone_device_update(tz); in thermal_pm_notify()