summaryrefslogtreecommitdiff
path: root/include/linux/devfreq_cooling.h
diff options
context:
space:
mode:
authorLukasz Luba <lukasz.luba@arm.com>2017-05-04 14:34:32 +0300
committerZhang Rui <rui.zhang@intel.com>2017-05-05 10:54:45 +0300
commit2be83da85a64773efaa407639de81bd1377f880e (patch)
tree71ee9c4b2a318f11345c3770a2dd3900c14bf2b0 /include/linux/devfreq_cooling.h
parente34cab4cd1f98b4daed5bc98fe727e63f8dbf4e4 (diff)
downloadlinux-2be83da85a64773efaa407639de81bd1377f880e.tar.xz
thermal: devfreq_cooling: add new interface for direct power read
This patch introduces a new interface for device drivers connected to devfreq_cooling in the thermal framework: get_real_power(). Some devices have more sophisticated methods (like power counters) to approximate the actual power that they use. In the previous implementation we had a pre-calculated power table which was then scaled by 'utilization' ('busy_time' and 'total_time' taken from devfreq 'last_status'). With this new interface the driver can provide more precise data regarding actual power to the thermal governor every time the power budget is calculated. We then use this value and calculate the real resource utilization scaling factor. Reviewed-by: Chris Diamand <chris.diamand@arm.com> Acked-by: Javi Merino <javi.merino@kernel.org> Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
Diffstat (limited to 'include/linux/devfreq_cooling.h')
-rw-r--r--include/linux/devfreq_cooling.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/linux/devfreq_cooling.h b/include/linux/devfreq_cooling.h
index c35d0c0e0ada..4635f95000a4 100644
--- a/include/linux/devfreq_cooling.h
+++ b/include/linux/devfreq_cooling.h
@@ -34,6 +34,23 @@
* If get_dynamic_power() is NULL, then the
* dynamic power is calculated as
* @dyn_power_coeff * frequency * voltage^2
+ * @get_real_power: When this is set, the framework uses it to ask the
+ * device driver for the actual power.
+ * Some devices have more sophisticated methods
+ * (like power counters) to approximate the actual power
+ * that they use.
+ * This function provides more accurate data to the
+ * thermal governor. When the driver does not provide
+ * such function, framework just uses pre-calculated
+ * table and scale the power by 'utilization'
+ * (based on 'busy_time' and 'total_time' taken from
+ * devfreq 'last_status').
+ * The value returned by this function must be lower
+ * or equal than the maximum power value
+ * for the current state
+ * (which can be found in power_table[state]).
+ * When this interface is used, the power_table holds
+ * max total (static + dynamic) power value for each OPP.
*/
struct devfreq_cooling_power {
unsigned long (*get_static_power)(struct devfreq *devfreq,
@@ -41,6 +58,8 @@ struct devfreq_cooling_power {
unsigned long (*get_dynamic_power)(struct devfreq *devfreq,
unsigned long freq,
unsigned long voltage);
+ int (*get_real_power)(struct devfreq *df, u32 *power,
+ unsigned long freq, unsigned long voltage);
unsigned long dyn_power_coeff;
};