aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/thermal.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/thermal.c')
-rw-r--r--drivers/acpi/thermal.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index c4e00ac8ea85..782c2250443e 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -884,10 +884,15 @@ static void acpi_thermal_check(void *data)
884static int thermal_get_temp(struct thermal_zone_device *thermal, char *buf) 884static int thermal_get_temp(struct thermal_zone_device *thermal, char *buf)
885{ 885{
886 struct acpi_thermal *tz = thermal->devdata; 886 struct acpi_thermal *tz = thermal->devdata;
887 int result;
887 888
888 if (!tz) 889 if (!tz)
889 return -EINVAL; 890 return -EINVAL;
890 891
892 result = acpi_thermal_get_temperature(tz);
893 if (result)
894 return result;
895
891 return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS(tz->temperature)); 896 return sprintf(buf, "%ld\n", KELVIN_TO_MILLICELSIUS(tz->temperature));
892} 897}
893 898
@@ -1012,6 +1017,18 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
1012 return -EINVAL; 1017 return -EINVAL;
1013} 1018}
1014 1019
1020static int thermal_get_crit_temp(struct thermal_zone_device *thermal,
1021 unsigned long *temperature) {
1022 struct acpi_thermal *tz = thermal->devdata;
1023
1024 if (tz->trips.critical.flags.valid) {
1025 *temperature = KELVIN_TO_MILLICELSIUS(
1026 tz->trips.critical.temperature);
1027 return 0;
1028 } else
1029 return -EINVAL;
1030}
1031
1015typedef int (*cb)(struct thermal_zone_device *, int, 1032typedef int (*cb)(struct thermal_zone_device *, int,
1016 struct thermal_cooling_device *); 1033 struct thermal_cooling_device *);
1017static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal, 1034static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
@@ -1103,6 +1120,7 @@ static struct thermal_zone_device_ops acpi_thermal_zone_ops = {
1103 .set_mode = thermal_set_mode, 1120 .set_mode = thermal_set_mode,
1104 .get_trip_type = thermal_get_trip_type, 1121 .get_trip_type = thermal_get_trip_type,
1105 .get_trip_temp = thermal_get_trip_temp, 1122 .get_trip_temp = thermal_get_trip_temp,
1123 .get_crit_temp = thermal_get_crit_temp,
1106}; 1124};
1107 1125
1108static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz) 1126static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
@@ -1123,9 +1141,9 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
1123 1141
1124 for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE && 1142 for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE &&
1125 tz->trips.active[i].flags.valid; i++, trips++); 1143 tz->trips.active[i].flags.valid; i++, trips++);
1126 tz->thermal_zone = thermal_zone_device_register("ACPI thermal zone", 1144 tz->thermal_zone = thermal_zone_device_register("acpitz",
1127 trips, tz, &acpi_thermal_zone_ops); 1145 trips, tz, &acpi_thermal_zone_ops);
1128 if (!tz->thermal_zone) 1146 if (IS_ERR(tz->thermal_zone))
1129 return -ENODEV; 1147 return -ENODEV;
1130 1148
1131 result = sysfs_create_link(&tz->device->dev.kobj, 1149 result = sysfs_create_link(&tz->device->dev.kobj,
@@ -1710,7 +1728,6 @@ static int acpi_thermal_resume(struct acpi_device *device)
1710 return AE_OK; 1728 return AE_OK;
1711} 1729}
1712 1730
1713#ifdef CONFIG_DMI
1714static int thermal_act(const struct dmi_system_id *d) { 1731static int thermal_act(const struct dmi_system_id *d) {
1715 1732
1716 if (act == 0) { 1733 if (act == 0) {
@@ -1785,7 +1802,6 @@ static struct dmi_system_id thermal_dmi_table[] __initdata = {
1785 }, 1802 },
1786 {} 1803 {}
1787}; 1804};
1788#endif /* CONFIG_DMI */
1789 1805
1790static int __init acpi_thermal_init(void) 1806static int __init acpi_thermal_init(void)
1791{ 1807{