summaryrefslogtreecommitdiff
path: root/driver/ppc
diff options
context:
space:
mode:
authorScott Collyer <scollyer@google.com>2018-04-04 10:38:50 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-04-10 19:12:48 -0700
commitdb8d6edf26ba3f78bbab2bcda7a98e249331b8c1 (patch)
tree8b15d0b02d9728dfab674cd65e0c7e27ba8c69b9 /driver/ppc
parentc8814430d65c440950446c573db0932707f02c89 (diff)
downloadchrome-ec-db8d6edf26ba3f78bbab2bcda7a98e249331b8c1.tar.gz
ppc: Add tcpci snk/src control via the COMMAND register
The ANX7447 has a sink/source control lines which can be connected to a PPC. The NX20P3483 PPC requires this control to set it's sink/source switch control. The ANX7447 contols these lines via the tcpci COMMAND register. This CL adds new tcpm_set functions to set either SNK or SRC control via the COMMAND register. BUG=b:77583452 BRANCH=NONE TEST=Tested on port 0 of Yorp with an external charger. Prior to this CL the PPC would remain in standby state because both snk/src control remained low. With these changes, verifed that snk_ctrl is driven high and vbus_sink_enable() function no longer returns an error. Change-Id: Icbea0d3edb63ad19f3d2c76636208497b6939a72 Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-on: https://chromium-review.googlesource.com/996239 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'driver/ppc')
-rw-r--r--driver/ppc/nx20p3483.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/driver/ppc/nx20p3483.c b/driver/ppc/nx20p3483.c
index b9b355441b..6c89fa76d5 100644
--- a/driver/ppc/nx20p3483.c
+++ b/driver/ppc/nx20p3483.c
@@ -12,6 +12,7 @@
#include "hooks.h"
#include "i2c.h"
#include "system.h"
+#include "tcpm.h"
#include "usb_charge.h"
#include "usb_pd_tcpm.h"
#include "usbc_ppc.h"
@@ -129,6 +130,10 @@ static int nx20p3483_vbus_sink_enable(int port, int enable)
/* Set SNK mode based on enable */
gpio_set_level(ppc_chips[port].snk_gpio, enable);
+ } else {
+ rv = tcpm_set_snk_ctrl(port, enable);
+ if (rv)
+ return rv;
}
/* Verify switch status register */
@@ -158,6 +163,10 @@ static int nx20p3483_vbus_source_enable(int port, int enable)
/* Set SRC mode based on enable */
gpio_set_level(ppc_chips[port].src_gpio, enable);
+ } else {
+ rv = tcpm_set_src_ctrl(port, enable);
+ if (rv)
+ return rv;
}
/* Verify switch status register */