summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorEric Yilun Lin <yllin@chromium.org>2022-03-17 13:23:53 +0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-07-27 03:05:57 +0000
commita1cead1d914ffc0ae7296e04c2fbda222882fefe (patch)
treeb317481899174be242e26ddbef86c61024d54dc0 /common
parent2d3cc862e95d55950dd22f68dabfd1021fe02640 (diff)
downloadchrome-ec-a1cead1d914ffc0ae7296e04c2fbda222882fefe.tar.gz
dps: respect PD_MAX_CURRENT_MA when evaluating PDO
PD_MAX_CURRENT_MA should be used when evaluating the PDO's maximum power it can request. BUG=b:169532537 TEST=none BRANCH=cherry Change-Id: Ia514e921b012b326fc314f33c2257f8082b42443 Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3529601 Tested-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Eric Yilun Lin <yllin@google.com> Reviewed-by: Sam Hurst <shurst@google.com>
Diffstat (limited to 'common')
-rw-r--r--common/dps.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/common/dps.c b/common/dps.c
index f3a8414e9c..7b00822830 100644
--- a/common/dps.c
+++ b/common/dps.c
@@ -397,7 +397,7 @@ static bool has_new_power_request(struct pdo_candidate *cand)
if (mv > max_mv)
continue;
- mw = ma * mv / 1000;
+ mw = MIN(ma, PD_MAX_CURRENT_MA) * mv / 1000;
efficient = is_more_efficient(mv, cand->mv, batt_mv,
batt_pwr, input_pwr_avg);