diff options
author | Wei-Han Chen <stimim@google.com> | 2018-10-08 19:32:08 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-10-15 23:28:42 -0700 |
commit | a72aa9ec4f6e331a236ad8541881fcbe98139216 (patch) | |
tree | 26e04fa6d264a161c5b15385738b795386b3d499 | |
parent | e89911e940dc94ebf3765e785716d4431a9d646e (diff) | |
download | chrome-ec-a72aa9ec4f6e331a236ad8541881fcbe98139216.tar.gz |
touchpad_st: preserve panel config section during update
We accidentially override panel config section, and this makes us have
to do "panel initialization" everytime after tp firmware is updated.
BRANCH=nocturne
BUG=b:117203130
TEST=manual on whiskers
Signed-off-by: Wei-Han Chen <stimim@chromium.org>
Change-Id: I10ce62297403f3e1dcadae62573255b00f82247d
Reviewed-on: https://chromium-review.googlesource.com/1270415
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Wei-Han Chen <stimim@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
-rw-r--r-- | driver/touchpad_st.c | 30 | ||||
-rw-r--r-- | driver/touchpad_st.h | 7 |
2 files changed, 23 insertions, 14 deletions
diff --git a/driver/touchpad_st.c b/driver/touchpad_st.c index d4c7aaa22b..65545418d7 100644 --- a/driver/touchpad_st.c +++ b/driver/touchpad_st.c @@ -68,9 +68,10 @@ static int tp_control; #define TP_CONTROL_SHALL_HALT (1 << 0) #define TP_CONTROL_SHALL_RESET (1 << 1) #define TP_CONTROL_SHALL_INIT (1 << 2) -#define TP_CONTROL_RESETTING (1 << 3) -#define TP_CONTROL_INIT (1 << 4) -#define TP_CONTROL_INIT_FULL (1 << 5) +#define TP_CONTROL_SHALL_DUMP_ERROR (1 << 3) +#define TP_CONTROL_RESETTING (1 << 4) +#define TP_CONTROL_INIT (1 << 5) +#define TP_CONTROL_INIT_FULL (1 << 6) /* * Number of times we have reset the touchpad because of errors. @@ -612,10 +613,7 @@ static void dump_memory(void) static int st_tp_handle_error(uint8_t error_type) { - enable_deep_sleep(0); - dump_error(); - dump_memory(); - enable_deep_sleep(1); + tp_control |= TP_CONTROL_SHALL_DUMP_ERROR; /* * Suggest action: memory dump and power cycle. @@ -761,8 +759,18 @@ static int st_tp_read_all_events(int suppress_error) st_tp_handle_status_report(e); } - if (!suppress_error && ret) - return -ret; + if (!suppress_error) { + if (tp_control & TP_CONTROL_SHALL_DUMP_ERROR) { + enable_deep_sleep(0); + dump_error(); + dump_memory(); + enable_deep_sleep(1); + tp_control &= ~TP_CONTROL_SHALL_DUMP_ERROR; + } + + if (ret) + return -ret; + } return i; } @@ -1161,9 +1169,9 @@ int touchpad_update_write(int offset, int size, const uint8_t *data) if (flash_offset % ST_TP_DMA_CHUNK_SIZE) return EC_ERROR_INVAL; - if (flash_offset >= ST_TP_FLASH_OFFSET_CX && + if (flash_offset >= ST_TP_FLASH_OFFSET_PANEL_CFG && flash_offset < ST_TP_FLASH_OFFSET_CONFIG) - /* don't update CX section */ + /* don't update CX section && panel config section */ return EC_SUCCESS; ret = st_tp_write_flash(flash_offset, size, data); diff --git a/driver/touchpad_st.h b/driver/touchpad_st.h index 506cf49ae6..6ae612be11 100644 --- a/driver/touchpad_st.h +++ b/driver/touchpad_st.h @@ -59,9 +59,10 @@ #define ST_TP_MEM_ID_SYSTEM_INFO 0x01 -#define ST_TP_FLASH_OFFSET_CODE (0x0000 << 2) -#define ST_TP_FLASH_OFFSET_CONFIG (0x7C00 << 2) -#define ST_TP_FLASH_OFFSET_CX (0x7000 << 2) +#define ST_TP_FLASH_OFFSET_CODE (0x0000 << 2) +#define ST_TP_FLASH_OFFSET_PANEL_CFG (0x6800 << 2) +#define ST_TP_FLASH_OFFSET_CX (0x7000 << 2) +#define ST_TP_FLASH_OFFSET_CONFIG (0x7C00 << 2) struct st_tp_host_data_header_t { |