Linux GPIO subsystem development
 help / color / mirror / Atom feed
* [PATCH] gpio: gpio-pca953x: no interrupts with 4-bit devices
@ 2016-03-09 12:37 mrpace2
  2016-03-09 13:05 ` Alexander Stein
  0 siblings, 1 reply; 4+ messages in thread
From: mrpace2 @ 2016-03-09 12:37 UTC (permalink / raw)
  To: linux-gpio

I/O expanders with less than 8 I/O (PCA9536 and PCA9537, currently) fail 
to invoke interrupt handlers because the NBANK macro

     #define NBANK(chip) (chip->gpio_chip.ngpio / BANK_SZ)
incorrectly calculates no banks for these devices. As a result, 
pca953x_irq_pending() never sets the trigger_seen flag.

The patch below fixed the issue by changing the NBANK() macro.

Signed-off-by: Frank Edelhaeuser <mrpace2 <at> gmail.com>
---
diff -Nur a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
--- a/drivers/gpio/gpio-pca953x.c 2016-03-08 00:00:00.000000000 +0000
+++ b/drivers/gpio/gpio-pca953x.c 2016-03-08 00:00:00.000000000 +0000
@@ -86,7 +86,7 @@
  #define MAX_BANK 5
  #define BANK_SZ 8

-#define NBANK(chip) (chip->gpio_chip.ngpio / BANK_SZ)
+#define NBANK(chip) (((chip->gpio_chip.ngpio - 1) / BANK_SZ) + 1)

  struct pca953x_chip {
   unsigned gpio_start;


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

end of thread, other threads:[~2016-03-10 18:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-09 12:37 [PATCH] gpio: gpio-pca953x: no interrupts with 4-bit devices mrpace2
2016-03-09 13:05 ` Alexander Stein
2016-03-10 10:15   ` [PATCH v2] " mrpace2
2016-03-10 18:02     ` Grygorii Strashko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox