diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-17 13:16:27 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-17 13:16:27 -0500 |
| commit | 2efda9042d76fcab0fb87b7ee8d84da52bf122b0 (patch) | |
| tree | f390199ae330fbe20b3c9d8fe1021d909f752421 /include | |
| parent | 0b4954c46943e8f15b9379eed4f133c874a0bc66 (diff) | |
| parent | 2707dbd09a859b7205917f9baf9d0192944ac46c (diff) | |
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux
Pull thermal management update from Zhang Rui:
"Summary:
- of-thermal extension to allow drivers to register and use its
functionality in a better way, without exploiting thermal core.
From Lukasz Majewski.
- Fix a bug in intel_soc_dts_thermal driver which calls a sleep
function in interrupt handler. From Maurice Petallo.
- add a thermal UAPI header file for exporting the thermal generic
netlink information to user-space. From Florian Fainelli.
- First round of refactoring in Exynos driver. Bartlomiej and Lukasz
are attempting to make it lean and easier to understand.
- New thermal driver for Rockchip (rk3288), with support for DT
thermal. From Caesar Wang.
- New thermal driver for Nvidia, Tegra124 SOCTHERM driver, with
support for DT thermal. From Mikko Perttunen.
- New cooling device, based on common clock framework. From Eduardo
Valentin.
- a couple of small fixes in thermal core framework. From Srinivas
Pandruvada, Javi Merino, Luis Henriques.
- Dropping Armada A375-Z1 SoC thermal support as the chip is not in
the market, armada folks decided to drop its support.
- a couple of small fixes and cleanups in int340x thermal driver"
* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux: (58 commits)
thermal: provide an UAPI header file
Thermal/int340x: Clear the error value of the last acpi_bus_get_device() call
thermal/powerclamp: add id for braswell cpu
thermal: Intel SoC DTS: Don't do thermal zone update inside spin_lock
Thermal: fix platform_no_drv_owner.cocci warnings
Thermal/int340x: avoid unnecessary pointer casting
thermal: int3403: Delete a check before thermal_zone_device_unregister()
thermal/int3400: export uuids
thermal: of: Extend current of-thermal.c code to allow setting emulated temp
thermal: of: Extend of-thermal to export table of trip points
thermal: of: Rename struct __thermal_trip to struct thermal_trip
thermal: of: Extend of-thermal.c to provide check if trip point is valid
thermal: of: Extend of-thermal.c to provide number of trip points
thermal: Fix error path in thermal_init()
thermal: lock the thermal zone when switching governors
thermal: core: ignore invalid trip temperature
thermal: armada: Remove support for A375-Z1 SoC
thermal: rockchip: add driver for thermal
dt-bindings: document Rockchip thermal
thermal: exynos: remove exynos_tmu_data.h include
...
Diffstat (limited to 'include')
| -rw-r--r-- | include/dt-bindings/thermal/tegra124-soctherm.h | 13 | ||||
| -rw-r--r-- | include/linux/clock_cooling.h | 65 | ||||
| -rw-r--r-- | include/linux/thermal.h | 73 | ||||
| -rw-r--r-- | include/uapi/linux/Kbuild | 1 | ||||
| -rw-r--r-- | include/uapi/linux/thermal.h | 35 |
5 files changed, 151 insertions, 36 deletions
diff --git a/include/dt-bindings/thermal/tegra124-soctherm.h b/include/dt-bindings/thermal/tegra124-soctherm.h new file mode 100644 index 000000000000..85aaf66690f9 --- /dev/null +++ b/include/dt-bindings/thermal/tegra124-soctherm.h | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | /* | ||
| 2 | * This header provides constants for binding nvidia,tegra124-soctherm. | ||
| 3 | */ | ||
| 4 | |||
| 5 | #ifndef _DT_BINDINGS_THERMAL_TEGRA124_SOCTHERM_H | ||
| 6 | #define _DT_BINDINGS_THERMAL_TEGRA124_SOCTHERM_H | ||
| 7 | |||
| 8 | #define TEGRA124_SOCTHERM_SENSOR_CPU 0 | ||
| 9 | #define TEGRA124_SOCTHERM_SENSOR_MEM 1 | ||
| 10 | #define TEGRA124_SOCTHERM_SENSOR_GPU 2 | ||
| 11 | #define TEGRA124_SOCTHERM_SENSOR_PLLX 3 | ||
| 12 | |||
| 13 | #endif | ||
diff --git a/include/linux/clock_cooling.h b/include/linux/clock_cooling.h new file mode 100644 index 000000000000..4d1019d56f7f --- /dev/null +++ b/include/linux/clock_cooling.h | |||
| @@ -0,0 +1,65 @@ | |||
| 1 | /* | ||
| 2 | * linux/include/linux/clock_cooling.h | ||
| 3 | * | ||
| 4 | * Copyright (C) 2014 Eduardo Valentin <edubezval@gmail.com> | ||
| 5 | * | ||
| 6 | * Copyright (C) 2013 Texas Instruments Inc. | ||
| 7 | * Contact: Eduardo Valentin <eduardo.valentin@ti.com> | ||
| 8 | * | ||
| 9 | * Highly based on cpu_cooling.c. | ||
| 10 | * Copyright (C) 2012 Samsung Electronics Co., Ltd(http://www.samsung.com) | ||
| 11 | * Copyright (C) 2012 Amit Daniel <amit.kachhap@linaro.org> | ||
| 12 | * | ||
| 13 | * This program is free software; you can redistribute it and/or modify | ||
| 14 | * it under the terms of the GNU General Public License as published by | ||
| 15 | * the Free Software Foundation; version 2 of the License. | ||
| 16 | * | ||
| 17 | * This program is distributed in the hope that it will be useful, but | ||
| 18 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 20 | * General Public License for more details. | ||
| 21 | */ | ||
| 22 | |||
| 23 | #ifndef __CPU_COOLING_H__ | ||
| 24 | #define __CPU_COOLING_H__ | ||
| 25 | |||
| 26 | #include <linux/of.h> | ||
| 27 | #include <linux/thermal.h> | ||
| 28 | #include <linux/cpumask.h> | ||
| 29 | |||
| 30 | #ifdef CONFIG_CLOCK_THERMAL | ||
| 31 | /** | ||
| 32 | * clock_cooling_register - function to create clock cooling device. | ||
| 33 | * @dev: struct device pointer to the device used as clock cooling device. | ||
| 34 | * @clock_name: string containing the clock used as cooling mechanism. | ||
| 35 | */ | ||
| 36 | struct thermal_cooling_device * | ||
| 37 | clock_cooling_register(struct device *dev, const char *clock_name); | ||
| 38 | |||
| 39 | /** | ||
| 40 | * clock_cooling_unregister - function to remove clock cooling device. | ||
| 41 | * @cdev: thermal cooling device pointer. | ||
| 42 | */ | ||
| 43 | void clock_cooling_unregister(struct thermal_cooling_device *cdev); | ||
| 44 | |||
| 45 | unsigned long clock_cooling_get_level(struct thermal_cooling_device *cdev, | ||
| 46 | unsigned long freq); | ||
| 47 | #else /* !CONFIG_CLOCK_THERMAL */ | ||
| 48 | static inline struct thermal_cooling_device * | ||
| 49 | clock_cooling_register(struct device *dev, const char *clock_name) | ||
| 50 | { | ||
| 51 | return NULL; | ||
| 52 | } | ||
| 53 | static inline | ||
| 54 | void clock_cooling_unregister(struct thermal_cooling_device *cdev) | ||
| 55 | { | ||
| 56 | } | ||
| 57 | static inline | ||
| 58 | unsigned long clock_cooling_get_level(struct thermal_cooling_device *cdev, | ||
| 59 | unsigned long freq) | ||
| 60 | { | ||
| 61 | return THERMAL_CSTATE_INVALID; | ||
| 62 | } | ||
| 63 | #endif /* CONFIG_CLOCK_THERMAL */ | ||
| 64 | |||
| 65 | #endif /* __CPU_COOLING_H__ */ | ||
diff --git a/include/linux/thermal.h b/include/linux/thermal.h index ef90838b36a0..c611a02fbc51 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h | |||
| @@ -29,10 +29,10 @@ | |||
| 29 | #include <linux/idr.h> | 29 | #include <linux/idr.h> |
| 30 | #include <linux/device.h> | 30 | #include <linux/device.h> |
| 31 | #include <linux/workqueue.h> | 31 | #include <linux/workqueue.h> |
| 32 | #include <uapi/linux/thermal.h> | ||
| 32 | 33 | ||
| 33 | #define THERMAL_TRIPS_NONE -1 | 34 | #define THERMAL_TRIPS_NONE -1 |
| 34 | #define THERMAL_MAX_TRIPS 12 | 35 | #define THERMAL_MAX_TRIPS 12 |
| 35 | #define THERMAL_NAME_LENGTH 20 | ||
| 36 | 36 | ||
| 37 | /* invalid cooling state */ | 37 | /* invalid cooling state */ |
| 38 | #define THERMAL_CSTATE_INVALID -1UL | 38 | #define THERMAL_CSTATE_INVALID -1UL |
| @@ -49,11 +49,6 @@ | |||
| 49 | #define MILLICELSIUS_TO_DECI_KELVIN_WITH_OFFSET(t, off) (((t) / 100) + (off)) | 49 | #define MILLICELSIUS_TO_DECI_KELVIN_WITH_OFFSET(t, off) (((t) / 100) + (off)) |
| 50 | #define MILLICELSIUS_TO_DECI_KELVIN(t) MILLICELSIUS_TO_DECI_KELVIN_WITH_OFFSET(t, 2732) | 50 | #define MILLICELSIUS_TO_DECI_KELVIN(t) MILLICELSIUS_TO_DECI_KELVIN_WITH_OFFSET(t, 2732) |
| 51 | 51 | ||
| 52 | /* Adding event notification support elements */ | ||
| 53 | #define THERMAL_GENL_FAMILY_NAME "thermal_event" | ||
| 54 | #define THERMAL_GENL_VERSION 0x01 | ||
| 55 | #define THERMAL_GENL_MCAST_GROUP_NAME "thermal_mc_grp" | ||
| 56 | |||
| 57 | /* Default Thermal Governor */ | 52 | /* Default Thermal Governor */ |
| 58 | #if defined(CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE) | 53 | #if defined(CONFIG_THERMAL_DEFAULT_GOV_STEP_WISE) |
| 59 | #define DEFAULT_THERMAL_GOVERNOR "step_wise" | 54 | #define DEFAULT_THERMAL_GOVERNOR "step_wise" |
| @@ -86,30 +81,6 @@ enum thermal_trend { | |||
| 86 | THERMAL_TREND_DROP_FULL, /* apply lowest cooling action */ | 81 | THERMAL_TREND_DROP_FULL, /* apply lowest cooling action */ |
| 87 | }; | 82 | }; |
| 88 | 83 | ||
| 89 | /* Events supported by Thermal Netlink */ | ||
| 90 | enum events { | ||
| 91 | THERMAL_AUX0, | ||
| 92 | THERMAL_AUX1, | ||
| 93 | THERMAL_CRITICAL, | ||
| 94 | THERMAL_DEV_FAULT, | ||
| 95 | }; | ||
| 96 | |||
| 97 | /* attributes of thermal_genl_family */ | ||
| 98 | enum { | ||
| 99 | THERMAL_GENL_ATTR_UNSPEC, | ||
| 100 | THERMAL_GENL_ATTR_EVENT, | ||
| 101 | __THERMAL_GENL_ATTR_MAX, | ||
| 102 | }; | ||
| 103 | #define THERMAL_GENL_ATTR_MAX (__THERMAL_GENL_ATTR_MAX - 1) | ||
| 104 | |||
| 105 | /* commands supported by the thermal_genl_family */ | ||
| 106 | enum { | ||
| 107 | THERMAL_GENL_CMD_UNSPEC, | ||
| 108 | THERMAL_GENL_CMD_EVENT, | ||
| 109 | __THERMAL_GENL_CMD_MAX, | ||
| 110 | }; | ||
| 111 | #define THERMAL_GENL_CMD_MAX (__THERMAL_GENL_CMD_MAX - 1) | ||
| 112 | |||
| 113 | struct thermal_zone_device_ops { | 84 | struct thermal_zone_device_ops { |
| 114 | int (*bind) (struct thermal_zone_device *, | 85 | int (*bind) (struct thermal_zone_device *, |
| 115 | struct thermal_cooling_device *); | 86 | struct thermal_cooling_device *); |
| @@ -289,19 +260,49 @@ struct thermal_genl_event { | |||
| 289 | enum events event; | 260 | enum events event; |
| 290 | }; | 261 | }; |
| 291 | 262 | ||
| 263 | /** | ||
| 264 | * struct thermal_zone_of_device_ops - scallbacks for handling DT based zones | ||
| 265 | * | ||
| 266 | * Mandatory: | ||
| 267 | * @get_temp: a pointer to a function that reads the sensor temperature. | ||
| 268 | * | ||
| 269 | * Optional: | ||
| 270 | * @get_trend: a pointer to a function that reads the sensor temperature trend. | ||
| 271 | * @set_emul_temp: a pointer to a function that sets sensor emulated | ||
| 272 | * temperature. | ||
| 273 | */ | ||
| 274 | struct thermal_zone_of_device_ops { | ||
| 275 | int (*get_temp)(void *, long *); | ||
| 276 | int (*get_trend)(void *, long *); | ||
| 277 | int (*set_emul_temp)(void *, unsigned long); | ||
| 278 | }; | ||
| 279 | |||
| 280 | /** | ||
| 281 | * struct thermal_trip - representation of a point in temperature domain | ||
| 282 | * @np: pointer to struct device_node that this trip point was created from | ||
| 283 | * @temperature: temperature value in miliCelsius | ||
| 284 | * @hysteresis: relative hysteresis in miliCelsius | ||
| 285 | * @type: trip point type | ||
| 286 | */ | ||
| 287 | |||
| 288 | struct thermal_trip { | ||
| 289 | struct device_node *np; | ||
| 290 | unsigned long int temperature; | ||
| 291 | unsigned long int hysteresis; | ||
| 292 | enum thermal_trip_type type; | ||
| 293 | }; | ||
| 294 | |||
| 292 | /* Function declarations */ | 295 | /* Function declarations */ |
| 293 | #ifdef CONFIG_THERMAL_OF | 296 | #ifdef CONFIG_THERMAL_OF |
| 294 | struct thermal_zone_device * | 297 | struct thermal_zone_device * |
| 295 | thermal_zone_of_sensor_register(struct device *dev, int id, | 298 | thermal_zone_of_sensor_register(struct device *dev, int id, void *data, |
| 296 | void *data, int (*get_temp)(void *, long *), | 299 | const struct thermal_zone_of_device_ops *ops); |
| 297 | int (*get_trend)(void *, long *)); | ||
| 298 | void thermal_zone_of_sensor_unregister(struct device *dev, | 300 | void thermal_zone_of_sensor_unregister(struct device *dev, |
| 299 | struct thermal_zone_device *tz); | 301 | struct thermal_zone_device *tz); |
| 300 | #else | 302 | #else |
| 301 | static inline struct thermal_zone_device * | 303 | static inline struct thermal_zone_device * |
| 302 | thermal_zone_of_sensor_register(struct device *dev, int id, | 304 | thermal_zone_of_sensor_register(struct device *dev, int id, void *data, |
| 303 | void *data, int (*get_temp)(void *, long *), | 305 | const struct thermal_zone_of_device_ops *ops) |
| 304 | int (*get_trend)(void *, long *)) | ||
| 305 | { | 306 | { |
| 306 | return NULL; | 307 | return NULL; |
| 307 | } | 308 | } |
diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild index 259d31fc9073..00b100023c47 100644 --- a/include/uapi/linux/Kbuild +++ b/include/uapi/linux/Kbuild | |||
| @@ -387,6 +387,7 @@ header-y += tcp.h | |||
| 387 | header-y += tcp_metrics.h | 387 | header-y += tcp_metrics.h |
| 388 | header-y += telephony.h | 388 | header-y += telephony.h |
| 389 | header-y += termios.h | 389 | header-y += termios.h |
| 390 | header-y += thermal.h | ||
| 390 | header-y += time.h | 391 | header-y += time.h |
| 391 | header-y += times.h | 392 | header-y += times.h |
| 392 | header-y += timex.h | 393 | header-y += timex.h |
diff --git a/include/uapi/linux/thermal.h b/include/uapi/linux/thermal.h new file mode 100644 index 000000000000..ac5535855982 --- /dev/null +++ b/include/uapi/linux/thermal.h | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | #ifndef _UAPI_LINUX_THERMAL_H | ||
| 2 | #define _UAPI_LINUX_THERMAL_H | ||
| 3 | |||
| 4 | #define THERMAL_NAME_LENGTH 20 | ||
| 5 | |||
| 6 | /* Adding event notification support elements */ | ||
| 7 | #define THERMAL_GENL_FAMILY_NAME "thermal_event" | ||
| 8 | #define THERMAL_GENL_VERSION 0x01 | ||
| 9 | #define THERMAL_GENL_MCAST_GROUP_NAME "thermal_mc_grp" | ||
| 10 | |||
| 11 | /* Events supported by Thermal Netlink */ | ||
| 12 | enum events { | ||
| 13 | THERMAL_AUX0, | ||
| 14 | THERMAL_AUX1, | ||
| 15 | THERMAL_CRITICAL, | ||
| 16 | THERMAL_DEV_FAULT, | ||
| 17 | }; | ||
| 18 | |||
| 19 | /* attributes of thermal_genl_family */ | ||
| 20 | enum { | ||
| 21 | THERMAL_GENL_ATTR_UNSPEC, | ||
| 22 | THERMAL_GENL_ATTR_EVENT, | ||
| 23 | __THERMAL_GENL_ATTR_MAX, | ||
| 24 | }; | ||
| 25 | #define THERMAL_GENL_ATTR_MAX (__THERMAL_GENL_ATTR_MAX - 1) | ||
| 26 | |||
| 27 | /* commands supported by the thermal_genl_family */ | ||
| 28 | enum { | ||
| 29 | THERMAL_GENL_CMD_UNSPEC, | ||
| 30 | THERMAL_GENL_CMD_EVENT, | ||
| 31 | __THERMAL_GENL_CMD_MAX, | ||
| 32 | }; | ||
| 33 | #define THERMAL_GENL_CMD_MAX (__THERMAL_GENL_CMD_MAX - 1) | ||
| 34 | |||
| 35 | #endif /* _UAPI_LINUX_THERMAL_H */ | ||
