static int gpio_keys_resume(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct gpio_keys_drvdata *ddata = platform_get_drvdata(pdev); struct gpio_keys_platform_data *pdata = pdev->dev.platform_data; int i; for (i = 0; i < pdata->nbuttons; i++) { #ifndef CONFIG_FEATURE_KCC_00 struct gpio_keys_button *button = &pdata->buttons[i]; if (button->wakeup && device_may_wakeup(&pdev->dev)) { int irq = gpio_to_irq(button->gpio); disable_irq_wake(irq); } #endif gpio_keys_report_event(&ddata->data[i]); } input_sync(ddata->input); return 0; }
static int gpio_keys_resume(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct gpio_keys_drvdata *ddata = platform_get_drvdata(pdev); struct gpio_keys_platform_data *pdata = pdev->dev.platform_data; int wakeup_key = KEY_RESERVED; int i; printk("gpio_keys_resume+\n"); if (pdata->wakeup_key) wakeup_key = pdata->wakeup_key(); for (i = 0; i < pdata->nbuttons; i++) { struct gpio_keys_button *button = &pdata->buttons[i]; if (button->wakeup && device_may_wakeup(&pdev->dev)) { int irq = gpio_to_irq(button->gpio); disable_irq_wake(irq); #if 0 if ((wakeup_key == button->code) && (wakeup_key == KEY_POWER)) { unsigned int type = button->type; input_event(ddata->input, type, button->code, 1); input_event(ddata->input, type, button->code, 0); input_sync(ddata->input); } #endif } gpio_keys_report_event(&ddata->data[i]); } input_sync(ddata->input); printk("gpio_keys_resume-\n"); return 0; }
static int gpio_keys_resume(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct gpio_keys_drvdata *ddata = platform_get_drvdata(pdev); struct gpio_keys_platform_data *pdata = pdev->dev.platform_data; int i; for (i = 0; i < pdata->nbuttons; i++) { struct gpio_keys_button *button = &pdata->buttons[i]; if (button->wakeup && device_may_wakeup(&pdev->dev)) { int irq = gpio_to_irq(button->gpio); disable_irq_wake(irq); /* Set last state before suspend to invalid value * since we are now resumed */ button->last_state = -1; } gpio_keys_report_event(&ddata->data[i], GPIO_KEYS_RESUME); } input_sync(ddata->input); return 0; }
static int __devinit gpio_keys_probe(struct platform_device *pdev) { struct gpio_keys_platform_data *pdata = pdev->dev.platform_data; struct gpio_keys_drvdata *ddata; struct device *dev = &pdev->dev; struct input_dev *input; int i, error; int wakeup = 0; ddata = kzalloc(sizeof(struct gpio_keys_drvdata) + pdata->nbuttons * sizeof(struct gpio_button_data), GFP_KERNEL); input = input_allocate_device(); if (!ddata || !input) { dev_err(dev, "failed to allocate state\n"); error = -ENOMEM; goto fail1; } ddata->input = input; ddata->n_buttons = pdata->nbuttons; ddata->enable = pdata->enable; ddata->disable = pdata->disable; mutex_init(&ddata->disable_lock); platform_set_drvdata(pdev, ddata); input_set_drvdata(input, ddata); input->name = pdev->name; input->phys = "gpio-keys/input0"; input->dev.parent = &pdev->dev; input->open = gpio_keys_open; input->close = gpio_keys_close; input->id.bustype = BUS_HOST; input->id.vendor = 0x0001; input->id.product = 0x0001; input->id.version = 0x0100; /* Enable auto repeat feature of Linux input subsystem */ if (pdata->rep) __set_bit(EV_REP, input->evbit); for (i = 0; i < pdata->nbuttons; i++) { struct gpio_keys_button *button = &pdata->buttons[i]; struct gpio_button_data *bdata = &ddata->data[i]; unsigned int type = button->type ?: EV_KEY; bdata->input = input; bdata->button = button; error = gpio_keys_setup_key(pdev, bdata, button); if (error) goto fail2; if (button->wakeup) wakeup = 1; input_set_capability(input, type, button->code); } error = sysfs_create_group(&pdev->dev.kobj, &gpio_keys_attr_group); if (error) { dev_err(dev, "Unable to export keys/switches, error: %d\n", error); goto fail2; } error = input_register_device(input); if (error) { dev_err(dev, "Unable to register input device, error: %d\n", error); goto fail3; } /* get current state of buttons */ for (i = 0; i < pdata->nbuttons; i++) gpio_keys_report_event(&ddata->data[i]); input_sync(input); device_init_wakeup(&pdev->dev, wakeup); return 0; fail3: sysfs_remove_group(&pdev->dev.kobj, &gpio_keys_attr_group); fail2: while (--i >= 0) { free_irq(gpio_to_irq(pdata->buttons[i].gpio), &ddata->data[i]); if (ddata->data[i].timer_debounce) del_timer_sync(&ddata->data[i].timer); cancel_work_sync(&ddata->data[i].work); gpio_free(pdata->buttons[i].gpio); } platform_set_drvdata(pdev, NULL); fail1: input_free_device(input); kfree(ddata); return error; }
static int __devinit gpio_keys_probe(struct platform_device *pdev) { struct gpio_keys_platform_data *pdata = pdev->dev.platform_data; struct gpio_keys_drvdata *ddata; struct device *dev = &pdev->dev; struct input_dev *input; int i, error; int wakeup = 0; ddata = kzalloc(sizeof(struct gpio_keys_drvdata) + pdata->nbuttons * sizeof(struct gpio_button_data), GFP_KERNEL); input = input_allocate_device(); if (!ddata || !input) { dev_err(dev, "failed to allocate state\n"); error = -ENOMEM; goto fail1; } ddata->input = input; ddata->n_buttons = pdata->nbuttons; ddata->enable = pdata->enable; ddata->disable = pdata->disable; #ifdef CONFIG_MACH_GC1 ddata->gpio_strobe_insert = pdata->gpio_strobe_insert; #endif mutex_init(&ddata->disable_lock); platform_set_drvdata(pdev, ddata); input_set_drvdata(input, ddata); input->name = pdata->name ? : pdev->name; input->phys = "gpio-keys/input0"; input->dev.parent = &pdev->dev; #ifdef CONFIG_MACH_GC1 input->evbit[0] |= BIT_MASK(EV_SW); input_set_capability(input, EV_SW, SW_STROBE_INSERT); #endif input->open = gpio_keys_open; input->close = gpio_keys_close; input->id.bustype = BUS_HOST; input->id.vendor = 0x0001; input->id.product = 0x0001; input->id.version = 0x0100; /* Enable auto repeat feature of Linux input subsystem */ if (pdata->rep) __set_bit(EV_REP, input->evbit); for (i = 0; i < pdata->nbuttons; i++) { struct gpio_keys_button *button = &pdata->buttons[i]; struct gpio_button_data *bdata = &ddata->data[i]; unsigned int type = button->type ?: EV_KEY; bdata->input = input; bdata->button = button; error = gpio_keys_setup_key(pdev, bdata, button); if (error) goto fail2; if (button->wakeup) wakeup = 1; input_set_capability(input, type, button->code); #ifdef CONFIG_TOUCH_WAKE set_powerkeydev(input); #endif } error = sysfs_create_group(&pdev->dev.kobj, &gpio_keys_attr_group); if (error) { dev_err(dev, "Unable to export keys/switches, error: %d\n", error); goto fail2; } ddata->sec_key = device_create(sec_class, NULL, 0, ddata, "sec_key"); if (IS_ERR(ddata->sec_key)) dev_err(dev, "Failed to create sec_key device\n"); error = sysfs_create_group(&ddata->sec_key->kobj, &sec_key_attr_group); if (error) { dev_err(dev, "Failed to create the test sysfs: %d\n", error); goto fail2; } error = input_register_device(input); if (error) { dev_err(dev, "Unable to register input device, error: %d\n", error); goto fail3; } /* get current state of buttons */ for (i = 0; i < pdata->nbuttons; i++) gpio_keys_report_event(&ddata->data[i]); input_sync(input); #ifdef CONFIG_FAST_BOOT /*Fake power off*/ input_set_capability(input, EV_KEY, KEY_FAKE_PWR); setup_timer(&fake_timer, gpio_keys_fake_off_check, (unsigned long)input); wake_lock_init(&fake_lock, WAKE_LOCK_SUSPEND, "fake_lock"); #endif device_init_wakeup(&pdev->dev, wakeup); #if defined(CONFIG_MACH_KONA) #ifdef AUTO_POWER_ON_OFF_FLAG init_timer(&poweroff_keypad_timer); poweroff_keypad_timer.function = poweroff_keypad_timer_handler; poweroff_keypad_timer.data = (unsigned long)&ddata->data[0]; poweroff_keypad_timer.expires = jiffies + 40*HZ; add_timer(&poweroff_keypad_timer); printk("AUTO_POWER_ON_OFF_FLAG Test Start !!!\n"); #endif #endif return 0; fail3: sysfs_remove_group(&pdev->dev.kobj, &gpio_keys_attr_group); sysfs_remove_group(&ddata->sec_key->kobj, &sec_key_attr_group); fail2: while (--i >= 0) { free_irq(gpio_to_irq(pdata->buttons[i].gpio), &ddata->data[i]); if (ddata->data[i].timer_debounce) del_timer_sync(&ddata->data[i].timer); cancel_work_sync(&ddata->data[i].work); gpio_free(pdata->buttons[i].gpio); } platform_set_drvdata(pdev, NULL); fail1: input_free_device(input); kfree(ddata); return error; }
static int gpio_keys_suspend(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); #ifndef CONFIG_MACH_Q1_REV02 struct gpio_keys_drvdata *ddata = platform_get_drvdata(pdev); #endif struct gpio_keys_platform_data *pdata = pdev->dev.platform_data; int i; if (device_may_wakeup(&pdev->dev)) { for (i = 0; i < pdata->nbuttons; i++) { struct gpio_keys_button *button = &pdata->buttons[i]; #ifdef CONFIG_MACH_Q1_REV02 if (button->wakeup) { #else struct gpio_button_data *bdata = &ddata->data[i]; if (button->wakeup && !bdata->disabled) { #endif int irq = gpio_to_irq(button->gpio); enable_irq_wake(irq); } } } return 0; } static int gpio_keys_resume(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct gpio_keys_drvdata *ddata = platform_get_drvdata(pdev); struct gpio_keys_platform_data *pdata = pdev->dev.platform_data; int i; for (i = 0; i < pdata->nbuttons; i++) { struct gpio_keys_button *button = &pdata->buttons[i]; #ifdef CONFIG_MACH_Q1_REV02 if (button->wakeup && device_may_wakeup(&pdev->dev)) { #else struct gpio_button_data *bdata = &ddata->data[i]; if (button->wakeup && !bdata->disabled && device_may_wakeup(&pdev->dev)) { #endif int irq = gpio_to_irq(button->gpio); disable_irq_wake(irq); } gpio_keys_report_event(&ddata->data[i]); } input_sync(ddata->input); return 0; } static const struct dev_pm_ops gpio_keys_pm_ops = { .suspend = gpio_keys_suspend, .resume = gpio_keys_resume, }; #endif static struct platform_driver gpio_keys_device_driver = { .probe = gpio_keys_probe, .remove = __devexit_p(gpio_keys_remove), .driver = { .name = "sec_key", .owner = THIS_MODULE, #ifdef CONFIG_PM .pm = &gpio_keys_pm_ops, #endif } }; static int __init gpio_keys_init(void) { return platform_driver_register(&gpio_keys_device_driver); } static void __exit gpio_keys_exit(void) { platform_driver_unregister(&gpio_keys_device_driver); } module_init(gpio_keys_init); module_exit(gpio_keys_exit); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Phil Blundell <*****@*****.**>"); MODULE_DESCRIPTION("Keyboard driver for CPU GPIOs"); MODULE_ALIAS("platform:gpio-keys");
static int __devinit gpio_keys_probe(struct platform_device *pdev) { struct gpio_keys_platform_data *pdata = pdev->dev.platform_data; struct gpio_keys_drvdata *ddata; struct device *dev = &pdev->dev; struct input_dev *input; int i, error, ret; int wakeup = 0; struct kobject *keyboard_kobj; doCheck = true; printk("[KEY] gpio_keys_probe\n"); ddata = kzalloc(sizeof(struct gpio_keys_drvdata) + pdata->nbuttons * sizeof(struct gpio_button_data), GFP_KERNEL); input = input_allocate_device(); if (!ddata || !input) { dev_err(dev, "failed to allocate state\n"); error = -ENOMEM; goto fail1; } ddata->input = input; ddata->n_buttons = pdata->nbuttons; ddata->enable = pdata->enable; ddata->disable = pdata->disable; mutex_init(&ddata->disable_lock); platform_set_drvdata(pdev, ddata); input_set_drvdata(input, ddata); input->name = pdev->name; input->phys = "gpio-keys/input0"; input->dev.parent = &pdev->dev; input->open = gpio_keys_open; input->close = gpio_keys_close; input->id.bustype = BUS_HOST; input->id.vendor = 0x0001; input->id.product = 0x0001; input->id.version = 0x0100; #ifdef CONFIG_TOUCHSCREEN_SYNAPTICS_SWEEP2WAKE if (!strcmp(input->name, "gpio-keys")) { sweep2wake_setdev(input); printk(KERN_INFO "[sweep2wake]: set device %s\n", input->name); } #endif PWR_MISTOUCH_gpio = pdata->PWR_MISTOUCH_gpio; mistouch_gpio_normal = pdata->mistouch_gpio_normal; mistouch_gpio_active = pdata->mistouch_gpio_active; if ( PWR_MISTOUCH_gpio ) { gpio_free(PWR_MISTOUCH_gpio); ret = gpio_request(PWR_MISTOUCH_gpio, "PWR_MISTOUCH"); if (ret < 0) { pr_err("[KEY]Requesting GPIO %d failes\n", PWR_MISTOUCH_gpio); } if ( mistouch_gpio_normal != NULL ) mistouch_gpio_normal(); else pr_err("[KEY] mistouch_gpio_normal() is NULL\n"); } delay_wq = create_singlethread_workqueue("gpio_key_work"); INIT_DELAYED_WORK(&delay_work, Mistouch_powerkey_func); wake_lock_init(&key_reset_clr_wake_lock, WAKE_LOCK_SUSPEND, "gpio_input_pwr_clear"); /* Enable auto repeat feature of Linux input subsystem */ if (pdata->rep) __set_bit(EV_REP, input->evbit); for (i = 0; i < pdata->nbuttons; i++) { struct gpio_keys_button *button = &pdata->buttons[i]; struct gpio_button_data *bdata = &ddata->data[i]; unsigned int type = button->type ?: EV_KEY; bdata->input = input; bdata->button = button; error = gpio_keys_setup_key(pdev, bdata, button); if (error) goto fail2; if (button->wakeup) wakeup = 1; input_set_capability(input, type, button->code); } error = sysfs_create_group(&pdev->dev.kobj, &gpio_keys_attr_group); if (error) { dev_err(dev, "Unable to export keys/switches, error: %d\n", error); goto fail2; } keyboard_kobj = kobject_create_and_add("keyboard", NULL); if (keyboard_kobj == NULL) { printk(KERN_ERR "[KEY] KEY_ERR: %s: subsystem_register failed\n", __func__); return -ENOMEM; } if (sysfs_create_file(keyboard_kobj, &dev_attr_vol_wakeup.attr)) pr_err("%s: sysfs_create_file error", __func__); wakeup_bitmask = 0; set_wakeup = 0; error = input_register_device(input); if (error) { dev_err(dev, "Unable to register input device, error: %d\n", error); goto fail3; } /* get current state of buttons */ for (i = 0; i < pdata->nbuttons; i++) { if (KEY_POWER != pdata->buttons[i].code) gpio_keys_report_event(&ddata->data[i]); } input_sync(input); device_init_wakeup(&pdev->dev, wakeup); wake_lock_init(&power_key_wake_lock, WAKE_LOCK_SUSPEND, "power_key_wake_lock"); pr_info("[KEY] gpio_keys_probe end.\n"); return 0; fail3: sysfs_remove_group(&pdev->dev.kobj, &gpio_keys_attr_group); fail2: while (--i >= 0) { free_irq(gpio_to_irq(pdata->buttons[i].gpio), &ddata->data[i]); if (ddata->data[i].timer_debounce) del_timer_sync(&ddata->data[i].timer); cancel_work_sync(&ddata->data[i].work); gpio_free(pdata->buttons[i].gpio); } platform_set_drvdata(pdev, NULL); fail1: input_free_device(input); kfree(ddata); return error; }
static int __devinit gpio_keys_probe(struct platform_device *pdev) { struct gpio_keys_platform_data *pdata = pdev->dev.platform_data; struct gpio_keys_drvdata *ddata; struct device *dev = &pdev->dev; struct input_dev *input; int i, error; int wakeup = 0; struct device *sec_key; #if defined(CONFIG_MACH_AEGIS2) || defined(CONFIG_MACH_APEXQ) struct device *sec_qwerty_flip ; #endif int ret; ddata = kzalloc(sizeof(struct gpio_keys_drvdata) + pdata->nbuttons * sizeof(struct gpio_button_data), GFP_KERNEL); input = input_allocate_device(); if (!ddata || !input) { dev_err(dev, "failed to allocate state\n"); error = -ENOMEM; goto fail1; } ddata->input = input; ddata->n_buttons = pdata->nbuttons; ddata->enable = pdata->enable; ddata->disable = pdata->disable; mutex_init(&ddata->disable_lock); platform_set_drvdata(pdev, ddata); input_set_drvdata(input, ddata); input->name = "sec_keys"; input->phys = "gpio-keys/input0"; input->dev.parent = &pdev->dev; input->open = gpio_keys_open; input->close = gpio_keys_close; input->id.bustype = BUS_HOST; input->id.vendor = 0x0001; input->id.product = 0x0001; input->id.version = 0x0100; /* Enable auto repeat feature of Linux input subsystem */ if (pdata->rep) __set_bit(EV_REP, input->evbit); /* Enable keyled for gpio keys */ if (pdata->keyled) { __set_bit(EV_LED, input->evbit); __set_bit(LED_MISC, input->ledbit); } for (i = 0; i < pdata->nbuttons; i++) { struct gpio_keys_button *button = &pdata->buttons[i]; struct gpio_button_data *bdata = &ddata->data[i]; unsigned int type = button->type ?: EV_KEY; bdata->input = input; bdata->button = button; error = gpio_keys_setup_key(pdev, bdata, button); if (error) goto fail2; if (button->wakeup) wakeup = 1; input_set_capability(input, type, button->code); } error = sysfs_create_group(&pdev->dev.kobj, &gpio_keys_attr_group); if (error) { dev_err(dev, "Unable to export keys/switches, error: %d\n", error); goto fail2; } error = input_register_device(input); if (error) { dev_err(dev, "Unable to register input device, error: %d\n", error); goto fail3; } /* get current state of buttons */ for (i = 0; i < pdata->nbuttons; i++) gpio_keys_report_event(&ddata->data[i]); input_sync(input); sec_key = device_create(sec_class, NULL, 0, NULL, "sec_key"); if (IS_ERR(sec_key)) pr_err("Failed to create device(sec_key)!\n"); ret = device_create_file(sec_key, &dev_attr_sec_key_pressed); if (ret) { pr_err("Failed to create device file in sysfs entries(%s)!\n", dev_attr_sec_key_pressed.attr.name); } #if defined(CONFIG_MACH_AEGIS2) || defined(CONFIG_MACH_APEXQ) sec_qwerty_flip = device_create(sec_class, NULL, 0, NULL, "sec_qwerty_flip"); if (IS_ERR(sec_qwerty_flip)) pr_err("Failed to create device(sec_qwerty_flip)!\n"); ret = device_create_file(sec_qwerty_flip, &dev_attr_sec_qwerty_flip_pressed); if (ret) { pr_err("Failed to create device file in sysfs entries(%s)!\n", dev_attr_sec_qwerty_flip_pressed.attr.name); } #endif ret = device_create_file(sec_key, &dev_attr_wakeup_keys); if (ret < 0) { pr_err("Failed to create device file(%s), error: %d\n", dev_attr_wakeup_keys.attr.name, ret); } dev_set_drvdata(sec_key, ddata); #if defined(CONFIG_MACH_AEGIS2) || defined(CONFIG_MACH_APEXQ) dev_set_drvdata(sec_qwerty_flip, ddata); #endif device_init_wakeup(&pdev->dev, 1); return 0; fail3: sysfs_remove_group(&pdev->dev.kobj, &gpio_keys_attr_group); fail2: while (--i >= 0) { free_irq(gpio_to_irq(pdata->buttons[i].gpio), &ddata->data[i]); if (ddata->data[i].timer_debounce) del_timer_sync(&ddata->data[i].timer); cancel_work_sync(&ddata->data[i].work); gpio_free(pdata->buttons[i].gpio); } platform_set_drvdata(pdev, NULL); fail1: input_free_device(input); kfree(ddata); return error; }
static int __devinit gpio_keys_probe(struct platform_device *pdev) { const struct gpio_keys_platform_data *pdata = pdev->dev.platform_data; struct gpio_keys_drvdata *ddata; struct device *dev = &pdev->dev; struct gpio_keys_platform_data alt_pdata; struct input_dev *input; int i, error; int wakeup = 0; if (!pdata) { error = gpio_keys_get_devtree_pdata(dev, &alt_pdata); if (error) return error; pdata = &alt_pdata; } ddata = kzalloc(sizeof(struct gpio_keys_drvdata) + pdata->nbuttons * sizeof(struct gpio_button_data), GFP_KERNEL); input = input_allocate_device(); if (!ddata || !input) { dev_err(dev, "failed to allocate state\n"); error = -ENOMEM; goto fail1; } ddata->input = input; ddata->n_buttons = pdata->nbuttons; ddata->enable = pdata->enable; ddata->disable = pdata->disable; #ifdef CONFIG_SENSORS_HALL ddata->gpio_flip_cover = pdata->gpio_flip_cover; ddata->irq_flip_cover = gpio_to_irq(ddata->gpio_flip_cover);; wake_lock_init(&ddata->flip_wake_lock, WAKE_LOCK_SUSPEND, "flip wake lock"); #endif mutex_init(&ddata->disable_lock); platform_set_drvdata(pdev, ddata); input_set_drvdata(input, ddata); input->name = pdata->name ? : pdev->name; input->phys = "gpio-keys/input0"; input->dev.parent = &pdev->dev; #ifdef CONFIG_SENSORS_HALL input->evbit[0] |= BIT_MASK(EV_SW); input_set_capability(input, EV_SW, SW_FLIP); #endif input->open = gpio_keys_open; input->close = gpio_keys_close; input->id.bustype = BUS_HOST; input->id.vendor = 0x0001; input->id.product = 0x0001; input->id.version = 0x0100; /* Enable auto repeat feature of Linux input subsystem */ if (pdata->rep) __set_bit(EV_REP, input->evbit); for (i = 0; i < pdata->nbuttons; i++) { struct gpio_keys_button *button = &pdata->buttons[i]; struct gpio_button_data *bdata = &ddata->data[i]; error = gpio_keys_setup_key(pdev, input, bdata, button); if (error) goto fail2; if (button->wakeup) wakeup = 1; #ifdef KEY_BOOSTER if (button->code == KEY_HOMEPAGE) { error = gpio_key_init_dvfs(bdata); if (error < 0) { dev_err(dev, "Fail get dvfs level for touch booster\n"); goto fail2; } } #endif } error = sysfs_create_group(&pdev->dev.kobj, &gpio_keys_attr_group); if (error) { dev_err(dev, "Unable to export keys/switches, error: %d\n", error); goto fail2; } ddata->sec_key = device_create(sec_class, NULL, 0, ddata, "sec_key"); if (IS_ERR(ddata->sec_key)) dev_err(dev, "Failed to create sec_key device\n"); error = sysfs_create_group(&ddata->sec_key->kobj, &sec_key_attr_group); if (error) { dev_err(dev, "Failed to create the test sysfs: %d\n", error); goto fail2; } #ifdef CONFIG_SENSORS_HALL init_hall_ic_irq(input); #endif error = input_register_device(input); if (error) { dev_err(dev, "Unable to register input device, error: %d\n", error); goto fail3; } /* get current state of buttons */ for (i = 0; i < pdata->nbuttons; i++) gpio_keys_report_event(&ddata->data[i]); input_sync(input); device_init_wakeup(&pdev->dev, wakeup); #if !defined(CONFIG_SAMSUNG_PRODUCT_SHIP) #if defined(CONFIG_N1A) if(set_auto_power_on_off_powerkey_val) { init_timer(&poweroff_keypad_timer); poweroff_keypad_timer.function = poweroff_keypad_timer_handler; poweroff_keypad_timer.data = (unsigned long)&ddata->data[0]; if(lpcharge) poweroff_keypad_timer.expires = jiffies + 20*HZ; else poweroff_keypad_timer.expires = jiffies + 40*HZ; add_timer(&poweroff_keypad_timer); printk("AUTO_POWER_ON_OFF_FLAG Test Start !!!\n"); } #endif #endif return 0; fail3: sysfs_remove_group(&pdev->dev.kobj, &gpio_keys_attr_group); sysfs_remove_group(&ddata->sec_key->kobj, &sec_key_attr_group); fail2: while (--i >= 0) gpio_remove_key(&ddata->data[i]); platform_set_drvdata(pdev, NULL); #ifdef CONFIG_SENSORS_HALL wake_lock_destroy(&ddata->flip_wake_lock); #endif fail1: input_free_device(input); kfree(ddata); /* If we have no platform_data, we allocated buttons dynamically. */ if (!pdev->dev.platform_data) kfree(pdata->buttons); return error; }
static void gpio_keys_work_func(struct work_struct *work) { struct gpio_button_data *bdata = container_of(work, struct gpio_button_data, delay_work.work); gpio_keys_report_event(bdata); }
static void gpio_check_button(unsigned long _data) { struct gpio_button_data *data = (struct gpio_button_data *)_data; gpio_keys_report_event(data); }