From: Kent Gibson <warthog618@gmail.com>
To: Markus Mirevik <markus.mirevik@dpsolutions.se>
Cc: "linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>
Subject: Re: Sv: GPIO level IRQ fires twice each time.
Date: Mon, 24 Jan 2022 15:20:06 +0800 [thread overview]
Message-ID: <20220124072006.GA27170@sol> (raw)
In-Reply-To: <HE1PR04MB310027275C077FFA647E93CAE65E9@HE1PR04MB3100.eurprd04.prod.outlook.com>
On Mon, Jan 24, 2022 at 07:12:31AM +0000, Markus Mirevik wrote:
> > On Fri, Jan 21, 2022 at 09:03:43AM +0000, Markus Mirevik wrote:
> > > I have a problem with a custom bord based on SoC am335x and a driver
> > utilizing a GPIO line for interrupts.
> > >
> > > I have two mcp2518fd chip connected on one SPI line and everything
> > works, but it's hogs a lot of CPU.
> > > In the current setup only one chip is connected and it only receives packets.
> > >
> > > The mcp2518fd is connected with 2 interrupt lines one "main" and one for
> > rx frames.
> > >
> > > The problem is that for every frame received the interrupt handler is run
> > twice, which is kind of expensive since it's a SPI call to the chip to check
> > interrupt registers.
> > >
> > > To me it looks like the interrupt is fired again as soon as it's unmasked.
> > Either because it's queued? or maybe not cleared internally?
> > > I have scoped the interrupt signal and its real good without any glitches.
> > >
> > > I'm currently running a yocto build:
> > > Linux botekcc 5.10.79-yocto-tiny #1 SMP Tue Nov 16 03:57:43 UTC 2021
> > > armv7l armv7l armv7l GNU/Linux
> > >
> > > But the mcp251xfd driver is from net-next/master
> > >
> > > mcp251xfd_irq is the irqhandler for the mcp2518fd and is added like this:
> > > err = request_threaded_irq(spi->irq, NULL, mcp251xfd_irq,
> > > IRQF_SHARED | IRQF_ONESHOT,
> > > dev_name(&spi->dev), priv);
> > >
> >
> > You haven't set a IRQF_TRIGGER flag, so you are getting the "as-already-
> > configured" behaviour, which on your setup is both edges?
> > Try adding IRQF_TRIGGER_RISING, IRQF_TRIGGER_FALLING,
> > IRQF_TRIGGER_HIGH or IRQF_TRIGGER_LOW, as appropriate to your use
> > case, to your flags.
> >
> > Cheers,
> > Kent.
>
> I have tried with the IRQF_TRIGGGER_LOW flag as well. With same result. i.e the interrupt is fired again as soon as the handler is ready. Even if the interrupt line is deactivated.
> However if I change the trigger to edge falling the interrupt will only fire once. But his will inevitably lead to a missed edge eventually.
>
Why is a missed edge inevitable?
Cheers,
Kent.
next prev parent reply other threads:[~2022-01-24 7:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-21 9:03 GPIO level IRQ fires twice each time Markus Mirevik
2022-01-22 23:59 ` Kent Gibson
2022-01-24 7:12 ` Sv: " Markus Mirevik
2022-01-24 7:20 ` Kent Gibson [this message]
2022-01-24 7:56 ` Lars-Peter Clausen
2022-01-24 7:58 ` Lars-Peter Clausen
2022-03-30 13:19 ` Grygorii Strashko
2022-04-14 8:39 ` Sv: " Markus Mirevik
2022-11-22 17:12 ` Markus Schneider-Pargmann
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=20220124072006.GA27170@sol \
--to=warthog618@gmail.com \
--cc=linux-gpio@vger.kernel.org \
--cc=markus.mirevik@dpsolutions.se \
/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.