From 079c16f43a5398bdc46aa8c25980f3918f2a9107 Mon Sep 17 00:00:00 2001
From: c00187401 <c00187401@notesmail.huawei.com>
Date: Wed, 22 Mar 2017 19:27:28 +0800
Subject: [PATCH] Input TP: Modify the TP in the wake of the problem does not
 respond

In the process of repeated sleep and wake up ,sometime TP firmware will not be
able to respond to the AP's TP driver. So it should be in the wake up
function to do abnormal detection. When the TP exception occurs, the TP
driver reset TP firmware.

Change-Id: Ic6175981238cf80380b8d27c5d1b1e93e50c6397
---
 .../input/touchscreen/cyttsp5_cs445a/cyttsp5_core.c    | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
 mode change 100644 => 100755 drivers/input/touchscreen/cyttsp5_cs445a/cyttsp5_core.c

diff --git a/drivers/input/touchscreen/cyttsp5_cs445a/cyttsp5_core.c b/drivers/input/touchscreen/cyttsp5_cs445a/cyttsp5_core.c
old mode 100644
new mode 100755
index 0a73be33a460..1f5c8642a95d
--- a/drivers/input/touchscreen/cyttsp5_cs445a/cyttsp5_core.c
+++ b/drivers/input/touchscreen/cyttsp5_cs445a/cyttsp5_core.c
@@ -51,6 +51,8 @@ extern struct dsm_client *tp_cyp_dclient;
 extern ssize_t cyttsp5_dsm_record_basic_err_info(struct device *dev);
 extern int cyttsp5_tp_report_dsm_err(struct device *dev, int type, int err_numb);
 #endif/*CONFIG_HUAWEI_DSM*/
+static int _fast_startup(struct cyttsp5_core_data *cd);
+
 struct device *gdev = NULL;
 struct device *cyttsp5_core_dev = NULL;
 struct cyttsp5_hid_field {
@@ -4309,7 +4311,13 @@ static int cyttsp5_core_wake_device_from_easy_wakeup_(
 			cd->easy_wakeup_gesture, &status);
 	if (rc || status == 1){
 		tp_log_err("%s: failed, rc=%d, status=%d\n", __func__, rc, status);
-		return -EBUSY;
+		rc = cyttsp5_reset_and_wait(cd);
+		if (rc < 0) {
+			dev_err(cd->dev, "%s: Error on h/w reset r=%d\n",__func__, rc);
+			return rc;
+		}
+		_fast_startup(cd);
+		return 0;
 	}
 
 	if (device_may_wakeup(cd->dev)) {
-- 
GitLab