for (i = 0; i < gpio_evmi->ninputs; i++) {
int gpio = gpio_evmi->input_gpios[i];
- if (enable != -1) {
- printk(KERN_INFO PREFIX "%sabling hardware debounce for GPIO %d\n", (enable?"En":"Dis"), gpio);
- omap_set_gpio_debounce(gpio, enable);
- }
-
- if (time != -1) {
+ if ((time != -1) && (time != hw_debounce_time) && hw_debounce) {
printk(KERN_INFO PREFIX "Setting hardware debounce time for GPIO %d to %d (%dus)\n", gpio, time, (time+1)*31);
omap_set_gpio_debounce_time(gpio, time);
}
+
+ if ((enable != -1) && (enable != hw_debounce)) {
+ printk(KERN_INFO PREFIX "%sabling hardware debounce for GPIO %d\n", (enable?"En":"Dis"), gpio);
+ omap_set_gpio_debounce(gpio, enable);
+ }
}
}
hw_debounce = 1;
}
else {
+ hw_debounce_set(-1, 0);
hw_debounce_set(0, -1);
hw_debounce = 0;
+ hw_debounce_time = 0;
}
return count;
if ((time < 0) || (time > 0xff))
return count;
+ if (!hw_debounce)
+ return count;
+
hw_debounce_set(-1, time);
hw_debounce_time = time;