Lines Matching refs:tz

30 	struct thermal_zone_device *tz = to_thermal_zone(dev);  in type_show()  local
32 return sprintf(buf, "%s\n", tz->type); in type_show()
38 struct thermal_zone_device *tz = to_thermal_zone(dev); in temp_show() local
41 ret = thermal_zone_get_temp(tz, &temperature); in temp_show()
52 struct thermal_zone_device *tz = to_thermal_zone(dev); in mode_show() local
53 int enabled = thermal_zone_device_is_enabled(tz); in mode_show()
62 struct thermal_zone_device *tz = to_thermal_zone(dev); in mode_store() local
66 result = thermal_zone_device_enable(tz); in mode_store()
68 result = thermal_zone_device_disable(tz); in mode_store()
82 struct thermal_zone_device *tz = to_thermal_zone(dev); in trip_point_type_show() local
86 if (!tz->ops->get_trip_type) in trip_point_type_show()
92 result = tz->ops->get_trip_type(tz, trip, &type); in trip_point_type_show()
114 struct thermal_zone_device *tz = to_thermal_zone(dev); in trip_point_temp_store() local
119 if (!tz->ops->set_trip_temp) in trip_point_temp_store()
128 ret = tz->ops->set_trip_temp(tz, trip, temperature); in trip_point_temp_store()
132 if (tz->ops->get_trip_hyst) { in trip_point_temp_store()
133 ret = tz->ops->get_trip_hyst(tz, trip, &hyst); in trip_point_temp_store()
138 ret = tz->ops->get_trip_type(tz, trip, &type); in trip_point_temp_store()
142 thermal_notify_tz_trip_change(tz->id, trip, type, temperature, hyst); in trip_point_temp_store()
144 thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED); in trip_point_temp_store()
153 struct thermal_zone_device *tz = to_thermal_zone(dev); in trip_point_temp_show() local
157 if (!tz->ops->get_trip_temp) in trip_point_temp_show()
163 ret = tz->ops->get_trip_temp(tz, trip, &temperature); in trip_point_temp_show()
175 struct thermal_zone_device *tz = to_thermal_zone(dev); in trip_point_hyst_store() local
179 if (!tz->ops->set_trip_hyst) in trip_point_hyst_store()
193 ret = tz->ops->set_trip_hyst(tz, trip, temperature); in trip_point_hyst_store()
196 thermal_zone_set_trips(tz); in trip_point_hyst_store()
205 struct thermal_zone_device *tz = to_thermal_zone(dev); in trip_point_hyst_show() local
209 if (!tz->ops->get_trip_hyst) in trip_point_hyst_show()
215 ret = tz->ops->get_trip_hyst(tz, trip, &temperature); in trip_point_hyst_show()
224 struct thermal_zone_device *tz = to_thermal_zone(dev); in passive_store() local
236 if (state && !tz->forced_passive) { in passive_store()
237 if (!tz->passive_delay) in passive_store()
238 tz->passive_delay = 1000; in passive_store()
239 thermal_zone_device_rebind_exception(tz, "Processor", in passive_store()
241 } else if (!state && tz->forced_passive) { in passive_store()
242 tz->passive_delay = 0; in passive_store()
243 thermal_zone_device_unbind_exception(tz, "Processor", in passive_store()
247 tz->forced_passive = state; in passive_store()
249 thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED); in passive_store()
258 struct thermal_zone_device *tz = to_thermal_zone(dev); in passive_show() local
260 return sprintf(buf, "%d\n", tz->forced_passive); in passive_show()
267 struct thermal_zone_device *tz = to_thermal_zone(dev); in policy_store() local
273 ret = thermal_zone_device_set_policy(tz, name); in policy_store()
283 struct thermal_zone_device *tz = to_thermal_zone(dev); in policy_show() local
285 return sprintf(buf, "%s\n", tz->governor->name); in policy_show()
300 struct thermal_zone_device *tz = to_thermal_zone(dev); in emul_temp_store() local
307 if (!tz->ops->set_emul_temp) { in emul_temp_store()
308 mutex_lock(&tz->lock); in emul_temp_store()
309 tz->emul_temperature = temperature; in emul_temp_store()
310 mutex_unlock(&tz->lock); in emul_temp_store()
312 ret = tz->ops->set_emul_temp(tz, temperature); in emul_temp_store()
316 thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED); in emul_temp_store()
327 struct thermal_zone_device *tz = to_thermal_zone(dev); in sustainable_power_show() local
329 if (tz->tzp) in sustainable_power_show()
330 return sprintf(buf, "%u\n", tz->tzp->sustainable_power); in sustainable_power_show()
339 struct thermal_zone_device *tz = to_thermal_zone(dev); in sustainable_power_store() local
342 if (!tz->tzp) in sustainable_power_store()
348 tz->tzp->sustainable_power = sustainable_power; in sustainable_power_store()
358 struct thermal_zone_device *tz = to_thermal_zone(dev); \
360 if (tz->tzp) \
361 return sprintf(buf, "%d\n", tz->tzp->name); \
370 struct thermal_zone_device *tz = to_thermal_zone(dev); \
373 if (!tz->tzp) \
379 tz->tzp->name = value; \
453 struct thermal_zone_device *tz; in thermal_zone_passive_is_visible() local
457 tz = container_of(dev, struct thermal_zone_device, device); in thermal_zone_passive_is_visible()
459 for (count = 0; count < tz->trips && !passive; count++) { in thermal_zone_passive_is_visible()
460 tz->ops->get_trip_type(tz, count, &trip_type); in thermal_zone_passive_is_visible()
494 static int create_trip_attrs(struct thermal_zone_device *tz, int mask) in create_trip_attrs() argument
500 if (tz->trips <= 0) in create_trip_attrs()
503 tz->trip_type_attrs = kcalloc(tz->trips, sizeof(*tz->trip_type_attrs), in create_trip_attrs()
505 if (!tz->trip_type_attrs) in create_trip_attrs()
508 tz->trip_temp_attrs = kcalloc(tz->trips, sizeof(*tz->trip_temp_attrs), in create_trip_attrs()
510 if (!tz->trip_temp_attrs) { in create_trip_attrs()
511 kfree(tz->trip_type_attrs); in create_trip_attrs()
515 if (tz->ops->get_trip_hyst) { in create_trip_attrs()
516 tz->trip_hyst_attrs = kcalloc(tz->trips, in create_trip_attrs()
517 sizeof(*tz->trip_hyst_attrs), in create_trip_attrs()
519 if (!tz->trip_hyst_attrs) { in create_trip_attrs()
520 kfree(tz->trip_type_attrs); in create_trip_attrs()
521 kfree(tz->trip_temp_attrs); in create_trip_attrs()
526 attrs = kcalloc(tz->trips * 3 + 1, sizeof(*attrs), GFP_KERNEL); in create_trip_attrs()
528 kfree(tz->trip_type_attrs); in create_trip_attrs()
529 kfree(tz->trip_temp_attrs); in create_trip_attrs()
530 if (tz->ops->get_trip_hyst) in create_trip_attrs()
531 kfree(tz->trip_hyst_attrs); in create_trip_attrs()
535 for (indx = 0; indx < tz->trips; indx++) { in create_trip_attrs()
537 snprintf(tz->trip_type_attrs[indx].name, THERMAL_NAME_LENGTH, in create_trip_attrs()
540 sysfs_attr_init(&tz->trip_type_attrs[indx].attr.attr); in create_trip_attrs()
541 tz->trip_type_attrs[indx].attr.attr.name = in create_trip_attrs()
542 tz->trip_type_attrs[indx].name; in create_trip_attrs()
543 tz->trip_type_attrs[indx].attr.attr.mode = S_IRUGO; in create_trip_attrs()
544 tz->trip_type_attrs[indx].attr.show = trip_point_type_show; in create_trip_attrs()
545 attrs[indx] = &tz->trip_type_attrs[indx].attr.attr; in create_trip_attrs()
548 snprintf(tz->trip_temp_attrs[indx].name, THERMAL_NAME_LENGTH, in create_trip_attrs()
551 sysfs_attr_init(&tz->trip_temp_attrs[indx].attr.attr); in create_trip_attrs()
552 tz->trip_temp_attrs[indx].attr.attr.name = in create_trip_attrs()
553 tz->trip_temp_attrs[indx].name; in create_trip_attrs()
554 tz->trip_temp_attrs[indx].attr.attr.mode = S_IRUGO; in create_trip_attrs()
555 tz->trip_temp_attrs[indx].attr.show = trip_point_temp_show; in create_trip_attrs()
558 tz->trip_temp_attrs[indx].attr.attr.mode |= S_IWUSR; in create_trip_attrs()
559 tz->trip_temp_attrs[indx].attr.store = in create_trip_attrs()
562 attrs[indx + tz->trips] = &tz->trip_temp_attrs[indx].attr.attr; in create_trip_attrs()
565 if (!tz->ops->get_trip_hyst) in create_trip_attrs()
567 snprintf(tz->trip_hyst_attrs[indx].name, THERMAL_NAME_LENGTH, in create_trip_attrs()
570 sysfs_attr_init(&tz->trip_hyst_attrs[indx].attr.attr); in create_trip_attrs()
571 tz->trip_hyst_attrs[indx].attr.attr.name = in create_trip_attrs()
572 tz->trip_hyst_attrs[indx].name; in create_trip_attrs()
573 tz->trip_hyst_attrs[indx].attr.attr.mode = S_IRUGO; in create_trip_attrs()
574 tz->trip_hyst_attrs[indx].attr.show = trip_point_hyst_show; in create_trip_attrs()
575 if (tz->ops->set_trip_hyst) { in create_trip_attrs()
576 tz->trip_hyst_attrs[indx].attr.attr.mode |= S_IWUSR; in create_trip_attrs()
577 tz->trip_hyst_attrs[indx].attr.store = in create_trip_attrs()
580 attrs[indx + tz->trips * 2] = in create_trip_attrs()
581 &tz->trip_hyst_attrs[indx].attr.attr; in create_trip_attrs()
583 attrs[tz->trips * 3] = NULL; in create_trip_attrs()
585 tz->trips_attribute_group.attrs = attrs; in create_trip_attrs()
596 static void destroy_trip_attrs(struct thermal_zone_device *tz) in destroy_trip_attrs() argument
598 if (!tz) in destroy_trip_attrs()
601 kfree(tz->trip_type_attrs); in destroy_trip_attrs()
602 kfree(tz->trip_temp_attrs); in destroy_trip_attrs()
603 if (tz->ops->get_trip_hyst) in destroy_trip_attrs()
604 kfree(tz->trip_hyst_attrs); in destroy_trip_attrs()
605 kfree(tz->trips_attribute_group.attrs); in destroy_trip_attrs()
608 int thermal_zone_create_device_groups(struct thermal_zone_device *tz, in thermal_zone_create_device_groups() argument
624 if (tz->trips) { in thermal_zone_create_device_groups()
625 result = create_trip_attrs(tz, mask); in thermal_zone_create_device_groups()
632 groups[size - 2] = &tz->trips_attribute_group; in thermal_zone_create_device_groups()
635 tz->device.groups = groups; in thermal_zone_create_device_groups()
640 void thermal_zone_destroy_device_groups(struct thermal_zone_device *tz) in thermal_zone_destroy_device_groups() argument
642 if (!tz) in thermal_zone_destroy_device_groups()
645 if (tz->trips) in thermal_zone_destroy_device_groups()
646 destroy_trip_attrs(tz); in thermal_zone_destroy_device_groups()
648 kfree(tz->device.groups); in thermal_zone_destroy_device_groups()