summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordavidycchen <davidycchen@google.com>2020-04-17 15:51:37 +0800
committerDavid Chen <davidycchen@google.com>2020-04-20 09:00:29 +0000
commit59395751579f9959fb2f5abc59a3ee8d90482c83 (patch)
tree060b799c7e3bc3c95078b3c114fb956300386191
parente76eb7999295ff720f2b25db40e0b7cc9d5f50a1 (diff)
downloadfts_touch-59395751579f9959fb2f5abc59a3ee8d90482c83.tar.gz
touch:fts: add command to avoid sensing off before reading rawdata
There would be a sense on force calibration after we set the sensing mode off and on and thus caused the rawdata incorrect. Bug: 154291200 Test: Read touch rawdate correctly. Change-Id: I37b18760c70149a884198abf0524c380b2672df1 Signed-off-by: davidycchen <davidycchen@google.com>
-rw-r--r--fts.c58
1 files changed, 38 insertions, 20 deletions
diff --git a/fts.c b/fts.c
index 455f93d..4a5d9b7 100644
--- a/fts.c
+++ b/fts.c
@@ -1951,14 +1951,20 @@ static ssize_t stm_fts_cmd_show(struct device *dev,
else
setScanMode(SCAN_MODE_LOCKED, LOCKED_ACTIVE);
msleep(WAIT_FOR_FRESH_FRAMES);
- setScanMode(SCAN_MODE_ACTIVE, 0x00);
- msleep(WAIT_AFTER_SENSEOFF);
- /* Delete the events related to some touch
- * (allow to call this function while touching
- * the screen without having a flooding of the
- * FIFO)
+ /* Skip sensing off when typeOfCommand[2]=0x01
+ * to avoid sense on force cal after reading raw data
*/
- flushFIFO();
+ if (!(numberParameters >= 3 &&
+ typeOfCommand[2] == 0x01)) {
+ setScanMode(SCAN_MODE_ACTIVE, 0x00);
+ msleep(WAIT_AFTER_SENSEOFF);
+ /* Delete the events related to some touch
+ * (allow to call this function while touching
+ * the screen without having a flooding of the
+ * FIFO)
+ */
+ flushFIFO();
+ }
#ifdef READ_FILTERED_RAW
res = getMSFrame3(MS_FILTER, &frameMS);
#else
@@ -2000,14 +2006,20 @@ static ssize_t stm_fts_cmd_show(struct device *dev,
else
setScanMode(SCAN_MODE_LOCKED, LOCKED_ACTIVE);
msleep(WAIT_FOR_FRESH_FRAMES);
- setScanMode(SCAN_MODE_ACTIVE, 0x00);
- msleep(WAIT_AFTER_SENSEOFF);
- flushFIFO();
- /* delete the events related to some touch
- * (allow to call this function while touching
- * the screen without having a flooding of the
- * FIFO)
+ /* Skip sensing off when typeOfCommand[2]=0x01
+ * to avoid sense on force cal after reading raw data
*/
+ if (!(numberParameters >= 3 &&
+ typeOfCommand[2] == 0x01)) {
+ setScanMode(SCAN_MODE_ACTIVE, 0x00);
+ msleep(WAIT_AFTER_SENSEOFF);
+ flushFIFO();
+ /* delete the events related to some touch
+ * (allow to call this function while touching
+ * the screen without having a flooding of the
+ * FIFO)
+ */
+ }
if (numberParameters >= 2 &&
typeOfCommand[1] == LOCKED_LP_DETECT)
#ifdef READ_FILTERED_RAW
@@ -2118,12 +2130,18 @@ static ssize_t stm_fts_cmd_show(struct device *dev,
break;
case 0x17: /* Read mutual strength */
pr_info("Get 1 MS Strength\n");
- setScanMode(SCAN_MODE_ACTIVE, 0xFF);
- msleep(WAIT_FOR_FRESH_FRAMES);
- setScanMode(SCAN_MODE_ACTIVE, 0x00);
- msleep(WAIT_AFTER_SENSEOFF);
- /* Flush outstanding touch events */
- flushFIFO();
+ /* Skip sensing off when typeOfCommand[1]=0x01
+ * to avoid sense on force cal after reading raw data
+ */
+ if (!(numberParameters >= 2 &&
+ typeOfCommand[1] == 0x01)) {
+ setScanMode(SCAN_MODE_ACTIVE, 0xFF);
+ msleep(WAIT_FOR_FRESH_FRAMES);
+ setScanMode(SCAN_MODE_ACTIVE, 0x00);
+ msleep(WAIT_AFTER_SENSEOFF);
+ /* Flush outstanding touch events */
+ flushFIFO();
+ }
nodes = getMSFrame3(MS_STRENGTH, &frameMS);
if (nodes < 0) {
res = nodes;