Skip to contentSkip to conversation

ACPI-Thermal: Add Hysteresis attributes

PATCH New Durgadoss R 1 participant 1 message Jun 29, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ACPI-Thermal: Add Hysteresis attributes

The Linux Thermal Framework does not support hysteresis attributes. Most thermal sensors, today, have a hysteresis value associated with trip points.

This patch adds hysteresis attributes on a per-trip-point basis, to the Thermal Framework. These attributes are optionally writable.

---
* This patch depends on v6 of 'writable trip points' patch.
* Fixed an invalid memory reference in create_trip_hyst_attr function.

---
 Documentation/thermal/sysfs-api.txt |    6 +++
 drivers/thermal/thermal_sys.c       |   80 +++++++++++++++++++++++++++++++++++
 include/linux/thermal.h             |    5 ++
 3 files changed, 91 insertions(+), 0 deletions(-)
Documentation/thermal/sysfs-api.txt +6 -0
index 0c7c423..3c8c2f8 100644
@@ -121,6 +121,7 @@ Thermal zone device sys I/F, created once it's registered:
     |---mode:			Working mode of the thermal zone
     |---trip_point_[0-*]_temp:	Trip point temperature
     |---trip_point_[0-*]_type:	Trip point type
+    |---trip_point_[0-*]_hyst:	Hysteresis value for this trip point
 
 Thermal cooling device sys I/F, created once it's registered:
 /sys/class/thermal/cooling_device[0-*]:
@@ -190,6 +191,11 @@ trip_point_[0-*]_type
 	thermal zone.
 	RO, Optional
 
+trip_point_[0-*]_hyst
+	The hysteresis value for a trip point, represented as an integer
+	Unit: Celsius
+	RW, Optional
+
 cdev[0-*]
 	Sysfs link to the thermal cooling device node where the sys I/F
 	for cooling device throttling control represents.
drivers/thermal/thermal_sys.c +80 -0

104 lines not on this page · raw message

include/linux/thermal.h +5 -0
index 825d4b0..c1e1883 100644
@@ -60,6 +60,10 @@ struct thermal_zone_device_ops {
 			      unsigned long *);
 	int (*set_trip_temp) (struct thermal_zone_device *, int,
 			      unsigned long);
+	int (*get_trip_hyst) (struct thermal_zone_device *, int,
+			      unsigned long *);
+	int (*set_trip_hyst) (struct thermal_zone_device *, int,
+			      unsigned long);
 	int (*get_crit_temp) (struct thermal_zone_device *, unsigned long *);
 	int (*notify) (struct thermal_zone_device *, int,
 		       enum thermal_trip_type);
@@ -93,6 +97,7 @@ struct thermal_zone_device {
 	struct device device;
 	struct device_attribute trip_temp_attrs[THERMAL_MAX_TRIPS];
 	struct device_attribute trip_type_attrs[THERMAL_MAX_TRIPS];
+	struct device_attribute trip_hyst_attrs[THERMAL_MAX_TRIPS];
 	void *devdata;
 	int trips;
 	int tc1;
Signature · 1 line
1.7.0.4