Skip to content

Commit 8410e7f

Browse files
sudeep-hollavireshk
authored andcommitted
cpufreq: scmi: Fix OPP addition failure with a dummy clock provider
Commit dd461cd ("opp: Allow dev_pm_opp_get_opp_table() to return -EPROBE_DEFER") handles -EPROBE_DEFER for the clock/interconnects within _allocate_opp_table() which is called from dev_pm_opp_add and it now propagates the error back to the caller. SCMI performance domain re-used clock bindings to keep it simple. However with the above mentioned change, if clock property is present in a device node, opps fails to get added with below errors until clk_get succeeds. cpu0: failed to add opp 450000000Hz cpu0: failed to add opps to the device ....(errors on cpu1-cpu4) cpu5: failed to add opp 450000000Hz cpu5: failed to add opps to the device So, in order to fix the issue, we need to register dummy clock provider. With the dummy clock provider, clk_get returns NULL(no errors!), then opp core proceeds to add OPPs for the CPUs. Cc: Rafael J. Wysocki <rjw@rjwysocki.net> Fixes: dd461cd ("opp: Allow dev_pm_opp_get_opp_table() to return -EPROBE_DEFER") Signed-off-by: Sudeep Holla <sudeep.holla@arm.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
1 parent e010d1d commit 8410e7f

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

drivers/cpufreq/scmi-cpufreq.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
1010

11+
#include <linux/clk-provider.h>
1112
#include <linux/cpu.h>
1213
#include <linux/cpufreq.h>
1314
#include <linux/cpumask.h>
@@ -228,12 +229,17 @@ static struct cpufreq_driver scmi_cpufreq_driver = {
228229
static int scmi_cpufreq_probe(struct scmi_device *sdev)
229230
{
230231
int ret;
232+
struct device *dev = &sdev->dev;
231233

232234
handle = sdev->handle;
233235

234236
if (!handle || !handle->perf_ops)
235237
return -ENODEV;
236238

239+
/* dummy clock provider as needed by OPP if clocks property is used */
240+
if (of_find_property(dev->of_node, "#clock-cells", NULL))
241+
devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, NULL);
242+
237243
ret = cpufreq_register_driver(&scmi_cpufreq_driver);
238244
if (ret) {
239245
dev_err(&sdev->dev, "%s: registering cpufreq failed, err: %d\n",

0 commit comments

Comments
 (0)