diff options
author | Peter Marheine <pmarheine@chromium.org> | 2022-11-09 16:51:36 +1100 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-11-17 00:47:22 +0000 |
commit | ec31407993ec9b5ae14fed72d728a4061d656d65 (patch) | |
tree | f576b45529cfa8b2b29a7bbcbbff36e33c686b61 /zephyr/Kconfig.usbc | |
parent | fcc7716bf1461477a3b3d8a53b85fdc81df677e4 (diff) | |
download | chrome-ec-ec31407993ec9b5ae14fed72d728a4061d656d65.tar.gz |
Add CONFIG_CHARGER_INPUT_CURRENT_DERATE_PCT
Many boards derate their charge current limits by some fixed ratio,
which results in duplicate code appearing in many different boards.
Since nearly all of these are in implementations of
board_set_charge_limit() and themselves call
charge_set_input_current_limit(), make that derating a config option
and move it into charge_set_input_current_limit(). This makes most
boards' implementations uniform and ripe for further simplification
in later changes.
For those boards that do more complex adjustments, those can be
retained by keeping the existing logic in board_set_charge_limit().
Several boards also uselessly defined multiple versions of
board_set_charge_limit(): the redundant ones are removed.
BUG=b:163093572
TEST=make buildall; zmake build -a
BRANCH=none
LOW_COVERAGE_REASON=follow-up CLs delete uncovered code
Change-Id: I0a7162e72538a91ad06ba85b91a10b93eb6af96b
Signed-off-by: Peter Marheine <pmarheine@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4015966
Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
Commit-Queue: Keith Short <keithshort@chromium.org>
Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'zephyr/Kconfig.usbc')
-rw-r--r-- | zephyr/Kconfig.usbc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/zephyr/Kconfig.usbc b/zephyr/Kconfig.usbc index 903cf575c6..5350c1cbbf 100644 --- a/zephyr/Kconfig.usbc +++ b/zephyr/Kconfig.usbc @@ -44,6 +44,22 @@ config PLATFORM_EC_CHARGER_INPUT_CURRENT chargers, this should be set to 512 mA in order to not brown-out low-current USB charge ports in accordance with USB-PD r3.0 Sec. 7.3 +config PLATFORM_EC_CHARGER_INPUT_CURRENT_DERATE_PCT + int "Charger input current derating percentage" + default 0 + depends on PLATFORM_EC_CHARGE_MANAGER + help + Setting this to a nonzero value causes actual charger current limits + to be adjusted by the given percentage. For example, setting this to + 4 and requesting a current limit of 1000 mA causes the charge manager + to program an actual current limit of 960 mA. + + This is useful if a charger consistently draws more current than the + programmed limit, or if it is desired to derate for other + safety-related reasons. If a more complex (non-linear) adjustment is + required, boards should override the board_set_charge_limit() + function instead of configuring this option. + config PLATFORM_EC_USBC_OCP bool help |