diff options
-rw-r--r-- | board/dingdong/usb_pd_config.h | 4 | ||||
-rw-r--r-- | board/hoho/usb_pd_config.h | 4 | ||||
-rw-r--r-- | board/host/usb_pd_config.h | 2 | ||||
-rw-r--r-- | board/ryu/usb_pd_config.h | 4 | ||||
-rw-r--r-- | board/ryu_p2/usb_pd_config.h | 4 | ||||
-rw-r--r-- | board/samus_pd/usb_pd_config.h | 4 | ||||
-rw-r--r-- | common/usb_pd_protocol.c | 16 | ||||
-rw-r--r-- | include/usb_pd.h | 1 |
8 files changed, 25 insertions, 14 deletions
diff --git a/board/dingdong/usb_pd_config.h b/board/dingdong/usb_pd_config.h index e68eb1f662..3af9e0a189 100644 --- a/board/dingdong/usb_pd_config.h +++ b/board/dingdong/usb_pd_config.h @@ -137,6 +137,6 @@ static inline int pd_snk_is_vbus_provided(int port) /* we are acting only as a sink */ #define PD_DEFAULT_STATE PD_STATE_SNK_DISCONNECTED -/* delay necessary for the voltage transition on the power supply */ -#define PD_POWER_SUPPLY_TRANSITION_DELAY 50000 /* us */ +/* we are never a source : don't care about power supply */ +#define PD_POWER_SUPPLY_TRANSITION_DELAY 0 /* us */ #endif /* __USB_PD_CONFIG_H */ diff --git a/board/hoho/usb_pd_config.h b/board/hoho/usb_pd_config.h index e68eb1f662..3af9e0a189 100644 --- a/board/hoho/usb_pd_config.h +++ b/board/hoho/usb_pd_config.h @@ -137,6 +137,6 @@ static inline int pd_snk_is_vbus_provided(int port) /* we are acting only as a sink */ #define PD_DEFAULT_STATE PD_STATE_SNK_DISCONNECTED -/* delay necessary for the voltage transition on the power supply */ -#define PD_POWER_SUPPLY_TRANSITION_DELAY 50000 /* us */ +/* we are never a source : don't care about power supply */ +#define PD_POWER_SUPPLY_TRANSITION_DELAY 0 /* us */ #endif /* __USB_PD_CONFIG_H */ diff --git a/board/host/usb_pd_config.h b/board/host/usb_pd_config.h index 6770b8e11d..d9eb607874 100644 --- a/board/host/usb_pd_config.h +++ b/board/host/usb_pd_config.h @@ -36,6 +36,6 @@ int pd_snk_is_vbus_provided(int port); #define PD_DEFAULT_STATE PD_STATE_SNK_DISCONNECTED /* delay necessary for the voltage transition on the power supply */ -#define PD_POWER_SUPPLY_TRANSITION_DELAY 50000 /* us */ +#define PD_POWER_SUPPLY_TRANSITION_DELAY 20000 /* us */ #endif /* __USB_PD_CONFIG_H */ diff --git a/board/ryu/usb_pd_config.h b/board/ryu/usb_pd_config.h index 8bea5276c2..8adc002e8c 100644 --- a/board/ryu/usb_pd_config.h +++ b/board/ryu/usb_pd_config.h @@ -170,7 +170,7 @@ static inline int pd_snk_is_vbus_provided(int port) /* start as a sink in case we have no other power supply/battery */ #define PD_DEFAULT_STATE PD_STATE_SNK_DISCONNECTED -/* delay necessary for the voltage transition on the power supply */ -#define PD_POWER_SUPPLY_TRANSITION_DELAY 50000 /* us */ +/* delay for the voltage transition on the power supply, chip max is 16us */ +#define PD_POWER_SUPPLY_TRANSITION_DELAY 20000 /* us */ #endif /* __USB_PD_CONFIG_H */ diff --git a/board/ryu_p2/usb_pd_config.h b/board/ryu_p2/usb_pd_config.h index e8edb86de0..374cb083d7 100644 --- a/board/ryu_p2/usb_pd_config.h +++ b/board/ryu_p2/usb_pd_config.h @@ -170,7 +170,7 @@ static inline int pd_snk_is_vbus_provided(int port) /* start as a sink in case we have no other power supply/battery */ #define PD_DEFAULT_STATE PD_STATE_SNK_DISCONNECTED -/* delay necessary for the voltage transition on the power supply */ -#define PD_POWER_SUPPLY_TRANSITION_DELAY 50000 /* us */ +/* delay for the voltage transition on the power supply, chip max is 16us */ +#define PD_POWER_SUPPLY_TRANSITION_DELAY 20000 /* us */ #endif /* __USB_PD_CONFIG_H */ diff --git a/board/samus_pd/usb_pd_config.h b/board/samus_pd/usb_pd_config.h index 62b699f3c0..d38999e2be 100644 --- a/board/samus_pd/usb_pd_config.h +++ b/board/samus_pd/usb_pd_config.h @@ -258,7 +258,7 @@ static inline int pd_snk_is_vbus_provided(int port) /* start as a sink in case we have no other power supply/battery */ #define PD_DEFAULT_STATE PD_STATE_SNK_DISCONNECTED -/* delay necessary for the voltage transition on the power supply */ -#define PD_POWER_SUPPLY_TRANSITION_DELAY 50000 /* us */ +/* delay for the voltage transition on the power supply, chip max is 16us */ +#define PD_POWER_SUPPLY_TRANSITION_DELAY 20000 /* us */ #endif /* __USB_PD_CONFIG_H */ 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", diff --git a/include/usb_pd.h b/include/usb_pd.h index 017b8031f4..bd19600282 100644 --- a/include/usb_pd.h +++ b/include/usb_pd.h @@ -504,6 +504,7 @@ enum pd_states { #endif /* CONFIG_USB_PD_DUAL_ROLE */ PD_STATE_SRC_DISCONNECTED, + PD_STATE_SRC_STARTUP, PD_STATE_SRC_DISCOVERY, PD_STATE_SRC_NEGOCIATE, PD_STATE_SRC_ACCEPTED, |