summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTing Shen <phoenixshen@google.com>2021-11-24 15:21:28 +0800
committerCommit Bot <commit-bot@chromium.org>2021-12-01 11:46:52 +0000
commit2cb4afc8068a487be1e1f15653cb57783bb2cc8b (patch)
tree1128632de5da68d3a899540a1752d041011ffa5e
parent256e46a676fd79c46e94354f44f454318e5018db (diff)
downloadchrome-ec-2cb4afc8068a487be1e1f15653cb57783bb2cc8b.tar.gz
mt6360: prevent BC1.2 trigger after PD established
(cherry-picked from CL:3299287 and removed rt1718s part) Add an extra check to prevent BC 1.2 detection trigger when VBUS state change after pd connection established (for example, power role swap or fast role swap) and break the existing USB2 connection. Note that after this change, BC1.2 detection still triggers when a PD charger just plugged in, because bc1.2 detection happens before EC awares that the adapter supports PD. BUG=b:193753475 TEST=verify BC1.2 detection doesn't trigger in following scenario: 1) power role swap 2) fast role swap 3) plug in USB-C-to-A adapter BRANCH=asurada Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: I6657d7f1fd8b8f2aad19744b89f794e107cd45c9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3299287 Reviewed-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org> (cherry picked from commit 762e1373319c42230923f7310d25a54d64697374) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3310397
-rw-r--r--driver/bc12/mt6360.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/driver/bc12/mt6360.c b/driver/bc12/mt6360.c
index 601da96576..7f792bc513 100644
--- a/driver/bc12/mt6360.c
+++ b/driver/bc12/mt6360.c
@@ -166,7 +166,11 @@ static void mt6360_usb_charger_task(const int port)
/* vbus change, start bc12 detection */
if (evt & USB_CHG_EVENT_VBUS) {
- if (pd_snk_is_vbus_provided(port))
+ bool is_non_pd_sink = !pd_capable(port) &&
+ pd_get_power_role(port) == PD_ROLE_SINK &&
+ pd_snk_is_vbus_provided(port);
+
+ if (is_non_pd_sink)
mt6360_enable_bc12_detection(1);
else
mt6360_update_charge_manager(