Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1077603rdb; Wed, 24 Jan 2024 04:23:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IE960KUwvc0ET8KJizHWhTbYMhHgsCZFx4wwgumfvZpt4XwtBaizN7m4JBbq4w0Y+s4B0L5 X-Received: by 2002:a17:90a:b903:b0:28e:88d9:c314 with SMTP id p3-20020a17090ab90300b0028e88d9c314mr4333793pjr.11.1706099000701; Wed, 24 Jan 2024 04:23:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706099000; cv=pass; d=google.com; s=arc-20160816; b=ZvVWr5ajxYezA64x9/z9wDPCbn9KJ03u7rLYG8Eh+qtOLhFdUCV3/CgMU95E5ouCrD oxIrNOt2v5j9MAFjKRlFrjpbZrvFWvdyMyLUcEXVvtI/jQEFNmSoeELnzvCVAz68FlTO 5JylZXrzYndB/0uB3GAWBq7j8btqH7/6BXM2NI8kNtpUB0JcL5nX1z6DFqs/VJMm3Xmy bY87IG3P9txx89Hmn7YcBy87SRsRU7Gh3ia0MeCuSfHM1rZ6GpaaGIbM0lXzFbL2Cg44 Uqr8Hau9eZGgqmfoP3lFz9eyAhSv1YXjeeQlXBdYNRQYNW7lF7xln0YeXTqt70P/EzHG uzoQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=J1EaaLwHENVWk54A9/6hyIN+6qmJPPYAItR8ppbz9ZQ=; fh=cTOyeHIiotxFveWD397Up69SLR8Dqpy9YboYIfW0A00=; b=uZm2tNL5hjBlCJCn623rfE/MRgdOzMfk1vbe8C2SJmRjW6uVTBmm6Vz/UfJN06ktij 7eAaGaWWU05uMfwkSBFUU566d4Ew/n74x4eWe0SXQZm5ko3Y70WHJHk0aCSdfautyCaG El9pUsJh54qZKgrZwN8pjSO3SpnEyJ7sksIMpSak8AW9tBanJjRbsOyNmuPKHbSvPIfo 2/WQV6kXnKDeRoyTz0RcCUKEvFYZO7pC/575sRD34DeEGsaG4QKVx7S6t+8OdyrnZZ+1 kdRV4HzBwr2Ybk1W3er4MNSUrDlwnP2DFXSovEKE9tcMcPyye7/Oiy9j0sLawVnxt6aT vMPg== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-36965-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36965-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id gb5-20020a17090b060500b002900ee516bdsi11565695pjb.24.2024.01.24.04.23.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 04:23:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-36965-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-36965-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36965-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 06105286674 for ; Wed, 24 Jan 2024 12:22:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 56A0B634EE; Wed, 24 Jan 2024 12:22:28 +0000 (UTC) Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F0381604D9 for ; Wed, 24 Jan 2024 12:22:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706098947; cv=none; b=M9XnDnqifsn3NoKNiL/W4qFjOH7qXKOfibYJXtCtEuJxq5yqEc2ok3H6416rPc9Qh3jXZgItoCaocFN5HALlOzeskRGyechcB+C2JIzkH3RB44Dndp9M0hHyRuvmH5gnMFVFKe6eZZZIbIM1MF+D9v0F2UCsloKi9AYw1THAWYM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706098947; c=relaxed/simple; bh=FYcpkMKnrRzDedyJnvEJ1/ALEy2O6Va6jd02INm4+pI=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=ohIBwZBDwgXcxpOgPhvmag03sJFprGtJZoI6GhTOrM4A/YzOBqgeYsL3LLH7+ZW9YAgNLxCMggNjMJTP90CR/D56PCCidLcuNWSZP4w07izeMHRSYbuhFXLwXeCgVj6jgduA9OrOAZB5WX188i4GCBQD4bhQqJ7DnFcPxoXpnD4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rScGd-0007o4-1C; Wed, 24 Jan 2024 13:22:07 +0100 Received: from [2a0a:edc0:0:1101:1d::ac] (helo=dude04.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rScGb-0023Za-UQ; Wed, 24 Jan 2024 13:22:05 +0100 Received: from ore by dude04.red.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rScGb-00340k-2p; Wed, 24 Jan 2024 13:22:05 +0100 From: Oleksij Rempel To: Sebastian Reichel , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Srinivas Kandagatla Cc: Oleksij Rempel , kernel@pengutronix.de, linux-kernel@vger.kernel.org, Liam Girdwood , Mark Brown , "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, =?UTF-8?q?S=C3=B8ren=20Andersen?= Subject: [RFC PATCH v1 0/8] Introduction of PSCR Framework and Related Components Date: Wed, 24 Jan 2024 13:21:56 +0100 Message-Id: <20240124122204.730370-1-o.rempel@pengutronix.de> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org changes v2: - rename the framework from PSCR to PSCRR (last R is for Recorder) - extend power on reason header and use it to show detected reason on system start and in sysfs. - remove "unknow" reason - rebase on top of v6.8-rc1 - yaml fixes - zero reason state on boot Hello all, This patch series introduces the Power State Change Reasons (PSCR) tracking framework and its related components into the kernel. The PSCR framework is designed for systems where traditional methods of storing power state change reasons, like PMICs or watchdogs, are inadequate. It provides a structured way to store reasons for system shutdowns and reboots, such as under-voltage or software-triggered events, in non-volatile hardware storage. These changes are critical for systems requiring detailed postmortem analysis and where immediate power-down scenarios limit traditional storage options. The framework also assists bootloaders and early-stage system components in making informed recovery decisions. Oleksij Rempel (8): power: Extend power_on_reason.h for upcoming PSCRR framework dt-bindings: power: reset: add generic PSCRR binding trackers power: reset: Introduce PSCR Recording Framework for Non-Volatile Storage dt-bindings: power: reset: add bindings for NVMEM hardware storing PSCR Data nvmem: provide consumer access to cell size metrics power: reset: add PSCR NVMEM Driver for Recording Power State Change Reasons regulator: set Power State Change Reason before hw_protection_shutdown() thermal: core: Record PSCR before hw_protection_shutdown() .../bindings/power/reset/pscrr-nvmem.yaml | 53 +++ .../bindings/power/reset/pscrr.yaml | 44 +++ drivers/nvmem/core.c | 25 ++ drivers/power/reset/Kconfig | 30 ++ drivers/power/reset/Makefile | 2 + drivers/power/reset/pscrr-nvmem.c | 121 ++++++ drivers/power/reset/pscrr.c | 353 ++++++++++++++++++ drivers/regulator/core.c | 6 + drivers/thermal/thermal_core.c | 3 + include/linux/nvmem-consumer.h | 7 + include/linux/power/power_on_reason.h | 3 + include/linux/pscrr.h | 73 ++++ 12 files changed, 720 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/reset/pscrr-nvmem.yaml create mode 100644 Documentation/devicetree/bindings/power/reset/pscrr.yaml create mode 100644 drivers/power/reset/pscrr-nvmem.c create mode 100644 drivers/power/reset/pscrr.c create mode 100644 include/linux/pscrr.h -- 2.39.2