mirror of
https://github.com/t2linux/kernel.git
synced 2026-04-30 13:48:59 -07:00
thermal: Add devfreq cooling
Add a generic thermal cooling device for devfreq, that is similar to cpu_cooling. The device must use devfreq. In order to use the power extension of the cooling device, it must have registered its OPPs using the OPP library. Cc: Zhang Rui <rui.zhang@intel.com> Cc: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Javi Merino <javi.merino@arm.com> Signed-off-by: Ørjan Eide <orjan.eide@arm.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
This commit is contained in:
committed by
Eduardo Valentin
parent
d6d007429f
commit
a76caf55e5
@@ -147,6 +147,20 @@ config CLOCK_THERMAL
|
|||||||
device that is configured to use this cooling mechanism will be
|
device that is configured to use this cooling mechanism will be
|
||||||
controlled to reduce clock frequency whenever temperature is high.
|
controlled to reduce clock frequency whenever temperature is high.
|
||||||
|
|
||||||
|
config DEVFREQ_THERMAL
|
||||||
|
bool "Generic device cooling support"
|
||||||
|
depends on PM_DEVFREQ
|
||||||
|
depends on PM_OPP
|
||||||
|
help
|
||||||
|
This implements the generic devfreq cooling mechanism through
|
||||||
|
frequency reduction for devices using devfreq.
|
||||||
|
|
||||||
|
This will throttle the device by limiting the maximum allowed DVFS
|
||||||
|
frequency corresponding to the cooling level.
|
||||||
|
|
||||||
|
In order to use the power extensions of the cooling device,
|
||||||
|
devfreq should use the simple_ondemand governor.
|
||||||
|
|
||||||
If you want this support, you should say Y here.
|
If you want this support, you should say Y here.
|
||||||
|
|
||||||
config THERMAL_EMULATION
|
config THERMAL_EMULATION
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ thermal_sys-$(CONFIG_CPU_THERMAL) += cpu_cooling.o
|
|||||||
# clock cooling
|
# clock cooling
|
||||||
thermal_sys-$(CONFIG_CLOCK_THERMAL) += clock_cooling.o
|
thermal_sys-$(CONFIG_CLOCK_THERMAL) += clock_cooling.o
|
||||||
|
|
||||||
|
# devfreq cooling
|
||||||
|
thermal_sys-$(CONFIG_DEVFREQ_THERMAL) += devfreq_cooling.o
|
||||||
|
|
||||||
# platform thermal drivers
|
# platform thermal drivers
|
||||||
obj-$(CONFIG_QCOM_SPMI_TEMP_ALARM) += qcom-spmi-temp-alarm.o
|
obj-$(CONFIG_QCOM_SPMI_TEMP_ALARM) += qcom-spmi-temp-alarm.o
|
||||||
obj-$(CONFIG_SPEAR_THERMAL) += spear_thermal.o
|
obj-$(CONFIG_SPEAR_THERMAL) += spear_thermal.o
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,81 @@
|
|||||||
|
/*
|
||||||
|
* devfreq_cooling: Thermal cooling device implementation for devices using
|
||||||
|
* devfreq
|
||||||
|
*
|
||||||
|
* Copyright (C) 2014-2015 ARM Limited
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed "as is" WITHOUT ANY WARRANTY of any
|
||||||
|
* kind, whether express or implied; without even the implied warranty
|
||||||
|
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __DEVFREQ_COOLING_H__
|
||||||
|
#define __DEVFREQ_COOLING_H__
|
||||||
|
|
||||||
|
#include <linux/devfreq.h>
|
||||||
|
#include <linux/thermal.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEVFREQ_THERMAL
|
||||||
|
|
||||||
|
/**
|
||||||
|
* struct devfreq_cooling_power - Devfreq cooling power ops
|
||||||
|
* @get_static_power: Take voltage, in mV, and return the static power
|
||||||
|
* in mW. If NULL, the static power is assumed
|
||||||
|
* to be 0.
|
||||||
|
* @get_dynamic_power: Take voltage, in mV, and frequency, in HZ, and
|
||||||
|
* return the dynamic power draw in mW. If NULL,
|
||||||
|
* a simple power model is used.
|
||||||
|
* @dyn_power_coeff: Coefficient for the simple dynamic power model in
|
||||||
|
* mW/(MHz mV mV).
|
||||||
|
* If get_dynamic_power() is NULL, then the
|
||||||
|
* dynamic power is calculated as
|
||||||
|
* @dyn_power_coeff * frequency * voltage^2
|
||||||
|
*/
|
||||||
|
struct devfreq_cooling_power {
|
||||||
|
unsigned long (*get_static_power)(unsigned long voltage);
|
||||||
|
unsigned long (*get_dynamic_power)(unsigned long freq,
|
||||||
|
unsigned long voltage);
|
||||||
|
unsigned long dyn_power_coeff;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct devfreq_cooling_device *
|
||||||
|
of_devfreq_cooling_register_power(struct device_node *np, struct devfreq *df,
|
||||||
|
struct devfreq_cooling_power *dfc_power);
|
||||||
|
struct devfreq_cooling_device *
|
||||||
|
of_devfreq_cooling_register(struct device_node *np, struct devfreq *df);
|
||||||
|
struct devfreq_cooling_device *devfreq_cooling_register(struct devfreq *df);
|
||||||
|
void devfreq_cooling_unregister(struct devfreq_cooling_device *dfc);
|
||||||
|
|
||||||
|
#else /* !CONFIG_DEVFREQ_THERMAL */
|
||||||
|
|
||||||
|
struct devfreq_cooling_device *
|
||||||
|
of_devfreq_cooling_register_power(struct device_node *np, struct devfreq *df,
|
||||||
|
struct devfreq_cooling_power *dfc_power)
|
||||||
|
{
|
||||||
|
return ERR_PTR(-EINVAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline struct devfreq_cooling_device *
|
||||||
|
of_devfreq_cooling_register(struct device_node *np, struct devfreq *df)
|
||||||
|
{
|
||||||
|
return ERR_PTR(-EINVAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline struct devfreq_cooling_device *
|
||||||
|
devfreq_cooling_register(struct devfreq *df)
|
||||||
|
{
|
||||||
|
return ERR_PTR(-EINVAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
devfreq_cooling_unregister(struct devfreq_cooling_device *dfc)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* CONFIG_DEVFREQ_THERMAL */
|
||||||
|
#endif /* __DEVFREQ_COOLING_H__ */
|
||||||
Reference in New Issue
Block a user