From e3eebc917d105fdd8af29b44358e522f547b7ce2 Mon Sep 17 00:00:00 2001 From: haojl2 Date: Wed, 28 Aug 2019 17:38:24 +0800 Subject: [PATCH] himax_v2_mmi: Make sure SPI bus not suspend when TP acvice 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: I611df4787632bf8f80ec01ddb1c45dc05baa4648 Signed-off-by: haojl2 Reviewed-on: https://gerrit.mot.com/1411955 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Guobin Zhang Submit-Approved: Jira Key --- .../touchscreen/himax_v2_mmi/himax_common.c | 36 +++++++++---------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/drivers/input/touchscreen/himax_v2_mmi/himax_common.c b/drivers/input/touchscreen/himax_v2_mmi/himax_common.c index cb7f779a16a5..59ec756ba96f 100644 --- a/drivers/input/touchscreen/himax_v2_mmi/himax_common.c +++ b/drivers/input/touchscreen/himax_v2_mmi/himax_common.c @@ -2838,7 +2838,19 @@ static void himax_palm_sensor_release_timer_handler(unsigned long data) static int _himax_palm_detect_sensor_set_enable(unsigned int enable) { I("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(&private_ts->palm_gesture_read_wakelock); +#else + __pm_stay_awake(&private_ts->palm_gesture_read_wakelock); +#endif g_core_fp.fp_palm_detection_function(1); private_ts->palm_detection_enabled = true; } else if (enable == 0) { @@ -2848,6 +2860,11 @@ static int _himax_palm_detect_sensor_set_enable(unsigned int enable) } g_core_fp.fp_palm_detection_function(0); private_ts->palm_detection_enabled = false; +#ifdef CONFIG_HAS_WAKELOCK + wake_unlock(&private_ts->palm_gesture_read_wakelock); +#else + __pm_relax(&private_ts->palm_gesture_read_wakelock); +#endif } else E("unknown enable symbol\n"); @@ -2975,25 +2992,6 @@ void himax_ts_work(struct himax_ts_data *ts) int ts_status = HX_TS_NORMAL_END; int ts_path = 0; -/* - * 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 HIMAX_PALM_SENSOR_EN - if (ts->palm_detection_enabled) { -#ifdef CONFIG_HAS_WAKELOCK - wake_lock_timeout(&ts->palm_gesture_read_wakelock, 10); -#else - __pm_wakeup_event(&ts->palm_gesture_read_wakelock, 10); -#endif - } -#endif - if (debug_data != NULL) debug_data->fp_ts_dbg_func(ts, HX_FINGER_ON);