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);
52 int enabled = thermal_zone_device_is_enabled(tz);
61 struct thermal_zone_device *tz = to_thermal_zone(dev);
65 result = thermal_zone_device_enable(tz);
67 result = thermal_zone_device_disable(tz);
81 struct thermal_zone_device *tz = to_thermal_zone(dev);
85 if (!tz->ops->get_trip_type)
91 result = tz->ops->get_trip_type(tz, trip, &type);
113 struct thermal_zone_device *tz = to_thermal_zone(dev);
118 if (!tz->ops->set_trip_temp)
127 ret = tz->ops->set_trip_temp(tz, trip, temperature);
131 if (tz->ops->get_trip_hyst) {
132 ret = tz->ops->get_trip_hyst(tz, trip, &hyst);
137 ret = tz->ops->get_trip_type(tz, trip, &type);
141 thermal_notify_tz_trip_change(tz->id, trip, type, temperature, hyst);
143 thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED);
152 struct thermal_zone_device *tz = to_thermal_zone(dev);
156 if (!tz->ops->get_trip_temp)
162 ret = tz->ops->get_trip_temp(tz, trip, &temperature);
174 struct thermal_zone_device *tz = to_thermal_zone(dev);
178 if (!tz->ops->set_trip_hyst)
192 ret = tz->ops->set_trip_hyst(tz, trip, temperature);
195 thermal_zone_set_trips(tz);
204 struct thermal_zone_device *tz = to_thermal_zone(dev);
208 if (!tz->ops->get_trip_hyst)
214 ret = tz->ops->get_trip_hyst(tz, trip, &temperature);
223 struct thermal_zone_device *tz = to_thermal_zone(dev);
235 if (state && !tz->forced_passive) {
236 if (!tz->passive_delay)
237 tz->passive_delay = 1000;
238 thermal_zone_device_rebind_exception(tz, "Processor",
240 } else if (!state && tz->forced_passive) {
241 tz->passive_delay = 0;
242 thermal_zone_device_unbind_exception(tz, "Processor",
246 tz->forced_passive = state;
248 thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED);
257 struct thermal_zone_device *tz = to_thermal_zone(dev);
259 return sprintf(buf, "%d\n", tz->forced_passive);
266 struct thermal_zone_device *tz = to_thermal_zone(dev);
272 ret = thermal_zone_device_set_policy(tz, name);
282 struct thermal_zone_device *tz = to_thermal_zone(dev);
284 return sprintf(buf, "%s\n", tz->governor->name);
299 struct thermal_zone_device *tz = to_thermal_zone(dev);
306 if (!tz->ops->set_emul_temp) {
307 mutex_lock(&tz->lock);
308 tz->emul_temperature = temperature;
309 mutex_unlock(&tz->lock);
311 ret = tz->ops->set_emul_temp(tz, temperature);
315 thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED);
326 struct thermal_zone_device *tz = to_thermal_zone(dev);
328 if (tz->tzp)
329 return sprintf(buf, "%u\n", tz->tzp->sustainable_power);
338 struct thermal_zone_device *tz = to_thermal_zone(dev);
341 if (!tz->tzp)
347 tz->tzp->sustainable_power = sustainable_power;
357 struct thermal_zone_device *tz = to_thermal_zone(dev); \
359 if (tz->tzp) \
360 return sprintf(buf, "%d\n", tz->tzp->name); \
369 struct thermal_zone_device *tz = to_thermal_zone(dev); \
372 if (!tz->tzp) \
378 tz->tzp->name = value; \
452 struct thermal_zone_device *tz;
456 tz = container_of(dev, struct thermal_zone_device, device);
458 for (count = 0; count < tz->trips && !passive; count++) {
459 tz->ops->get_trip_type(tz, count, &trip_type);
485 * @tz: the thermal zone device
493 static int create_trip_attrs(struct thermal_zone_device *tz, int mask)
499 if (tz->trips <= 0)
502 tz->trip_type_attrs = kcalloc(tz->trips, sizeof(*tz->trip_type_attrs),
504 if (!tz->trip_type_attrs)
507 tz->trip_temp_attrs = kcalloc(tz->trips, sizeof(*tz->trip_temp_attrs),
509 if (!tz->trip_temp_attrs) {
510 kfree(tz->trip_type_attrs);
514 if (tz->ops->get_trip_hyst) {
515 tz->trip_hyst_attrs = kcalloc(tz->trips,
516 sizeof(*tz->trip_hyst_attrs),
518 if (!tz->trip_hyst_attrs) {
519 kfree(tz->trip_type_attrs);
520 kfree(tz->trip_temp_attrs);
525 attrs = kcalloc(tz->trips * 3 + 1, sizeof(*attrs), GFP_KERNEL);
527 kfree(tz->trip_type_attrs);
528 kfree(tz->trip_temp_attrs);
529 if (tz->ops->get_trip_hyst)
530 kfree(tz->trip_hyst_attrs);
534 for (indx = 0; indx < tz->trips; indx++) {
536 snprintf(tz->trip_type_attrs[indx].name, THERMAL_NAME_LENGTH,
539 sysfs_attr_init(&tz->trip_type_attrs[indx].attr.attr);
540 tz->trip_type_attrs[indx].attr.attr.name =
541 tz->trip_type_attrs[indx].name;
542 tz->trip_type_attrs[indx].attr.attr.mode = S_IRUGO;
543 tz->trip_type_attrs[indx].attr.show = trip_point_type_show;
544 attrs[indx] = &tz->trip_type_attrs[indx].attr.attr;
547 snprintf(tz->trip_temp_attrs[indx].name, THERMAL_NAME_LENGTH,
550 sysfs_attr_init(&tz->trip_temp_attrs[indx].attr.attr);
551 tz->trip_temp_attrs[indx].attr.attr.name =
552 tz->trip_temp_attrs[indx].name;
553 tz->trip_temp_attrs[indx].attr.attr.mode = S_IRUGO;
554 tz->trip_temp_attrs[indx].attr.show = trip_point_temp_show;
557 tz->trip_temp_attrs[indx].attr.attr.mode |= S_IWUSR;
558 tz->trip_temp_attrs[indx].attr.store =
561 attrs[indx + tz->trips] = &tz->trip_temp_attrs[indx].attr.attr;
564 if (!tz->ops->get_trip_hyst)
566 snprintf(tz->trip_hyst_attrs[indx].name, THERMAL_NAME_LENGTH,
569 sysfs_attr_init(&tz->trip_hyst_attrs[indx].attr.attr);
570 tz->trip_hyst_attrs[indx].attr.attr.name =
571 tz->trip_hyst_attrs[indx].name;
572 tz->trip_hyst_attrs[indx].attr.attr.mode = S_IRUGO;
573 tz->trip_hyst_attrs[indx].attr.show = trip_point_hyst_show;
574 if (tz->ops->set_trip_hyst) {
575 tz->trip_hyst_attrs[indx].attr.attr.mode |= S_IWUSR;
576 tz->trip_hyst_attrs[indx].attr.store =
579 attrs[indx + tz->trips * 2] =
580 &tz->trip_hyst_attrs[indx].attr.attr;
582 attrs[tz->trips * 3] = NULL;
584 tz->trips_attribute_group.attrs = attrs;
591 * @tz: the thermal zone device
595 static void destroy_trip_attrs(struct thermal_zone_device *tz)
597 if (!tz)
600 kfree(tz->trip_type_attrs);
601 kfree(tz->trip_temp_attrs);
602 if (tz->ops->get_trip_hyst)
603 kfree(tz->trip_hyst_attrs);
604 kfree(tz->trips_attribute_group.attrs);
607 int thermal_zone_create_device_groups(struct thermal_zone_device *tz,
623 if (tz->trips) {
624 result = create_trip_attrs(tz, mask);
631 groups[size - 2] = &tz->trips_attribute_group;
634 tz->device.groups = groups;
639 void thermal_zone_destroy_device_groups(struct thermal_zone_device *tz)
641 if (!tz)
644 if (tz->trips)
645 destroy_trip_attrs(tz);
647 kfree(tz->device.groups);