From 1a5c66033832f0c7892feb45a654e5cd7f5d580c Mon Sep 17 00:00:00 2001 From: haojl2 Date: Wed, 21 Aug 2019 19:28:51 +0800 Subject: [PATCH] himax_v2_mmi: Add wakelock before leave event TP: Add a wakelock when leave event reported. The wakelock timeout time is same as leave report timer. Change-Id: I0c1b1e5f0e7be588c98fe3f9e37ee1aa64374a9b Signed-off-by: haojl2 Reviewed-on: https://gerrit.mot.com/1407159 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Submit-Approved: Jira Key Tested-by: Jira Key (cherry picked from commit 046c02edca7b8de7dc998743d4c3ba0af474bf17) Reviewed-on: https://gerrit.mot.com/1407897 Reviewed-by: Jianqi Yang --- .../touchscreen/himax_v2_mmi/himax_common.c | 18 ++++++++++++++++++ .../touchscreen/himax_v2_mmi/himax_common.h | 5 +++++ 2 files changed, 23 insertions(+) diff --git a/drivers/input/touchscreen/himax_v2_mmi/himax_common.c b/drivers/input/touchscreen/himax_v2_mmi/himax_common.c index ce4202294b6d..d3429a472e62 100644 --- a/drivers/input/touchscreen/himax_v2_mmi/himax_common.c +++ b/drivers/input/touchscreen/himax_v2_mmi/himax_common.c @@ -2749,6 +2749,13 @@ static void himax_report_points(struct himax_ts_data *ts) } else if (himax_palm_detect(hx_touch_data->hx_coord_buf) == PALM_LEAVE_REPORT) { mod_timer(&ts->palm_release_fimer, jiffies + msecs_to_jiffies(ts->palm_release_delay_ms)); +#ifdef CONFIG_HAS_WAKELOCK + wake_lock_timeout(&ts->palm_gesture_wakelock, + ts->palm_release_delay_ms); +#else + __pm_wakeup_event(&ts->palm_gesture_wakelock, + ts->palm_release_delay_ms); +#endif return; } } @@ -2890,6 +2897,12 @@ static int himax_palm_detect_sensor_init(struct himax_ts_data *data) if (err) goto unregister_sensor_input_device; +#ifdef CONFIG_HAS_WAKELOCK + wake_lock_init(&data->palm_gesture_wakelock, WAKE_LOCK_SUSPEND, "palm_detect_wl"); +#else + wakeup_source_init(&data->palm_gesture_wakelock, "palm_detect_wl"); +#endif + data->palm_release_fimer.function = himax_palm_sensor_release_timer_handler; init_timer(&data->palm_release_fimer); data->palm_release_delay_ms = 850; @@ -2913,6 +2926,11 @@ int himax_palm_detect_sensor_remove(struct himax_ts_data *data) input_unregister_device(data->palm_sensor_pdata->input_sensor_dev); devm_kfree(&data->palm_sensor_pdata->input_sensor_dev->dev, data->palm_sensor_pdata); +#ifdef CONFIG_HAS_WAKELOCK + wake_lock_destroy(&data->palm_gesture_wakelock); +#else + wakeup_source_trash(&data->palm_gesture_wakelock); +#endif data->palm_sensor_pdata = NULL; data->palm_detection_enabled = false; return 0; diff --git a/drivers/input/touchscreen/himax_v2_mmi/himax_common.h b/drivers/input/touchscreen/himax_v2_mmi/himax_common.h index 0535106bef3d..850c509d8d0f 100755 --- a/drivers/input/touchscreen/himax_v2_mmi/himax_common.h +++ b/drivers/input/touchscreen/himax_v2_mmi/himax_common.h @@ -473,6 +473,11 @@ struct himax_ts_data { struct himax_sensor_platform_data *palm_sensor_pdata; struct timer_list palm_release_fimer; unsigned int palm_release_delay_ms; +#ifdef CONFIG_HAS_WAKELOCK + struct wake_lock palm_gesture_wakelock; +#else + struct wakeup_source palm_gesture_wakelock; +#endif #endif };