static int gpio_keys_resume(struct device *dev) { struct gpio_keys_drvdata *ddata = dev_get_drvdata(dev); struct input_dev *input = ddata->input; int error = 0; int i; if (device_may_wakeup(dev)) { for (i = 0; i < ddata->pdata->nbuttons; i++) { struct gpio_button_data *bdata = &ddata->data[i]; if (bdata->button->wakeup) disable_irq_wake(bdata->irq); } } else { mutex_lock(&input->mutex); if (input->users) error = gpio_keys_open(input); mutex_unlock(&input->mutex); } if (error) return error; gpio_keys_report_state(ddata); return 0; }
static int gpio_keys_open(struct input_dev *input) { struct gpio_keys_drvdata *ddata = input_get_drvdata(input); const struct gpio_keys_platform_data *pdata = ddata->pdata; int error; if (pdata->enable) { error = pdata->enable(input->dev.parent); if (error) return error; } /* Report current state of buttons that are connected to GPIOs */ gpio_keys_report_state(ddata); return 0; }
static int gpio_keys_open(struct input_dev *input) { struct gpio_keys_drvdata *ddata = input_get_drvdata(input); const struct gpio_keys_platform_data *pdata = ddata->pdata; int error; #if defined(CONFIG_SENSORS_HALL) int ret = 0; int irq = gpio_to_irq(ddata->gpio_flip_cover); if(ddata->gpio_flip_cover == 0) { printk(KERN_DEBUG"[HALL_IC] : %s skip flip\n", __func__); goto skip_flip; } printk(KERN_DEBUG"[HALL_IC] : %s\n", __func__); INIT_DELAYED_WORK(&ddata->flip_cover_dwork, flip_cover_work); ret = request_threaded_irq( irq, NULL, flip_cover_detect, IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, "flip_cover", ddata); if (ret < 0) { printk(KERN_ERR "keys: failed to request flip cover irq %d gpio %d\n", irq, ddata->gpio_flip_cover); } else { /* update the current status */ schedule_delayed_work(&ddata->flip_cover_dwork, HZ / 2); } skip_flip: #endif if (pdata->enable) { error = pdata->enable(input->dev.parent); if (error) return error; } /* Report current state of buttons that are connected to GPIOs */ gpio_keys_report_state(ddata); return 0; }