1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  *  linux/include/linux/clock_cooling.h
4  *
5  *  Copyright (C) 2014 Eduardo Valentin <edubezval@gmail.com>
6  *
7  *  Copyright (C) 2013	Texas Instruments Inc.
8  *  Contact:  Eduardo Valentin <eduardo.valentin@ti.com>
9  *
10  *  Highly based on cpu_cooling.c.
11  *  Copyright (C) 2012	Samsung Electronics Co., Ltd(http://www.samsung.com)
12  *  Copyright (C) 2012  Amit Daniel <amit.kachhap@linaro.org>
13  */
14 
15 #ifndef __CPU_COOLING_H__
16 #define __CPU_COOLING_H__
17 
18 #include <linux/of.h>
19 #include <linux/thermal.h>
20 #include <linux/cpumask.h>
21 
22 #ifdef CONFIG_CLOCK_THERMAL
23 /**
24  * clock_cooling_register - function to create clock cooling device.
25  * @dev: struct device pointer to the device used as clock cooling device.
26  * @clock_name: string containing the clock used as cooling mechanism.
27  */
28 struct thermal_cooling_device *
29 clock_cooling_register(struct device *dev, const char *clock_name);
30 
31 /**
32  * clock_cooling_unregister - function to remove clock cooling device.
33  * @cdev: thermal cooling device pointer.
34  */
35 void clock_cooling_unregister(struct thermal_cooling_device *cdev);
36 
37 unsigned long clock_cooling_get_level(struct thermal_cooling_device *cdev,
38 				      unsigned long freq);
39 #else /* !CONFIG_CLOCK_THERMAL */
40 static inline struct thermal_cooling_device *
clock_cooling_register(struct device * dev,const char * clock_name)41 clock_cooling_register(struct device *dev, const char *clock_name)
42 {
43 	return NULL;
44 }
45 static inline
clock_cooling_unregister(struct thermal_cooling_device * cdev)46 void clock_cooling_unregister(struct thermal_cooling_device *cdev)
47 {
48 }
49 static inline
clock_cooling_get_level(struct thermal_cooling_device * cdev,unsigned long freq)50 unsigned long clock_cooling_get_level(struct thermal_cooling_device *cdev,
51 				      unsigned long freq)
52 {
53 	return THERMAL_CSTATE_INVALID;
54 }
55 #endif	/* CONFIG_CLOCK_THERMAL */
56 
57 #endif /* __CPU_COOLING_H__ */
58