summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/usb_pd_protocol.c10
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) */