public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: linux-arm-kernel@lists.arm.linux.org.uk
Cc: linux-omap@vger.kernel.org, Eero Nurkkala <ext-eero.nurkkala@nokia.com>
Subject: [PATCH 4/9] OMAP: GPIO: Avoid generating extra IRQs
Date: Tue, 11 Aug 2009 12:50:32 +0300	[thread overview]
Message-ID: <20090811095032.32577.69831.stgit@localhost> (raw)
In-Reply-To: <20090811094348.32577.81307.stgit@localhost>

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.

Signed-off-by: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
Signed-off-by: Tony Lindgren <tony@atomide.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 555bab0..19d4dfb 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);
+
+		/* 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


-------------------------------------------------------------------
List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel
FAQ:        http://www.arm.linux.org.uk/mailinglists/faq.php
Etiquette:  http://www.arm.linux.org.uk/mailinglists/etiquette.php

  parent reply	other threads:[~2009-08-11  9:50 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-11  9:45 [PATCH 0/9] Omap updates for upcoming 2.6.32 merge window Tony Lindgren
2009-08-11  9:46 ` [PATCH 1/9] OMAP: remove OMAP_TAG_SERIAL_CONSOLE Tony Lindgren
2009-08-13  9:15   ` Russell King - ARM Linux
2009-08-11  9:47 ` [PATCH 2/9] OMAP: remove OMAP_TAG_UART Tony Lindgren
2009-08-13  9:16   ` Russell King - ARM Linux
2009-08-24 12:54     ` [PATCH 2/9] OMAP: remove OMAP_TAG_UART, v2 Tony Lindgren
2009-08-11  9:49 ` [PATCH 3/9] OMAP: Remove omap boot parsing code Tony Lindgren
2009-08-13  9:16   ` Russell King - ARM Linux
2009-08-11  9:50 ` Tony Lindgren [this message]
2009-08-13  9:17   ` [PATCH 4/9] OMAP: GPIO: Avoid generating extra IRQs Russell King - ARM Linux
2009-08-11  9:51 ` [PATCH 5/9] OMAP1: AMS_DELTA: add modem support Tony Lindgren
2009-08-18 13:19   ` Janusz Krzysztofik
2009-08-24 12:51     ` Tony Lindgren
2009-08-11  9:53 ` [PATCH 6/9] OMAP2/3: Add support for flash on SDP boards Tony Lindgren
2009-08-11 14:33   ` vimal singh
2009-08-12 11:30     ` Tony Lindgren
2009-08-12 11:41       ` vimal singh
2009-08-12 11:44         ` Tony Lindgren
2009-08-11  9:54 ` [PATCH 7/9] OMAP2: compile usb-tusb6010.c Tony Lindgren
2009-08-13  9:18   ` Russell King - ARM Linux
2009-08-11  9:55 ` [PATCH 8/9] OMAP2: add board file for Nokia N800 and N810 Tony Lindgren
2009-08-13  9:15   ` Russell King - ARM Linux
2009-08-14  6:01     ` Kalle Valo
2009-08-14 11:08       ` Tony Lindgren
2009-08-15  6:28         ` Kalle Valo
2009-08-15  7:38         ` Kalle Valo
2009-08-15  7:44           ` [PATCH v2] " Kalle Valo
2009-08-16 15:03             ` Tony Lindgren
2009-08-24 12:57               ` [PATCH v2] OMAP2: add board file for Nokia N800 and N810, v3 Tony Lindgren
2009-08-11  9:57 ` [PATCH 9/9] OMAP2: n8x0: add n8x0_defconfig Tony Lindgren
2009-08-13  9:18   ` Russell King - ARM Linux

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=20090811095032.32577.69831.stgit@localhost \
    --to=tony@atomide.com \
    --cc=ext-eero.nurkkala@nokia.com \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --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