Re: [PATCH] thermal/drivers/tsens: Add suspend to RAM support for tsens

From: Konrad Dybcio
Date: Mon Jan 22 2024 - 09:33:21 EST


On 22.01.2024 11:07, Priyansh Jain wrote:
> Add suspend callback support for tsens which disables tsens interrupts
> in suspend to RAM callback.

Would it not be preferrable to have the "critical overheat", wakeup-
capable interrupts be enabled, even if the system is suspended?

> Add resume callback support for tsens which reinitializes tsens hardware
> and enables back tsens interrupts in resume callback.
>
> Signed-off-by: Priyansh Jain <quic_priyjain@xxxxxxxxxxx>
> ---

[...]


> +
> +int tsens_suspend_common(struct tsens_priv *priv)
> +{
> + switch (pm_suspend_target_state) {
> + case PM_SUSPEND_MEM:
> + if (priv->combo_irq > 0) {
> + disable_irq_nosync(priv->combo_irq);
> + disable_irq_wake(priv->combo_irq);
> + }
> +
> + if (priv->uplow_irq > 0) {
> + disable_irq_nosync(priv->uplow_irq);
> + disable_irq_wake(priv->uplow_irq);
> + }
> +
> + if (priv->crit_irq > 0) {
> + disable_irq_nosync(priv->crit_irq);
> + disable_irq_wake(priv->crit_irq);
> + }
> + break;
> + default:
> + break;
> + }

if (pm_suspend_target_state != PM_SUSPEND_MEM)
return 0;

<rest of the code>

[...]

>
> + /* For saving irq number to re-use later */

This is rather self-explanatory

Konrad