Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6e436b7f authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "input: touchscreen: st: enable manual firmware upgrade"

parents 3fdaf026 8f979460
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -205,7 +205,7 @@ static ssize_t fts_fwupdate_store(struct device *dev,
	}

	fwD.data = NULL;
	ret = getFWdata(PATH_FILE_FW, &orig_data, &orig_size, 0);
	ret = getFWdata_nocheck(PATH_FILE_FW, &orig_data, &orig_size, 0);
	if (ret < OK) {
		logError(1, "%s %s: impossible retrieve FW... ERROR %08X\n",
			tag, __func__, ERROR_MEMH_READ);
+33 −1
Original line number Diff line number Diff line
@@ -119,6 +119,38 @@ int getFirmwareVersion(u16 *fw_vers, u16 *config_id)
	return OK;
}

int getFWdata_nocheck(const char *pathToFile, u8 **data, int *size, int from)
{
	const struct firmware *fw = NULL;
	struct device *dev = getDev();
	int res;

	if (dev == NULL)
		return ERROR_OP_NOT_ALLOW;

	logError(0, "%s Read FW from BIN file!\n", tag);

	res = firmware_request_nowarn(&fw, pathToFile, dev);
	if (res) {
		logError(1, "%s %s:No File found! ERROR %08X\n",
			tag, __func__, ERROR_FILE_NOT_FOUND);
		return ERROR_FILE_NOT_FOUND;
	}

	*size = fw->size;
	*data = (u8 *)kmalloc_array((*size), sizeof(u8), GFP_KERNEL);
	if (*data == NULL) {
		logError(1, "%s %s:Impossible to allocate! %08X\n", __func__);
		release_firmware(fw);
		return ERROR_ALLOC;
	}
	memcpy(*data, (u8 *)fw->data, (*size));
	release_firmware(fw);

	logError(0, "%s %s:Finshed!\n", tag, __func__);
	return OK;
}

int getFWdata(const char *pathToFile, u8 **data, int *size, int from)
{
	const struct firmware *fw = NULL;
@@ -145,7 +177,7 @@ int getFWdata(const char *pathToFile, u8 **data, int *size, int from)
	default:
		logError(0, "%s Read FW from BIN file!\n", tag);

		if (ftsInfo.u16_fwVer == FTS_LATEST_VERSION)
		if (ftsInfo.u16_fwVer >= FTS_LATEST_VERSION)
			return ERROR_FW_NO_UPDATE;

		dev = getDev();
+1 −0
Original line number Diff line number Diff line
@@ -100,6 +100,7 @@ int flash_unlock(void);
int fillMemory(u32 address, u8 *data, int size);
int getFirmwareVersion(u16 *fw_vers, u16 *config_id);
int getFWdata(const char *pathToFile, u8 **data, int *size, int from);
int getFWdata_nocheck(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);