Skip to contentSkip to conversation

gpio-pch: fix a bug in the interrupt handler

PATCH New Tomoya MORINAGA 1 participant 2 messages Dec 20, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 gpio-pch: fix a bug in the interrupt handler

Also need the following patch for gpio-pch

commit 4d052213ff8f71a4a70fc4eed71b773cfde51fcf

Author: Feng Tang <[email protected]>
Date:   Tue Dec 13 23:53:50 2011 +0800

gpio-ml-ioh: Add the irq_disable/irq_enable hooks for ml-ioh irq chip

These hooks will be needed by the general disabl/enable_irq();

---
 drivers/gpio/gpio-pch.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/gpio/gpio-pch.c +1 -1
index f060329..01bd405 100644
@@ -320,7 +320,7 @@ static irqreturn_t pch_gpio_handler(int irq, void *dev_id)
 	int i;
 	int ret = IRQ_NONE;
 
-	for (i = 0; i < gpio_pins[chip->ioh]; i++) {
+	for (i = 0; i < gpio_pins[chip->ioh]; i++, chip++) {
 		if (reg_val & BIT(i)) {
 			dev_dbg(chip->dev, "%s:[%d]:irq=%d  status=0x%x\n",
 				__func__, i, irq, reg_val);
Signature · 1 line
1.7.4.4
#1 lore raw

PATCH 2/2 gpio-pch: Add the irq_disable/irq_enable hooks for pch irq chip

Also need the following patch for gpio-pch

commit f9ea14efa5277c47efec341dee2c408b6b80f854

Author: Feng Tang <[email protected]>
Date:   Tue Dec 13 23:53:49 2011 +0800

gpio-ml-ioh: fix a bug in the interrupt handler

GPIO's irq action's dev_id is set to the first struct ioh_gpio chip, so when loop checking the 8 chips, the "chip" should be changed according.

---
 drivers/gpio/gpio-pch.c |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)
drivers/gpio/gpio-pch.c +30 -0
index 01bd405..e80eedb 100644
@@ -313,6 +313,34 @@ static void pch_irq_mask(struct irq_data *d)
 	iowrite32(1 << (d->irq - chip->irq_base), &chip->reg->imask);
 }
 
+static void pch_irq_disable(struct irq_data *d)
+{
+	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
+	struct pch_gpio *chip = gc->private;
+	unsigned long flags;
+	u32 ien;
+
+	spin_lock_irqsave(&chip->spinlock, flags);
+	ien = ioread32(&chip->reg->ien);
+	ien &= ~(1 << (d->irq - chip->irq_base));
+	iowrite32(ien, &chip->reg->ien);
+	spin_unlock_irqrestore(&chip->spinlock, flags);
+}
+
+static void pch_irq_enable(struct irq_data *d)
+{
+	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
+	struct pch_gpio *chip = gc->private;
+	unsigned long flags;
+	u32 ien;
+
+	spin_lock_irqsave(&chip->spinlock, flags);
+	ien = ioread32(&chip->reg->ien);
+	ien |= 1 << (d->irq - chip->irq_base);
+	iowrite32(ien, &chip->reg->ien);
+	spin_unlock_irqrestore(&chip->spinlock, flags);
+}
+
 static irqreturn_t pch_gpio_handler(int irq, void *dev_id)
 {
 	struct pch_gpio *chip = dev_id;
@@ -346,6 +374,8 @@ static __devinit void pch_gpio_alloc_generic_chip(struct pch_gpio *chip,
 	ct->chip.irq_mask = pch_irq_mask;
 	ct->chip.irq_unmask = pch_irq_unmask;
 	ct->chip.irq_set_type = pch_irq_type;
+	ct->chip.irq_disable = pch_irq_disable;
+	ct->chip.irq_enable = pch_irq_enable;
 
 	irq_setup_generic_chip(gc, IRQ_MSK(num), IRQ_GC_INIT_MASK_CACHE,
 			       IRQ_NOREQUEST | IRQ_NOPROBE, 0);
Signature · 1 line
1.7.4.4