blob: a3bdc8a98f2c41b483f1996c030882b3cfb3f289 [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
Olivier Deprez157378f2022-04-04 15:47:50 +020022#ifdef CONFIG_CPU_FREQ_THERMAL
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000023/**
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
Olivier Deprez157378f2022-04-04 15:47:50 +020036/**
37 * of_cpufreq_cooling_register - create cpufreq cooling device based on DT.
38 * @policy: cpufreq policy.
39 */
40struct thermal_cooling_device *
41of_cpufreq_cooling_register(struct cpufreq_policy *policy);
42
43#else /* !CONFIG_CPU_FREQ_THERMAL */
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000044static inline struct thermal_cooling_device *
45cpufreq_cooling_register(struct cpufreq_policy *policy)
46{
47 return ERR_PTR(-ENOSYS);
48}
49
50static inline
51void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)
52{
53 return;
54}
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000055
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000056static inline struct thermal_cooling_device *
57of_cpufreq_cooling_register(struct cpufreq_policy *policy)
58{
59 return NULL;
60}
Olivier Deprez157378f2022-04-04 15:47:50 +020061#endif /* CONFIG_CPU_FREQ_THERMAL */
62
63struct cpuidle_driver;
64
65#ifdef CONFIG_CPU_IDLE_THERMAL
66void cpuidle_cooling_register(struct cpuidle_driver *drv);
67#else /* CONFIG_CPU_IDLE_THERMAL */
68static inline void cpuidle_cooling_register(struct cpuidle_driver *drv)
69{
70}
71#endif /* CONFIG_CPU_IDLE_THERMAL */
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000072
73#endif /* __CPU_COOLING_H__ */