diff options
author | Vincent Palatin <vpalatin@chromium.org> | 2014-05-22 08:16:30 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-06-03 23:23:31 +0000 |
commit | bc3a927a03c6a4096602deae5b7b342f3b5caf75 (patch) | |
tree | 7cecda8e64b50153790bd1996b1296445c955308 | |
parent | 455950b6da6e999b71f22eceb77675615039ecc6 (diff) | |
download | chrome-ec-bc3a927a03c6a4096602deae5b7b342f3b5caf75.tar.gz |
pd: detect sink disconnection
For non-PD aware sink, ensure that we detect their disconnection when
the CC goes back above Vnc.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BRANCH=none
BUG=chrome-os-partner:28782
TEST=on Samus, put the port in source mode (using the "pd charger"
console command), then plug and unplug the type-C to type-A cable and see the
PD state going from Disconnected to Discovery and the other way round
(using "pd state" console command).
Change-Id: Ic9e19fee78f0c5e1fc742e2443eaf4b804ee5ee9
Reviewed-on: https://chromium-review.googlesource.com/202445
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r-- | common/usb_pd_protocol.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index 179ac828d0..214d5f15a0 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -811,6 +811,16 @@ void pd_task(void) timeout = 10*MSEC; break; case PD_STATE_SRC_DISCOVERY: + /* Detect disconnect by monitoring Vnc */ + cc1_volt = pd_adc_read(pd_polarity); + if (cc1_volt > PD_SRC_VNC) { + /* The sink disappeared ... */ + pd_power_supply_reset(); + pd_task_state = PD_STATE_SRC_DISCONNECTED; + /* Debouncing */ + timeout = 50*MSEC; + break; + } /* Query capabilites of the other side */ res = send_source_cap(ctxt); /* packet was acked => PD capable device) */ |