From b7b3d637ead031ce244f192cbcb5c1dad91e487e Mon Sep 17 00:00:00 2001 From: Aseda Aboagye Date: Fri, 14 Feb 2020 13:27:12 -0800 Subject: raa489000: Utilize VBUS auto discharge The Renesas RAA489000 has an issue where GoodCRC messages are not emitted unless the VBUS Auto Discharge Disconnect setting is enabled. This needs to occur after determining orientation. However, there appears to be another issue where the device will not DRP toggle while that VBUS Auto Discharge Disconnect setting is set. Luckily, our TCPMv2 state machine will enable/disable this setting at these times for us. Therefore, this commit leverages the TCPCI auto discharge disconnect function which allows DRP toggling to work. BUG=b:149337338 BRANCH=None TEST=Build and flash waddledoo, boot to S0, verify DUT DRP toggles. Plug in a PD port partner, verify that PD communication works. TEST=Repeat above test in both orientations. Change-Id: Ieb79392f3cd7c1939bb6fb3de0d6785cec0b24c4 Signed-off-by: Aseda Aboagye Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2057847 Tested-by: Aseda Aboagye Reviewed-by: Diana Z Commit-Queue: Aseda Aboagye Auto-Submit: Aseda Aboagye --- driver/tcpm/raa489000.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/driver/tcpm/raa489000.c b/driver/tcpm/raa489000.c index 9b4581a421..dec9313fba 100644 --- a/driver/tcpm/raa489000.c +++ b/driver/tcpm/raa489000.c @@ -83,9 +83,12 @@ int raa489000_init(int port) if (rv) CPRINTS("c%d: failed to set PD PHY setting1", port); - /* Enable VBUS auto discharge. needed to goodcrc */ + /* + * Disable VBUS auto discharge, we'll turn it on later as its needed to + * goodcrc. + */ rv = tcpc_read(port, TCPC_REG_POWER_CTRL, ®val); - regval |= TCPC_REG_POWER_CTRL_AUTO_DISCHARGE_DISCONNECT; + regval &= ~TCPC_REG_POWER_CTRL_AUTO_DISCHARGE_DISCONNECT; rv |= tcpc_write(port, TCPC_REG_POWER_CTRL, regval); if (rv) CPRINTS("c%d: failed to set auto discharge", port); @@ -154,4 +157,6 @@ const struct tcpm_drv raa489000_tcpm_drv = { #ifdef CONFIG_USB_PD_TCPC_LOW_POWER .enter_low_power_mode = &tcpci_enter_low_power_mode, #endif + .tcpc_enable_auto_discharge_disconnect = + &tcpci_tcpc_enable_auto_discharge_disconnect, }; -- cgit v1.2.1