summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2021-04-30 09:07:10 -0700
committerCommit Bot <commit-bot@chromium.org>2021-06-11 21:20:29 +0000
commit4a46ad60f03301f0184df4a0f977b02cfeb3a1f7 (patch)
tree8a69e9960bc058a88a0dfb8725d76108a62c645b /include
parentfae894230df4f0e34dc4f13c587ee4d721dfa812 (diff)
downloadchrome-ec-4a46ad60f03301f0184df4a0f977b02cfeb3a1f7.tar.gz
PCHG: Handle WLC_CHG_CTRL_DEVICE_STATE_DEVICE_DOCKED
We'll extend the period for a stylus to be statically charged so that EEPROM corruption can be avoided by not entering negotiated mode with a depleted battery. During this static charge period, the user currently doesn't see any charging indication. To prevent users from removing a stylus, we'll add a new state 'device docked' to ctn730. The EC firmware is updated to handle this new state as follows: - PCHG_STATE_DETECTED will be reused to indicate a device is in proximity but not ready for communication. - PCHG_STATE_CONNECTED will be added to indicate a device is ready for digital communication. This is formerly called DETECTED. - CTN730 driver produces PCHG_EVENT_DETECTED on 'docked' event and PCHG_EVENT_CONNECTED on 'detected' event. - When DEVICE_UNDOCKED is received in PCHG_STATE_DETECTED, transition to PCHG_STATE_ENABLED. BUG=b:189323070, b:173235954 BRANCH=trogdor TEST=Verify unpowered listener board can be detected. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I7fa83f6dd31cf74eab7c158e557ddc09f8976798 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2920628 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/ec_commands.h9
-rw-r--r--include/peripheral_charger.h29
2 files changed, 24 insertions, 14 deletions
diff --git a/include/ec_commands.h b/include/ec_commands.h
index c0bea49322..09592c8b96 100644
--- a/include/ec_commands.h
+++ b/include/ec_commands.h
@@ -6820,16 +6820,18 @@ enum pchg_state {
PCHG_STATE_INITIALIZED,
/* Charger is enabled and ready to detect a device. */
PCHG_STATE_ENABLED,
- /* Device is detected in proximity. */
+ /* Device is in proximity. */
PCHG_STATE_DETECTED,
/* Device is being charged. */
PCHG_STATE_CHARGING,
/* Device is fully charged. It implies DETECTED (& not charging). */
PCHG_STATE_FULL,
- /* In download (or firmware update) mode. Update session is closed. */
+ /* In download (a.k.a. firmware update) mode */
PCHG_STATE_DOWNLOAD,
- /* In download mode. Session is opened. Ready for receiving data. */
+ /* In download mode. Ready for receiving data. */
PCHG_STATE_DOWNLOADING,
+ /* Device is ready for data communication. */
+ PCHG_STATE_CONNECTED,
/* Put no more entry below */
PCHG_STATE_COUNT,
};
@@ -6843,6 +6845,7 @@ enum pchg_state {
[PCHG_STATE_FULL] = "FULL", \
[PCHG_STATE_DOWNLOAD] = "DOWNLOAD", \
[PCHG_STATE_DOWNLOADING] = "DOWNLOADING", \
+ [PCHG_STATE_CONNECTED] = "CONNECTED", \
}
/**
diff --git a/include/peripheral_charger.h b/include/peripheral_charger.h
index 93d6427814..702d3c9835 100644
--- a/include/peripheral_charger.h
+++ b/include/peripheral_charger.h
@@ -37,26 +37,32 @@
* |
* | INITIALIZED
* v
- * +-------+-------+
+ * +---------------+
* | INITIALIZED |<--------------+
- * +------+-+------+ |
+ * +------+--------+ |
* | ^ |
* ENABLED | | DISABLED |
* v | |
- * +------+--------+ |
- * +------------->+ ENABLED | |
- * | +-------+-------+ |
- * | | |
- * | | DEVICE_DETECTED |
- * | v |
+ * +--------+------+ |
+ * +------------->| ENABLED | |
+ * | +-----+-+-------+ |
+ * | | | |
+ * | DEVICE_CONNECTED | | DEVICE_DOCKED |
+ * | | v |
+ * | DEVICE_LOST +---------------+ |
+ * +--------------+ DOCKED +---------------+
* | +-------+-------+ |
- * +--------------+ DETECTED +---------------+
- * | DEVICE_LOST +------+-+------+ ERROR |
+ * | | | |
+ * | | | DEVICE_CONNECTED |
+ * | v v |
+ * | +---------------+ |
+ * +--------------+ CONNECTED +---------------+
+ * | DEVICE_LOST +------+--------+ ERROR |
* | | ^ |
* | CHARGE_STARTED | | CHARGE_ENDED |
* | | | CHARGE_STOPPED |
* | v | |
- * | +------+-+------+ |
+ * | +--------+------+ |
* +--------------+ CHARGING +---------------+
* DEVICE_LOST +---------------+ ERROR
*
@@ -94,6 +100,7 @@ enum pchg_event {
PCHG_EVENT_ENABLED,
PCHG_EVENT_DISABLED,
PCHG_EVENT_DEVICE_DETECTED,
+ PCHG_EVENT_DEVICE_CONNECTED,
PCHG_EVENT_DEVICE_LOST,
PCHG_EVENT_CHARGE_STARTED,
PCHG_EVENT_CHARGE_UPDATE,