From c0c9a384cce259ed0448e545453844c7c75e372f Mon Sep 17 00:00:00 2001 From: Wenge Zhu Date: Thu, 10 Nov 2022 11:13:23 +0800 Subject: [PATCH] Optimize FocalTech gesture mode Receive gesture type through extended API and remove redundant codes. Change-Id: I9fe49271cd1ae2066f45796754484949e8826409 Signed-off-by: Wenge Zhu Reviewed-on: https://gerrit.mot.com/2425688 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Jianqi Yang Reviewed-by: Wei Deng Submit-Approved: Jira Key --- .../focaltech_touch_v3/focaltech_ts_mmi.c | 43 ++++++++++--------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/drivers/input/touchscreen/focaltech_touch_v3/focaltech_ts_mmi.c b/drivers/input/touchscreen/focaltech_touch_v3/focaltech_ts_mmi.c index 4f84977d7edc..a867e2af4d8f 100644 --- a/drivers/input/touchscreen/focaltech_touch_v3/focaltech_ts_mmi.c +++ b/drivers/input/touchscreen/focaltech_touch_v3/focaltech_ts_mmi.c @@ -235,7 +235,10 @@ static int fts_mmi_panel_state(struct device *dev, struct fts_ts_platform_data *pdata; struct fts_ts_data *ts_data; int ret = 0; - static u8 gesture_command = 0; +#if defined(CONFIG_FTS_DOUBLE_TAP_CONTROL) + u8 gesture_command = 0; + unsigned char gesture_type = 0; +#endif GET_TS_DATA(dev); pdata = ts_data->pdata; @@ -249,6 +252,24 @@ static int fts_mmi_panel_state(struct device *dev, break; case TS_MMI_PM_GESTURE: +#if defined(CONFIG_FTS_DOUBLE_TAP_CONTROL) + if (ts_data->imports && ts_data->imports->get_gesture_type) { + ret = ts_data->imports->get_gesture_type(ts_data->dev, &gesture_type); + } + + if (gesture_type & TS_MMI_GESTURE_SINGLE) { + gesture_command |= (1 << 7); + FTS_INFO("Enable GESTURE_CLI_SINGLE command: %02x", gesture_command); + } + if (gesture_type & TS_MMI_GESTURE_DOUBLE) { + gesture_command |= (1 << 4); + FTS_INFO("Enable GESTURE_CLI_DOUBLE command: %02x", gesture_command); + } + + FTS_INFO("CLI GESTURE SWITCH command: %02x", gesture_command); + ts_data->gsx_cmd = gesture_command; +#endif + #if FTS_GESTURE_EN if (fts_gesture_suspend(ts_data) == 0) { /* Enter into gesture mode(suspend) */ @@ -260,26 +281,6 @@ static int fts_mmi_panel_state(struct device *dev, #endif break; - case TS_MMI_PM_GESTURE_CLI_SINGLE: - gesture_command |= (1 << 7); - FTS_INFO("Enable GESTURE_CLI_SINGLE command: %02x", gesture_command); - break; - - case TS_MMI_PM_GESTURE_CLI_DOUBLE: - gesture_command |= (1 << 4); - FTS_INFO("Enable GESTURE_CLI_DOUBLE command: %02x", gesture_command); - break; - - case TS_MMI_PM_GESTURE_SWITCH: - FTS_INFO("CLI GESTURE SWITCH command: %02x", gesture_command); - ts_data->gsx_cmd = gesture_command; - if (fts_gesture_suspend(ts_data) == 0) { - ts_data->wakeable = true; - ts_data->gesture_support = true; - } - gesture_command = 0; - break; - case TS_MMI_PM_ACTIVE: break; default: