diff options
Diffstat (limited to 'drivers/input/keyboard')
| -rw-r--r-- | drivers/input/keyboard/gpio_keys.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index 6ca05326754f..0c26d23541f0 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c @@ -35,6 +35,8 @@ #include <linux/pinctrl/consumer.h> #include <linux/syscore_ops.h> +#define HOME_KEY_CODE 102 + struct gpio_button_data { const struct gpio_keys_button *button; struct input_dev *input; @@ -59,12 +61,18 @@ struct gpio_keys_drvdata { struct gpio_button_data data[0]; }; + static struct device *global_dev; static struct syscore_ops gpio_keys_syscore_pm_ops; static void gpio_keys_syscore_resume(void); /* + * From drivers/misc/fpc1020_ree.c + */ +extern bool reset_gpio(void); + +/* * SYSFS interface for enabling/disabling keys and switches: * * There are 4 attributes under /sys/devices/platform/gpio-keys/ @@ -362,6 +370,13 @@ static struct attribute_group gpio_keys_attr_group = { .attrs = gpio_keys_attrs, }; +/* + * Status of home button. + * true: pressed + * false: not pressed + */ +bool home_button_status; + static void gpio_keys_gpio_report_event(struct gpio_button_data *bdata) { const struct gpio_keys_button *button = bdata->button; @@ -375,6 +390,11 @@ static void gpio_keys_gpio_report_event(struct gpio_button_data *bdata) return; } + pr_info("key gpio value = %d active_low = %d state=%d home_button_status=%d\n" , (int)__gpio_get_value(button->gpio),button->active_low,state, home_button_status); + if ((state == 1) && (int)button->code == HOME_KEY_CODE) { + home_button_status = 1; + } + if (type == EV_ABS) { if (state) input_event(input, type, button->code, button->value); @@ -384,6 +404,26 @@ static void gpio_keys_gpio_report_event(struct gpio_button_data *bdata) input_sync(input); } +/* + * Used by drivers/misc/fpc1020_ree.c + * Resets home button status. + */ +void reset_home_button(void) +{ + home_button_status = false; + pr_info("key home button reset ok, home_button_status=%d", home_button_status); +} + +/* + * Used by drivers/misc/fpc1020_ree.c + * Returns a bool specifying whether home button is pressed. + */ +bool home_button_pressed(void) +{ + return home_button_status; +} + + static void gpio_keys_gpio_work_func(struct work_struct *work) { struct gpio_button_data *bdata = |
