From b71046c818aee78f1d2d90201dd221c7c1fab726 Mon Sep 17 00:00:00 2001 From: Wai-Hong Tam Date: Fri, 20 Dec 2019 15:54:10 -0800 Subject: Trogdor: Implement board_set_tcpc_power_mode The board_set_tcpc_power_mode() function hasn't been defined. When doing TCPC software sync, AP to ask EC to suspend the TCPC chip, and then resume it when done. Missing the board_set_tcpc_power_mode() function made the TCPC chip can't resume back. BRANCH=None BUG=b:146652805 TEST=Executed the TCPC software sync, verified the TCPC is back, i.e. 2019-12-20 15:33:27 > C0 st1 SUSPENDED 2019-12-20 15:33:30 [286.977749 TCPC p0 suspended!] 2019-12-20 15:34:14 C0 st2 SNK_DISCONNECTED 2019-12-20 15:34:14 [330.333053 Resetting TCPCs...] 2019-12-20 15:34:14 [330.382545 C0 FAULT 0x00 detected] 2019-12-20 15:34:14 [330.383235 C0 FAULT 0x00 handled] 2019-12-20 15:34:14 [330.387583 TCPC p0 resumed!] Without this CL, an error was reported and the TCPC chip still in suspend. 2019-12-20 14:57:52 C0 st2 SNK_DISCONNECTED 2019-12-20 14:57:52 [546.264649 TCPC p0 restart failed!] Change-Id: I6cee0b7a6d24b9b6ab40f5259a659ca234319990 Signed-off-by: Wai-Hong Tam Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1979611 Reviewed-by: Stephen Boyd --- board/trogdor/board.c | 9 +++++++++ board/trogdor/board.h | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/board/trogdor/board.c b/board/trogdor/board.c index c9367cca9c..5e966c75cf 100644 --- a/board/trogdor/board.c +++ b/board/trogdor/board.c @@ -381,6 +381,15 @@ void board_reset_pd_mcu(void) msleep(PS8805_FW_INIT_DELAY_MS); } +void board_set_tcpc_power_mode(int port, int mode) +{ + /* Ignore the "mode" to turn the chip on. We can only do a reset. */ + if (mode) + return; + + board_reset_pd_mcu(); +} + int board_vbus_sink_enable(int port, int enable) { /* Both ports are controlled by PPC SN5S330 */ diff --git a/board/trogdor/board.h b/board/trogdor/board.h index 915375d719..f44e08aaca 100644 --- a/board/trogdor/board.h +++ b/board/trogdor/board.h @@ -102,7 +102,6 @@ /* * TODO(b/145723652): Add back the following CONFIG's after we enable * the PD software sync to update the PS8805 firmware. - * * #define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE * #define CONFIG_USB_PD_TCPC_LOW_POWER */ @@ -236,6 +235,7 @@ int board_is_sourcing_vbus(int port); int board_vbus_sink_enable(int port, int enable); /* Reset all TCPCs. */ void board_reset_pd_mcu(void); +void board_set_tcpc_power_mode(int port, int mode); #endif /* !defined(__ASSEMBLER__) */ -- cgit v1.2.1