[PATCH v3 1/2] PM / devfreq: Resume at the frequency from before suspend
From: Arun Iyengar via B4 Relay
Date: Thu Nov 19 2026 - 16:16:38 EST
From: Arun Iyengar <aiyengar1990@xxxxxxxxx>
Since commit 62453f1ba5d5 ("PM / devfreq: Use more accurate returned
new_freq as resume_freq"), devfreq_set_target() records the frequency it
sets as resume_freq, so the suspend transition in
devfreq_suspend_device() overwrites it with the suspend frequency. The
device then resumes at its suspend frequency and stays there until the
governor's next update; with runtime PM (e.g. lima on RK3528) that is
after every idle period.
Keep the frequency from before the suspend transition as resume_freq.
Fixes: 62453f1ba5d5 ("PM / devfreq: Use more accurate returned new_freq as resume_freq")
Signed-off-by: Arun Iyengar <aiyengar1990@xxxxxxxxx>
---
drivers/devfreq/devfreq.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index f25304bca37f..795a01d012ec 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -1144,6 +1144,7 @@ EXPORT_SYMBOL(devm_devfreq_remove_device);
*/
int devfreq_suspend_device(struct devfreq *devfreq)
{
+ unsigned long resume_freq;
int ret;
if (!devfreq)
@@ -1161,7 +1162,10 @@ int devfreq_suspend_device(struct devfreq *devfreq)
if (devfreq->suspend_freq) {
mutex_lock(&devfreq->lock);
+ /* devfreq_set_target() overwrites resume_freq; keep the pre-suspend one */
+ resume_freq = devfreq->previous_freq;
ret = devfreq_set_target(devfreq, devfreq->suspend_freq, 0);
+ devfreq->resume_freq = resume_freq;
mutex_unlock(&devfreq->lock);
if (ret)
return ret;
--
2.55.0