1 /*
2  *  linux/include/linux/clock_cooling.h
3  *
4  *  Copyright (C) 2014 Eduardo Valentin <edubezval@gmail.com>
5  *
6  *  Copyright (C) 2013	Texas Instruments Inc.
7  *  Contact:  Eduardo Valentin <eduardo.valentin@ti.com>
8  *
9  *  Highly based on cpu_cooling.c.
10  *  Copyright (C) 2012	Samsung Electronics Co., Ltd(http://www.samsung.com)
11  *  Copyright (C) 2012  Amit Daniel <amit.kachhap@linaro.org>
12  *
13  *  This program is free software; you can redistribute it and/or modify
14  *  it under the terms of the GNU General Public License as published by
15  *  the Free Software Foundation; version 2 of the License.
16  *
17  *  This program is distributed in the hope that it will be useful, but
18  *  WITHOUT ANY WARRANTY; without even the implied warranty of
19  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20  *  General Public License for more details.
21  */
22 
23 #ifndef __CPU_COOLING_H__
24 #define __CPU_COOLING_H__
25 
26 #include <linux/of.h>
27 #include <linux/thermal.h>
28 #include <linux/cpumask.h>
29 
30 #ifdef CONFIG_CLOCK_THERMAL
31 /**
32  * clock_cooling_register - function to create clock cooling device.
33  * @dev: struct device pointer to the device used as clock cooling device.
34  * @clock_name: string containing the clock used as cooling mechanism.
35  */
36 struct thermal_cooling_device *
37 clock_cooling_register(struct device *dev, const char *clock_name);
38 
39 /**
40  * clock_cooling_unregister - function to remove clock cooling device.
41  * @cdev: thermal cooling device pointer.
42  */
43 void clock_cooling_unregister(struct thermal_cooling_device *cdev);
44 
45 unsigned long clock_cooling_get_level(struct thermal_cooling_device *cdev,
46 				      unsigned long freq);
47 #else /* !CONFIG_CLOCK_THERMAL */
48 static inline struct thermal_cooling_device *
clock_cooling_register(struct device * dev,const char * clock_name)49 clock_cooling_register(struct device *dev, const char *clock_name)
50 {
51 	return NULL;
52 }
53 static inline
clock_cooling_unregister(struct thermal_cooling_device * cdev)54 void clock_cooling_unregister(struct thermal_cooling_device *cdev)
55 {
56 }
57 static inline
clock_cooling_get_level(struct thermal_cooling_device * cdev,unsigned long freq)58 unsigned long clock_cooling_get_level(struct thermal_cooling_device *cdev,
59 				      unsigned long freq)
60 {
61 	return THERMAL_CSTATE_INVALID;
62 }
63 #endif	/* CONFIG_CLOCK_THERMAL */
64 
65 #endif /* __CPU_COOLING_H__ */
66