* [RFC PATCH] thermal: rzg3e: Propagate reset assertion failure from suspend
@ 2026-08-28 9:21 Pengpeng Hou
2026-09-28 16:36 ` Daniel Lezcano
2026-09-29 11:57 ` Daniel Lezcano
0 siblings, 2 replies; 4+ messages in thread
From: Pengpeng Hou @ 2026-08-28 9:21 UTC (permalink / raw)
To: John Madieu, Rafael J . Wysocki
Cc: Pengpeng Hou, Daniel Lezcano, Zhang Rui, Lukasz Luba,
Philipp Zabel, linux-pm, linux-kernel
rzg3e_thermal_suspend() powers off an active sensor and then ignores
failure to assert its reset. System sleep can therefore continue
without the clean reset state expected by resume.
Return the reset error and, when the sensor had been active, try to
restore power before failing suspend. This remains an RFC because a
reset assertion failure can represent partial hardware state and the
preferred recovery policy needs platform confirmation.
The issue was identified via static analysis and manually reviewed.
Assisted-by: LLM
Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
---
drivers/thermal/renesas/rzg3e_thermal.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/thermal/renesas/rzg3e_thermal.c b/drivers/thermal/renesas/rzg3e_thermal.c
index c44f5b8858d0..7686a45341b3 100644
--- a/drivers/thermal/renesas/rzg3e_thermal.c
+++ b/drivers/thermal/renesas/rzg3e_thermal.c
@@ -499,15 +499,19 @@ static int rzg3e_thermal_runtime_resume(struct device *dev)
static int rzg3e_thermal_suspend(struct device *dev)
{
struct rzg3e_thermal_priv *priv = dev_get_drvdata(dev);
+ bool active = pm_runtime_active(dev);
+ int ret;
/* If device is active, power it off */
- if (pm_runtime_active(dev))
+ if (active)
rzg3e_thermal_power_off(priv);
/* Assert reset to ensure clean state after resume */
- reset_control_assert(priv->rstc);
+ ret = reset_control_assert(priv->rstc);
+ if (ret && active)
+ rzg3e_thermal_power_on(priv);
- return 0;
+ return ret;
}
static int rzg3e_thermal_resume(struct device *dev)
--
2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC PATCH] thermal: rzg3e: Propagate reset assertion failure from suspend
2026-08-28 9:21 [RFC PATCH] thermal: rzg3e: Propagate reset assertion failure from suspend Pengpeng Hou
@ 2026-09-28 16:36 ` Daniel Lezcano
2026-09-29 10:39 ` claudiu beznea
2026-09-29 11:57 ` Daniel Lezcano
1 sibling, 1 reply; 4+ messages in thread
From: Daniel Lezcano @ 2026-09-28 16:36 UTC (permalink / raw)
To: Pengpeng Hou, John Madieu, Rafael J . Wysocki
Cc: Daniel Lezcano, Zhang Rui, Lukasz Luba, Philipp Zabel, linux-pm,
linux-kernel
On 8/28/26 11:21, Pengpeng Hou wrote:
> rzg3e_thermal_suspend() powers off an active sensor and then ignores
> failure to assert its reset. System sleep can therefore continue
> without the clean reset state expected by resume.
>
> Return the reset error and, when the sensor had been active, try to
> restore power before failing suspend. This remains an RFC because a
> reset assertion failure can represent partial hardware state and the
> preferred recovery policy needs platform confirmation.
>
> The issue was identified via static analysis and manually reviewed.
>
> Assisted-by: LLM
> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
> ---
> drivers/thermal/renesas/rzg3e_thermal.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/thermal/renesas/rzg3e_thermal.c b/drivers/thermal/renesas/rzg3e_thermal.c
> index c44f5b8858d0..7686a45341b3 100644
> --- a/drivers/thermal/renesas/rzg3e_thermal.c
> +++ b/drivers/thermal/renesas/rzg3e_thermal.c
> @@ -499,15 +499,19 @@ static int rzg3e_thermal_runtime_resume(struct device *dev)
> static int rzg3e_thermal_suspend(struct device *dev)
> {
> struct rzg3e_thermal_priv *priv = dev_get_drvdata(dev);
> + bool active = pm_runtime_active(dev);
> + int ret;
>
> /* If device is active, power it off */
> - if (pm_runtime_active(dev))
> + if (active)
> rzg3e_thermal_power_off(priv);
>
> /* Assert reset to ensure clean state after resume */
> - reset_control_assert(priv->rstc);
> + ret = reset_control_assert(priv->rstc);
> + if (ret && active)
> + rzg3e_thermal_power_on(priv);
>
> - return 0;
> + return ret;
> }
>
> static int rzg3e_thermal_resume(struct device *dev)
Sounds reasonable
John ?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC PATCH] thermal: rzg3e: Propagate reset assertion failure from suspend
2026-09-28 16:36 ` Daniel Lezcano
@ 2026-09-29 10:39 ` claudiu beznea
0 siblings, 0 replies; 4+ messages in thread
From: claudiu beznea @ 2026-09-29 10:39 UTC (permalink / raw)
To: Daniel Lezcano, Pengpeng Hou, John Madieu, Rafael J . Wysocki
Cc: Daniel Lezcano, Zhang Rui, Lukasz Luba, Philipp Zabel, linux-pm,
linux-kernel
Hi,
On 9/28/26 19:36, Daniel Lezcano wrote:
> On 8/28/26 11:21, Pengpeng Hou wrote:
>> rzg3e_thermal_suspend() powers off an active sensor and then ignores
>> failure to assert its reset. System sleep can therefore continue
>> without the clean reset state expected by resume.
>>
>> Return the reset error and, when the sensor had been active, try to
>> restore power before failing suspend. This remains an RFC because a
>> reset assertion failure can represent partial hardware state and the
>> preferred recovery policy needs platform confirmation.
>>
>> The issue was identified via static analysis and manually reviewed.
>>
>> Assisted-by: LLM
>> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
>> ---
>> drivers/thermal/renesas/rzg3e_thermal.c | 10 +++++++---
>> 1 file changed, 7 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/thermal/renesas/rzg3e_thermal.c b/drivers/thermal/
>> renesas/rzg3e_thermal.c
>> index c44f5b8858d0..7686a45341b3 100644
>> --- a/drivers/thermal/renesas/rzg3e_thermal.c
>> +++ b/drivers/thermal/renesas/rzg3e_thermal.c
>> @@ -499,15 +499,19 @@ static int rzg3e_thermal_runtime_resume(struct device *dev)
>> static int rzg3e_thermal_suspend(struct device *dev)
>> {
>> struct rzg3e_thermal_priv *priv = dev_get_drvdata(dev);
>> + bool active = pm_runtime_active(dev);
>> + int ret;
>> /* If device is active, power it off */
>> - if (pm_runtime_active(dev))
>> + if (active)
>> rzg3e_thermal_power_off(priv);
>> /* Assert reset to ensure clean state after resume */
>> - reset_control_assert(priv->rstc);
>> + ret = reset_control_assert(priv->rstc);
>> + if (ret && active)
>> + rzg3e_thermal_power_on(priv);
>> - return 0;
>> + return ret;
>> }
>> static int rzg3e_thermal_resume(struct device *dev)
>
> Sounds reasonable
>
> John ?
John is not with Renesas anymore. I'll reply myself to this.
The patch looks OK, I consider it is the best we can do to recover from that state.
The reset driver implementation try to do its best as well to recover the reset
line in case the assert fails [1]. However, there is no guarantee the reset
recover will succeed. Still, this looks like the best we can do to recover from
the reset assert failure state.
You can add:
Reviewed-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Thank you,
Claudiu
[1]
https://elixir.bootlin.com/linux/v7.3-rc5/source/drivers/clk/renesas/rzv2h-cpg.c#L1347
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC PATCH] thermal: rzg3e: Propagate reset assertion failure from suspend
2026-08-28 9:21 [RFC PATCH] thermal: rzg3e: Propagate reset assertion failure from suspend Pengpeng Hou
2026-09-28 16:36 ` Daniel Lezcano
@ 2026-09-29 11:57 ` Daniel Lezcano
1 sibling, 0 replies; 4+ messages in thread
From: Daniel Lezcano @ 2026-09-29 11:57 UTC (permalink / raw)
To: Pengpeng Hou, John Madieu, Rafael J . Wysocki
Cc: Daniel Lezcano, Zhang Rui, Lukasz Luba, Philipp Zabel, linux-pm,
linux-kernel
On 8/28/26 11:21, Pengpeng Hou wrote:
> rzg3e_thermal_suspend() powers off an active sensor and then ignores
> failure to assert its reset. System sleep can therefore continue
> without the clean reset state expected by resume.
>
> Return the reset error and, when the sensor had been active, try to
> restore power before failing suspend. This remains an RFC because a
> reset assertion failure can represent partial hardware state and the
> preferred recovery policy needs platform confirmation.
>
> The issue was identified via static analysis and manually reviewed.
>
> Assisted-by: LLM
> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
> ---
Please resend without the RFC prefix and with Claudiu tag
Thanks
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-09-29 11:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-28 9:21 [RFC PATCH] thermal: rzg3e: Propagate reset assertion failure from suspend Pengpeng Hou
2026-09-28 16:36 ` Daniel Lezcano
2026-09-29 10:39 ` claudiu beznea
2026-09-29 11:57 ` Daniel Lezcano
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®