linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: Doug Anderson <dianders@chromium.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Stephen Boyd <swboyd@chromium.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH v3 1/3] pinctrl: msm: Really mask level interrupts to prevent latching
Date: Thu, 23 Aug 2018 09:57:18 +0200	[thread overview]
Message-ID: <CACRpkdZJ6Xa6Ge8iCkRSUek3S=LFGt710KQxotovZYgGf4qoXA@mail.gmail.com> (raw)
In-Reply-To: <CAD=FV=Uk9XgP+6_4x685E0yM4kS+0HkEFtML+N-nkR6DzFfchQ@mail.gmail.com>

On Thu, Aug 16, 2018 at 10:49 PM Doug Anderson <dianders@chromium.org> wrote:
> On Thu, Aug 16, 2018 at 1:06 PM, Stephen Boyd <swboyd@chromium.org> wrote:
> > The interrupt controller hardware in this pin controller has two status
> > enable bits. The first "normal" status enable bit enables or disables
> > the summary interrupt line being raised when a gpio interrupt triggers
> > and the "raw" status enable bit allows or prevents the hardware from
> > latching an interrupt into the status register for a gpio interrupt.
> > Currently we just toggle the "normal" status enable bit in the mask and
> > unmask ops so that the summary irq interrupt going to the CPU's
> > interrupt controller doesn't trigger for the masked gpio interrupt.
> >
> > For a level triggered interrupt, the flow would be as follows: the pin
> > controller sees the interrupt, latches the status into the status
> > register, raises the summary irq to the CPU, summary irq handler runs
> > and calls handle_level_irq(), handle_level_irq() masks and acks the gpio
> > interrupt, the interrupt handler runs, and finally unmask the interrupt.
> > When the interrupt handler completes, we expect that the interrupt line
> > level will go back to the deasserted state so the genirq code can unmask
> > the interrupt without it triggering again.
> >
> > If we only mask the interrupt by clearing the "normal" status enable bit
> > then we'll ack the interrupt but it will continue to show up as pending
> > in the status register because the raw status bit is enabled, the
> > hardware hasn't deasserted the line, and thus the asserted state latches
> > into the status register again. When the hardware deasserts the
> > interrupt the pin controller still thinks there is a pending unserviced
> > level interrupt because it latched it earlier. This behavior causes
> > software to see an extra interrupt for level type interrupts each time
> > the interrupt is handled.
> >
> > Let's fix this by clearing the raw status enable bit for level type
> > interrupts so that the hardware stops latching the status of the
> > interrupt after we ack it. We don't do this for edge type interrupts
> > because it seems that toggling the raw status enable bit for edge type
> > interrupts causes spurious edge interrupts.
> >
> > Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
> > Cc: Doug Anderson <dianders@chromium.org>
> > Signed-off-by: Stephen Boyd <swboyd@chromium.org>
> > ---
> >  drivers/pinctrl/qcom/pinctrl-msm.c | 24 ++++++++++++++++++++++++
> >  1 file changed, 24 insertions(+)
>
> Reviewed-by: Douglas Anderson <dianders@chromium.org>
>
> NOTE: IMO we should land this fix even if we continue to have debate
> on patch #2 and #3 since this fixes a definite problem.

OK makes sense, I guess I'll queue this for fixes
once v4.19-rc1 is out.

Would be nice to also get Bjorn's buy-in on it!

Yours,
Linus Walleij

  reply	other threads:[~2018-08-23  8:06 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-16 20:06 [PATCH v3 0/3] pinctrl: msm interrupt and muxing fixes Stephen Boyd
2018-08-16 20:06 ` [PATCH v3 1/3] pinctrl: msm: Really mask level interrupts to prevent latching Stephen Boyd
2018-08-16 20:49   ` Doug Anderson
2018-08-23  7:57     ` Linus Walleij [this message]
2018-08-27  3:05   ` Bjorn Andersson
2018-08-29  7:40   ` Linus Walleij
2018-08-29  7:44     ` Linus Walleij
2018-08-16 20:06 ` [PATCH v3 2/3] pinctrl: msm: Mux out gpio function with gpio_request() Stephen Boyd
2018-08-27  3:06   ` Bjorn Andersson
2018-08-29  7:42   ` Linus Walleij
2018-08-16 20:06 ` [PATCH v3 3/3] pinctrl: msm: Configure interrupts as input and gpio mode Stephen Boyd
2018-08-27  3:06   ` Bjorn Andersson
2018-08-29  7:43   ` Linus Walleij
2018-09-12 10:34 ` [PATCH v3 0/3] pinctrl: msm interrupt and muxing fixes Niklas Cassel
2018-10-01 18:46   ` Stephen Boyd
2018-10-01 19:34     ` Niklas Cassel

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='CACRpkdZJ6Xa6Ge8iCkRSUek3S=LFGt710KQxotovZYgGf4qoXA@mail.gmail.com' \
    --to=linus.walleij@linaro.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=dianders@chromium.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=swboyd@chromium.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).