From: Tony Lindgren <tony@atomide.com>
To: Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: Peter Ujfalusi <peter.ujfalusi@ti.com>,
Grygorii Strashko <grygorii.strashko@ti.com>,
Aaro Koskinen <aaro.koskinen@iki.fi>, Keerthy <j-keerthy@ti.com>,
Tero Kristo <t-kristo@ti.com>,
linux-gpio@vger.kernel.org,
Russell King <rmk+kernel@armlinux.org.uk>,
Ladislav Michl <ladis@linux-mips.org>,
linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] gpio: gpio-omap: Fix lost edge wake-up interrupts
Date: Wed, 8 May 2019 17:49:51 -0700 [thread overview]
Message-ID: <20190509004951.GT8007@atomide.com> (raw)
In-Reply-To: <20190508204015.GS8007@atomide.com>
* Tony Lindgren <tony@atomide.com> [190508 20:40]:
> * Tony Lindgren <tony@atomide.com> [190508 11:20]:
> > --- a/drivers/gpio/gpio-omap.c
> > +++ b/drivers/gpio/gpio-omap.c
> > @@ -1279,7 +1279,14 @@ static void omap_gpio_idle(struct gpio_bank *bank, bool may_lose_context)
> > void __iomem *base = bank->base;
> > u32 nowake;
> >
> > + /*
> > + * Save datain register to trigger edge interrupts on unidle for GPIOS
> > + * that are not wake-up capable. Ignore any enabled_non_wakeup_gpios
> > + * that may have just triggered as we're entering idle. Otherwise unidle
> > + * will not notice them.
> > + */
> > bank->saved_datain = readl_relaxed(base + bank->regs->datain);
> > + bank->saved_datain |= bank->enabled_non_wakeup_gpios;
>
> Oops, sorry this is not complete yet. We need to enable or clear
> the possible pending interrupt in saved_datain based on the edge
> interrupt polarity. I'll fix and resend.
Below seems to behave for me based on light testing..
Might be worth thinking about this a bit more, anybody got
better ideas? :)
Regards,
Tony
8< --------------------
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -1277,10 +1277,24 @@ static void omap_gpio_idle(struct gpio_bank *bank, bool may_lose_context)
{
struct device *dev = bank->chip.parent;
void __iomem *base = bank->base;
- u32 nowake;
+ u32 mask, nowake;
+ /*
+ * Save datain register to trigger edge interrupts on unidle for GPIOS
+ * that are not wake-up capable. Ignore any enabled_non_wakeup_gpios
+ * that may have just triggered as we're entering idle. Otherwise unidle
+ * will not notice them. Note that this does not help with EDGE_BOTH.
+ */
bank->saved_datain = readl_relaxed(base + bank->regs->datain);
+ mask = bank->enabled_non_wakeup_gpios & bank->context.fallingdetect;
+ mask &= ~bank->context.risingdetect;
+ bank->saved_datain |= mask;
+
+ mask = bank->enabled_non_wakeup_gpios & bank->context.risingdetect;
+ mask &= ~bank->context.fallingdetect;
+ bank->saved_datain &= ~mask;
+
if (!bank->enabled_non_wakeup_gpios)
goto update_gpio_context_count;
--
2.21.0
WARNING: multiple messages have this Message-ID (diff)
From: Tony Lindgren <tony@atomide.com>
To: Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: Peter Ujfalusi <peter.ujfalusi@ti.com>,
Grygorii Strashko <grygorii.strashko@ti.com>,
Aaro Koskinen <aaro.koskinen@iki.fi>, Keerthy <j-keerthy@ti.com>,
Tero Kristo <t-kristo@ti.com>,
linux-gpio@vger.kernel.org,
Russell King <rmk+kernel@armlinux.org.uk>,
Ladislav Michl <ladis@linux-mips.org>,
linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] gpio: gpio-omap: Fix lost edge wake-up interrupts
Date: Wed, 8 May 2019 17:49:51 -0700 [thread overview]
Message-ID: <20190509004951.GT8007@atomide.com> (raw)
In-Reply-To: <20190508204015.GS8007@atomide.com>
* Tony Lindgren <tony@atomide.com> [190508 20:40]:
> * Tony Lindgren <tony@atomide.com> [190508 11:20]:
> > --- a/drivers/gpio/gpio-omap.c
> > +++ b/drivers/gpio/gpio-omap.c
> > @@ -1279,7 +1279,14 @@ static void omap_gpio_idle(struct gpio_bank *bank, bool may_lose_context)
> > void __iomem *base = bank->base;
> > u32 nowake;
> >
> > + /*
> > + * Save datain register to trigger edge interrupts on unidle for GPIOS
> > + * that are not wake-up capable. Ignore any enabled_non_wakeup_gpios
> > + * that may have just triggered as we're entering idle. Otherwise unidle
> > + * will not notice them.
> > + */
> > bank->saved_datain = readl_relaxed(base + bank->regs->datain);
> > + bank->saved_datain |= bank->enabled_non_wakeup_gpios;
>
> Oops, sorry this is not complete yet. We need to enable or clear
> the possible pending interrupt in saved_datain based on the edge
> interrupt polarity. I'll fix and resend.
Below seems to behave for me based on light testing..
Might be worth thinking about this a bit more, anybody got
better ideas? :)
Regards,
Tony
8< --------------------
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -1277,10 +1277,24 @@ static void omap_gpio_idle(struct gpio_bank *bank, bool may_lose_context)
{
struct device *dev = bank->chip.parent;
void __iomem *base = bank->base;
- u32 nowake;
+ u32 mask, nowake;
+ /*
+ * Save datain register to trigger edge interrupts on unidle for GPIOS
+ * that are not wake-up capable. Ignore any enabled_non_wakeup_gpios
+ * that may have just triggered as we're entering idle. Otherwise unidle
+ * will not notice them. Note that this does not help with EDGE_BOTH.
+ */
bank->saved_datain = readl_relaxed(base + bank->regs->datain);
+ mask = bank->enabled_non_wakeup_gpios & bank->context.fallingdetect;
+ mask &= ~bank->context.risingdetect;
+ bank->saved_datain |= mask;
+
+ mask = bank->enabled_non_wakeup_gpios & bank->context.risingdetect;
+ mask &= ~bank->context.fallingdetect;
+ bank->saved_datain &= ~mask;
+
if (!bank->enabled_non_wakeup_gpios)
goto update_gpio_context_count;
--
2.21.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-05-09 0:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-08 18:19 [PATCH] gpio: gpio-omap: Fix lost edge wake-up interrupts Tony Lindgren
2019-05-08 18:19 ` Tony Lindgren
2019-05-08 20:40 ` Tony Lindgren
2019-05-08 20:40 ` Tony Lindgren
2019-05-09 0:49 ` Tony Lindgren [this message]
2019-05-09 0:49 ` 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=20190509004951.GT8007@atomide.com \
--to=tony@atomide.com \
--cc=aaro.koskinen@iki.fi \
--cc=bgolaszewski@baylibre.com \
--cc=grygorii.strashko@ti.com \
--cc=j-keerthy@ti.com \
--cc=ladis@linux-mips.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=peter.ujfalusi@ti.com \
--cc=rmk+kernel@armlinux.org.uk \
--cc=t-kristo@ti.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.