]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
drm/lima: Fix opp clkname setting in case of missing regulator
authorErico Nunes <nunes.erico@gmail.com>
Thu, 27 Oct 2022 07:32:00 +0000 (09:32 +0200)
committerQiang Yu <yuq825@gmail.com>
Mon, 14 Nov 2022 11:08:21 +0000 (19:08 +0800)
Commit d8c32d3971e4 ("drm/lima: Migrate to dev_pm_opp_set_config()")
introduced a regression as it may undo the clk_names setting in case
the optional regulator is missing. This resulted in test and performance
regressions with lima.

Restore the old behavior where clk_names is set separately so it is not
undone in case of a missing optional regulator.

Fixes: d8c32d3971e4 ("drm/lima: Migrate to dev_pm_opp_set_config()")
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221027073200.3885839-1-nunes.erico@gmail.com
drivers/gpu/drm/lima/lima_devfreq.c

index 011be7ff51e1aa44756d743e07417bc75fb55289..bc8fb4e38d0a7279cc038d086869f0345ca418da 100644 (file)
@@ -112,11 +112,6 @@ int lima_devfreq_init(struct lima_device *ldev)
        unsigned long cur_freq;
        int ret;
        const char *regulator_names[] = { "mali", NULL };
-       const char *clk_names[] = { "core", NULL };
-       struct dev_pm_opp_config config = {
-               .regulator_names = regulator_names,
-               .clk_names = clk_names,
-       };
 
        if (!device_property_present(dev, "operating-points-v2"))
                /* Optional, continue without devfreq */
@@ -124,7 +119,15 @@ int lima_devfreq_init(struct lima_device *ldev)
 
        spin_lock_init(&ldevfreq->lock);
 
-       ret = devm_pm_opp_set_config(dev, &config);
+       /*
+        * clkname is set separately so it is not affected by the optional
+        * regulator setting which may return error.
+        */
+       ret = devm_pm_opp_set_clkname(dev, "core");
+       if (ret)
+               return ret;
+
+       ret = devm_pm_opp_set_regulators(dev, regulator_names);
        if (ret) {
                /* Continue if the optional regulator is missing */
                if (ret != -ENODEV)