summaryrefslogtreecommitdiff
path: root/board/vell
diff options
context:
space:
mode:
authorPeter Marheine <pmarheine@chromium.org>2022-11-09 16:51:36 +1100
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-11-17 00:47:22 +0000
commitec31407993ec9b5ae14fed72d728a4061d656d65 (patch)
treef576b45529cfa8b2b29a7bbcbbff36e33c686b61 /board/vell
parentfcc7716bf1461477a3b3d8a53b85fdc81df677e4 (diff)
downloadchrome-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 'board/vell')
-rw-r--r--board/vell/board.h2
-rw-r--r--board/vell/charger.c5
2 files changed, 2 insertions, 5 deletions
diff --git a/board/vell/board.h b/board/vell/board.h
index 4b3d527901..3a7d97858c 100644
--- a/board/vell/board.h
+++ b/board/vell/board.h
@@ -61,6 +61,8 @@
#undef CONFIG_SYV682X_HV_ILIM
#define CONFIG_SYV682X_HV_ILIM SYV682X_HV_ILIM_5_50
+#define CONFIG_CHARGER_INPUT_CURRENT_DERATE_PCT 4
+
/* TODO: b/177608416 - measure and check these values on brya */
#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
diff --git a/board/vell/charger.c b/board/vell/charger.c
index e33a0ed44a..a153d57704 100644
--- a/board/vell/charger.c
+++ b/board/vell/charger.c
@@ -84,11 +84,6 @@ int board_set_active_charge_port(int port)
void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
int charge_mv)
{
- /*
- * Limit the input current to 96% negotiated limit,
- * to account for the charger chip margin.
- */
- charge_ma = charge_ma * 96 / 100;
charge_set_input_current_limit(
MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}