mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Faruque Ansari <faruque.ansari@oss.qualcomm.com>
To: Matti Vaittinen <mazziesaccount@gmail.com>,
	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>,
	"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>
Cc: 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 4/6] reboot: extend psc_reason with power-on and reset causes
Date: Wed, 23 Sep 2026 16:35:50 +0530	[thread overview]
Message-ID: <f0eef0f2-bd56-47e1-a3e5-5e83a1680c02@oss.qualcomm.com> (raw)
In-Reply-To: <9ba75a42-a3cb-4ee2-bd29-84f23bbaa70c@gmail.com>


Hi Matti Vaittinen,

On 22-Sep-26 1:15 PM, Matti Vaittinen wrote:
> On 21/09/2026 20:44, Faruque Ansari wrote:
>> psc_reason covered only the protection reasons. Extend it to 
>> mirror the
>> full POWER_ON_REASON_* vocabulary - power-on, watchdog, software,
>> external, RTC, reset button, CPU clock and crystal failures - so a
>> provider can report why the system last powered on, not only 
>> why it was
>> shut down. New values are appended to keep the existing numeric 
>> ABI.
>>
>> 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>
>>
>> changes v12:
>> - new patch
>> ---
>>   include/linux/reboot.h | 28 ++++++++++++++++++++++++++++
>>   kernel/reboot.c        |  8 ++++++++
>>   2 files changed, 36 insertions(+)
>>
>> diff --git a/include/linux/reboot.h b/include/linux/reboot.h
>> index 4c5327dd7645..13f004ad1066 100644
>> --- a/include/linux/reboot.h
>> +++ b/include/linux/reboot.h
>> @@ -225,9 +225,28 @@ extern void orderly_reboot(void);
>>    *    management errors, or an unrecoverable hardware fault 
>> requiring
>>    *    immediate response.
>>    *
>> + * @PSCR_POWER_ON: Regular cold power-on (e.g. via a PMIC 
>> power-on request).
>> + *
>> + * @PSCR_WATCHDOG: Reset caused by a watchdog timeout.
>> + *
>> + * @PSCR_SOFTWARE: Software-initiated reset or reboot.
>> + *
>> + * @PSCR_EXTERNAL: Reset asserted through an external pin or 
>> reset input.
>> + *
>> + * @PSCR_RTC: Wake-up or power-on triggered by the RTC.
>> + *
>> + * @PSCR_RESET_BUTTON: Reset triggered by a user reset button.
>> + *
>> + * @PSCR_CPU_CLK_FAIL: Reset caused by a CPU clock failure.
>> + *
>> + * @PSCR_XTAL_FAIL: Reset caused by a crystal oscillator failure.
>> + *
>>    * @PSCR_REASON_COUNT: Number of defined power state change 
>> reasons. This
>>    *    value is useful for range checking and potential future 
>> extensions
>>    *    while maintaining compatibility.
>> + *
>> + * The reasons mirror the POWER_ON_REASON_* strings in
>> + * <linux/power/power_on_reason.h>; keep the two in sync when 
>> extending.
> 
> (still a nit)
> We should now also ensure the psc_reason_desc[] in reboot.c stays 
> in sync... (See my nits for 3/6). I have a nagging feeling this 
> is not optimal :)

Thanks for the review.
I will address this in patch 3/6.

> 
> Is there a reason for having this as a separate patch and not 
> merged with 3/6? If yes:
> 
Yes, there is a reason.
patch 3/6 introduces the mechanism — the struct, the token/label 
table shape, and the two accessor functions.
patch 4/6 only adds data on top of that — new enum values and 
their matching table rows, nothing else.
Keeping them separate keeps each patch focused on a single 
concern and makes review, bisection, and potential reverts more 
straightforward.

Thanks,
Faruque Ansari

> Reviewed-by: Matti Vaittinen <mazziesaccount@gmail.com>
> 
>>    */
>>   enum psc_reason {
>>       PSCR_UNKNOWN,
>> @@ -236,6 +255,15 @@ enum psc_reason {
>>       PSCR_REGULATOR_FAILURE,
>>       PSCR_OVER_TEMPERATURE,
>>       PSCR_EC_PANIC,
>> +    /* Append new reasons here; the numeric order is ABI. */
>> +    PSCR_POWER_ON,
>> +    PSCR_WATCHDOG,
>> +    PSCR_SOFTWARE,
>> +    PSCR_EXTERNAL,
>> +    PSCR_RTC,
>> +    PSCR_RESET_BUTTON,
>> +    PSCR_CPU_CLK_FAIL,
>> +    PSCR_XTAL_FAIL,
>>       /* Number of reasons */
>>       PSCR_REASON_COUNT,
>> diff --git a/kernel/reboot.c b/kernel/reboot.c
>> index e53fb31bad06..5d4ecc82b35e 100644
>> --- a/kernel/reboot.c
>> +++ b/kernel/reboot.c
>> @@ -1102,6 +1102,14 @@ static const struct psc_reason_desc 
>> psc_reason_descs[] = {
>>       [PSCR_REGULATOR_FAILURE] = { "regulator-failure", 
>> POWER_ON_REASON_REGULATOR_FAILURE },
>>       [PSCR_OVER_TEMPERATURE]     = { "over-temperature",  
>> POWER_ON_REASON_OVER_TEMPERATURE },
>>       [PSCR_EC_PANIC]         = { "ec-panic",      
>> POWER_ON_REASON_EC_PANIC },
>> +    [PSCR_POWER_ON]         = { "power-on",      
>> POWER_ON_REASON_REGULAR },
>> +    [PSCR_WATCHDOG]         = { "watchdog",      
>> POWER_ON_REASON_WATCHDOG },
>> +    [PSCR_SOFTWARE]         = { "software",      
>> POWER_ON_REASON_SOFTWARE },
>> +    [PSCR_EXTERNAL]         = { "external",      
>> POWER_ON_REASON_EXTERNAL },
>> +    [PSCR_RTC]         = { "rtc",          POWER_ON_REASON_RTC },
>> +    [PSCR_RESET_BUTTON]     = { "reset-button",      
>> POWER_ON_REASON_RST_BTN },
>> +    [PSCR_CPU_CLK_FAIL]     = { "cpu-clock-failure", 
>> POWER_ON_REASON_CPU_CLK_FAIL },
>> +    [PSCR_XTAL_FAIL]     = { "crystal-failure",      
>> POWER_ON_REASON_XTAL_FAIL },
>>   };
>>   /**
>>
> 
> 


  reply	other threads:[~2026-09-23 11:06 UTC|newest]

Thread overview: 17+ 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-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 [this message]
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

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=f0eef0f2-bd56-47e1-a3e5-5e83a1680c02@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=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®