All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arun Iyengar <aiyengar1990@gmail.com>
To: MyungJoo Ham <myungjoo.ham@samsung.com>,
	 Kyungmin Park <kyungmin.park@samsung.com>,
	 Chanwoo Choi <cw00.choi@samsung.com>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Boris Brezillon <boris.brezillon@collabora.com>,
	 Steven Price <steven.price@arm.com>,
	Liviu Dudau <liviu.dudau@arm.com>,
	 Jonas Karlman <jonas@kwiboo.se>,
	Dong Aisheng <aisheng.dong@nxp.com>,
	 Arun Iyengar <aiyengar1990@gmail.com>
Subject: [PATCH v3 1/2] PM / devfreq: Resume at the frequency from before suspend
Date: Thu, 19 Nov 2026 21:16:22 +0000	[thread overview]
Message-ID: <20261119-devfreq-suspend-sync-v3-1-ef19fbf94d83@gmail.com> (raw)
In-Reply-To: <20261119-devfreq-suspend-sync-v3-0-ef19fbf94d83@gmail.com>

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@gmail.com>
---
 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


WARNING: multiple messages have this Message-ID (diff)
From: Arun Iyengar via B4 Relay <devnull+aiyengar1990.gmail.com@kernel.org>
To: MyungJoo Ham <myungjoo.ham@samsung.com>,
	 Kyungmin Park <kyungmin.park@samsung.com>,
	 Chanwoo Choi <cw00.choi@samsung.com>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Boris Brezillon <boris.brezillon@collabora.com>,
	 Steven Price <steven.price@arm.com>,
	Liviu Dudau <liviu.dudau@arm.com>,
	 Jonas Karlman <jonas@kwiboo.se>,
	Dong Aisheng <aisheng.dong@nxp.com>,
	 Arun Iyengar <aiyengar1990@gmail.com>
Subject: [PATCH v3 1/2] PM / devfreq: Resume at the frequency from before suspend
Date: Thu, 19 Nov 2026 21:16:22 +0000	[thread overview]
Message-ID: <20261119-devfreq-suspend-sync-v3-1-ef19fbf94d83@gmail.com> (raw)
In-Reply-To: <20261119-devfreq-suspend-sync-v3-0-ef19fbf94d83@gmail.com>

From: Arun Iyengar <aiyengar1990@gmail.com>

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@gmail.com>
---
 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



  reply	other threads:[~2026-11-19 21:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 21:16 [PATCH v3 0/2] PM / devfreq: Do not change the frequency of a suspended device Arun Iyengar
2026-11-19 21:16 ` Arun Iyengar via B4 Relay
2026-11-19 21:16 ` Arun Iyengar [this message]
2026-11-19 21:16   ` [PATCH v3 1/2] PM / devfreq: Resume at the frequency from before suspend Arun Iyengar via B4 Relay
2026-11-19 21:16 ` [PATCH v3 2/2] PM / devfreq: Do not change the frequency of a suspended device Arun Iyengar
2026-11-19 21:16   ` Arun Iyengar via B4 Relay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261119-devfreq-suspend-sync-v3-1-ef19fbf94d83@gmail.com \
    --to=aiyengar1990@gmail.com \
    --cc=aisheng.dong@nxp.com \
    --cc=boris.brezillon@collabora.com \
    --cc=cw00.choi@samsung.com \
    --cc=jonas@kwiboo.se \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=liviu.dudau@arm.com \
    --cc=myungjoo.ham@samsung.com \
    --cc=steven.price@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.