On 03/06/2021 07:40, Matti Vaittinen wrote: > There can be few cases when we need to shut-down the system in order to > protect the hardware. Currently this is done at least by the thermal core > when temperature raises over certain limit. > > Some PMICs can also generate interrupts for example for over-current or > over-voltage, voltage drops, short-circuit, ... etc. On some systems > these are a sign of hardware failure and only thing to do is try to > protect the rest of the hardware by shutting down the system. > > Add shut-down logic which can be used by all subsystems instead of > implementing the shutdown in each subsystem. The logic is stolen from > thermal_core with difference of using atomic_t instead of a mutex in > order to allow calls directly from IRQ context and changing the WARN() > to pr_emerg() as discussed here: > https://lore.kernel.org/lkml/YJuPwAZroVZ%2Fw633@alley/ > and here: > https://lore.kernel.org/linux-iommu/20210331093104.383705-4-geert+renesas@xxxxxxxxx/ > > Signed-off-by: Matti Vaittinen <matti.vaittinen@xxxxxxxxxxxxxxxxx> Acked-by: Daniel Lezcano <daniel.lezcano@xxxxxxxxxx> -- <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