blob: bae54bb7c048c5a87a8a038ba632253c1be3cc5b [file] [log] [blame]
Thomas Gleixner873e65b2019-05-27 08:55:15 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Amit Daniel Kachhap02361412012-08-16 17:11:40 +05302/*
3 * linux/include/linux/cpu_cooling.h
4 *
5 * Copyright (C) 2012 Samsung Electronics Co., Ltd(http://www.samsung.com)
6 * Copyright (C) 2012 Amit Daniel <amit.kachhap@linaro.org>
7 *
8 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Amit Daniel Kachhap02361412012-08-16 17:11:40 +05309 *
10 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11 */
12
13#ifndef __CPU_COOLING_H__
14#define __CPU_COOLING_H__
15
Eduardo Valentin39d99cf2013-09-12 19:26:45 -040016#include <linux/of.h>
Amit Daniel Kachhap02361412012-08-16 17:11:40 +053017#include <linux/thermal.h>
Eduardo Valentin198f38f2013-04-24 23:10:28 +080018#include <linux/cpumask.h>
Amit Daniel Kachhap02361412012-08-16 17:11:40 +053019
Viresh Kumar4d753aa2017-04-25 15:57:14 +053020struct cpufreq_policy;
21
Zhang Ruibbf7fc82013-03-26 23:57:01 +080022#ifdef CONFIG_CPU_THERMAL
Amit Daniel Kachhap02361412012-08-16 17:11:40 +053023/**
24 * cpufreq_cooling_register - function to create cpufreq cooling device.
Viresh Kumar4d753aa2017-04-25 15:57:14 +053025 * @policy: cpufreq policy.
Amit Daniel Kachhap02361412012-08-16 17:11:40 +053026 */
Eduardo Valentind44ada52013-04-17 17:12:23 +000027struct thermal_cooling_device *
Viresh Kumar4d753aa2017-04-25 15:57:14 +053028cpufreq_cooling_register(struct cpufreq_policy *policy);
Amit Daniel Kachhap02361412012-08-16 17:11:40 +053029
30/**
31 * cpufreq_cooling_unregister - function to remove cpufreq cooling device.
32 * @cdev: thermal cooling device pointer.
33 */
34void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev);
Zhang Rui57df8102013-02-08 14:52:06 +080035
Amit Daniel Kachhap02361412012-08-16 17:11:40 +053036#else /* !CONFIG_CPU_THERMAL */
Eduardo Valentind44ada52013-04-17 17:12:23 +000037static inline struct thermal_cooling_device *
Viresh Kumar4d753aa2017-04-25 15:57:14 +053038cpufreq_cooling_register(struct cpufreq_policy *policy)
Amit Daniel Kachhap02361412012-08-16 17:11:40 +053039{
Javi Merino503ccc3f2014-12-17 11:11:24 +000040 return ERR_PTR(-ENOSYS);
Amit Daniel Kachhap02361412012-08-16 17:11:40 +053041}
Javi Merinoc36cf072015-02-26 19:00:29 +000042
Eduardo Valentind44ada52013-04-17 17:12:23 +000043static inline
44void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)
Amit Daniel Kachhap02361412012-08-16 17:11:40 +053045{
46 return;
47}
Amit Daniel Kachhap02361412012-08-16 17:11:40 +053048#endif /* CONFIG_CPU_THERMAL */
49
Viresh Kumar3ebb62f2017-12-05 11:02:45 +053050#if defined(CONFIG_THERMAL_OF) && defined(CONFIG_CPU_THERMAL)
51/**
52 * of_cpufreq_cooling_register - create cpufreq cooling device based on DT.
53 * @policy: cpufreq policy.
54 */
55struct thermal_cooling_device *
56of_cpufreq_cooling_register(struct cpufreq_policy *policy);
57#else
58static inline struct thermal_cooling_device *
59of_cpufreq_cooling_register(struct cpufreq_policy *policy)
60{
61 return NULL;
62}
63#endif /* defined(CONFIG_THERMAL_OF) && defined(CONFIG_CPU_THERMAL) */
64
Amit Daniel Kachhap02361412012-08-16 17:11:40 +053065#endif /* __CPU_COOLING_H__ */