2 * linux/include/linux/cpu_cooling.h
4 * Copyright (C) 2012 Samsung Electronics Co., Ltd(http://www.samsung.com)
5 * Copyright (C) 2012 Amit Daniel <amit.kachhap@linaro.org>
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.
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.
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.
21 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
24 #ifndef __CPU_COOLING_H__
25 #define __CPU_COOLING_H__
27 #include <linux/thermal.h>
29 #define CPUFREQ_COOLING_START 0
30 #define CPUFREQ_COOLING_STOP 1
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
37 * @mask_val: cpumask of the allowed cpu's where the clipping will take place.
39 * This structure is required to be filled and passed to the
40 * cpufreq_cooling_unregister function.
42 struct freq_clip_table {
43 unsigned int freq_clip_max;
44 unsigned int temp_level;
45 const struct cpumask *mask_val;
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.
54 * This exported function registers a driver with cpu cooling layer. The driver
55 * will be notified when any cpu cooling action is called.
57 int cputherm_register_notifier(struct notifier_block *nb, unsigned int list);
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.
65 * This exported function un-registers a driver with cpu cooling layer.
67 int cputherm_unregister_notifier(struct notifier_block *nb, unsigned int list);
69 #ifdef CONFIG_CPU_FREQ
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
78 struct thermal_cooling_device *cpufreq_cooling_register(
79 struct freq_clip_table *tab_ptr, unsigned int tab_size);
82 * cpufreq_cooling_unregister - function to remove cpufreq cooling device.
83 * @cdev: thermal cooling device pointer.
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);
92 static inline void cpufreq_cooling_unregister(
93 struct thermal_cooling_device *cdev)
97 #endif /*CONFIG_CPU_FREQ*/
99 #endif /* __CPU_COOLING_H__ */