summaryrefslogtreecommitdiff
path: root/common/usb_pd_dual_role.c
diff options
context:
space:
mode:
authorDenis Brockus <dbrockus@google.com>2020-09-04 13:08:19 -0600
committerCommit Bot <commit-bot@chromium.org>2020-09-08 18:37:55 +0000
commit00446e091f2ac824d17e5d059d12576e6d64b133 (patch)
tree01c5e498826bd634545f332ce8ce9514201136a0 /common/usb_pd_dual_role.c
parentc535c381a70d2062491793841672aa188f619ef2 (diff)
downloadchrome-ec-00446e091f2ac824d17e5d059d12576e6d64b133.tar.gz
charge_manager: two charger DUT does not choose correct port
The active charge_port is selected in a delayed call to charge_manager_refresh. This leaves a big window allowing a better charger to be detected but not acted upon as the soon to be active charge_port. This leads to the PD Policy Engine deciding this better port is not the current active charge_port and down grading the current limit for the port to no longer be the best choice. So when the charge_manager_refresh is called, it starts changing ports and then later checks for the best port and then swaps back to a lesser charger. BUG=b:166228326 BRANCH=none TEST=USB-C0 45W then attach USB-C1 65W charger Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I23dad1e4690285b3867bd046d9416db9522002e8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2393863 Commit-Queue: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Edward Hill <ecgh@chromium.org> Tested-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org>
Diffstat (limited to 'common/usb_pd_dual_role.c')
-rw-r--r--common/usb_pd_dual_role.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/common/usb_pd_dual_role.c b/common/usb_pd_dual_role.c
index eff8954622..de925b1c58 100644
--- a/common/usb_pd_dual_role.c
+++ b/common/usb_pd_dual_role.c
@@ -200,7 +200,7 @@ void pd_build_request(int32_t vpd_vdo, uint32_t *rdo, uint32_t *ma,
* current limit gets incorrectly set to 0.5A.
*/
if (IS_ENABLED(CONFIG_CHARGE_MANAGER)) {
- int chg_port = charge_manager_get_active_charge_port();
+ int chg_port = charge_manager_get_selected_charge_port();
charging_allowed =
(chg_port == port || chg_port == CHARGE_PORT_NONE);