@@ -68,13 +68,16 @@ static void gpio_buttons_poll(struct input_polled_dev *dev)
struct gpio_buttons_dev *bdev = dev->private;
struct gpio_buttons_platform_data *pdata = bdev->pdata;
struct input_dev *input = dev->input;
- int i;
+ int i, threshold;
for (i = 0; i < bdev->pdata->nbuttons; i++) {
struct gpio_button *button = &pdata->buttons[i];
struct gpio_button_data *bdata = &bdev->data[i];
- if (bdata->count < button->threshold)
+ threshold = round_up(button->debounce_interval,
+ pdata->poll_interval) /
+ pdata->poll_interval;
+ if (bdata->count < threshold)
bdata->count++;
else
gpio_buttons_check_state(input, button, bdata);
@@ -21,7 +21,7 @@ struct gpio_button {
char *desc; /* button description */
int type; /* input event type (EV_KEY, EV_SW) */
int code; /* input event code (KEY_*, SW_*) */
- int threshold; /* count threshold */
+ int debounce_interval; /* debounce ticks interval in msecs */
};
struct gpio_buttons_platform_data {