aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/devfreq_cooling.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-11-11 12:03:01 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-11-11 12:03:01 -0500
commitbaf51c43926ec9aa42ef9d33ca6ee9e3e043aebe (patch)
tree3ae0fbc2389f8264f195699721c9489dc347ff4f /include/linux/devfreq_cooling.h
parentc5a37883f42be712a989e54d5d6c0159b0e56599 (diff)
parent7c5b2759bf8c2cbc60e5560c72cf51a2628f6d30 (diff)
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux
Pull thermal updates from Zhang Rui: - Implement generic devfreq cooling mechanism through frequency reduction for devices using devfreq. From Ørjan Eide and Javi Merino. - Introduce OMAP3 support on TI SoC thermal driver. From Pavel Mack and Eduardo Valentin. - A bounch of small fixes on devfreq_cooling, Exynos, IMX, Armada, and Rockchip thermal drivers. * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux: (24 commits) thermal: exynos: Directly return 0 instead of using local ret variable thermal: exynos: Remove unneeded semicolon thermal: exynos: Use IS_ERR() because regulator cannot be NULL thermal: exynos: Fix first temperature read after registering sensor thermal: exynos: Fix unbalanced regulator disable on probe failure devfreq_cooling: return on allocation failure thermal: rockchip: support the sleep pinctrl state to avoid glitches in s2r dt-bindings: rockchip-thermal: Add the pinctrl states in this document thermal: devfreq_cooling: Make power a u64 thermal: devfreq_cooling: use a thermal_cooling_device for register and unregister thermal: underflow bug in imx_set_trip_temp() thermal: armada: Fix possible overflow in the Armada 380 thermal sensor formula thermal: imx: register irq handler later in probe thermal: rockhip: fix setting thermal shutdown polarity thermal: rockchip: fix handling of invalid readings devfreq_cooling: add trace information thermal: Add devfreq cooling PM / OPP: get the voltage for all OPPs tools/thermal: tmon: use pkg-config also for CFLAGS linux/thermal.h: rename KELVIN_TO_CELSIUS to DECI_KELVIN_TO_CELSIUS ...
Diffstat (limited to 'include/linux/devfreq_cooling.h')
-rw-r--r--include/linux/devfreq_cooling.h81
1 files changed, 81 insertions, 0 deletions
diff --git a/include/linux/devfreq_cooling.h b/include/linux/devfreq_cooling.h
new file mode 100644
index 000000000000..7adf6cc4b305
--- /dev/null
+++ b/include/linux/devfreq_cooling.h
@@ -0,0 +1,81 @@
1/*
2 * devfreq_cooling: Thermal cooling device implementation for devices using
3 * devfreq
4 *
5 * Copyright (C) 2014-2015 ARM Limited
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
12 * kind, whether express or implied; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#ifndef __DEVFREQ_COOLING_H__
18#define __DEVFREQ_COOLING_H__
19
20#include <linux/devfreq.h>
21#include <linux/thermal.h>
22
23#ifdef CONFIG_DEVFREQ_THERMAL
24
25/**
26 * struct devfreq_cooling_power - Devfreq cooling power ops
27 * @get_static_power: Take voltage, in mV, and return the static power
28 * in mW. If NULL, the static power is assumed
29 * to be 0.
30 * @get_dynamic_power: Take voltage, in mV, and frequency, in HZ, and
31 * return the dynamic power draw in mW. If NULL,
32 * a simple power model is used.
33 * @dyn_power_coeff: Coefficient for the simple dynamic power model in
34 * mW/(MHz mV mV).
35 * If get_dynamic_power() is NULL, then the
36 * dynamic power is calculated as
37 * @dyn_power_coeff * frequency * voltage^2
38 */
39struct devfreq_cooling_power {
40 unsigned long (*get_static_power)(unsigned long voltage);
41 unsigned long (*get_dynamic_power)(unsigned long freq,
42 unsigned long voltage);
43 unsigned long dyn_power_coeff;
44};
45
46struct thermal_cooling_device *
47of_devfreq_cooling_register_power(struct device_node *np, struct devfreq *df,
48 struct devfreq_cooling_power *dfc_power);
49struct thermal_cooling_device *
50of_devfreq_cooling_register(struct device_node *np, struct devfreq *df);
51struct thermal_cooling_device *devfreq_cooling_register(struct devfreq *df);
52void devfreq_cooling_unregister(struct thermal_cooling_device *dfc);
53
54#else /* !CONFIG_DEVFREQ_THERMAL */
55
56struct thermal_cooling_device *
57of_devfreq_cooling_register_power(struct device_node *np, struct devfreq *df,
58 struct devfreq_cooling_power *dfc_power)
59{
60 return ERR_PTR(-EINVAL);
61}
62
63static inline struct thermal_cooling_device *
64of_devfreq_cooling_register(struct device_node *np, struct devfreq *df)
65{
66 return ERR_PTR(-EINVAL);
67}
68
69static inline struct thermal_cooling_device *
70devfreq_cooling_register(struct devfreq *df)
71{
72 return ERR_PTR(-EINVAL);
73}
74
75static inline void
76devfreq_cooling_unregister(struct thermal_cooling_device *dfc)
77{
78}
79
80#endif /* CONFIG_DEVFREQ_THERMAL */
81#endif /* __DEVFREQ_COOLING_H__ */