[ARM] 3583/1: AT91RM9200 IRQ suspend/resume support
authorAndrew Victor <andrew@sanpeople.com>
Mon, 19 Jun 2006 14:26:53 +0000 (15:26 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Mon, 19 Jun 2006 14:26:53 +0000 (15:26 +0100)
Patch from Andrew Victor

Added suspend/resume/set_wake support for the AT91RM9200's AIC interrupt
controller.

Signed-off-by: Andrew Victor <andrew@sanpeople.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mach-at91rm9200/irq.c

index cc545b2c4388e1e99febd3677a720f4fdedc698d..70f4d7ac1533cfca40206fc396d7886f186429fe 100644 (file)
@@ -118,11 +118,47 @@ static int at91rm9200_irq_type(unsigned irq, unsigned type)
        return 0;
 }
 
+#ifdef CONFIG_PM
+
+static u32 wakeups;
+static u32 backups;
+
+static int at91rm9200_irq_set_wake(unsigned irq, unsigned value)
+{
+       if (unlikely(irq >= 32))
+               return -EINVAL;
+
+       if (value)
+               wakeups |= (1 << irq);
+       else
+               wakeups &= ~(1 << irq);
+
+       return 0;
+}
+
+void at91_irq_suspend(void)
+{
+       backups = at91_sys_read(AT91_AIC_IMR);
+       at91_sys_write(AT91_AIC_IDCR, backups);
+       at91_sys_write(AT91_AIC_IECR, wakeups);
+}
+
+void at91_irq_resume(void)
+{
+       at91_sys_write(AT91_AIC_IDCR, wakeups);
+       at91_sys_write(AT91_AIC_IECR, backups);
+}
+
+#else
+#define at91rm9200_irq_set_wake        NULL
+#endif
+
 static struct irqchip at91rm9200_irq_chip = {
        .ack            = at91rm9200_mask_irq,
        .mask           = at91rm9200_mask_irq,
        .unmask         = at91rm9200_unmask_irq,
        .set_type       = at91rm9200_irq_type,
+       .set_wake       = at91rm9200_irq_set_wake,
 };
 
 /*