Loading drivers/input/touchscreen/st/fts.c +26 −9 Original line number Diff line number Diff line Loading @@ -220,7 +220,7 @@ static ssize_t fts_fwupdate_store(struct device *dev, } logError(0, "%s Starting flashing procedure...\n", tag); ret = flash_burn(fwD, mode, !mode); ret = flash_burn(&fwD, mode, !mode); if (ret < OK && ret != (ERROR_FW_NO_UPDATE | ERROR_FLASH_BURN_FAILED)) logError(0, "%s flashProcedure: ERROR %02X\n", Loading Loading @@ -3287,23 +3287,39 @@ static void fts_fw_update_auto(struct work_struct *work) struct delayed_work, work); int crc_status = 0; int error = 0; struct Firmware fwD; int orig_size; u8 *orig_data; info = container_of(fwu_work, struct fts_ts_info, fwu_work); logError(0, "%s Fw Auto Update is starting...\n", tag); fts_chip_powercycle(info); retval = flashProcedure(PATH_FILE_FW, crc_status, 1); if ((retval & ERROR_FILE_NOT_FOUND) == ERROR_FILE_NOT_FOUND || retval == (ERROR_FW_NO_UPDATE | ERROR_FLASH_BURN_FAILED)) { logError(1, "%s %s: no firmware file or no newer firmware!\n", tag, __func__); ret = getFWdata(PATH_FILE_FW, &orig_data, &orig_size, 0); if (ret < OK) { logError(0, "%s %s: impossible retrieve FW... ERROR %08X\n", tag, __func__, ERROR_MEMH_READ); ret = (ret | ERROR_MEMH_READ); goto NO_FIRMWARE_UPDATE; } ret = parseBinFile(orig_data, orig_size, &fwD, 1); if (ret < OK) { logError(1, "%s %s: impossible parse ERROR %08X\n", tag, __func__, ERROR_MEMH_READ); ret = (ret | ERROR_MEMH_READ); kfree(fwD.data); goto NO_FIRMWARE_UPDATE; } else if ((retval & 0xFF000000) == ERROR_FLASH_PROCEDURE) { } fts_chip_powercycle(info); retval = flash_burn(&fwD, crc_status, 1); if ((retval & 0xFF000000) == ERROR_FLASH_PROCEDURE) { logError(1, "%s %s:firmware update retry! ERROR %08X\n", tag, __func__, retval); fts_chip_powercycle(info); retval1 = flashProcedure(PATH_FILE_FW, crc_status, 1); retval1 = flash_burn(&fwD, crc_status, 1); if ((retval1 & 0xFF000000) == ERROR_FLASH_PROCEDURE) { logError(1, "%s %s: update failed again! ERROR %08X\n", Loading @@ -3312,6 +3328,7 @@ static void fts_fw_update_auto(struct work_struct *work) } } kfree(fwD.data); u16ToU8_be(SYSTEM_RESET_ADDRESS, &cmd[1]); ret = fts_writeCmd(cmd, 4); if (ret < OK) { Loading drivers/input/touchscreen/st/fts_lib/ftsFlash.c +27 −21 Original line number Diff line number Diff line Loading @@ -78,6 +78,8 @@ #define LOAD_FW_FROM 0 #endif #define FTS_LATEST_VERSION 0x1101 static char tag[8] = "[ FTS ]\0"; int getFirmwareVersion(u16 *fw_vers, u16 *config_id) Loading Loading @@ -142,6 +144,10 @@ int getFWdata(const char *pathToFile, u8 **data, int *size, int from) #endif default: logError(0, "%s Read FW from BIN file!\n", tag); if (ftsInfo.u16_fwVer == FTS_LATEST_VERSION) return ERROR_FW_NO_UPDATE; dev = getDev(); if (dev != NULL) { Loading Loading @@ -219,7 +225,7 @@ int flashProcedure(const char *path, int force, int keep_cx) logError(0, "%s Fw file read COMPLETED!\n", tag); logError(0, "%s Starting flashing procedure...\n", tag); res = flash_burn(fw, force, keep_cx); res = flash_burn(&fw, force, keep_cx); if (res < OK && res != (ERROR_FW_NO_UPDATE | ERROR_FLASH_BURN_FAILED)) { logError(1, "%s %s: ERROR %02X\n", tag, __func__, ERROR_FLASH_PROCEDURE); Loading Loading @@ -453,13 +459,13 @@ int fillMemory(u32 address, u8 *data, int size) return OK; } int flash_burn(Firmware fw, int force_burn, int keep_cx) int flash_burn(Firmware *fw, int force_burn, int keep_cx) { u8 cmd; int res; if (!force_burn && (ftsInfo.u16_fwVer >= fw.fw_ver) && (ftsInfo.u16_cfgId >= fw.config_id)) { if (!force_burn && (ftsInfo.u16_fwVer >= fw->fw_ver) && (ftsInfo.u16_cfgId >= fw->config_id)) { logError(0, "Firmware in the chip newer"); logError(0, " or equal to the one to burn! "); logError(0, "%s %s:NO UPDATE ERROR %02X\n", Loading Loading @@ -498,7 +504,7 @@ int flash_burn(Firmware fw, int force_burn, int keep_cx) //Write the lower part of the Program RAM logError(0, "%s 3) PREPARING DATA FOR FLASH BURN:\n", tag); res = fillMemory(FLASH_ADDR_CODE, fw.data, fw.data_size); res = fillMemory(FLASH_ADDR_CODE, fw->data, fw->data_size); if (res < 0) { logError(1, "%s Error During filling the memory!%02X\n", tag, ERROR_FLASH_BURN_FAILED); Loading Loading @@ -567,15 +573,15 @@ int flash_burn(Firmware fw, int force_burn, int keep_cx) return (res | ERROR_FLASH_BURN_FAILED); } if ((ftsInfo.u16_fwVer != fw.fw_ver) && (ftsInfo.u16_cfgId != fw.config_id)) { if ((ftsInfo.u16_fwVer != fw->fw_ver) && (ftsInfo.u16_cfgId != fw->config_id)) { logError(1, "Firmware in the chip different"); logError(1, " from the one that was burn!"); logError(1, "%s fw: %x != %x , conf: %x != %x\n", tag, ftsInfo.u16_fwVer, fw.fw_ver, fw->fw_ver, ftsInfo.u16_cfgId, fw.config_id); fw->config_id); return ERROR_FLASH_BURN_FAILED; } Loading Loading @@ -1015,14 +1021,14 @@ int fillFlash(u32 address, u8 *data, int size) return OK; } int flash_burn(struct Firmware fw, int force_burn, int keep_cx) int flash_burn(struct Firmware *fw, int force_burn, int keep_cx) { int res; if (!force_burn && (ftsInfo.u16_fwVer >= fw.fw_ver) && (ftsInfo.u16_cfgId >= fw.config_id)) { if (!force_burn && (ftsInfo.u16_fwVer >= fw->fw_ver) && (ftsInfo.u16_cfgId >= fw->config_id)) { for (res = EXTERNAL_RELEASE_INFO_SIZE-1; res >= 0; res--) { if (fw.externalRelease[res] > if (fw->externalRelease[res] > ftsInfo.u8_extReleaseInfo[res]) goto start; } Loading @@ -1045,7 +1051,7 @@ int flash_burn(struct Firmware fw, int force_burn, int keep_cx) if (res < OK) { logError(1, "%s warm boot FAILED!\n", tag); return (res | ERROR_FLASH_BURN_FAILED); } /*else*/ } logError(0, "%s warm boot COMPLETED!\n\n", tag); //mdelay(FLASH_WAIT_TIME); Loading Loading @@ -1084,8 +1090,8 @@ int flash_burn(struct Firmware fw, int force_burn, int keep_cx) //mdelay(FLASH_WAIT_TIME); logError(0, "%s 6) LOAD PROGRAM:\n", tag); res = fillFlash(FLASH_ADDR_CODE, &fw.data[0], fw.sec0_size); res = fillFlash(FLASH_ADDR_CODE, (u8 *)(&fw->data[0]), fw->sec0_size); if (res < OK) { logError(1, "%s load program ERROR %02X\n", tag, ERROR_FLASH_BURN_FAILED); Loading @@ -1094,7 +1100,7 @@ int flash_burn(struct Firmware fw, int force_burn, int keep_cx) logError(0, "%s load program DONE!\n", tag); logError(0, "%s 7) LOAD CONFIG:\n", tag); res = fillFlash(FLASH_ADDR_CONFIG, &(fw.data[fw.sec0_size]), fw.sec1_size); &(fw->data[fw->sec0_size]), fw->sec1_size); if (res < OK) { logError(1, "%s load config ERROR %02X\n", tag, ERROR_FLASH_BURN_FAILED); Loading Loading @@ -1122,12 +1128,12 @@ int flash_burn(struct Firmware fw, int force_burn, int keep_cx) return (res | ERROR_FLASH_BURN_FAILED); } if ((ftsInfo.u16_fwVer != fw.fw_ver) && (ftsInfo.u16_cfgId != fw.config_id)) { if ((ftsInfo.u16_fwVer != fw->fw_ver) && (ftsInfo.u16_cfgId != fw->config_id)) { pr_err("Firmware is different from the old!\n"); logError(1, "%s fw: %x != %x, conf: %x != %x\n", tag, ftsInfo.u16_fwVer, fw.fw_ver, ftsInfo.u16_cfgId, fw.config_id); tag, ftsInfo.u16_fwVer, fw->fw_ver, ftsInfo.u16_cfgId, fw->config_id); return ERROR_FLASH_BURN_FAILED; } Loading drivers/input/touchscreen/st/fts_lib/ftsFlash.h +1 −1 Original line number Diff line number Diff line Loading @@ -102,7 +102,7 @@ int getFirmwareVersion(u16 *fw_vers, u16 *config_id); int getFWdata(const char *pathToFile, u8 **data, int *size, int from); int parseBinFile(u8 *fw_data, int fw_size, struct Firmware *fw, int keep_cx); int readFwFile(const char *path, struct Firmware *fw, int keep_cx); int flash_burn(struct Firmware fw, int force_burn, int keep_cx); int flash_burn(struct Firmware *fw, int force_burn, int keep_cx); int flashProcedure(const char *path, int force, int keep_cx); #endif Loading
drivers/input/touchscreen/st/fts.c +26 −9 Original line number Diff line number Diff line Loading @@ -220,7 +220,7 @@ static ssize_t fts_fwupdate_store(struct device *dev, } logError(0, "%s Starting flashing procedure...\n", tag); ret = flash_burn(fwD, mode, !mode); ret = flash_burn(&fwD, mode, !mode); if (ret < OK && ret != (ERROR_FW_NO_UPDATE | ERROR_FLASH_BURN_FAILED)) logError(0, "%s flashProcedure: ERROR %02X\n", Loading Loading @@ -3287,23 +3287,39 @@ static void fts_fw_update_auto(struct work_struct *work) struct delayed_work, work); int crc_status = 0; int error = 0; struct Firmware fwD; int orig_size; u8 *orig_data; info = container_of(fwu_work, struct fts_ts_info, fwu_work); logError(0, "%s Fw Auto Update is starting...\n", tag); fts_chip_powercycle(info); retval = flashProcedure(PATH_FILE_FW, crc_status, 1); if ((retval & ERROR_FILE_NOT_FOUND) == ERROR_FILE_NOT_FOUND || retval == (ERROR_FW_NO_UPDATE | ERROR_FLASH_BURN_FAILED)) { logError(1, "%s %s: no firmware file or no newer firmware!\n", tag, __func__); ret = getFWdata(PATH_FILE_FW, &orig_data, &orig_size, 0); if (ret < OK) { logError(0, "%s %s: impossible retrieve FW... ERROR %08X\n", tag, __func__, ERROR_MEMH_READ); ret = (ret | ERROR_MEMH_READ); goto NO_FIRMWARE_UPDATE; } ret = parseBinFile(orig_data, orig_size, &fwD, 1); if (ret < OK) { logError(1, "%s %s: impossible parse ERROR %08X\n", tag, __func__, ERROR_MEMH_READ); ret = (ret | ERROR_MEMH_READ); kfree(fwD.data); goto NO_FIRMWARE_UPDATE; } else if ((retval & 0xFF000000) == ERROR_FLASH_PROCEDURE) { } fts_chip_powercycle(info); retval = flash_burn(&fwD, crc_status, 1); if ((retval & 0xFF000000) == ERROR_FLASH_PROCEDURE) { logError(1, "%s %s:firmware update retry! ERROR %08X\n", tag, __func__, retval); fts_chip_powercycle(info); retval1 = flashProcedure(PATH_FILE_FW, crc_status, 1); retval1 = flash_burn(&fwD, crc_status, 1); if ((retval1 & 0xFF000000) == ERROR_FLASH_PROCEDURE) { logError(1, "%s %s: update failed again! ERROR %08X\n", Loading @@ -3312,6 +3328,7 @@ static void fts_fw_update_auto(struct work_struct *work) } } kfree(fwD.data); u16ToU8_be(SYSTEM_RESET_ADDRESS, &cmd[1]); ret = fts_writeCmd(cmd, 4); if (ret < OK) { Loading
drivers/input/touchscreen/st/fts_lib/ftsFlash.c +27 −21 Original line number Diff line number Diff line Loading @@ -78,6 +78,8 @@ #define LOAD_FW_FROM 0 #endif #define FTS_LATEST_VERSION 0x1101 static char tag[8] = "[ FTS ]\0"; int getFirmwareVersion(u16 *fw_vers, u16 *config_id) Loading Loading @@ -142,6 +144,10 @@ int getFWdata(const char *pathToFile, u8 **data, int *size, int from) #endif default: logError(0, "%s Read FW from BIN file!\n", tag); if (ftsInfo.u16_fwVer == FTS_LATEST_VERSION) return ERROR_FW_NO_UPDATE; dev = getDev(); if (dev != NULL) { Loading Loading @@ -219,7 +225,7 @@ int flashProcedure(const char *path, int force, int keep_cx) logError(0, "%s Fw file read COMPLETED!\n", tag); logError(0, "%s Starting flashing procedure...\n", tag); res = flash_burn(fw, force, keep_cx); res = flash_burn(&fw, force, keep_cx); if (res < OK && res != (ERROR_FW_NO_UPDATE | ERROR_FLASH_BURN_FAILED)) { logError(1, "%s %s: ERROR %02X\n", tag, __func__, ERROR_FLASH_PROCEDURE); Loading Loading @@ -453,13 +459,13 @@ int fillMemory(u32 address, u8 *data, int size) return OK; } int flash_burn(Firmware fw, int force_burn, int keep_cx) int flash_burn(Firmware *fw, int force_burn, int keep_cx) { u8 cmd; int res; if (!force_burn && (ftsInfo.u16_fwVer >= fw.fw_ver) && (ftsInfo.u16_cfgId >= fw.config_id)) { if (!force_burn && (ftsInfo.u16_fwVer >= fw->fw_ver) && (ftsInfo.u16_cfgId >= fw->config_id)) { logError(0, "Firmware in the chip newer"); logError(0, " or equal to the one to burn! "); logError(0, "%s %s:NO UPDATE ERROR %02X\n", Loading Loading @@ -498,7 +504,7 @@ int flash_burn(Firmware fw, int force_burn, int keep_cx) //Write the lower part of the Program RAM logError(0, "%s 3) PREPARING DATA FOR FLASH BURN:\n", tag); res = fillMemory(FLASH_ADDR_CODE, fw.data, fw.data_size); res = fillMemory(FLASH_ADDR_CODE, fw->data, fw->data_size); if (res < 0) { logError(1, "%s Error During filling the memory!%02X\n", tag, ERROR_FLASH_BURN_FAILED); Loading Loading @@ -567,15 +573,15 @@ int flash_burn(Firmware fw, int force_burn, int keep_cx) return (res | ERROR_FLASH_BURN_FAILED); } if ((ftsInfo.u16_fwVer != fw.fw_ver) && (ftsInfo.u16_cfgId != fw.config_id)) { if ((ftsInfo.u16_fwVer != fw->fw_ver) && (ftsInfo.u16_cfgId != fw->config_id)) { logError(1, "Firmware in the chip different"); logError(1, " from the one that was burn!"); logError(1, "%s fw: %x != %x , conf: %x != %x\n", tag, ftsInfo.u16_fwVer, fw.fw_ver, fw->fw_ver, ftsInfo.u16_cfgId, fw.config_id); fw->config_id); return ERROR_FLASH_BURN_FAILED; } Loading Loading @@ -1015,14 +1021,14 @@ int fillFlash(u32 address, u8 *data, int size) return OK; } int flash_burn(struct Firmware fw, int force_burn, int keep_cx) int flash_burn(struct Firmware *fw, int force_burn, int keep_cx) { int res; if (!force_burn && (ftsInfo.u16_fwVer >= fw.fw_ver) && (ftsInfo.u16_cfgId >= fw.config_id)) { if (!force_burn && (ftsInfo.u16_fwVer >= fw->fw_ver) && (ftsInfo.u16_cfgId >= fw->config_id)) { for (res = EXTERNAL_RELEASE_INFO_SIZE-1; res >= 0; res--) { if (fw.externalRelease[res] > if (fw->externalRelease[res] > ftsInfo.u8_extReleaseInfo[res]) goto start; } Loading @@ -1045,7 +1051,7 @@ int flash_burn(struct Firmware fw, int force_burn, int keep_cx) if (res < OK) { logError(1, "%s warm boot FAILED!\n", tag); return (res | ERROR_FLASH_BURN_FAILED); } /*else*/ } logError(0, "%s warm boot COMPLETED!\n\n", tag); //mdelay(FLASH_WAIT_TIME); Loading Loading @@ -1084,8 +1090,8 @@ int flash_burn(struct Firmware fw, int force_burn, int keep_cx) //mdelay(FLASH_WAIT_TIME); logError(0, "%s 6) LOAD PROGRAM:\n", tag); res = fillFlash(FLASH_ADDR_CODE, &fw.data[0], fw.sec0_size); res = fillFlash(FLASH_ADDR_CODE, (u8 *)(&fw->data[0]), fw->sec0_size); if (res < OK) { logError(1, "%s load program ERROR %02X\n", tag, ERROR_FLASH_BURN_FAILED); Loading @@ -1094,7 +1100,7 @@ int flash_burn(struct Firmware fw, int force_burn, int keep_cx) logError(0, "%s load program DONE!\n", tag); logError(0, "%s 7) LOAD CONFIG:\n", tag); res = fillFlash(FLASH_ADDR_CONFIG, &(fw.data[fw.sec0_size]), fw.sec1_size); &(fw->data[fw->sec0_size]), fw->sec1_size); if (res < OK) { logError(1, "%s load config ERROR %02X\n", tag, ERROR_FLASH_BURN_FAILED); Loading Loading @@ -1122,12 +1128,12 @@ int flash_burn(struct Firmware fw, int force_burn, int keep_cx) return (res | ERROR_FLASH_BURN_FAILED); } if ((ftsInfo.u16_fwVer != fw.fw_ver) && (ftsInfo.u16_cfgId != fw.config_id)) { if ((ftsInfo.u16_fwVer != fw->fw_ver) && (ftsInfo.u16_cfgId != fw->config_id)) { pr_err("Firmware is different from the old!\n"); logError(1, "%s fw: %x != %x, conf: %x != %x\n", tag, ftsInfo.u16_fwVer, fw.fw_ver, ftsInfo.u16_cfgId, fw.config_id); tag, ftsInfo.u16_fwVer, fw->fw_ver, ftsInfo.u16_cfgId, fw->config_id); return ERROR_FLASH_BURN_FAILED; } Loading
drivers/input/touchscreen/st/fts_lib/ftsFlash.h +1 −1 Original line number Diff line number Diff line Loading @@ -102,7 +102,7 @@ int getFirmwareVersion(u16 *fw_vers, u16 *config_id); int getFWdata(const char *pathToFile, u8 **data, int *size, int from); int parseBinFile(u8 *fw_data, int fw_size, struct Firmware *fw, int keep_cx); int readFwFile(const char *path, struct Firmware *fw, int keep_cx); int flash_burn(struct Firmware fw, int force_burn, int keep_cx); int flash_burn(struct Firmware *fw, int force_burn, int keep_cx); int flashProcedure(const char *path, int force, int keep_cx); #endif