Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  *  linux/include/linux/cpu_cooling.h
0004  *
0005  *  Copyright (C) 2012  Samsung Electronics Co., Ltd(http://www.samsung.com)
0006  *  Copyright (C) 2012  Amit Daniel <amit.kachhap@linaro.org>
0007  *
0008  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0009  *
0010  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0011  */
0012 
0013 #ifndef __CPU_COOLING_H__
0014 #define __CPU_COOLING_H__
0015 
0016 #include <linux/of.h>
0017 #include <linux/thermal.h>
0018 #include <linux/cpumask.h>
0019 
0020 struct cpufreq_policy;
0021 
0022 #ifdef CONFIG_CPU_FREQ_THERMAL
0023 /**
0024  * cpufreq_cooling_register - function to create cpufreq cooling device.
0025  * @policy: cpufreq policy.
0026  */
0027 struct thermal_cooling_device *
0028 cpufreq_cooling_register(struct cpufreq_policy *policy);
0029 
0030 /**
0031  * cpufreq_cooling_unregister - function to remove cpufreq cooling device.
0032  * @cdev: thermal cooling device pointer.
0033  */
0034 void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev);
0035 
0036 /**
0037  * of_cpufreq_cooling_register - create cpufreq cooling device based on DT.
0038  * @policy: cpufreq policy.
0039  */
0040 struct thermal_cooling_device *
0041 of_cpufreq_cooling_register(struct cpufreq_policy *policy);
0042 
0043 #else /* !CONFIG_CPU_FREQ_THERMAL */
0044 static inline struct thermal_cooling_device *
0045 cpufreq_cooling_register(struct cpufreq_policy *policy)
0046 {
0047     return ERR_PTR(-ENOSYS);
0048 }
0049 
0050 static inline
0051 void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)
0052 {
0053     return;
0054 }
0055 
0056 static inline struct thermal_cooling_device *
0057 of_cpufreq_cooling_register(struct cpufreq_policy *policy)
0058 {
0059     return NULL;
0060 }
0061 #endif /* CONFIG_CPU_FREQ_THERMAL */
0062 
0063 struct cpuidle_driver;
0064 
0065 #ifdef CONFIG_CPU_IDLE_THERMAL
0066 void cpuidle_cooling_register(struct cpuidle_driver *drv);
0067 #else /* CONFIG_CPU_IDLE_THERMAL */
0068 static inline void cpuidle_cooling_register(struct cpuidle_driver *drv)
0069 {
0070 }
0071 #endif /* CONFIG_CPU_IDLE_THERMAL */
0072 
0073 #endif /* __CPU_COOLING_H__ */