diff mbox series

[v5,8/8] cpufreq: scmi: Read inefficiencies from EM

Message ID 1629966944-439570-9-git-send-email-vincent.donnefort@arm.com
State New
Headers show
Series inefficient OPPs | expand

Commit Message

Vincent Donnefort Aug. 26, 2021, 8:35 a.m. UTC
The Energy Model has a 1:1 mapping between OPPs and performance states
(em_perf_state). If a CPUFreq driver registers an Energy Model,
inefficiencies found by the latter can be applied to CPUFreq.

Signed-off-by: Vincent Donnefort <vincent.donnefort@arm.com>
diff mbox series

Patch

diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c
index 1e0cd4d165f0..f4fd634d2ecd 100644
--- a/drivers/cpufreq/scmi-cpufreq.c
+++ b/drivers/cpufreq/scmi-cpufreq.c
@@ -250,6 +250,7 @@  static void scmi_cpufreq_register_em(struct cpufreq_policy *policy)
 {
 	struct em_data_callback em_cb = EM_DATA_CB(scmi_get_cpu_power);
 	bool power_scale_mw = perf_ops->power_scale_mw_get(ph);
+	struct device *cpu_dev = get_cpu_device(policy->cpu);
 	struct scmi_data *priv = policy->driver_data;
 
 	/*
@@ -262,9 +263,9 @@  static void scmi_cpufreq_register_em(struct cpufreq_policy *policy)
 	if (!priv->nr_opp)
 		return;
 
-	em_dev_register_perf_domain(get_cpu_device(policy->cpu), priv->nr_opp,
-				    &em_cb, priv->opp_shared_cpus,
-				    power_scale_mw);
+	em_dev_register_perf_domain(cpu_dev, priv->nr_opp, &em_cb,
+				    priv->opp_shared_cpus, power_scale_mw);
+	cpufreq_read_inefficiencies_from_em(policy, em_pd_get(cpu_dev));
 }
 
 static struct cpufreq_driver scmi_cpufreq_driver = {