本文主要是介绍MT6765中断处理IO口配置流程,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1 添加EINT_VAR
alps/vender/mediated/proprietary/scripts/dct/ 目录下文件 YuSu.cmp,EINT_YuSu.cmp, GPIO_YuSu.cmp
添加 IRQ_M300 和GPIO_IRQ_M300_PIN
2 运行
alps/vender/mediated/proprietary/scripts/dct/DrvGen
分别打开下面三个问题,相同配置:
alps/kernel-4.9/drivers/misc/mediatek/dws/mt6765/k62v1_64_bsp.dws
alps/vendor/mediatek/proprietary/bootable/bootloader/lk/target/k62v1_64_bsp/dct/dct/codegen.dws
alps/vendor/mediatek/proprietary/bootable/bootloader/preloader/custom/k62v1_64_bsp/dct/dct/codegen.dws
在GPIO配置界面设置对应的GPIO为中断模式,mapping到GPIO_IRQ_M300_PIN,在EINT配置界面设置对于的EINT mapping到IRQ_M300
3 配置DTS
(1) 打开mt6765.dts,添加
m300_int: m300_int {
compatible = "mediatek,irq_m300-eint";
};
(2) 打开k62v1_64_bsp.dts,添加
&i2c2{
m300: m300@30 {
compatible = "ecp,m300";
reg = <0x30>;
status = "okay";
clock-frequency = <400000>;
m300,interrupt-gpios = <&pio 111 0>;
m300,enable-gpios = <&pio 51 0>;
};
};
4 关键驱动注册:
int irq = 0;
irq_gpio = of_get_named_gpio_flags(np, "m300,interrupt-gpios", 0, &flags);
gpio_request(irq_gpio, "m300 irq gpio");
gpio_direction_input(irq_gpio);
irq = gpio_to_irq(irq_gpio);
request_threaded_irq(irq, NULL, m300_irq_handler,
IRQF_TRIGGER_FALLING |IRQF_ONESHOT, "m300_interrupt", (void *)data);
enable_irq(data->irq);//使能中断
这篇关于MT6765中断处理IO口配置流程的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!