This patch is to detect any level-triggered eint as wakeup source.
If so, mask these interrupts and ack the pending interrupts.

Matt

From: Matt Hsu <[EMAIL PROTECTED]>
Date: Thu, 13 Nov 2008 18:44:16 +0800

 This patch is to detect any level-triggered eint as wakeup source.
 If so, mask these interrupts and ack the pending interrupts.

---
 arch/arm/plat-s3c24xx/include/plat/pm.h |    1 +
 arch/arm/plat-s3c24xx/pm.c              |   10 ++++++++++
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/arch/arm/plat-s3c24xx/include/plat/pm.h b/arch/arm/plat-s3c24xx/include/plat/pm.h
index c384d02..0d43421 100644
--- a/arch/arm/plat-s3c24xx/include/plat/pm.h
+++ b/arch/arm/plat-s3c24xx/include/plat/pm.h
@@ -31,6 +31,7 @@ static inline int s3c2410_pm_init(void)
 /* configuration for the IRQ mask over sleep */
 extern unsigned long s3c_irqwake_intmask;
 extern unsigned long s3c_irqwake_eintmask;
+extern unsigned long s3c_irqresume_eintmask;
 
 /* IRQ masks for IRQs allowed to go to sleep (see irq.c) */
 extern unsigned long s3c_irqwake_intallow;
diff --git a/arch/arm/plat-s3c24xx/pm.c b/arch/arm/plat-s3c24xx/pm.c
index bc37cf4..89245d6 100644
--- a/arch/arm/plat-s3c24xx/pm.c
+++ b/arch/arm/plat-s3c24xx/pm.c
@@ -771,6 +771,16 @@ static int s3c2410_pm_enter(suspend_state_t state)
 	s3c2410_pm_do_restore(uart_save, ARRAY_SIZE(uart_save));
 	s3c2410_pm_restore_gpios();
 
+	/* mask any level interrupts which are wakeup source
+	 * to avoid irq storm */
+
+	if (s3c_irqresume_eintmask) {
+		__raw_writel(__raw_readl(S3C24XX_EINTMASK) |
+					s3c_irqresume_eintmask, S3C24XX_EINTMASK);
+		__raw_writel(__raw_readl(S3C2410_EINTPEND), S3C2410_EINTPEND);
+		__raw_writel(__raw_readl(S3C2410_SRCPND), S3C2410_SRCPND);
+	}
+
 	s3c2410_pm_debug_init();
 
 	/* check what irq (if any) restored the system */
-- 
1.5.5.1

Reply via email to