summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlschyi <lschyi@google.com>2022-08-29 11:04:14 +0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-08-29 08:13:33 +0000
commit1d582a16b27377fe99fb08ed4d2224ef74d24d48 (patch)
tree45ba30a308445ece81495acd83c3a8fa5eb02415
parente0d429f62c16c847df2602b678eea7bee5aa454f (diff)
downloadchrome-ec-1d582a16b27377fe99fb08ed4d2224ef74d24d48.tar.gz
anx7447: fix Rp value before entering low power mode.
If set ANX7447 as force source role in TCPC and not set the Rp value to default before entering the low power mode, ANX7447 would cause periodic voltage drop on type c port and resulting spam logs in EC console. Update the enter low power mode method to set the Rp value to default if ANX7447 is configured as force source role. BRANCH=none BUG=b:237603237 TEST=run `pd {port} dualrole {mode}` and check `tcpci_dump {port}` with (1) mode = on (2) mode = sink (3) mode = source and ensure no spam logs, and ROLE register matches to the mode. Signed-off-by: lschyi <lschyi@google.com> Change-Id: I0bc9b0e2e8708d479b0d7c783041c3a13026e6d1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3861707 Reviewed-by: Eric Yilun Lin <yllin@google.com> Tested-by: Sung-Chi Li <lschyi@chromium.org> Commit-Queue: Sung-Chi Li <lschyi@chromium.org>
-rw-r--r--driver/tcpm/anx7447.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/driver/tcpm/anx7447.c b/driver/tcpm/anx7447.c
index 690d13c148..0aa732d0b8 100644
--- a/driver/tcpm/anx7447.c
+++ b/driver/tcpm/anx7447.c
@@ -494,6 +494,29 @@ static void anx7447_tcpc_alert(int port)
tcpci_tcpc_alert(port);
}
+#ifdef CONFIG_USB_PD_TCPC_LOW_POWER
+static int anx7447_tcpc_enter_low_power_mode(int port)
+{
+ int rv;
+
+ /*
+ * if anx7447 is in source mode, need to set Rp to default before
+ * entering the low power mode.
+ */
+ if (pd_get_dual_role(port) == PD_DRP_FORCE_SOURCE) {
+ rv = tcpc_write(
+ port, TCPC_REG_ROLE_CTRL,
+ TCPC_REG_ROLE_CTRL_SET(TYPEC_NO_DRP, TYPEC_RP_USB,
+ TYPEC_CC_RP, TYPEC_CC_RP));
+ if (rv) {
+ return rv;
+ }
+ }
+
+ return tcpci_enter_low_power_mode(port);
+}
+#endif
+
#ifdef CONFIG_USB_PD_FRS_TCPC
static void anx7447_disable_frs_deferred(void)
{
@@ -1028,7 +1051,7 @@ const struct tcpm_drv anx7447_tcpm_drv = {
.set_snk_ctrl = &tcpci_tcpm_set_snk_ctrl,
.set_src_ctrl = &tcpci_tcpm_set_src_ctrl,
#ifdef CONFIG_USB_PD_TCPC_LOW_POWER
- .enter_low_power_mode = &tcpci_enter_low_power_mode,
+ .enter_low_power_mode = &anx7447_tcpc_enter_low_power_mode,
#endif
#ifdef CONFIG_USB_PD_FRS_TCPC
.set_frs_enable = &anx7447_set_frs_enable,