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
52 int enabled = thermal_zone_device_is_enabled(tz); in mode_show()
61 struct thermal_zone_device *tz = to_thermal_zone(dev); in mode_store() local
65 result = thermal_zone_device_enable(tz); in mode_store()
67 result = thermal_zone_device_disable(tz); in mode_store()
81 struct thermal_zone_device *tz = to_thermal_zone(dev); in trip_point_type_show() local
85 if (!tz->ops->get_trip_type) in trip_point_type_show()
91 result = tz->ops->get_trip_type(tz, trip, &type); in trip_point_type_show()
113 struct thermal_zone_device *tz = to_thermal_zone(dev); in trip_point_temp_store() local
118 if (!tz->ops->set_trip_temp) in trip_point_temp_store()
127 ret = tz->ops->set_trip_temp(tz, trip, temperature); in trip_point_temp_store()
131 if (tz->ops->get_trip_hyst) { in trip_point_temp_store()
132 ret = tz->ops->get_trip_hyst(tz, trip, &hyst); in trip_point_temp_store()
137 ret = tz->ops->get_trip_type(tz, trip, &type); in trip_point_temp_store()
141 thermal_notify_tz_trip_change(tz->id, trip, type, temperature, hyst); in trip_point_temp_store()
143 thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED); in trip_point_temp_store()
152 struct thermal_zone_device *tz = to_thermal_zone(dev); in trip_point_temp_show() local
156 if (!tz->ops->get_trip_temp) in trip_point_temp_show()
162 ret = tz->ops->get_trip_temp(tz, trip, &temperature); in trip_point_temp_show()
174 struct thermal_zone_device *tz = to_thermal_zone(dev); in trip_point_hyst_store() local
178 if (!tz->ops->set_trip_hyst) in trip_point_hyst_store()
192 ret = tz->ops->set_trip_hyst(tz, trip, temperature); in trip_point_hyst_store()
195 thermal_zone_set_trips(tz); in trip_point_hyst_store()
204 struct thermal_zone_device *tz = to_thermal_zone(dev); in trip_point_hyst_show() local
208 if (!tz->ops->get_trip_hyst) in trip_point_hyst_show()
214 ret = tz->ops->get_trip_hyst(tz, trip, &temperature); in trip_point_hyst_show()
223 struct thermal_zone_device *tz = to_thermal_zone(dev); in policy_store() local
229 ret = thermal_zone_device_set_policy(tz, name); in policy_store()
239 struct thermal_zone_device *tz = to_thermal_zone(dev); in policy_show() local
241 return sprintf(buf, "%s\n", tz->governor->name); in policy_show()
256 struct thermal_zone_device *tz = to_thermal_zone(dev); in emul_temp_store() local
263 if (!tz->ops->set_emul_temp) { in emul_temp_store()
264 mutex_lock(&tz->lock); in emul_temp_store()
265 tz->emul_temperature = temperature; in emul_temp_store()
266 mutex_unlock(&tz->lock); in emul_temp_store()
268 ret = tz->ops->set_emul_temp(tz, temperature); in emul_temp_store()
272 thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED); in emul_temp_store()
283 struct thermal_zone_device *tz = to_thermal_zone(dev); in sustainable_power_show() local
285 if (tz->tzp) in sustainable_power_show()
286 return sprintf(buf, "%u\n", tz->tzp->sustainable_power); in sustainable_power_show()
295 struct thermal_zone_device *tz = to_thermal_zone(dev); in sustainable_power_store() local
298 if (!tz->tzp) in sustainable_power_store()
304 tz->tzp->sustainable_power = sustainable_power; in sustainable_power_store()
314 struct thermal_zone_device *tz = to_thermal_zone(dev); \
316 if (tz->tzp) \
317 return sprintf(buf, "%d\n", tz->tzp->name); \
326 struct thermal_zone_device *tz = to_thermal_zone(dev); \
329 if (!tz->tzp) \
335 tz->tzp->name = value; \
413 static int create_trip_attrs(struct thermal_zone_device *tz, int mask) in create_trip_attrs() argument
419 if (tz->trips <= 0) in create_trip_attrs()
422 tz->trip_type_attrs = kcalloc(tz->trips, sizeof(*tz->trip_type_attrs), in create_trip_attrs()
424 if (!tz->trip_type_attrs) in create_trip_attrs()
427 tz->trip_temp_attrs = kcalloc(tz->trips, sizeof(*tz->trip_temp_attrs), in create_trip_attrs()
429 if (!tz->trip_temp_attrs) { in create_trip_attrs()
430 kfree(tz->trip_type_attrs); in create_trip_attrs()
434 if (tz->ops->get_trip_hyst) { in create_trip_attrs()
435 tz->trip_hyst_attrs = kcalloc(tz->trips, in create_trip_attrs()
436 sizeof(*tz->trip_hyst_attrs), in create_trip_attrs()
438 if (!tz->trip_hyst_attrs) { in create_trip_attrs()
439 kfree(tz->trip_type_attrs); in create_trip_attrs()
440 kfree(tz->trip_temp_attrs); in create_trip_attrs()
445 attrs = kcalloc(tz->trips * 3 + 1, sizeof(*attrs), GFP_KERNEL); in create_trip_attrs()
447 kfree(tz->trip_type_attrs); in create_trip_attrs()
448 kfree(tz->trip_temp_attrs); in create_trip_attrs()
449 if (tz->ops->get_trip_hyst) in create_trip_attrs()
450 kfree(tz->trip_hyst_attrs); in create_trip_attrs()
454 for (indx = 0; indx < tz->trips; indx++) { in create_trip_attrs()
456 snprintf(tz->trip_type_attrs[indx].name, THERMAL_NAME_LENGTH, in create_trip_attrs()
459 sysfs_attr_init(&tz->trip_type_attrs[indx].attr.attr); in create_trip_attrs()
460 tz->trip_type_attrs[indx].attr.attr.name = in create_trip_attrs()
461 tz->trip_type_attrs[indx].name; in create_trip_attrs()
462 tz->trip_type_attrs[indx].attr.attr.mode = S_IRUGO; in create_trip_attrs()
463 tz->trip_type_attrs[indx].attr.show = trip_point_type_show; in create_trip_attrs()
464 attrs[indx] = &tz->trip_type_attrs[indx].attr.attr; in create_trip_attrs()
467 snprintf(tz->trip_temp_attrs[indx].name, THERMAL_NAME_LENGTH, in create_trip_attrs()
470 sysfs_attr_init(&tz->trip_temp_attrs[indx].attr.attr); in create_trip_attrs()
471 tz->trip_temp_attrs[indx].attr.attr.name = in create_trip_attrs()
472 tz->trip_temp_attrs[indx].name; in create_trip_attrs()
473 tz->trip_temp_attrs[indx].attr.attr.mode = S_IRUGO; in create_trip_attrs()
474 tz->trip_temp_attrs[indx].attr.show = trip_point_temp_show; in create_trip_attrs()
477 tz->trip_temp_attrs[indx].attr.attr.mode |= S_IWUSR; in create_trip_attrs()
478 tz->trip_temp_attrs[indx].attr.store = in create_trip_attrs()
481 attrs[indx + tz->trips] = &tz->trip_temp_attrs[indx].attr.attr; in create_trip_attrs()
484 if (!tz->ops->get_trip_hyst) in create_trip_attrs()
486 snprintf(tz->trip_hyst_attrs[indx].name, THERMAL_NAME_LENGTH, in create_trip_attrs()
489 sysfs_attr_init(&tz->trip_hyst_attrs[indx].attr.attr); in create_trip_attrs()
490 tz->trip_hyst_attrs[indx].attr.attr.name = in create_trip_attrs()
491 tz->trip_hyst_attrs[indx].name; in create_trip_attrs()
492 tz->trip_hyst_attrs[indx].attr.attr.mode = S_IRUGO; in create_trip_attrs()
493 tz->trip_hyst_attrs[indx].attr.show = trip_point_hyst_show; in create_trip_attrs()
494 if (tz->ops->set_trip_hyst) { in create_trip_attrs()
495 tz->trip_hyst_attrs[indx].attr.attr.mode |= S_IWUSR; in create_trip_attrs()
496 tz->trip_hyst_attrs[indx].attr.store = in create_trip_attrs()
499 attrs[indx + tz->trips * 2] = in create_trip_attrs()
500 &tz->trip_hyst_attrs[indx].attr.attr; in create_trip_attrs()
502 attrs[tz->trips * 3] = NULL; in create_trip_attrs()
504 tz->trips_attribute_group.attrs = attrs; in create_trip_attrs()
515 static void destroy_trip_attrs(struct thermal_zone_device *tz) in destroy_trip_attrs() argument
517 if (!tz) in destroy_trip_attrs()
520 kfree(tz->trip_type_attrs); in destroy_trip_attrs()
521 kfree(tz->trip_temp_attrs); in destroy_trip_attrs()
522 if (tz->ops->get_trip_hyst) in destroy_trip_attrs()
523 kfree(tz->trip_hyst_attrs); in destroy_trip_attrs()
524 kfree(tz->trips_attribute_group.attrs); in destroy_trip_attrs()
527 int thermal_zone_create_device_groups(struct thermal_zone_device *tz, in thermal_zone_create_device_groups() argument
543 if (tz->trips) { in thermal_zone_create_device_groups()
544 result = create_trip_attrs(tz, mask); in thermal_zone_create_device_groups()
551 groups[size - 2] = &tz->trips_attribute_group; in thermal_zone_create_device_groups()
554 tz->device.groups = groups; in thermal_zone_create_device_groups()
559 void thermal_zone_destroy_device_groups(struct thermal_zone_device *tz) in thermal_zone_destroy_device_groups() argument
561 if (!tz) in thermal_zone_destroy_device_groups()
564 if (tz->trips) in thermal_zone_destroy_device_groups()
565 destroy_trip_attrs(tz); in thermal_zone_destroy_device_groups()
567 kfree(tz->device.groups); in thermal_zone_destroy_device_groups()