From dd9733e4e148b533ae5a9e039fb7716bcef87179 Mon Sep 17 00:00:00 2001 From: dengwei1 Date: Wed, 19 Jun 2019 12:10:02 +0800 Subject: [PATCH] kane: input update touch fw progress update the touch fw progress to make sure success Change-Id: I4eb39e13ddc74d629fb8e184033a5873db28f57f Signed-off-by: dengwei1 Reviewed-on: https://gerrit.mot.com/1373092 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Hua Tan Submit-Approved: Jira Key (cherry picked from commit f80727c7665bb31e5f78702db6c8a791c96b1091) Reviewed-on: https://gerrit.mot.com/1396782 --- .../touchscreen/hxchipset/himax_common.c | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/drivers/input/touchscreen/hxchipset/himax_common.c b/drivers/input/touchscreen/hxchipset/himax_common.c index 260f6a92d2a8..2a79552002c2 100755 --- a/drivers/input/touchscreen/hxchipset/himax_common.c +++ b/drivers/input/touchscreen/hxchipset/himax_common.c @@ -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 -- 2.20.1