summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2014-11-04 14:34:00 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-11-11 00:10:35 +0000
commit2c83bfc7da317e254dedd32a0bea7763345d3510 (patch)
tree1b060376d6032a61ef19870165cfd9f5b1e4be7a /common
parent3fd064745ba37a626df1ed34a79765821e259a46 (diff)
downloadchrome-ec-2c83bfc7da317e254dedd32a0bea7763345d3510.tar.gz
pd: add delay for power supply startup before sending src cap
Add delay for power supply startup time before sending source capabilities packets. BUG=none BRANCH=samus TEST=load on samus, plug in C to A receptacle adapter, see that VBUS enabled before source cap packet sent. Change-Id: If3b595e1671d089e859693b420841a639fdb146b Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/227423
Diffstat (limited to 'common')
-rw-r--r--common/usb_pd_protocol.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index 2e15e8bc7b..01a997366c 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -1411,7 +1411,7 @@ void pd_task(void)
pd_set_vconn(port, pd[port].polarity, 1);
#endif
- set_state(port, PD_STATE_SRC_DISCOVERY);
+ set_state(port, PD_STATE_SRC_STARTUP);
caps_count = 0;
#ifdef CONFIG_USB_PD_DUAL_ROLE
/* Keep VBUS up for the hold period */
@@ -1433,6 +1433,15 @@ void pd_task(void)
}
#endif
break;
+ case PD_STATE_SRC_STARTUP:
+ /* Wait for power source to enable */
+ if (pd[port].last_state != pd[port].task_state)
+ set_state_timeout(
+ port,
+ get_time().val +
+ PD_POWER_SUPPLY_TRANSITION_DELAY,
+ PD_STATE_SRC_DISCOVERY);
+ break;
case PD_STATE_SRC_DISCOVERY:
/* Send source cap some minimum number of times */
if (caps_count < PD_CAPS_COUNT) {
@@ -2169,8 +2178,9 @@ static int command_pd(int argc, char **argv)
"SNK_SWAP_SNK_DISABLE", "SNK_SWAP_SRC_DISABLE",
"SNK_SWAP_STANDBY", "SNK_SWAP_COMPLETE",
#endif /* CONFIG_USB_PD_DUAL_ROLE */
- "SRC_DISCONNECTED", "SRC_DISCOVERY", "SRC_NEGOCIATE",
- "SRC_ACCEPTED", "SRC_TRANSITION", "SRC_READY",
+ "SRC_DISCONNECTED", "SRC_STARTUP", "SRC_DISCOVERY",
+ "SRC_NEGOCIATE", "SRC_ACCEPTED", "SRC_TRANSITION",
+ "SRC_READY",
#ifdef CONFIG_USB_PD_DUAL_ROLE
"SRC_SWAP_INIT", "SRC_SWAP_SNK_DISABLE",
"SRC_SWAP_SRC_DISABLE", "SRC_SWAP_STANDBY",