static void gpio_keys_report_event(struct gpio_button_data *bdata) { static struct timespec home_key_up_time = {0, 0}; struct gpio_keys_button *button = bdata->button; struct input_dev *input = bdata->input; unsigned int type = button->type ?: EV_KEY; struct irq_desc *desc = irq_to_desc(gpio_to_irq(button->gpio)); int state = (gpio_get_value_cansleep(button->gpio) ? 1 : 0) ^ button->active_low; if (type == EV_ABS) { if (state) input_event(input, type, button->code, button->value); } else { bdata->key_state = !!state; if (button->code == KEY_HOME || button->code == KEY_UP || button->code == KEY_DOWN) { if (state) { // we can't press this button again in 30ms! god finger? by tegrak if (ts_sub_to_ms(current_kernel_time(), home_key_up_time) < 30) { printk(KERN_ERR "Unintended home key repeatition. Ignore this action."); return; } } } else { home_key_up_time = current_kernel_time(); } input_event(input, type, button->code, irqd_is_wakeup_set(&desc->irq_data) ? 1 : !!state); } input_sync(input); }
static void gpio_keys_report_event(struct gpio_button_data *bdata) { static struct timespec home_key_up_time = {0, 0}; struct gpio_keys_button *button = bdata->button; struct input_dev *input = bdata->input; unsigned int type = button->type ?: EV_KEY; struct irq_desc *desc = irq_to_desc(gpio_to_irq(button->gpio)); int state = (gpio_get_value(button->gpio) ? 1 : 0) ^ button->active_low; #ifdef CONFIG_MACH_C1_NA_SPR_EPIC2_REV00 int gpio_hall_ic ; if(button->code == HALL_CODE) { gpio_hall_ic = gpio_get_value(button->gpio); if(gpio_hall_ic) //open { input_report_switch(input, SW_LID, !gpio_hall_ic); input_sync(input); printk("** SLIDE OPEN : %d\n ",!gpio_hall_ic); } else { input_report_switch(input, SW_LID, !gpio_hall_ic); input_sync(input); printk("** SLIDE CLOSED : %d\n ",!gpio_hall_ic); } } else { #endif bdata->key_state = !!state; #if !defined(CONFIG_TOUCHSCREEN_MXT540E) if (button->code == HOME_KEY_VAL)) { if (state) { if (ts_sub_to_ms(current_kernel_time(), home_key_up_time) < 30) { printk(KERN_ERR "Unintended home key repeatition. Ignore this action."); return; } if (touch_is_pressed) { printk(KERN_ERR "In Key routine, Touch Down!!! Touch state clear!!"); Mxt224_force_released(); } } else { home_key_up_time = current_kernel_time(); } } #endif input_event(input, type, button->code, (desc->status & IRQ_WAKEUP) ? 1 : !!state); /* if (bdata->key_state == 1) printk(KERN_ERR "key [%d] is pressed\n", bdata->button->code); else printk(KERN_ERR "key [%d] is released\n", bdata->button->code); */ input_sync(input); #ifdef CONFIG_MACH_C1_NA_SPR_EPIC2_REV00 } #endif }