Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux
Pull thermal updates from Zhang Rui: - Implement generic devfreq cooling mechanism through frequency reduction for devices using devfreq. From Ørjan Eide and Javi Merino. - Introduce OMAP3 support on TI SoC thermal driver. From Pavel Mack and Eduardo Valentin. - A bounch of small fixes on devfreq_cooling, Exynos, IMX, Armada, and Rockchip thermal drivers. * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux: (24 commits) thermal: exynos: Directly return 0 instead of using local ret variable thermal: exynos: Remove unneeded semicolon thermal: exynos: Use IS_ERR() because regulator cannot be NULL thermal: exynos: Fix first temperature read after registering sensor thermal: exynos: Fix unbalanced regulator disable on probe failure devfreq_cooling: return on allocation failure thermal: rockchip: support the sleep pinctrl state to avoid glitches in s2r dt-bindings: rockchip-thermal: Add the pinctrl states in this document thermal: devfreq_cooling: Make power a u64 thermal: devfreq_cooling: use a thermal_cooling_device for register and unregister thermal: underflow bug in imx_set_trip_temp() thermal: armada: Fix possible overflow in the Armada 380 thermal sensor formula thermal: imx: register irq handler later in probe thermal: rockhip: fix setting thermal shutdown polarity thermal: rockchip: fix handling of invalid readings devfreq_cooling: add trace information thermal: Add devfreq cooling PM / OPP: get the voltage for all OPPs tools/thermal: tmon: use pkg-config also for CFLAGS linux/thermal.h: rename KELVIN_TO_CELSIUS to DECI_KELVIN_TO_CELSIUS ...
This commit is contained in:
81
include/linux/devfreq_cooling.h
Normal file
81
include/linux/devfreq_cooling.h
Normal file
@@ -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 thermal_cooling_device *
|
||||
of_devfreq_cooling_register_power(struct device_node *np, struct devfreq *df,
|
||||
struct devfreq_cooling_power *dfc_power);
|
||||
struct thermal_cooling_device *
|
||||
of_devfreq_cooling_register(struct device_node *np, struct devfreq *df);
|
||||
struct thermal_cooling_device *devfreq_cooling_register(struct devfreq *df);
|
||||
void devfreq_cooling_unregister(struct thermal_cooling_device *dfc);
|
||||
|
||||
#else /* !CONFIG_DEVFREQ_THERMAL */
|
||||
|
||||
struct thermal_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 thermal_cooling_device *
|
||||
of_devfreq_cooling_register(struct device_node *np, struct devfreq *df)
|
||||
{
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
||||
static inline struct thermal_cooling_device *
|
||||
devfreq_cooling_register(struct devfreq *df)
|
||||
{
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
||||
static inline void
|
||||
devfreq_cooling_unregister(struct thermal_cooling_device *dfc)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* CONFIG_DEVFREQ_THERMAL */
|
||||
#endif /* __DEVFREQ_COOLING_H__ */
|
@@ -44,9 +44,11 @@
|
||||
#define THERMAL_WEIGHT_DEFAULT 0
|
||||
|
||||
/* Unit conversion macros */
|
||||
#define KELVIN_TO_CELSIUS(t) (long)(((long)t-2732 >= 0) ? \
|
||||
((long)t-2732+5)/10 : ((long)t-2732-5)/10)
|
||||
#define CELSIUS_TO_KELVIN(t) ((t)*10+2732)
|
||||
#define DECI_KELVIN_TO_CELSIUS(t) ({ \
|
||||
long _t = (t); \
|
||||
((_t-2732 >= 0) ? (_t-2732+5)/10 : (_t-2732-5)/10); \
|
||||
})
|
||||
#define CELSIUS_TO_DECI_KELVIN(t) ((t)*10+2732)
|
||||
#define DECI_KELVIN_TO_MILLICELSIUS_WITH_OFFSET(t, off) (((t) - (off)) * 100)
|
||||
#define DECI_KELVIN_TO_MILLICELSIUS(t) DECI_KELVIN_TO_MILLICELSIUS_WITH_OFFSET(t, 2732)
|
||||
#define MILLICELSIUS_TO_DECI_KELVIN_WITH_OFFSET(t, off) (((t) / 100) + (off))
|
||||
|
Reference in New Issue
Block a user