Commit d6d00742 authored by Javi Merino's avatar Javi Merino Committed by Eduardo Valentin

PM / OPP: get the voltage for all OPPs

The OPP library is now used for power models to calculate the power
that a device would consume at a specific OPP.  To do that, we use a
simple power model which takes frequency and voltage as inputs.  We get
the voltage and frequency from the OPP library.

The devfreq cooling device for the thermal framework controls
temperature by disabling OPPs.  The power model needs to calculate the
power that would be consumed if we reenabled the OPP.  Therefore, let
dev_pm_opp_get_voltage() work for disabled OPPs.

Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarJavi Merino <javi.merino@arm.com>
Signed-off-by: default avatarEduardo Valentin <edubezval@gmail.com>
parent b840b6e6
...@@ -217,7 +217,7 @@ static struct device_opp *_find_device_opp(struct device *dev) ...@@ -217,7 +217,7 @@ static struct device_opp *_find_device_opp(struct device *dev)
} }
/** /**
* dev_pm_opp_get_voltage() - Gets the voltage corresponding to an available opp * dev_pm_opp_get_voltage() - Gets the voltage corresponding to an opp
* @opp: opp for which voltage has to be returned for * @opp: opp for which voltage has to be returned for
* *
* Return: voltage in micro volt corresponding to the opp, else * Return: voltage in micro volt corresponding to the opp, else
...@@ -239,7 +239,7 @@ unsigned long dev_pm_opp_get_voltage(struct dev_pm_opp *opp) ...@@ -239,7 +239,7 @@ unsigned long dev_pm_opp_get_voltage(struct dev_pm_opp *opp)
opp_rcu_lockdep_assert(); opp_rcu_lockdep_assert();
tmp_opp = rcu_dereference(opp); tmp_opp = rcu_dereference(opp);
if (IS_ERR_OR_NULL(tmp_opp) || !tmp_opp->available) if (IS_ERR_OR_NULL(tmp_opp))
pr_err("%s: Invalid parameters\n", __func__); pr_err("%s: Invalid parameters\n", __func__);
else else
v = tmp_opp->u_volt; v = tmp_opp->u_volt;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment