2 * linux/kernel/irq/pm.c
4 * Copyright (C) 2009 Rafael J. Wysocki <rjw@sisk.pl>, Novell Inc.
6 * This file contains power management functions related to interrupts.
10 #include <linux/module.h>
11 #include <linux/interrupt.h>
13 #include "internals.h"
16 * suspend_device_irqs - disable all currently enabled interrupt lines
18 * During system-wide suspend or hibernation device interrupts need to be
19 * disabled at the chip level and this function is provided for this purpose.
20 * It disables all interrupt lines that are enabled at the moment and sets the
21 * IRQ_SUSPENDED flag for them.
23 void suspend_device_irqs(void)
25 struct irq_desc *desc;
28 for_each_irq_desc(irq, desc) {
31 spin_lock_irqsave(&desc->lock, flags);
32 __disable_irq(desc, irq, true);
33 spin_unlock_irqrestore(&desc->lock, flags);
36 for_each_irq_desc(irq, desc)
37 if (desc->status & IRQ_SUSPENDED)
40 EXPORT_SYMBOL_GPL(suspend_device_irqs);
43 * resume_device_irqs - enable interrupt lines disabled by suspend_device_irqs()
45 * Enable all interrupt lines previously disabled by suspend_device_irqs() that
46 * have the IRQ_SUSPENDED flag set.
48 void resume_device_irqs(void)
50 struct irq_desc *desc;
53 for_each_irq_desc(irq, desc) {
56 if (!(desc->status & IRQ_SUSPENDED))
59 spin_lock_irqsave(&desc->lock, flags);
60 __enable_irq(desc, irq, true);
61 spin_unlock_irqrestore(&desc->lock, flags);
64 EXPORT_SYMBOL_GPL(resume_device_irqs);
67 * check_wakeup_irqs - check if any wake-up interrupts are pending
69 int check_wakeup_irqs(void)
71 struct irq_desc *desc;
74 for_each_irq_desc(irq, desc)
75 if ((desc->status & IRQ_WAKEUP) && (desc->status & IRQ_PENDING))