[PATCH v3 4/5] drm/panfrost: devfreq: set opp to the recommended one to configure and enable regulator

From: Clément Péron
Date: Mon Sep 05 2022 - 13:16:36 EST


devm_pm_opp_set_regulators() doesn't enable regulator, which make
regulator framework switching it off during regulator_late_cleanup().

Call dev_pm_opp_set_opp() with the recommend OPP in
panfrost_devfreq_init() to enable the regulator and avoid any switch off
by regulator_late_cleanup().

Suggested-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
Signed-off-by: Clément Péron <peron.clem@xxxxxxxxx>
---
drivers/gpu/drm/panfrost/panfrost_devfreq.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c
index 5110cd9b2425..67b242407156 100644
--- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c
+++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c
@@ -131,6 +131,14 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev)
return PTR_ERR(opp);

panfrost_devfreq_profile.initial_freq = cur_freq;
+
+ /* Setup and enable regulator */
+ ret = dev_pm_opp_set_opp(dev, opp);
+ if (ret) {
+ DRM_DEV_ERROR(dev, "Couldn't set recommended OPP\n");
+ return ret;
+ }
+
dev_pm_opp_put(opp);

/*
--
2.34.1