summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Yilun Lin <yllin@chromium.org>2022-02-24 16:09:04 +0800
committerCommit Bot <commit-bot@chromium.org>2022-02-24 09:51:03 +0000
commit2f73fa6752a877e27b2ca90aa49c3c3768455b42 (patch)
treeac2bb02f969d37ba4f1bdea3d08423d335fd0cbb
parent0d799bd45ed2dd9025a5dbf61d69ba4d96d4c306 (diff)
downloadchrome-ec-2f73fa6752a877e27b2ca90aa49c3c3768455b42.tar.gz
corsola: reset USB-C port when USB hub is reset and was sourcing
This is recommend by USB 3.2 spec 10.3.1.1. BUG=b:203739613 TEST=ensure USB-C port is hardreset when resume from S5 or lower BRANCH=none Change-Id: Ia24b2bf4397cd9ca3408f6a2418199fef7848af8 Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3487371 Tested-by: Eric Yilun Lin <yllin@google.com> Auto-Submit: Eric Yilun Lin <yllin@google.com> Reviewed-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org>
-rw-r--r--zephyr/projects/corsola/src/usbc_config.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/zephyr/projects/corsola/src/usbc_config.c b/zephyr/projects/corsola/src/usbc_config.c
index 026d66fba6..b83209285b 100644
--- a/zephyr/projects/corsola/src/usbc_config.c
+++ b/zephyr/projects/corsola/src/usbc_config.c
@@ -29,6 +29,7 @@
#include "usb_charge.h"
#include "usb_mux.h"
#include "usb_pd_tcpm.h"
+#include "usb_tc_sm.h"
#include "usbc_ppc.h"
#include "variant_db_detection.h"
@@ -69,6 +70,17 @@ void usb_a0_interrupt(enum gpio_signal signal)
for (int i = 0; i < USB_PORT_COUNT; i++)
usb_charge_set_mode(i, mode, USB_ALLOW_SUSPEND_CHARGE);
+
+ /*
+ * Trigger hard reset to cycle Vbus on Type-C ports, recommended by
+ * USB 3.2 spec 10.3.1.1.
+ */
+ if (gpio_get_level(signal)) {
+ for (int i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) {
+ if (tc_is_attached_src(i))
+ pd_dpm_request(i, DPM_REQUEST_HARD_RESET_SEND);
+ }
+ }
}
void board_set_charge_limit(int port, int supplier, int charge_ma,