~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/thermal/tmon/tmon.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /tools/thermal/tmon/tmon.h (Architecture ppc) and /tools/thermal/tmon/tmon.h (Architecture alpha)


  1 /* SPDX-License-Identifier: GPL-2.0-or-later *      1 /* SPDX-License-Identifier: GPL-2.0-or-later */
  2 /*                                                  2 /*
  3  * tmon.h contains data structures and constan      3  * tmon.h contains data structures and constants used by TMON
  4  *                                                  4  *
  5  * Copyright (C) 2012 Intel Corporation. All r      5  * Copyright (C) 2012 Intel Corporation. All rights reserved.
  6  *                                                  6  *
  7  * Author Name Jacob Pan <jacob.jun.pan@linux.      7  * Author Name Jacob Pan <jacob.jun.pan@linux.intel.com>
  8  */                                                 8  */
  9                                                     9 
 10 #ifndef TMON_H                                     10 #ifndef TMON_H
 11 #define TMON_H                                     11 #define TMON_H
 12                                                    12 
 13 #define MAX_DISP_TEMP 125                          13 #define MAX_DISP_TEMP 125
 14 #define MAX_CTRL_TEMP 105                          14 #define MAX_CTRL_TEMP 105
 15 #define MIN_CTRL_TEMP 40                           15 #define MIN_CTRL_TEMP 40
 16 #define MAX_NR_TZONE 16                            16 #define MAX_NR_TZONE 16
 17 #define MAX_NR_CDEV 32                             17 #define MAX_NR_CDEV 32
 18 #define MAX_NR_TRIP 16                             18 #define MAX_NR_TRIP 16
 19 #define MAX_NR_CDEV_TRIP 12 /* number of cooli     19 #define MAX_NR_CDEV_TRIP 12 /* number of cooling devices that can bind
 20                              * to a thermal zo     20                              * to a thermal zone trip.
 21                              */                    21                              */
 22 #define MAX_TEMP_KC 140000                         22 #define MAX_TEMP_KC 140000
 23 /* starting char position to draw sensor data,     23 /* starting char position to draw sensor data, such as tz names
 24  * trip point list, etc.                           24  * trip point list, etc.
 25  */                                                25  */
 26 #define DATA_LEFT_ALIGN 10                         26 #define DATA_LEFT_ALIGN 10
 27 #define NR_LINES_TZDATA 1                          27 #define NR_LINES_TZDATA 1
 28 #define TMON_LOG_FILE "/var/tmp/tmon.log"          28 #define TMON_LOG_FILE "/var/tmp/tmon.log"
 29                                                    29 
 30 #include <sys/time.h>                              30 #include <sys/time.h>
 31 #include <pthread.h>                               31 #include <pthread.h>
 32                                                    32 
 33 extern unsigned long ticktime;                     33 extern unsigned long ticktime;
 34 extern double time_elapsed;                        34 extern double time_elapsed;
 35 extern unsigned long target_temp_user;             35 extern unsigned long target_temp_user;
 36 extern int dialogue_on;                            36 extern int dialogue_on;
 37 extern char ctrl_cdev[];                           37 extern char ctrl_cdev[];
 38 extern pthread_mutex_t input_lock;                 38 extern pthread_mutex_t input_lock;
 39 extern int tmon_exit;                              39 extern int tmon_exit;
 40 extern int target_thermal_zone;                    40 extern int target_thermal_zone;
 41 /* use fixed size record to simplify data proc     41 /* use fixed size record to simplify data processing and transfer
 42  * TBD: more info to be added, e.g. programmab     42  * TBD: more info to be added, e.g. programmable trip point data.
 43 */                                                 43 */
 44 struct thermal_data_record {                       44 struct thermal_data_record {
 45         struct timeval tv;                         45         struct timeval tv;
 46         unsigned long temp[MAX_NR_TZONE];          46         unsigned long temp[MAX_NR_TZONE];
 47         double pid_out_pct;                        47         double pid_out_pct;
 48 };                                                 48 };
 49                                                    49 
 50 struct cdev_info {                                 50 struct cdev_info {
 51         char type[64];                             51         char type[64];
 52         int instance;                              52         int instance;
 53         unsigned long max_state;                   53         unsigned long max_state;
 54         unsigned long cur_state;                   54         unsigned long cur_state;
 55         unsigned long flag;                        55         unsigned long flag;
 56 };                                                 56 };
 57                                                    57 
 58 enum trip_type {                                   58 enum trip_type {
 59         THERMAL_TRIP_CRITICAL,                     59         THERMAL_TRIP_CRITICAL,
 60         THERMAL_TRIP_HOT,                          60         THERMAL_TRIP_HOT,
 61         THERMAL_TRIP_PASSIVE,                      61         THERMAL_TRIP_PASSIVE,
 62         THERMAL_TRIP_ACTIVE,                       62         THERMAL_TRIP_ACTIVE,
 63         NR_THERMAL_TRIP_TYPE,                      63         NR_THERMAL_TRIP_TYPE,
 64 };                                                 64 };
 65                                                    65 
 66 struct trip_point {                                66 struct trip_point {
 67         enum trip_type type;                       67         enum trip_type type;
 68         unsigned long temp;                        68         unsigned long temp;
 69         unsigned long hysteresis;                  69         unsigned long hysteresis;
 70         int attribute; /* programmability etc.     70         int attribute; /* programmability etc. */
 71 };                                                 71 };
 72                                                    72 
 73 /* thermal zone configuration information, bin     73 /* thermal zone configuration information, binding with cooling devices could
 74  * change at runtime.                              74  * change at runtime.
 75  */                                                75  */
 76 struct tz_info {                                   76 struct tz_info {
 77         char type[256]; /* e.g. acpitz */          77         char type[256]; /* e.g. acpitz */
 78         int instance;                              78         int instance;
 79         int passive; /* active zone has passiv     79         int passive; /* active zone has passive node to force passive mode */
 80         int nr_cdev; /* number of cooling devi     80         int nr_cdev; /* number of cooling device binded */
 81         int nr_trip_pts;                           81         int nr_trip_pts;
 82         struct trip_point tp[MAX_NR_TRIP];         82         struct trip_point tp[MAX_NR_TRIP];
 83         unsigned long cdev_binding; /* bitmap      83         unsigned long cdev_binding; /* bitmap for attached cdevs */
 84         /* cdev bind trip points, allow one cd     84         /* cdev bind trip points, allow one cdev bind to multiple trips */
 85         unsigned long trip_binding[MAX_NR_CDEV     85         unsigned long trip_binding[MAX_NR_CDEV];
 86 };                                                 86 };
 87                                                    87 
 88 struct tmon_platform_data {                        88 struct tmon_platform_data {
 89         int nr_tz_sensor;                          89         int nr_tz_sensor;
 90         int nr_cooling_dev;                        90         int nr_cooling_dev;
 91         /* keep track of instance ids since th     91         /* keep track of instance ids since there might be gaps */
 92         int max_tz_instance;                       92         int max_tz_instance;
 93         int max_cdev_instance;                     93         int max_cdev_instance;
 94         struct tz_info *tzi;                       94         struct tz_info *tzi;
 95         struct cdev_info *cdi;                     95         struct cdev_info *cdi;
 96 };                                                 96 };
 97                                                    97 
 98 struct control_ops {                               98 struct control_ops {
 99         void (*set_ratio)(unsigned long ratio)     99         void (*set_ratio)(unsigned long ratio);
100         unsigned long (*get_ratio)(unsigned lo    100         unsigned long (*get_ratio)(unsigned long ratio);
101                                                   101 
102 };                                                102 };
103                                                   103 
104 enum cdev_types {                                 104 enum cdev_types {
105         CDEV_TYPE_PROC,                           105         CDEV_TYPE_PROC,
106         CDEV_TYPE_FAN,                            106         CDEV_TYPE_FAN,
107         CDEV_TYPE_MEM,                            107         CDEV_TYPE_MEM,
108         CDEV_TYPE_NR,                             108         CDEV_TYPE_NR,
109 };                                                109 };
110                                                   110 
111 /* REVISIT: the idea is to group sensors if po    111 /* REVISIT: the idea is to group sensors if possible, e.g. on intel mid
112  * we have "skin0", "skin1", "sys", "msicdie"     112  * we have "skin0", "skin1", "sys", "msicdie"
113  * on DPTF enabled systems, we might have PCH,    113  * on DPTF enabled systems, we might have PCH, TSKN, TAMB, etc.
114  */                                               114  */
115 enum tzone_types {                                115 enum tzone_types {
116         TZONE_TYPE_ACPI,                          116         TZONE_TYPE_ACPI,
117         TZONE_TYPE_PCH,                           117         TZONE_TYPE_PCH,
118         TZONE_TYPE_NR,                            118         TZONE_TYPE_NR,
119 };                                                119 };
120                                                   120 
121 /* limit the output of PID controller adjustme    121 /* limit the output of PID controller adjustment */
122 #define LIMIT_HIGH (95)                           122 #define LIMIT_HIGH (95)
123 #define LIMIT_LOW  (2)                            123 #define LIMIT_LOW  (2)
124                                                   124 
125 struct pid_params {                               125 struct pid_params {
126         double kp;  /* Controller gain from Di    126         double kp;  /* Controller gain from Dialog Box */
127         double ki;  /* Time-constant for I act    127         double ki;  /* Time-constant for I action from Dialog Box */
128         double kd;  /* Time-constant for D act    128         double kd;  /* Time-constant for D action from Dialog Box */
129         double ts;                                129         double ts;
130         double k_lpf;                             130         double k_lpf;
131                                                   131 
132         double t_target;                          132         double t_target;
133         double y_k;                               133         double y_k;
134 };                                                134 };
135                                                   135 
136 extern int init_thermal_controller(void);         136 extern int init_thermal_controller(void);
137 extern void controller_handler(const double xk    137 extern void controller_handler(const double xk, double *yk);
138                                                   138 
139 extern struct tmon_platform_data ptdata;          139 extern struct tmon_platform_data ptdata;
140 extern struct pid_params p_param;                 140 extern struct pid_params p_param;
141                                                   141 
142 extern FILE *tmon_log;                            142 extern FILE *tmon_log;
143 extern int cur_thermal_record; /* index to the    143 extern int cur_thermal_record; /* index to the trec array */
144 extern struct thermal_data_record trec[];         144 extern struct thermal_data_record trec[];
145 extern const char *trip_type_name[];              145 extern const char *trip_type_name[];
146 extern unsigned long no_control;                  146 extern unsigned long no_control;
147                                                   147 
148 extern void initialize_curses(void);              148 extern void initialize_curses(void);
149 extern void show_controller_stats(char *line);    149 extern void show_controller_stats(char *line);
150 extern void show_title_bar(void);                 150 extern void show_title_bar(void);
151 extern void setup_windows(void);                  151 extern void setup_windows(void);
152 extern void disable_tui(void);                    152 extern void disable_tui(void);
153 extern void show_sensors_w(void);                 153 extern void show_sensors_w(void);
154 extern void show_data_w(void);                    154 extern void show_data_w(void);
155 extern void write_status_bar(int x, char *line    155 extern void write_status_bar(int x, char *line);
156 extern void show_control_w();                     156 extern void show_control_w();
157                                                   157 
158 extern void show_cooling_device(void);            158 extern void show_cooling_device(void);
159 extern void show_dialogue(void);                  159 extern void show_dialogue(void);
160 extern int update_thermal_data(void);             160 extern int update_thermal_data(void);
161                                                   161 
162 extern int probe_thermal_sysfs(void);             162 extern int probe_thermal_sysfs(void);
163 extern void free_thermal_data(void);              163 extern void free_thermal_data(void);
164 extern  void resize_handler(int sig);             164 extern  void resize_handler(int sig);
165 extern void set_ctrl_state(unsigned long state    165 extern void set_ctrl_state(unsigned long state);
166 extern void get_ctrl_state(unsigned long *stat    166 extern void get_ctrl_state(unsigned long *state);
167 extern void *handle_tui_events(void *arg);        167 extern void *handle_tui_events(void *arg);
168 extern int sysfs_set_ulong(char *path, char *f    168 extern int sysfs_set_ulong(char *path, char *filename, unsigned long val);
169 extern int zone_instance_to_index(int zone_ins    169 extern int zone_instance_to_index(int zone_inst);
170 extern void close_windows(void);                  170 extern void close_windows(void);
171                                                   171 
172 #define PT_COLOR_DEFAULT    1                     172 #define PT_COLOR_DEFAULT    1
173 #define PT_COLOR_HEADER_BAR 2                     173 #define PT_COLOR_HEADER_BAR 2
174 #define PT_COLOR_ERROR      3                     174 #define PT_COLOR_ERROR      3
175 #define PT_COLOR_RED        4                     175 #define PT_COLOR_RED        4
176 #define PT_COLOR_YELLOW     5                     176 #define PT_COLOR_YELLOW     5
177 #define PT_COLOR_GREEN      6                     177 #define PT_COLOR_GREEN      6
178 #define PT_COLOR_BRIGHT     7                     178 #define PT_COLOR_BRIGHT     7
179 #define PT_COLOR_BLUE       8                     179 #define PT_COLOR_BLUE       8
180                                                   180 
181 /* each thermal zone uses 12 chars, 8 for name    181 /* each thermal zone uses 12 chars, 8 for name, 2 for instance, 2 space
182  * also used to list trip points in forms of A    182  * also used to list trip points in forms of AAAC, which represents
183  * A: Active                                      183  * A: Active
184  * C: Critical                                    184  * C: Critical
185  */                                               185  */
186 #define TZONE_RECORD_SIZE 12                      186 #define TZONE_RECORD_SIZE 12
187 #define TZ_LEFT_ALIGN 32                          187 #define TZ_LEFT_ALIGN 32
188 #define CDEV_NAME_SIZE 20                         188 #define CDEV_NAME_SIZE 20
189 #define CDEV_FLAG_IN_CONTROL (1 << 0)             189 #define CDEV_FLAG_IN_CONTROL (1 << 0)
190                                                   190 
191 /* dialogue box starts */                         191 /* dialogue box starts */
192 #define DIAG_X 48                                 192 #define DIAG_X 48
193 #define DIAG_Y 8                                  193 #define DIAG_Y 8
194 #define THERMAL_SYSFS "/sys/class/thermal"        194 #define THERMAL_SYSFS "/sys/class/thermal"
195 #define CDEV "cooling_device"                     195 #define CDEV "cooling_device"
196 #define TZONE "thermal_zone"                      196 #define TZONE "thermal_zone"
197 #define TDATA_LEFT 16                             197 #define TDATA_LEFT 16
198 #endif /* TMON_H */                               198 #endif /* TMON_H */
199                                                   199 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php