Thomas Gleixner | 873e65b | 2019-05-27 08:55:15 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Amit Daniel Kachhap | 0236141 | 2012-08-16 17:11:40 +0530 | [diff] [blame] | 2 | /* |
| 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 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
Amit Daniel Kachhap | 0236141 | 2012-08-16 17:11:40 +0530 | [diff] [blame] | 9 | * |
| 10 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 11 | */ |
| 12 | |
| 13 | #ifndef __CPU_COOLING_H__ |
| 14 | #define __CPU_COOLING_H__ |
| 15 | |
Eduardo Valentin | 39d99cf | 2013-09-12 19:26:45 -0400 | [diff] [blame] | 16 | #include <linux/of.h> |
Amit Daniel Kachhap | 0236141 | 2012-08-16 17:11:40 +0530 | [diff] [blame] | 17 | #include <linux/thermal.h> |
Eduardo Valentin | 198f38f | 2013-04-24 23:10:28 +0800 | [diff] [blame] | 18 | #include <linux/cpumask.h> |
Amit Daniel Kachhap | 0236141 | 2012-08-16 17:11:40 +0530 | [diff] [blame] | 19 | |
Viresh Kumar | 4d753aa | 2017-04-25 15:57:14 +0530 | [diff] [blame] | 20 | struct cpufreq_policy; |
| 21 | |
Daniel Lezcano | 2b586fe | 2019-12-04 16:39:27 +0100 | [diff] [blame] | 22 | #ifdef CONFIG_CPU_FREQ_THERMAL |
Amit Daniel Kachhap | 0236141 | 2012-08-16 17:11:40 +0530 | [diff] [blame] | 23 | /** |
| 24 | * cpufreq_cooling_register - function to create cpufreq cooling device. |
Viresh Kumar | 4d753aa | 2017-04-25 15:57:14 +0530 | [diff] [blame] | 25 | * @policy: cpufreq policy. |
Amit Daniel Kachhap | 0236141 | 2012-08-16 17:11:40 +0530 | [diff] [blame] | 26 | */ |
Eduardo Valentin | d44ada5 | 2013-04-17 17:12:23 +0000 | [diff] [blame] | 27 | struct thermal_cooling_device * |
Viresh Kumar | 4d753aa | 2017-04-25 15:57:14 +0530 | [diff] [blame] | 28 | cpufreq_cooling_register(struct cpufreq_policy *policy); |
Amit Daniel Kachhap | 0236141 | 2012-08-16 17:11:40 +0530 | [diff] [blame] | 29 | |
| 30 | /** |
| 31 | * cpufreq_cooling_unregister - function to remove cpufreq cooling device. |
| 32 | * @cdev: thermal cooling device pointer. |
| 33 | */ |
| 34 | void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev); |
Zhang Rui | 57df810 | 2013-02-08 14:52:06 +0800 | [diff] [blame] | 35 | |
Daniel Lezcano | 0cac755 | 2019-10-30 10:10:37 +0100 | [diff] [blame] | 36 | /** |
| 37 | * of_cpufreq_cooling_register - create cpufreq cooling device based on DT. |
| 38 | * @policy: cpufreq policy. |
| 39 | */ |
| 40 | struct thermal_cooling_device * |
| 41 | of_cpufreq_cooling_register(struct cpufreq_policy *policy); |
| 42 | |
Daniel Lezcano | 2b586fe | 2019-12-04 16:39:27 +0100 | [diff] [blame] | 43 | #else /* !CONFIG_CPU_FREQ_THERMAL */ |
Eduardo Valentin | d44ada5 | 2013-04-17 17:12:23 +0000 | [diff] [blame] | 44 | static inline struct thermal_cooling_device * |
Viresh Kumar | 4d753aa | 2017-04-25 15:57:14 +0530 | [diff] [blame] | 45 | cpufreq_cooling_register(struct cpufreq_policy *policy) |
Amit Daniel Kachhap | 0236141 | 2012-08-16 17:11:40 +0530 | [diff] [blame] | 46 | { |
Javi Merino | 503ccc3f | 2014-12-17 11:11:24 +0000 | [diff] [blame] | 47 | return ERR_PTR(-ENOSYS); |
Amit Daniel Kachhap | 0236141 | 2012-08-16 17:11:40 +0530 | [diff] [blame] | 48 | } |
Javi Merino | c36cf07 | 2015-02-26 19:00:29 +0000 | [diff] [blame] | 49 | |
Eduardo Valentin | d44ada5 | 2013-04-17 17:12:23 +0000 | [diff] [blame] | 50 | static inline |
| 51 | void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev) |
Amit Daniel Kachhap | 0236141 | 2012-08-16 17:11:40 +0530 | [diff] [blame] | 52 | { |
| 53 | return; |
| 54 | } |
Amit Daniel Kachhap | 0236141 | 2012-08-16 17:11:40 +0530 | [diff] [blame] | 55 | |
Viresh Kumar | 3ebb62f | 2017-12-05 11:02:45 +0530 | [diff] [blame] | 56 | static inline struct thermal_cooling_device * |
| 57 | of_cpufreq_cooling_register(struct cpufreq_policy *policy) |
| 58 | { |
| 59 | return NULL; |
| 60 | } |
Daniel Lezcano | 2b586fe | 2019-12-04 16:39:27 +0100 | [diff] [blame] | 61 | #endif /* CONFIG_CPU_FREQ_THERMAL */ |
Viresh Kumar | 3ebb62f | 2017-12-05 11:02:45 +0530 | [diff] [blame] | 62 | |
Daniel Lezcano | a4c428e | 2019-12-19 23:53:16 +0100 | [diff] [blame] | 63 | struct cpuidle_driver; |
| 64 | |
| 65 | #ifdef CONFIG_CPU_IDLE_THERMAL |
| 66 | int cpuidle_cooling_register(struct cpuidle_driver *drv); |
| 67 | int cpuidle_of_cooling_register(struct device_node *np, |
| 68 | struct cpuidle_driver *drv); |
| 69 | #else /* CONFIG_CPU_IDLE_THERMAL */ |
| 70 | static inline int cpuidle_cooling_register(struct cpuidle_driver *drv) |
| 71 | { |
| 72 | return 0; |
| 73 | } |
| 74 | static inline int cpuidle_of_cooling_register(struct device_node *np, |
| 75 | struct cpuidle_driver *drv) |
| 76 | { |
| 77 | return 0; |
| 78 | } |
| 79 | #endif /* CONFIG_CPU_IDLE_THERMAL */ |
| 80 | |
Amit Daniel Kachhap | 0236141 | 2012-08-16 17:11:40 +0530 | [diff] [blame] | 81 | #endif /* __CPU_COOLING_H__ */ |