From 5147d1ce0178cd7063b5f250f60c2464d1f186ac Mon Sep 17 00:00:00 2001 From: dengwei1 Date: Tue, 25 Sep 2018 11:22:58 +0800 Subject: [PATCH] channel input: add nova touch support rmmod add nova touch support rmmod rmmod and insmod work well Change-Id: I36b43461fd584bcee1e191db256ec89c1ffe6fba Signed-off-by: dengwei1 Reviewed-on: https://gerrit.mot.com/1245946 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Xiangpo Zhao Submit-Approved: Jira Key --- .../touchscreen/nova_36525_mmi/nt36xxx.c | 34 ++++++++++++++++++- .../nova_36525_mmi/nt36xxx_ext_proc.c | 27 +++++++++++++++ .../nova_36525_mmi/nt36xxx_mp_ctrlram.c | 15 ++++++++ 3 files changed, 75 insertions(+), 1 deletion(-) diff --git a/drivers/input/touchscreen/nova_36525_mmi/nt36xxx.c b/drivers/input/touchscreen/nova_36525_mmi/nt36xxx.c index 03f7247be8f3..f91b65bf2c9f 100644 --- a/drivers/input/touchscreen/nova_36525_mmi/nt36xxx.c +++ b/drivers/input/touchscreen/nova_36525_mmi/nt36xxx.c @@ -66,6 +66,7 @@ uint8_t esd_retry_max = 5; #if NVT_TOUCH_EXT_PROC extern int32_t nvt_extra_proc_init(void); +extern void nvt_extra_proc_remove(void); #endif #if NVT_TOUCH_FW @@ -75,6 +76,7 @@ extern int32_t nvt_fw_sysfs_deinit(void); #if NVT_TOUCH_MP extern int32_t nvt_mp_proc_init(void); +extern void nvt_mp_proc_remove(void); #endif struct nvt_ts_data *ts; @@ -627,6 +629,15 @@ static int32_t nvt_flash_proc_init(void) } #endif +static void nvt_flash_proc_remove(void) +{ + if (NVT_proc_entry != NULL) { + remove_proc_entry(DEVICE_NAME, NULL); + NVT_LOG("Removed %s under /proc\n", + DEVICE_NAME); + } +} + #if WAKEUP_GESTURE #define GESTURE_WORD_C 12 #define GESTURE_WORD_W 13 @@ -1535,6 +1546,24 @@ static int32_t nvt_ts_remove(struct i2c_client *client) NVT_LOG("Removing driver...\n"); free_irq(client->irq, ts); + if (gpio_is_valid(ts->irq_gpio)) { + gpio_free(ts->irq_gpio); + } +#if NVT_TOUCH_SUPPORT_HW_RST + if (gpio_is_valid(ts->reset_gpio)) + gpio_free(ts->reset_gpio); +#endif + +#if NVT_TOUCH_PROC + nvt_flash_proc_remove(); +#endif +#if NVT_TOUCH_MP + nvt_mp_proc_remove(); +#endif +#if NVT_TOUCH_EXT_PROC + nvt_extra_proc_remove(); +#endif + input_unregister_device(ts->input_dev); i2c_set_clientdata(client, NULL); kfree(ts); @@ -1925,8 +1954,11 @@ static void __exit nvt_driver_exit(void) #endif #if NVT_TOUCH_ESD_PROTECT - if (nvt_esd_check_wq) + if (nvt_esd_check_wq) { + cancel_delayed_work_sync(&nvt_esd_check_work); + flush_workqueue(nvt_esd_check_wq); destroy_workqueue(nvt_esd_check_wq); + } #endif /* #if NVT_TOUCH_ESD_PROTECT */ } diff --git a/drivers/input/touchscreen/nova_36525_mmi/nt36xxx_ext_proc.c b/drivers/input/touchscreen/nova_36525_mmi/nt36xxx_ext_proc.c index 9ec4d20d69ce..12057a884967 100644 --- a/drivers/input/touchscreen/nova_36525_mmi/nt36xxx_ext_proc.c +++ b/drivers/input/touchscreen/nova_36525_mmi/nt36xxx_ext_proc.c @@ -691,4 +691,31 @@ int32_t nvt_extra_proc_init(void) return 0; } + +void nvt_extra_proc_remove(void) +{ + if (NVT_proc_fw_version_entry != NULL) { + remove_proc_entry(NVT_FW_VERSION, NULL); + NVT_LOG("Removed %s under /proc\n", + NVT_FW_VERSION); + } + + if (NVT_proc_baseline_entry != NULL) { + remove_proc_entry(NVT_BASELINE, NULL); + NVT_LOG("Removed %s under /proc\n", + NVT_BASELINE); + } + + if (NVT_proc_raw_entry != NULL) { + remove_proc_entry(NVT_RAW, NULL); + NVT_LOG("Removed %s under /proc\n", + NVT_RAW); + } + + if (NVT_proc_diff_entry != NULL) { + remove_proc_entry(NVT_DIFF, NULL); + NVT_LOG("Removed %s under /proc\n", + NVT_DIFF); + } +} #endif diff --git a/drivers/input/touchscreen/nova_36525_mmi/nt36xxx_mp_ctrlram.c b/drivers/input/touchscreen/nova_36525_mmi/nt36xxx_mp_ctrlram.c index 0c05b865c783..118e42795bff 100644 --- a/drivers/input/touchscreen/nova_36525_mmi/nt36xxx_mp_ctrlram.c +++ b/drivers/input/touchscreen/nova_36525_mmi/nt36xxx_mp_ctrlram.c @@ -1898,4 +1898,19 @@ int32_t nvt_mp_proc_init(void) return ret; } +void nvt_mp_proc_remove(void) +{ + if (NVT_proc_selftest_entry != NULL) { + remove_proc_entry("nvt_selftest", NULL); + NVT_LOG("Removed %s under /proc\n", + "nvt_selftest"); + } +#if NVT_TOUCH_MP_LENOVO + if (NVT_proc_selftest_read_data != NULL) { + remove_proc_entry("nvt_read_data", NULL); + NVT_LOG("Removed %s under /proc\n", + "nvt_read_data"); + } +#endif +} #endif /* #if NVT_TOUCH_MP */