All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-omap@vger.kernel.org,
	Arthur Demchenkov <spinal.by@gmail.com>,
	Merlijn Wajer <merlijn@wizzup.org>, Pavel Machek <pavel@ucw.cz>,
	Sebastian Reichel <sre@kernel.org>, ruleh <ruleh@gmx.de>
Subject: Re: [PATCH 3/3] Input: omap4-keypad - check state again for lost key-up interrupts
Date: Fri, 6 Mar 2020 11:23:43 -0800	[thread overview]
Message-ID: <20200306192343.GN37466@atomide.com> (raw)
In-Reply-To: <20200306191021.GH217608@dtor-ws>

* Dmitry Torokhov <dmitry.torokhov@gmail.com> [200306 19:11]:
> On Fri, Feb 28, 2020 at 09:12:23AM -0800, Tony Lindgren wrote:
> > We only have partial errata i689 implemented with Commit 6c3516fed7b6
> > ("Input: omap-keypad - fix keyboard debounce configuration"). We are
> > still missing the check for lost key-up interrupts as described in the
> > omap4 silicon errata documentation as Errata ID i689 "1.32 Keyboard Key
> > Up Event Can Be Missed":
> > 
> > "When a key is released for a time shorter than the debounce time,
> >  in-between 2 key press (KP1 and KP2), the keyboard state machine will go
> >  to idle mode and will never detect the key release (after KP1, and also
> >  after KP2), and thus will never generate a new IRQ indicating the key
> >  release."
> > 
> > Let's check the keyboard state with delayed_work after each event. And
> > if the problem state is detect, let's clear all events.
> > 
> > Cc: Arthur Demchenkov <spinal.by@gmail.com>
> > Cc: Merlijn Wajer <merlijn@wizzup.org>
> > Cc: Pavel Machek <pavel@ucw.cz>
> > Cc: Sebastian Reichel <sre@kernel.org>
> > Signed-off-by: Tony Lindgren <tony@atomide.com>
> > ---
> >  drivers/input/keyboard/omap4-keypad.c | 56 ++++++++++++++++++++++++---
> >  1 file changed, 50 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c
> > --- a/drivers/input/keyboard/omap4-keypad.c
> > +++ b/drivers/input/keyboard/omap4-keypad.c
> > @@ -71,6 +71,8 @@ struct omap4_keypad {
> >  	void __iomem *base;
> >  	bool irq_wake_enabled;
> >  	unsigned int irq;
> > +	struct delayed_work key_work;
> > +	struct mutex lock;		/* for key scan */
> 
> I think having threaded interrupt and delayed work together defeats the
> purpose of having threaded interrupt. If you want to add a delay before
> repeating scan I think you can add it directly in
> omap4_keypad_irq_thread_fn(). Or is there a concern that we will not
> rely quickly enough on additional key presses? It is unclear to me if
> additional key press within the debounce time will result in additional
> interrupt.

Well if we wait in threaded interrupt, we won't see a new interrupt.
So yes, an additional key press will still produce an interrupt.

After a key press has been detected, we need to set a timer that checks
the keyboard controller state after it has idled. Then check for a
potentially stuck state, and clear all down events if the state is
idle with keys down.

I don't think we can really use runtime PM autosuspend delay here as we
already keep the device enabled with clock autogated so there's nothing
to do. If we now added runtime PM calls, we'd end up in mode with
clocks completely disabled. Maybe some tinkering of usage counts in
the interrupt handler would allow using PM runtime though :)

Regards,

Tony


  reply	other threads:[~2020-03-06 19:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-28 17:12 [PATCHv2 0/3] Lost key-up interrupt handling for omap4-keypad Tony Lindgren
2020-02-28 17:12 ` [PATCH 1/3] Input: omap4-keypad - configure interrupt as level Tony Lindgren
2020-02-28 17:12 ` [PATCH 2/3] Input: omap4-keypad - disable unused long interrupts Tony Lindgren
2020-02-28 17:12 ` [PATCH 3/3] Input: omap4-keypad - check state again for lost key-up interrupts Tony Lindgren
2020-03-06 19:10   ` Dmitry Torokhov
2020-03-06 19:23     ` Tony Lindgren [this message]
2020-02-28 18:02 ` [PATCHv2 4/3] Input: omap4-keypad - scan the keys in two phases to detect lost key-up Tony Lindgren
2020-03-06 19:04   ` Dmitry Torokhov
2020-03-06 19:09     ` Tony Lindgren
2020-02-28 18:04 ` [PATCHv2 0/3] Lost key-up interrupt handling for omap4-keypad Tony Lindgren
2020-03-18 22:57 [PATCHv3 " Tony Lindgren
2020-03-18 22:57 ` [PATCH 3/3] Input: omap4-keypad - check state again for lost key-up interrupts Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200306192343.GN37466@atomide.com \
    --to=tony@atomide.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=merlijn@wizzup.org \
    --cc=pavel@ucw.cz \
    --cc=ruleh@gmx.de \
    --cc=spinal.by@gmail.com \
    --cc=sre@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.