]>
git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - include/linux/cpu_cooling.h
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 #ifdef CONFIG_CPU_THERMAL
33 * cpufreq_cooling_register - function to create cpufreq cooling device.
34 * @clip_cpus: cpumask of cpus where the frequency constraints will happen
36 struct thermal_cooling_device
*
37 cpufreq_cooling_register(const struct cpumask
*clip_cpus
);
40 * of_cpufreq_cooling_register - create cpufreq cooling device based on DT.
41 * @np: a valid struct device_node to the cooling device device tree node.
42 * @clip_cpus: cpumask of cpus where the frequency constraints will happen
44 #ifdef CONFIG_THERMAL_OF
45 struct thermal_cooling_device
*
46 of_cpufreq_cooling_register(struct device_node
*np
,
47 const struct cpumask
*clip_cpus
);
49 static inline struct thermal_cooling_device
*
50 of_cpufreq_cooling_register(struct device_node
*np
,
51 const struct cpumask
*clip_cpus
)
53 return ERR_PTR(-ENOSYS
);
58 * cpufreq_cooling_unregister - function to remove cpufreq cooling device.
59 * @cdev: thermal cooling device pointer.
61 void cpufreq_cooling_unregister(struct thermal_cooling_device
*cdev
);
63 unsigned long cpufreq_cooling_get_level(unsigned int cpu
, unsigned int freq
);
64 #else /* !CONFIG_CPU_THERMAL */
65 static inline struct thermal_cooling_device
*
66 cpufreq_cooling_register(const struct cpumask
*clip_cpus
)
68 return ERR_PTR(-ENOSYS
);
70 static inline struct thermal_cooling_device
*
71 of_cpufreq_cooling_register(struct device_node
*np
,
72 const struct cpumask
*clip_cpus
)
74 return ERR_PTR(-ENOSYS
);
77 void cpufreq_cooling_unregister(struct thermal_cooling_device
*cdev
)
82 unsigned long cpufreq_cooling_get_level(unsigned int cpu
, unsigned int freq
)
84 return THERMAL_CSTATE_INVALID
;
86 #endif /* CONFIG_CPU_THERMAL */
88 #endif /* __CPU_COOLING_H__ */