[PATCH v3 0/2] PM / devfreq: Do not change the frequency of a suspended device

From: Arun Iyengar via B4 Relay

Date: Thu Nov 19 2026 - 16:16:30 EST


>From the review of a panthor patch [1]: Boris Brezillon pointed out that
the devfreq core, not the driver, should stop calling ->target() between
devfreq_suspend_device() and devfreq_resume_device().

1/2 is v2 of [2], which 2/2 builds on. The panthor side is [3].

Tested on an Orange Pi 5 (RK3588S), v7.3-based kernel with [3],
GPU clock on SCMI_CLK_GPU with a 200 MHz opp-suspend (Jonas Karlman's
RFC, not in mainline).
min_freq, max_freq, the userspace governor's set_freq and the cooling
state written while the GPU was runtime suspended take effect on resume,
with no SError; min_freq also after s2idle and deep suspend. 200 runtime
suspend/resume cycles with changing limits. A KUnit test (not posted)
covers the passive governor, the single transition on resume, failing
suspend and resume, and a resume without a suspend.

Developed with Claude (Anthropic), which wrote the code and the commit
messages. I reviewed every change.

[1] https://lore.kernel.org/r/20261110-panthor-suspend-clk-v1-1-53457050e51e@xxxxxxxxx
[2] https://lore.kernel.org/r/20261110-devfreq-resume-freq-v1-1-90de450ccbd0@xxxxxxxxx
[3] https://lore.kernel.org/r/20261112-panthor-suspend-clk-v2-1-62e1b168052d@xxxxxxxxx

---
Changes in v3:
- Run the pending update instead of restoring first, so resume makes
one transition; the userspace governor without set_freq keeps the
frequency from before suspend (Sashiko)
- Keep the passive governor out of the pending update, which evaluated
it with freq 0 (Sashiko)
- Leave devfreq suspended when suspend or resume fails, instead of the
v2 undo: callers may power the device down regardless. A caller that
ignores a failed resume recovers on its next suspend and resume (Sashiko)
- Add [2] as 1/2: commit message corrected (lima on RK3528 is the
mainline case, not panthor), comment shortened
- Rebase on devfreq-next
- Link to v2: https://patch.msgid.link/20261114-devfreq-suspend-sync-v2-1-10f0c3e14245@xxxxxxxxx

Changes in v2:
- Keep only the suspend count, now a plain int changed under
devfreq->lock, instead of a separate suspended flag that could
disagree with it when suspend and resume race (Sashiko)
- Resume at the resume frequency clamped to the current limits, then
run the deferred update: the userspace governor without set_freq
stayed at the suspend frequency (Sashiko)
- Don't defer the passive governor's parent updates: exynos-bus
children must follow their parent to its suspend frequency, also at
shutdown (Sashiko)
- Drop pending_freq: the deferred update runs like any update_devfreq()
call. If it fails, resume logs the error and still sends
DEVFREQ_GOV_RESUME (Sashiko)
- Undo a failed devfreq_suspend_device(), as rk3399_dmc and lima abort
without resuming; an unbalanced devfreq_resume_device() is a no-op
(Sashiko)
- Leave polling governors to their next poll after resume; the driver
has just reset their load data (Sashiko)
- Link to v1: https://patch.msgid.link/20261112-devfreq-suspend-sync-v1-1-af64603ef43e@xxxxxxxxx

---
Arun Iyengar (2):
PM / devfreq: Resume at the frequency from before suspend
PM / devfreq: Do not change the frequency of a suspended device

drivers/devfreq/devfreq.c | 86 +++++++++++++++++++++++++++++-------
drivers/devfreq/governor_userspace.c | 3 +-
include/linux/devfreq.h | 10 ++++-
3 files changed, 79 insertions(+), 20 deletions(-)
---
base-commit: f9316c13d6f621af4f6f4a6089d3c989ffe899e6
change-id: 20261112-devfreq-suspend-sync-7ca8fc51550a

Best regards,
--
Arun Iyengar <aiyengar1990@xxxxxxxxx>