diff options
author | Eduardo Valentin <eduardo.valentin@ti.com> | 2013-07-03 15:35:39 -0400 |
---|---|---|
committer | Eduardo Valentin <eduardo.valentin@ti.com> | 2013-12-04 08:31:34 -0500 |
commit | 4e5e4705bf69ea450f58fc709ac5888f321a9299 (patch) | |
tree | 523e7c5a3f5459acdd5b81d81b0deeb68de79dc0 /include/linux/thermal.h | |
parent | 81bd4e1cebed5efb85bd94a15342ee4d6965a416 (diff) |
thermal: introduce device tree parser
This patch introduces a device tree bindings for
describing the hardware thermal behavior and limits.
Also a parser to read and interpret the data and feed
it in the thermal framework is presented.
This patch introduces a thermal data parser for device
tree. The parsed data is used to build thermal zones
and thermal binding parameters. The output data
can then be used to deploy thermal policies.
This patch adds also documentation regarding this
API and how to define tree nodes to use
this infrastructure.
Note that, in order to be able to have control
on the sensor registration on the DT thermal zone,
it was required to allow changing the thermal zone
.get_temp callback. For this reason, this patch
also removes the 'const' modifier from the .ops
field of thermal zone devices.
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Diffstat (limited to 'include/linux/thermal.h')
-rw-r--r-- | include/linux/thermal.h | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/include/linux/thermal.h b/include/linux/thermal.h index b268d3cf7ae3..b780c5b27122 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h | |||
@@ -143,6 +143,7 @@ struct thermal_cooling_device { | |||
143 | int id; | 143 | int id; |
144 | char type[THERMAL_NAME_LENGTH]; | 144 | char type[THERMAL_NAME_LENGTH]; |
145 | struct device device; | 145 | struct device device; |
146 | struct device_node *np; | ||
146 | void *devdata; | 147 | void *devdata; |
147 | const struct thermal_cooling_device_ops *ops; | 148 | const struct thermal_cooling_device_ops *ops; |
148 | bool updated; /* true if the cooling device does not need update */ | 149 | bool updated; /* true if the cooling device does not need update */ |
@@ -172,7 +173,7 @@ struct thermal_zone_device { | |||
172 | int emul_temperature; | 173 | int emul_temperature; |
173 | int passive; | 174 | int passive; |
174 | unsigned int forced_passive; | 175 | unsigned int forced_passive; |
175 | const struct thermal_zone_device_ops *ops; | 176 | struct thermal_zone_device_ops *ops; |
176 | const struct thermal_zone_params *tzp; | 177 | const struct thermal_zone_params *tzp; |
177 | struct thermal_governor *governor; | 178 | struct thermal_governor *governor; |
178 | struct list_head thermal_instances; | 179 | struct list_head thermal_instances; |
@@ -242,8 +243,31 @@ struct thermal_genl_event { | |||
242 | }; | 243 | }; |
243 | 244 | ||
244 | /* Function declarations */ | 245 | /* Function declarations */ |
246 | #ifdef CONFIG_THERMAL_OF | ||
247 | struct thermal_zone_device * | ||
248 | thermal_zone_of_sensor_register(struct device *dev, int id, | ||
249 | void *data, int (*get_temp)(void *, long *), | ||
250 | int (*get_trend)(void *, long *)); | ||
251 | void thermal_zone_of_sensor_unregister(struct device *dev, | ||
252 | struct thermal_zone_device *tz); | ||
253 | #else | ||
254 | static inline struct thermal_zone_device * | ||
255 | thermal_zone_of_sensor_register(struct device *dev, int id, | ||
256 | void *data, int (*get_temp)(void *, long *), | ||
257 | int (*get_trend)(void *, long *)) | ||
258 | { | ||
259 | return NULL; | ||
260 | } | ||
261 | |||
262 | static inline | ||
263 | void thermal_zone_of_sensor_unregister(struct device *dev, | ||
264 | struct thermal_zone_device *tz) | ||
265 | { | ||
266 | } | ||
267 | |||
268 | #endif | ||
245 | struct thermal_zone_device *thermal_zone_device_register(const char *, int, int, | 269 | struct thermal_zone_device *thermal_zone_device_register(const char *, int, int, |
246 | void *, const struct thermal_zone_device_ops *, | 270 | void *, struct thermal_zone_device_ops *, |
247 | const struct thermal_zone_params *, int, int); | 271 | const struct thermal_zone_params *, int, int); |
248 | void thermal_zone_device_unregister(struct thermal_zone_device *); | 272 | void thermal_zone_device_unregister(struct thermal_zone_device *); |
249 | 273 | ||