lkml.org 
[lkml]   [2021]   [Oct]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [RFC PATCH 4/9] opp: core: Don't warn if required OPP device does not exist
From
Date
On 12/10/2021 18.32, Viresh Kumar wrote:
> On 12-10-21, 18:31, Hector Martin "marcan" wrote:
>> That doesn't work, though, because the CPUs aren't normal devices
>> with runtime-pm. That was the first thing I tried :).
>
> What's the exact problem with runtime PM here ?

The CPU devices aren't attached to their genpd, so the required OPP
transition fails with the same error.

However, this was easier to fix than I expected. With this patch to
cpufreq-dt, it all works properly, and I can drop the parent genpd
from the clock node and related handling. Thoughts?

commit c4f88743374c1f4678ee7f17fb6cae30ded9ed59
Author: Hector Martin <marcan@marcan.st>
Date: Thu Oct 14 15:47:45 2021 +0900

cpufreq: dt: Attach CPU devices to power domains

This allows the required-opps mechanism to work for CPU OPP tables,
triggering specific OPP levels in a parent power domain.

Signed-off-by: Hector Martin <marcan@marcan.st>

diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c
index 8fcaba541539..5b22846b557d 100644
--- a/drivers/cpufreq/cpufreq-dt.c
+++ b/drivers/cpufreq/cpufreq-dt.c
@@ -16,6 +16,7 @@
#include <linux/list.h>
#include <linux/module.h>
#include <linux/of.h>
+#include <linux/pm_domain.h>
#include <linux/pm_opp.h>
#include <linux/platform_device.h>
#include <linux/regulator/consumer.h>
@@ -264,6 +265,16 @@ static int dt_cpufreq_early_init(struct device *dev, int cpu)
goto out;
}

+ /*
+ * Attach the CPU device to its genpd domain (if any), to allow OPP
+ * dependencies to be satisfied.
+ */
+ ret = genpd_dev_pm_attach(cpu_dev);
+ if (ret <= 0) {
+ dev_err(cpu_dev, "Failed to attach CPU device to genpd\n");
+ goto out;
+ }
+
/*
* The OPP table must be initialized, statically or dynamically, by this
* point.
--
Hector Martin (marcan@marcan.st)
Public Key: https://mrcn.st/pub

\
 
 \ /
  Last update: 2021-10-14 08:53    [W:0.093 / U:11.244 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site