From 40dea5aed3d27bc275a08ab9be396efd6393e656 Mon Sep 17 00:00:00 2001 From: wengjun1 Date: Mon, 18 Nov 2019 20:49:44 +0800 Subject: [PATCH] dlkm: ft8756: Fixed the touch can't works when resume - Because now we found that when the screen is on, the touch has a low probability of not working. It seems that the firmware of the touch works abnormally, so reset the touch when status is abnormal for recover touch function. Change-Id: I1f6f80cb06d5e04bb585e6646620f597757655f7 Signed-off-by: wengjun1 Reviewed-on: https://gerrit.mot.com/1457062 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Hujun Liao Submit-Approved: Jira Key --- .../focaltech_0flash_mmi/focaltech_core.c | 15 ++++++++++++++- .../focaltech_0flash_mmi/focaltech_core.h | 1 + .../focaltech_0flash_mmi/focaltech_spi_v1_1_1.c | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/input/touchscreen/focaltech_0flash_mmi/focaltech_core.c b/drivers/input/touchscreen/focaltech_0flash_mmi/focaltech_core.c index 643d70a16988..c2cb1aa4fa67 100755 --- a/drivers/input/touchscreen/focaltech_0flash_mmi/focaltech_core.c +++ b/drivers/input/touchscreen/focaltech_0flash_mmi/focaltech_core.c @@ -120,7 +120,7 @@ int fts_wait_tp_to_valid(void) do { ret = fts_read_reg(FTS_REG_CHIP_ID, ®_value); if ((ret < 0) || (reg_value != chip_id)) { - FTS_DEBUG("TP Not Ready, ReadData = 0x%x", reg_value); + FTS_INFO("TP Not Ready, ReadData = 0x%x", reg_value); } else if (reg_value == chip_id) { FTS_INFO("TP Ready, Device ID = 0x%x", reg_value); return 0; @@ -1575,6 +1575,10 @@ static int fts_parse_dt(struct device *dev, struct fts_ts_platform_data *pdata) if (pdata->always_on_vio) FTS_INFO("TP VIO always on."); + pdata->rst_in_resume = of_property_read_bool(np, "focaltech,rst_in_resume"); + if (pdata->rst_in_resume) + FTS_INFO("Reset touch when firmware abnormal in resume."); + pdata->irq_gpio = of_get_named_gpio_flags(np, "focaltech,irq-gpio", 0, &pdata->irq_gpio_flags); if (pdata->irq_gpio < 0) @@ -2206,6 +2210,7 @@ static int fts_ts_suspend(struct device *dev) static int _fts_ts_resume(struct device *dev) { + int ret = 0; struct fts_ts_data *ts_data = fts_data; #ifdef FOCALTECH_SENSOR_EN @@ -2236,6 +2241,14 @@ static int _fts_ts_resume(struct device *dev) } fts_irq_enable(); + + if (ts_data->pdata->rst_in_resume) { + ret = fts_wait_tp_to_valid(); + if(ret){ + FTS_INFO("wait tp to valid abnormal,need reset tp"); + fts_reset_proc(200); + } + } fts_tp_state_recovery(ts_data); #if FTS_ESDCHECK_EN diff --git a/drivers/input/touchscreen/focaltech_0flash_mmi/focaltech_core.h b/drivers/input/touchscreen/focaltech_0flash_mmi/focaltech_core.h index 5f23d9d320e4..4abef3124468 100755 --- a/drivers/input/touchscreen/focaltech_0flash_mmi/focaltech_core.h +++ b/drivers/input/touchscreen/focaltech_0flash_mmi/focaltech_core.h @@ -136,6 +136,7 @@ struct fts_ts_platform_data { u32 reset_gpio; u32 reset_gpio_flags; bool always_on_vio; + bool rst_in_resume; bool share_reset_gpio; bool have_key; u32 key_number; diff --git a/drivers/input/touchscreen/focaltech_0flash_mmi/focaltech_spi_v1_1_1.c b/drivers/input/touchscreen/focaltech_0flash_mmi/focaltech_spi_v1_1_1.c index 2ee3bda56d55..d5d1538aa22b 100755 --- a/drivers/input/touchscreen/focaltech_0flash_mmi/focaltech_spi_v1_1_1.c +++ b/drivers/input/touchscreen/focaltech_0flash_mmi/focaltech_spi_v1_1_1.c @@ -275,7 +275,7 @@ int fts_read(u8 *cmd, u32 cmdlen, u8 *data, u32 datalen) } break; } else { - FTS_DEBUG("data read(status=%x),retry=%d,ret=%d", + FTS_INFO("data read(status=%x),retry=%d,ret=%d", rxbuf[3], i, ret); ret = -EIO; udelay(CS_HIGH_DELAY);