I am writing GPIO Device Driver for linux 3.14 on Beagleboard XM (RevB). I have done with simple ON/OFF LED blinking. But stuck at interrupt handler implementation. BB XM has GPIO_7 pin connected to user button. Following is code sample I have implemented. But it is not working. I am able to insert module using insmod. Interrupt is also registered in /proc/interrupts. But handler is not getting invoked.
Am I on right track? #include <linux/gpio.h> #include <linux/interrupt.h> #define GPIO 7 int var; static irqreturn_t irq_handler(int irq, void *dev_id) { var++; printk("In the Interrupt handler, Count: %d\n", var); return IRQ_HANDLED; } static int __init hello_init(void) { int errno, irq_line; if((errno = gpio_direction_input(GPIO)) !=0) { printk(KERN_INFO "Can't set GPIO direction, error %i\n", errno); gpio_free(GPIO); return -EINVAL; } irq_line = gpio_to_irq(GPIO); printk ("IRQ Line is %d \n",irq_line); errno = request_irq( irq_line, (irq_handler_t)irq_handler, IRQF_TRIGGER_FALLING, "Interrupt123", NULL ); if(errno<0) { printk(KERN_INFO "Problem requesting IRQ, error %i\n", errno); } return 0; } static void __exit hello_exit(void) { int irq_line; printk ("Unloading my module.\n"); irq_line = gpio_to_irq(GPIO); free_irq(irq_line,NULL); printk("Hello Example Exit\n"); return; } module_init(hello_init); module_exit(hello_exit); MODULE_AUTHOR("TheInventor"); MODULE_DESCRIPTION("Interrupt Module"); MODULE_LICENSE("GPL"); -- For more options, visit http://beagleboard.org/discuss --- You received this message because you are subscribed to the Google Groups "BeagleBoard" group. To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.