Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 61dcd890 authored by Quentin Perret's avatar Quentin Perret
Browse files

ANDROID: cpufreq: scpi: 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.

Change-Id: I113fa2edf8201c1272c9fb5a0c6c39622ae53f94
Signed-off-by: default avatarQuentin Perret <quentin.perret@arm.com>
parent d326aa36
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -23,6 +23,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/of_platform.h>
@@ -98,11 +99,12 @@ scpi_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask)

static int scpi_cpufreq_init(struct cpufreq_policy *policy)
{
	int ret;
	int ret, nr_opp;
	unsigned int latency;
	struct device *cpu_dev;
	struct scpi_data *priv;
	struct cpufreq_frequency_table *freq_table;
	struct em_data_callback em_cb = EM_DATA_CB(of_dev_pm_opp_get_cpu_power);

	cpu_dev = get_cpu_device(policy->cpu);
	if (!cpu_dev) {
@@ -135,6 +137,7 @@ static int scpi_cpufreq_init(struct cpufreq_policy *policy)
		ret = -EPROBE_DEFER;
		goto out_free_opp;
	}
	nr_opp = ret;

	priv = kzalloc(sizeof(*priv), GFP_KERNEL);
	if (!priv) {
@@ -170,6 +173,9 @@ static int scpi_cpufreq_init(struct cpufreq_policy *policy)
	policy->cpuinfo.transition_latency = latency;

	policy->fast_switch_possible = false;

	em_register_perf_domain(policy->cpus, nr_opp, &em_cb);

	return 0;

out_free_cpufreq_table: