From: Thomas Gleixner <tglx@kernel.org>
To: Igor Velkov <iav@iav.lv>
Cc: John Stultz <jstultz@google.com>,
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>,
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: Re: [PATCH RFC 2/3] alarmtimer: Choose the wakeup RTC by sleep state and priority
Date: Thu, 12 Nov 2026 11:26:09 +0100 [thread overview]
Message-ID: <878q2ytkfy.ffs@fw13> (raw)
In-Reply-To: <20261111-re-tglx-alarmtimer-rfc2@iav.lv>
On Wed, Nov 11 2026 at 01:50, Igor Velkov wrote:
> On Wed, Nov 11 2026 at 00:14, Thomas Gleixner wrote:
>> So this gets _ONE_ suspend() and _ONE_ resume() call and nothing more
>> and everything falls in place and is comprehensible, no?
>
> Thanks, that is much simpler. v2 will first replace the freezer_delta
> handling as you sketched, then add the per-state wakeup_ctl with one
> pseudo device and no priority, and reject suspend into a state without
> an RTC while an alarm is armed. It will be based on tip timers/core and
> follow the tip style. I'll also check whether user space looks up the
> alarmtimer device.
You want to structure this nicely into $N patches:
1) Provide and use alarmtimer_has_rtcdev()
Just check !!READ_ONCE(rtcdev)
Convert the one lonely user outside of the core code and the core
code itself. Replace the few users which actually need the
pointer and do the read directly there.
2) Move the static variables into struct wakeup_ctl
3) Replace the freezer delta handling
4) Switch to the pseudo platform device
5) Convert the rtcdev storage to an array and implement a stub
parser which returns STATES_ALL.
6) Add the actual device tree parser logic, which enables the whole
thing.
That makes it easy to review and bisect.
For #4 you might think about doing the following:
for (int state = 0; i < ARRAY_SIZE(state_names); state++) {
if (!state_names[state])
continue;
sysfs_create_link(&wakeup_ctl->pdev->dev.kobj,
&dev->kobj, state_names[state];
}
which creates symlinks in
/sys/devices/platform/alarmtimer.0.auto/
freeze -> ../../pci0000:00/0000:00:1f.0/PNP0B00:00/rtc/rtc0
mem -> ../../pci0000:00/0000:00:1f.0/PNP0B00:00/rtc/rtc0
standby -> ../../pci0000:00/0000:00:1f.0/PNP0B00:00/rtc/rtc0
and in #5 this becomes:
for_each_set_bit(state, &states, PM_SUSPEND_MAX) {
wakeup_ctl.rtcs[state] = dev;
sysfs_create_link(&wakeup_ctl->pdev->dev.kobj,
&dev->kobj, state_names[state];
}
so the symlinks point to the device which is assigned to a state. That
gives at least some insight into the actual assignments on systmes which
need more than one RTC to wake up.
Thanks,
tglx
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
next prev parent reply other threads:[~2026-11-12 10:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-04 5:54 [PATCH RFC 0/3] alarmtimer: Choose the wakeup RTC per sleep state from the device tree Igor Velkov via B4 Relay
2026-11-04 5:54 ` [PATCH RFC 1/3] dt-bindings: rtc: Add linux,wakeup-states and linux,alarmtimer-priority Igor Velkov via B4 Relay
2026-11-04 6:06 ` sashiko-bot
2026-11-04 5:54 ` [PATCH RFC 2/3] alarmtimer: Choose the wakeup RTC by sleep state and priority Igor Velkov via B4 Relay
2026-11-10 23:14 ` Thomas Gleixner
2026-11-10 23:50 ` Igor Velkov
2026-11-12 10:26 ` Thomas Gleixner [this message]
2026-11-04 5:54 ` [PATCH RFC 3/3] arm64: dts: amlogic: meson-sm1-odroid-hc4: Describe which RTC wakes the board Igor Velkov via B4 Relay
2026-11-04 8:50 ` [PATCH RFC 0/3] alarmtimer: Choose the wakeup RTC per sleep state from the device tree Neil Armstrong
2026-11-04 18:38 ` Igor Velkov
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=878q2ytkfy.ffs@fw13 \
--to=tglx@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 \
/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