[PATCH RFC 0/3] clk: Restore the clocks of a provider after a hibernation
From: Abel Vesa
Date: Wed Oct 28 2026 - 05:54:00 EST
When a hibernation image is restored, the clock hardware has been through
a power cycle and a boot kernel, while the clock framework in the image
still holds the rates, parents and enable state the consumers asked for
before the image was created. The consumers ask for the same rates again
when they resume, the framework sees no change, and the clocks the boot
kernel did not touch keep whatever the boot firmware left in them.
Whether the kernel that loads the image probed a given controller at
all depends on whether its driver is built in or available from the
initramfs. On the Qualcomm Glymur CRD, the display clock controller
driver is a module that it does not probe, so after the restore the DPU
runs at the 333MHz the firmware configured the PLL for instead of the
717MHz the framework believes it runs at, underflows, and the panel
shows a solid blue screen.
The first patch adds clk_restore_context_dev(), which re-applies the
cached state of the clocks registered by a provider device, parents
first, as an alternative to the global clk_restore_context() that
depends on every clock implementing the restore_context operation. The
second one adds a hibernation restore callback to the Qualcomm clock
controller common code, which redoes the probe time configuration and
restores the clocks, and the third one uses it for the Glymur display
clock controller.
Sent as RFC, as the same applies to every clock controller and I would
like to know whether this is the right level to handle it at before
wiring up the rest. In particular:
- Instead of programming the cached state into the hardware, the
framework could read the parents and rates back from the hardware
after the restore, so that the consumers asking for the same rates
again go through the normal clk_set_rate() path. Would that be
preferred?
- Programming the cached rate of a clock that is not enabled may not
work on every clock type, for example on an RCG whose source is off.
- The Qualcomm callback finds its state through devres, which only
covers drivers that call qcom_cc_really_probe() once per device.
Clocks left enabled by the firmware but not by the framework stay
enabled, and the phase and duty cycle are not restored.
Prepared with help from an LLM-based assistant.
Signed-off-by: Abel Vesa <abel.vesa@xxxxxxxxxxxxxxxx>
---
Abel Vesa (3):
clk: Add a way to restore the clocks of a provider after a power cycle
clk: qcom: common: Restore the clock controller after hibernation
clk: qcom: dispcc-glymur: Restore the clocks after hibernation
drivers/clk/clk.c | 68 ++++++++++++++++++++++++++++++++++++++++
drivers/clk/qcom/common.c | 52 +++++++++++++++++++++++++++++-
drivers/clk/qcom/common.h | 2 ++
drivers/clk/qcom/dispcc-glymur.c | 2 ++
include/linux/clk-provider.h | 2 ++
5 files changed, 125 insertions(+), 1 deletion(-)
---
base-commit: f1ac44c32cba88ad65dcecd4a279661d14e93651
change-id: 20261023-b4-clk-restore-after-hibernation-74fff1dea5f2
Best regards,
--
Abel