xref: /linux-6.15/include/linux/cpu_cooling.h (revision 7f36688f)
1873e65bcSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
202361418SAmit Daniel Kachhap /*
302361418SAmit Daniel Kachhap  *  linux/include/linux/cpu_cooling.h
402361418SAmit Daniel Kachhap  *
502361418SAmit Daniel Kachhap  *  Copyright (C) 2012	Samsung Electronics Co., Ltd(http://www.samsung.com)
602361418SAmit Daniel Kachhap  *  Copyright (C) 2012  Amit Daniel <[email protected]>
702361418SAmit Daniel Kachhap  *
802361418SAmit Daniel Kachhap  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
902361418SAmit Daniel Kachhap  *
1002361418SAmit Daniel Kachhap  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1102361418SAmit Daniel Kachhap  */
1202361418SAmit Daniel Kachhap 
1302361418SAmit Daniel Kachhap #ifndef __CPU_COOLING_H__
1402361418SAmit Daniel Kachhap #define __CPU_COOLING_H__
1502361418SAmit Daniel Kachhap 
1639d99cffSEduardo Valentin #include <linux/of.h>
1702361418SAmit Daniel Kachhap #include <linux/thermal.h>
1802361418SAmit Daniel Kachhap 
194d753aa7SViresh Kumar struct cpufreq_policy;
204d753aa7SViresh Kumar 
212b586feaSDaniel Lezcano #ifdef CONFIG_CPU_FREQ_THERMAL
2202361418SAmit Daniel Kachhap /**
2302361418SAmit Daniel Kachhap  * cpufreq_cooling_register - function to create cpufreq cooling device.
244d753aa7SViresh Kumar  * @policy: cpufreq policy.
2502361418SAmit Daniel Kachhap  */
26d44ada51SEduardo Valentin struct thermal_cooling_device *
274d753aa7SViresh Kumar cpufreq_cooling_register(struct cpufreq_policy *policy);
2802361418SAmit Daniel Kachhap 
2902361418SAmit Daniel Kachhap /**
3002361418SAmit Daniel Kachhap  * cpufreq_cooling_unregister - function to remove cpufreq cooling device.
3102361418SAmit Daniel Kachhap  * @cdev: thermal cooling device pointer.
3202361418SAmit Daniel Kachhap  */
3302361418SAmit Daniel Kachhap void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev);
3457df8106SZhang Rui 
350cac7559SDaniel Lezcano /**
360cac7559SDaniel Lezcano  * of_cpufreq_cooling_register - create cpufreq cooling device based on DT.
370cac7559SDaniel Lezcano  * @policy: cpufreq policy.
380cac7559SDaniel Lezcano  */
390cac7559SDaniel Lezcano struct thermal_cooling_device *
400cac7559SDaniel Lezcano of_cpufreq_cooling_register(struct cpufreq_policy *policy);
410cac7559SDaniel Lezcano 
422b586feaSDaniel Lezcano #else /* !CONFIG_CPU_FREQ_THERMAL */
43d44ada51SEduardo Valentin static inline struct thermal_cooling_device *
cpufreq_cooling_register(struct cpufreq_policy * policy)444d753aa7SViresh Kumar cpufreq_cooling_register(struct cpufreq_policy *policy)
4502361418SAmit Daniel Kachhap {
46503ccc3fSJavi Merino 	return ERR_PTR(-ENOSYS);
4702361418SAmit Daniel Kachhap }
48c36cf071SJavi Merino 
49d44ada51SEduardo Valentin static inline
cpufreq_cooling_unregister(struct thermal_cooling_device * cdev)50d44ada51SEduardo Valentin void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)
5102361418SAmit Daniel Kachhap {
5202361418SAmit Daniel Kachhap 	return;
5302361418SAmit Daniel Kachhap }
5402361418SAmit Daniel Kachhap 
553ebb62ffSViresh Kumar static inline struct thermal_cooling_device *
of_cpufreq_cooling_register(struct cpufreq_policy * policy)563ebb62ffSViresh Kumar of_cpufreq_cooling_register(struct cpufreq_policy *policy)
573ebb62ffSViresh Kumar {
583ebb62ffSViresh Kumar 	return NULL;
593ebb62ffSViresh Kumar }
602b586feaSDaniel Lezcano #endif /* CONFIG_CPU_FREQ_THERMAL */
613ebb62ffSViresh Kumar 
62a4c428e5SDaniel Lezcano struct cpuidle_driver;
63a4c428e5SDaniel Lezcano 
64a4c428e5SDaniel Lezcano #ifdef CONFIG_CPU_IDLE_THERMAL
65*dfd0bda3SDaniel Lezcano void cpuidle_cooling_register(struct cpuidle_driver *drv);
66a4c428e5SDaniel Lezcano #else /* CONFIG_CPU_IDLE_THERMAL */
cpuidle_cooling_register(struct cpuidle_driver * drv)67*dfd0bda3SDaniel Lezcano static inline void cpuidle_cooling_register(struct cpuidle_driver *drv)
68a4c428e5SDaniel Lezcano {
69a4c428e5SDaniel Lezcano }
70a4c428e5SDaniel Lezcano #endif /* CONFIG_CPU_IDLE_THERMAL */
71a4c428e5SDaniel Lezcano 
7202361418SAmit Daniel Kachhap #endif /* __CPU_COOLING_H__ */
73