mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Faruque Ansari <faruque.ansari@oss.qualcomm.com>
To: Daniel Lezcano <daniel.lezcano@oss.qualcomm.com>
Cc: Sebastian Reichel <sre@kernel.org>,
	Benson Leung <bleung@chromium.org>,
	Tzung-Bi Shih <tzungbi@kernel.org>,
	Guenter Roeck <groeck@chromium.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	Matti Vaittinen <mazziesaccount@gmail.com>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Daniel Lezcano <daniel.lezcano@kernel.org>,
	Zhang Rui <rui.zhang@intel.com>,
	Lukasz Luba <lukasz.luba@arm.com>,
	Oleksij Rempel <o.rempel@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org, chrome-platform@lists.linux.dev,
	avaneesh.dwivedi@oss.qualcomm.com,
	Umang Chheda <umang.chheda@oss.qualcomm.com>
Subject: Re: [PATCH v14 2/6] reboot: hw_protection_trigger: use standardized numeric shutdown/reboot reasons instead of strings
Date: Mon, 5 Oct 2026 17:57:10 +0530	[thread overview]
Message-ID: <e4ff494b-0321-4d63-b648-1b26f42be2b3@oss.qualcomm.com> (raw)
In-Reply-To: <ar9e9-xnxO8rbJk0@mai.linaro.org>

Hi Daniel Lezcano,

On 02-Oct-26 1:17 PM, Daniel Lezcano wrote:
> On Mon, Sep 21, 2026 at 11:14:17PM +0530, Faruque Ansari wrote:
> 
> [ ... ]
> 
>> +/**
>> + * enum psc_reason - Enumerates reasons for power state changes.
>> + *
>> + * This enum defines various reasons why a system might transition into a
>> + * shutdown, reboot, or kexec state. While originally intended for hardware
>> + * protection events, `psc_reason` can be extended to track other system
>> + * transitions, such as controlled reboots triggered by software or
>> + * maintenance operations.
>> + *
>> + * The values in this enumeration provide structured and standardized
>> + * identifiers that replace free-form string descriptions. They are designed
>> + * to be stored efficiently, making them suitable for use in environments
>> + * with limited storage, such as battery-backed RTC registers, non-volatile
>> + * memory, or bootloader communication mechanisms.
>> + *
>> + * Importantly, the order of these values **must remain stable**, as
>> + * bootloaders, user-space tools, or post-mortem investigation utilities
>> + * may rely on their numerical representation for consistent behavior.
>> + *
>> + * @PSCR_UNKNOWN: Unknown or unspecified reason for the power state change.
>> + *	This value serves as a default when no explicit cause is recorded.
>> + *
>> + * @PSCR_UNDER_VOLTAGE: Shutdown or reboot triggered due to supply voltage
>> + *      dropping below a safe threshold. This helps prevent instability or
>> + *      corruption caused by insufficient power.
>> + *
>> + * @PSCR_OVER_CURRENT: System shutdown or reboot due to excessive current draw,
>> + *      which may indicate a short circuit, an overloaded power rail, or other
>> + *      hardware faults requiring immediate action.
>> + *
>> + * @PSCR_REGULATOR_FAILURE: A critical failure in a voltage regulator, causing
>> + *      improper power delivery. This may be due to internal component failure,
>> + *      transient conditions, or external load issues requiring mitigation.
>> + *
>> + * @PSCR_OVER_TEMPERATURE: System shutdown or reboot due to excessive thermal
>> + *	conditions. This attempts to prevent hardware damage when temperature
>> + *	sensors detect unsafe levels, often impacting CPUs, GPUs, or power
>> + *	components.
>> + *
>> + * @PSCR_EC_PANIC: Shutdown or reboot triggered by an Embedded Controller (EC)
>> + *	panic. The EC is a microcontroller responsible for low-level system
>> + *	management, including power sequencing, thermal control, and battery
>> + *	management. An EC panic may indicate critical firmware issues, power
>> + *	management errors, or an unrecoverable hardware fault requiring
>> + *	immediate response.
>> + *
>> + * @PSCR_REASON_COUNT: Number of defined power state change reasons. This
>> + *	value is useful for range checking and potential future extensions
>> + *	while maintaining compatibility.
>> + */
>> +enum psc_reason {
>> +	PSCR_UNKNOWN,
>> +	PSCR_UNDER_VOLTAGE,
>> +	PSCR_OVER_CURRENT,
>> +	PSCR_REGULATOR_FAILURE,
>> +	PSCR_OVER_TEMPERATURE,
>> +	PSCR_EC_PANIC,
>> +
>> +	/* Number of reasons */
>> +	PSCR_REASON_COUNT,
>> +};
>> +
>> +#define PSCR_MAX_REASON	(PSCR_REASON_COUNT - 1)
> 
> May be I missed it but where is PSCR_MAX_REASON used in this series?

Ack. Agree, PSCR_MAX_REASON is not used anywhere in this series. 
It appears to be a leftover from an earlier revision. I'll remove 
it in the next version. Thanks for catching that.

