input: gpio_input: send input_sync after reporting keys
Jeff Brown [Fri, 18 Mar 2011 23:02:26 +0000 (16:02 -0700)]
Signed-off-by: jeffbrown@android.com
Change-Id: Ie170960df3c8ab4833ed686135dc8575cb9f2d48

drivers/input/misc/gpio_input.c

index 758df48..98d204f 100644 (file)
@@ -62,6 +62,7 @@ static enum hrtimer_restart gpio_event_input_timer_func(struct hrtimer *timer)
        struct gpio_key_state *key_state;
        unsigned long irqflags;
        uint8_t debounce;
+       bool sync_needed;
 
 #if 0
        key_entry = kp->keys_info->keymap;
@@ -72,6 +73,7 @@ static enum hrtimer_restart gpio_event_input_timer_func(struct hrtimer *timer)
 #endif
        key_entry = ds->info->keymap;
        key_state = ds->key_state;
+       sync_needed = false;
        spin_lock_irqsave(&ds->irq_lock, irqflags);
        for (i = 0; i < nkeys; i++, key_entry++, key_state++) {
                debounce = key_state->debounce;
@@ -129,6 +131,11 @@ static enum hrtimer_restart gpio_event_input_timer_func(struct hrtimer *timer)
                                key_entry->code, i, key_entry->gpio, pressed);
                input_event(ds->input_devs->dev[key_entry->dev], ds->info->type,
                            key_entry->code, pressed);
+               sync_needed = true;
+       }
+       if (sync_needed) {
+               for (i = 0; i < ds->input_devs->count; i++)
+                       input_sync(ds->input_devs->dev[i]);
        }
 
 #if 0
@@ -196,6 +203,7 @@ static irqreturn_t gpio_event_input_irq_handler(int irq, void *dev_id)
                                key_entry->gpio, pressed);
                input_event(ds->input_devs->dev[key_entry->dev], ds->info->type,
                            key_entry->code, pressed);
+               input_sync(ds->input_devs->dev[key_entry->dev]);
        }
        return IRQ_HANDLED;
 }