]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - include/linux/cpu_cooling.h
ACPI: fix acpi_find_child_device() invocation in acpi_preset_companion()
[mirror_ubuntu-bionic-kernel.git] / include / linux / cpu_cooling.h
CommitLineData
02361418
ADK
1/*
2 * linux/include/linux/cpu_cooling.h
3 *
4 * Copyright (C) 2012 Samsung Electronics Co., Ltd(http://www.samsung.com)
5 * Copyright (C) 2012 Amit Daniel <amit.kachhap@linaro.org>
6 *
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.
11 *
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.
16 *
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.
20 *
21 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22 */
23
24#ifndef __CPU_COOLING_H__
25#define __CPU_COOLING_H__
26
39d99cff 27#include <linux/of.h>
02361418 28#include <linux/thermal.h>
198f38f7 29#include <linux/cpumask.h>
02361418 30
4d753aa7
VK
31struct cpufreq_policy;
32
c36cf071
JM
33typedef int (*get_static_t)(cpumask_t *cpumask, int interval,
34 unsigned long voltage, u32 *power);
35
bbf7fc88 36#ifdef CONFIG_CPU_THERMAL
02361418
ADK
37/**
38 * cpufreq_cooling_register - function to create cpufreq cooling device.
4d753aa7 39 * @policy: cpufreq policy.
02361418 40 */
d44ada51 41struct thermal_cooling_device *
4d753aa7 42cpufreq_cooling_register(struct cpufreq_policy *policy);
02361418 43
c36cf071 44struct thermal_cooling_device *
4d753aa7 45cpufreq_power_cooling_register(struct cpufreq_policy *policy,
c36cf071
JM
46 u32 capacitance, get_static_t plat_static_func);
47
39d99cff
EV
48/**
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.
4d753aa7 51 * @policy: cpufreq policy.
39d99cff
EV
52 */
53#ifdef CONFIG_THERMAL_OF
54struct thermal_cooling_device *
55of_cpufreq_cooling_register(struct device_node *np,
4d753aa7 56 struct cpufreq_policy *policy);
c36cf071
JM
57
58struct thermal_cooling_device *
59of_cpufreq_power_cooling_register(struct device_node *np,
4d753aa7 60 struct cpufreq_policy *policy,
c36cf071
JM
61 u32 capacitance,
62 get_static_t plat_static_func);
39d99cff
EV
63#else
64static inline struct thermal_cooling_device *
65of_cpufreq_cooling_register(struct device_node *np,
4d753aa7 66 struct cpufreq_policy *policy)
39d99cff 67{
503ccc3f 68 return ERR_PTR(-ENOSYS);
39d99cff 69}
c36cf071
JM
70
71static inline struct thermal_cooling_device *
72of_cpufreq_power_cooling_register(struct device_node *np,
4d753aa7 73 struct cpufreq_policy *policy,
c36cf071
JM
74 u32 capacitance,
75 get_static_t plat_static_func)
76{
77 return NULL;
78}
39d99cff
EV
79#endif
80
02361418
ADK
81/**
82 * cpufreq_cooling_unregister - function to remove cpufreq cooling device.
83 * @cdev: thermal cooling device pointer.
84 */
85void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev);
57df8106 86
02361418 87#else /* !CONFIG_CPU_THERMAL */
d44ada51 88static inline struct thermal_cooling_device *
4d753aa7 89cpufreq_cooling_register(struct cpufreq_policy *policy)
02361418 90{
503ccc3f 91 return ERR_PTR(-ENOSYS);
02361418 92}
c36cf071 93static inline struct thermal_cooling_device *
4d753aa7 94cpufreq_power_cooling_register(struct cpufreq_policy *policy,
c36cf071
JM
95 u32 capacitance, get_static_t plat_static_func)
96{
97 return NULL;
98}
99
39d99cff
EV
100static inline struct thermal_cooling_device *
101of_cpufreq_cooling_register(struct device_node *np,
4d753aa7 102 struct cpufreq_policy *policy)
39d99cff 103{
503ccc3f 104 return ERR_PTR(-ENOSYS);
39d99cff 105}
c36cf071
JM
106
107static inline struct thermal_cooling_device *
108of_cpufreq_power_cooling_register(struct device_node *np,
4d753aa7 109 struct cpufreq_policy *policy,
c36cf071
JM
110 u32 capacitance,
111 get_static_t plat_static_func)
112{
113 return NULL;
114}
115
d44ada51
EV
116static inline
117void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)
02361418
ADK
118{
119 return;
120}
121#endif /* CONFIG_CPU_THERMAL */
122
123#endif /* __CPU_COOLING_H__ */