>From 99fbdefb4d9e74e5641e892bb9fbe7cae1c1e39a Mon Sep 17 00:00:00 2001 From: Alek Du <alek.du@xxxxxxxxx> Date: Fri, 8 May 2009 12:35:48 +0800 Subject: [PATCH] INPUT: Give more precise auto repeat control for gpio_keys driver gpio_keys_platform_data has a rep flag to control auto repeat feature. But It is not enough, for example, there is a situation that most of buttons are repeatable, while some buttons like poweroff or mute can't be repeatable. By adding another repeat flag for gpio_keys_button, we could precisely control that. Signed-off-by: Alek Du <alek.du@xxxxxxxxx> --- drivers/input/keyboard/gpio_keys.c | 3 +++ include/linux/gpio_keys.h | 1 + 2 files changed, 4 insertions(+), 0 deletions(-) diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index 5e9fb79..bfde124 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c @@ -50,6 +50,9 @@ static void gpio_keys_report_event(struct work_struct *work) int state = (gpio_get_value(button->gpio) ? 1 : 0) ^ button->active_low; input_event(input, type, button->code, !!state); + /* if button disabled auto repeat */ + if (state && test_bit(EV_REP, input->evbit) && button->norep) + input_event(input, type, button->code, 0); input_sync(input); } diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h index 1289fa7..ffda87c 100644 --- a/include/linux/gpio_keys.h +++ b/include/linux/gpio_keys.h @@ -10,6 +10,7 @@ struct gpio_keys_button { int type; /* input event type (EV_KEY, EV_SW) */ int wakeup; /* configure the button as a wake-up source */ int debounce_interval; /* debounce ticks interval in msecs */ + unsigned int norep:1; /* more precise auto repeat control */ }; struct gpio_keys_platform_data { -- 1.6.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html