]> err.no Git - linux-2.6/commitdiff
[PATCH] genirq: add irq-wake (power-management) support
authorThomas Gleixner <tglx@linutronix.de>
Thu, 29 Jun 2006 09:24:55 +0000 (02:24 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Thu, 29 Jun 2006 17:26:24 +0000 (10:26 -0700)
Enable platforms to set the irq-wake (power-management) properties of an IRQ.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
include/linux/interrupt.h
kernel/irq/manage.c

index 70741e170114e5f9328553fa9b8eadc1a60fc7ab..db2a63a11633cb9ebdfeb21dc9436b1a23bd92ea 100644 (file)
@@ -36,6 +36,20 @@ extern void free_irq(unsigned int, void *);
 extern void disable_irq_nosync(unsigned int irq);
 extern void disable_irq(unsigned int irq);
 extern void enable_irq(unsigned int irq);
+
+/* IRQ wakeup (PM) control: */
+extern int set_irq_wake(unsigned int irq, unsigned int on);
+
+static inline int enable_irq_wake(unsigned int irq)
+{
+       return set_irq_wake(irq, 1);
+}
+
+static inline int disable_irq_wake(unsigned int irq)
+{
+       return set_irq_wake(irq, 0);
+}
+
 #endif
 
 #ifndef __ARCH_SET_SOFTIRQ_PENDING
index b61784ee78b2adde4c673893c6aeef2914090faf..3ed7aee848651c1924db31da8ba53deb9301b3fc 100644 (file)
@@ -133,6 +133,27 @@ void enable_irq(unsigned int irq)
 }
 EXPORT_SYMBOL(enable_irq);
 
+/**
+ *     set_irq_wake - control irq power management wakeup
+ *     @irq:   interrupt to control
+ *     @on:    enable/disable power management wakeup
+ *
+ *     Enable/disable power management wakeup mode
+ */
+int set_irq_wake(unsigned int irq, unsigned int on)
+{
+       struct irq_desc *desc = irq_desc + irq;
+       unsigned long flags;
+       int ret = -ENXIO;
+
+       spin_lock_irqsave(&desc->lock, flags);
+       if (desc->chip->set_wake)
+               ret = desc->chip->set_wake(irq, on);
+       spin_unlock_irqrestore(&desc->lock, flags);
+       return ret;
+}
+EXPORT_SYMBOL(set_irq_wake);
+
 /*
  * Internal function that tells the architecture code whether a
  * particular irq has been exclusively allocated or is available