From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Fabio Estevam <festevam@gmail.com>
Cc: rafael@kernel.org, krzysztof.kozlowski+dt@linaro.org,
robh+dt@kernel.org, conor+dt@kernel.org,
linux-pm@vger.kernel.org, devicetree@vger.kernel.org,
Fabio Estevam <festevam@denx.de>
Subject: Re: [PATCH v9 3/3] thermal: thermal_core: Allow rebooting after critical temp
Date: Sun, 1 Oct 2023 19:25:26 +0200 [thread overview]
Message-ID: <3d1c6755-6a8b-d82d-d31d-3a71f83fba96@linaro.org> (raw)
In-Reply-To: <20231001030014.1244633-3-festevam@gmail.com>
On 01/10/2023 05:00, Fabio Estevam wrote:
> From: Fabio Estevam <festevam@denx.de>
>
> Currently, the default mechanism is to trigger a shutdown after the
> critical temperature is reached.
>
> In some embedded cases, such behavior does not suit well, as the board may
> be unattended in the field and rebooting may be a better approach.
>
> The bootloader may also check the temperature and only allow the boot to
> proceed when the temperature is below a certain threshold.
>
> Introduce support for allowing a reboot to be triggered after the
> critical temperature is reached.
>
> If the "critical-action" devicetree property is not found, fall back to
> the shutdown action to preserve the existing default behavior.
>
> If a custom ops->critical exists, then it takes preference over
> critical-actions.
>
> Tested on a i.MX8MM board with the following devicetree changes:
>
> thermal-zones {
> cpu-thermal {
> critical-action = "reboot";
> };
> };
>
> Signed-off-by: Fabio Estevam <festevam@denx.de>
> ---
Sounds good to me
> Changes since v8:
> - Simplify the logic for calling thermal_zone_device_critical_reboot(). (Daniel).
>
> drivers/thermal/thermal_of.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c
> index 1e0655b63259..4d6c22e0ed85 100644
> --- a/drivers/thermal/thermal_of.c
> +++ b/drivers/thermal/thermal_of.c
> @@ -475,6 +475,7 @@ static struct thermal_zone_device *thermal_of_zone_register(struct device_node *
> struct thermal_zone_params tzp = {};
> struct thermal_zone_device_ops *of_ops;
> struct device_node *np;
> + const char *action;
> int delay, pdelay;
> int ntrips, mask;
> int ret;
> @@ -511,6 +512,11 @@ static struct thermal_zone_device *thermal_of_zone_register(struct device_node *
>
> mask = GENMASK_ULL((ntrips) - 1, 0);
>
> + ret = of_property_read_string(np, "critical-action", &action);
> + if (!ret)
> + if (!of_ops->critical && !strcasecmp(action, "reboot"))
> + of_ops->critical = thermal_zone_device_critical_reboot;
> +
> tz = thermal_zone_device_register_with_trips(np->name, trips, ntrips,
> mask, data, of_ops, &tzp,
> pdelay, delay);
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
next prev parent reply other threads:[~2023-10-01 17:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-01 3:00 [PATCH v9 1/3] dt-bindings: thermal-zones: Document critical-action Fabio Estevam
2023-10-01 3:00 ` [PATCH v9 2/3] reboot: Introduce thermal_zone_device_critical_reboot() Fabio Estevam
2023-10-01 17:23 ` Daniel Lezcano
2023-10-01 3:00 ` [PATCH v9 3/3] thermal: thermal_core: Allow rebooting after critical temp Fabio Estevam
2023-10-01 17:25 ` Daniel Lezcano [this message]
2023-10-01 16:48 ` [PATCH v9 1/3] dt-bindings: thermal-zones: Document critical-action Daniel Lezcano
2023-10-01 17:09 ` Daniel Lezcano
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=3d1c6755-6a8b-d82d-d31d-3a71f83fba96@linaro.org \
--to=daniel.lezcano@linaro.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=festevam@denx.de \
--cc=festevam@gmail.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=robh+dt@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).