1 /* SPDX-License-Identifier: GPL-2.0-only */ << 2 /* 1 /* 3 * linux/include/linux/cpu_cooling.h 2 * linux/include/linux/cpu_cooling.h 4 * 3 * 5 * Copyright (C) 2012 Samsung Electronics Co 4 * Copyright (C) 2012 Samsung Electronics Co., Ltd(http://www.samsung.com) 6 * Copyright (C) 2012 Amit Daniel <amit.kach 5 * Copyright (C) 2012 Amit Daniel <amit.kachhap@linaro.org> 7 * 6 * 8 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 7 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> 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. 9 * 20 * 10 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 21 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 11 */ 22 */ 12 23 13 #ifndef __CPU_COOLING_H__ 24 #ifndef __CPU_COOLING_H__ 14 #define __CPU_COOLING_H__ 25 #define __CPU_COOLING_H__ 15 26 16 #include <linux/of.h> 27 #include <linux/of.h> 17 #include <linux/thermal.h> 28 #include <linux/thermal.h> >> 29 #include <linux/cpumask.h> 18 30 19 struct cpufreq_policy; !! 31 typedef int (*get_static_t)(cpumask_t *cpumask, int interval, >> 32 unsigned long voltage, u32 *power); 20 33 21 #ifdef CONFIG_CPU_FREQ_THERMAL !! 34 #ifdef CONFIG_CPU_THERMAL 22 /** 35 /** 23 * cpufreq_cooling_register - function to crea 36 * cpufreq_cooling_register - function to create cpufreq cooling device. 24 * @policy: cpufreq policy. !! 37 * @clip_cpus: cpumask of cpus where the frequency constraints will happen 25 */ 38 */ 26 struct thermal_cooling_device * 39 struct thermal_cooling_device * 27 cpufreq_cooling_register(struct cpufreq_policy !! 40 cpufreq_cooling_register(const struct cpumask *clip_cpus); 28 41 29 /** !! 42 struct thermal_cooling_device * 30 * cpufreq_cooling_unregister - function to re !! 43 cpufreq_power_cooling_register(const struct cpumask *clip_cpus, 31 * @cdev: thermal cooling device pointer. !! 44 u32 capacitance, get_static_t plat_static_func); 32 */ << 33 void cpufreq_cooling_unregister(struct thermal << 34 45 35 /** 46 /** 36 * of_cpufreq_cooling_register - create cpufre 47 * of_cpufreq_cooling_register - create cpufreq cooling device based on DT. 37 * @policy: cpufreq policy. !! 48 * @np: a valid struct device_node to the cooling device device tree node. >> 49 * @clip_cpus: cpumask of cpus where the frequency constraints will happen 38 */ 50 */ >> 51 #ifdef CONFIG_THERMAL_OF 39 struct thermal_cooling_device * 52 struct thermal_cooling_device * 40 of_cpufreq_cooling_register(struct cpufreq_pol !! 53 of_cpufreq_cooling_register(struct device_node *np, >> 54 const struct cpumask *clip_cpus); 41 55 42 #else /* !CONFIG_CPU_FREQ_THERMAL */ !! 56 struct thermal_cooling_device * >> 57 of_cpufreq_power_cooling_register(struct device_node *np, >> 58 const struct cpumask *clip_cpus, >> 59 u32 capacitance, >> 60 get_static_t plat_static_func); >> 61 #else 43 static inline struct thermal_cooling_device * 62 static inline struct thermal_cooling_device * 44 cpufreq_cooling_register(struct cpufreq_policy !! 63 of_cpufreq_cooling_register(struct device_node *np, >> 64 const struct cpumask *clip_cpus) 45 { 65 { 46 return ERR_PTR(-ENOSYS); 66 return ERR_PTR(-ENOSYS); 47 } 67 } 48 68 49 static inline !! 69 static inline struct thermal_cooling_device * 50 void cpufreq_cooling_unregister(struct thermal !! 70 of_cpufreq_power_cooling_register(struct device_node *np, >> 71 const struct cpumask *clip_cpus, >> 72 u32 capacitance, >> 73 get_static_t plat_static_func) 51 { 74 { 52 return; !! 75 return NULL; 53 } 76 } >> 77 #endif >> 78 >> 79 /** >> 80 * cpufreq_cooling_unregister - function to remove cpufreq cooling device. >> 81 * @cdev: thermal cooling device pointer. >> 82 */ >> 83 void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev); 54 84 >> 85 unsigned long cpufreq_cooling_get_level(unsigned int cpu, unsigned int freq); >> 86 #else /* !CONFIG_CPU_THERMAL */ 55 static inline struct thermal_cooling_device * 87 static inline struct thermal_cooling_device * 56 of_cpufreq_cooling_register(struct cpufreq_pol !! 88 cpufreq_cooling_register(const struct cpumask *clip_cpus) >> 89 { >> 90 return ERR_PTR(-ENOSYS); >> 91 } >> 92 static inline struct thermal_cooling_device * >> 93 cpufreq_power_cooling_register(const struct cpumask *clip_cpus, >> 94 u32 capacitance, get_static_t plat_static_func) 57 { 95 { 58 return NULL; 96 return NULL; 59 } 97 } 60 #endif /* CONFIG_CPU_FREQ_THERMAL */ << 61 98 62 struct cpuidle_driver; !! 99 static inline struct thermal_cooling_device * >> 100 of_cpufreq_cooling_register(struct device_node *np, >> 101 const struct cpumask *clip_cpus) >> 102 { >> 103 return ERR_PTR(-ENOSYS); >> 104 } 63 105 64 #ifdef CONFIG_CPU_IDLE_THERMAL !! 106 static inline struct thermal_cooling_device * 65 void cpuidle_cooling_register(struct cpuidle_d !! 107 of_cpufreq_power_cooling_register(struct device_node *np, 66 #else /* CONFIG_CPU_IDLE_THERMAL */ !! 108 const struct cpumask *clip_cpus, 67 static inline void cpuidle_cooling_register(st !! 109 u32 capacitance, >> 110 get_static_t plat_static_func) >> 111 { >> 112 return NULL; >> 113 } >> 114 >> 115 static inline >> 116 void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev) >> 117 { >> 118 return; >> 119 } >> 120 static inline >> 121 unsigned long cpufreq_cooling_get_level(unsigned int cpu, unsigned int freq) 68 { 122 { >> 123 return THERMAL_CSTATE_INVALID; 69 } 124 } 70 #endif /* CONFIG_CPU_IDLE_THERMAL */ !! 125 #endif /* CONFIG_CPU_THERMAL */ 71 126 72 #endif /* __CPU_COOLING_H__ */ 127 #endif /* __CPU_COOLING_H__ */ 73 128
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.