diff options
author | Eric Yilun Lin <yllin@chromium.org> | 2023-04-07 14:58:54 +0800 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-04-07 09:00:34 +0000 |
commit | 2c3a9fc9ad623ba387d225ec0db352a805bdb515 (patch) | |
tree | 0ff25284bb824e18094ecfe4a20f52e0e17c62b6 /driver/ppc/rt1739.c | |
parent | eea95bc3d1d4d4908e29a92b6af09a4da1b91ef4 (diff) | |
download | chrome-ec-2c3a9fc9ad623ba387d225ec0db352a805bdb515.tar.gz |
rt1739: check PD state before disconnect SBU/DU/DM
Fix the issue when SBU/DP/DM is affected by the disconnection of the
other port.
BUG=b:274553828 b:276416575
BRANCH=none
TEST=disconnect C0, and C1 USB is still probable
Change-Id: I1a3fc502bde1e48e19107fbd9fdafae7b3cb9869
Signed-off-by: Eric Yilun Lin <yllin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4408487
Reviewed-by: Ting Shen <phoenixshen@chromium.org>
Commit-Queue: Ting Shen <phoenixshen@chromium.org>
Tested-by: Eric Yilun Lin <yllin@google.com>
Auto-Submit: Eric Yilun Lin <yllin@google.com>
Diffstat (limited to 'driver/ppc/rt1739.c')
-rw-r--r-- | driver/ppc/rt1739.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/driver/ppc/rt1739.c b/driver/ppc/rt1739.c index 7c70c18975..edb54bb73c 100644 --- a/driver/ppc/rt1739.c +++ b/driver/ppc/rt1739.c @@ -486,7 +486,7 @@ void rt1739_interrupt(int port) void rt1739_pd_connect(void) { for (int i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; ++i) { - if (ppc_chips[i].drv == &rt1739_ppc_drv) + if (ppc_chips[i].drv == &rt1739_ppc_drv && pd_is_connected(i)) update_reg(i, RT1739_REG_SBU_CTRL_01, RT1739_DM_SWEN | RT1739_DP_SWEN | RT1739_SBU1_SWEN | RT1739_SBU2_SWEN, @@ -498,7 +498,8 @@ DECLARE_HOOK(HOOK_USB_PD_CONNECT, rt1739_pd_connect, HOOK_PRIO_DEFAULT); void rt1739_pd_disconnect(void) { for (int i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; ++i) { - if (ppc_chips[i].drv == &rt1739_ppc_drv) + if (ppc_chips[i].drv == &rt1739_ppc_drv && + pd_is_disconnected(i)) update_reg(i, RT1739_REG_SBU_CTRL_01, RT1739_DM_SWEN | RT1739_DP_SWEN | RT1739_SBU1_SWEN | RT1739_SBU2_SWEN, |