kane: input update touch fw progress
authordengwei1 <dengwei1@motorola.com>
Wed, 19 Jun 2019 04:10:02 +0000 (12:10 +0800)
committerxiest1 <xiest1@lenovo.com>
Tue, 5 Nov 2019 09:32:08 +0000 (17:32 +0800)
update the touch fw progress
to make sure success

Change-Id: I4eb39e13ddc74d629fb8e184033a5873db28f57f
Signed-off-by: dengwei1 <dengwei1@motorola.com>
Reviewed-on: https://gerrit.mot.com/1373092
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Hua Tan <tanhua1@motorola.com>
Submit-Approved: Jira Key
(cherry picked from commit f80727c7665bb31e5f78702db6c8a791c96b1091)
Reviewed-on: https://gerrit.mot.com/1396782

drivers/input/touchscreen/hxchipset/himax_common.c

index 260f6a92d2a89b4723d1d5325ea225cbfa9ea29c..2a79552002c24bc259fa01a76298618ba3f2aa6e 100755 (executable)
@@ -46,6 +46,7 @@
 char *i_CTPM_firmware_name = "Himax_firmware.bin";
 bool g_auto_update_flag = false;
 #endif
+bool g_fw_checksum = false;
 #if defined(HX_AUTO_UPDATE_FW)
 unsigned char *i_CTPM_FW = NULL;
 int i_CTPM_FW_len;
@@ -2142,6 +2143,7 @@ static int himax_fw_updater (struct himax_ts_data *ts, const char *fileName) {
        const struct firmware *fw = NULL;
        int fw_type = 0;
        int result;
+       int update_times = 0;
 
        himax_int_enable(0);
 
@@ -2155,6 +2157,7 @@ static int himax_fw_updater (struct himax_ts_data *ts, const char *fileName) {
 
        fw_type = (fw->size)/1024;
        I("Now FW size is : %dk\n", fw_type);
+update_retry:
        switch (fw_type) {
        case 32:
                result = g_core_fp.fp_fts_ctpm_fw_upgrade_with_sys_fs_32k(
@@ -2200,14 +2203,20 @@ static int himax_fw_updater (struct himax_ts_data *ts, const char *fileName) {
                E("%s: Flash command fail: %d\n", __func__, __LINE__);
                break;
        }
-       if (result == 0)
-               private_ts->fw_upgrade_status = FW_NOT_READY;
-       else
+
+       if (result == 0) {
+               update_times++;
+               if(update_times < 3)
+                       goto update_retry;
+               else
+                       private_ts->fw_upgrade_status = FW_NOT_READY;
+       } else {
+               g_core_fp.fp_read_FW_ver();
+               g_core_fp.fp_touch_information();
                private_ts->fw_upgrade_status = READY_TO_SERVE;
+       }
 
        release_firmware(fw);
-       g_core_fp.fp_read_FW_ver();
-       g_core_fp.fp_touch_information();
 
 #ifdef HX_RST_PIN_FUNC
        g_core_fp.fp_ic_reset(true, false);
@@ -2596,9 +2605,13 @@ int himax_chip_common_init(void)
        g_auto_update_flag |= g_core_fp.fp_flash_lastdata_check();
        if (g_auto_update_flag)
                goto FW_force_upgrade;
+#else
+       g_fw_checksum = (!g_core_fp.fp_calculateChecksum(false));
+       g_fw_checksum |= g_core_fp.fp_flash_lastdata_check();
 #endif
 #ifndef HX_ZERO_FLASH
-       g_core_fp.fp_read_FW_ver();
+       if(g_fw_checksum == false)
+               g_core_fp.fp_read_FW_ver();
 #endif
 
 #ifdef HX_AUTO_UPDATE_FW