Merge "input: touchscreen: nt36xxx: Add Chip id and firmware"

This commit is contained in:
qctecmdr 2021-06-21 05:06:17 -07:00 committed by Gerrit - the friendly Code Review server
commit 300f5a8cac
4 changed files with 41 additions and 15 deletions

View File

@ -1121,8 +1121,8 @@ void nvt_stop_crc_reboot(void)
*
* return:
* Executive outcomes. 0---NVT IC. -1---not NVT IC.
*******************************************************/
static int8_t nvt_ts_check_chip_ver_trim(void)
*******************************************************/
static int8_t nvt_ts_check_chip_ver_trim(uint32_t chip_ver_trim_addr)
{
uint8_t buf[8] = {0};
int32_t retry = 0;
@ -1142,9 +1142,9 @@ static int8_t nvt_ts_check_chip_ver_trim(void)
CTP_I2C_WRITE(ts->client, I2C_HW_Address, buf, 2);
msleep(10);
nvt_set_page(I2C_BLDR_Address, 0x1F64E);
nvt_set_page(I2C_BLDR_Address, chip_ver_trim_addr);
buf[0] = 0x4E;
buf[0] = chip_ver_trim_addr & 0xFF;
buf[1] = 0x00;
buf[2] = 0x00;
buf[3] = 0x00;
@ -1292,11 +1292,15 @@ static int32_t nvt_ts_late_probe(struct i2c_client *client,
}
//---check chip version trim---
ret = nvt_ts_check_chip_ver_trim();
ret = nvt_ts_check_chip_ver_trim(CHIP_VER_TRIM_ADDR);
if (ret) {
NVT_ERR("chip is not identified\n");
ret = -EINVAL;
goto err_chipvertrim_failed;
NVT_LOG("try to check from old chip ver trim address\n");
ret = nvt_ts_check_chip_ver_trim(CHIP_VER_TRIM_OLD_ADDR);
if (ret) {
NVT_ERR("chip is not identified\n");
ret = -EINVAL;
goto err_chipvertrim_failed;
}
}
nvt_bootloader_reset();

View File

@ -62,7 +62,7 @@
//---Touch info.---
#define TOUCH_DEFAULT_MAX_WIDTH 1080
#define TOUCH_DEFAULT_MAX_HEIGHT 1920
#define TOUCH_DEFAULT_MAX_HEIGHT 2408
#define TOUCH_MAX_FINGER_NUM 10
#define TOUCH_KEY_NUM 0
#if TOUCH_KEY_NUM > 0
@ -82,7 +82,7 @@ extern const uint16_t touch_key_array[TOUCH_KEY_NUM];
#if WAKEUP_GESTURE
extern const uint16_t gesture_key_array[];
#endif
#define BOOT_UPDATE_FIRMWARE 0
#define BOOT_UPDATE_FIRMWARE 1
#define BOOT_UPDATE_FIRMWARE_NAME "novatek_ts_fw.bin"
//---ESD Protect.---

View File

@ -47,9 +47,15 @@ static int32_t nvt_get_fw_need_write_size(const struct firmware *fw_entry)
for (i = total_sectors_to_check; i > 0; i--) {
/* printk("current end flag address checked = 0x%X\n", i * FLASH_SECTOR_SIZE - NVT_FLASH_END_FLAG_LEN); */
/* check if there is end flag "NVT" at the end of this sector */
if (memcmp(&fw_entry->data[i * FLASH_SECTOR_SIZE - NVT_FLASH_END_FLAG_LEN], "NVT", NVT_FLASH_END_FLAG_LEN) == 0) {
if ((memcmp((const char *)&fw_entry->data[i *
FLASH_SECTOR_SIZE - NVT_FLASH_END_FLAG_LEN],
"NVT", NVT_FLASH_END_FLAG_LEN) == 0) ||
(memcmp((const char *)&fw_entry->data[i *
FLASH_SECTOR_SIZE - NVT_FLASH_END_FLAG_LEN],
"MOD", NVT_FLASH_END_FLAG_LEN) == 0)) {
fw_need_write_size = i * FLASH_SECTOR_SIZE;
NVT_LOG("fw_need_write_size = %zu(0x%zx)\n", fw_need_write_size, fw_need_write_size);
NVT_LOG("fw_need_write_size = %zu(0x%zx)\n",
fw_need_write_size, fw_need_write_size);
return 0;
}
}
@ -75,7 +81,7 @@ int32_t update_firmware_request(char *filename)
NVT_LOG("filename is %s\n", filename);
ret = request_firmware_nowarn(&fw_entry, filename, &ts->client->dev);
ret = request_firmware(&fw_entry, filename, &ts->client->dev);
if (ret) {
NVT_ERR("firmware load failed, ret=%d\n", ret);
return ret;
@ -966,10 +972,11 @@ int32_t nvt_check_flash_end_flag(void)
}
//buf[3:5] => NVT End Flag
strlcpy(nvt_end_flag, &buf[3], NVT_FLASH_END_FLAG_LEN);
strlcpy(nvt_end_flag, &buf[3], sizeof(nvt_end_flag));
NVT_LOG("nvt_end_flag=%s (%02X %02X %02X)\n", nvt_end_flag, buf[3], buf[4], buf[5]);
if (memcmp(nvt_end_flag, "NVT", NVT_FLASH_END_FLAG_LEN) == 0) {
if ((memcmp(nvt_end_flag, "NVT", NVT_FLASH_END_FLAG_LEN) == 0) ||
(memcmp(nvt_end_flag, "MOD", NVT_FLASH_END_FLAG_LEN) == 0)) {
return 0;
} else {
NVT_ERR("\"NVT\" end flag not found!\n");
@ -994,6 +1001,11 @@ void Boot_Update_Firmware(struct work_struct *work)
snprintf(firmware_name, sizeof(firmware_name),
BOOT_UPDATE_FIRMWARE_NAME);
if (ts->nvt_pid == 0x5B0B) {
NVT_LOG("Skip Firmware Update\n");
return;
}
// request bin file in "/etc/firmware"
ret = update_firmware_request(firmware_name);
if (ret) {

View File

@ -16,6 +16,8 @@
* more details.
*
*/
#define CHIP_VER_TRIM_ADDR 0x3F004
#define CHIP_VER_TRIM_OLD_ADDR 0x1F64E
struct nvt_ts_mem_map {
uint32_t EVENT_BUF_ADDR;
@ -173,6 +175,14 @@ struct nvt_ts_trim_id_table {
};
static const struct nvt_ts_trim_id_table trim_id_table[] = {
{.id = {0x20, 0xFF, 0xFF, 0x72, 0x66, 0x03}, .mask = {1, 0, 0, 1, 1, 1},
.mmap = &NT36675_memory_map, .hwinfo = &NT36675_hw_info},
{.id = {0x00, 0xFF, 0xFF, 0x80, 0x66, 0x03}, .mask = {1, 0, 0, 1, 1, 1},
.mmap = &NT36675_memory_map, .hwinfo = &NT36675_hw_info},
{.id = {0x0C, 0xFF, 0xFF, 0x25, 0x65, 0x03}, .mask = {1, 0, 0, 1, 1, 1},
.mmap = &NT36672A_memory_map, .hwinfo = &NT36672A_hw_info},
{.id = {0x0E, 0xFF, 0xFF, 0x72, 0x66, 0x03}, .mask = {1, 0, 0, 1, 1, 1},
.mmap = &NT36675_memory_map, .hwinfo = &NT36675_hw_info},
{.id = {0x0C, 0xFF, 0xFF, 0x72, 0x66, 0x03}, .mask = {1, 0, 0, 1, 1, 1},
.mmap = &NT36675_memory_map, .hwinfo = &NT36675_hw_info},
{.id = {0xFF, 0xFF, 0xFF, 0x26, 0x65, 0x03}, .mask = {0, 0, 0, 1, 1, 1},