[PATCH v12 0/6] Introduce the Power State Change Reasons Recording (PSCRR) framework
From: Oleksij Rempel
Date: Fri Jul 31 2026 - 06:15:21 EST
changes v12:
- Drop all provider drivers and their tests; post the framework alone. The
NVMEM-cell binding a recorder needs to pick its storage is still
deadlocked, and several projects already need the framework - so unblock
the core now and let the providers (NVMEM, PMIC, ...) follow separately.
- Rework into a multi-provider design (per-provider /sys/kernel/pscrr/
directories); add reason tokens and a built-in /chosen/reset-source
provider.
changes v11:
- add missing break reported by kernel test robot <lkp@xxxxxxxxx>
changes v10:
- add some add Reviewed-by tags
- regulator_handle_critical: set pscr = PSCR_UNKNOWN for default case
- make g_pscrr static
changes v9:
- Remove redundant pr_crit() messages before hw_protection_trigger()
- Replace psc_reason_to_str() switch with static const string array
- Mark psc_last_reason as static
changes v8:
- Use DEFINE_GUARD() and guard(g_pscrr) for scoped locking of the global
pscrr_core struct
- Replace manual mutex_lock/unlock with automatic cleanup-based guard() usage
- Centralize backend and locking state in struct pscrr_core
- Prepare for future multi-backend support with clean encapsulation
- Improve sysfs documentation
changes v7:
- document expected values in sysfs documentation
- make write support optional
changes v6:
- add sysfs documentation
- push core part of the reset reason into kernel/reboot.c
changes v5:
- fix compile with NVMEM=n and potential issues with NVMEM=m
changes v4:
- fix compile with CONFIG_PSCRR=n
changes v3:
- rework to remove devicetree dependencies
- extend NVMEM to search devices and cells by names
changes v2:
- rename the framework from PSCR to PSCRR (last R is for Recorder)
- extend the power-on reason header and reuse it for the detected reason
- rebase on top of v6.8-rc1
Hello all,
A system power-state transition - a shutdown or a reboot - rarely has a
single, unambiguous cause, and no one component sees the whole picture: the
PMIC, the watchdog, the SoC reset registers, the bootloader and software each
only know their own part, so there is no single source of truth.
PSCRR gives these sources one central place to report side by side. Every
provider keeps its own view - several providers, and several reasons within a
provider, can be reported at once and are deliberately not collapsed into a
single "winning" cause (a bit of a minority report). On top of that it adds a
software-backed recorder, so software-detected reasons - under-voltage,
over-temperature, a watchdog pretimeout, a panic, a controlled reboot - are
captured too and survive into the next boot.
The NVMEM-cell binding a recorder needs to nominate its storage is still
deadlocked, and several projects already need the framework, so this v12
posts the framework, its reboot/reason infrastructure and the sysfs
documentation only; the provider drivers (NVMEM, PMIC, ...) and the tests
follow separately once the binding is resolved. One built-in provider,
reporting the bootloader's device-tree /chosen/reset-source, is kept so the
framework is useful on its own without a new binding.
For followup drivers, see:
https://github.com/olerem/linux-2.6/tree/v7.2/topic/pscr-v12
Oleksij Rempel (6):
power: Extend power_on_reason.h for upcoming PSCRR framework
reboot: hw_protection_trigger: use standardized numeric
shutdown/reboot reasons instead of strings
reboot: add parsable tokens for power state change reasons
reboot: extend psc_reason with power-on and reset causes
power: reset: Introduce PSCR Recording Framework for Non-Volatile
Storage
Documentation: Add sysfs documentation for PSCRR
Documentation/ABI/testing/sysfs-kernel-pscrr | 108 ++++
MAINTAINERS | 10 +
drivers/platform/chrome/cros_ec_lpc.c | 2 +-
drivers/power/reset/Kconfig | 2 +
drivers/power/reset/Makefile | 1 +
drivers/power/reset/pscrr/Kconfig | 33 +
drivers/power/reset/pscrr/Makefile | 2 +
drivers/power/reset/pscrr/pscrr.c | 634 +++++++++++++++++++
drivers/regulator/core.c | 16 +-
drivers/regulator/irq_helpers.c | 9 +-
drivers/thermal/thermal_core.c | 3 +-
include/linux/power/power_on_reason.h | 5 +
include/linux/pscrr.h | 107 ++++
include/linux/reboot.h | 108 +++-
kernel/reboot.c | 165 ++++-
15 files changed, 1183 insertions(+), 22 deletions(-)
create mode 100644 Documentation/ABI/testing/sysfs-kernel-pscrr
create mode 100644 drivers/power/reset/pscrr/Kconfig
create mode 100644 drivers/power/reset/pscrr/Makefile
create mode 100644 drivers/power/reset/pscrr/pscrr.c
create mode 100644 include/linux/pscrr.h
--
2.47.3