CHROMIUM: config: Disable USB persist by default
[cascardo/linux.git] / include / linux / cpu_cooling.h
1 /*
2  *  linux/include/linux/cpu_cooling.h
3  *
4  *  Copyright (C) 2012  Samsung Electronics Co., Ltd(http://www.samsung.com)
5  *  Copyright (C) 2012  Amit Daniel <amit.kachhap@linaro.org>
6  *
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.
20  *
21  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22  */
23
24 #ifndef __CPU_COOLING_H__
25 #define __CPU_COOLING_H__
26
27 #include <linux/thermal.h>
28
29 #define CPUFREQ_COOLING_START           0
30 #define CPUFREQ_COOLING_STOP            1
31
32 /**
33  * struct freq_clip_table
34  * @freq_clip_max: maximum frequency allowed for this cooling state.
35  * @temp_level: Temperature level at which the temperature clipping will
36  *      happen.
37  * @mask_val: cpumask of the allowed cpu's where the clipping will take place.
38  *
39  * This structure is required to be filled and passed to the
40  * cpufreq_cooling_unregister function.
41  */
42 struct freq_clip_table {
43         unsigned int freq_clip_max;
44         unsigned int temp_level;
45         const struct cpumask *mask_val;
46 };
47
48 /**
49  * cputherm_register_notifier - Register a notifier with cpu cooling interface.
50  * @nb: struct notifier_block * with callback info.
51  * @list: integer value for which notification is needed. possible values are
52  *      CPUFREQ_COOLING_TYPE and CPUHOTPLUG_COOLING_TYPE.
53  *
54  * This exported function registers a driver with cpu cooling layer. The driver
55  * will be notified when any cpu cooling action is called.
56  */
57 int cputherm_register_notifier(struct notifier_block *nb, unsigned int list);
58
59 /**
60  * cputherm_unregister_notifier - Un-register a notifier.
61  * @nb: struct notifier_block * with callback info.
62  * @list: integer value for which notification is needed. values possible are
63  *      CPUFREQ_COOLING_TYPE.
64  *
65  * This exported function un-registers a driver with cpu cooling layer.
66  */
67 int cputherm_unregister_notifier(struct notifier_block *nb, unsigned int list);
68
69 #ifdef CONFIG_CPU_FREQ
70 /**
71  * cpufreq_cooling_register - function to create cpufreq cooling device.
72  * @tab_ptr: table ptr containing the maximum value of frequency to be clipped
73  *      for each cooling state.
74  * @tab_size: count of entries in the above table.
75  * @mask_val: cpumask containing the allowed cpu's where frequency clipping can
76  *      happen.
77  */
78 struct thermal_cooling_device *cpufreq_cooling_register(
79         struct freq_clip_table *tab_ptr, unsigned int tab_size);
80
81 /**
82  * cpufreq_cooling_unregister - function to remove cpufreq cooling device.
83  * @cdev: thermal cooling device pointer.
84  */
85 void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev);
86 #else /*!CONFIG_CPU_FREQ*/
87 static inline struct thermal_cooling_device *cpufreq_cooling_register(
88         struct freq_clip_table *tab_ptr, unsigned int tab_size);
89 {
90         return NULL;
91 }
92 static inline void cpufreq_cooling_unregister(
93                 struct thermal_cooling_device *cdev)
94 {
95         return;
96 }
97 #endif  /*CONFIG_CPU_FREQ*/
98
99 #endif /* __CPU_COOLING_H__ */