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
31typedef int (*get_static_t)(cpumask_t *cpumask, int interval,
32 unsigned long voltage, u32 *power);
33
34#ifdef CONFIG_CPU_THERMAL
35
36
37
38
39struct thermal_cooling_device *
40cpufreq_cooling_register(const struct cpumask *clip_cpus);
41
42struct thermal_cooling_device *
43cpufreq_power_cooling_register(const struct cpumask *clip_cpus,
44 u32 capacitance, get_static_t plat_static_func);
45
46
47
48
49
50
51#ifdef CONFIG_THERMAL_OF
52struct thermal_cooling_device *
53of_cpufreq_cooling_register(struct device_node *np,
54 const struct cpumask *clip_cpus);
55
56struct thermal_cooling_device *
57of_cpufreq_power_cooling_register(struct device_node *np,
58 const struct cpumask *clip_cpus,
59 u32 capacitance,
60 get_static_t plat_static_func);
61#else
62static inline struct thermal_cooling_device *
63of_cpufreq_cooling_register(struct device_node *np,
64 const struct cpumask *clip_cpus)
65{
66 return ERR_PTR(-ENOSYS);
67}
68
69static inline struct thermal_cooling_device *
70of_cpufreq_power_cooling_register(struct device_node *np,
71 const struct cpumask *clip_cpus,
72 u32 capacitance,
73 get_static_t plat_static_func)
74{
75 return NULL;
76}
77#endif
78
79
80
81
82
83void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev);
84
85unsigned long cpufreq_cooling_get_level(unsigned int cpu, unsigned int freq);
86#else
87static inline struct thermal_cooling_device *
88cpufreq_cooling_register(const struct cpumask *clip_cpus)
89{
90 return ERR_PTR(-ENOSYS);
91}
92static inline struct thermal_cooling_device *
93cpufreq_power_cooling_register(const struct cpumask *clip_cpus,
94 u32 capacitance, get_static_t plat_static_func)
95{
96 return NULL;
97}
98
99static inline struct thermal_cooling_device *
100of_cpufreq_cooling_register(struct device_node *np,
101 const struct cpumask *clip_cpus)
102{
103 return ERR_PTR(-ENOSYS);
104}
105
106static inline struct thermal_cooling_device *
107of_cpufreq_power_cooling_register(struct device_node *np,
108 const struct cpumask *clip_cpus,
109 u32 capacitance,
110 get_static_t plat_static_func)
111{
112 return NULL;
113}
114
115static inline
116void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)
117{
118 return;
119}
120static inline
121unsigned long cpufreq_cooling_get_level(unsigned int cpu, unsigned int freq)
122{
123 return THERMAL_CSTATE_INVALID;
124}
125#endif
126
127#endif
128