Re: PCA GPIO interrupt triggers, matrix-keypad

From: Peter Rusko
Date: Mon Mar 26 2012 - 06:27:38 EST


? I fail to see why having EDGE_FALLING together with EDGE_RISING is not
supported. Are you sure you didn't use some other IRQ_TYPE here?

Yes, you're right, the problem is not there.

I think, this patch should work:

Think? Can't you test it :)
I wish that could be that simple :)

I can test it with the matrix-keypad driver. But there's an inverter
(+delay) in the circuit (to prevent contact bounce) and I don't know how
it affects the signals. But in the end sometimes I don't get e.g. the
key-release event.

Another change in the code was with the IRQ request. I could only make
the matrix-keypad driver working with threaded interrupts:

diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c
index e2ae657..f047502 100644
--- a/drivers/input/keyboard/matrix_keypad.c
+++ b/drivers/input/keyboard/matrix_keypad.c
@@ -48,7 +48,7 @@ struct matrix_keypad {
static void __activate_col(const struct matrix_keypad_platform_data *pdata,
int col, bool on)
{
- bool level_on = !pdata->active_low;
+ bool level_on = (!pdata->active_low)^(!!pdata->invert_output);

if (on) {
gpio_direction_output(pdata->col_gpios[col], level_on);
@@ -341,7 +341,8 @@ static int __devinit init_matrix_gpio(struct platform_device *pdev,
}
} else {
for (i = 0; i < pdata->num_row_gpios; i++) {
- err = request_irq(gpio_to_irq(pdata->row_gpios[i]),
+ err = request_threaded_irq(gpio_to_irq(pdata->row_gpios[i]),
+ NULL,
matrix_keypad_interrupt,
IRQF_TRIGGER_RISING |
IRQF_TRIGGER_FALLING,

Is this okay, or is there another way?

Regards,
Peter
--
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/