Lines Matching full: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
54 mutex_lock(&tz->lock); in mode_show()
55 enabled = thermal_zone_device_is_enabled(tz); in mode_show()
56 mutex_unlock(&tz->lock); in mode_show()
65 struct thermal_zone_device *tz = to_thermal_zone(dev); in mode_store() local
69 result = thermal_zone_device_enable(tz); in mode_store()
71 result = thermal_zone_device_disable(tz); in mode_store()
85 struct thermal_zone_device *tz = to_thermal_zone(dev); in trip_point_type_show() local
91 switch (tz->trips[trip_id].type) { in trip_point_type_show()
109 struct thermal_zone_device *tz = to_thermal_zone(dev); in trip_point_temp_store() local
121 mutex_lock(&tz->lock); in trip_point_temp_store()
123 trip = &tz->trips[trip_id]; in trip_point_temp_store()
126 if (tz->ops->set_trip_temp) { in trip_point_temp_store()
127 ret = tz->ops->set_trip_temp(tz, trip_id, temp); in trip_point_temp_store()
132 thermal_zone_set_trip_temp(tz, trip, temp); in trip_point_temp_store()
134 __thermal_zone_device_update(tz, THERMAL_TRIP_CHANGED); in trip_point_temp_store()
138 mutex_unlock(&tz->lock); in trip_point_temp_store()
147 struct thermal_zone_device *tz = to_thermal_zone(dev); in trip_point_temp_show() local
153 return sprintf(buf, "%d\n", tz->trips[trip_id].temperature); in trip_point_temp_show()
160 struct thermal_zone_device *tz = to_thermal_zone(dev); in trip_point_hyst_store() local
172 mutex_lock(&tz->lock); in trip_point_hyst_store()
174 trip = &tz->trips[trip_id]; in trip_point_hyst_store()
177 if (tz->ops->set_trip_hyst) { in trip_point_hyst_store()
178 ret = tz->ops->set_trip_hyst(tz, trip_id, hyst); in trip_point_hyst_store()
185 thermal_zone_trip_updated(tz, trip); in trip_point_hyst_store()
189 mutex_unlock(&tz->lock); in trip_point_hyst_store()
198 struct thermal_zone_device *tz = to_thermal_zone(dev); in trip_point_hyst_show() local
204 return sprintf(buf, "%d\n", tz->trips[trip_id].hysteresis); in trip_point_hyst_show()
211 struct thermal_zone_device *tz = to_thermal_zone(dev); in policy_store() local
217 ret = thermal_zone_device_set_policy(tz, name); in policy_store()
227 struct thermal_zone_device *tz = to_thermal_zone(dev); in policy_show() local
229 return sprintf(buf, "%s\n", tz->governor->name); in policy_show()
244 struct thermal_zone_device *tz = to_thermal_zone(dev); in emul_temp_store() local
251 mutex_lock(&tz->lock); in emul_temp_store()
253 if (!tz->ops->set_emul_temp) in emul_temp_store()
254 tz->emul_temperature = temperature; in emul_temp_store()
256 ret = tz->ops->set_emul_temp(tz, temperature); in emul_temp_store()
259 __thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED); in emul_temp_store()
261 mutex_unlock(&tz->lock); in emul_temp_store()
272 struct thermal_zone_device *tz = to_thermal_zone(dev); in sustainable_power_show() local
274 if (tz->tzp) in sustainable_power_show()
275 return sprintf(buf, "%u\n", tz->tzp->sustainable_power); in sustainable_power_show()
284 struct thermal_zone_device *tz = to_thermal_zone(dev); in sustainable_power_store() local
287 if (!tz->tzp) in sustainable_power_store()
293 tz->tzp->sustainable_power = sustainable_power; in sustainable_power_store()
303 struct thermal_zone_device *tz = to_thermal_zone(dev); \
305 if (tz->tzp) \
306 return sprintf(buf, "%d\n", tz->tzp->name); \
315 struct thermal_zone_device *tz = to_thermal_zone(dev); \
318 if (!tz->tzp) \
324 tz->tzp->name = value; \
394 * @tz: the thermal zone device
402 static int create_trip_attrs(struct thermal_zone_device *tz, int mask) in create_trip_attrs() argument
408 if (tz->num_trips <= 0) in create_trip_attrs()
411 tz->trip_type_attrs = kcalloc(tz->num_trips, sizeof(*tz->trip_type_attrs), in create_trip_attrs()
413 if (!tz->trip_type_attrs) in create_trip_attrs()
416 tz->trip_temp_attrs = kcalloc(tz->num_trips, sizeof(*tz->trip_temp_attrs), in create_trip_attrs()
418 if (!tz->trip_temp_attrs) { in create_trip_attrs()
419 kfree(tz->trip_type_attrs); in create_trip_attrs()
423 tz->trip_hyst_attrs = kcalloc(tz->num_trips, in create_trip_attrs()
424 sizeof(*tz->trip_hyst_attrs), in create_trip_attrs()
426 if (!tz->trip_hyst_attrs) { in create_trip_attrs()
427 kfree(tz->trip_type_attrs); in create_trip_attrs()
428 kfree(tz->trip_temp_attrs); in create_trip_attrs()
432 attrs = kcalloc(tz->num_trips * 3 + 1, sizeof(*attrs), GFP_KERNEL); in create_trip_attrs()
434 kfree(tz->trip_type_attrs); in create_trip_attrs()
435 kfree(tz->trip_temp_attrs); in create_trip_attrs()
436 kfree(tz->trip_hyst_attrs); in create_trip_attrs()
440 for (indx = 0; indx < tz->num_trips; indx++) { in create_trip_attrs()
442 snprintf(tz->trip_type_attrs[indx].name, THERMAL_NAME_LENGTH, in create_trip_attrs()
445 sysfs_attr_init(&tz->trip_type_attrs[indx].attr.attr); in create_trip_attrs()
446 tz->trip_type_attrs[indx].attr.attr.name = in create_trip_attrs()
447 tz->trip_type_attrs[indx].name; in create_trip_attrs()
448 tz->trip_type_attrs[indx].attr.attr.mode = S_IRUGO; in create_trip_attrs()
449 tz->trip_type_attrs[indx].attr.show = trip_point_type_show; in create_trip_attrs()
450 attrs[indx] = &tz->trip_type_attrs[indx].attr.attr; in create_trip_attrs()
453 snprintf(tz->trip_temp_attrs[indx].name, THERMAL_NAME_LENGTH, in create_trip_attrs()
456 sysfs_attr_init(&tz->trip_temp_attrs[indx].attr.attr); in create_trip_attrs()
457 tz->trip_temp_attrs[indx].attr.attr.name = in create_trip_attrs()
458 tz->trip_temp_attrs[indx].name; in create_trip_attrs()
459 tz->trip_temp_attrs[indx].attr.attr.mode = S_IRUGO; in create_trip_attrs()
460 tz->trip_temp_attrs[indx].attr.show = trip_point_temp_show; in create_trip_attrs()
463 tz->trip_temp_attrs[indx].attr.attr.mode |= S_IWUSR; in create_trip_attrs()
464 tz->trip_temp_attrs[indx].attr.store = in create_trip_attrs()
467 attrs[indx + tz->num_trips] = &tz->trip_temp_attrs[indx].attr.attr; in create_trip_attrs()
469 snprintf(tz->trip_hyst_attrs[indx].name, THERMAL_NAME_LENGTH, in create_trip_attrs()
472 sysfs_attr_init(&tz->trip_hyst_attrs[indx].attr.attr); in create_trip_attrs()
473 tz->trip_hyst_attrs[indx].attr.attr.name = in create_trip_attrs()
474 tz->trip_hyst_attrs[indx].name; in create_trip_attrs()
475 tz->trip_hyst_attrs[indx].attr.attr.mode = S_IRUGO; in create_trip_attrs()
476 tz->trip_hyst_attrs[indx].attr.show = trip_point_hyst_show; in create_trip_attrs()
477 if (tz->ops->set_trip_hyst) { in create_trip_attrs()
478 tz->trip_hyst_attrs[indx].attr.attr.mode |= S_IWUSR; in create_trip_attrs()
479 tz->trip_hyst_attrs[indx].attr.store = in create_trip_attrs()
482 attrs[indx + tz->num_trips * 2] = in create_trip_attrs()
483 &tz->trip_hyst_attrs[indx].attr.attr; in create_trip_attrs()
485 attrs[tz->num_trips * 3] = NULL; in create_trip_attrs()
487 tz->trips_attribute_group.attrs = attrs; in create_trip_attrs()
494 * @tz: the thermal zone device
498 static void destroy_trip_attrs(struct thermal_zone_device *tz) in destroy_trip_attrs() argument
500 if (!tz) in destroy_trip_attrs()
503 kfree(tz->trip_type_attrs); in destroy_trip_attrs()
504 kfree(tz->trip_temp_attrs); in destroy_trip_attrs()
505 kfree(tz->trip_hyst_attrs); in destroy_trip_attrs()
506 kfree(tz->trips_attribute_group.attrs); in destroy_trip_attrs()
509 int thermal_zone_create_device_groups(struct thermal_zone_device *tz, in thermal_zone_create_device_groups() argument
525 if (tz->num_trips) { in thermal_zone_create_device_groups()
526 result = create_trip_attrs(tz, mask); in thermal_zone_create_device_groups()
533 groups[size - 2] = &tz->trips_attribute_group; in thermal_zone_create_device_groups()
536 tz->device.groups = groups; in thermal_zone_create_device_groups()
541 void thermal_zone_destroy_device_groups(struct thermal_zone_device *tz) in thermal_zone_destroy_device_groups() argument
543 if (!tz) in thermal_zone_destroy_device_groups()
546 if (tz->num_trips) in thermal_zone_destroy_device_groups()
547 destroy_trip_attrs(tz); in thermal_zone_destroy_device_groups()
549 kfree(tz->device.groups); in thermal_zone_destroy_device_groups()
915 thermal_zone_trip_id(instance->tz, instance->trip)); in trip_point_show()
941 mutex_lock(&instance->tz->lock); in weight_store()
945 thermal_governor_update_tz(instance->tz, in weight_store()
948 mutex_unlock(&instance->tz->lock); in weight_store()