summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Zieba <robertzieba@google.com>2023-02-13 17:21:55 +0000
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-02-17 19:12:24 +0000
commit0b89053de723754d6c329794c3b596ffd905e9ab (patch)
tree3fed9d1a45d8807cc3a6d6b2b8a5c0311c667639
parent6dcfdc7b10f44852c40b30564d596fe27c5249c8 (diff)
downloadchrome-ec-0b89053de723754d6c329794c3b596ffd905e9ab.tar.gz
skyrim/usbc_config: Ensure that type-A ports are powered after TCPC reset
The GPIO restore code in `reset_nct38xx_port` can disable vbus supply to the type-A port if the device transitions to S0 during the function call. Add code to ensure vbus is supplied to the type-A port if we're in S0. BRANCH=none BUG=b:265709281 TEST=ODM verified on frostflow device Change-Id: I2f4d58801ebbc7c1e5f350a3917e7e2dcc6b5d61 Signed-off-by: Robert Zieba <robertzieba@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4250037 Tested-by: SamSP Liu <samsp_liu2@compal.corp-partner.google.com> Commit-Queue: Chao Gui <chaogui@google.com> Reviewed-by: Diana Z <dzigterman@chromium.org>
-rw-r--r--zephyr/program/skyrim/src/usbc_config.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/zephyr/program/skyrim/src/usbc_config.c b/zephyr/program/skyrim/src/usbc_config.c
index c8f56c455f..e2983b2307 100644
--- a/zephyr/program/skyrim/src/usbc_config.c
+++ b/zephyr/program/skyrim/src/usbc_config.c
@@ -241,6 +241,7 @@ static void reset_nct38xx_port(int port)
{
const struct gpio_dt_spec *reset_gpio_l;
const struct device *ioex_port0, *ioex_port1;
+ int rv;
/* The maximum pin numbers of the NCT38xx IO expander port is 8 */
gpio_flags_t saved_port0_flags[8] = { 0 };
@@ -275,6 +276,18 @@ static void reset_nct38xx_port(int port)
ARRAY_SIZE(saved_port0_flags));
gpio_restore_port_config(ioex_port1, saved_port1_flags,
ARRAY_SIZE(saved_port1_flags));
+
+ if (power_get_state() == POWER_S0) {
+ /* If we transitioned to S0 during the reset then the restore
+ * may set the vbus enable pin low. Ensure the A port is
+ * always powered in S0.
+ */
+ rv = usb_charge_set_mode(port, USB_CHARGE_MODE_ENABLED,
+ USB_ALLOW_SUSPEND_CHARGE);
+ if (rv)
+ CPRINTSUSB("S0 TCPC enable failure on port %d(%d)",
+ port, rv);
+ }
}
void board_reset_pd_mcu(void)