Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1078066rdb; Wed, 24 Jan 2024 04:24:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IHCBrDbmoBkquPTYhFZKkeoEJpW//bw8TVGkFLptWNRuzeI81MgI5zl4Cp5PbAyx566WPZ2 X-Received: by 2002:a17:90b:154b:b0:28e:8489:c0a1 with SMTP id ig11-20020a17090b154b00b0028e8489c0a1mr3738087pjb.40.1706099057336; Wed, 24 Jan 2024 04:24:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706099057; cv=pass; d=google.com; s=arc-20160816; b=G39OHBZ1U7zECx0E6q91T1KMhl0KeoclOm2ctpRzDTeoz/7l6M/HGLDH5AjxJHWXw/ irT7+EbtP7re0+9sE6BRnk7IpZXSn+XtOD92yI9YpkhPfFBAEKWRxMcnl4b60dQ8ov13 xoJecmsOCrfY/VpXxnXsCzF39m2e+K9Na5NP854SHwvFfwlH1ifRTgNld+wgCwKoFdA6 zS1ONdc56fEjVJU0nJA97F1szJcS4luowRmdgP+HW0dKxR2mmo1WJR5SAFrw8BPmzYUp 457dtNuMpzWpAxtjdnQRLuEgtYBIiSnuBHhSOGeDIJPLzmWaTh//kHIPeZWyq3l1qoH6 UqXQ== 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:references:in-reply-to:message-id :date:subject:cc:to:from; bh=+zDQv++RLCalS6ktCQpPxsGWt6H9QW/h/MsAabbtMHA=; fh=0BN2nRYNwwsdS1La2xjSUQ73DGvrm/moKRrAYVYJiBo=; b=tHV415pErda8z2vIYnDISkY17zAC4Dv3EL4974PVirWDPpN+6ZUpBJzL12PM7MphJ2 pXNilSyfr/SGuuOA/Kgs9KG2Rc8JjqW50VDATvvKAFAuBK81a6trLZnWv071k9uhsjeY ruI3m6I0IskjlimvCf9IEbBz83Ix160NLjaP+zbQzVqPfpchlHWntpmV618oSP4sm5Lr lGlP66OrApLU64sinljuW7zmsfZHx+HiIjc7Ke3JaYF4hixEM8rc78Z6JhvYo/wnJtrD aHzXKwYFxvP1QAs+vbAG6+WWISdQfMaI/ZtldjMEYXL7MzEKCywa9/u6uyPX4RWHofVr 6eAw== 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-36967-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36967-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id rm5-20020a17090b3ec500b0028bbcd027aasi11663674pjb.94.2024.01.24.04.24.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 04:24:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-36967-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-36967-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36967-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 A6BF92864FD for ; Wed, 24 Jan 2024 12:23:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1E829657A5; Wed, 24 Jan 2024 12:22:31 +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 71C5563115 for ; Wed, 24 Jan 2024 12:22:26 +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=mPa4qi0OZ4CP+9x7k/roe38uYFYYp/LJ2+GA+iIHCFMc4v6jMlWA7PDP3Pxbhm/5GxD2z+MsNyuQ0l2ZriJpraYotFscaV7uGKPZXlU1rFlBgYOYkDS7znZ9nPbHmAFFt85UcWpQpQd3dI1zLa6lzteGaseLz/3ps6LIERjiaok= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706098947; c=relaxed/simple; bh=aGoYIr6WP6qwdiccu6/EeWFB5o3ysjwmHOnTwOOjDkQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=nuj45cf7S8gTkReo0J6H0v2X90+t1WEt230ZfBBFe62t0eFTWjGFXQuJIJKI8n8BZ14nbvve6jlD2eviJlXbxx3rkCCDBrpwCHXu9oAmQ7asVVrb5lM+lVDFRECuG9inwIOe8yOjVx/P+4pLdRbrUH60KxaPj6clb8bGME6f3IA= 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-0007oB-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 1rScGc-0023Zk-2z; Wed, 24 Jan 2024 13:22:06 +0100 Received: from ore by dude04.red.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rScGc-00341u-00; Wed, 24 Jan 2024 13:22:06 +0100 From: Oleksij Rempel To: Sebastian Reichel , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Srinivas Kandagatla Cc: Oleksij Rempel , Mark Brown , kernel@pengutronix.de, linux-kernel@vger.kernel.org, Liam Girdwood , "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: [PATCH v2 7/8] regulator: set Power State Change Reason before hw_protection_shutdown() Date: Wed, 24 Jan 2024 13:22:03 +0100 Message-Id: <20240124122204.730370-8-o.rempel@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240124122204.730370-1-o.rempel@pengutronix.de> References: <20240124122204.730370-1-o.rempel@pengutronix.de> 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 Store the state change reason to some black box, for later investigation. Signed-off-by: Oleksij Rempel Reviewed-by: Mark Brown --- drivers/regulator/core.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index a968dabb48f5..a811a5ff2273 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -5095,6 +5096,7 @@ EXPORT_SYMBOL_GPL(regulator_bulk_free); static void regulator_handle_critical(struct regulator_dev *rdev, unsigned long event) { + enum pscr pscr; const char *reason = NULL; if (!rdev->constraints->system_critical) @@ -5103,17 +5105,21 @@ static void regulator_handle_critical(struct regulator_dev *rdev, switch (event) { case REGULATOR_EVENT_UNDER_VOLTAGE: reason = "System critical regulator: voltage drop detected"; + pscr = PSCR_UNDER_VOLTAGE; break; case REGULATOR_EVENT_OVER_CURRENT: reason = "System critical regulator: over-current detected"; + pscr = PSCR_OVER_CURRENT; break; case REGULATOR_EVENT_FAIL: reason = "System critical regulator: unknown error"; + pscr = PSCR_REGULATOR_FAILURE; } if (!reason) return; + set_power_state_change_reason(pscr); hw_protection_shutdown(reason, rdev->constraints->uv_less_critical_window_ms); } -- 2.39.2