Re: [Qualcomm PM8921 MFD v2 2/6] mfd: pm8xxx: Add irq support

From: Abhijeet Dharmapurikar
Date: Fri Mar 11 2011 - 19:13:27 EST


Thomas Gleixner wrote:
So I deduce, that your HW has no way to mark the wakeup
interrupts. Whack your HW designer on my behalf, please! :)

Patch below against:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git irq/core

It's 8 lines, but that's still at least an order of magnitude less
than solving this with an workaround. :)

Thanks,

tglx

---------->
Subject: genirq-force-mask-on-suspend.patch
From: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Date: Fri, 11 Mar 2011 21:22:14 +0100

Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
---
include/linux/irq.h | 2 ++
kernel/irq/pm.c | 14 ++++++++++----
2 files changed, 12 insertions(+), 4 deletions(-)

Index: linux-2.6-tip/include/linux/irq.h
===================================================================
--- linux-2.6-tip.orig/include/linux/irq.h
+++ linux-2.6-tip/include/linux/irq.h
@@ -330,10 +330,12 @@ struct irq_chip {
*
* IRQCHIP_SET_TYPE_MASKED: Mask before calling chip.irq_set_type()
* IRQCHIP_EOI_IF_HANDLED: Only issue irq_eoi() when irq was handled
+ * IRQCHIP_MASK_ON_SUSPEND: Mask non wake irqs in the suspend path
*/
enum {
IRQCHIP_SET_TYPE_MASKED = (1 << 0),
IRQCHIP_EOI_IF_HANDLED = (1 << 1),
+ IRQCHIP_MASK_ON_SUSPEND = (2 << 1),
};
/* This include will go away once we isolated irq_desc usage to core code */
Index: linux-2.6-tip/kernel/irq/pm.c
===================================================================
--- linux-2.6-tip.orig/kernel/irq/pm.c
+++ linux-2.6-tip/kernel/irq/pm.c
@@ -68,10 +68,16 @@ int check_wakeup_irqs(void)
struct irq_desc *desc;
int irq;
- for_each_irq_desc(irq, desc)
- if (irqd_is_wakeup_set(&desc->irq_data) &&
- (desc->istate & IRQS_PENDING))
- return -EBUSY;
+ for_each_irq_desc(irq, desc) {
+ if (irqd_is_wakeup_set(&desc->irq_data)) {
+ if (desc->istate & IRQS_PENDING)
+ return -EBUSY;
+ continue;
+ }
+ if (desc->istate & IRQS_SUSPENDED &&
+ irq_desc_get_chip(desc)->flags & IRQCHIP_MASK_ON_SUSPEND)
+ mask_irq(desc);
+ }
return 0;
}

Awesome. This addresses the suspend/resume concerns. Thanks so much.
Reviewed-by: Abhijeet Dharmapurikar <adharmap@xxxxxxxxxxxxxx>

To avoid compile time issues, I will add
.flags = IRQCHIP_MASK_ON_SUSPEND
in my driver at a later time (after this change is pulled in).

--
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/