linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] gpio: pca953x: allow shared interrupts
@ 2014-04-30  8:01 Toby Smith
  2014-04-30  8:01 ` [PATCH 1/2] gpio: pca953x: return IRQ_NONE when appropriate Toby Smith
  2014-04-30  8:01 ` [PATCH 2/2] gpio: pca953x: request a shared interrupt Toby Smith
  0 siblings, 2 replies; 5+ messages in thread
From: Toby Smith @ 2014-04-30  8:01 UTC (permalink / raw)
  To: linus.walleij, gnurou, grant.likely, robh+dt
  Cc: linux-gpio, linux-kernel, devicetree, Toby Smith

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(-)

-- 
1.8.3.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] gpio: pca953x: return IRQ_NONE when appropriate
  2014-04-30  8:01 [PATCH 0/2] gpio: pca953x: allow shared interrupts Toby Smith
@ 2014-04-30  8:01 ` Toby Smith
  2014-05-09 10:57   ` Linus Walleij
  2014-04-30  8:01 ` [PATCH 2/2] gpio: pca953x: request a shared interrupt Toby Smith
  1 sibling, 1 reply; 5+ messages in thread
From: Toby Smith @ 2014-04-30  8:01 UTC (permalink / raw)
  To: linus.walleij, gnurou, grant.likely, robh+dt
  Cc: linux-gpio, linux-kernel, devicetree, Toby Smith

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

Signed-off-by: Toby Smith <toby@tismith.id.au>
---
 drivers/gpio/gpio-pca953x.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index d550d8e..83cc2c8 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -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,
-- 
1.8.3.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] gpio: pca953x: request a shared interrupt
  2014-04-30  8:01 [PATCH 0/2] gpio: pca953x: allow shared interrupts Toby Smith
  2014-04-30  8:01 ` [PATCH 1/2] gpio: pca953x: return IRQ_NONE when appropriate Toby Smith
@ 2014-04-30  8:01 ` Toby Smith
  2014-05-09 10:58   ` Linus Walleij
  1 sibling, 1 reply; 5+ messages in thread
From: Toby Smith @ 2014-04-30  8:01 UTC (permalink / raw)
  To: linus.walleij, gnurou, grant.likely, robh+dt
  Cc: linux-gpio, linux-kernel, devicetree, Toby Smith

Request a shared interrupt when requesting a pca953x GPIO interrupt

Signed-off-by: Toby Smith <toby@tismith.id.au>
---
 drivers/gpio/gpio-pca953x.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index 83cc2c8..6398f8a 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -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",
-- 
1.8.3.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] gpio: pca953x: return IRQ_NONE when appropriate
  2014-04-30  8:01 ` [PATCH 1/2] gpio: pca953x: return IRQ_NONE when appropriate Toby Smith
@ 2014-05-09 10:57   ` Linus Walleij
  0 siblings, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2014-05-09 10:57 UTC (permalink / raw)
  To: Toby Smith, Aaron Sierra, Graeme Smecher, Andrew Ruder, Gregory CLEMENT
  Cc: Alexandre Courbot, Grant Likely, Rob Herring, linux-gpio,
	linux-kernel, devicetree

On Wed, Apr 30, 2014 at 10:01 AM, Toby Smith <toby@tismith.id.au> wrote:

> The irq handler should return IRQ_NONE or IRQ_HANDLED to report
> if we have handled the interrupt.
>
> Signed-off-by: Toby Smith <toby@tismith.id.au>

Patch applied.

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

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] gpio: pca953x: request a shared interrupt
  2014-04-30  8:01 ` [PATCH 2/2] gpio: pca953x: request a shared interrupt Toby Smith
@ 2014-05-09 10:58   ` Linus Walleij
  0 siblings, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2014-05-09 10:58 UTC (permalink / raw)
  To: Toby Smith, Aaron Sierra, Graeme Smecher, Andrew Ruder, Gregory CLEMENT
  Cc: Alexandre Courbot, Grant Likely, Rob Herring, linux-gpio,
	linux-kernel, devicetree

On Wed, Apr 30, 2014 at 10:01 AM, Toby Smith <toby@tismith.id.au> wrote:

> Request a shared interrupt when requesting a pca953x GPIO interrupt
>
> Signed-off-by: Toby Smith <toby@tismith.id.au>

Patch applied.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-05-09 10:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-30  8:01 [PATCH 0/2] gpio: pca953x: allow shared interrupts Toby Smith
2014-04-30  8:01 ` [PATCH 1/2] gpio: pca953x: return IRQ_NONE when appropriate Toby Smith
2014-05-09 10:57   ` Linus Walleij
2014-04-30  8:01 ` [PATCH 2/2] gpio: pca953x: request a shared interrupt Toby Smith
2014-05-09 10:58   ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).