summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2021-03-11 13:17:35 -0800
committerCommit Bot <commit-bot@chromium.org>2021-03-18 19:28:06 +0000
commit1c5ff6f4d1ddfd3862f9bcfc85a4564eac63d16f (patch)
tree18b1f49685261f099409180c62bc5e70c361420a /include
parent4126a065489fe40668186c5f5b4dee4797388b25 (diff)
downloadchrome-ec-1c5ff6f4d1ddfd3862f9bcfc85a4564eac63d16f.tar.gz
PCHG: Support reset to firmware update mode
This patch allows a charger chip to reset to firmware update mode (a.k.a. download mode). Actual firmware update will be added in a separate patch. Currently, a reset event causes the state machine to unconditionally transition to normal mode. This patch makes the state machine check 'mode' field in the context to decide whether it transitions to normal mode or not. This patch also makes ctn730 driver explicitly return PCHG_EVENT_*_ERROR while PCHG_EVENT_NONE was returned previously. BUG=b:173235954 BRANCH=trogdor TEST=Stylus connect, disconnect, charge events are triggered as expected. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I10dbd25d0b3d5284952e57d4ade2949e9594c8d1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2770503
Diffstat (limited to 'include')
-rw-r--r--include/peripheral_charger.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/peripheral_charger.h b/include/peripheral_charger.h
index a53fbb9104..2e535d4f3e 100644
--- a/include/peripheral_charger.h
+++ b/include/peripheral_charger.h
@@ -83,7 +83,11 @@ enum pchg_event {
PCHG_EVENT_CHARGE_UPDATE,
PCHG_EVENT_CHARGE_ENDED,
PCHG_EVENT_CHARGE_STOPPED,
+ PCHG_EVENT_IN_NORMAL,
+
+ /* Errors */
PCHG_EVENT_CHARGE_ERROR,
+ PCHG_EVENT_OTHER_ERROR,
/* Internal (a.k.a. Host) Events */
PCHG_EVENT_INITIALIZE,
@@ -103,6 +107,11 @@ enum pchg_error {
PCHG_ERROR_FOREIGN_OBJECT = BIT(3),
};
+enum pchg_mode {
+ PCHG_MODE_NORMAL = 0,
+ PCHG_MODE_DOWNLOAD,
+};
+
/**
* Data struct describing the configuration of a peripheral charging port.
*/
@@ -140,6 +149,8 @@ struct pchg {
uint8_t battery_percent;
/* Number of dropped events (due to queue overflow) */
uint32_t dropped_event_count;
+ /* enum pchg_mode */
+ uint8_t mode;
};
/**