This source file includes following definitions.
- thermal_cooling_device_stats_update
- of_parse_thermal_zones
- of_thermal_destroy_zones
- of_thermal_get_ntrips
- of_thermal_is_trip_valid
- of_thermal_get_trip_points
1
2
3
4
5
6
7
8
9 #ifndef __THERMAL_CORE_H__
10 #define __THERMAL_CORE_H__
11
12 #include <linux/device.h>
13 #include <linux/thermal.h>
14
15
16 #define THERMAL_NO_TARGET -1UL
17
18
19 extern struct thermal_governor *__governor_thermal_table[];
20 extern struct thermal_governor *__governor_thermal_table_end[];
21
22 #define THERMAL_TABLE_ENTRY(table, name) \
23 static typeof(name) *__thermal_table_entry_##name \
24 __used __section(__##table##_thermal_table) = &name
25
26 #define THERMAL_GOVERNOR_DECLARE(name) THERMAL_TABLE_ENTRY(governor, name)
27
28 #define for_each_governor_table(__governor) \
29 for (__governor = __governor_thermal_table; \
30 __governor < __governor_thermal_table_end; \
31 __governor++)
32
33
34
35
36
37
38 struct thermal_instance {
39 int id;
40 char name[THERMAL_NAME_LENGTH];
41 struct thermal_zone_device *tz;
42 struct thermal_cooling_device *cdev;
43 int trip;
44 bool initialized;
45 unsigned long upper;
46 unsigned long lower;
47 unsigned long target;
48 char attr_name[THERMAL_NAME_LENGTH];
49 struct device_attribute attr;
50 char weight_attr_name[THERMAL_NAME_LENGTH];
51 struct device_attribute weight_attr;
52 struct list_head tz_node;
53 struct list_head cdev_node;
54 unsigned int weight;
55 };
56
57 #define to_thermal_zone(_dev) \
58 container_of(_dev, struct thermal_zone_device, device)
59
60 #define to_cooling_device(_dev) \
61 container_of(_dev, struct thermal_cooling_device, device)
62
63 int thermal_register_governor(struct thermal_governor *);
64 void thermal_unregister_governor(struct thermal_governor *);
65 void thermal_zone_device_rebind_exception(struct thermal_zone_device *,
66 const char *, size_t);
67 void thermal_zone_device_unbind_exception(struct thermal_zone_device *,
68 const char *, size_t);
69 int thermal_zone_device_set_policy(struct thermal_zone_device *, char *);
70 int thermal_build_list_of_policies(char *buf);
71
72
73 int thermal_zone_create_device_groups(struct thermal_zone_device *, int);
74 void thermal_zone_destroy_device_groups(struct thermal_zone_device *);
75 void thermal_cooling_device_setup_sysfs(struct thermal_cooling_device *);
76 void thermal_cooling_device_destroy_sysfs(struct thermal_cooling_device *cdev);
77
78 ssize_t trip_point_show(struct device *, struct device_attribute *, char *);
79 ssize_t weight_show(struct device *, struct device_attribute *, char *);
80 ssize_t weight_store(struct device *, struct device_attribute *, const char *,
81 size_t);
82
83 #ifdef CONFIG_THERMAL_STATISTICS
84 void thermal_cooling_device_stats_update(struct thermal_cooling_device *cdev,
85 unsigned long new_state);
86 #else
87 static inline void
88 thermal_cooling_device_stats_update(struct thermal_cooling_device *cdev,
89 unsigned long new_state) {}
90 #endif
91
92
93 #ifdef CONFIG_THERMAL_OF
94 int of_parse_thermal_zones(void);
95 void of_thermal_destroy_zones(void);
96 int of_thermal_get_ntrips(struct thermal_zone_device *);
97 bool of_thermal_is_trip_valid(struct thermal_zone_device *, int);
98 const struct thermal_trip *
99 of_thermal_get_trip_points(struct thermal_zone_device *);
100 #else
101 static inline int of_parse_thermal_zones(void) { return 0; }
102 static inline void of_thermal_destroy_zones(void) { }
103 static inline int of_thermal_get_ntrips(struct thermal_zone_device *tz)
104 {
105 return 0;
106 }
107 static inline bool of_thermal_is_trip_valid(struct thermal_zone_device *tz,
108 int trip)
109 {
110 return false;
111 }
112 static inline const struct thermal_trip *
113 of_thermal_get_trip_points(struct thermal_zone_device *tz)
114 {
115 return NULL;
116 }
117 #endif
118
119 #endif