[PATCH 1/5] thermal/drivers/mediatek/lvts: Disable monitor mode during suspend

Hsin-Te Yuan yuanhsinte at chromium.org
Tue Nov 26 23:27:16 PST 2024


On Tue, Nov 26, 2024 at 9:37 PM Nícolas F. R. A. Prado
<nfraprado at collabora.com> wrote:
>
> On Tue, Nov 26, 2024 at 04:00:42PM +0800, Hsin-Te Yuan wrote:
> > On Tue, Nov 26, 2024 at 5:21 AM Nícolas F. R. A. Prado
> > <nfraprado at collabora.com> wrote:
> > >
> > > When configured in filtered mode, the LVTS thermal controller will
> > > monitor the temperature from the sensors and trigger an interrupt once a
> > > thermal threshold is crossed.
> > >
> > > Currently this is true even during suspend and resume. The problem with
> > > that is that when enabling the internal clock of the LVTS controller in
> > > lvts_ctrl_set_enable() during resume, the temperature reading can glitch
> > > and appear much higher than the real one, resulting in a spurious
> > > interrupt getting generated.
> > >
> > This sounds weird to me. On my end, the symptom is that the device
> > sometimes cannot suspend.
> > To be more precise, `echo mem > /sys/power/state` returns almost
> > immediately. I think the irq is more
> > likely to be triggered during suspension.
>
> Hi Hsin-Te,
>
> please also check the first paragraph of the cover letter, and patch 2, that
> should clarify it. But anyway, I can explain it here too:
>
> The issue you observed is caused by two things combined:
> * When returning from resume with filtered mode enabled, the sensor temperature
>   reading can glitch, appearing much higher. (fixed by this patch)
> * Since the Stage 3 threshold is enabled and configured to take the maximum
>   reading from the sensors, it will be triggered by that glitch and bring the
>   system into a state where it can no longer suspend, it will just resume right
>   away. (fixed by patch 2)
>
> So currently, every so often, during resume both these things will happen, and
> any future suspend will resume right away. That's why this was never observed by
> me when testing a single suspend/resume. It only breaks on resume, and only
> affects future suspends, so you need to test multiple suspend/resumes on the
> same run to observe this issue.
>
> And also since both things are needed to cause this issue, if you apply only
> patch 1 or only patch 2, it will already fix the issue.
>
> Hope this clarifies it.
>
> Thanks,
> Nícolas

Thanks for the explanation!

Regards,
Hsin-Te



More information about the Linux-mediatek mailing list