fix debounce

This commit is contained in:
Yunlong Xiao 2022-07-21 09:15:03 +08:00
parent db36088350
commit fd2f758613
1 changed files with 8 additions and 7 deletions

View File

@ -76,12 +76,11 @@ void mute_status_report(void)
static unsigned int oldstat=-1; static unsigned int oldstat=-1;
int newstat = gpio_get_value(gpioint); int newstat = gpio_get_value(gpioint);
printk("newstat %d\n",newstat); //printk("new:%d old:%d\n",newstat,oldstat);
if(gdevb!=NULL) if(gdevb!=NULL)
{ {
if(oldstat!=newstat) if(oldstat!=newstat)
{ {
printk("2newstat %d\n",newstat);
oldstat = newstat; oldstat = newstat;
if(newstat==0) if(newstat==0)
{ {
@ -94,13 +93,15 @@ void mute_status_report(void)
snprintf(module_name, 16, "MODULE=%s", "gpioint"); snprintf(module_name, 16, "MODULE=%s", "gpioint");
snprintf(udev_event, 128, "EVENT=%s", event); snprintf(udev_event, 128, "EVENT=%s", event);
printk("3newstat %d\n",newstat); if(newstat==0){
if(newstat==0) printk("Mu\n");
kobject_uevent_env(&gdevb->kobj, KOBJ_CHANGE, envp); kobject_uevent_env(&gdevb->kobj, KOBJ_CHANGE, envp);
else }else{
printk("Un\n");
kobject_uevent_env(&gdevb->kobj, KOBJ_CHANGE, envp); kobject_uevent_env(&gdevb->kobj, KOBJ_CHANGE, envp);
} }
} }
}
} }
@ -230,7 +231,7 @@ static int feier_gpioint_probe(struct platform_device *pdev)
irqmute = irq_of_parse_and_map(node, 0); irqmute = irq_of_parse_and_map(node, 0);
printk("irqmute = %d\n", irqmute); printk("irqmute = %d\n", irqmute);
of_property_read_u32(node, "touch-debounce", &debounce); of_property_read_u32(node, "touch-debounce", &debounce);
gpio_set_debounce(gpioint, debounce); gpio_set_debounce(gpioint, debounce*1000);
ret = request_irq(irqmute, feier_mute_interrupt, ret = request_irq(irqmute, feier_mute_interrupt,
IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, "feier_mute", pdev); IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, "feier_mute", pdev);
if (ret) { if (ret) {
@ -242,7 +243,7 @@ static int feier_gpioint_probe(struct platform_device *pdev)
chargeint = of_get_named_gpio(node, "interrupts-extended", 1); chargeint = of_get_named_gpio(node, "interrupts-extended", 1);
irqchr = irq_of_parse_and_map(node, 1); irqchr = irq_of_parse_and_map(node, 1);
printk("irqchr = %d\n", irqchr); printk("irqchr = %d\n", irqchr);
gpio_set_debounce(chargeint, debounce); gpio_set_debounce(chargeint, debounce*1000);
ret = request_irq(irqchr, feier_charge_interrupt, ret = request_irq(irqchr, feier_charge_interrupt,
IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, "feier_chrint", pdev); IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, "feier_chrint", pdev);
if (ret) { if (ret) {