diff options
author | Scott Collyer <scollyer@google.com> | 2018-10-16 16:36:33 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-10-23 13:01:53 -0700 |
commit | 8b51318ae8eeb10c494f007969b1e1e3548e616f (patch) | |
tree | 0886a030635261f82f3d41593c035ff062d2cf42 | |
parent | 9b28515c5bf8a9274f414ab319d9504b388812b4 (diff) | |
download | chrome-ec-8b51318ae8eeb10c494f007969b1e1e3548e616f.tar.gz |
ppc: syv682x: Make source disable dependent on VBUS presence
The syv682x PPC does not provide independent disabling of the source
and sink paths. Instead there is a single bit PWR_ENB, which when set,
will disable both the source and sink paths.
As part of USB PD initialization, pd_power_supply_reset(0) is called
to ensure VBUS isn't being sourced. If the source path isn't currently
active, then PWR_ENB bit should not be set as that will also disable
the sink path which may be active in a dead battery start up case.
This CL modifies the syv682x driver to only set PWR_ENB if the bit in
flags is set to indicate that the VBUS was being sourced.
BRANCH=none
BUG=b:117657778
TEST=Tested on DragonEgg. With no battery, connected external to port
1 and verified that the system boots successfully. Previously, it
would lose power.
Change-Id: I92b8f86a4b5b4e103dbeeafda2cf8da9ac7c17f2
Signed-off-by: Scott Collyer <scollyer@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1285294
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
-rw-r--r-- | driver/ppc/syv682x.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/driver/ppc/syv682x.c b/driver/ppc/syv682x.c index be341bb7b2..ea6e83ae48 100644 --- a/driver/ppc/syv682x.c +++ b/driver/ppc/syv682x.c @@ -126,8 +126,14 @@ static int syv682x_vbus_source_enable(int port, int enable) SYV682X_CONTROL_1_PWR_ENB); /* Disable HV Sink path */ regval |= SYV682X_CONTROL_1_HV_DR; - } else { + } else if (flags[port] & SYV682X_FLAGS_SOURCE_ENABLED) { /* + * For the disable case, make sure that VBUS was being sourced + * proir to disabling the source path. Because the source/sink + * paths can't be independently disabled, and this function will + * get called as part of USB PD initialization, setting the + * PWR_ENB always can lead to broken dead battery behavior. + * * No need to change the voltage path or channel direction. But, * turn both paths off. */ |