From 17880786ac660127b414a2c6aef8d2feff8c2f33 Mon Sep 17 00:00:00 2001 From: litong20 Date: Mon, 5 Jul 2021 15:38:04 +0800 Subject: [PATCH] Close the calibration operation after fwupdate. TP: After the touch fwupate, if the config id is different from before, the calibration operation will be tiggered. But try not to add calibration operations in touch driver. Change-Id: Id82c331c4617a03cb2351987380eae96d837fb7e Reviewed-on: https://gerrit.mot.com/2002079 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Yeqing Wang Reviewed-by: Jun Weng Reviewed-by: Jichao Zou Submit-Approved: Jira Key --- drivers/input/touchscreen/stmicro_mmi/fts.c | 33 ++++++++++++++------- drivers/input/touchscreen/stmicro_mmi/fts.h | 1 + 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/drivers/input/touchscreen/stmicro_mmi/fts.c b/drivers/input/touchscreen/stmicro_mmi/fts.c index c5c9b85c0098..9524ac213f2f 100644 --- a/drivers/input/touchscreen/stmicro_mmi/fts.c +++ b/drivers/input/touchscreen/stmicro_mmi/fts.c @@ -2857,6 +2857,7 @@ int fts_fw_update(struct fts_ts_info *info) int error = 0; int init_type = NO_INIT; const char *firmware_name; + const struct fts_hw_platform_data *bdata = info->board; #if defined(PRE_SAVED_METHOD) || defined (COMPUTE_INIT_METHOD) int keep_cx = 1; @@ -2986,16 +2987,23 @@ int fts_fw_update(struct fts_ts_info *info) init_type = NO_INIT; } - - if (init_type != NO_INIT) { /* initialization status not correct or - * after FW complete update, do - * initialization. */ - error = fts_chip_initialization(info, init_type); - if (error < OK) - logError(1, - "%s %s Cannot initialize the chip ERROR %08X\n", - tag, - __func__, error); +/** + * Note: The fts_chip_initialization function contains the touchscreen calibration + * operation. We close the operation by default, plese be very careful to + * open it if necessary. +*/ + if (bdata->need_tp_cal) { + if (init_type != NO_INIT) { /* initialization status not correct or + * after FW complete update, do + * initialization. */ + logError(1, "%s Note: Do touch calibration...!\n", tag); + error = fts_chip_initialization(info, init_type); + if (error < OK) + logError(1, + "%s %s Cannot initialize the chip ERROR %08X\n", + tag, + __func__, error); + } } error = fts_init_sensing(info); @@ -3971,6 +3979,11 @@ static int parse_dt(struct device *dev, struct fts_hw_platform_data *bdata) logError(0, "%s flip X\n", tag); } + if (of_property_read_bool(np, "st,need_tp_cal")) { + bdata->need_tp_cal = true; + logError(0, "%s Need to do calibraion after fw upgrade"); + } + if (of_property_read_u8_array(np, "st,interpolation_cmd", bdata->interpolation_cmd, 10) == 0) { bdata->interpolation_ctrl = true; diff --git a/drivers/input/touchscreen/stmicro_mmi/fts.h b/drivers/input/touchscreen/stmicro_mmi/fts.h index 023ed12f083b..02c58d3419f0 100644 --- a/drivers/input/touchscreen/stmicro_mmi/fts.h +++ b/drivers/input/touchscreen/stmicro_mmi/fts.h @@ -234,6 +234,7 @@ struct fts_hw_platform_data { unsigned int y_max; bool y_flip, x_flip; bool power_on_suspend; + bool need_tp_cal; u8 jitter_cmd[8]; /* /< support report rate switching */ bool jitter_ctrl; /* /< support report rate switching */ u8 linearity_cmd[3]; /* /< support report rate switching */