summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2014-05-17 16:08:05 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-05-21 20:35:47 +0000
commitf52b23e96423fa0447013d58da1c6677ac8ae9f8 (patch)
tree83dc601edaa46e9310dff542eaf7784b3aadcddc /common
parentffac23c0ea1bd4ff4568f5bd709a98f912b833a7 (diff)
downloadchrome-ec-f52b23e96423fa0447013d58da1c6677ac8ae9f8.tar.gz
samus_pd: when sinking power detect loss of VBUS and disconnect
Detect loss of VBUS when acting as PD sink and go to the disconnected state. This allows us to renegotiate power when power supply drops and switches to 5V. BUG=none BRANCH=none TEST=On a samus, tested by running for a couple of hours, and verifying that occasionally when zinger drops from 20V to 5V, we detect it and go to the disconnected state. Note, this only happens a couple times every hour. Change-Id: I237d267824ff564662c9c02e525ce2613ed229e6 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/200365 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/usb_pd_protocol.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index d15f9bcc0e..48e2763712 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -778,6 +778,14 @@ void pd_task(void)
break;
case PD_STATE_SNK_READY:
/* we have power and we are happy */
+
+ /* if we have lost vbus, go back to disconnected */
+ if (!pd_snk_is_vbus_provided()) {
+ pd_task_state = PD_STATE_SNK_DISCONNECTED;
+ /* set timeout small to reconnect fast */
+ timeout = 5*MSEC;
+ }
+
/* check vital parameters from time to time */
timeout = 100*MSEC;
break;