From 14cb51b3f8bcdcacd3f851812247bdc51d77b1e6 Mon Sep 17 00:00:00 2001 From: haojl2 Date: Wed, 28 Aug 2019 17:13:58 +0800 Subject: [PATCH] focaltech_0flash_mmi: Make sure SPI bus not suspend TP: When Palm sensor is enabled, make sure device is in active state. Because in this situation, TP interrupt is active, and data need read from SPI bus. Change-Id: I5769a987d278a299b5a7de9ea19ac421cb3c9fe3 Signed-off-by: haojl2 Reviewed-on: https://gerrit.mot.com/1411932 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Guobin Zhang Submit-Approved: Jira Key --- .../focaltech_0flash_mmi/focaltech_core.c | 36 +++++++++---------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/drivers/input/touchscreen/focaltech_0flash_mmi/focaltech_core.c b/drivers/input/touchscreen/focaltech_0flash_mmi/focaltech_core.c index 82fe0e018331..2a54c0a61246 100755 --- a/drivers/input/touchscreen/focaltech_0flash_mmi/focaltech_core.c +++ b/drivers/input/touchscreen/focaltech_0flash_mmi/focaltech_core.c @@ -843,25 +843,6 @@ static void fts_irq_read_report(void) static irqreturn_t fts_irq_handler(int irq, void *data) { -/* - * If palm detect function is enabled, interrupt will not disable, IC works in - * normal mode. But in case touch event is reported to input subsystem, skip - * touch event when suspend flag is true. So input subsystem will not take - * wakelock because no one report event. - * In this case, we still need read data from IC, so AP can not enter suspend. - * Add a 10ms wakelock when this function is enabled. (TP report rate is around - * 100Hz). - */ -#ifdef FOCALTECH_PALM_SENSOR_EN - if (fts_data->palm_detection_enabled) { -#ifdef CONFIG_HAS_WAKELOCK - wake_lock_timeout(&fts_data->palm_gesture_read_wakelock, 10); -#else - __pm_wakeup_event(&fts_data->palm_gesture_read_wakelock, 10); -#endif - } -#endif - fts_irq_read_report(); return IRQ_HANDLED; } @@ -977,7 +958,19 @@ static void fts_palm_sensor_release_timer_handler(unsigned long data) static int _fts_palm_sensor_set_enable(unsigned int enable) { FTS_INFO("Palm gesture set enable %d!", enable); +/* + * If palm detect function is enabled, interrupt will not disable, IC works in + * normal mode. But in case touch event is reported to input subsystem, skip + * touch event when suspend flag is true. So input subsystem will not take + * wakelock because no one report event. + * In this case, we still need read data from IC, so AP can not enter suspend. + */ if (enable == 1) { +#ifdef CONFIG_HAS_WAKELOCK + wake_lock(&fts_data->palm_gesture_read_wakelock); +#else + __pm_stay_awake(&fts_data->palm_gesture_read_wakelock); +#endif fts_data->palm_detection_enabled = true; fts_write_reg(0xB0, 0x01); } else if (enable == 0) { @@ -987,6 +980,11 @@ static int _fts_palm_sensor_set_enable(unsigned int enable) del_timer(&fts_data->palm_release_fimer); } fts_write_reg(0xB0, 0x00); +#ifdef CONFIG_HAS_WAKELOCK + wake_unlock(&fts_data->palm_gesture_read_wakelock); +#else + __pm_relax(&fts_data->palm_gesture_read_wakelock); +#endif } else { FTS_INFO("unknown enable symbol\n"); }