* [PATCH] rtc: meson-vrtc: keep the alarm across the hibernation snapshot
@ 2026-11-17 20:13 Igor Velkov via B4 Relay
2026-11-17 20:23 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Igor Velkov via B4 Relay @ 2026-11-17 20:13 UTC (permalink / raw)
To: Alexandre Belloni, Neil Armstrong, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl
Cc: linux-rtc, linux-arm-kernel, linux-amlogic, linux-kernel,
Igor Velkov
From: Igor Velkov <iav@iav.lv>
SIMPLE_DEV_PM_OPS also installs meson_vrtc_resume() as the .thaw
callback, so the alarm is cleared as soon as the hibernation image has
been created. An alarm set through the RTC (rtcwake, wakealarm) is then
lost: with hybrid-sleep the system suspends with a zero wakeup time in
the SCP and does not wake on it. The alarmtimer is not affected, as it
sets the alarm again from its own suspend callback.
Set only the suspend/resume and poweroff/restore callbacks, so freeze
and thaw leave the alarm alone.
Tested on ODROID-HC4 with v7.4-rc3, rtcwake -m no before hybrid-sleep:
BL301 printed alarm=0S before this change and the remaining time with
it, and woke the board on the alarm 3 of 3 times. Waking needs a BL301
that acts on this alarm; the stock one for HC4 does not. Deep suspend
still wakes on the alarm.
Fixes: 6ef35398e827 ("rtc: Add Amlogic Virtual Wake RTC")
Signed-off-by: Igor Velkov <iav@iav.lv>
---
drivers/rtc/rtc-meson-vrtc.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/rtc/rtc-meson-vrtc.c b/drivers/rtc/rtc-meson-vrtc.c
index e5f9f05ffee0..f34a98defee6 100644
--- a/drivers/rtc/rtc-meson-vrtc.c
+++ b/drivers/rtc/rtc-meson-vrtc.c
@@ -86,7 +86,7 @@ static int meson_vrtc_probe(struct platform_device *pdev)
return devm_rtc_register_device(rtc);
}
-static int __maybe_unused meson_vrtc_suspend(struct device *dev)
+static int meson_vrtc_suspend(struct device *dev)
{
struct meson_vrtc_data *vrtc = dev_get_drvdata(dev);
@@ -115,7 +115,7 @@ static int __maybe_unused meson_vrtc_suspend(struct device *dev)
return 0;
}
-static int __maybe_unused meson_vrtc_resume(struct device *dev)
+static int meson_vrtc_resume(struct device *dev)
{
struct meson_vrtc_data *vrtc = dev_get_drvdata(dev);
@@ -126,8 +126,12 @@ static int __maybe_unused meson_vrtc_resume(struct device *dev)
return 0;
}
-static SIMPLE_DEV_PM_OPS(meson_vrtc_pm_ops,
- meson_vrtc_suspend, meson_vrtc_resume);
+static const struct dev_pm_ops meson_vrtc_pm_ops = {
+ .suspend = pm_sleep_ptr(meson_vrtc_suspend),
+ .resume = pm_sleep_ptr(meson_vrtc_resume),
+ .poweroff = pm_sleep_ptr(meson_vrtc_suspend),
+ .restore = pm_sleep_ptr(meson_vrtc_resume),
+};
static const struct of_device_id meson_vrtc_dt_match[] = {
{ .compatible = "amlogic,meson-vrtc"},
---
base-commit: aebb7274476403040d582c61478df8f4a7bf9cd3
change-id: 20261117-meson-vrtc-thaw-09a01c9c9a5e
Best regards,
--
Igor Velkov <iav@iav.lv>
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] rtc: meson-vrtc: keep the alarm across the hibernation snapshot
2026-11-17 20:13 [PATCH] rtc: meson-vrtc: keep the alarm across the hibernation snapshot Igor Velkov via B4 Relay
@ 2026-11-17 20:23 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-11-17 20:23 UTC (permalink / raw)
To: Igor Velkov; +Cc: linux-rtc, Alexandre Belloni
> From: Igor Velkov <iav@iav.lv>
>
> SIMPLE_DEV_PM_OPS also installs meson_vrtc_resume() as the .thaw
> callback, so the alarm is cleared as soon as the hibernation image has
> been created. An alarm set through the RTC (rtcwake, wakealarm) is then
> lost: with hybrid-sleep the system suspends with a zero wakeup time in
> the SCP and does not wake on it. The alarmtimer is not affected, as it
> sets the alarm again from its own suspend callback.
>
> Set only the suspend/resume and poweroff/restore callbacks, so freeze
> and thaw leave the alarm alone.
>
> Tested on ODROID-HC4 with v7.4-rc3, rtcwake -m no before hybrid-sleep:
> BL301 printed alarm=0S before this change and the remaining time with
> it, and woke the board on the alarm 3 of 3 times. Waking needs a BL301
> that acts on this alarm; the stock one for HC4 does not. Deep suspend
> still wakes on the alarm.
>
> Fixes: 6ef35398e827 ("rtc: Add Amlogic Virtual Wake RTC")
> Signed-off-by: Igor Velkov <iav@iav.lv>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261117-meson-vrtc-thaw-v1-1-b58a2c3919d3@iav.lv?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-17 20:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-17 20:13 [PATCH] rtc: meson-vrtc: keep the alarm across the hibernation snapshot Igor Velkov via B4 Relay
2026-11-17 20:23 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox