• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/linux/linux-2.6.36/drivers/thermal/

Lines Matching refs:tz

45 	struct thermal_zone_device *tz;
100 struct thermal_zone_device *tz = to_thermal_zone(dev);
102 return sprintf(buf, "%s\n", tz->type);
108 struct thermal_zone_device *tz = to_thermal_zone(dev);
112 if (!tz->ops->get_temp)
115 ret = tz->ops->get_temp(tz, &temperature);
126 struct thermal_zone_device *tz = to_thermal_zone(dev);
130 if (!tz->ops->get_mode)
133 result = tz->ops->get_mode(tz, &mode);
145 struct thermal_zone_device *tz = to_thermal_zone(dev);
148 if (!tz->ops->set_mode)
152 result = tz->ops->set_mode(tz, THERMAL_DEVICE_ENABLED);
154 result = tz->ops->set_mode(tz, THERMAL_DEVICE_DISABLED);
168 struct thermal_zone_device *tz = to_thermal_zone(dev);
172 if (!tz->ops->get_trip_type)
178 result = tz->ops->get_trip_type(tz, trip, &type);
200 struct thermal_zone_device *tz = to_thermal_zone(dev);
204 if (!tz->ops->get_trip_temp)
210 ret = tz->ops->get_trip_temp(tz, trip, &temperature);
222 struct thermal_zone_device *tz = to_thermal_zone(dev);
235 if (state && !tz->forced_passive) {
240 thermal_zone_bind_cooling_device(tz,
245 if (!tz->passive_delay)
246 tz->passive_delay = 1000;
247 } else if (!state && tz->forced_passive) {
252 thermal_zone_unbind_cooling_device(tz,
257 tz->passive_delay = 0;
260 tz->tc1 = 1;
261 tz->tc2 = 1;
263 tz->forced_passive = state;
265 thermal_zone_device_update(tz);
274 struct thermal_zone_device *tz = to_thermal_zone(dev);
276 return sprintf(buf, "%d\n", tz->forced_passive);
436 struct thermal_zone_device *tz
440 ret = tz->ops->get_temp(tz, &temperature);
454 struct thermal_zone_device *tz
460 ret = tz->ops->get_trip_temp(tz, 0, &temperature);
469 thermal_add_hwmon_sysfs(struct thermal_zone_device *tz)
477 if (!strcmp(hwmon->type, tz->type)) {
489 strlcpy(hwmon->type, tz->type, THERMAL_NAME_LENGTH);
501 tz->hwmon = hwmon;
504 snprintf(tz->temp_input.name, THERMAL_NAME_LENGTH,
506 tz->temp_input.attr.attr.name = tz->temp_input.name;
507 tz->temp_input.attr.attr.mode = 0444;
508 tz->temp_input.attr.show = temp_input_show;
509 sysfs_attr_init(&tz->temp_input.attr.attr);
510 result = device_create_file(hwmon->device, &tz->temp_input.attr);
514 if (tz->ops->get_crit_temp) {
516 if (!tz->ops->get_crit_temp(tz, &temperature)) {
517 snprintf(tz->temp_crit.name, THERMAL_NAME_LENGTH,
519 tz->temp_crit.attr.attr.name = tz->temp_crit.name;
520 tz->temp_crit.attr.attr.mode = 0444;
521 tz->temp_crit.attr.show = temp_crit_show;
522 sysfs_attr_init(&tz->temp_crit.attr.attr);
524 &tz->temp_crit.attr);
533 list_add_tail(&tz->hwmon_node, &hwmon->tz_list);
539 device_remove_file(hwmon->device, &tz->temp_crit.attr);
540 device_remove_file(hwmon->device, &tz->temp_input.attr);
553 thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz)
555 struct thermal_hwmon_device *hwmon = tz->hwmon;
557 tz->hwmon = NULL;
558 device_remove_file(hwmon->device, &tz->temp_input.attr);
559 device_remove_file(hwmon->device, &tz->temp_crit.attr);
562 list_del(&tz->hwmon_node);
576 thermal_add_hwmon_sysfs(struct thermal_zone_device *tz)
582 thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz)
587 static void thermal_zone_device_set_polling(struct thermal_zone_device *tz,
590 cancel_delayed_work(&(tz->poll_queue));
596 schedule_delayed_work(&(tz->poll_queue),
599 schedule_delayed_work(&(tz->poll_queue),
603 static void thermal_zone_device_passive(struct thermal_zone_device *tz,
619 tz->passive = true;
621 trend = (tz->tc1 * (temp - tz->last_temperature)) +
622 (tz->tc2 * (temp - trip_temp));
626 list_for_each_entry(instance, &tz->cooling_devices,
637 list_for_each_entry(instance, &tz->cooling_devices,
658 list_for_each_entry(instance, &tz->cooling_devices, node) {
667 tz->passive = false;
673 struct thermal_zone_device *tz = container_of(work, struct
676 thermal_zone_device_update(tz);
681 * @tz: thermal zone device
688 int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz,
698 if (trip >= tz->trips || (trip < 0 && trip != THERMAL_TRIPS_NONE))
702 if (pos1 == tz)
710 if (tz != pos1 || cdev != pos2)
717 dev->tz = tz;
720 result = get_idr(&tz->idr, &tz->lock, &dev->id);
726 sysfs_create_link(&tz->device.kobj, &cdev->device.kobj, dev->name);
735 result = device_create_file(&tz->device, &dev->attr);
739 mutex_lock(&tz->lock);
740 list_for_each_entry(pos, &tz->cooling_devices, node)
741 if (pos->tz == tz && pos->trip == trip && pos->cdev == cdev) {
746 list_add_tail(&dev->node, &tz->cooling_devices);
747 mutex_unlock(&tz->lock);
752 device_remove_file(&tz->device, &dev->attr);
754 sysfs_remove_link(&tz->device.kobj, dev->name);
756 release_idr(&tz->idr, &tz->lock, dev->id);
766 * @tz: thermal zone device
773 int thermal_zone_unbind_cooling_device(struct thermal_zone_device *tz,
779 mutex_lock(&tz->lock);
780 list_for_each_entry_safe(pos, next, &tz->cooling_devices, node) {
781 if (pos->tz == tz && pos->trip == trip && pos->cdev == cdev) {
783 mutex_unlock(&tz->lock);
787 mutex_unlock(&tz->lock);
792 device_remove_file(&tz->device, &pos->attr);
793 sysfs_remove_link(&tz->device.kobj, pos->name);
794 release_idr(&tz->idr, &tz->lock, pos->id);
803 struct thermal_zone_device *tz;
807 tz = to_thermal_zone(dev);
808 kfree(tz);
914 struct thermal_zone_device *tz;
930 list_for_each_entry(tz, &thermal_tz_list, node) {
931 if (!tz->ops->unbind)
933 tz->ops->unbind(tz, cdev);
953 void thermal_zone_device_update(struct thermal_zone_device *tz)
961 mutex_lock(&tz->lock);
963 if (tz->ops->get_temp(tz, &temp)) {
966 "%d\n", tz->id);
970 for (count = 0; count < tz->trips; count++) {
971 tz->ops->get_trip_type(tz, count, &trip_type);
972 tz->ops->get_trip_temp(tz, count, &trip_temp);
977 if (tz->ops->notify)
978 ret = tz->ops->notify(tz, count,
990 if (tz->ops->notify)
991 tz->ops->notify(tz, count, trip_type);
994 list_for_each_entry(instance, &tz->cooling_devices,
1008 if (temp >= trip_temp || tz->passive)
1009 thermal_zone_device_passive(tz, temp,
1015 if (tz->forced_passive)
1016 thermal_zone_device_passive(tz, temp, tz->forced_passive,
1019 tz->last_temperature = temp;
1022 if (tz->passive)
1023 thermal_zone_device_set_polling(tz, tz->passive_delay);
1024 else if (tz->polling_delay)
1025 thermal_zone_device_set_polling(tz, tz->polling_delay);
1027 thermal_zone_device_set_polling(tz, 0);
1028 mutex_unlock(&tz->lock);
1059 struct thermal_zone_device *tz;
1075 tz = kzalloc(sizeof(struct thermal_zone_device), GFP_KERNEL);
1076 if (!tz)
1079 INIT_LIST_HEAD(&tz->cooling_devices);
1080 idr_init(&tz->idr);
1081 mutex_init(&tz->lock);
1082 result = get_idr(&thermal_tz_idr, &thermal_idr_lock, &tz->id);
1084 kfree(tz);
1088 strcpy(tz->type, type);
1089 tz->ops = ops;
1090 tz->device.class = &thermal_class;
1091 tz->devdata = devdata;
1092 tz->trips = trips;
1093 tz->tc1 = tc1;
1094 tz->tc2 = tc2;
1095 tz->passive_delay = passive_delay;
1096 tz->polling_delay = polling_delay;
1098 dev_set_name(&tz->device, "thermal_zone%d", tz->id);
1099 result = device_register(&tz->device);
1101 release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id);
1102 kfree(tz);
1108 result = device_create_file(&tz->device, &dev_attr_type);
1113 result = device_create_file(&tz->device, &dev_attr_temp);
1118 result = device_create_file(&tz->device, &dev_attr_mode);
1124 TRIP_POINT_ATTR_ADD(&tz->device, count, result);
1127 tz->ops->get_trip_type(tz, count, &trip_type);
1133 result = device_create_file(&tz->device,
1139 result = thermal_add_hwmon_sysfs(tz);
1144 list_add_tail(&tz->node, &thermal_tz_list);
1147 result = ops->bind(tz, pos);
1153 INIT_DELAYED_WORK(&(tz->poll_queue), thermal_zone_device_check);
1155 thermal_zone_device_update(tz);
1158 return tz;
1161 release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id);
1162 device_unregister(&tz->device);
1170 * @tz: the thermal zone device to remove
1172 void thermal_zone_device_unregister(struct thermal_zone_device *tz)
1178 if (!tz)
1183 if (pos == tz)
1185 if (pos != tz) {
1190 list_del(&tz->node);
1191 if (tz->ops->unbind)
1193 tz->ops->unbind(tz, cdev);
1196 thermal_zone_device_set_polling(tz, 0);
1198 if (tz->type[0])
1199 device_remove_file(&tz->device, &dev_attr_type);
1200 device_remove_file(&tz->device, &dev_attr_temp);
1201 if (tz->ops->get_mode)
1202 device_remove_file(&tz->device, &dev_attr_mode);
1204 for (count = 0; count < tz->trips; count++)
1205 TRIP_POINT_ATTR_REMOVE(&tz->device, count);
1207 thermal_remove_hwmon_sysfs(tz);
1208 release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id);
1209 idr_destroy(&tz->idr);
1210 mutex_destroy(&tz->lock);
1211 device_unregister(&tz->device);