Lines Matching refs:tz

29 	struct thermal_zone_device *tz = to_thermal_zone(dev);
31 return sprintf(buf, "%s\n", tz->type);
37 struct thermal_zone_device *tz = to_thermal_zone(dev);
40 ret = thermal_zone_get_temp(tz, &temperature);
51 struct thermal_zone_device *tz = to_thermal_zone(dev);
54 mutex_lock(&tz->lock);
55 enabled = thermal_zone_device_is_enabled(tz);
56 mutex_unlock(&tz->lock);
65 struct thermal_zone_device *tz = to_thermal_zone(dev);
69 result = thermal_zone_device_enable(tz);
71 result = thermal_zone_device_disable(tz);
85 struct thermal_zone_device *tz = to_thermal_zone(dev);
92 mutex_lock(&tz->lock);
95 result = __thermal_zone_get_trip(tz, trip_id, &trip);
99 mutex_unlock(&tz->lock);
122 struct thermal_zone_device *tz = to_thermal_zone(dev);
129 mutex_lock(&tz->lock);
136 ret = __thermal_zone_get_trip(tz, trip_id, &trip);
144 ret = thermal_zone_set_trip(tz, trip_id, &trip);
146 mutex_unlock(&tz->lock);
155 struct thermal_zone_device *tz = to_thermal_zone(dev);
162 mutex_lock(&tz->lock);
165 ret = __thermal_zone_get_trip(tz, trip_id, &trip);
169 mutex_unlock(&tz->lock);
181 struct thermal_zone_device *tz = to_thermal_zone(dev);
188 mutex_lock(&tz->lock);
195 ret = __thermal_zone_get_trip(tz, trip_id, &trip);
203 ret = thermal_zone_set_trip(tz, trip_id, &trip);
205 mutex_unlock(&tz->lock);
214 struct thermal_zone_device *tz = to_thermal_zone(dev);
221 mutex_lock(&tz->lock);
224 ret = __thermal_zone_get_trip(tz, trip_id, &trip);
228 mutex_unlock(&tz->lock);
237 struct thermal_zone_device *tz = to_thermal_zone(dev);
243 ret = thermal_zone_device_set_policy(tz, name);
253 struct thermal_zone_device *tz = to_thermal_zone(dev);
255 return sprintf(buf, "%s\n", tz->governor->name);
270 struct thermal_zone_device *tz = to_thermal_zone(dev);
277 mutex_lock(&tz->lock);
284 if (!tz->ops->set_emul_temp)
285 tz->emul_temperature = temperature;
287 ret = tz->ops->set_emul_temp(tz, temperature);
290 __thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED);
293 mutex_unlock(&tz->lock);
304 struct thermal_zone_device *tz = to_thermal_zone(dev);
306 if (tz->tzp)
307 return sprintf(buf, "%u\n", tz->tzp->sustainable_power);
316 struct thermal_zone_device *tz = to_thermal_zone(dev);
319 if (!tz->tzp)
325 tz->tzp->sustainable_power = sustainable_power;
335 struct thermal_zone_device *tz = to_thermal_zone(dev); \
337 if (tz->tzp) \
338 return sprintf(buf, "%d\n", tz->tzp->name); \
347 struct thermal_zone_device *tz = to_thermal_zone(dev); \
350 if (!tz->tzp) \
356 tz->tzp->name = value; \
426 * @tz: the thermal zone device
434 static int create_trip_attrs(struct thermal_zone_device *tz, int mask)
440 if (tz->num_trips <= 0)
443 tz->trip_type_attrs = kcalloc(tz->num_trips, sizeof(*tz->trip_type_attrs),
445 if (!tz->trip_type_attrs)
448 tz->trip_temp_attrs = kcalloc(tz->num_trips, sizeof(*tz->trip_temp_attrs),
450 if (!tz->trip_temp_attrs) {
451 kfree(tz->trip_type_attrs);
455 tz->trip_hyst_attrs = kcalloc(tz->num_trips,
456 sizeof(*tz->trip_hyst_attrs),
458 if (!tz->trip_hyst_attrs) {
459 kfree(tz->trip_type_attrs);
460 kfree(tz->trip_temp_attrs);
464 attrs = kcalloc(tz->num_trips * 3 + 1, sizeof(*attrs), GFP_KERNEL);
466 kfree(tz->trip_type_attrs);
467 kfree(tz->trip_temp_attrs);
468 kfree(tz->trip_hyst_attrs);
472 for (indx = 0; indx < tz->num_trips; indx++) {
474 snprintf(tz->trip_type_attrs[indx].name, THERMAL_NAME_LENGTH,
477 sysfs_attr_init(&tz->trip_type_attrs[indx].attr.attr);
478 tz->trip_type_attrs[indx].attr.attr.name =
479 tz->trip_type_attrs[indx].name;
480 tz->trip_type_attrs[indx].attr.attr.mode = S_IRUGO;
481 tz->trip_type_attrs[indx].attr.show = trip_point_type_show;
482 attrs[indx] = &tz->trip_type_attrs[indx].attr.attr;
485 snprintf(tz->trip_temp_attrs[indx].name, THERMAL_NAME_LENGTH,
488 sysfs_attr_init(&tz->trip_temp_attrs[indx].attr.attr);
489 tz->trip_temp_attrs[indx].attr.attr.name =
490 tz->trip_temp_attrs[indx].name;
491 tz->trip_temp_attrs[indx].attr.attr.mode = S_IRUGO;
492 tz->trip_temp_attrs[indx].attr.show = trip_point_temp_show;
495 tz->trip_temp_attrs[indx].attr.attr.mode |= S_IWUSR;
496 tz->trip_temp_attrs[indx].attr.store =
499 attrs[indx + tz->num_trips] = &tz->trip_temp_attrs[indx].attr.attr;
501 snprintf(tz->trip_hyst_attrs[indx].name, THERMAL_NAME_LENGTH,
504 sysfs_attr_init(&tz->trip_hyst_attrs[indx].attr.attr);
505 tz->trip_hyst_attrs[indx].attr.attr.name =
506 tz->trip_hyst_attrs[indx].name;
507 tz->trip_hyst_attrs[indx].attr.attr.mode = S_IRUGO;
508 tz->trip_hyst_attrs[indx].attr.show = trip_point_hyst_show;
509 if (tz->ops->set_trip_hyst) {
510 tz->trip_hyst_attrs[indx].attr.attr.mode |= S_IWUSR;
511 tz->trip_hyst_attrs[indx].attr.store =
514 attrs[indx + tz->num_trips * 2] =
515 &tz->trip_hyst_attrs[indx].attr.attr;
517 attrs[tz->num_trips * 3] = NULL;
519 tz->trips_attribute_group.attrs = attrs;
526 * @tz: the thermal zone device
530 static void destroy_trip_attrs(struct thermal_zone_device *tz)
532 if (!tz)
535 kfree(tz->trip_type_attrs);
536 kfree(tz->trip_temp_attrs);
537 kfree(tz->trip_hyst_attrs);
538 kfree(tz->trips_attribute_group.attrs);
541 int thermal_zone_create_device_groups(struct thermal_zone_device *tz,
557 if (tz->num_trips) {
558 result = create_trip_attrs(tz, mask);
565 groups[size - 2] = &tz->trips_attribute_group;
568 tz->device.groups = groups;
573 void thermal_zone_destroy_device_groups(struct thermal_zone_device *tz)
575 if (!tz)
578 if (tz->num_trips)
579 destroy_trip_attrs(tz);
581 kfree(tz->device.groups);
947 thermal_zone_trip_id(instance->tz, instance->trip));