From afe045cddc84e753f9c8026dd0f719191cd4603b Mon Sep 17 00:00:00 2001 From: wengjun1 Date: Thu, 23 Aug 2018 17:05:52 +0800 Subject: [PATCH] DLKM: Improve focaltech touch driver - Prevent potential risk that the touch has been updated successful but display initial code isn't written fully which will cause display can't work on ft8006u. Change-Id: I0dd8232a79fb1ced88deb748f656a195d97908ac Signed-off-by: wengjun1 Reviewed-on: https://gerrit.mot.com/1232123 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Yeqing Wang Reviewed-by: Huosheng Liao Submit-Approved: Jira Key --- .../focaltech_mmi/focaltech_flash.c | 2 +- .../focaltech_mmi/focaltech_flash.h | 1 + .../touchscreen/focaltech_mmi/focaltech_ts.c | 22 +++++++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/drivers/input/touchscreen/focaltech_mmi/focaltech_flash.c b/drivers/input/touchscreen/focaltech_mmi/focaltech_flash.c index f8af81abeb54..35de0e3c5c80 100644 --- a/drivers/input/touchscreen/focaltech_mmi/focaltech_flash.c +++ b/drivers/input/touchscreen/focaltech_mmi/focaltech_flash.c @@ -1565,7 +1565,7 @@ static int fts_lic_get_vid_in_host(u16 *vid) return 0; } -static int fts_lic_get_ver_in_tp(struct i2c_client *client, u8 *ver) +int fts_lic_get_ver_in_tp(struct i2c_client *client, u8 *ver) { int ret = 0; diff --git a/drivers/input/touchscreen/focaltech_mmi/focaltech_flash.h b/drivers/input/touchscreen/focaltech_mmi/focaltech_flash.h index 14a610ff53db..6f39f65b626b 100644 --- a/drivers/input/touchscreen/focaltech_mmi/focaltech_flash.h +++ b/drivers/input/touchscreen/focaltech_mmi/focaltech_flash.h @@ -224,6 +224,7 @@ int fts_pram_ecc_cal(struct i2c_client *client, u32 saddr, u32 len); int fts_pram_start(struct i2c_client *client); int fts_fwupg_do_upgrade(const char *fwname); +int fts_lic_get_ver_in_tp(struct i2c_client *client, u8 *ver); int fts_extra_init(struct i2c_client *client, struct input_dev *input_dev, struct ft_ts_platform_data *pdata); int fts_extra_exit(void); diff --git a/drivers/input/touchscreen/focaltech_mmi/focaltech_ts.c b/drivers/input/touchscreen/focaltech_mmi/focaltech_ts.c index 2a08127dc3b9..3794fcbd6805 100644 --- a/drivers/input/touchscreen/focaltech_mmi/focaltech_ts.c +++ b/drivers/input/touchscreen/focaltech_mmi/focaltech_ts.c @@ -876,6 +876,13 @@ static void ft_update_fw_id(struct ft_ts_data *data) data->fw_id[0], data->fw_id[1]); } +static void ft_clear_fw_id(struct ft_ts_data *data) +{ + data->fw_id[0] = 0; + data->fw_id[1] = 0; + data->fw_ver[0] = 0; +} + static void ft_ud_fix_mismatch(struct ft_ts_data *data) { int i; @@ -3330,6 +3337,7 @@ static int ft_ts_probe(struct i2c_client *client, struct dentry *temp; u8 reg_value = 0; u8 reg_addr; + u8 lic_ver = 0; int err, retval, attr_count; if (client->dev.of_node) { @@ -3624,6 +3632,20 @@ static int ft_ts_probe(struct i2c_client *client, ft_update_fw_vendor_id(data); ft_update_fw_id(data); + if (pdata->family_id == FT8006U_ID) { + fts_lic_get_ver_in_tp(client, &lic_ver); + /* + * If display initial code isn't written fully, then this value should be + * a negative value with signed(e.g. 0xFF), therefore need to clear the buildid + * info then this will cause script update the touch firmware again. + */ + dev_info(&client->dev, "Display init code ver:%d\n", + (s8)lic_ver); + if ((s8)lic_ver < 0) { + ft_clear_fw_id(data); + } + } + #if defined(CONFIG_FB) INIT_WORK(&data->fb_notify_work, fb_notify_resume_work); data->fb_notif.notifier_call = fb_notifier_callback;