Re: [PATCH v7 2/9] reboot: thermal: Export hardware protection shutdown

From: Vaittinen, Matti
Date: Sat Apr 17 2021 - 04:49:37 EST



On Sat, 2021-04-17 at 06:57 +0200, Daniel Lezcano wrote:
> On 14/04/2021 07:52, Matti Vaittinen wrote:
> > Thermal core contains a logic for safety shutdown. System is
> > attempted to
> > be powered off if temperature exceeds safety limits.
> >
> > Currently this can be also utilized by regulator subsystem as a
> > final
> > protection measure if PMICs report dangerous over-voltage, over-
> > current or
> > over-temperature and if per regulator counter measures fail or do
> > not
> > exist.
> >
> > Move this logic to kernel/reboot.c and export the functionality for
> > other
> > subsystems to use. Also replace the mutex with a spinlock to allow
> > using
> > the function from any context.
> >
> > Also the EMIF bus code has implemented a safety shut-down. EMIF
> > does not
> > attempt orderly_poweroff at all. Thus the EMIF code is not
> > converted to use
> > this new function.
> >
> > Signed-off-by: Matti Vaittinen <matti.vaittinen@xxxxxxxxxxxxxxxxx>
> > ---
> > Changelog
> > v7:
> > - new patch
> >
> > Please note - this patch has received only a minimal amount of
> > testing.
> > (The new API call was tested to shut-down my system at driver probe
> > but
> > no odd corner-cases have been tested).
> >
> > Any testing for thermal shutdown is appreciated.
>
> You can test it easily by enabling the option
> CONFIG_THERMAL_EMULATION
>
> Then in any thermal zone:
>
> Assuming the critical temp is below the one specified in the command:
>
> echo 100000 > /sys/class/thermal/thermal_zone0/emul_temp
>

Thanks Daniel, I will see how that works when I create the next version
:)

Best Regards
Matti Vaittinen