| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * linux/include/linux/cpu_cooling.h |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 5 | 6 | * Copyright (C) 2012 Amit Daniel <amit.kachhap@linaro.org> |
|---|
| 6 | 7 | * |
|---|
| 7 | 8 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 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 | 9 | * |
|---|
| 21 | 10 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 22 | 11 | */ |
|---|
| .. | .. |
|---|
| 30 | 19 | |
|---|
| 31 | 20 | struct cpufreq_policy; |
|---|
| 32 | 21 | |
|---|
| 33 | | -typedef int (*plat_mitig_t)(int cpu, u32 clip_freq); |
|---|
| 34 | | - |
|---|
| 35 | | -struct cpu_cooling_ops { |
|---|
| 36 | | - plat_mitig_t ceil_limit, floor_limit; |
|---|
| 37 | | -}; |
|---|
| 38 | | - |
|---|
| 39 | | -#ifdef CONFIG_CPU_THERMAL |
|---|
| 22 | +#ifdef CONFIG_CPU_FREQ_THERMAL |
|---|
| 40 | 23 | /** |
|---|
| 41 | 24 | * cpufreq_cooling_register - function to create cpufreq cooling device. |
|---|
| 42 | 25 | * @policy: cpufreq policy. |
|---|
| .. | .. |
|---|
| 44 | 27 | struct thermal_cooling_device * |
|---|
| 45 | 28 | cpufreq_cooling_register(struct cpufreq_policy *policy); |
|---|
| 46 | 29 | |
|---|
| 47 | | -struct thermal_cooling_device * |
|---|
| 48 | | -cpufreq_platform_cooling_register(struct cpufreq_policy *policy, |
|---|
| 49 | | - struct cpu_cooling_ops *ops); |
|---|
| 50 | | - |
|---|
| 51 | 30 | /** |
|---|
| 52 | 31 | * cpufreq_cooling_unregister - function to remove cpufreq cooling device. |
|---|
| 53 | 32 | * @cdev: thermal cooling device pointer. |
|---|
| 54 | 33 | */ |
|---|
| 55 | 34 | void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev); |
|---|
| 56 | 35 | |
|---|
| 57 | | -#else /* !CONFIG_CPU_THERMAL */ |
|---|
| 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 | + |
|---|
| 43 | +#else /* !CONFIG_CPU_FREQ_THERMAL */ |
|---|
| 58 | 44 | static inline struct thermal_cooling_device * |
|---|
| 59 | 45 | cpufreq_cooling_register(struct cpufreq_policy *policy) |
|---|
| 60 | 46 | { |
|---|
| 61 | 47 | return ERR_PTR(-ENOSYS); |
|---|
| 62 | | -} |
|---|
| 63 | | - |
|---|
| 64 | | -static inline struct thermal_cooling_device * |
|---|
| 65 | | -cpufreq_platform_cooling_register(struct cpufreq_policy *policy, |
|---|
| 66 | | - struct cpu_cooling_ops *ops) |
|---|
| 67 | | -{ |
|---|
| 68 | | - return NULL; |
|---|
| 69 | 48 | } |
|---|
| 70 | 49 | |
|---|
| 71 | 50 | static inline |
|---|
| .. | .. |
|---|
| 73 | 52 | { |
|---|
| 74 | 53 | return; |
|---|
| 75 | 54 | } |
|---|
| 76 | | -#endif /* CONFIG_CPU_THERMAL */ |
|---|
| 77 | 55 | |
|---|
| 78 | | -#if defined(CONFIG_THERMAL_OF) && defined(CONFIG_CPU_THERMAL) |
|---|
| 79 | | -/** |
|---|
| 80 | | - * of_cpufreq_cooling_register - create cpufreq cooling device based on DT. |
|---|
| 81 | | - * @policy: cpufreq policy. |
|---|
| 82 | | - */ |
|---|
| 83 | | -struct thermal_cooling_device * |
|---|
| 84 | | -of_cpufreq_cooling_register(struct cpufreq_policy *policy); |
|---|
| 85 | | -#else |
|---|
| 86 | 56 | static inline struct thermal_cooling_device * |
|---|
| 87 | 57 | of_cpufreq_cooling_register(struct cpufreq_policy *policy) |
|---|
| 88 | 58 | { |
|---|
| 89 | 59 | return NULL; |
|---|
| 90 | 60 | } |
|---|
| 91 | | -#endif /* defined(CONFIG_THERMAL_OF) && defined(CONFIG_CPU_THERMAL) */ |
|---|
| 61 | +#endif /* CONFIG_CPU_FREQ_THERMAL */ |
|---|
| 62 | + |
|---|
| 63 | +struct cpuidle_driver; |
|---|
| 64 | + |
|---|
| 65 | +#ifdef CONFIG_CPU_IDLE_THERMAL |
|---|
| 66 | +void cpuidle_cooling_register(struct cpuidle_driver *drv); |
|---|
| 67 | +#else /* CONFIG_CPU_IDLE_THERMAL */ |
|---|
| 68 | +static inline void cpuidle_cooling_register(struct cpuidle_driver *drv) |
|---|
| 69 | +{ |
|---|
| 70 | +} |
|---|
| 71 | +#endif /* CONFIG_CPU_IDLE_THERMAL */ |
|---|
| 92 | 72 | |
|---|
| 93 | 73 | #endif /* __CPU_COOLING_H__ */ |
|---|