diff --git a/drivers/input/touchscreen/ilitek_0flash_mmi/ilitek.c b/drivers/input/touchscreen/ilitek_0flash_mmi/ilitek.c index 7191d9673f18..e963a1db49e5 100644 --- a/drivers/input/touchscreen/ilitek_0flash_mmi/ilitek.c +++ b/drivers/input/touchscreen/ilitek_0flash_mmi/ilitek.c @@ -1040,6 +1040,39 @@ void ili_dev_remove(void) ili_interface_dev_exit(ilits); } +void ilitek_spi_shutdown(struct spi_device *spi) +{ + ILI_INFO("Shutdown driver...\n"); + + ili_irq_disable(); + +#ifdef ILI_CONFIG_PANEL_NOTIFICATIONS + ilitek_panel_notifier_unregister(); +#endif + + if (esd_wq != NULL) { + cancel_delayed_work_sync(&esd_work); + flush_workqueue(esd_wq); + destroy_workqueue(esd_wq); + } + if (bat_wq != NULL) { + cancel_delayed_work_sync(&bat_work); + flush_workqueue(bat_wq); + destroy_workqueue(bat_wq); + } + + if (ilits->ws) + wakeup_source_unregister(ilits->ws); + + ilits->gesture = DISABLE; + + if(gpio_is_valid(ilits->tp_rst)) { + gpio_direction_output(ilits->tp_rst, 0); + mdelay(1); + gpio_set_value(ilits->tp_rst, 0); + } +} + int ili_dev_init(struct ilitek_hwif_info *hwif) { ILI_INFO("TP Interface: %s\n", (hwif->bus_type == BUS_I2C) ? "I2C" : "SPI"); diff --git a/drivers/input/touchscreen/ilitek_0flash_mmi/ilitek.h b/drivers/input/touchscreen/ilitek_0flash_mmi/ilitek.h index 66f9d05e6ecf..9a0a2cc590f2 100644 --- a/drivers/input/touchscreen/ilitek_0flash_mmi/ilitek.h +++ b/drivers/input/touchscreen/ilitek_0flash_mmi/ilitek.h @@ -1130,6 +1130,10 @@ extern int ili_get_tp_recore_ctrl(int data); extern int ili_get_tp_recore_data(void); extern void ili_demo_debug_info_mode(u8 *buf, size_t rlen); extern void ili_demo_debug_info_id0(u8 *buf, size_t len); +#ifdef ILI_CONFIG_PANEL_NOTIFICATIONS +extern void ilitek_panel_notifier_unregister(void); +#endif +extern void ilitek_spi_shutdown(struct spi_device *spi); static inline void ipio_kfree(void **mem) { diff --git a/drivers/input/touchscreen/ilitek_0flash_mmi/ilitek_qcom.c b/drivers/input/touchscreen/ilitek_0flash_mmi/ilitek_qcom.c index 0662d86ea762..78caf1dd98dd 100644 --- a/drivers/input/touchscreen/ilitek_0flash_mmi/ilitek_qcom.c +++ b/drivers/input/touchscreen/ilitek_0flash_mmi/ilitek_qcom.c @@ -720,6 +720,13 @@ static int ili_panel_notifier_callback(struct notifier_block *self, unsigned lon return 0; } + +void ilitek_panel_notifier_unregister(void) +{ + if (register_panel_notifier(&ilits->panel_notif)) { + ILI_ERR("unregister panel_notifier failed\n"); + } +} #endif static void ilitek_plat_sleep_init(void) diff --git a/drivers/input/touchscreen/ilitek_0flash_mmi/ilitek_spi.c b/drivers/input/touchscreen/ilitek_0flash_mmi/ilitek_spi.c index 0bcc0579567f..85a76d521b69 100644 --- a/drivers/input/touchscreen/ilitek_0flash_mmi/ilitek_spi.c +++ b/drivers/input/touchscreen/ilitek_0flash_mmi/ilitek_spi.c @@ -596,6 +596,7 @@ int ili_interface_dev_init(struct ilitek_hwif_info *hwif) info->bus_driver.probe = ilitek_spi_probe; info->bus_driver.remove = ilitek_spi_remove; + info->bus_driver.shutdown = ilitek_spi_shutdown; info->bus_driver.id_table = tp_spi_id; info->hwif = hwif;