summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2021-03-06 10:09:24 -0800
committerCommit Bot <commit-bot@chromium.org>2021-03-09 16:14:16 +0000
commit2c703a08e866e3c3efedd8bb05d3de2323fa201c (patch)
tree51f9123156879a4da806c145891f46f59dfc0c37 /include
parente66435cead81185ece7a21a0823c9817018a1bab (diff)
downloadchrome-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 'include')
-rw-r--r--include/peripheral_charger.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/peripheral_charger.h b/include/peripheral_charger.h
index 62b1b0ac01..26b7b98a2e 100644
--- a/include/peripheral_charger.h
+++ b/include/peripheral_charger.h
@@ -73,6 +73,7 @@ enum pchg_event {
PCHG_EVENT_IRQ,
/* External Events */
+ PCHG_EVENT_RESET,
PCHG_EVENT_INITIALIZED,
PCHG_EVENT_ENABLED,
PCHG_EVENT_DISABLED,
@@ -140,6 +141,8 @@ struct pchg {
* Peripheral charger driver
*/
struct pchg_drv {
+ /* Reset charger chip. */
+ int (*reset)(struct pchg *ctx);
/* Initialize the charger. */
int (*init)(struct pchg *ctx);
/* Enable/disable the charger. */