blob: bae54bb7c048c5a87a8a038ba632253c1be3cc5b [file] [log] [blame]
David Brazdil0f672f62019-12-10 10:32:29 +00001/* SPDX-License-Identifier: GPL-2.0-only */
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002/*
3 * linux/include/linux/cpu_cooling.h
4 *
5 * Copyright (C) 2012 Samsung Electronics Co., Ltd(http://www.samsung.com)
6 * Copyright (C) 2012 Amit Daniel <amit.kachhap@linaro.org>
7 *
8 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00009 *
10 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11 */
12
13#ifndef __CPU_COOLING_H__
14#define __CPU_COOLING_H__
15
16#include <linux/of.h>
17#include <linux/thermal.h>
18#include <linux/cpumask.h>
19
20struct cpufreq_policy;
21
22#ifdef CONFIG_CPU_THERMAL
23/**
24 * cpufreq_cooling_register - function to create cpufreq cooling device.
25 * @policy: cpufreq policy.
26 */
27struct thermal_cooling_device *
28cpufreq_cooling_register(struct cpufreq_policy *policy);
29
30/**
31 * cpufreq_cooling_unregister - function to remove cpufreq cooling device.
32 * @cdev: thermal cooling device pointer.
33 */
34void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev);
35
36#else /* !CONFIG_CPU_THERMAL */
37static inline struct thermal_cooling_device *
38cpufreq_cooling_register(struct cpufreq_policy *policy)
39{
40 return ERR_PTR(-ENOSYS);
41}
42
43static inline
44void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)
45{
46 return;
47}
48#endif /* CONFIG_CPU_THERMAL */
49
50#if defined(CONFIG_THERMAL_OF) && defined(CONFIG_CPU_THERMAL)
51/**
52 * of_cpufreq_cooling_register - create cpufreq cooling device based on DT.
53 * @policy: cpufreq policy.
54 */
55struct thermal_cooling_device *
56of_cpufreq_cooling_register(struct cpufreq_policy *policy);
57#else
58static inline struct thermal_cooling_device *
59of_cpufreq_cooling_register(struct cpufreq_policy *policy)
60{
61 return NULL;
62}
63#endif /* defined(CONFIG_THERMAL_OF) && defined(CONFIG_CPU_THERMAL) */
64
65#endif /* __CPU_COOLING_H__ */