How to handle interrupt for reading occurance of on board key press on apalis imx6 in linux?

Hello everybody,
I want to blink LEDs as a part of interrupt handler upon a key press. But, I don’t have any idea how to write IRQ for the same.
Please help me!


Please have a look in this posts.


Hello Max,
I searched for interrupt related documentation in the link, you provided, but couldn’t find the syntax to enable the interrupt, wait for the interrupt and handle it.
Can you pls help me with the above data?

Can you please download the test code on the link and check how “enable the interrupt, wait for the interrupt and handle it” is done on Linux.

Hello Sanchayan,
By test code, do you mean checking the file gpio_event_driven.c? Can you tell me the name of the test code, in which the information on enabling the interrupt is given?

Yes, I mean the file gpio_event_driven.c

Doing this from user space like in the example @max.tx has given all the interrupt handling is done implicitly by resp. GPIO drivers in the Linux kernel and you would not have to mess with any of this.

Alternatively one could even use the leds-gpio driver with a ledtrig-gpio trigger configured.

If however you are trying to do this yourself in kernel space you would need to write a special driver e.g. using resp. GPIO interfaces requesting resp. GPIO interrupt e.g. as done in above mentioned trigger example.