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 | |
Zhang Rui | bbf7fc8 | 2013-03-26 23:57:01 +0800 | [diff] [blame] | 22 | #ifdef CONFIG_CPU_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 | |
Amit Daniel Kachhap | 0236141 | 2012-08-16 17:11:40 +0530 | [diff] [blame] | 36 | #else /* !CONFIG_CPU_THERMAL */ |
Eduardo Valentin | d44ada5 | 2013-04-17 17:12:23 +0000 | [diff] [blame] | 37 | static inline struct thermal_cooling_device * |
Viresh Kumar | 4d753aa | 2017-04-25 15:57:14 +0530 | [diff] [blame] | 38 | cpufreq_cooling_register(struct cpufreq_policy *policy) |
Amit Daniel Kachhap | 0236141 | 2012-08-16 17:11:40 +0530 | [diff] [blame] | 39 | { |
Javi Merino | 503ccc3f | 2014-12-17 11:11:24 +0000 | [diff] [blame] | 40 | return ERR_PTR(-ENOSYS); |
Amit Daniel Kachhap | 0236141 | 2012-08-16 17:11:40 +0530 | [diff] [blame] | 41 | } |
Javi Merino | c36cf07 | 2015-02-26 19:00:29 +0000 | [diff] [blame] | 42 | |
Eduardo Valentin | d44ada5 | 2013-04-17 17:12:23 +0000 | [diff] [blame] | 43 | static inline |
| 44 | void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev) |
Amit Daniel Kachhap | 0236141 | 2012-08-16 17:11:40 +0530 | [diff] [blame] | 45 | { |
| 46 | return; |
| 47 | } |
Amit Daniel Kachhap | 0236141 | 2012-08-16 17:11:40 +0530 | [diff] [blame] | 48 | #endif /* CONFIG_CPU_THERMAL */ |
| 49 | |
Viresh Kumar | 3ebb62f | 2017-12-05 11:02:45 +0530 | [diff] [blame] | 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 | */ |
| 55 | struct thermal_cooling_device * |
| 56 | of_cpufreq_cooling_register(struct cpufreq_policy *policy); |
| 57 | #else |
| 58 | static inline struct thermal_cooling_device * |
| 59 | of_cpufreq_cooling_register(struct cpufreq_policy *policy) |
| 60 | { |
| 61 | return NULL; |
| 62 | } |
| 63 | #endif /* defined(CONFIG_THERMAL_OF) && defined(CONFIG_CPU_THERMAL) */ |
| 64 | |
Amit Daniel Kachhap | 0236141 | 2012-08-16 17:11:40 +0530 | [diff] [blame] | 65 | #endif /* __CPU_COOLING_H__ */ |