diff options
author | Diana Z <dzigterman@chromium.org> | 2021-03-12 15:21:16 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-03-17 00:09:47 +0000 |
commit | 4d8bc2363d3323755d24ea71c0086adef92ccc7a (patch) | |
tree | 29f4b76ca8bf49310afecbd18e84d4862121284c /common/usbc/usb_pe_drp_sm.c | |
parent | 5e6d9d3a85e5003106fa05ef93ccfad6aac88ae7 (diff) | |
download | chrome-ec-4d8bc2363d3323755d24ea71c0086adef92ccc7a.tar.gz |
TCPMv2: Preserve selected source current in FRS
When executing a fast role swap, ensure that any 3.0 A selected current
is preserved through the select_current_limit_rp in the TC layer.
Additionally, use this selected current to set our current limit when
first attaching as a source.
If FRS is disabled on a port, restore the default Rp value for the
board.
BRANCH=None
BUG=b:180434465
TEST=Check that a 3A FRS device loaded over 1.5 A is able to
successfully complete FRS
Signed-off-by: Diana Z <dzigterman@chromium.org>
Change-Id: I6e6b2f95066a3f8972664c6ac62b450e179e408d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2757096
Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
Diffstat (limited to 'common/usbc/usb_pe_drp_sm.c')
-rw-r--r-- | common/usbc/usb_pe_drp_sm.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/common/usbc/usb_pe_drp_sm.c b/common/usbc/usb_pe_drp_sm.c index b87c947c7d..46cf5fc185 100644 --- a/common/usbc/usb_pe_drp_sm.c +++ b/common/usbc/usb_pe_drp_sm.c @@ -931,10 +931,10 @@ static void pe_set_frs_enable(int port, int enable) int curr_limit = *pd_get_snk_caps(port) & PDO_FIXED_FRS_CURR_MASK; - typec_set_source_current_limit(port, - curr_limit == - PDO_FIXED_FRS_CURR_3A0_AT_5V ? - TYPEC_RP_3A0 : TYPEC_RP_1A5); + typec_select_src_current_limit_rp(port, + curr_limit == + PDO_FIXED_FRS_CURR_3A0_AT_5V ? + TYPEC_RP_3A0 : TYPEC_RP_1A5); PE_SET_FLAG(port, PE_FLAGS_FAST_ROLE_SWAP_ENABLED); } else { PE_CLR_FLAG(port, PE_FLAGS_FAST_ROLE_SWAP_ENABLED); @@ -1622,6 +1622,9 @@ static bool sink_dpm_requests(int port) } else if (PE_CHK_DPM_REQUEST(port, DPM_REQUEST_FRS_DET_DISABLE)) { pe_set_frs_enable(port, 0); + /* Restore a default port current limit */ + typec_select_src_current_limit_rp(port, + CONFIG_USB_PD_PULLUP); /* Requires no state change, fall through to false */ PE_CLR_DPM_REQUEST(port, DPM_REQUEST_FRS_DET_DISABLE); |