1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24#ifndef __CPU_COOLING_H__
25#define __CPU_COOLING_H__
26
27#include <linux/of.h>
28#include <linux/thermal.h>
29#include <linux/cpumask.h>
30
31struct cpufreq_policy;
32
33typedef int (*get_static_t)(cpumask_t *cpumask, int interval,
34 unsigned long voltage, u32 *power);
35
36#ifdef CONFIG_CPU_THERMAL
37
38
39
40
41struct thermal_cooling_device *
42cpufreq_cooling_register(struct cpufreq_policy *policy);
43
44struct thermal_cooling_device *
45cpufreq_power_cooling_register(struct cpufreq_policy *policy,
46 u32 capacitance, get_static_t plat_static_func);
47
48
49
50
51
52
53#ifdef CONFIG_THERMAL_OF
54struct thermal_cooling_device *
55of_cpufreq_cooling_register(struct device_node *np,
56 struct cpufreq_policy *policy);
57
58struct thermal_cooling_device *
59of_cpufreq_power_cooling_register(struct device_node *np,
60 struct cpufreq_policy *policy,
61 u32 capacitance,
62 get_static_t plat_static_func);
63#else
64static inline struct thermal_cooling_device *
65of_cpufreq_cooling_register(struct device_node *np,
66 struct cpufreq_policy *policy)
67{
68 return ERR_PTR(-ENOSYS);
69}
70
71static inline struct thermal_cooling_device *
72of_cpufreq_power_cooling_register(struct device_node *np,
73 struct cpufreq_policy *policy,
74 u32 capacitance,
75 get_static_t plat_static_func)
76{
77 return NULL;
78}
79#endif
80
81
82
83
84
85void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev);
86
87#else
88static inline struct thermal_cooling_device *
89cpufreq_cooling_register(struct cpufreq_policy *policy)
90{
91 return ERR_PTR(-ENOSYS);
92}
93static inline struct thermal_cooling_device *
94cpufreq_power_cooling_register(struct cpufreq_policy *policy,
95 u32 capacitance, get_static_t plat_static_func)
96{
97 return NULL;
98}
99
100static inline struct thermal_cooling_device *
101of_cpufreq_cooling_register(struct device_node *np,
102 struct cpufreq_policy *policy)
103{
104 return ERR_PTR(-ENOSYS);
105}
106
107static inline struct thermal_cooling_device *
108of_cpufreq_power_cooling_register(struct device_node *np,
109 struct cpufreq_policy *policy,
110 u32 capacitance,
111 get_static_t plat_static_func)
112{
113 return NULL;
114}
115
116static inline
117void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)
118{
119 return;
120}
121#endif
122
123#endif
124