From 80f53174f404c6db2f2d275129c2a7bd852ef624 Mon Sep 17 00:00:00 2001 From: Keith Short Date: Wed, 12 Feb 2020 17:44:53 -0700 Subject: syv682x: Don't turn off VBUS when disabling sink mode When the last charger is removed from the system, boards call ppc_vbus_sink_enable() to disable sink mode on all PD ports. The SYV682 doesn't support turning of VBUS and VCHG independently, so do nothing if if the SYV682 is currently the VBUS source. BUG=b:149428774 BRANCH=none TEST=make buildall TEST=On volteer, connect a charger to C0, connect a SNK device to C1. Disconnect charger and C0 and verify VBUS stays up on C1. Change-Id: I1747b3b19f584b0069134c520bd0ef0453a0a06a Signed-off-by: Keith Short Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2053036 Reviewed-by: caveh jalali --- driver/ppc/syv682x.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'driver/ppc') diff --git a/driver/ppc/syv682x.c b/driver/ppc/syv682x.c index d5bee2e985..ea1617ee7b 100644 --- a/driver/ppc/syv682x.c +++ b/driver/ppc/syv682x.c @@ -98,6 +98,13 @@ static int syv682x_vbus_sink_enable(int port, int enable) int regval; int rv; + if (!enable && syv682x_is_sourcing_vbus(port)) { + /* + * We're currently a source, so nothing more to do + */ + return EC_SUCCESS; + } + /* * For sink mode need to make sure high voltage power path is connected * and sink mode is selected. @@ -115,7 +122,7 @@ static int syv682x_vbus_sink_enable(int port, int enable) } else { /* * No need to change the voltage path or channel direction. But, - * turn both paths off. + * turn both paths off because we are currently a sink. */ regval |= SYV682X_CONTROL_1_PWR_ENB; } -- cgit v1.2.1