Skip to contentSkip to conversation

gpio: pca953x: allow shared interrupts

PATCH In review Toby Smith 2 participants 5 messages Apr 30, 2014 – May 9, 2014 GPIO

lore
Share & tools
lore

Toby Smith

author
#0 lore raw

cover gpio: pca953x: allow shared interrupts

These patches allow the pca953x family of chips to use a shared interrupt.

Toby Smith (2):
gpio: pca953x: return IRQ_NONE when appropriate
gpio: pca953x: request a shared interrupt

 drivers/gpio/gpio-pca953x.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
Signature · 1 line
1.8.3.2
author
#1 lore raw

PATCH 1/2 gpio: pca953x: return IRQ_NONE when appropriate

The irq handler should return IRQ_NONE or IRQ_HANDLED to report if we have handled the interrupt.

---
 drivers/gpio/gpio-pca953x.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpio/gpio-pca953x.c +4 -2
index d550d8e..83cc2c8 100644
@@ -503,10 +503,11 @@ static irqreturn_t pca953x_irq_handler(int irq, void *devid)
 	struct pca953x_chip *chip = devid;
 	u8 pending[MAX_BANK];
 	u8 level;
+	unsigned nhandled = 0;
 	int i;
 
 	if (!pca953x_irq_pending(chip, pending))
-		return IRQ_HANDLED;
+		return IRQ_NONE;
 
 	for (i = 0; i < NBANK(chip); i++) {
 		while (pending[i]) {
@@ -514,10 +515,11 @@ static irqreturn_t pca953x_irq_handler(int irq, void *devid)
 			handle_nested_irq(irq_find_mapping(chip->domain,
 							level + (BANK_SZ * i)));
 			pending[i] &= ~(1 << level);
+			nhandled++;
 		}
 	}
 
-	return IRQ_HANDLED;
+	return (nhandled > 0) ? IRQ_HANDLED : IRQ_NONE;
 }
 
 static int pca953x_gpio_irq_map(struct irq_domain *d, unsigned int irq,
Signature · 1 line
1.8.3.2
#2 lore raw

Re: [PATCH 1/2] gpio: pca953x: return IRQ_NONE when appropriate

Quoted 4 lines · Toby Smith

The irq handler should return IRQ_NONE or IRQ_HANDLED to report if we have handled the interrupt.

Patch applied.

Adding some randon pca953x developers to the thread so noone gets upset.

Yours,
Linus Walleij

author
#3 lore raw

PATCH 2/2 gpio: pca953x: request a shared interrupt

In reply to Toby Smith

Request a shared interrupt when requesting a pca953x GPIO interrupt

---
 drivers/gpio/gpio-pca953x.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpio/gpio-pca953x.c +2 -1
index 83cc2c8..6398f8a 100644
@@ -586,7 +586,8 @@ static int pca953x_irq_setup(struct pca953x_chip *chip,
 					client->irq,
 					   NULL,
 					   pca953x_irq_handler,
-					   IRQF_TRIGGER_LOW | IRQF_ONESHOT,
+					   IRQF_TRIGGER_LOW | IRQF_ONESHOT |
+						   IRQF_SHARED,
 					   dev_name(&client->dev), chip);
 		if (ret) {
 			dev_err(&client->dev, "failed to request irq %d\n",
Signature · 1 line
1.8.3.2
#4 lore raw

Re: [PATCH 2/2] gpio: pca953x: request a shared interrupt

Quoted 3 lines · Toby Smith

Request a shared interrupt when requesting a pca953x GPIO interrupt

Patch applied.

Yours,
Linus Walleij