diff options
author | Sam Hurst <shurst@google.com> | 2019-11-07 17:55:55 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-11-21 23:41:16 +0000 |
commit | 2e2dcb986bfe952cd9a87bf2cd3498fafde6e805 (patch) | |
tree | 2d63c1ceb0ab7bad0f2e414b73243307dff87676 /include/usb_common.h | |
parent | 154f597b8656fbcc16f6652f6fe8713943440939 (diff) | |
download | chrome-ec-2e2dcb986bfe952cd9a87bf2cd3498fafde6e805.tar.gz |
TCPMv2: Enable TCPC low power when port is looking for a connection
When the port is in a state where it is looking for a connection,
to save power, we should put the TCPC in its low power mode and
enable auto toggling. Low power mode can happen when DRP auto
toggling, acting as a SNK only, or acting as a SRC only.
BUG=chromium:1022217
BRANCH=none
TEST=make -j buildall
manual tests:
1: (S0) Nothing plugged in, port is drp and low power mode
2: (S5/S3/S0ix) Port is SNK only, and low power with nothing plugged in
3: (S3/S0ix) If TypeC sink was previously plugged in, port remains powered
4: (S5/S3/S0ix) TypeC source is recognized
5: (S3->S0) TypeC sink plugged in, port is powered when S0 is reached
Low power exit test:
Using this command from the AP console:
ectool i2cread 8 2 0x16 0x0d
Transfer failed with status=0x1 # This means the TCPC was asleep.
On the EC console:
2019-11-21 09:50:24 [315.235538 TCPC p1 init ready]
2019-11-21 09:50:24 [315.236048 TCPC p1 Exit Low Power Mode]
2019-11-21 09:50:24 [315.242837 TCPC p1 init ready]
2019-11-21 09:50:24 [315.243229 C1: DRPAutoToggle]
2019-11-21 09:50:24 [315.246471 C1: Unattached.SNK]
2019-11-21 09:50:24 [315.252504 C1: DRPAutoToggle]
2019-11-21 09:50:24 [315.362878 C1: LowPowerMode]
2019-11-21 09:50:24 [315.363314 TCPC p1 Enter Low Power Mode]
Change-Id: I7e853d05e0ece1f6b3031f17a18fcbf0d9a15a51
Signed-off-by: Sam Hurst <shurst@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1904974
Reviewed-by: Edward Hill <ecgh@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'include/usb_common.h')
-rw-r--r-- | include/usb_common.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/usb_common.h b/include/usb_common.h index 85260d539d..b35e5f27f9 100644 --- a/include/usb_common.h +++ b/include/usb_common.h @@ -10,6 +10,28 @@ #include "usb_pd_tcpm.h" #include "task_id.h" +enum pd_drp_next_states { + DRP_TC_DEFAULT, + DRP_TC_UNATTACHED_SNK, + DRP_TC_UNATTACHED_SRC, + DRP_TC_DRP_AUTO_TOGGLE +}; + +/** + * Returns the next state to transition to while in the drp auto toggle state. + * + * @param drp_sink_time timer for handling TOGGLE_OFF/FORCE_SINK mode when + * auto-toggle enabled. This is an in/out variable. + * @param power_role current power role + * @param drp_state dual role states + * @param cc1 value of CC1 set by tcpm_get_cc + * @param cc2 value of CC2 set by tcpm_get_cc + * + */ +enum pd_drp_next_states drp_auto_toggle_next_state(uint64_t *drp_sink_time, + enum pd_power_role power_role, enum pd_dual_role_states drp_state, + enum tcpc_cc_voltage_status cc1, enum tcpc_cc_voltage_status cc2); + /* Returns the battery percentage [0-100] of the system. */ int usb_get_battery_soc(void); |