* [PATCH 0/4] power: reset: add NVMEM recorder provider for PSCRR
@ 2026-08-17 13:29 Faruque Ansari
2026-08-17 13:29 ` [PATCH 1/4] dt-bindings: power: reset: add PSCRR NVMEM recorder binding Faruque Ansari
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Faruque Ansari @ 2026-08-17 13:29 UTC (permalink / raw)
To: kernel; +Cc: avaneesh.dwivedi, linux-arm-msm
The PSCRR framework[1] currently does not provide a recorder provider
capable of persisting power state change reasons across power cycles.
This series extends the PSCRR framework[1] with support for an
NVMEM-cell recorder provider, integrating PSCRR-recorded power state
change reasons with the NVMEM subsystem.
The recorder writes the power state change reason into a small NVMEM cell
(e.g. a PMIC SDAM byte or RTC scratch register) before shutdown or reset,
so the cause survives a power cycle and is available via
/sys/kernel/pscrr/ on the next boot.
Only the NVMEM-cell provider is included here. The PMIC hardware-register
provider will be submitted as a separate series.
[1] https://lore.kernel.org/lkml/20260731095959.296056-1-o.rempel@pengutronix.de/
Signed-off-by: Faruque Ansari <faruque.ansari@oss.qualcomm.com>
---
Faruque Ansari (4):
dt-bindings: power: reset: add PSCRR NVMEM recorder binding
power: reset: add PSCRR NVMEM recorder
nvmem: provide consumer access to cell size metrics
arm64: dts: qcom: lemans: add PSCRR NVMEM recorder node
.../bindings/power/reset/pscrr-nvmem.yaml | 62 +++++++++
MAINTAINERS | 1 +
arch/arm64/boot/dts/qcom/lemans-pmics.dtsi | 9 ++
drivers/nvmem/core.c | 29 ++++
drivers/power/reset/pscrr/Kconfig | 14 ++
drivers/power/reset/pscrr/Makefile | 1 +
drivers/power/reset/pscrr/pscrr-nvmem.c | 155 +++++++++++++++++++++
include/linux/nvmem-consumer.h | 7 +
8 files changed, 278 insertions(+)
---
base-commit: be461b2185ea3ff6d9c92deedcee0a62a57e1332
change-id: 20260806-pscrr-provider-b9f8f451701e
Best regards,
--
Faruque Ansari <faruque.ansari@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH 1/4] dt-bindings: power: reset: add PSCRR NVMEM recorder binding 2026-08-17 13:29 [PATCH 0/4] power: reset: add NVMEM recorder provider for PSCRR Faruque Ansari @ 2026-08-17 13:29 ` Faruque Ansari 2026-08-18 6:47 ` Krzysztof Kozlowski 2026-08-17 13:29 ` [PATCH 2/4] power: reset: add PSCRR NVMEM recorder Faruque Ansari ` (2 subsequent siblings) 3 siblings, 1 reply; 8+ messages in thread From: Faruque Ansari @ 2026-08-17 13:29 UTC (permalink / raw) To: kernel; +Cc: avaneesh.dwivedi, linux-arm-msm Add binding for the PSCRR NVMEM recorder. Records the power state change reason into a small NVMEM cell — such as a PMIC SDAM byte or RTC scratch register — so the cause survives a power cycle and can be read back on the next boot. Signed-off-by: Faruque Ansari <faruque.ansari@oss.qualcomm.com> --- .../bindings/power/reset/pscrr-nvmem.yaml | 62 ++++++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 63 insertions(+) diff --git a/Documentation/devicetree/bindings/power/reset/pscrr-nvmem.yaml b/Documentation/devicetree/bindings/power/reset/pscrr-nvmem.yaml new file mode 100644 index 000000000000..a9c7b97f1251 --- /dev/null +++ b/Documentation/devicetree/bindings/power/reset/pscrr-nvmem.yaml @@ -0,0 +1,62 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/power/reset/pscrr-nvmem.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NVMEM Power State Change Reason recorder + +maintainers: + - Faruque Ansari <faruque.ansari@oss.qualcomm.com> + - Oleksij Rempel <o.rempel@pengutronix.de> + +description: + An NVMEM-backed recorder for Power State Change Reasons (PSCRR). Persists + the reboot or shutdown cause into a small NVMEM cell — such as an RTC + scratch register, a PMIC SDAM (Scratch Data Access Memory) byte, or an + EEPROM — so the reason survives a power cycle and can be read back on the + next boot. The cell is referenced via the standard nvmem-cells consumer + binding. + +allOf: + - $ref: /schemas/nvmem/nvmem-consumer.yaml# + +properties: + compatible: + const: pscrr-nvmem + + nvmem-cells: + maxItems: 1 + + nvmem-cell-names: + items: + - const: pscr + +required: + - compatible + - nvmem-cells + - nvmem-cell-names + +unevaluatedProperties: false + +examples: + - | + /* SDAM NVMEM provider node (pmm8654au_0 PMIC, abbreviated) */ + nvram@7100 { + compatible = "qcom,spmi-sdam"; + reg = <0x7100>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0 0x7100 0x100>; + + reboot_reason_persist: reboot-reason-persist@49 { + reg = <0x49 0x1>; + }; + }; + + pscr-reason { + compatible = "pscrr-nvmem"; + nvmem-cells = <&reboot_reason_persist>; + nvmem-cell-names = "pscr"; + }; +... diff --git a/MAINTAINERS b/MAINTAINERS index 19b9f6605d98..f329cd9d0491 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -21693,6 +21693,7 @@ R: Pengutronix Kernel Team <kernel@pengutronix.de> L: linux-pm@vger.kernel.org S: Maintained F: Documentation/ABI/testing/sysfs-kernel-pscrr +F: Documentation/devicetree/bindings/power/reset/pscrr-nvmem.yaml F: drivers/power/reset/pscrr/ F: include/linux/pscrr.h F: tools/testing/selftests/pscrr/ -- 2.34.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/4] dt-bindings: power: reset: add PSCRR NVMEM recorder binding 2026-08-17 13:29 ` [PATCH 1/4] dt-bindings: power: reset: add PSCRR NVMEM recorder binding Faruque Ansari @ 2026-08-18 6:47 ` Krzysztof Kozlowski 2026-08-18 10:29 ` Faruque Ansari 0 siblings, 1 reply; 8+ messages in thread From: Krzysztof Kozlowski @ 2026-08-18 6:47 UTC (permalink / raw) To: Faruque Ansari, kernel; +Cc: avaneesh.dwivedi, linux-arm-msm On 17/08/2026 15:29, Faruque Ansari wrote: > Add binding for the PSCRR NVMEM recorder. Records the power state > change reason into a small NVMEM cell — such as a PMIC SDAM byte or > RTC scratch register — so the cause survives a power cycle and can be > read back on the next boot. > > Signed-off-by: Faruque Ansari <faruque.ansari@oss.qualcomm.com> > --- Why are you sending emails to kernel@oss mailing list? This is only internal. Please use scripts/get_maintainers.pl to get a list of necessary people and lists to CC. It might happen, that command when run on an older kernel, gives you outdated entries. Therefore please be sure you base your patches on recent Linux kernel. Tools like b4 or scripts/get_maintainer.pl provide you proper list of people, so fix your workflow. Tools might also fail if you work on some ancient tree (don't, instead use mainline) or work on fork of kernel (don't, instead use mainline). Just use b4 and everything should be fine, although remember about `b4 prep --auto-to-cc` if you added new patches to the patchset. You missed at least devicetree list (maybe more), so this won't be tested by automated tooling. Performing review on untested code might be a waste of time. Please kindly resend and include all necessary To/Cc entries. Please follow writing bindings, writing schema and DTS101 slides before next submission. I see at least a few trivial issues which should not be there. Best regards, Krzysztof ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/4] dt-bindings: power: reset: add PSCRR NVMEM recorder binding 2026-08-18 6:47 ` Krzysztof Kozlowski @ 2026-08-18 10:29 ` Faruque Ansari 0 siblings, 0 replies; 8+ messages in thread From: Faruque Ansari @ 2026-08-18 10:29 UTC (permalink / raw) To: Krzysztof Kozlowski, kernel; +Cc: avaneesh.dwivedi, linux-arm-msm Hi Krzysztof, On 18-Aug-26 12:17 PM, Krzysztof Kozlowski wrote: > On 17/08/2026 15:29, Faruque Ansari wrote: >> Add binding for the PSCRR NVMEM recorder. Records the power state >> change reason into a small NVMEM cell — such as a PMIC SDAM byte or >> RTC scratch register — so the cause survives a power cycle and can be >> read back on the next boot. >> >> Signed-off-by: Faruque Ansari <faruque.ansari@oss.qualcomm.com> >> --- > > Why are you sending emails to kernel@oss mailing list? This is only > internal. Apologies for the confusion. The patches were intended for internal review before submission, but I accidentally sent the email to the mailing list instead of the internal recipients. Sorry for the noise.> > Please use scripts/get_maintainers.pl to get a list of necessary people > and lists to CC. It might happen, that command when run on an older > kernel, gives you outdated entries. Therefore please be sure you base > your patches on recent Linux kernel. > > Tools like b4 or scripts/get_maintainer.pl provide you proper list of > people, so fix your workflow. Tools might also fail if you work on some > ancient tree (don't, instead use mainline) or work on fork of kernel > (don't, instead use mainline). Just use b4 and everything should be > fine, although remember about `b4 prep --auto-to-cc` if you added new > patches to the patchset. > > You missed at least devicetree list (maybe more), so this won't be > tested by automated tooling. Performing review on untested code might be > a waste of time. > > Please kindly resend and include all necessary To/Cc entries. > > Please follow writing bindings, writing schema and DTS101 slides before > next submission. I see at least a few trivial issues which should not be > there. I've fixed the trivial issues and will incorporate the feedback in the next revision. I'll make sure the correct To/Cc list is included when posting the updated series. Thanks, Faruque Ansari ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/4] power: reset: add PSCRR NVMEM recorder 2026-08-17 13:29 [PATCH 0/4] power: reset: add NVMEM recorder provider for PSCRR Faruque Ansari 2026-08-17 13:29 ` [PATCH 1/4] dt-bindings: power: reset: add PSCRR NVMEM recorder binding Faruque Ansari @ 2026-08-17 13:29 ` Faruque Ansari 2026-08-18 9:02 ` Uwe Kleine-König 2026-08-17 13:29 ` [PATCH 3/4] nvmem: provide consumer access to cell size metrics Faruque Ansari 2026-08-17 13:29 ` [PATCH 4/4] arm64: dts: qcom: lemans: add PSCRR NVMEM recorder node Faruque Ansari 3 siblings, 1 reply; 8+ messages in thread From: Faruque Ansari @ 2026-08-17 13:29 UTC (permalink / raw) To: kernel; +Cc: avaneesh.dwivedi, linux-arm-msm Record the power state change reason into a small NVMEM cell (an RTC scratch register or EEPROM) and read it back on the next boot, so the cause survives a power cycle. The cell is a plain nvmem consumer reference and the reason value is stored directly. Co-developed-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Faruque Ansari <faruque.ansari@oss.qualcomm.com> --- drivers/power/reset/pscrr/Kconfig | 14 +++ drivers/power/reset/pscrr/Makefile | 1 + drivers/power/reset/pscrr/pscrr-nvmem.c | 155 ++++++++++++++++++++++++++++++++ 3 files changed, 170 insertions(+) diff --git a/drivers/power/reset/pscrr/Kconfig b/drivers/power/reset/pscrr/Kconfig index 72de82731b53..bfcf04b0c8f5 100644 --- a/drivers/power/reset/pscrr/Kconfig +++ b/drivers/power/reset/pscrr/Kconfig @@ -31,3 +31,17 @@ menuconfig PSCRR unless hardware provides the reset cause. If unsure, say N. + +if PSCRR + +config PSCRR_NVMEM + tristate "PSCRR NVMEM recorder provider" + depends on NVMEM + help + PSCRR recorder that stores the power state change reason in a + small NVMEM cell (such as an RTC scratch register) and reads it + back on the next boot, so the cause survives a power cycle. + + If unsure, say N. + +endif # PSCRR diff --git a/drivers/power/reset/pscrr/Makefile b/drivers/power/reset/pscrr/Makefile index e5530a858971..95c80c80c7da 100644 --- a/drivers/power/reset/pscrr/Makefile +++ b/drivers/power/reset/pscrr/Makefile @@ -1,2 +1,3 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_PSCRR) += pscrr.o +obj-$(CONFIG_PSCRR_NVMEM) += pscrr-nvmem.o diff --git a/drivers/power/reset/pscrr/pscrr-nvmem.c b/drivers/power/reset/pscrr/pscrr-nvmem.c new file mode 100644 index 000000000000..66bfb8ef19f9 --- /dev/null +++ b/drivers/power/reset/pscrr/pscrr-nvmem.c @@ -0,0 +1,155 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * pscrr-nvmem.c - NVMEM recorder provider for PSCRR + * + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. + * Copyright (C) 2025 Pengutronix, Oleksij Rempel <o.rempel@pengutronix.de> + */ + +#include <linux/mod_devicetable.h> +#include <linux/module.h> +#include <linux/nvmem-consumer.h> +#include <linux/platform_device.h> +#include <linux/pscrr.h> +#include <linux/reboot.h> +#include <linux/slab.h> + +struct pscrr_nvmem { + struct nvmem_cell *cell; + enum psc_reason reason; +}; + +static int pscrr_nvmem_cell_read(struct pscrr_nvmem *priv, u8 *out) +{ + size_t len; + void *buf; + + buf = nvmem_cell_read(priv->cell, &len); + if (IS_ERR(buf)) + return PTR_ERR(buf); + + *out = len ? *(u8 *)buf : 0; + kfree(buf); + + return 0; +} + +static int pscrr_nvmem_cell_write(struct pscrr_nvmem *priv, u8 val) +{ + int ret; + + /* nvmem_cell_write() returns the byte count on success, not 0. */ + ret = nvmem_cell_write(priv->cell, &val, sizeof(val)); + + return ret < 0 ? ret : 0; +} + +static int pscrr_nvmem_read_reasons(struct pscrr_provider *p, + unsigned long *reasons) +{ + struct pscrr_nvmem *priv = p->priv; + + /* + * Report the reason latched at probe (or overwritten by a later + * record); the cell itself was cleared at probe, so it is not read + * live here. + */ + set_bit(READ_ONCE(priv->reason), reasons); + + return 0; +} + +static int pscrr_nvmem_write_reason(struct pscrr_provider *p, + enum psc_reason reason) +{ + struct pscrr_nvmem *priv = p->priv; + int ret; + + if (reason >= PSCR_REASON_COUNT) + return -EINVAL; + + ret = pscrr_nvmem_cell_write(priv, reason); + if (ret) + return ret; + + WRITE_ONCE(priv->reason, reason); + + return 0; +} + +static const struct pscrr_provider_ops pscrr_nvmem_ops = { + .read_reasons = pscrr_nvmem_read_reasons, + .write_reason = pscrr_nvmem_write_reason, +}; + +static int pscrr_nvmem_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct pscrr_nvmem *priv; + size_t bytes, bits; + u8 val; + int ret; + + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + priv->cell = devm_nvmem_cell_get(dev, "pscr"); + if (IS_ERR(priv->cell)) + return dev_err_probe(dev, PTR_ERR(priv->cell), + "failed to get the pscr nvmem cell\n"); + + ret = nvmem_cell_get_size(priv->cell, &bytes, &bits); + if (ret) + return ret; + + /* The reason is a single byte; a bit cell still occupies one. */ + if ((bytes ?: DIV_ROUND_UP(bits, 8)) != sizeof(val)) + return dev_err_probe(dev, -EINVAL, + "unsupported pscr nvmem cell size\n"); + + /* + * The cell survives resets, so at boot it still holds whatever the + * previous session recorded before it went down. Latch that as this + * boot's reason, then clear the cell back to PSCR_UNKNOWN: if this + * session is later cut short by an abrupt reset that never runs the + * recorder (watchdog power-cycle, sudden power loss), the next boot + * reads "unknown" instead of a stale reason left over from an earlier + * cycle. + */ + ret = pscrr_nvmem_cell_read(priv, &val); + if (ret) + return dev_err_probe(dev, ret, + "failed to read the pscr nvmem cell\n"); + + priv->reason = val < PSCR_REASON_COUNT ? val : PSCR_UNKNOWN; + + ret = pscrr_nvmem_cell_write(priv, PSCR_UNKNOWN); + if (ret) + return dev_err_probe(dev, ret, + "failed to clear the pscr nvmem cell\n"); + + return PTR_ERR_OR_ZERO(devm_pscrr_provider_register(dev, "nvmem", + &pscrr_nvmem_ops, NULL, + priv)); +} + +static const struct of_device_id pscrr_nvmem_of_match[] = { + { .compatible = "pscrr-nvmem" }, + {} +}; +MODULE_DEVICE_TABLE(of, pscrr_nvmem_of_match); + +static struct platform_driver pscrr_nvmem_driver = { + .probe = pscrr_nvmem_probe, + .driver = { + .name = "pscrr-nvmem", + .of_match_table = pscrr_nvmem_of_match, + }, +}; +module_platform_driver(pscrr_nvmem_driver); + +MODULE_AUTHOR("Oleksij Rempel <o.rempel@pengutronix.de>"); +MODULE_AUTHOR("Faruque Ansari <faruque.ansari@oss.qualcomm.com>"); +MODULE_DESCRIPTION("NVMEM recorder provider for PSCRR"); +MODULE_LICENSE("GPL"); -- 2.34.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/4] power: reset: add PSCRR NVMEM recorder 2026-08-17 13:29 ` [PATCH 2/4] power: reset: add PSCRR NVMEM recorder Faruque Ansari @ 2026-08-18 9:02 ` Uwe Kleine-König 0 siblings, 0 replies; 8+ messages in thread From: Uwe Kleine-König @ 2026-08-18 9:02 UTC (permalink / raw) To: Faruque Ansari; +Cc: kernel, avaneesh.dwivedi, linux-arm-msm [-- Attachment #1: Type: text/plain, Size: 774 bytes --] Hello, On Mon, Aug 17, 2026 at 06:59:42PM +0530, Faruque Ansari wrote: > +#include <linux/mod_devicetable.h> > +#include <linux/module.h> > +#include <linux/nvmem-consumer.h> > +#include <linux/platform_device.h> > +#include <linux/pscrr.h> > +#include <linux/reboot.h> > +#include <linux/slab.h> Please rely on <linux/platform_device.h> to provide of_device_id and drop <linux/mod_devicetable.h>. The latter header will go away soon (and <linux/platform_device.h> only includes <linux/device-id/platform.h> which introduces much less dependencies.) > [...] > +static const struct of_device_id pscrr_nvmem_of_match[] = { > + { .compatible = "pscrr-nvmem" }, > + {} { } please (i.e. add a space) > +}; > +MODULE_DEVICE_TABLE(of, pscrr_nvmem_of_match); Best regards Uwe [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/4] nvmem: provide consumer access to cell size metrics 2026-08-17 13:29 [PATCH 0/4] power: reset: add NVMEM recorder provider for PSCRR Faruque Ansari 2026-08-17 13:29 ` [PATCH 1/4] dt-bindings: power: reset: add PSCRR NVMEM recorder binding Faruque Ansari 2026-08-17 13:29 ` [PATCH 2/4] power: reset: add PSCRR NVMEM recorder Faruque Ansari @ 2026-08-17 13:29 ` Faruque Ansari 2026-08-17 13:29 ` [PATCH 4/4] arm64: dts: qcom: lemans: add PSCRR NVMEM recorder node Faruque Ansari 3 siblings, 0 replies; 8+ messages in thread From: Faruque Ansari @ 2026-08-17 13:29 UTC (permalink / raw) To: kernel; +Cc: avaneesh.dwivedi, linux-arm-msm Add nvmem_cell_get_size() to let a consumer query a cell's size before reading or writing it. Without this, a consumer that assumes a fixed cell size can pass nvmem_cell_write() a buffer larger than the cell, which fails with an incorrect-size error instead of succeeding with the cell's actual capacity. Co-developed-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com> Link: https://lore.kernel.org/lkml/dixmyhyj6b66vyizfotpqw6yzaavi2o2mauloa5x6zn3qgk5ub@huoal5ucdd44/ Signed-off-by: Faruque Ansari <faruque.ansari@oss.qualcomm.com> --- drivers/nvmem/core.c | 29 +++++++++++++++++++++++++++++ include/linux/nvmem-consumer.h | 7 +++++++ 2 files changed, 36 insertions(+) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 0556d140170a..49afcff4c72c 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -1790,6 +1790,35 @@ int nvmem_cell_write(struct nvmem_cell *cell, void *buf, size_t len) EXPORT_SYMBOL_GPL(nvmem_cell_write); +/** + * nvmem_cell_get_size() - Retrieve the storage size of an NVMEM cell. + * @cell: Pointer to the NVMEM cell structure. + * @bytes: Optional pointer to store the cell size in bytes (can be NULL). + * @bits: Optional pointer to store the cell size in bits (can be NULL). + * + * This function allows consumers to retrieve the size of a specific NVMEM + * cell before performing read/write operations. It is useful for validating + * buffer sizes to prevent mismatched writes. + * + * Return: 0 on success or negative on failure. + */ +int nvmem_cell_get_size(struct nvmem_cell *cell, size_t *bytes, size_t *bits) +{ + struct nvmem_cell_entry *entry = cell->entry; + + if (!entry->nvmem) + return -EINVAL; + + if (bytes) + *bytes = entry->bytes; + + if (bits) + *bits = entry->nbits; + + return 0; +} +EXPORT_SYMBOL_GPL(nvmem_cell_get_size); + static int nvmem_cell_read_common(struct device *dev, const char *cell_id, void *val, size_t count) { diff --git a/include/linux/nvmem-consumer.h b/include/linux/nvmem-consumer.h index 34c0e58dfa26..bcb0e17e415d 100644 --- a/include/linux/nvmem-consumer.h +++ b/include/linux/nvmem-consumer.h @@ -56,6 +56,7 @@ void nvmem_cell_put(struct nvmem_cell *cell); void devm_nvmem_cell_put(struct device *dev, struct nvmem_cell *cell); void *nvmem_cell_read(struct nvmem_cell *cell, size_t *len); int nvmem_cell_write(struct nvmem_cell *cell, void *buf, size_t len); +int nvmem_cell_get_size(struct nvmem_cell *cell, size_t *bytes, size_t *bits); int nvmem_cell_read_u8(struct device *dev, const char *cell_id, u8 *val); int nvmem_cell_read_u16(struct device *dev, const char *cell_id, u16 *val); int nvmem_cell_read_u32(struct device *dev, const char *cell_id, u32 *val); @@ -128,6 +129,12 @@ static inline int nvmem_cell_write(struct nvmem_cell *cell, return -EOPNOTSUPP; } +static inline int nvmem_cell_get_size(struct nvmem_cell *cell, size_t *bytes, + size_t *bits) +{ + return -EOPNOTSUPP; +} + static inline int nvmem_cell_read_u8(struct device *dev, const char *cell_id, u8 *val) { -- 2.34.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/4] arm64: dts: qcom: lemans: add PSCRR NVMEM recorder node 2026-08-17 13:29 [PATCH 0/4] power: reset: add NVMEM recorder provider for PSCRR Faruque Ansari ` (2 preceding siblings ...) 2026-08-17 13:29 ` [PATCH 3/4] nvmem: provide consumer access to cell size metrics Faruque Ansari @ 2026-08-17 13:29 ` Faruque Ansari 3 siblings, 0 replies; 8+ messages in thread From: Faruque Ansari @ 2026-08-17 13:29 UTC (permalink / raw) To: kernel; +Cc: avaneesh.dwivedi, linux-arm-msm Add a one-byte NVMEM cell node in the SDAM to persist the power state change reason across resets, and wire it to a pscrr-nvmem recorder consumer node so the reason is recorded before shutdown/reboot and read back on the next boot. Signed-off-by: Faruque Ansari <faruque.ansari@oss.qualcomm.com> --- arch/arm64/boot/dts/qcom/lemans-pmics.dtsi | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/lemans-pmics.dtsi b/arch/arm64/boot/dts/qcom/lemans-pmics.dtsi index 500f715931aa..d75b75df870b 100644 --- a/arch/arm64/boot/dts/qcom/lemans-pmics.dtsi +++ b/arch/arm64/boot/dts/qcom/lemans-pmics.dtsi @@ -97,6 +97,12 @@ reboot-mode { mode-recovery = <0x01>; mode-bootloader = <0x02>; }; + + pscr-reason { + compatible = "pscrr-nvmem"; + nvmem-cells = <&reboot_reason_persist>; + nvmem-cell-names = "pscr"; + }; }; &spmi_bus { @@ -186,6 +192,9 @@ reboot_reason: reboot-reason@48 { reg = <0x48 0x1>; bits = <1 7>; }; + reboot_reason_persist: reboot-reason-persist@49 { + reg = <0x49 0x1>; + }; }; }; -- 2.34.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2026-08-18 10:29 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-08-17 13:29 [PATCH 0/4] power: reset: add NVMEM recorder provider for PSCRR Faruque Ansari 2026-08-17 13:29 ` [PATCH 1/4] dt-bindings: power: reset: add PSCRR NVMEM recorder binding Faruque Ansari 2026-08-18 6:47 ` Krzysztof Kozlowski 2026-08-18 10:29 ` Faruque Ansari 2026-08-17 13:29 ` [PATCH 2/4] power: reset: add PSCRR NVMEM recorder Faruque Ansari 2026-08-18 9:02 ` Uwe Kleine-König 2026-08-17 13:29 ` [PATCH 3/4] nvmem: provide consumer access to cell size metrics Faruque Ansari 2026-08-17 13:29 ` [PATCH 4/4] arm64: dts: qcom: lemans: add PSCRR NVMEM recorder node Faruque Ansari
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.