Changeset 37090


Ignore:
Timestamp:
2013-06-29T21:01:49+02:00 (5 years ago)
Author:
nbd
Message:

gpio-button-hotplug: improve gpio button debouncing, verify state changes over multiple polls. fixes spurious failsafe triggers (#13784)

Signed-off-by: Felix Fietkau <nbd@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c

    r37007 r37090  
    275275                unsigned int type = button->type ?: EV_KEY; 
    276276 
     277                if (bdata->count < bdata->threshold) { 
     278                        bdata->count++; 
     279                        return; 
     280                } 
     281 
    277282                button_hotplug_event(bdata, type, button->code, state); 
    278                 bdata->count = 0; 
    279283                bdata->last_state = state; 
    280284        } 
     285 
     286        bdata->count = 0; 
    281287} 
    282288 
     
    300306        for (i = 0; i < bdev->pdata->nbuttons; i++) { 
    301307                struct gpio_keys_button_data *bdata = &bdev->data[i]; 
    302  
    303                 if (bdata->count < bdata->threshold) 
    304                         bdata->count++; 
    305                 else 
    306                         gpio_keys_polled_check_state(&pdata->buttons[i], bdata); 
     308                gpio_keys_polled_check_state(&pdata->buttons[i], bdata); 
    307309        } 
    308310        gpio_keys_polled_queue_work(bdev); 
Note: See TracChangeset for help on using the changeset viewer.