xref: /linux/include/uapi/linux/thermal.h (revision 7f71507851fc7764b36a3221839607d3a45c2025)
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 #ifndef _UAPI_LINUX_THERMAL_H
3 #define _UAPI_LINUX_THERMAL_H
4 
5 #define THERMAL_NAME_LENGTH	20
6 #define THERMAL_THRESHOLD_WAY_UP	BIT(0)
7 #define THERMAL_THRESHOLD_WAY_DOWN	BIT(1)
8 
9 enum thermal_device_mode {
10 	THERMAL_DEVICE_DISABLED = 0,
11 	THERMAL_DEVICE_ENABLED,
12 };
13 
14 enum thermal_trip_type {
15 	THERMAL_TRIP_ACTIVE = 0,
16 	THERMAL_TRIP_PASSIVE,
17 	THERMAL_TRIP_HOT,
18 	THERMAL_TRIP_CRITICAL,
19 };
20 
21 /* Adding event notification support elements */
22 #define THERMAL_GENL_FAMILY_NAME		"thermal"
23 #define THERMAL_GENL_VERSION			0x02
24 #define THERMAL_GENL_SAMPLING_GROUP_NAME	"sampling"
25 #define THERMAL_GENL_EVENT_GROUP_NAME		"event"
26 
27 /* Attributes of thermal_genl_family */
28 enum thermal_genl_attr {
29 	THERMAL_GENL_ATTR_UNSPEC,
30 	THERMAL_GENL_ATTR_TZ,
31 	THERMAL_GENL_ATTR_TZ_ID,
32 	THERMAL_GENL_ATTR_TZ_TEMP,
33 	THERMAL_GENL_ATTR_TZ_PREV_TEMP,
34 	THERMAL_GENL_ATTR_TZ_TRIP,
35 	THERMAL_GENL_ATTR_TZ_TRIP_ID,
36 	THERMAL_GENL_ATTR_TZ_TRIP_TYPE,
37 	THERMAL_GENL_ATTR_TZ_TRIP_TEMP,
38 	THERMAL_GENL_ATTR_TZ_TRIP_HYST,
39 	THERMAL_GENL_ATTR_TZ_MODE,
40 	THERMAL_GENL_ATTR_TZ_NAME,
41 	THERMAL_GENL_ATTR_TZ_CDEV_WEIGHT,
42 	THERMAL_GENL_ATTR_TZ_GOV,
43 	THERMAL_GENL_ATTR_TZ_GOV_NAME,
44 	THERMAL_GENL_ATTR_CDEV,
45 	THERMAL_GENL_ATTR_CDEV_ID,
46 	THERMAL_GENL_ATTR_CDEV_CUR_STATE,
47 	THERMAL_GENL_ATTR_CDEV_MAX_STATE,
48 	THERMAL_GENL_ATTR_CDEV_NAME,
49 	THERMAL_GENL_ATTR_GOV_NAME,
50 	THERMAL_GENL_ATTR_CPU_CAPABILITY,
51 	THERMAL_GENL_ATTR_CPU_CAPABILITY_ID,
52 	THERMAL_GENL_ATTR_CPU_CAPABILITY_PERFORMANCE,
53 	THERMAL_GENL_ATTR_CPU_CAPABILITY_EFFICIENCY,
54 	THERMAL_GENL_ATTR_THRESHOLD,
55 	THERMAL_GENL_ATTR_THRESHOLD_TEMP,
56 	THERMAL_GENL_ATTR_THRESHOLD_DIRECTION,
57 	__THERMAL_GENL_ATTR_MAX,
58 };
59 #define THERMAL_GENL_ATTR_MAX (__THERMAL_GENL_ATTR_MAX - 1)
60 
61 enum thermal_genl_sampling {
62 	THERMAL_GENL_SAMPLING_TEMP,
63 	__THERMAL_GENL_SAMPLING_MAX,
64 };
65 #define THERMAL_GENL_SAMPLING_MAX (__THERMAL_GENL_SAMPLING_MAX - 1)
66 
67 /* Events of thermal_genl_family */
68 enum thermal_genl_event {
69 	THERMAL_GENL_EVENT_UNSPEC,
70 	THERMAL_GENL_EVENT_TZ_CREATE,		/* Thermal zone creation */
71 	THERMAL_GENL_EVENT_TZ_DELETE,		/* Thermal zone deletion */
72 	THERMAL_GENL_EVENT_TZ_DISABLE,		/* Thermal zone disabled */
73 	THERMAL_GENL_EVENT_TZ_ENABLE,		/* Thermal zone enabled */
74 	THERMAL_GENL_EVENT_TZ_TRIP_UP,		/* Trip point crossed the way up */
75 	THERMAL_GENL_EVENT_TZ_TRIP_DOWN,	/* Trip point crossed the way down */
76 	THERMAL_GENL_EVENT_TZ_TRIP_CHANGE,	/* Trip point changed */
77 	THERMAL_GENL_EVENT_TZ_TRIP_ADD,		/* Trip point added */
78 	THERMAL_GENL_EVENT_TZ_TRIP_DELETE,	/* Trip point deleted */
79 	THERMAL_GENL_EVENT_CDEV_ADD,		/* Cdev bound to the thermal zone */
80 	THERMAL_GENL_EVENT_CDEV_DELETE,		/* Cdev unbound */
81 	THERMAL_GENL_EVENT_CDEV_STATE_UPDATE,	/* Cdev state updated */
82 	THERMAL_GENL_EVENT_TZ_GOV_CHANGE,	/* Governor policy changed  */
83 	THERMAL_GENL_EVENT_CPU_CAPABILITY_CHANGE,	/* CPU capability changed */
84 	THERMAL_GENL_EVENT_THRESHOLD_ADD,	/* A thresold has been added */
85 	THERMAL_GENL_EVENT_THRESHOLD_DELETE,	/* A thresold has been deleted */
86 	THERMAL_GENL_EVENT_THRESHOLD_FLUSH,	/* All thresolds have been deleted */
87 	THERMAL_GENL_EVENT_THRESHOLD_UP,	/* A thresold has been crossed the way up */
88 	THERMAL_GENL_EVENT_THRESHOLD_DOWN,	/* A thresold has been crossed the way down */
89 	__THERMAL_GENL_EVENT_MAX,
90 };
91 #define THERMAL_GENL_EVENT_MAX (__THERMAL_GENL_EVENT_MAX - 1)
92 
93 /* Commands supported by the thermal_genl_family */
94 enum thermal_genl_cmd {
95 	THERMAL_GENL_CMD_UNSPEC,
96 	THERMAL_GENL_CMD_TZ_GET_ID,		/* List of thermal zones id */
97 	THERMAL_GENL_CMD_TZ_GET_TRIP,		/* List of thermal trips */
98 	THERMAL_GENL_CMD_TZ_GET_TEMP,		/* Get the thermal zone temperature */
99 	THERMAL_GENL_CMD_TZ_GET_GOV,		/* Get the thermal zone governor */
100 	THERMAL_GENL_CMD_TZ_GET_MODE,		/* Get the thermal zone mode */
101 	THERMAL_GENL_CMD_CDEV_GET,		/* List of cdev id */
102 	THERMAL_GENL_CMD_THRESHOLD_GET,		/* List of thresholds */
103 	THERMAL_GENL_CMD_THRESHOLD_ADD,		/* Add a threshold */
104 	THERMAL_GENL_CMD_THRESHOLD_DELETE,	/* Delete a threshold */
105 	THERMAL_GENL_CMD_THRESHOLD_FLUSH,	/* Flush all the thresholds */
106 	__THERMAL_GENL_CMD_MAX,
107 };
108 #define THERMAL_GENL_CMD_MAX (__THERMAL_GENL_CMD_MAX - 1)
109 
110 #endif /* _UAPI_LINUX_THERMAL_H */
111