aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhang, Rui <rui.zhang@intel.com>2008-04-10 04:13:10 -0400
committerLen Brown <len.brown@intel.com>2008-04-29 02:45:49 -0400
commit9ec732ff80b7e8a9096666f78ae584d3b393bc84 (patch)
treefae3a8b26c555521ac26992b8c3d897b07921cd5
parent63c4ec905d63834a97ec7dbbf0a2ec89ef5872be (diff)
thermal: add new get_crit_temp callback
Add a new callback so that the generic thermal can get the critical trip point info of a thermal zone, which is needed for building the tempX_crit hwmon sysfs attribute. Signed-off-by: Zhang Rui <rui.zhang@intel.com> Acked-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r--drivers/acpi/thermal.c13
-rw-r--r--include/linux/thermal.h1
2 files changed, 14 insertions, 0 deletions
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 766bd25d3376..ec707ed1a70f 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -1012,6 +1012,18 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
1012 return -EINVAL; 1012 return -EINVAL;
1013} 1013}
1014 1014
1015static int thermal_get_crit_temp(struct thermal_zone_device *thermal,
1016 unsigned long *temperature) {
1017 struct acpi_thermal *tz = thermal->devdata;
1018
1019 if (tz->trips.critical.flags.valid) {
1020 *temperature = KELVIN_TO_MILLICELSIUS(
1021 tz->trips.critical.temperature);
1022 return 0;
1023 } else
1024 return -EINVAL;
1025}
1026
1015typedef int (*cb)(struct thermal_zone_device *, int, 1027typedef int (*cb)(struct thermal_zone_device *, int,
1016 struct thermal_cooling_device *); 1028 struct thermal_cooling_device *);
1017static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal, 1029static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
@@ -1103,6 +1115,7 @@ static struct thermal_zone_device_ops acpi_thermal_zone_ops = {
1103 .set_mode = thermal_set_mode, 1115 .set_mode = thermal_set_mode,
1104 .get_trip_type = thermal_get_trip_type, 1116 .get_trip_type = thermal_get_trip_type,
1105 .get_trip_temp = thermal_get_trip_temp, 1117 .get_trip_temp = thermal_get_trip_temp,
1118 .get_crit_temp = thermal_get_crit_temp,
1106}; 1119};
1107 1120
1108static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz) 1121static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz)
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index 3ff680b44e81..16e6a8bdeb3c 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -41,6 +41,7 @@ struct thermal_zone_device_ops {
41 int (*set_mode) (struct thermal_zone_device *, const char *); 41 int (*set_mode) (struct thermal_zone_device *, const char *);
42 int (*get_trip_type) (struct thermal_zone_device *, int, char *); 42 int (*get_trip_type) (struct thermal_zone_device *, int, char *);
43 int (*get_trip_temp) (struct thermal_zone_device *, int, char *); 43 int (*get_trip_temp) (struct thermal_zone_device *, int, char *);
44 int (*get_crit_temp) (struct thermal_zone_device *, unsigned long *);
44}; 45};
45 46
46struct thermal_cooling_device_ops { 47struct thermal_cooling_device_ops {