Re: [PATCH v16 5/6] power: reset: Introduce PSCR Recording Framework for Non-Volatile Storage

From: Daniel Lezcano

Date: Wed Oct 07 2026 - 04:47:33 EST


On 10/7/26 09:06, Faruque Ansari wrote:
Introduce the Power State Change Reasons Recording (PSCRR) framework: a
generic mechanism to record why the last power state change (shutdown or
reboot) happened - under-voltage, thermal, watchdog, software-triggered,
etc. - so a postmortem reason survives a reboot or an abrupt power loss.

PSCRR is built around providers. A provider is either a hardware reason
source (a PMIC, SoC reset controller or watchdog exposing a reset cause)
or a recorder that persists the reason across a power cycle (an NVMEM or
RTC scratch cell). Each provider gets a directory under
/sys/kernel/pscrr/providerN/ exposing its name, backing device, the set
of observed reasons (as tokens), its capabilities, the reasons it
supports and - for recorders - a record policy. The reason set is
deliberately not collapsed to a single winning cause, since resets are
often multi-causal.

Reasons are the numeric enum psc_reason values from reboot.h, shared with
the POWER_ON_REASON_* vocabulary, so they store compactly in small
battery-backed cells. The current reason (get/set_psc_reason(), set by
the thermal/regulator/hw_protection paths) is written to every recorder
from the reboot notifier.

Co-developed-by: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx>
Signed-off-by: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx>
Reported-by: Francesco Valla <francesco@xxxxxxxx>
Closes: https://lore.kernel.org/all/178749889134.204450.5740187753642158305.b4-review@b4/
Reviewed-by: Matti Vaittinen <mazziesaccount@xxxxxxxxx>
Signed-off-by: Faruque Ansari <faruque.ansari@xxxxxxxxxxxxxxxx>

Reviewed-by: Daniel Lezcano <daniel.lezcano@xxxxxxxxxxxxxxxx>