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

TOMOYO Linux Cross Reference
Linux/tools/lib/thermal/include/thermal.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ 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.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: LGPL-2.1+ */
  2 /* Copyright (C) 2022, Linaro Ltd - Daniel Lezcano <daniel.lezcano@linaro.org> */
  3 #ifndef __LIBTHERMAL_H
  4 #define __LIBTHERMAL_H
  5 
  6 #include <linux/thermal.h>
  7 
  8 #ifndef LIBTHERMAL_API
  9 #define LIBTHERMAL_API __attribute__((visibility("default")))
 10 #endif
 11 
 12 #ifdef __cplusplus
 13 extern "C" {
 14 #endif
 15 
 16 struct thermal_sampling_ops {
 17         int (*tz_temp)(int tz_id, int temp, void *arg);
 18 };
 19 
 20 struct thermal_events_ops {
 21         int (*tz_create)(const char *name, int tz_id, void *arg);
 22         int (*tz_delete)(int tz_id, void *arg);
 23         int (*tz_enable)(int tz_id, void *arg);
 24         int (*tz_disable)(int tz_id, void *arg);
 25         int (*trip_high)(int tz_id, int trip_id, int temp, void *arg);
 26         int (*trip_low)(int tz_id, int trip_id, int temp, void *arg);
 27         int (*trip_add)(int tz_id, int trip_id, int type, int temp, int hyst, void *arg);
 28         int (*trip_change)(int tz_id, int trip_id, int type, int temp, int hyst, void *arg);
 29         int (*trip_delete)(int tz_id, int trip_id, void *arg);
 30         int (*cdev_add)(const char *name, int cdev_id, int max_state, void *arg);
 31         int (*cdev_delete)(int cdev_id, void *arg);
 32         int (*cdev_update)(int cdev_id, int cur_state, void *arg);
 33         int (*gov_change)(int tz_id, const char *gov_name, void *arg);
 34 };
 35 
 36 struct thermal_ops {
 37         struct thermal_sampling_ops sampling;
 38         struct thermal_events_ops events;
 39 };
 40 
 41 struct thermal_trip {
 42         int id;
 43         int type;
 44         int temp;
 45         int hyst;
 46 };
 47 
 48 struct thermal_zone {
 49         int id;
 50         int temp;
 51         char name[THERMAL_NAME_LENGTH];
 52         char governor[THERMAL_NAME_LENGTH];
 53         struct thermal_trip *trip;
 54 };
 55 
 56 struct thermal_cdev {
 57         int id;
 58         char name[THERMAL_NAME_LENGTH];
 59         int max_state;
 60         int min_state;
 61         int cur_state;
 62 };
 63 
 64 typedef enum {
 65         THERMAL_ERROR = -1,
 66         THERMAL_SUCCESS = 0,
 67 } thermal_error_t;
 68 
 69 struct thermal_handler;
 70 
 71 typedef int (*cb_tz_t)(struct thermal_zone *, void *);
 72 
 73 typedef int (*cb_tt_t)(struct thermal_trip *, void *);
 74 
 75 typedef int (*cb_tc_t)(struct thermal_cdev *, void *);
 76 
 77 LIBTHERMAL_API int for_each_thermal_zone(struct thermal_zone *tz, cb_tz_t cb, void *arg);
 78 
 79 LIBTHERMAL_API int for_each_thermal_trip(struct thermal_trip *tt, cb_tt_t cb, void *arg);
 80 
 81 LIBTHERMAL_API int for_each_thermal_cdev(struct thermal_cdev *cdev, cb_tc_t cb, void *arg);
 82 
 83 LIBTHERMAL_API struct thermal_zone *thermal_zone_find_by_name(struct thermal_zone *tz,
 84                                                               const char *name);
 85 
 86 LIBTHERMAL_API struct thermal_zone *thermal_zone_find_by_id(struct thermal_zone *tz, int id);
 87 
 88 LIBTHERMAL_API struct thermal_zone *thermal_zone_discover(struct thermal_handler *th);
 89 
 90 LIBTHERMAL_API struct thermal_handler *thermal_init(struct thermal_ops *ops);
 91 
 92 LIBTHERMAL_API void thermal_exit(struct thermal_handler *th);
 93 
 94 /*
 95  * Netlink thermal events
 96  */
 97 LIBTHERMAL_API thermal_error_t thermal_events_exit(struct thermal_handler *th);
 98 
 99 LIBTHERMAL_API thermal_error_t thermal_events_init(struct thermal_handler *th);
100 
101 LIBTHERMAL_API thermal_error_t thermal_events_handle(struct thermal_handler *th, void *arg);
102 
103 LIBTHERMAL_API int thermal_events_fd(struct thermal_handler *th);
104 
105 /*
106  * Netlink thermal commands
107  */
108 LIBTHERMAL_API thermal_error_t thermal_cmd_exit(struct thermal_handler *th);
109 
110 LIBTHERMAL_API thermal_error_t thermal_cmd_init(struct thermal_handler *th);
111 
112 LIBTHERMAL_API thermal_error_t thermal_cmd_get_tz(struct thermal_handler *th,
113                                                   struct thermal_zone **tz);
114 
115 LIBTHERMAL_API thermal_error_t thermal_cmd_get_cdev(struct thermal_handler *th,
116                                                     struct thermal_cdev **tc);
117 
118 LIBTHERMAL_API thermal_error_t thermal_cmd_get_trip(struct thermal_handler *th,
119                                                     struct thermal_zone *tz);
120 
121 LIBTHERMAL_API thermal_error_t thermal_cmd_get_governor(struct thermal_handler *th,
122                                                         struct thermal_zone *tz);
123 
124 LIBTHERMAL_API thermal_error_t thermal_cmd_get_temp(struct thermal_handler *th,
125                                                     struct thermal_zone *tz);
126 
127 /*
128  * Netlink thermal samples
129  */
130 LIBTHERMAL_API thermal_error_t thermal_sampling_exit(struct thermal_handler *th);
131 
132 LIBTHERMAL_API thermal_error_t thermal_sampling_init(struct thermal_handler *th);
133 
134 LIBTHERMAL_API thermal_error_t thermal_sampling_handle(struct thermal_handler *th, void *arg);
135 
136 LIBTHERMAL_API int thermal_sampling_fd(struct thermal_handler *th);
137 
138 #endif /* __LIBTHERMAL_H */
139 
140 #ifdef __cplusplus
141 }
142 #endif
143 

~ [ 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