diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2021-03-06 10:09:24 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-03-09 16:14:16 +0000 |
commit | 2c703a08e866e3c3efedd8bb05d3de2323fa201c (patch) | |
tree | 51f9123156879a4da806c145891f46f59dfc0c37 /driver/nfc | |
parent | e66435cead81185ece7a21a0823c9817018a1bab (diff) | |
download | chrome-ec-2c703a08e866e3c3efedd8bb05d3de2323fa201c.tar.gz |
PCHG: Handle reset event
Currently, PCHG assumes PCHG chips are reset only on POR and ignores
reset events. This can cause the state machine to be in an unexpected
state when a reset happens asynchronously.
This patch allows PCHG to handle chip reset events. It also makes the
task explicitly reset PCHG chips at start-up so that everything will
start in known & clean states.
BUG=b:181745891,b:181036152,b:173235954
BRANCH=trogdor
TEST=Verify PCHG behaves expectedly across cold reset, warm reset,
suspend & resume. Repeat the test with and without stylus.
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Change-Id: Ia3dd1fe7ebc8dd6f4ee8149a4c25918922143fc3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2741282
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'driver/nfc')
-rw-r--r-- | driver/nfc/ctn730.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/driver/nfc/ctn730.c b/driver/nfc/ctn730.c index 8e5dd2ea20..75487fa701 100644 --- a/driver/nfc/ctn730.c +++ b/driver/nfc/ctn730.c @@ -252,6 +252,14 @@ static int _send_command(struct pchg *ctx, const struct ctn730_msg *cmd) return rv; } +static int ctn730_reset(struct pchg *ctx) +{ + gpio_set_level(GPIO_WLC_NRST_CONN, 0); + msleep(1); + gpio_set_level(GPIO_WLC_NRST_CONN, 1); + return EC_SUCCESS_IN_PROGRESS; +} + static int ctn730_init(struct pchg *ctx) { uint8_t buf[CTN730_MESSAGE_BUFFER_SIZE]; @@ -376,7 +384,7 @@ static int _process_payload_event(struct pchg *ctx, struct ctn730_msg *res) */ msleep(5); } else if (buf[0] == WLC_HOST_CTRL_RESET_EVT_DOWNLOAD_MODE) { - ctx->event = PCHG_EVENT_NONE; + ctx->event = PCHG_EVENT_RESET; } else { return EC_ERROR_INVAL; } @@ -539,6 +547,7 @@ exit: } const struct pchg_drv ctn730_drv = { + .reset = ctn730_reset, .init = ctn730_init, .enable = ctn730_enable, .get_event = ctn730_get_event, |