From: Igor Velkov via B4 Relay <devnull+iav.iav.lv@kernel.org>
To: John Stultz <jstultz@google.com>,
Thomas Gleixner <tglx@kernel.org>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Neil Armstrong <neil.armstrong@linaro.org>,
Kevin Hilman <khilman@baylibre.com>
Cc: Stephen Boyd <sboyd@kernel.org>,
Miroslav Lichvar <mlichvar@redhat.com>,
Jerome Brunet <jbrunet@baylibre.com>,
Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
linux-rtc@vger.kernel.org, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org,
Igor Velkov <iav@iav.lv>
Subject: [PATCH v2 0/8] alarmtimer: Pick the wakeup RTC per suspend state
Date: Mon, 16 Nov 2026 00:24:59 +0000 [thread overview]
Message-ID: <20261116-b4-alarmtimer-rtc-priority-v2-0-b2c69721e489@iav.lv> (raw)
alarmtimer takes the first RTC with an alarm and a wakeup capable parent
and programs it on every suspend. Which RTC wakes the system can depend
on the suspend state. On ODROID-HC4, meson-vrtc is a register the SoC
firmware reads when the application processors suspend: it wakes the
board from deep sleep only, and only with a BL301 that handles it, while
the pcf8563 wakes it from s2idle. meson-vrtc registers first, so an
alarm does not wake the board from s2idle.
The series keeps an RTC per suspend state, taken from a new
linux,wakeup-states property of the RTC's parent, structured as Thomas
suggested:
1-2 alarmtimer_has_rtcdev(), the state in struct rtc_wakeup
3 the freezer delta replaced with per type expiry times
4 a platform device without a parent, linked to the RTC, with
sysfs links per suspend state
5 an RTC per suspend state; suspend is rejected when an alarm is
pending and no RTC wakes the system from the target state
6-7 the binding and its parser
8 ODROID-HC4
Without the property every RTC is taken for every state, so the first
one is used as before.
The user space found to look the platform device up (omarchy-mobile,
hostmobility, z13ctl) matches it by name under
/sys/bus/platform/devices or by a glob over /sys, and still finds it
under /sys/devices/platform.
Patch 8 needs the pcf8563 interrupt [1] for s2idle. Without it the
pcf8563 takes s2idle but cannot wake the board, which is no worse than
today.
Tested on ODROID-HC4 on top of timers/core with [1]:
- s2idle: the pcf8563 alarm wakes the board
- deep: meson-vrtc wakes it, the pcf8563 is not programmed
- a CLOCK_BOOTTIME_ALARM clock_nanosleep() interrupted by the freezer
wakes the board from deep sleep
- with the pcf8563 limited to "deep", s2idle with an alarm pending
fails with -EOPNOTSUPP
The PCIe root port was removed for s2idle: pci-meson has no PM
callbacks and the board does not resume otherwise. The same tests
passed on v7.3.4 with the five alarmtimer commits from timers/core and
lockdep enabled. sparse reports nothing new.
[1] https://lore.kernel.org/r/20261019-hc4-rtc-alarm-irq-v1-1-078fc79e596f@iav.lv
Signed-off-by: Igor Velkov <iav@iav.lv>
---
Changes in v2:
- restructured as suggested, no priority property, no list of RTCs
- one platform device for all RTCs, ordered by a device link to each
- sysfs links per suspend state
- the freezer delta replaced
- suspend rejected when no RTC covers the target state
- binding: s2idle, shallow, deep or none; hibernate and off dropped
- based on tip timers/core
- Link to v1: https://lore.kernel.org/r/20261104-b4-alarmtimer-rtc-priority-v1-0-e996681b8086@iav.lv
---
Igor Velkov (8):
alarmtimer: Replace alarmtimer_get_rtcdev() with alarmtimer_has_rtcdev()
alarmtimer: Move the wakeup state into struct rtc_wakeup
alarmtimer: Replace the freezer delta with per type expiry times
alarmtimer: Register the platform device without a parent
alarmtimer: Keep an RTC per suspend state
dt-bindings: rtc: Add linux,wakeup-states
alarmtimer: Read the wakeup states of an RTC from linux,wakeup-states
arm64: dts: amlogic: meson-sm1-odroid-hc4: Describe which RTC wakes the board
.../bindings/rtc/amlogic,meson-vrtc.yaml | 2 +
.../devicetree/bindings/rtc/nxp,pcf8563.yaml | 2 +
Documentation/devicetree/bindings/rtc/rtc.yaml | 17 ++
.../boot/dts/amlogic/meson-sm1-odroid-hc4.dts | 5 +
drivers/power/supply/charger-manager.c | 2 +-
include/linux/alarmtimer.h | 7 +-
kernel/time/alarmtimer.c | 228 +++++++++++++--------
7 files changed, 174 insertions(+), 89 deletions(-)
---
base-commit: 0359ecff58853a491dd0f09792fea8e87235ae06
change-id: 20261104-b4-alarmtimer-rtc-priority-2e25131a2917
Best regards,
--
Igor Velkov <iav@iav.lv>
next reply other threads:[~2026-11-16 0:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 0:24 Igor Velkov via B4 Relay [this message]
2026-11-16 0:25 ` [PATCH v2 1/8] alarmtimer: Replace alarmtimer_get_rtcdev() with alarmtimer_has_rtcdev() Igor Velkov via B4 Relay
2026-11-16 0:25 ` [PATCH v2 2/8] alarmtimer: Move the wakeup state into struct rtc_wakeup Igor Velkov via B4 Relay
2026-11-16 0:25 ` [PATCH v2 3/8] alarmtimer: Replace the freezer delta with per type expiry times Igor Velkov via B4 Relay
2026-11-16 0:25 ` [PATCH v2 4/8] alarmtimer: Register the platform device without a parent Igor Velkov via B4 Relay
2026-11-16 0:25 ` [PATCH v2 5/8] alarmtimer: Keep an RTC per suspend state Igor Velkov via B4 Relay
2026-11-16 0:25 ` [PATCH v2 6/8] dt-bindings: rtc: Add linux,wakeup-states Igor Velkov via B4 Relay
2026-11-16 0:25 ` [PATCH v2 7/8] alarmtimer: Read the wakeup states of an RTC from linux,wakeup-states Igor Velkov via B4 Relay
2026-11-16 0:25 ` [PATCH v2 8/8] arm64: dts: amlogic: meson-sm1-odroid-hc4: Describe which RTC wakes the board Igor Velkov 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=20261116-b4-alarmtimer-rtc-priority-v2-0-b2c69721e489@iav.lv \
--to=devnull+iav.iav.lv@kernel.org \
--cc=alexandre.belloni@bootlin.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=iav@iav.lv \
--cc=jbrunet@baylibre.com \
--cc=jstultz@google.com \
--cc=khilman@baylibre.com \
--cc=krzk+dt@kernel.org \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=martin.blumenstingl@googlemail.com \
--cc=mlichvar@redhat.com \
--cc=neil.armstrong@linaro.org \
--cc=robh@kernel.org \
--cc=sboyd@kernel.org \
--cc=tglx@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®