All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Jeff LaBundy <jeff@labundy.com>
Cc: Tomas Mudrunka <tomas.mudrunka@gmail.com>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Fix freeze in lm8333 i2c keyboard driver
Date: Wed, 26 Apr 2023 16:16:01 -0700	[thread overview]
Message-ID: <ZEmwsViIjUVPZ4Cd@google.com> (raw)
In-Reply-To: <ZEf0RYdD5jhE9JEk@nixie71>

Hi Jeff, Tomas,

On Tue, Apr 25, 2023 at 10:39:49AM -0500, Jeff LaBundy wrote:
> Hi Tomas,
> 
> On Tue, Apr 25, 2023 at 03:00:53PM +0200, Tomas Mudrunka wrote:
> > LM8333 uses gpio interrupt line which is active-low.
> > When interrupt is set to FALLING edge and button is pressed
> > before driver loads, driver will miss the edge and never respond.
> > To fix this we handle ONESHOT LOW interrupt rather than edge.
> > 
> > Signed-off-by: Tomas Mudrunka <tomas.mudrunka@gmail.com>
> > ---
> >  drivers/input/keyboard/lm8333.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/input/keyboard/lm8333.c b/drivers/input/keyboard/lm8333.c
> > index 7457c3220..c5770ebb2 100644
> > --- a/drivers/input/keyboard/lm8333.c
> > +++ b/drivers/input/keyboard/lm8333.c
> > @@ -179,7 +179,7 @@ static int lm8333_probe(struct i2c_client *client)
> >  	}
> >  
> >  	err = request_threaded_irq(client->irq, NULL, lm8333_irq_thread,
> > -				   IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
> > +				   IRQF_TRIGGER_LOW | IRQF_ONESHOT,
> >  				   "lm8333", lm8333);
> >  	if (err)
> >  		goto free_mem;
> 
> Thanks for the patch, but this is a NAK in my opinion.
> 
> First of all, we should not be hard-coding interrupt polarity in the
> first place; that is an existing piece of technical debt in this driver.

Yes, I wonder if the original hardware was limited to the edge
interrupts.

> 
> Second, changing from edge-triggered to level-triggered interrupts runs
> the risk of creating an interrupt storm depending on the time it takes
> the device to deassert the irq following the I2C read and the point at
> which the threaded handler returns. Have you measured this?

IRQF_ONESHOT ensures that the level interrupt is unmasked only when the
threaded handler returns.

> 
> Can we not simply read the interrupt status registers once at start-up
> to clear any pending status? This is essentially what your change does
> anyway, albeit indirectly.
> 

Thanks.

-- 
Dmitry

  parent reply	other threads:[~2023-04-26 23:16 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-25 13:00 [PATCH] Fix freeze in lm8333 i2c keyboard driver Tomas Mudrunka
2023-04-25 15:39 ` Jeff LaBundy
2023-04-25 16:49   ` [PATCH v2] " Tomas Mudrunka
2023-04-27  0:41     ` Jeff LaBundy
2023-04-27  8:13       ` Tomáš Mudruňka
2023-04-27 18:47         ` Jeff LaBundy
2023-04-28 10:09       ` [PATCH v3] " Tomas Mudrunka
2023-04-28 10:20       ` [PATCH v4] " Tomas Mudrunka
2023-05-03  3:02         ` Jeff LaBundy
2023-05-03  8:54           ` Tomáš Mudruňka
2023-05-03 15:32             ` [PATCH v5] " Tomas Mudrunka
2023-05-04  1:44               ` Jeff LaBundy
2023-05-11 23:44                 ` Dmitry Torokhov
2023-05-12 16:54                   ` Jeff LaBundy
2023-05-12 16:55                   ` Tomáš Mudruňka
2023-05-12 17:28                     ` Jeff LaBundy
2023-11-14 12:30                       ` [PATCH v6] " Tomas Mudrunka
2023-12-14  2:24                         ` Jeff LaBundy
2023-12-15 15:56                           ` [PATCH v7] " Tomas Mudrunka
2025-02-19 14:51                             ` Tomas Mudrunka
2023-04-26 23:16   ` Dmitry Torokhov [this message]
2023-04-27  0:27     ` [PATCH] " Jeff LaBundy
2023-04-27  8:19       ` Tomáš Mudruňka
2023-04-27 18:54         ` Jeff LaBundy

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=ZEmwsViIjUVPZ4Cd@google.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=jeff@labundy.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tomas.mudrunka@gmail.com \
    /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.