diff options
author | Diana Z <dzigterman@chromium.org> | 2021-02-04 13:30:03 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-04-07 18:57:27 +0000 |
commit | b7a40f8a9396fe8d8da3b152024e69e19c0d18e5 (patch) | |
tree | 230a17305e1e83d38ec9499feb03fd7c2f145571 | |
parent | 7bf58091a5d00c7485d28af40eb5679d333564aa (diff) | |
download | chrome-ec-b7a40f8a9396fe8d8da3b152024e69e19c0d18e5.tar.gz |
TCPMv2: Check charge port when booting
When booting into S0, take the current charge port into account when
deciding whether to power role swap. If the port has been selected from
the UI as a charge port, then refrain from swapping and continue to
charge from it.
BRANCH=None
BUG=b:179334214,b:179095748,b:178070314
TEST=on madoo, connect to magolor and select charging from magolor on
the UI. Go through suspend and shutdown iterations and confirm that
madoo continues to charge from magolor
Signed-off-by: Diana Z <dzigterman@chromium.org>
Change-Id: I40ef73309f75372b0a34a7542282244ff30868ed
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2676924
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2809635
Reviewed-by: Edward Hill <ecgh@chromium.org>
Commit-Queue: Edward Hill <ecgh@chromium.org>
Tested-by: Edward Hill <ecgh@chromium.org>
-rw-r--r-- | common/usbc/usb_pe_drp_sm.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/common/usbc/usb_pe_drp_sm.c b/common/usbc/usb_pe_drp_sm.c index 27ddd92ecc..2547707187 100644 --- a/common/usbc/usb_pe_drp_sm.c +++ b/common/usbc/usb_pe_drp_sm.c @@ -1214,13 +1214,16 @@ static bool pd_can_source_from_device(const int pdo_cnt, const uint32_t *pdos) void pd_resume_check_pr_swap_needed(int port) { /* - * Explicit contract, current power role of SNK and the device - * indicates it should not power us then trigger a PR_Swap + * Explicit contract, current power role of SNK, the device + * indicates it should not power us, and device isn't selected + * as the charging port (ex. through the GUI) then trigger a PR_Swap */ if (pe_is_explicit_contract(port) && pd_get_power_role(port) == PD_ROLE_SINK && !pd_can_source_from_device(pd_get_src_cap_cnt(port), - pd_get_src_caps(port))) + pd_get_src_caps(port)) && + (!IS_ENABLED(CONFIG_CHARGE_MANAGER) || + charge_manager_get_active_charge_port() != port)) pd_dpm_request(port, DPM_REQUEST_PR_SWAP); } |