diff options
author | Diana Z <dzigterman@chromium.org> | 2021-06-23 13:35:30 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-06-24 18:40:53 +0000 |
commit | 2deb6c9dcb24d1f034be0f270b137f3146c8ee6e (patch) | |
tree | a10e4fefd8100ef3f46b8f40744c44d241d7dac6 | |
parent | 46481b71d4d9a7d0f0830794fb84900e8cfd3d7a (diff) | |
download | chrome-ec-2deb6c9dcb24d1f034be0f270b137f3146c8ee6e.tar.gz |
RAA489000: Take sinking into account during debug detach
When detaching from debug accessories, we need to set the CC lines to
Open which may cause a loss of Vbus. However, if the port isn't sinking
Vbus, then it should be okay to run this detach regardless of our
current battery level.
BRANCH=None
BUG=b:191465743
TEST=on blipper, run the battery down with servo_v4 attached and observe
the DUT can be woken normally by a charger on C0 after hibernate
Signed-off-by: Diana Z <dzigterman@chromium.org>
Change-Id: I5f946b23607c0bb3936132e93355875ff5688b30
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2983694
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r-- | driver/tcpm/raa489000.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/driver/tcpm/raa489000.c b/driver/tcpm/raa489000.c index 5276063d08..4de63926d4 100644 --- a/driver/tcpm/raa489000.c +++ b/driver/tcpm/raa489000.c @@ -259,6 +259,8 @@ int raa489000_tcpm_set_cc(int port, int pull) int raa489000_debug_detach(int port) { int rv; + int power_status; + /* * Force RAA489000 to see debug detach by running: * @@ -266,10 +268,13 @@ int raa489000_debug_detach(int port) * 2. Set ROLE_CONTROL=0x0F(OPEN,OPEN) * 3. Set POWER_CONTROL. AutoDischargeDisconnect=0 * - * Only if we have sufficient battery. Otherwise, we would risk - * brown-out during the CC open set. + * Only if we have sufficient battery or are not sinking. Otherwise, + * we would risk brown-out during the CC open set. */ - if (!pd_is_battery_capable()) + RETURN_ERROR(tcpc_read(port, TCPC_REG_POWER_STATUS, &power_status)); + + if (!pd_is_battery_capable() && + (power_status & TCPC_REG_POWER_STATUS_SINKING_VBUS)) return EC_SUCCESS; tcpci_tcpc_enable_auto_discharge_disconnect(port, 1); |