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

Thomas Gleixner tglx at linutronix.de
Fri Mar 11 15:37:50 EST 2011


On Fri, 11 Mar 2011, Abhijeet Dharmapurikar wrote:
> Thomas Gleixner wrote:
> > Simply because this kind of misdesigned hardware will creep up over
> > and over and we want to handle these cases in the core. Even for a
> > sinlge instance like yours solving it in the core is the right thing
> > to do, because it's a ~3 lines patch to the core code to get this
> > done.
> 
> ~3 lines patch to the code sounds promising. Please tell me how?

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 at linutronix.de>
Date: Fri, 11 Mar 2011 21:22:14 +0100

Signed-off-by: Thomas Gleixner <tglx at linutronix.de>
---
 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;
 }



More information about the linux-arm-kernel mailing list