2 * linux/include/linux/cpu_cooling.h
4 * Copyright (C) 2012 Samsung Electronics Co., Ltd(http://www.samsung.com)
5 * Copyright (C) 2012 Amit Daniel <amit.kachhap@linaro.org>
7 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
21 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
24 #ifndef __CPU_COOLING_H__
25 #define __CPU_COOLING_H__
28 #include <linux/thermal.h>
29 #include <linux/cpumask.h>
31 struct cpufreq_policy
;
33 typedef int (*get_static_t
)(cpumask_t
*cpumask
, int interval
,
34 unsigned long voltage
, u32
*power
);
36 #ifdef CONFIG_CPU_THERMAL
38 * cpufreq_cooling_register - function to create cpufreq cooling device.
39 * @policy: cpufreq policy.
41 struct thermal_cooling_device
*
42 cpufreq_cooling_register(struct cpufreq_policy
*policy
);
44 struct thermal_cooling_device
*
45 cpufreq_power_cooling_register(struct cpufreq_policy
*policy
,
46 u32 capacitance
, get_static_t plat_static_func
);
49 * of_cpufreq_cooling_register - create cpufreq cooling device based on DT.
50 * @np: a valid struct device_node to the cooling device device tree node.
51 * @policy: cpufreq policy.
53 #ifdef CONFIG_THERMAL_OF
54 struct thermal_cooling_device
*
55 of_cpufreq_cooling_register(struct device_node
*np
,
56 struct cpufreq_policy
*policy
);
58 struct thermal_cooling_device
*
59 of_cpufreq_power_cooling_register(struct device_node
*np
,
60 struct cpufreq_policy
*policy
,
62 get_static_t plat_static_func
);
64 static inline struct thermal_cooling_device
*
65 of_cpufreq_cooling_register(struct device_node
*np
,
66 struct cpufreq_policy
*policy
)
68 return ERR_PTR(-ENOSYS
);
71 static inline struct thermal_cooling_device
*
72 of_cpufreq_power_cooling_register(struct device_node
*np
,
73 struct cpufreq_policy
*policy
,
75 get_static_t plat_static_func
)
82 * cpufreq_cooling_unregister - function to remove cpufreq cooling device.
83 * @cdev: thermal cooling device pointer.
85 void cpufreq_cooling_unregister(struct thermal_cooling_device
*cdev
);
87 #else /* !CONFIG_CPU_THERMAL */
88 static inline struct thermal_cooling_device
*
89 cpufreq_cooling_register(struct cpufreq_policy
*policy
)
91 return ERR_PTR(-ENOSYS
);
93 static inline struct thermal_cooling_device
*
94 cpufreq_power_cooling_register(struct cpufreq_policy
*policy
,
95 u32 capacitance
, get_static_t plat_static_func
)
100 static inline struct thermal_cooling_device
*
101 of_cpufreq_cooling_register(struct device_node
*np
,
102 struct cpufreq_policy
*policy
)
104 return ERR_PTR(-ENOSYS
);
107 static inline struct thermal_cooling_device
*
108 of_cpufreq_power_cooling_register(struct device_node
*np
,
109 struct cpufreq_policy
*policy
,
111 get_static_t plat_static_func
)
117 void cpufreq_cooling_unregister(struct thermal_cooling_device
*cdev
)
121 #endif /* CONFIG_CPU_THERMAL */
123 #endif /* __CPU_COOLING_H__ */