设备树中有一部分与中断有关的节点描述:
xxx_eint {compatible = "mediatek, xxx-eint";
interrupt-parent = <&eintc>;
interrupts = <79 IRQ_TYPE_EDGE_FALLING>;//79是gpio号
debounce = <79 1000>;
status = "okay";
};
看如下的代码片断:
node = of_find_compatible_node(NULL, NULL, "mediatek, xxx-eint"); //获取中断对应的compatible的节点
debounce = ints[1]; //debounce = 1000
gpiopin = ints[0]; //gpio = 79
irqnum = irq_of_parse_and_map(node, 0); //获取节点中关于interrupt中gpio对应的中断号(此接口可以根据device tree中描述的中断信息来分析出此节点中interrupts中gpio对应的中断号),获取中断号后,就可调用request_irq来申请中断。