summaryrefslogtreecommitdiff
path: root/driver/tcpm/anx7447.c
diff options
context:
space:
mode:
authorXin Ji <xji@analogixsemi.com>2019-03-22 15:09:09 +0800
committerchrome-bot <chrome-bot@chromium.org>2019-03-28 19:04:06 -0700
commit9c7428ea97fb6606979607457a86a1ebf8ec9b19 (patch)
tree75b13fd278013616bbd76dd99033d28dd5e8efef /driver/tcpm/anx7447.c
parent60e9071a9ba8f773d33c076e0b4fb1956d285efd (diff)
downloadchrome-ec-9c7428ea97fb6606979607457a86a1ebf8ec9b19.tar.gz
anx7447.c: change VBUS present detection interface
ANX PD has two way to get VBUS present info, 1:ADC, 2:Comparator the ADC has been reset at chip reset stage, the comparator(0x1e:bit2) is analog part, it is not been reset by chip reset. there is a corner case which EC TCPM detect VBUS present info at chip reset stage(at system rebooting stage, EC TCPM issue TEST_R signal, this will trigger chip hardware reset). the original VBUS present function checks the VBUS from ADC, the ADC register value became to 0 while at chip reset stage, so at this moment, EC TCPM need check 0x1e:bit2 to get real VBUS present info. BRANCH=None BUG=b:129092057 TEST=Tested on Phaser, reboot stress test. Change-Id: I1e847c88b22684bc9b17243628179bad534801b2 Signed-off-by: Xin Ji <xji@analogixsemi.com> Reviewed-on: https://chromium-review.googlesource.com/1535085 Commit-Ready: Justin TerAvest <teravest@chromium.org> Tested-by: Justin TerAvest <teravest@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
Diffstat (limited to 'driver/tcpm/anx7447.c')
-rw-r--r--driver/tcpm/anx7447.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/driver/tcpm/anx7447.c b/driver/tcpm/anx7447.c
index 5b49cd685e..c57504bb09 100644
--- a/driver/tcpm/anx7447.c
+++ b/driver/tcpm/anx7447.c
@@ -30,6 +30,10 @@
#define vsafe5v_min (3800/25)
#define vsafe0v_max (800/25)
+/*
+ * These interface are workable while ADC is enabled, before
+ * calling them should make sure ec driver finished chip initilization.
+ */
#define is_equal_greater_safe5v(port) \
(((anx7447_get_vbus_voltage(port))) > vsafe5v_min)
#define is_equal_greater_safe0v(port) \
@@ -392,11 +396,6 @@ static int anx7447_get_vbus_voltage(int port)
return vbus_volt;
}
-static int anx7447_tcpm_get_vbus_level(int port)
-{
- return is_equal_greater_safe5v(port);
-}
-
int anx7447_set_power_supply_ready(int port)
{
int count = 0;
@@ -566,7 +565,7 @@ const struct tcpm_drv anx7447_tcpm_drv = {
.release = &anx7447_release,
.get_cc = &tcpci_tcpm_get_cc,
#ifdef CONFIG_USB_PD_VBUS_DETECT_TCPC
- .get_vbus_level = &anx7447_tcpm_get_vbus_level,
+ .get_vbus_level = &tcpci_tcpm_get_vbus_level,
#endif
.select_rp_value = &tcpci_tcpm_select_rp_value,
.set_cc = &tcpci_tcpm_set_cc,