diff options
author | Wei-Han Chen <stimim@google.com> | 2018-09-07 14:47:31 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-09-16 04:04:29 -0700 |
commit | 8cf4925294d0111dd020563180b4c39d38e1eac4 (patch) | |
tree | 75300c38926091a55f7adbe9a58e216f35525e94 | |
parent | afc8c232cd9b854eb4feca82dbf1d7884d436c1e (diff) | |
download | chrome-ec-8cf4925294d0111dd020563180b4c39d38e1eac4.tar.gz |
touchpad_st: "dump_memory" can be enabled via console command
Previously, dump_memory can only be enabled at compile time (through
local build). Make this runtime configurable.
Currently, it is default off, since dump_memory is very slow and might
not be useful to enable for all users. The dump log through USB
interface doesn't look good for now. We revisit the default value in
the future.
BRANCH=nocturne
BUG=b:112877237
TEST=manual on whiskers
Signed-off-by: Wei-Han Chen <stimim@chromium.org>
Change-Id: I422a5a23392298301995df4fbf8101b7a18a62ba
Reviewed-on: https://chromium-review.googlesource.com/1212665
Commit-Ready: Wei-Han Chen <stimim@chromium.org>
Tested-by: Wei-Han Chen <stimim@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
-rw-r--r-- | driver/touchpad_st.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/driver/touchpad_st.c b/driver/touchpad_st.c index b6c20a2a6a..4f7292e445 100644 --- a/driver/touchpad_st.c +++ b/driver/touchpad_st.c @@ -67,6 +67,8 @@ static int tp_control; #define TP_CONTROL_SHALL_RESET (1 << 1) #define TP_CONTROL_SHALL_INITIALIZE (1 << 2) +static int dump_memory_on_error; + /* * Timestamp of last interrupt (32 bits are enough as we divide the value by 100 * and then put it in a 16-bit field). @@ -546,11 +548,13 @@ static void dump_error(void) */ static void dump_memory(void) { -#if 0 uint32_t size = 0x10000, rx_len = 512; uint32_t offset, i; uint8_t cmd[] = {0xFB, 0x00, 0x10, 0x00, 0x00}; + if (!dump_memory_on_error) + return; + for (offset = 0; offset < size; offset += 512) { cmd[3] = (offset >> 8) & 0xFF; cmd[4] = (offset >> 0) & 0xFF; @@ -572,7 +576,6 @@ static void dump_memory(void) } CPRINTF("===============================\n"); msleep(8); -#endif } /* @@ -1492,7 +1495,7 @@ USB_DECLARE_EP(USB_EP_ST_TOUCHPAD_INT, st_tp_interrupt_tx, st_tp_interrupt_tx, /* Debugging commands */ static int command_touchpad_st(int argc, char **argv) { - if (argc != 2) + if (argc < 2) return EC_ERROR_PARAM_COUNT; if (strcasecmp(argv[1], "version") == 0) { st_tp_read_system_info(1); @@ -1523,10 +1526,17 @@ static int command_touchpad_st(int argc, char **argv) dump_memory(); enable_deep_sleep(1); return EC_SUCCESS; + } else if (strcasecmp(argv[1], "memory_dump") == 0) { + if (argc == 3 && !parse_bool(argv[2], &dump_memory_on_error)) + return EC_ERROR_PARAM2; + + ccprintf("memory_dump: %d\n", dump_memory_on_error); + return EC_SUCCESS; } else { return EC_ERROR_PARAM1; } } DECLARE_CONSOLE_COMMAND(touchpad_st, command_touchpad_st, - "<enable|disable|version>", + "<enable | disable | version | calibrate | dump | " + "memory_dump <enable|disable>>", "Read write spi. id is spi_devices array index"); |