http://blog.chinaunix.net/uid-12461657-id-3064012.html
https://community.nxp.com/message/597984
https://community.nxp.com/message/934765
1. dts configuration
arch/arm/boot/dts/imx6sl-evk.dts:
MX6SL_PAD_EPDC_D9__GPIO1_IO16 0x1b0b0
interrupt-parent = <&gpio1>;
interrupts = <16 2>;
2. c source
#include<linux/kernel.h>
#include<linux/types.h>
#include<linux/kthread.h>
#include<linux/wait.h>
#include<linux/string.h>
#include<linux/sysctl.h>
#include<linux/workqueue.h>
#include<linux/interrupt.h>
#include<linux/irq.h>
#include<linux/device.h>
#include<linux/gpio.h>
int irq = 176;
static int irq_handler(int irq_num, void *dev_id)
{
printk("interrupt handler function:%d...\n", irq_num);
return IRQ_WAKE_THREAD;
}
static int irq_thread_fn(int irq_num, void *dev_id)
{
printk("interrupt thread function:%d...\n", irq_num);
return IRQ_HANDLED;
}
static int __init request_threaded_irq_init(void)
{
int result = 0;
printk("gpio_to_irq()=%d\n", gpio_to_irq(16));
result = request_threaded_irq(irq, irq_handler, irq_thread_fn, IRQF_DISABLED,
"irq_test", NULL);
disable_irq(irq);
enable_irq(irq);
return 0;
}
static void __exit request_threaded_irq_exit(void)
{
free_irq(irq, NULL);
printk("Goodbye request_threaded_irq\n");
return;
}
module_init(request_threaded_irq_init);
module_exit(request_threaded_irq_exit);
MODULE_LICENSE("GPL");
3. result