Re: [PATCH] iio: light: stk3310: Deal with the ps interrupt issue in PM

From: Andy Shevchenko

Date: Mon Apr 27 2026 - 06:01:58 EST


On Mon, Apr 27, 2026 at 05:43:13PM +0800, Miao Li wrote:

> On the Huawei hisi platform, if the STK3311-X chip's PS interrupt

Is it officially spelled form of 'hisi'? I was under impression it should be
spelled as 'HiSi'.

> is configured in "Recommended interrupt mode", the interrupt cannot
> be triggered normally after waking from suspend or hibernation.
>
> In this case, neither disabling and re-enabling the interrupt nor
> resetting the PS threshold register can restore the interrupt to
> normal operation.
>
> if we disable the interrupt in suspend(), then reset the PS threshold
> register and enable the interrupt in resume(), this issue can be fixed.

Sounds like a fix with the Fixes tag being missed.

...

> bool als_enabled;
> bool ps_enabled;
> + bool ps_int_enabled;
> + uint32_t ps_thdl;
> + uint32_t ps_thdh;
> uint32_t ps_near_level;

Use u32 in the fix and add a new (refactoring) change that moves from uintXX_t
to uXX, and all the same to intXX_t to sXX.

> u64 timestamp;
> struct regmap *regmap;

Another potential patch (third one), may be derived from what `pahole` thinks
of all this. I mean that the layout maybe suboptimal, and one can rearrange
the members of the data types to reduce memory footprint.

--
With Best Regards,
Andy Shevchenko