summaryrefslogtreecommitdiff
path: root/common/usbc
diff options
context:
space:
mode:
authorWai-Hong Tam <waihong@google.com>2021-05-18 15:11:53 -0700
committerCommit Bot <commit-bot@chromium.org>2021-05-20 23:08:05 +0000
commit2663f98dd8c0aaf21f2e119d71d95be8241f5a63 (patch)
tree5967983a1ee04bc470e323f5129eb370df3473f9 /common/usbc
parentb3367a2fcc57d04c4b9abbfcd291fef25c837797 (diff)
downloadchrome-ec-2663f98dd8c0aaf21f2e119d71d95be8241f5a63.tar.gz
TCPMv2: Seed the charge manger in Attached.SRCstabilize-13983.B-main
When EC reboots, the TCPMv2 stack initializes the Type-C supplier in either staying in Unattached.SNK (debounced that nothing is attached to the connector) or transition to Attached.SNK (exclude the PRS case), in order to seed the charge manager. However, if the state transits to Attached.SRC from Unattached.SNK via Try.SRC. The charge manger has never been seeded. It happens when a DRP (like a Type-C hub) is attached during reboot. It may then transit to Attached.SNK through a Power-Role-Swap. However, the PRS case is excluded to seed the charge manger. This CL initializes the Type-C supplier to 0 in the Attached.SRC state. It seeds the charge manger. So all cases (Unattached.SNK, Attached.SNK, Attached.SRC) are covered. BRANCH=None BUG=b:188532782 TEST=Attach a powered Type-C hub; reboot EC; the charge manger is seeded; the charge port is selected; the power sink path is enabled. Change-Id: I8fbfc1c4ffc5c9a9a8a49fcc36d67da93d01c403 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2904562 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'common/usbc')
-rw-r--r--common/usbc/usb_tc_drp_acc_trysrc_sm.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/common/usbc/usb_tc_drp_acc_trysrc_sm.c b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
index c2e47f7906..b73b8ecf25 100644
--- a/common/usbc/usb_tc_drp_acc_trysrc_sm.c
+++ b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
@@ -3011,6 +3011,10 @@ static void tc_attached_src_entry(const int port)
/* Inform PPC and OCP module that a sink is connected. */
tc_set_partner_role(port, PPC_DEV_SNK);
+ /* Initialize type-C supplier to seed the charge manger */
+ if (IS_ENABLED(CONFIG_CHARGE_MANAGER))
+ typec_set_input_current_limit(port, 0, 0);
+
/*
* Only notify if we're not performing a power role swap. During a
* power role swap, the port partner is not disconnecting/connecting.