diff mbox series

[2/2] powercap: DTPM: Check Energy Model type for power values scale

Message ID 20220207073036.14901-3-lukasz.luba@arm.com (mailing list archive)
State New, archived
Delegated to: Daniel Lezcano
Headers show
Series Ignore Energy Model with abstract scale in IPA and DTPM | expand

Commit Message

Lukasz Luba Feb. 7, 2022, 7:30 a.m. UTC
The Energy Model power values might be in an abstract scale. In such case
it's safe to bail out during the registration, since the PowerCap
framework supports only micro-Watts.

Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
---
 drivers/powercap/dtpm_cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/powercap/dtpm_cpu.c b/drivers/powercap/dtpm_cpu.c
index b740866b228d..e6bcde081de4 100644
--- a/drivers/powercap/dtpm_cpu.c
+++ b/drivers/powercap/dtpm_cpu.c
@@ -188,7 +188,7 @@  static int cpuhp_dtpm_cpu_online(unsigned int cpu)
 		return 0;
 
 	pd = em_cpu_get(cpu);
-	if (!pd)
+	if (!pd || !(pd->flags & EM_PERF_DOMAIN_MILLIWATTS))
 		return -EINVAL;
 
 	dtpm_cpu = per_cpu(dtpm_per_cpu, cpu);