From: Tony Lindgren <tony@atomide.com>
To: ext-eero.nurkkala@nokia.com
Cc: linux-omap@vger.kernel.org
Subject: Re: [PATCH] OMAP: GPIO: Avoid generating extra IRQs
Date: Wed, 5 Aug 2009 16:17:03 +0300 [thread overview]
Message-ID: <20090805131703.GG7374@atomide.com> (raw)
In-Reply-To: <1246602393-8812-1-git-send-email-ext-eero.nurkkala@nokia.com>
Hi,
* ext-eero.nurkkala@nokia.com <ext-eero.nurkkala@nokia.com> [090703 09:27]:
> From: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
>
> It is possible for GPIO IRQ lines configured with
> falling edge triggering only to get IRQs at the
> rising edge upon the exit of offmode. And vice
> versa. Prevent such IRQs to arrive by generating
> the IRQ obeying the detection scheme.
Is the situation still the same if we temporarily change the
level lines to edge for the duration of idle? This would allow
waking up even if the line is level.
Also one question below.
> Signed-off-by: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
> ---
> arch/arm/plat-omap/gpio.c | 27 +++++++++++++++++++++++----
> 1 files changed, 23 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
> index 26b387c..7a270c0 100644
> --- a/arch/arm/plat-omap/gpio.c
> +++ b/arch/arm/plat-omap/gpio.c
> @@ -1804,7 +1804,7 @@ void omap2_gpio_resume_after_retention(void)
> return;
> for (i = 0; i < gpio_bank_count; i++) {
> struct gpio_bank *bank = &gpio_bank[i];
> - u32 l;
> + u32 l, gen, gen0, gen1;
>
> if (!(bank->enabled_non_wakeup_gpios))
> continue;
> @@ -1825,14 +1825,33 @@ void omap2_gpio_resume_after_retention(void)
> #endif
> l ^= bank->saved_datain;
> l &= bank->non_wakeup_gpios;
> - if (l) {
> +
> + /*
> + * No need to generate IRQs for the rising edge for gpio IRQs
> + * configured with falling edge only; and vice versa.
> + */
> + gen0 = l & bank->saved_fallingdetect;
> + gen0 &= bank->saved_datain;
> +
> + gen1 = l & bank->saved_risingdetect;
> + gen1 &= ~(bank->saved_datain);
> +
Is the gen0 &= correct or should it also clear the bits?
Also, have you checked the code flow on omap1 when l, gen, gen0 & gen1
are not initialized? Just wondering ;)
Tony
> + /* FIXME: Consider GPIO IRQs with level detections properly! */
> + gen = l & (~(bank->saved_fallingdetect) &
> + ~(bank->saved_risingdetect));
> + /* Consider all GPIO IRQs needed to be updated */
> + gen |= gen0 | gen1;
> +
> + if (gen) {
> u32 old0, old1;
> #if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \
> defined(CONFIG_ARCH_OMAP4)
> old0 = __raw_readl(bank->base + OMAP24XX_GPIO_LEVELDETECT0);
> old1 = __raw_readl(bank->base + OMAP24XX_GPIO_LEVELDETECT1);
> - __raw_writel(old0 | l, bank->base + OMAP24XX_GPIO_LEVELDETECT0);
> - __raw_writel(old1 | l, bank->base + OMAP24XX_GPIO_LEVELDETECT1);
> + __raw_writel(old0 | gen, bank->base +
> + OMAP24XX_GPIO_LEVELDETECT0);
> + __raw_writel(old1 | gen, bank->base +
> + OMAP24XX_GPIO_LEVELDETECT1);
> __raw_writel(old0, bank->base + OMAP24XX_GPIO_LEVELDETECT0);
> __raw_writel(old1, bank->base + OMAP24XX_GPIO_LEVELDETECT1);
> #endif
> --
> 1.6.0.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2009-08-05 13:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-03 6:26 [PATCH] OMAP: GPIO: Avoid generating extra IRQs ext-eero.nurkkala
2009-08-05 13:17 ` Tony Lindgren [this message]
2009-08-05 14:41 ` ext-Eero.Nurkkala
2009-08-05 15:15 ` Tony Lindgren
2009-08-05 17:56 ` ext-Eero.Nurkkala
2009-08-10 16:10 ` [APPLIED] " 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=20090805131703.GG7374@atomide.com \
--to=tony@atomide.com \
--cc=ext-eero.nurkkala@nokia.com \
--cc=linux-omap@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox