]>
git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blob - include/linux/devfreq_cooling.h
2 * devfreq_cooling: Thermal cooling device implementation for devices using
5 * Copyright (C) 2014-2015 ARM Limited
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
11 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
12 * kind, whether express or implied; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
17 #ifndef __DEVFREQ_COOLING_H__
18 #define __DEVFREQ_COOLING_H__
20 #include <linux/devfreq.h>
21 #include <linux/thermal.h>
25 * struct devfreq_cooling_power - Devfreq cooling power ops
26 * @get_static_power: Take voltage, in mV, and return the static power
27 * in mW. If NULL, the static power is assumed
29 * @get_dynamic_power: Take voltage, in mV, and frequency, in HZ, and
30 * return the dynamic power draw in mW. If NULL,
31 * a simple power model is used.
32 * @dyn_power_coeff: Coefficient for the simple dynamic power model in
34 * If get_dynamic_power() is NULL, then the
35 * dynamic power is calculated as
36 * @dyn_power_coeff * frequency * voltage^2
38 struct devfreq_cooling_power
{
39 unsigned long (*get_static_power
)(struct devfreq
*devfreq
,
40 unsigned long voltage
);
41 unsigned long (*get_dynamic_power
)(struct devfreq
*devfreq
,
43 unsigned long voltage
);
44 unsigned long dyn_power_coeff
;
47 #ifdef CONFIG_DEVFREQ_THERMAL
49 struct thermal_cooling_device
*
50 of_devfreq_cooling_register_power(struct device_node
*np
, struct devfreq
*df
,
51 struct devfreq_cooling_power
*dfc_power
);
52 struct thermal_cooling_device
*
53 of_devfreq_cooling_register(struct device_node
*np
, struct devfreq
*df
);
54 struct thermal_cooling_device
*devfreq_cooling_register(struct devfreq
*df
);
55 void devfreq_cooling_unregister(struct thermal_cooling_device
*dfc
);
57 #else /* !CONFIG_DEVFREQ_THERMAL */
59 struct thermal_cooling_device
*
60 of_devfreq_cooling_register_power(struct device_node
*np
, struct devfreq
*df
,
61 struct devfreq_cooling_power
*dfc_power
)
63 return ERR_PTR(-EINVAL
);
66 static inline struct thermal_cooling_device
*
67 of_devfreq_cooling_register(struct device_node
*np
, struct devfreq
*df
)
69 return ERR_PTR(-EINVAL
);
72 static inline struct thermal_cooling_device
*
73 devfreq_cooling_register(struct devfreq
*df
)
75 return ERR_PTR(-EINVAL
);
79 devfreq_cooling_unregister(struct thermal_cooling_device
*dfc
)
83 #endif /* CONFIG_DEVFREQ_THERMAL */
84 #endif /* __DEVFREQ_COOLING_H__ */