summaryrefslogtreecommitdiff
path: root/common/usb_pd_protocol.c
diff options
context:
space:
mode:
authorRuibin Chang <ruibin.chang@ite.com.tw>2020-02-03 17:39:01 +0800
committerCommit Bot <commit-bot@chromium.org>2020-02-05 09:50:16 +0000
commitf060100507d0d02a487e873a22c8ddfa8728d916 (patch)
tree34480d8ded9a2433726b4fa16e0314d22528c706 /common/usb_pd_protocol.c
parent1e544609affc989a0b4bb75d69659d6a86291ec3 (diff)
downloadchrome-ec-f060100507d0d02a487e873a22c8ddfa8728d916.tar.gz
TCPMv1: Don't turn off pd module clock if rx enabled
Plug in type-c adapter in G3 power state. Because the SLEEP_MASK_USB_PD won't be set before we receive the SRC_Cap from SRC in SNK_Discovery state, but at waiting SRC_Cap this period time we will enter deep sleep mode and turns pd module clock off. This will cause TCPC miss the SRC_Cap message from SRC, then our PD_T_SINK_WAIT_CAP timer timeout and tx hard reset. So I add a configuration: SLEEP_MASK_USB_PD is set only by it83xx driver, so that SLEEP_MASK_USB_PD value won't be overwritten by set_state() function in usb_pd_prtocol.c. If one of the port TCPC Rx is enabled, chip will not go to deep sleep, but chip can go to doze mode that pd module clock won't be turned off only mcu core clock off. if all ports are nothing plug-in, the chip can go to deep sleep. BUG=none BRANCH=none TEST=TCPC doesn't miss any message from partner: -in SNK_DISCOVERY and power G3 state on board ampton. -in SRC_DISCOVERY and power S0 state on board it8xxx2_evb. Change-Id: I9639523e2ca180809f0f74f24321d06e7b3a04c2 Signed-off-by: Ruibin Chang <ruibin.chang@ite.com.tw> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1990935 Tested-by: Ruibin Chang <Ruibin.Chang@ite.com.tw> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Ruibin Chang <Ruibin.Chang@ite.com.tw>
Diffstat (limited to 'common/usb_pd_protocol.c')
-rw-r--r--common/usb_pd_protocol.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index a592ffaec3..39154f3fe0 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -730,7 +730,7 @@ static inline int is_try_src(int port)
static inline void set_state(int port, enum pd_states next_state)
{
enum pd_states last_state = pd[port].task_state;
-#ifdef CONFIG_LOW_POWER_IDLE
+#if defined(CONFIG_LOW_POWER_IDLE) && !defined(CONFIG_USB_PD_TCPC_ON_CHIP)
int i;
#endif
int not_auto_toggling = 1;
@@ -897,7 +897,7 @@ static inline void set_state(int port, enum pd_states next_state)
}
#endif
-#ifdef CONFIG_LOW_POWER_IDLE
+#if defined(CONFIG_LOW_POWER_IDLE) && !defined(CONFIG_USB_PD_TCPC_ON_CHIP)
/* If a PD device is attached then disable deep sleep */
for (i = 0; i < board_get_usb_pd_port_count(); i++) {
if (pd_capable(i))