ANDROID: cpufreq: arm_big_little: Register an Energy Model
The Energy Model framework provides an API to register the active power of CPUs. This commit calls this API from the scpi-cpufreq driver which uses the power estimation helper from PM_OPP. Todo: Check if driver can handle -EPROBE_DEFER and if the call to dev_pm_opp_get_opp_count() id realy necessary. Change-Id: Ia808262ef6c9f2cc7819a83e8eb2f602454edfa3 Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com> Signed-off-by: Quentin Perret <quentin.perret@arm.com>
This commit is contained in:
parent
61dcd89053
commit
354f0b0c8d
1 changed files with 10 additions and 0 deletions
|
@ -24,6 +24,7 @@
|
|||
#include <linux/cpufreq.h>
|
||||
#include <linux/cpumask.h>
|
||||
#include <linux/cpu_cooling.h>
|
||||
#include <linux/energy_model.h>
|
||||
#include <linux/export.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/mutex.h>
|
||||
|
@ -456,6 +457,7 @@ static int get_cluster_clk_and_freq_table(struct device *cpu_dev,
|
|||
/* Per-CPU initialization */
|
||||
static int bL_cpufreq_init(struct cpufreq_policy *policy)
|
||||
{
|
||||
struct em_data_callback em_cb = EM_DATA_CB(of_dev_pm_opp_get_cpu_power);
|
||||
u32 cur_cluster = cpu_to_cluster(policy->cpu);
|
||||
struct device *cpu_dev;
|
||||
int ret;
|
||||
|
@ -487,6 +489,14 @@ static int bL_cpufreq_init(struct cpufreq_policy *policy)
|
|||
policy->cpuinfo.transition_latency =
|
||||
arm_bL_ops->get_transition_latency(cpu_dev);
|
||||
|
||||
ret = dev_pm_opp_get_opp_count(cpu_dev);
|
||||
if (ret <= 0) {
|
||||
dev_dbg(cpu_dev, "OPP table is not ready, deferring probe\n");
|
||||
return -EPROBE_DEFER;
|
||||
}
|
||||
|
||||
em_register_perf_domain(policy->cpus, ret, &em_cb);
|
||||
|
||||
if (is_bL_switching_enabled())
|
||||
per_cpu(cpu_last_req_freq, policy->cpu) = clk_get_cpu_rate(policy->cpu);
|
||||
|
||||
|
|
Loading…
Reference in a new issue