RFC: Selecting an NVMEM cell for Power State Change Reason (PSCR) recording
From: Oleksij Rempel
Date: Thu Oct 02 2025 - 08:00:53 EST
Hi all,
I'm seeking consensus on a minimal, upstream-acceptable way to identify the
single NVMEM cell used to persist a Power State Change Reason (PSCR). Typical
targets are battery-backed RTC scratchpads or small EEPROM. The aim is to have
a tiny breadcrumb available before userspace, across full power cuts, and
shared by bootloader/kernel/userspace.
DT vs Userspace vs ACPI
* DeviceTree (preferred): Describing where the storage lives under a real
NVMEM provider (RTC/EEPROM) is early, robust, and OS-agnostic.
* Userspace (fallback): Possible via module/cmdline/sysfs, but leaves an
early-boot window unconfigured and reduces usefulness for embedded devices.
* ACPI: No existing shared mechanism for this use case at present (not
proposing an ACPI path right now).
What implementations were tried
* A PSCR consumer node in DT -> NACKed as not a HW node.
* Kernel/module parameters or sysfs selection -> tried earlier, but rejected
for new designs and cannot guarantee early availability.
* Name-based lookups in NVMEM -> considered fragile and not scalable.
Other options which came in question (seeking guidance)
* cell-level `compatible` on a fixed-cell child (analogous to `mac-base`) to
nominate the PSCR cell under the existing NVMEM provider. DT remains purely
descriptive (location/size); encoding is documented outside DT and shared
across components.
* `/chosen` phandle pointing to the nominated fixed-cell (simple to discover;
unsure about policy concerns).
* pstore integration (not tried): a backend that uses a nominated NVMEM cell if
such a nomination is acceptable.
* nvmem-layout usage (not tried): provider-side markup of the region to
indicate it carries PSCR, if that pattern is acceptable for this purpose.
* Open to any established precedent for nominating a specific NVMEM cell for a
system role without introducing software/virtual DT nodes.
Ask
* Is a cell-level `compatible` on a `fixed-cell` child an acceptable way to
nominate the PSCR cell?
* If not, is a `/chosen` phandle acceptable here, or is there a preferred
alternative?
Thanks for guidance - once the selection mechanism is agreed, I can respin the
PSCR series accordingly.
Latest patch version: https://lore.kernel.org/all/aHTZTFxfS6Bn4yhz@xxxxxxxxxxxxxx/
Best Regards,
Oleksij
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |