From fa99fed1fef90c2bd796017ca0967d65a8f1f46f Mon Sep 17 00:00:00 2001 From: haojl2 Date: Tue, 20 Aug 2019 16:47:35 +0800 Subject: [PATCH] himax_v2_mmi: Add delay when palm leave. TP: Add 850ms delay when palm release found. Change-Id: Ie7bde3057c2655e421d7ea0887d7c00cdcc133c6 Signed-off-by: haojl2 Reviewed-on: https://gerrit.mot.com/1406178 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Jianqi Yang Submit-Approved: Jira Key --- .../touchscreen/himax_v2_mmi/himax_common.c | 19 ++++++++++++++++--- .../touchscreen/himax_v2_mmi/himax_common.h | 2 ++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/input/touchscreen/himax_v2_mmi/himax_common.c b/drivers/input/touchscreen/himax_v2_mmi/himax_common.c index 30b911fd21dc..ce4202294b6d 100644 --- a/drivers/input/touchscreen/himax_v2_mmi/himax_common.c +++ b/drivers/input/touchscreen/himax_v2_mmi/himax_common.c @@ -2743,12 +2743,12 @@ static void himax_report_points(struct himax_ts_data *ts) #if defined(HX_PALM_REPORT) && defined(HIMAX_PALM_SENSOR_EN) if (ts->palm_detection_enabled) { if (himax_palm_detect(hx_touch_data->hx_coord_buf) == PALM_REPORT) { - I(" %s HX_PALM_REPORT\n", __func__); + del_timer(&ts->palm_release_fimer); himax_palm_detect_func(ts, true); return; } else if (himax_palm_detect(hx_touch_data->hx_coord_buf) == PALM_LEAVE_REPORT) { - I(" %s HX_PALM_LEAVE_REPORT\n", __func__); - himax_palm_detect_func(ts, false); + mod_timer(&ts->palm_release_fimer, + jiffies + msecs_to_jiffies(ts->palm_release_delay_ms)); return; } } @@ -2822,6 +2822,11 @@ END_FUNCTION: } #ifdef HIMAX_PALM_SENSOR_EN +static void himax_palm_sensor_release_timer_handler(unsigned long data) +{ + himax_palm_detect_func(private_ts, false); +} + static int himax_palm_detect_sensor_set_enable(struct sensors_classdev *sensors_cdev, unsigned int enable) { @@ -2830,6 +2835,10 @@ static int himax_palm_detect_sensor_set_enable(struct sensors_classdev *sensors_ g_core_fp.fp_palm_detection_function(1); private_ts->palm_detection_enabled = true; } else if (enable == 0) { + if (timer_pending(&private_ts->palm_release_fimer)) { + himax_palm_detect_func(private_ts, false); + del_timer(&private_ts->palm_release_fimer); + } g_core_fp.fp_palm_detection_function(0); private_ts->palm_detection_enabled = false; } else @@ -2881,6 +2890,10 @@ static int himax_palm_detect_sensor_init(struct himax_ts_data *data) if (err) goto unregister_sensor_input_device; + data->palm_release_fimer.function = himax_palm_sensor_release_timer_handler; + init_timer(&data->palm_release_fimer); + data->palm_release_delay_ms = 850; + return 0; unregister_sensor_input_device: diff --git a/drivers/input/touchscreen/himax_v2_mmi/himax_common.h b/drivers/input/touchscreen/himax_v2_mmi/himax_common.h index cf8c1f9b31ba..0535106bef3d 100755 --- a/drivers/input/touchscreen/himax_v2_mmi/himax_common.h +++ b/drivers/input/touchscreen/himax_v2_mmi/himax_common.h @@ -471,6 +471,8 @@ struct himax_ts_data { #ifdef HIMAX_PALM_SENSOR_EN bool palm_detection_enabled; struct himax_sensor_platform_data *palm_sensor_pdata; + struct timer_list palm_release_fimer; + unsigned int palm_release_delay_ms; #endif };