From b38f0056adb6284504ff11ba4dd3fa5262593dea Mon Sep 17 00:00:00 2001 From: haojl2 Date: Sun, 25 Aug 2019 01:47:18 +0800 Subject: [PATCH] himax_v2_mmi: Add wakelock before SPI operation 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). Change-Id: I867a90844edc2d9372bf6b15f776f6b1a66ef51a Signed-off-by: haojl2 Reviewed-on: https://gerrit.mot.com/1409612 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Zhenxin Xi Submit-Approved: Jira Key --- .../touchscreen/himax_v2_mmi/himax_common.c | 29 +++++++++++++++++++ .../touchscreen/himax_v2_mmi/himax_common.h | 5 ++++ 2 files changed, 34 insertions(+) diff --git a/drivers/input/touchscreen/himax_v2_mmi/himax_common.c b/drivers/input/touchscreen/himax_v2_mmi/himax_common.c index d3429a472e62..744031008f9f 100644 --- a/drivers/input/touchscreen/himax_v2_mmi/himax_common.c +++ b/drivers/input/touchscreen/himax_v2_mmi/himax_common.c @@ -2902,6 +2902,11 @@ static int himax_palm_detect_sensor_init(struct himax_ts_data *data) #else wakeup_source_init(&data->palm_gesture_wakelock, "palm_detect_wl"); #endif +#ifdef CONFIG_HAS_WAKELOCK + wake_lock_init(&data->palm_gesture_read_wakelock, WAKE_LOCK_SUSPEND, "palm_read_wl"); +#else + wakeup_source_init(&data->palm_gesture_read_wakelock, "palm_read_wl"); +#endif data->palm_release_fimer.function = himax_palm_sensor_release_timer_handler; init_timer(&data->palm_release_fimer); @@ -2930,6 +2935,11 @@ int himax_palm_detect_sensor_remove(struct himax_ts_data *data) wake_lock_destroy(&data->palm_gesture_wakelock); #else wakeup_source_trash(&data->palm_gesture_wakelock); +#endif +#ifdef CONFIG_HAS_WAKELOCK + wake_lock_destroy(&data->palm_gesture_read_wakelock); +#else + wakeup_source_trash(&data->palm_gesture_read_wakelock); #endif data->palm_sensor_pdata = NULL; data->palm_detection_enabled = false; @@ -2943,6 +2953,25 @@ 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); diff --git a/drivers/input/touchscreen/himax_v2_mmi/himax_common.h b/drivers/input/touchscreen/himax_v2_mmi/himax_common.h index 850c509d8d0f..51b02cc9a8e2 100755 --- a/drivers/input/touchscreen/himax_v2_mmi/himax_common.h +++ b/drivers/input/touchscreen/himax_v2_mmi/himax_common.h @@ -478,6 +478,11 @@ struct himax_ts_data { #else struct wakeup_source palm_gesture_wakelock; #endif +#ifdef CONFIG_HAS_WAKELOCK + struct wake_lock palm_gesture_read_wakelock; +#else + struct wakeup_source palm_gesture_read_wakelock; +#endif #endif };