summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatryk Duda <pdk@semihalf.com>2020-12-15 16:55:55 +0100
committerCommit Bot <commit-bot@chromium.org>2020-12-21 17:04:51 +0000
commit4a683f9fc8489596f4d0ae7ddd82483562a81524 (patch)
treea43c09b910364d3b7b074f3b6da045d570842909
parentcf873bd7993a90dd32ed5d530656b2c5ca88c3e9 (diff)
downloadchrome-ec-4a683f9fc8489596f4d0ae7ddd82483562a81524.tar.gz
usb_pd_dual_role: Respect max voltage limit when processing capabilities
To process source capabilities received from charger we just find the most appropriate PDO and inform charge manager about our choice (pd_process_source_cap() function). This function doesn't respect any voltage limits, so even when such a limit exists charge manager will be informed about higher voltage. Of course PD stack will request correct voltage from charger and charge manager will be notified about that fact, but providing wrong information about voltage can cause unnecessary new power requests. This issue was found during debugging EC hibernate issue on casta. BUG=b:161775827 BRANCH=none TEST=Flash EC ToT on casta. Set voltage limit to 5V. Observe if charge manager reports voltage changes from 5V to 15V (in my case) when received capabilities from ServoV4. NOTE: ServoV4 will send capabilities to DUT as a result of voltage transition (requested by ServoV4). Signed-off-by: Patryk Duda <pdk@semihalf.com> Change-Id: I5fe30f7a1b86fb1d934a29429147d9d7c9a84337 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2592496 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2600008
-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 fc70a6099a..683c2f1837 100644
--- a/common/usb_pd_dual_role.c
+++ b/common/usb_pd_dual_role.c
@@ -350,7 +350,7 @@ void pd_process_source_cap(int port, int cnt, uint32_t *src_caps)
/* Get max power info that we could request */
pd_find_pdo_index(pd_get_src_cap_cnt(port),
pd_get_src_caps(port),
- PD_MAX_VOLTAGE_MV, &pdo);
+ pd_get_max_voltage(), &pdo);
pd_extract_pdo_power(pdo, &ma, &mv);
/* Set max. limit, but apply 500mA ceiling */