Fix S3C2410 resume irq handling (was Fix s3c_irq_demux_extint8...)

Balaji Rao balajirrao at openmoko.org
Wed Dec 10 08:16:54 CET 2008


On Wed, Dec 10, 2008 at 12:27:08AM +0530, Balaji Rao wrote:
> Hi,
> 
> It was observed that  even after the move to level irq on pcf50633, the
> problem of 'the phone doesn't resume if POWER is pressed during
> transition to standby' remains.
> 

Hi,

Here's a better attempt to solve the problem. This 'ack pending but
masked interrupts' is now moved into irq resuming code - which is where
it should really be. It wastes cpu time sitting in
s3c_irq_demux_extint8.

Ben, what do you think about this patch ?

Signed-off-by: Balaji Rao <balajirrao at openmoko.org>

diff --git a/arch/arm/plat-s3c24xx/irq-pm.c b/arch/arm/plat-s3c24xx/irq-pm.c
index 87bda52..04352bf 100644
--- a/arch/arm/plat-s3c24xx/irq-pm.c
+++ b/arch/arm/plat-s3c24xx/irq-pm.c
@@ -15,6 +15,7 @@
 #include <linux/module.h>
 #include <linux/interrupt.h>
 #include <linux/sysdev.h>
+#include <linux/irq.h>
 
 #include <plat/cpu.h>
 #include <plat/pm.h>
@@ -83,7 +84,9 @@ int s3c24xx_irq_suspend(struct sys_device *dev, pm_message_t state)
 
 int s3c24xx_irq_resume(struct sys_device *dev)
 {
-	unsigned int i;
+	unsigned int i, irq;
+	unsigned long eintpnd;
+	struct irq_desc *desc;
 
 	for (i = 0; i < ARRAY_SIZE(save_extint); i++)
 		__raw_writel(save_extint[i], S3C24XX_EXTINT0 + (i*4));
@@ -94,5 +97,25 @@ int s3c24xx_irq_resume(struct sys_device *dev)
 	s3c_pm_do_restore(irq_save, ARRAY_SIZE(irq_save));
 	__raw_writel(save_eintmask, S3C24XX_EINTMASK);
 
+	/*
+	 * ACK those interrupts which are now masked and pending.
+	 * Level interrupts if not ACKed here, create an interrupt storm
+	 * because they are not handled at all.
+	 */
+
+	eintpnd = __raw_readl(S3C24XX_EINTPEND);
+
+	eintpnd &= save_eintmask;
+	eintpnd &= ~0xff;	/* ignore lower irqs */
+
+	while (eintpnd) {
+		irq = __ffs(eintpnd);
+		eintpnd &= ~(1 << irq);
+
+		irq += (IRQ_EINT4 - 4);
+		desc = irq_to_desc(irq);
+		desc->chip->ack(irq);
+	}
+
 	return 0;
 }



More information about the openmoko-kernel mailing list