mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-07 16:11:43 +00:00
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
This commit is contained in:
committed by
chrome-internal-fetch
parent
3fd064745b
commit
2c83bfc7da
@@ -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 */
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user