Re: [PATCH v2 4/4] input: misc: rt5120: Add power key support

From: ChiYuan Huang
Date: Sun Jul 10 2022 - 23:43:58 EST


Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx> 於 2022年7月9日 週六 中午12:53寫道:
>
> Hi ChiYuan,
>
> On Wed, Jun 22, 2022 at 06:01:44PM +0800, cy_huang wrote:
> > +
> > + is_pressed = !(stat & RT5120_PWRKEYSTAT_MASK);
> > +
> > + if ((is_pressed && irq == priv->press_irq) ||
> > + (!is_pressed && irq == priv->release_irq)) {
> > + input_report_key(priv->input, KEY_POWER, is_pressed);
> > + input_sync(priv->input);
> > + }
> > +
>
> What is the reason for checking both the status and interrupt? Can we
> simply say:
>
Just to make sure 'press/release' to matche the current state.
In the IC design, it already guarantee press/release interrupt with 50
millisecond debounce time.
But if irq is delayed handling, press and release irq will all be checked.
Although irq is one by one, but in that case, pwrkey button up will be
reported twice.
I'm not sure whether this case exists or not.
>
> input_report_key(priv->input, KEY_POWER,
> !(stat & RT5120_PWRKEYSTAT_MASK));
> input_sync(priv->input);
>
> ?
>
Yes, but how about the above comment? Is that case 'don't care'?
> Thanks.
>
> --
> Dmitry