Forums » Software Development »
GPIO Interrupt: request_irq() returning error: EINVAL
Added by Keith Fletcher about 12 years ago
Hi,
I have attempted to configure a digital io, from bank0, as an interrupt, using the AINTC. However, when I attempt to assign an ISR to the interrupt (No 42) using request_irq() it returns EIVAL.
I have configured the GPIO, the AINTC and the PSC, but clearly I have missed something out.
Does anybody have any suggestions of what I could have done wrong ?
Thanks
Keith.
Replies (2)
RE: GPIO Interrupt: request_irq() returning error: EINVAL - Added by Michael Williamson about 12 years ago
I am assuming you are writing kernel code or a kernel module?
Can you send a snippet of the code?
The GPIO interrupt routing is a little different that normal peripherals. The "real" IRQ for the GPIOS (one per bank or perhaps some set of GPIOs, I can't remember off hand) gets handled by an IRQ handler the davinci_irq driver. The driver creates "soft IRQs" for each GPIO pin that it is handling. I think the soft IRQs start after all the hard IRQs in terms of numbering. It will route specific interrupts based on which pins are actually asserting interrupt conditions.
You need to use the gpio_to_irq() function to get the soft IRQ number to register for and not use the HARD IRQ number. I suspect this may be the problem, but I am sort of guessing without a code snippet....
-Mike
RE: GPIO Interrupt: request_irq() returning error: EINVAL - Added by Keith Fletcher about 12 years ago
Hi Mike,
You were correct - I had failed to use the gpio_to_irq() function.
It all works sweet now!
Thanks for you help,
Keith.