From bad4b4d393ec520c802a2bf4eeebea0d8df52484 Mon Sep 17 00:00:00 2001 From: litong20 Date: Mon, 22 Nov 2021 16:38:28 +0800 Subject: [PATCH] Add calibration noise error handler TP: If the noise detection fails after calibration, the touch IC will report the "F3 E0" event, and when the event is received, the touch driver will send the calibration command again. Change-Id: Ifd2f4bd287fbdc7861a127d2ffd481f635d963c7 Reviewed-on: https://gerrit.mot.com/2123149 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Jichao Zou Submit-Approved: Jira Key --- drivers/input/touchscreen/stmicro_mmi/fts_lib/ftsError.c | 4 ++++ drivers/input/touchscreen/stmicro_mmi/fts_lib/ftsIO.c | 2 +- drivers/input/touchscreen/stmicro_mmi/fts_lib/ftsSoftware.h | 1 + drivers/input/touchscreen/stmicro_mmi/fts_mmi_class.c | 4 ++++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/input/touchscreen/stmicro_mmi/fts_lib/ftsError.c b/drivers/input/touchscreen/stmicro_mmi/fts_lib/ftsError.c index 9b16c3d5aa6f..4db6d8091333 100644 --- a/drivers/input/touchscreen/stmicro_mmi/fts_lib/ftsError.c +++ b/drivers/input/touchscreen/stmicro_mmi/fts_lib/ftsError.c @@ -218,6 +218,10 @@ int errorHandler(u8 *event, int size) case EVT_TYPE_ERROR_ITO_KEYOPEN: logError(1, "%s errorHandler: Key Open !\n", tag); break; + case EVT_TYPE_ERROR_CAL_NOISE: + logError(1, "%s errorHandler: Calibration noise check error !\n", tag); + res = (ERROR_HANDLER_STOP_PROC | res); + break; default: logError(1, "%s errorHandler: No Action taken!\n", tag); diff --git a/drivers/input/touchscreen/stmicro_mmi/fts_lib/ftsIO.c b/drivers/input/touchscreen/stmicro_mmi/fts_lib/ftsIO.c index 81d26ab494fe..85bef81c86f8 100644 --- a/drivers/input/touchscreen/stmicro_mmi/fts_lib/ftsIO.c +++ b/drivers/input/touchscreen/stmicro_mmi/fts_lib/ftsIO.c @@ -363,7 +363,7 @@ int fts_writeFwCmd(u8 *cmd, int cmdLength) ret2 = checkEcho(cmd, cmdLength); if (ret < OK || ret2 < OK) msleep(I2C_WAIT_BEFORE_RETRY); - /* logError(1,"%s fts_writeCmd: attempt %d\n", tag, retry); */ + logError(1,"%s fts_writeCmd: attempt %d\n", tag, retry); } if (ret < 0) { logError(1, "%s fts_writeFwCmd: ERROR %08X\n", tag, diff --git a/drivers/input/touchscreen/stmicro_mmi/fts_lib/ftsSoftware.h b/drivers/input/touchscreen/stmicro_mmi/fts_lib/ftsSoftware.h index df0a0221bfc9..dc0fa30b2443 100644 --- a/drivers/input/touchscreen/stmicro_mmi/fts_lib/ftsSoftware.h +++ b/drivers/input/touchscreen/stmicro_mmi/fts_lib/ftsSoftware.h @@ -443,6 +443,7 @@ typedef enum { * Subsection Area Header */ #define EVT_TYPE_ERROR_CRC_CX_SUB 0xA6 /* /< CRC error in the CX * Subsection Area */ +#define EVT_TYPE_ERROR_CAL_NOISE 0xE0 #define EVT_TYPE_ERROR_ESD 0xF0 /* /< ESD error */ /** @}*/ diff --git a/drivers/input/touchscreen/stmicro_mmi/fts_mmi_class.c b/drivers/input/touchscreen/stmicro_mmi/fts_mmi_class.c index 6a6c0195fa0b..e3c59a59d7fb 100644 --- a/drivers/input/touchscreen/stmicro_mmi/fts_mmi_class.c +++ b/drivers/input/touchscreen/stmicro_mmi/fts_mmi_class.c @@ -533,6 +533,9 @@ static ssize_t fts_mmi_calibrate_store(struct device *dev, return -EINVAL; } + /* disable irq to fully control IC*/ + fts_disableInterrupt(); + if (value == 3) { u8 cmd[3] = { FTS_CMD_SYSTEM, SYS_CMD_SPECIAL, SPECIAL_FULL_PANEL_INIT }; pr_info("Sending Event [0x%02x 0x%02x 0x%02x]...\n", @@ -549,6 +552,7 @@ static ssize_t fts_mmi_calibrate_store(struct device *dev, return -EINVAL; } + fts_enableInterrupt(); return size; }