summaryrefslogtreecommitdiffstats
path: root/include/linux/thermal.h
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2024-02-22 18:30:49 +0100
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2024-02-27 12:02:50 +0100
commit5340f7647294fa8ff8cf5a1bee326b2bd8340e27 (patch)
treec6bdc635eeac5800c2558b5597ebba1947299e66 /include/linux/thermal.h
parentda1983355ccefcfb3f8eb410fff82e250fa87e39 (diff)
downloadlinux-5340f7647294fa8ff8cf5a1bee326b2bd8340e27.tar.gz
linux-5340f7647294fa8ff8cf5a1bee326b2bd8340e27.tar.bz2
linux-5340f7647294fa8ff8cf5a1bee326b2bd8340e27.zip
thermal: core: Add flags to struct thermal_trip
In order to allow thermal zone creators to specify the writability of trip point temperature and hysteresis on a per-trip basis, add a flags field to struct thermal_trip and define flags to represent the desired trip properties. Also make thermal_zone_device_register_with_trips() set the THERMAL_TRIP_FLAG_RW_TEMP flag for all trips covered by the writable trips mask passed to it and modify the thermal sysfs code to look at the trip flags instead of using the writable trips mask directly or checking the presence of the .set_trip_hyst() zone callback. Additionally, make trip_point_temp_store() and trip_point_hyst_store() fail with an error code if the trip passed to one of them has THERMAL_TRIP_FLAG_RW_TEMP or THERMAL_TRIP_FLAG_RW_HYST, respectively, clear in its flags. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'include/linux/thermal.h')
-rw-r--r--include/linux/thermal.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index ec0559e98d6f..6eb6f3297ea0 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -64,15 +64,23 @@ enum thermal_notify_event {
* @threshold: trip crossing notification threshold miliCelsius
* @type: trip point type
* @priv: pointer to driver data associated with this trip
+ * @flags: flags representing binary properties of the trip
*/
struct thermal_trip {
int temperature;
int hysteresis;
int threshold;
enum thermal_trip_type type;
+ u8 flags;
void *priv;
};
+#define THERMAL_TRIP_FLAG_RW_TEMP BIT(0)
+#define THERMAL_TRIP_FLAG_RW_HYST BIT(1)
+
+#define THERMAL_TRIP_FLAG_RW (THERMAL_TRIP_FLAG_RW_TEMP | \
+ THERMAL_TRIP_FLAG_RW_HYST)
+
struct thermal_zone_device_ops {
int (*bind) (struct thermal_zone_device *,
struct thermal_cooling_device *);