diff options
author | Ravi Jain <raviajain@google.com> | 2023-10-03 07:24:51 +0000 |
---|---|---|
committer | Ravi Jain <raviajain@google.com> | 2023-10-04 06:25:07 +0000 |
commit | 5073027fe13b9e605b056831b5331cf88199bcca (patch) | |
tree | 5c252d19a50519823456d65840cb8254f08cd062 | |
parent | 92b7be15a7f33def36f08a33b7af85fffe6b16f2 (diff) | |
download | goodix_touch-5073027fe13b9e605b056831b5331cf88199bcca.tar.gz |
touch/goodix: Import v1.3.3 driver
- Fix ChkSum Error while calculate Package ID & MCU Fab
Bug: 301718404
Test: Local stress test for proc `get_mcu_id` and `get_package_id`
Change-Id: I5b3a20586120d0899e19789dde13fee07578c124
Signed-off-by: xulinkun <xulinkun@goodix.com>
Signed-off-by: Ravi Jain <raviajain@google.com>
-rw-r--r-- | goodix_brl_hw.c | 16 | ||||
-rw-r--r-- | goodix_ts_core.h | 2 |
2 files changed, 12 insertions, 6 deletions
diff --git a/goodix_brl_hw.c b/goodix_brl_hw.c index 211d90e..e1a759a 100644 --- a/goodix_brl_hw.c +++ b/goodix_brl_hw.c @@ -1924,15 +1924,21 @@ static int brl_flash_read(struct goodix_ts_core *cd, u32 addr, u8 *buf, int len) u8 *tmp_buf; u32 buffer_addr = cd->ic_info.misc.fw_buffer_addr; uint32_t checksum = 0; + uint32_t read_len; flash_head_info_t head_info; u8 *p = (u8 *)&head_info.address; - tmp_buf = kzalloc(len + sizeof(flash_head_info_t), GFP_KERNEL); + if ((len % 2) != 0) + read_len = len + 1; // if odd number, must +1 + else + read_len = len; + + tmp_buf = kzalloc(read_len + sizeof(flash_head_info_t), GFP_KERNEL); if (!tmp_buf) return -ENOMEM; head_info.address = cpu_to_le32(addr); - head_info.length = cpu_to_le32(len); + head_info.length = cpu_to_le32(read_len); for (i = 0; i < 8; i += 2) checksum += p[i] | (p[i + 1] << 8); head_info.checksum = checksum; @@ -1959,15 +1965,15 @@ static int brl_flash_read(struct goodix_ts_core *cd, u32 addr, u8 *buf, int len) } ret = cd->hw_ops->read( - cd, buffer_addr, tmp_buf, len + sizeof(flash_head_info_t)); + cd, buffer_addr, tmp_buf, read_len + sizeof(flash_head_info_t)); if (ret < 0) { ts_err("failed read data len %lu", - len + sizeof(flash_head_info_t)); + read_len + sizeof(flash_head_info_t)); goto read_end; } checksum = 0; - for (i = 0; i < len + sizeof(flash_head_info_t) - 4; i += 2) + for (i = 0; i < read_len + sizeof(flash_head_info_t) - 4; i += 2) checksum += tmp_buf[4 + i] | (tmp_buf[5 + i] << 8); if (checksum != le32_to_cpup((__le32 *)tmp_buf)) { diff --git a/goodix_ts_core.h b/goodix_ts_core.h index 82891c8..6b6914c 100644 --- a/goodix_ts_core.h +++ b/goodix_ts_core.h @@ -57,7 +57,7 @@ #define GOODIX_CORE_DRIVER_NAME "goodix_ts" #define GOODIX_PEN_DRIVER_NAME "goodix_ts,pen" -#define GOODIX_DRIVER_VERSION "v1.3.2" +#define GOODIX_DRIVER_VERSION "v1.3.3" #define GOODIX_MAX_TOUCH 10 #define GOODIX_PEN_MAX_PRESSURE 4096 #define GOODIX_MAX_PEN_KEY 2 |