diff options
| -rw-r--r-- | drivers/fingerprint/fpc1020_ree.c | 26 | ||||
| -rw-r--r-- | drivers/input/keyboard/gpio_keys.c | 22 |
2 files changed, 46 insertions, 2 deletions
diff --git a/drivers/fingerprint/fpc1020_ree.c b/drivers/fingerprint/fpc1020_ree.c index 704d22bce6f6..7c31100c923f 100644 --- a/drivers/fingerprint/fpc1020_ree.c +++ b/drivers/fingerprint/fpc1020_ree.c @@ -57,6 +57,11 @@ struct fpc1020_data { int screen_on; }; +extern bool home_button_pressed(void); +extern void reset_home_button(bool); + +bool reset; + static int fb_notifier_callback(struct notifier_block *self, unsigned long event, void *data); static ssize_t irq_get(struct device* device, @@ -84,6 +89,7 @@ static ssize_t irq_set(struct device* device, return -ENOENT; return strnlen(buffer, count); } + static DEVICE_ATTR(irq, S_IRUSR | S_IWUSR, irq_get, irq_set); static ssize_t fp_wl_get(struct device* device, @@ -111,6 +117,7 @@ static ssize_t fp_wl_set(struct device* device, } return strnlen(buffer, count); } + static DEVICE_ATTR(wl, S_IRUSR | S_IWUSR, fp_wl_get, fp_wl_set); static ssize_t get_wakeup_status(struct device* device, @@ -143,12 +150,13 @@ static ssize_t set_wakeup_status(struct device* device, return strnlen(buffer, count); } + static DEVICE_ATTR(wakeup, S_IRUSR | S_IWUSR, get_wakeup_status, set_wakeup_status); static ssize_t get_key(struct device* device, struct device_attribute* attribute, char* buffer) { struct fpc1020_data* fpc1020 = dev_get_drvdata(device); - return scnprintf(buffer, PAGE_SIZE, "%i\n", fpc1020->report_key); + return scnprintf(buffer, PAGE_SIZE, "%i\n", fpc1020->report_key); } static ssize_t set_key(struct device* device, @@ -163,13 +171,26 @@ static ssize_t set_key(struct device* device, if (!retval) { if (val == KEY_HOME) val = KEY_NAVI_LONG; //Convert to U-touch long press keyValue + if (val != 0 && home_button_pressed()) val = 0; + + pr_info("home key pressed = %d\n", (int)home_button_pressed()); fpc1020->report_key = (int)val; queue_work(fpc1020->fpc1020_wq, &fpc1020->input_report_work); + + if (val == 0) { + pr_info("calling home key reset"); + reset_home_button(0); + } } else return -ENOENT; return strnlen(buffer, count); +} +bool reset_gpio(void) +{ + return reset; } + static DEVICE_ATTR(key, S_IRUSR | S_IWUSR, get_key, set_key); static ssize_t get_screen_stat(struct device* device, struct device_attribute* attribute, char* buffer) @@ -184,6 +205,7 @@ static ssize_t set_screen_stat(struct device* device, { return 1; } + static DEVICE_ATTR(screen, S_IRUSR | S_IWUSR, get_screen_stat, set_screen_stat); static struct attribute *attributes[] = { @@ -194,6 +216,7 @@ static struct attribute *attributes[] = { &dev_attr_screen.attr, NULL }; + static const struct attribute_group attribute_group = { .attrs = attributes, }; @@ -316,7 +339,6 @@ static int fpc1020_manage_sysfs(struct fpc1020_data *fpc1020) return 0; } - static int fpc1020_alloc_input_dev(struct fpc1020_data *fpc1020) { int retval = 0; diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index 6ca05326754f..eeaaf1071a42 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c @@ -59,6 +59,9 @@ struct gpio_keys_drvdata { struct gpio_button_data data[0]; }; +extern bool reset_gpio(void); + + static struct device *global_dev; static struct syscore_ops gpio_keys_syscore_pm_ops; @@ -362,6 +365,8 @@ static struct attribute_group gpio_keys_attr_group = { .attrs = gpio_keys_attrs, }; +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 +380,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) { + home_button_status = 1; + } + if (type == EV_ABS) { if (state) input_event(input, type, button->code, button->value); @@ -384,6 +394,13 @@ static void gpio_keys_gpio_report_event(struct gpio_button_data *bdata) input_sync(input); } +void reset_home_button(int i) +{ + home_button_status = i; + pr_info("key home button reset ok, home_button_status=%d",i); +} + + static void gpio_keys_gpio_work_func(struct work_struct *work) { struct gpio_button_data *bdata = @@ -1040,6 +1057,11 @@ static void __exit gpio_keys_exit(void) platform_driver_unregister(&gpio_keys_device_driver); } +bool home_button_pressed(void) +{ + return home_button_status; +} + late_initcall(gpio_keys_init); module_exit(gpio_keys_exit); |
