blob: de0dafb9399dc0fb8022d364a3eedebca964138d [file] [log] [blame]
Amit Daniel Kachhap02361412012-08-16 17:11:40 +05301/*
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
Eduardo Valentin39d99cf2013-09-12 19:26:45 -040027#include <linux/of.h>
Amit Daniel Kachhap02361412012-08-16 17:11:40 +053028#include <linux/thermal.h>
Eduardo Valentin198f38f2013-04-24 23:10:28 +080029#include <linux/cpumask.h>
Amit Daniel Kachhap02361412012-08-16 17:11:40 +053030
Viresh Kumar4d753aa2017-04-25 15:57:14 +053031struct cpufreq_policy;
32
Zhang Ruibbf7fc82013-03-26 23:57:01 +080033#ifdef CONFIG_CPU_THERMAL
Amit Daniel Kachhap02361412012-08-16 17:11:40 +053034/**
35 * cpufreq_cooling_register - function to create cpufreq cooling device.
Viresh Kumar4d753aa2017-04-25 15:57:14 +053036 * @policy: cpufreq policy.
Amit Daniel Kachhap02361412012-08-16 17:11:40 +053037 */
Eduardo Valentind44ada52013-04-17 17:12:23 +000038struct thermal_cooling_device *
Viresh Kumar4d753aa2017-04-25 15:57:14 +053039cpufreq_cooling_register(struct cpufreq_policy *policy);
Amit Daniel Kachhap02361412012-08-16 17:11:40 +053040
41/**
42 * cpufreq_cooling_unregister - function to remove cpufreq cooling device.
43 * @cdev: thermal cooling device pointer.
44 */
45void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev);
Zhang Rui57df8102013-02-08 14:52:06 +080046
Amit Daniel Kachhap02361412012-08-16 17:11:40 +053047#else /* !CONFIG_CPU_THERMAL */
Eduardo Valentind44ada52013-04-17 17:12:23 +000048static inline struct thermal_cooling_device *
Viresh Kumar4d753aa2017-04-25 15:57:14 +053049cpufreq_cooling_register(struct cpufreq_policy *policy)
Amit Daniel Kachhap02361412012-08-16 17:11:40 +053050{
Javi Merino503ccc32014-12-17 11:11:24 +000051 return ERR_PTR(-ENOSYS);
Amit Daniel Kachhap02361412012-08-16 17:11:40 +053052}
Javi Merinoc36cf072015-02-26 19:00:29 +000053
Eduardo Valentind44ada52013-04-17 17:12:23 +000054static inline
55void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)
Amit Daniel Kachhap02361412012-08-16 17:11:40 +053056{
57 return;
58}
Amit Daniel Kachhap02361412012-08-16 17:11:40 +053059#endif /* CONFIG_CPU_THERMAL */
60
Viresh Kumar3ebb62f2017-12-05 11:02:45 +053061#if defined(CONFIG_THERMAL_OF) && defined(CONFIG_CPU_THERMAL)
62/**
63 * of_cpufreq_cooling_register - create cpufreq cooling device based on DT.
64 * @policy: cpufreq policy.
65 */
66struct thermal_cooling_device *
67of_cpufreq_cooling_register(struct cpufreq_policy *policy);
68#else
69static inline struct thermal_cooling_device *
70of_cpufreq_cooling_register(struct cpufreq_policy *policy)
71{
72 return NULL;
73}
74#endif /* defined(CONFIG_THERMAL_OF) && defined(CONFIG_CPU_THERMAL) */
75
Amit Daniel Kachhap02361412012-08-16 17:11:40 +053076#endif /* __CPU_COOLING_H__ */