static int __devexit i2c_touchkey_remove(struct i2c_client *client) { struct cypress_touchkey_devdata *devdata = i2c_get_clientdata(client); #ifdef CONFIG_KEYPAD_CYPRESS_TOUCH_BLN misc_deregister(&backlightnotification_device); #endif #if defined(TOUCH_UPDATE) misc_deregister(&touchkey_update_device); #endif unregister_early_suspend(&devdata->early_suspend); /* If the device is dead IRQs are disabled, we need to rebalance them */ if (unlikely(devdata->is_dead)) enable_irq(client->irq); else turn_touchkey( devdata, false ); //devdata->pdata->touchkey_onoff(TOUCHKEY_OFF); free_irq(client->irq, devdata); all_keys_up(devdata); input_unregister_device(devdata->input_dev); #if defined(CONFIG_S5PC110_DEMPSEY_BOARD) touchkey_ldo_on(0); #endif kfree(devdata); return 0; }
static int recovery_routine(struct cypress_touchkey_devdata *devdata) { int ret = -1; int retry = 10; u8 data; int irq_eint; if (unlikely(devdata->is_dead)) { dev_err(&devdata->client->dev, "%s: Device is already dead, " "skipping recovery\n", __func__); return -ENODEV; } irq_eint = devdata->client->irq; all_keys_up(devdata); disable_irq_nosync(irq_eint); while (retry--) { devdata->pdata->touchkey_onoff(TOUCHKEY_OFF); devdata->pdata->touchkey_onoff(TOUCHKEY_ON); ret = i2c_touchkey_read_byte(devdata, &data); if (!ret) { enable_irq(irq_eint); goto out; } dev_err(&devdata->client->dev, "%s: i2c transfer error retry = " "%d\n", __func__, retry); } devdata->is_dead = true; devdata->pdata->touchkey_onoff(TOUCHKEY_OFF); dev_err(&devdata->client->dev, "%s: touchkey died\n", __func__); out: return ret; }
static void cypress_touchwake_disable(void) { touchwakedevdata->is_powering_on = true; if (unlikely(touchwakedevdata->is_dead)) return; disable_irq(touchwakedevdata->client->irq); #ifdef CONFIG_GENERIC_BLN /* * Disallow powering off the touchkey controller * while a led notification is ongoing */ if(bln_is_ongoing()) { cypress_touchkey_enable_led_notification(); } else { touchwakedevdata->pdata->touchkey_onoff(TOUCHKEY_OFF); touchwakedevdata->pdata->touchkey_sleep_onoff(TOUCHKEY_OFF); } #else touchwakedevdata->pdata->touchkey_onoff(TOUCHKEY_OFF); #endif all_keys_up(touchwakedevdata); return; }
static int atmel_touchkey_suspend(struct i2c_client *client) { int mode; struct qt1060_data *devdata = i2c_get_clientdata(client); disable_irq(devdata->client->irq); all_keys_up(devdata); hrtimer_cancel(&devdata->timer); cancel_work_sync(&devdata->timer_work); mode = cancel_work_sync(&devdata->work); if (mode) enable_irq(client->irq); mutex_lock(&devdata->lock); mode = qt1060_write(devdata->client,QT1060_CMD_USER_OUTPUT_BUFFER, QT1060_KEY_LIGHT_DOWN); if (mode) { dev_err(&devdata->client->dev, "failed to active user buffer\n"); qt1060_write(devdata->client,QT1060_CMD_USER_OUTPUT_BUFFER, QT1060_KEY_LIGHT_DOWN); } mode = qt1060_read(devdata->client, QT1060_CMD_DETCTION_STATUS); mode = qt1060_write(devdata->client, QT1060_CMD_LP_MODE, 0); mutex_unlock(&devdata->lock); if (mode) { dev_err(&devdata->client->dev, "atmel Tk failed to mode device\n"); } dev_info(&qt1060copy->client->dev,"qt1060_model has suspend\n"); return 0; }
static void cypress_touchkey_early_suspend(struct early_suspend *h) { struct cypress_touchkey_devdata *devdata = container_of(h, struct cypress_touchkey_devdata, early_suspend); #ifdef CONFIG_TOUCH_WAKE i2c_touchkey_write_byte(devdata, devdata->backlight_off); #else devdata->is_powering_on = true; if (unlikely(devdata->is_dead)) return; disable_irq(devdata->client->irq); #ifdef CONFIG_GENERIC_BLN /* * Disallow powering off the touchkey controller * while a led notification is ongoing */ if(!bln_is_ongoing()) { devdata->pdata->touchkey_onoff(TOUCHKEY_OFF); devdata->pdata->touchkey_sleep_onoff(TOUCHKEY_OFF); } #else devdata->pdata->touchkey_onoff(TOUCHKEY_OFF); #endif all_keys_up(devdata); #endif }
static void cypress_touchkey_early_suspend(struct early_suspend *h) { struct cypress_touchkey_devdata *devdata = container_of(h, struct cypress_touchkey_devdata, early_suspend); devdata->is_powering_on = true; if (unlikely(devdata->is_dead)) return; disable_irq(devdata->client->irq); devdata->pdata->touchkey_onoff(TOUCHKEY_OFF); all_keys_up(devdata); }
static int __devexit i2c_touchkey_remove(struct i2c_client *client) { struct cypress_touchkey_devdata *devdata = i2c_get_clientdata(client); unregister_early_suspend(&devdata->early_suspend); /* If the device is dead IRQs are disabled, we need to rebalance them */ if (unlikely(devdata->is_dead)) enable_irq(client->irq); else devdata->pdata->touchkey_onoff(TOUCHKEY_OFF); free_irq(client->irq, devdata); all_keys_up(devdata); input_unregister_device(devdata->input_dev); kfree(devdata); return 0; }
static int recovery_routine(struct cypress_touchkey_devdata *devdata) { int ret = -1; int retry = 10; u8 data; int irq_eint; if (unlikely(devdata->is_dead)) { dev_err(&devdata->client->dev, "%s: Device is already dead, " "skipping recovery\n", __func__); return -ENODEV; } irq_eint = devdata->client->irq; down(&enable_sem); all_keys_up(devdata); disable_irq_nosync(irq_eint); while (retry--) { devdata->pdata->touchkey_onoff(TOUCHKEY_OFF); devdata->pdata->touchkey_onoff(TOUCHKEY_ON); ret = i2c_touchkey_read_byte(devdata, &data); if (!ret) { if (!devdata->is_sleeping) { enable_irq(irq_eint); #ifdef CONFIG_SAMSUNG_FASCINATE touch_key_set_int_flt(touch_int_flt_width); #endif } goto out; } dev_err(&devdata->client->dev, "%s: i2c transfer error retry = " "%d\n", __func__, retry); } devdata->is_dead = true; devdata->pdata->touchkey_onoff(TOUCHKEY_OFF); dev_err(&devdata->client->dev, "%s: touchkey died\n", __func__); out: dev_err(&devdata->client->dev, "%s: recovery_routine\n", __func__); up(&enable_sem); return ret; }
static int __devexit qt1060_remove(struct i2c_client *client) { struct qt1060_data *qt1060; qt1060 = i2c_get_clientdata(client); dev_info(&client->dev, "Atmel qt1060 remove!\n"); unregister_early_suspend(&qt1060->early_suspend); if(client->irq) free_irq(client->irq, qt1060); /* Release IRQ so no queue will be scheduled */ destroy_workqueue(qt1060->atmel_wq); destroy_workqueue(qt1060->timer_work_queue); all_keys_up(qt1060); qt1060_write(qt1060->client,QT1060_CMD_USER_OUTPUT_BUFFER, QT1060_KEY_LIGHT_DOWN); input_unregister_device(qt1060->input); kfree(qt1060); qt1060copy = NULL; led_classdev_unregister(&qt1060_kp_bl_led); sysfs_remove_group(&client->dev.kobj, &qt1060_attr_group); return 0; }
static void cypress_touchkey_early_suspend(struct early_suspend *h) { struct cypress_touchkey_devdata *devdata = container_of(h, struct cypress_touchkey_devdata, early_suspend); devdata->is_powering_on = true; if (unlikely(devdata->is_dead)) return; disable_irq(devdata->client->irq); #ifdef CONFIG_KEYPAD_CYPRESS_TOUCH_BLN /* * Disallow powering off the touchkey controller * while a led notification is ongoing */ if(!bln_notification_ongoing) #endif devdata->pdata->touchkey_onoff(TOUCHKEY_OFF); all_keys_up(devdata); }
static int __devexit i2c_touchkey_remove(struct i2c_client *client) { struct cypress_touchkey_devdata *devdata = i2c_get_clientdata(client); dev_err(&client->dev, "%s: i2c_touchkey_remove\n", __func__); misc_deregister(&bl_led_device); unregister_early_suspend(&devdata->early_suspend); /* If the device is dead IRQs are disabled, we need to rebalance them */ if (unlikely(devdata->is_dead)) enable_irq(client->irq); else { devdata->pdata->touchkey_onoff(TOUCHKEY_OFF); devdata->is_powering_on = false; } free_irq(client->irq, devdata); all_keys_up(devdata); input_unregister_device(devdata->input_dev); del_timer(&bl_timer); kfree(devdata); return 0; }
static void cypress_touchkey_early_suspend(struct early_suspend *h) { struct cypress_touchkey_devdata *devdata = container_of(h, struct cypress_touchkey_devdata, early_suspend); _pr_info("%s: suspending...\n", __FUNCTION__); down(&enable_sem); if (unlikely(devdata->is_dead)) { up(&enable_sem); return; } devdata->is_powering_on = true; disable_irq(devdata->client->irq); #ifdef CONFIG_KEYPAD_CYPRESS_TOUCH_BLN /* * Disallow powering off the touchkey controller * while a led notification is ongoing */ if ( ! bln_notification_ongoing ) #endif turn_touchkey( devdata, false ); //devdata->pdata->touchkey_onoff(TOUCHKEY_OFF); all_keys_up(devdata); #if defined(CONFIG_S5PC110_DEMPSEY_BOARD) touchkey_ldo_on(0); #endif up(&enable_sem); _pr_info("%s: suspended\n", __FUNCTION__); }
static void cypress_touchkey_early_suspend(struct early_suspend *h) { struct cypress_touchkey_devdata *devdata = container_of(h, struct cypress_touchkey_devdata, early_suspend); down(&enable_sem); devdata->is_powering_on = true; if (unlikely(devdata->is_dead)) { goto out; } disable_irq(devdata->client->irq); if (!bl_on) devdata->pdata->touchkey_onoff(TOUCHKEY_OFF); all_keys_up(devdata); devdata->is_sleeping = true; out: up(&enable_sem); }