diff options
author | Keith Short <keithshort@chromium.org> | 2019-12-03 16:29:08 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-12-06 00:24:16 +0000 |
commit | 436ab9db9a0f999ac3452f8f26d4fb7ad4d4802c (patch) | |
tree | fca420f71598568ed21545cab45de7506b641b17 | |
parent | fbe977e7a603bf4d4e60854f462fecf496bec3c6 (diff) | |
download | chrome-ec-436ab9db9a0f999ac3452f8f26d4fb7ad4d4802c.tar.gz |
volteer: disable PD 3.0 stack
The PD 3.0 stack isn't reliably charging the battery.
BUG=b:145622441
BRANCH=none
TEST=make buildall
TEST=verify PD negotiation with battery connected and battery charging
Change-Id: Idccf6a4f325e94fdbf2df310b539a0b75125be92
Signed-off-by: Keith Short <keithshort@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1949148
-rw-r--r-- | baseboard/volteer/baseboard.h | 3 | ||||
-rw-r--r-- | baseboard/volteer/usb_pd_policy.c | 36 |
2 files changed, 39 insertions, 0 deletions
diff --git a/baseboard/volteer/baseboard.h b/baseboard/volteer/baseboard.h index 2b51696708..634fe33d69 100644 --- a/baseboard/volteer/baseboard.h +++ b/baseboard/volteer/baseboard.h @@ -94,11 +94,14 @@ /* USB Type C and USB PD defines */ /* Enable the new USB-C PD stack */ +/* TODO: b/145756626 - re-enable once all blocking issues resolved */ +#if 0 #define CONFIG_USB_SM_FRAMEWORK #define CONFIG_USB_TYPEC_SM #define CONFIG_USB_PRL_SM #define CONFIG_USB_PE_SM #define CONFIG_USB_TYPEC_DRP_ACC_TRYSRC +#endif #define CONFIG_USB_POWER_DELIVERY #define CONFIG_USB_PD_ALT_MODE diff --git a/baseboard/volteer/usb_pd_policy.c b/baseboard/volteer/usb_pd_policy.c index 3d01f37e4e..4c543a1efd 100644 --- a/baseboard/volteer/usb_pd_policy.c +++ b/baseboard/volteer/usb_pd_policy.c @@ -38,6 +38,42 @@ const uint32_t pd_snk_pdo[] = { }; const int pd_snk_pdo_cnt = ARRAY_SIZE(pd_snk_pdo); +#ifndef CONFIG_USB_SM_FRAMEWORK +int pd_board_checks(void) +{ + return EC_SUCCESS; +} + +void pd_check_dr_role(int port, int dr_role, int flags) +{ + /* If UFP, try to switch to DFP */ + if ((flags & PD_FLAGS_PARTNER_DR_DATA) && + dr_role == PD_ROLE_UFP) + pd_request_data_swap(port); +} + +void pd_check_pr_role(int port, int pr_role, int flags) +{ + /* + * If partner is dual-role power and dualrole toggling is on, consider + * if a power swap is necessary. + */ + if ((flags & PD_FLAGS_PARTNER_DR_POWER) && + pd_get_dual_role(port) == PD_DRP_TOGGLE_ON) { + /* + * If we are a sink and partner is not externally powered, then + * swap to become a source. If we are source and partner is + * externally powered, swap to become a sink. + */ + int partner_extpower = flags & PD_FLAGS_PARTNER_EXTPOWER; + + if ((!partner_extpower && pr_role == PD_ROLE_SINK) || + (partner_extpower && pr_role == PD_ROLE_SOURCE)) + pd_request_power_swap(port); + } +} +#endif + int pd_check_data_swap(int port, int data_role) { /* Allow data swap if we are a UFP, otherwise don't allow. */ |