diff options
author | Caveh Jalali <caveh@chromium.org> | 2019-10-25 01:54:37 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-11-01 05:31:35 +0000 |
commit | 40b0cd04aeb2ac5c59b295106fb5d4cd2d2397a5 (patch) | |
tree | 841faf12a6d0f8003517c4f1f6e1ae9961e4c240 /board/atlas | |
parent | 36d36bafc2ff53efbed0fb1638c82fca07e17dc1 (diff) | |
download | chrome-ec-40b0cd04aeb2ac5c59b295106fb5d4cd2d2397a5.tar.gz |
atlas: initialize max charge current
the isl923x is strapped to initialize the charge current to 3A.
however, its default max charge current limit is 3.072. when the
charge current exceeds the current limit, the charger asserts PROCHOT
which means the AP gets throttled to 400MHz until the charge_state
machine updates the current limit.
on an unlocked system, we don't change the charge limit from its
default, so we never apply the 5% derating needed to avoid the isl923x
from over-currenting the charger.
the solution is to over-ride the 3A strapping of the isl923x by
appling a 5% derated current request early when we boot up.
BUG=b:141533503
BRANCH=none
TEST=atlas no longer boots into PROCHOT on 5v3a charger
Change-Id: Idba55edf7b1c0eec36b6583aa0b276c3cb1f0c89
Signed-off-by: Caveh Jalali <caveh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1889312
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'board/atlas')
-rw-r--r-- | board/atlas/board.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/board/atlas/board.c b/board/atlas/board.c index a7f3e41dc8..10c918679b 100644 --- a/board/atlas/board.c +++ b/board/atlas/board.c @@ -510,6 +510,22 @@ int board_set_active_charge_port(int charge_port) return EC_SUCCESS; } +/* + * Limit the input current to 95% negotiated limit, + * to account for the charger chip margin. + */ + +static int charger_derate(int current) +{ + return current * 95 / 100; +} + +static void board_charger_init(void) +{ + charger_set_input_current(charger_derate(PD_MAX_CURRENT_MA)); +} +DECLARE_HOOK(HOOK_INIT, board_charger_init, HOOK_PRIO_DEFAULT); + /** * Set the charge limit based upon desired maximum. * @@ -521,11 +537,7 @@ int board_set_active_charge_port(int charge_port) void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma, int charge_mv) { - /* - * Limit the input current to 95% negotiated limit, - * to account for the charger chip margin. - */ - charge_ma = (charge_ma * 95) / 100; + charge_ma = charger_derate(charge_ma); charge_set_input_current_limit(MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv); } |