diff options
author | Ting Shen <phoenixshen@google.com> | 2021-09-30 15:41:33 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-10-05 08:04:20 +0000 |
commit | f48b29920036c69793eb1fdca0af7f8d945a20ab (patch) | |
tree | 70027d5d6a73f5d5de3041198a8160f39b290c81 | |
parent | 0b991c85aeabc67ba4c22a72db2fa452fdba674a (diff) | |
download | chrome-ec-f48b29920036c69793eb1fdca0af7f8d945a20ab.tar.gz |
baseboard/cherry: don't reset rt1718s gpio state in every init() call
To make the device bootable without battery, board_rt1718s_init()
enables sink path (GPIO1) at boot, but also incorrectly enables sink
path on subsequent low-power-mode exits.
Fix this incorrect behavior: board_rt1718s_init should keep the previous
GPIO state on LPM exit.
BUG=none
TEST=verify that C1 sink path does not turn on by default when replug
BRANCH=main
Signed-off-by: Ting Shen <phoenixshen@google.com>
Change-Id: I8ae8f65e101fc66f828168237c136ca180189c08
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3195204
Reviewed-by: Eric Yilun Lin <yllin@google.com>
Commit-Queue: Ting Shen <phoenixshen@chromium.org>
Tested-by: Ting Shen <phoenixshen@chromium.org>
-rw-r--r-- | baseboard/cherry/baseboard.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/baseboard/cherry/baseboard.c b/baseboard/cherry/baseboard.c index daf5e218d2..7013dc9790 100644 --- a/baseboard/cherry/baseboard.c +++ b/baseboard/cherry/baseboard.c @@ -38,6 +38,7 @@ #include "regulator.h" #include "spi.h" #include "switch.h" +#include "system.h" #include "tablet_mode.h" #include "task.h" #include "temp_sensor.h" @@ -375,10 +376,15 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { __override int board_rt1718s_init(int port) { - /* set GPIO 1~3 as push pull, as output, output low. */ - rt1718s_gpio_set_flags(port, RT1718S_GPIO1, GPIO_OUT_LOW); - rt1718s_gpio_set_flags(port, RT1718S_GPIO2, GPIO_OUT_LOW); - rt1718s_gpio_set_flags(port, RT1718S_GPIO3, GPIO_OUT_LOW); + static bool gpio_initialized; + + if (!system_jumped_late() && !gpio_initialized) { + /* set GPIO 1~3 as push pull, as output, output low. */ + rt1718s_gpio_set_flags(port, RT1718S_GPIO1, GPIO_OUT_LOW); + rt1718s_gpio_set_flags(port, RT1718S_GPIO2, GPIO_OUT_LOW); + rt1718s_gpio_set_flags(port, RT1718S_GPIO3, GPIO_OUT_LOW); + gpio_initialized = true; + } /* gpio 1/2 output high when receiving frx signal */ RETURN_ERROR(rt1718s_update_bits8(port, RT1718S_GPIO1_VBUS_CTRL, |