> [ ... ]
> 
>> +/**
>> + * psc_reason_to_str - Converts a power state change reason enum to a string.
>> + * @reason: The `psc_reason` enum value to be converted.
>> + *
>> + * This function provides a human-readable string representation of the power
>> + * state change reason, making it easier to interpret logs and debug messages.
>> + *
>> + * Return:
>> + * - A string corresponding to the given `psc_reason` value.
>> + * - `"Invalid"` if the value is not recognized.
>> + */
>> +const char *psc_reason_to_str(enum psc_reason reason)
>> +{
>> +	if (reason < 0 || reason >= PSCR_REASON_COUNT)
>> +		return "Invalid";
> 
> s/Invalid/Invalid reason/
> 
> [ ... ]

Ack. I'll fix it in the next revision.

Thanks,
Faruque Ansari

> With that fixed you can add:
> 
> Reviewed-by: Daniel Lezcano <daniel.lezcano@oss.qualcomm.com>


  reply	other threads:[~2026-10-05 12:27 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-21 17:44 [PATCH v14 0/6] power: reset: Introduce the Power State Change Reasons Recording (PSCRR) framework Faruque Ansari
2026-09-21 17:44 ` [PATCH v14 1/6] power: Extend power_on_reason.h for upcoming PSCRR framework Faruque Ansari
2026-09-22  6:02   ` Matti Vaittinen
2026-09-21 17:44 ` [PATCH v14 2/6] reboot: hw_protection_trigger: use standardized numeric shutdown/reboot reasons instead of strings Faruque Ansari
2026-10-02  7:47   ` Daniel Lezcano
2026-10-05 12:27     ` Faruque Ansari [this message]
2026-09-21 17:44 ` [PATCH v14 3/6] reboot: add parsable tokens for power state change reasons Faruque Ansari
2026-09-22  7:37   ` Matti Vaittinen
2026-09-23 11:05     ` Faruque Ansari
2026-09-21 17:44 ` [PATCH v14 4/6] reboot: extend psc_reason with power-on and reset causes Faruque Ansari
2026-09-22  7:45   ` Matti Vaittinen
2026-09-23 11:05     ` Faruque Ansari
2026-09-21 17:44 ` [PATCH v14 5/6] power: reset: Introduce PSCR Recording Framework for Non-Volatile Storage Faruque Ansari
2026-09-22  9:03   ` Matti Vaittinen
2026-09-23 11:06     ` Faruque Ansari
2026-09-21 17:44 ` [PATCH v14 6/6] Documentation: Add sysfs documentation for PSCRR Faruque Ansari
2026-09-22  9:12   ` Matti Vaittinen
2026-09-22  6:33 ` [PATCH v14 0/6] power: reset: Introduce the Power State Change Reasons Recording (PSCRR) framework Bradley Morgan
2026-09-22  6:44   ` Faruque Ansari
2026-09-24  7:08 ` [PATCH v15 " Faruque Ansari
2026-09-24  7:08   ` [PATCH v15 1/6] power: Extend power_on_reason.h for upcoming PSCRR framework Faruque Ansari
2026-10-01 20:22     ` Daniel Lezcano
2026-10-02  4:22       ` Oleksij Rempel
2026-10-02  7:07     ` Daniel Lezcano
2026-09-24  7:08   ` [PATCH v15 2/6] reboot: hw_protection_trigger: use standardized numeric shutdown/reboot reasons instead of strings Faruque Ansari
2026-09-24  7:08   ` [PATCH v15 3/6] reboot: add parsable tokens for power state change reasons Faruque Ansari
2026-10-02  7:53     ` Daniel Lezcano
2026-09-24  7:08   ` [PATCH v15 4/6] reboot: extend psc_reason with power-on and reset causes Faruque Ansari
2026-09-24 12:14     ` Matti Vaittinen
2026-09-24  7:08   ` [PATCH v15 5/6] power: reset: Introduce PSCR Recording Framework for Non-Volatile Storage Faruque Ansari
2026-10-02  9:06     ` Daniel Lezcano
2026-10-05 12:26       ` Faruque Ansari
2026-09-24  7:08   ` [PATCH v15 6/6] Documentation: Add sysfs documentation for PSCRR Faruque Ansari
2026-09-25 17:34 ` [PATCH v14 0/6] power: reset: Introduce the Power State Change Reasons Recording (PSCRR) framework Bradley Morgan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e4ff494b-0321-4d63-b648-1b26f42be2b3@oss.qualcomm.com \
    --to=faruque.ansari@oss.qualcomm.com \
    --cc=avaneesh.dwivedi@oss.qualcomm.com \
    --cc=bleung@chromium.org \
    --cc=broonie@kernel.org \
    --cc=chrome-platform@lists.linux.dev \
    --cc=daniel.lezcano@kernel.org \
    --cc=daniel.lezcano@oss.qualcomm.com \
    --cc=groeck@chromium.org \
    --cc=kernel@pengutronix.de \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=mazziesaccount@gmail.com \
    --cc=o.rempel@pengutronix.de \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=sre@kernel.org \
    --cc=tzungbi@kernel.org \
    --cc=umang.chheda@oss.qualcomm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®