From 477d824a1cb0108fe6c56faab8a7ee05d45e5d15 Mon Sep 17 00:00:00 2001 From: wengjun1 Date: Tue, 2 Jun 2020 13:53:10 +0800 Subject: [PATCH] dlkm: Improve himax_0flash_mmi for single tap - Because sometimes the event of singe tap does not take long enough for the upper layer to process, adding wakelock extends the time for the system to enter sleep to ensure that every event can be processed normally. Change-Id: Ie01c83eb6d4331dc1ab38dd1d4e33fc3aae3a50f Signed-off-by: wengjun1 Reviewed-on: https://gerrit.mot.com/1594839 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Jianqiu Huang Reviewed-by: Huosheng Liao Submit-Approved: Jira Key --- .../touchscreen/himax_0flash_mmi/himax_common.c | 16 ++++++++++++++++ .../touchscreen/himax_0flash_mmi/himax_common.h | 5 +++++ 2 files changed, 21 insertions(+) diff --git a/drivers/input/touchscreen/himax_0flash_mmi/himax_common.c b/drivers/input/touchscreen/himax_0flash_mmi/himax_common.c index 24675862cb24..18cbb6e65a41 100644 --- a/drivers/input/touchscreen/himax_0flash_mmi/himax_common.c +++ b/drivers/input/touchscreen/himax_0flash_mmi/himax_common.c @@ -1564,6 +1564,11 @@ static void himax_wake_event_report(void) I("input report: %d", report_cnt); if (report_cnt >= REPORT_MAX_COUNT) report_cnt = 0; +#ifdef CONFIG_HAS_WAKELOCK + wake_lock_timeout(&private_ts->tap_gesture_wakelock, msecs_to_jiffies(5000)); +#else + __pm_wakeup_event(&private_ts->tap_gesture_wakelock, 5000); +#endif #else I(" %s SMART WAKEUP KEY event %d press\n", __func__, KEY_EVENT); input_report_key(private_ts->input_dev, KEY_EVENT, 1); @@ -3108,6 +3113,12 @@ static int himax_tap_detect_sensor_init(struct himax_ts_data *data) if (err) goto unregister_sensor_input_device; +#ifdef CONFIG_HAS_WAKELOCK + wake_lock_init(&data->tap_gesture_wakelock, WAKE_LOCK_SUSPEND, "dt-wake-lock"); +#else + wakeup_source_init(&data->tap_gesture_wakelock, "dt-wake-lock"); +#endif + return 0; unregister_sensor_input_device: @@ -3127,6 +3138,11 @@ int himax_tap_detect_sensor_remove(struct himax_ts_data *data) input_unregister_device(data->sensor_pdata->input_sensor_dev); devm_kfree(&data->sensor_pdata->input_sensor_dev->dev, data->sensor_pdata); +#ifdef CONFIG_HAS_WAKELOCK + wake_lock_destroy(&data->tap_gesture_wakelock); +#else + wakeup_source_trash(&data->tap_gesture_wakelock); +#endif data->sensor_pdata = NULL; return 0; } diff --git a/drivers/input/touchscreen/himax_0flash_mmi/himax_common.h b/drivers/input/touchscreen/himax_0flash_mmi/himax_common.h index 67e1f3046c4c..5390d0aed82b 100755 --- a/drivers/input/touchscreen/himax_0flash_mmi/himax_common.h +++ b/drivers/input/touchscreen/himax_0flash_mmi/himax_common.h @@ -542,6 +542,11 @@ struct himax_ts_data { #ifdef HIMAX_V2_SENSOR_EN struct himax_tap_sensor_platform_data *sensor_pdata; +#ifdef CONFIG_HAS_WAKELOCK + struct wake_lock tap_gesture_wakelock; +#else + struct wakeup_source tap_gesture_wakelock; +#endif #endif };