So I had been scouring the web for some information on how to use the GPIO pins as kernel interrupts. There is plenty of reference material on how to use sysfs interface to poll the pins manually but I couldn't figure out the interrupts, with some perserverance and some digging through the source tree I came up with this.
Bear in mind my platform is the imx53 based DIMM-MX53 from Emtrion but the theory should still apply across the board including the IMXQSB.
static irqreturn_t button_interrupt(int irq, unsigned long data)
printk(KERN_INFO "Hello World\n");
static int __init hello_start(void)
printk(KERN_INFO "Loaded hello module....\n");
ret = request_irq(gpio_to_irq(42), button_interrupt,
IRQF_DISABLED | IRQF_TRIGGER_FALLING,
printk(KERN_ERR "Failed to request IRQ\n");
The macro gpio_to_irq(x) changes the GPIO address to an IRQ, in my case I'm using the second 32 bit GPIO port and bit 10 (GPIO2-10). It is also worth noting that it is probably bad practice to request the IRQ during the initialisation but rather when you want to use the device, this way you will not hog any system resource.
This should be enough to get you going, enjoy.