Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[cris-mirror.git] / include / linux / devfreq_cooling.h
blob7adf6cc4b305d93fc5510b433b025165df4adf62
1 /*
2 * devfreq_cooling: Thermal cooling device implementation for devices using
3 * devfreq
5 * Copyright (C) 2014-2015 ARM Limited
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.
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.
17 #ifndef __DEVFREQ_COOLING_H__
18 #define __DEVFREQ_COOLING_H__
20 #include <linux/devfreq.h>
21 #include <linux/thermal.h>
23 #ifdef CONFIG_DEVFREQ_THERMAL
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
39 struct 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;
46 struct thermal_cooling_device *
47 of_devfreq_cooling_register_power(struct device_node *np, struct devfreq *df,
48 struct devfreq_cooling_power *dfc_power);
49 struct thermal_cooling_device *
50 of_devfreq_cooling_register(struct device_node *np, struct devfreq *df);
51 struct thermal_cooling_device *devfreq_cooling_register(struct devfreq *df);
52 void devfreq_cooling_unregister(struct thermal_cooling_device *dfc);
54 #else /* !CONFIG_DEVFREQ_THERMAL */
56 struct thermal_cooling_device *
57 of_devfreq_cooling_register_power(struct device_node *np, struct devfreq *df,
58 struct devfreq_cooling_power *dfc_power)
60 return ERR_PTR(-EINVAL);
63 static inline struct thermal_cooling_device *
64 of_devfreq_cooling_register(struct device_node *np, struct devfreq *df)
66 return ERR_PTR(-EINVAL);
69 static inline struct thermal_cooling_device *
70 devfreq_cooling_register(struct devfreq *df)
72 return ERR_PTR(-EINVAL);
75 static inline void
76 devfreq_cooling_unregister(struct thermal_cooling_device *dfc)
80 #endif /* CONFIG_DEVFREQ_THERMAL */
81 #endif /* __DEVFREQ_COOLING_H__ */