From 9b0454f331efb2274e3f6462e63e723d1d3652d1 Mon Sep 17 00:00:00 2001 From: dengwei1 Date: Tue, 16 Mar 2021 16:13:46 +0800 Subject: [PATCH] pstar: input touch stm fix issue input touch stm fix issue Change-Id: I9a4a67acc176ea1a283c254f7569ee7b61ded6e2 Signed-off-by: dengwei1 Reviewed-on: https://gerrit.mot.com/1902528 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Xiangpo Zhao Submit-Approved: Jira Key --- drivers/input/touchscreen/stmicro_mmi/fts.c | 7 +++++++ drivers/input/touchscreen/stmicro_mmi/fts_lib/ftsCore.c | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/drivers/input/touchscreen/stmicro_mmi/fts.c b/drivers/input/touchscreen/stmicro_mmi/fts.c index 11c830a23c46..7ee08dc41d12 100644 --- a/drivers/input/touchscreen/stmicro_mmi/fts.c +++ b/drivers/input/touchscreen/stmicro_mmi/fts.c @@ -2161,8 +2161,10 @@ static void fts_enter_pointer_event_handler(struct fts_ts_info *info, unsigned input_report_abs(info->input_dev, ABS_MT_POSITION_Y, y); input_report_abs(info->input_dev, ABS_MT_TOUCH_MAJOR, z); input_report_abs(info->input_dev, ABS_MT_TOUCH_MINOR, z); +#if KERNEL_VERSION(5, 4, 0) <= LINUX_VERSION_CODE input_report_abs(info->input_dev, ABS_MT_PRESSURE, z); input_report_abs(info->input_dev, ABS_MT_DISTANCE, distance); +#endif /* logError(0, "%s %s : Event 0x%02x - ID[%d], (x, y) = (%3d, %3d) * Size = %d\n", tag, __func__, *event, touchId, x, y, touchType); */ @@ -3613,6 +3615,9 @@ void fts_resume_func(struct fts_ts_info *info) info->resume_bit = 1; fts_mode_handler(info, 0); info->sensor_sleep = false; +#if KERNEL_VERSION(5, 4, 0) > LINUX_VERSION_CODE + fts_enableInterrupt(); +#endif #if 0 u8 cmd[3] = { FTS_CMD_SYSTEM, SYS_CMD_INT, 1 }; int res; @@ -4207,10 +4212,12 @@ static int fts_probe(struct spi_device *client) AREA_MAX, 0, 0); input_set_abs_params(info->input_dev, ABS_MT_TOUCH_MINOR, AREA_MIN, AREA_MAX, 0, 0); +#if KERNEL_VERSION(5, 4, 0) <= LINUX_VERSION_CODE input_set_abs_params(info->input_dev, ABS_MT_PRESSURE, PRESSURE_MIN, PRESSURE_MAX, 0, 0); input_set_abs_params(info->input_dev, ABS_MT_DISTANCE, DISTANCE_MIN, DISTANCE_MAX, 0, 0); +#endif #ifdef GESTURE_MODE input_set_capability(info->input_dev, EV_KEY, KEY_WAKEUP); diff --git a/drivers/input/touchscreen/stmicro_mmi/fts_lib/ftsCore.c b/drivers/input/touchscreen/stmicro_mmi/fts_lib/ftsCore.c index 2285b3f273f9..b39d3fbeafc2 100644 --- a/drivers/input/touchscreen/stmicro_mmi/fts_lib/ftsCore.c +++ b/drivers/input/touchscreen/stmicro_mmi/fts_lib/ftsCore.c @@ -23,6 +23,7 @@ #include #include #include +#include #include "ftsCompensation.h" #include "ftsCore.h" #include "ftsError.h" @@ -880,10 +881,14 @@ int writeConfig(u16 offset, u8 *data, int len) */ int fts_disableInterrupt(void) { +#if KERNEL_VERSION(5, 4, 0) <= LINUX_VERSION_CODE unsigned long flag; +#endif if (getClient() != NULL) { +#if KERNEL_VERSION(5, 4, 0) <= LINUX_VERSION_CODE spin_lock_irqsave(&fts_int, flag); +#endif if (disable_irq_count == 0) { logError(0, "%s Executing Disable...\n", tag); disable_irq(getClient()->irq); @@ -891,7 +896,9 @@ int fts_disableInterrupt(void) } /* disable_irq is re-entrant so it is required to keep track * of the number of calls of this when reenabling */ +#if KERNEL_VERSION(5, 4, 0) <= LINUX_VERSION_CODE spin_unlock_irqrestore(&fts_int, flag); +#endif return OK; } else { logError(1, "%s %s: Impossible get client irq... ERROR %08X\n",