diff options
Diffstat (limited to 'include/linux/thermal.h')
-rw-r--r-- | include/linux/thermal.h | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 90c1c191ea69..06d3e6eb9ca8 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h | |||
@@ -41,6 +41,7 @@ struct thermal_zone_device_ops { | |||
41 | int (*set_mode) (struct thermal_zone_device *, const char *); | 41 | int (*set_mode) (struct thermal_zone_device *, const char *); |
42 | int (*get_trip_type) (struct thermal_zone_device *, int, char *); | 42 | int (*get_trip_type) (struct thermal_zone_device *, int, char *); |
43 | int (*get_trip_temp) (struct thermal_zone_device *, int, char *); | 43 | int (*get_trip_temp) (struct thermal_zone_device *, int, char *); |
44 | int (*get_crit_temp) (struct thermal_zone_device *, unsigned long *); | ||
44 | }; | 45 | }; |
45 | 46 | ||
46 | struct thermal_cooling_device_ops { | 47 | struct thermal_cooling_device_ops { |
@@ -65,6 +66,23 @@ struct thermal_cooling_device { | |||
65 | ((long)t-2732+5)/10 : ((long)t-2732-5)/10) | 66 | ((long)t-2732+5)/10 : ((long)t-2732-5)/10) |
66 | #define CELSIUS_TO_KELVIN(t) ((t)*10+2732) | 67 | #define CELSIUS_TO_KELVIN(t) ((t)*10+2732) |
67 | 68 | ||
69 | #if defined(CONFIG_HWMON) || \ | ||
70 | (defined(CONFIG_HWMON_MODULE) && defined(CONFIG_THERMAL_MODULE)) | ||
71 | /* thermal zone devices with the same type share one hwmon device */ | ||
72 | struct thermal_hwmon_device { | ||
73 | char type[THERMAL_NAME_LENGTH]; | ||
74 | struct device *device; | ||
75 | int count; | ||
76 | struct list_head tz_list; | ||
77 | struct list_head node; | ||
78 | }; | ||
79 | |||
80 | struct thermal_hwmon_attr { | ||
81 | struct device_attribute attr; | ||
82 | char name[16]; | ||
83 | }; | ||
84 | #endif | ||
85 | |||
68 | struct thermal_zone_device { | 86 | struct thermal_zone_device { |
69 | int id; | 87 | int id; |
70 | char type[THERMAL_NAME_LENGTH]; | 88 | char type[THERMAL_NAME_LENGTH]; |
@@ -76,6 +94,13 @@ struct thermal_zone_device { | |||
76 | struct idr idr; | 94 | struct idr idr; |
77 | struct mutex lock; /* protect cooling devices list */ | 95 | struct mutex lock; /* protect cooling devices list */ |
78 | struct list_head node; | 96 | struct list_head node; |
97 | #if defined(CONFIG_HWMON) || \ | ||
98 | (defined(CONFIG_HWMON_MODULE) && defined(CONFIG_THERMAL_MODULE)) | ||
99 | struct list_head hwmon_node; | ||
100 | struct thermal_hwmon_device *hwmon; | ||
101 | struct thermal_hwmon_attr temp_input; /* hwmon sys attr */ | ||
102 | struct thermal_hwmon_attr temp_crit; /* hwmon sys attr */ | ||
103 | #endif | ||
79 | }; | 104 | }; |
80 | 105 | ||
81 | struct thermal_zone_device *thermal_zone_device_register(char *, int, void *, | 106 | struct thermal_zone_device *thermal_zone_device_register(char *, int, void *, |
@@ -88,24 +113,10 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int, | |||
88 | struct thermal_cooling_device *); | 113 | struct thermal_cooling_device *); |
89 | int thermal_zone_unbind_cooling_device(struct thermal_zone_device *, int, | 114 | int thermal_zone_unbind_cooling_device(struct thermal_zone_device *, int, |
90 | struct thermal_cooling_device *); | 115 | struct thermal_cooling_device *); |
91 | |||
92 | #ifdef CONFIG_THERMAL | ||
93 | struct thermal_cooling_device *thermal_cooling_device_register(char *, void *, | 116 | struct thermal_cooling_device *thermal_cooling_device_register(char *, void *, |
94 | struct | 117 | struct |
95 | thermal_cooling_device_ops | 118 | thermal_cooling_device_ops |
96 | *); | 119 | *); |
97 | void thermal_cooling_device_unregister(struct thermal_cooling_device *); | 120 | void thermal_cooling_device_unregister(struct thermal_cooling_device *); |
98 | #else | ||
99 | static inline struct thermal_cooling_device | ||
100 | *thermal_cooling_device_register(char *c, void *v, | ||
101 | struct thermal_cooling_device_ops *t) | ||
102 | { | ||
103 | return NULL; | ||
104 | } | ||
105 | static inline | ||
106 | void thermal_cooling_device_unregister(struct thermal_cooling_device *t) | ||
107 | { | ||
108 | }; | ||
109 | #endif | ||
110 | 121 | ||
111 | #endif /* __THERMAL_H__ */ | 122 | #endif /* __THERMAL_H__ */ |