PCA GPIO interrupt triggers

From: Peter Rusko
Date: Fri Mar 23 2012 - 01:42:25 EST


Hi,

I'm using a GPIO chip (PCA9554) for a matrix-keypad. The keypad driver itself needs interrupts for both rising and falling edges. The PCA driver (gpio-pca953x.c) doesn't support it, but I don't understand why.

I think, this patch should work:

diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index 147df8a..be9aff4 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -356,12 +356,6 @@ static int pca953x_irq_set_type(struct irq_data *d, unsigned int type)
uint16_t level = d->irq - chip->irq_base;
uint16_t mask = 1 << level;

- if (!(type & IRQ_TYPE_EDGE_BOTH)) {
- dev_err(&chip->client->dev, "irq %d: unsupported type %d\n",
- d->irq, type);
- return -EINVAL;
- }
-
if (type & IRQ_TYPE_EDGE_FALLING)
chip->irq_trig_fall |= mask;
else

I think that the other parts of the code checks for rising and falling edges correctly. Am I missing something?

--
Ruskà PÃter
FejlesztÅmÃrnÃk

Prolan Zrt. / Prolan Co.
Hungary 2011 BudakalÃsz, Szentendrei Ãt 1-3.
Tel./Phone: +36 20 954 3118
Fax: +36 26 540 420
E-mail: rusko.peter@xxxxxxxxx
Web: www.prolan.hu
Timezone:CET
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/