按键1按下触发一次中断,按键按下却触发两次,不知道为什么,有大佬解答一下吗?
设备树按键节点
mykeys {
compatible = "my_keys";
mykey1{
pinctrl-names = "default";
pinctrl-0 = <&key1_pinctrl>;
status = "okay";
key-gpios = <&gpio5 1 GPIO_ACTIVE_HIGH>;
interrupt-parent = <&gpio5>;
interrupts = <1 IRQ_TYPE_EDGE_FALLING>;
};
mykey2{
pinctrl-names = "default";
pinctrl-0 = <&key2_pinctrl>;
status = "okay";
key-gpios = <&gpio4 14 GPIO_ACTIVE_HIGH>;
interrupt-parent = <&gpio4>;
interrupts = <14 IRQ_TYPE_EDGE_FALLING>;
};
};
pinctrl部分
&iomuxc {
……
key2_pinctrl:mykey2{
fsl,pins = <
MX6UL_PAD_NAND_CE1_B__GPIO4_IO14 0x000110A0
>;
};
……
}
&iomuxc_snvs {
……
key1_pinctrl:mykey1{
fsl,pins = <
MX6ULL_PAD_SNVS_TAMPER1__GPIO5_IO01 0x000190A0
>;
};
……
}
probe函数
static int gpio_key_probe(struct platform_device *pdev)
{
printk("%s %s line %d\n", __FILE__, __FUNCTION__, __LINE__);
int i,err;
struct device_node *node = pdev->dev.of_node;
count = device_get_child_node_count(&pdev->dev);
my_keys = kzalloc(sizeof(struct my_keys_gpiod) * count, GFP_KERNEL);
for(i=0;i<count;i++)
{
child_fw = of_get_next_child(node, child_fw);
if(child_fw)
{
my_keys[i].key_gpio = of_get_named_gpio(child_fw,"key-gpios",0);
if(my_keys[i].key_gpio)
{
err = gpio_request(my_keys[i].key_gpio, "key");
if (err < 0)
{
printk("gpio_request is error \n");
return -1;
}
}
else
{
printk("of_get_named_gpio is error \n");
return -1;
}
gpio_direction_input(my_keys[i].key_gpio);
my_keys[i].key_gpiod = gpio_to_desc(my_keys[i].key_gpio);
err = request_irq(my_keys[i].irq, gpio_key_isr, IRQF_TRIGGER_FALLING, "my_gpio_key",&my_keys[i] );
if(err != 0) {
dev_err(&pdev->dev, "Faikey to request IRQ for key\n");
return err;
}
}
}
return 0;
}
按键1正常,按键2还是会两次触发。
大佬帮我看看啥问题,感谢感谢