Lines Matching refs:tz
29 struct thermal_zone_device *tz = to_thermal_zone(dev); in type_show() local
31 return sprintf(buf, "%s\n", tz->type); in type_show()
37 struct thermal_zone_device *tz = to_thermal_zone(dev); in temp_show() local
40 ret = thermal_zone_get_temp(tz, &temperature); in temp_show()
51 struct thermal_zone_device *tz = to_thermal_zone(dev); in mode_show() local
55 if (!tz->ops->get_mode) in mode_show()
58 result = tz->ops->get_mode(tz, &mode); in mode_show()
70 struct thermal_zone_device *tz = to_thermal_zone(dev); in mode_store() local
73 if (!tz->ops->set_mode) in mode_store()
77 result = tz->ops->set_mode(tz, THERMAL_DEVICE_ENABLED); in mode_store()
79 result = tz->ops->set_mode(tz, THERMAL_DEVICE_DISABLED); in mode_store()
93 struct thermal_zone_device *tz = to_thermal_zone(dev); in trip_point_type_show() local
97 if (!tz->ops->get_trip_type) in trip_point_type_show()
103 result = tz->ops->get_trip_type(tz, trip, &type); in trip_point_type_show()
125 struct thermal_zone_device *tz = to_thermal_zone(dev); in trip_point_temp_store() local
129 if (!tz->ops->set_trip_temp) in trip_point_temp_store()
138 ret = tz->ops->set_trip_temp(tz, trip, temperature); in trip_point_temp_store()
142 thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED); in trip_point_temp_store()
151 struct thermal_zone_device *tz = to_thermal_zone(dev); in trip_point_temp_show() local
155 if (!tz->ops->get_trip_temp) in trip_point_temp_show()
161 ret = tz->ops->get_trip_temp(tz, trip, &temperature); in trip_point_temp_show()
173 struct thermal_zone_device *tz = to_thermal_zone(dev); in trip_point_hyst_store() local
177 if (!tz->ops->set_trip_hyst) in trip_point_hyst_store()
191 ret = tz->ops->set_trip_hyst(tz, trip, temperature); in trip_point_hyst_store()
194 thermal_zone_set_trips(tz); in trip_point_hyst_store()
203 struct thermal_zone_device *tz = to_thermal_zone(dev); in trip_point_hyst_show() local
207 if (!tz->ops->get_trip_hyst) in trip_point_hyst_show()
213 ret = tz->ops->get_trip_hyst(tz, trip, &temperature); in trip_point_hyst_show()
222 struct thermal_zone_device *tz = to_thermal_zone(dev); in passive_store() local
234 if (state && !tz->forced_passive) { in passive_store()
235 if (!tz->passive_delay) in passive_store()
236 tz->passive_delay = 1000; in passive_store()
237 thermal_zone_device_rebind_exception(tz, "Processor", in passive_store()
239 } else if (!state && tz->forced_passive) { in passive_store()
240 tz->passive_delay = 0; in passive_store()
241 thermal_zone_device_unbind_exception(tz, "Processor", in passive_store()
245 tz->forced_passive = state; in passive_store()
247 thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED); in passive_store()
256 struct thermal_zone_device *tz = to_thermal_zone(dev); in passive_show() local
258 return sprintf(buf, "%d\n", tz->forced_passive); in passive_show()
265 struct thermal_zone_device *tz = to_thermal_zone(dev); in policy_store() local
271 ret = thermal_zone_device_set_policy(tz, name); in policy_store()
281 struct thermal_zone_device *tz = to_thermal_zone(dev); in policy_show() local
283 return sprintf(buf, "%s\n", tz->governor->name); in policy_show()
298 struct thermal_zone_device *tz = to_thermal_zone(dev); in emul_temp_store() local
305 if (!tz->ops->set_emul_temp) { in emul_temp_store()
306 mutex_lock(&tz->lock); in emul_temp_store()
307 tz->emul_temperature = temperature; in emul_temp_store()
308 mutex_unlock(&tz->lock); in emul_temp_store()
310 ret = tz->ops->set_emul_temp(tz, temperature); in emul_temp_store()
314 thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED); in emul_temp_store()
325 struct thermal_zone_device *tz = to_thermal_zone(dev); in sustainable_power_show() local
327 if (tz->tzp) in sustainable_power_show()
328 return sprintf(buf, "%u\n", tz->tzp->sustainable_power); in sustainable_power_show()
337 struct thermal_zone_device *tz = to_thermal_zone(dev); in sustainable_power_store() local
340 if (!tz->tzp) in sustainable_power_store()
346 tz->tzp->sustainable_power = sustainable_power; in sustainable_power_store()
356 struct thermal_zone_device *tz = to_thermal_zone(dev); \
358 if (tz->tzp) \
359 return sprintf(buf, "%d\n", tz->tzp->name); \
368 struct thermal_zone_device *tz = to_thermal_zone(dev); \
371 if (!tz->tzp) \
377 tz->tzp->name = value; \
442 struct thermal_zone_device *tz; in thermal_zone_mode_is_visible() local
444 tz = container_of(dev, struct thermal_zone_device, device); in thermal_zone_mode_is_visible()
446 if (tz->ops->get_mode) in thermal_zone_mode_is_visible()
468 struct thermal_zone_device *tz; in thermal_zone_passive_is_visible() local
472 tz = container_of(dev, struct thermal_zone_device, device); in thermal_zone_passive_is_visible()
474 for (count = 0; count < tz->trips && !passive; count++) { in thermal_zone_passive_is_visible()
475 tz->ops->get_trip_type(tz, count, &trip_type); in thermal_zone_passive_is_visible()
509 static int create_trip_attrs(struct thermal_zone_device *tz, int mask) in create_trip_attrs() argument
515 if (tz->trips <= 0) in create_trip_attrs()
518 tz->trip_type_attrs = kcalloc(tz->trips, sizeof(*tz->trip_type_attrs), in create_trip_attrs()
520 if (!tz->trip_type_attrs) in create_trip_attrs()
523 tz->trip_temp_attrs = kcalloc(tz->trips, sizeof(*tz->trip_temp_attrs), in create_trip_attrs()
525 if (!tz->trip_temp_attrs) { in create_trip_attrs()
526 kfree(tz->trip_type_attrs); in create_trip_attrs()
530 if (tz->ops->get_trip_hyst) { in create_trip_attrs()
531 tz->trip_hyst_attrs = kcalloc(tz->trips, in create_trip_attrs()
532 sizeof(*tz->trip_hyst_attrs), in create_trip_attrs()
534 if (!tz->trip_hyst_attrs) { in create_trip_attrs()
535 kfree(tz->trip_type_attrs); in create_trip_attrs()
536 kfree(tz->trip_temp_attrs); in create_trip_attrs()
541 attrs = kcalloc(tz->trips * 3 + 1, sizeof(*attrs), GFP_KERNEL); in create_trip_attrs()
543 kfree(tz->trip_type_attrs); in create_trip_attrs()
544 kfree(tz->trip_temp_attrs); in create_trip_attrs()
545 if (tz->ops->get_trip_hyst) in create_trip_attrs()
546 kfree(tz->trip_hyst_attrs); in create_trip_attrs()
550 for (indx = 0; indx < tz->trips; indx++) { in create_trip_attrs()
552 snprintf(tz->trip_type_attrs[indx].name, THERMAL_NAME_LENGTH, in create_trip_attrs()
555 sysfs_attr_init(&tz->trip_type_attrs[indx].attr.attr); in create_trip_attrs()
556 tz->trip_type_attrs[indx].attr.attr.name = in create_trip_attrs()
557 tz->trip_type_attrs[indx].name; in create_trip_attrs()
558 tz->trip_type_attrs[indx].attr.attr.mode = S_IRUGO; in create_trip_attrs()
559 tz->trip_type_attrs[indx].attr.show = trip_point_type_show; in create_trip_attrs()
560 attrs[indx] = &tz->trip_type_attrs[indx].attr.attr; in create_trip_attrs()
563 snprintf(tz->trip_temp_attrs[indx].name, THERMAL_NAME_LENGTH, in create_trip_attrs()
566 sysfs_attr_init(&tz->trip_temp_attrs[indx].attr.attr); in create_trip_attrs()
567 tz->trip_temp_attrs[indx].attr.attr.name = in create_trip_attrs()
568 tz->trip_temp_attrs[indx].name; in create_trip_attrs()
569 tz->trip_temp_attrs[indx].attr.attr.mode = S_IRUGO; in create_trip_attrs()
570 tz->trip_temp_attrs[indx].attr.show = trip_point_temp_show; in create_trip_attrs()
573 tz->trip_temp_attrs[indx].attr.attr.mode |= S_IWUSR; in create_trip_attrs()
574 tz->trip_temp_attrs[indx].attr.store = in create_trip_attrs()
577 attrs[indx + tz->trips] = &tz->trip_temp_attrs[indx].attr.attr; in create_trip_attrs()
580 if (!tz->ops->get_trip_hyst) in create_trip_attrs()
582 snprintf(tz->trip_hyst_attrs[indx].name, THERMAL_NAME_LENGTH, in create_trip_attrs()
585 sysfs_attr_init(&tz->trip_hyst_attrs[indx].attr.attr); in create_trip_attrs()
586 tz->trip_hyst_attrs[indx].attr.attr.name = in create_trip_attrs()
587 tz->trip_hyst_attrs[indx].name; in create_trip_attrs()
588 tz->trip_hyst_attrs[indx].attr.attr.mode = S_IRUGO; in create_trip_attrs()
589 tz->trip_hyst_attrs[indx].attr.show = trip_point_hyst_show; in create_trip_attrs()
590 if (tz->ops->set_trip_hyst) { in create_trip_attrs()
591 tz->trip_hyst_attrs[indx].attr.attr.mode |= S_IWUSR; in create_trip_attrs()
592 tz->trip_hyst_attrs[indx].attr.store = in create_trip_attrs()
595 attrs[indx + tz->trips * 2] = in create_trip_attrs()
596 &tz->trip_hyst_attrs[indx].attr.attr; in create_trip_attrs()
598 attrs[tz->trips * 3] = NULL; in create_trip_attrs()
600 tz->trips_attribute_group.attrs = attrs; in create_trip_attrs()
611 static void destroy_trip_attrs(struct thermal_zone_device *tz) in destroy_trip_attrs() argument
613 if (!tz) in destroy_trip_attrs()
616 kfree(tz->trip_type_attrs); in destroy_trip_attrs()
617 kfree(tz->trip_temp_attrs); in destroy_trip_attrs()
618 if (tz->ops->get_trip_hyst) in destroy_trip_attrs()
619 kfree(tz->trip_hyst_attrs); in destroy_trip_attrs()
620 kfree(tz->trips_attribute_group.attrs); in destroy_trip_attrs()
623 int thermal_zone_create_device_groups(struct thermal_zone_device *tz, in thermal_zone_create_device_groups() argument
639 if (tz->trips) { in thermal_zone_create_device_groups()
640 result = create_trip_attrs(tz, mask); in thermal_zone_create_device_groups()
647 groups[size - 2] = &tz->trips_attribute_group; in thermal_zone_create_device_groups()
650 tz->device.groups = groups; in thermal_zone_create_device_groups()
655 void thermal_zone_destroy_device_groups(struct thermal_zone_device *tz) in thermal_zone_destroy_device_groups() argument
657 if (!tz) in thermal_zone_destroy_device_groups()
660 if (tz->trips) in thermal_zone_destroy_device_groups()
661 destroy_trip_attrs(tz); in thermal_zone_destroy_device_groups()
663 kfree(tz->device.groups); in thermal_zone_destroy_device_groups()