diff options
author | Shawn Nematbakhsh <shawnn@chromium.org> | 2017-09-25 10:47:57 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-09-26 13:36:20 -0700 |
commit | 3fe117d346e2a23d316cbdf038f95ccb62ac4565 (patch) | |
tree | 22e31f4a292a6c1c1171465fb1d1f004fdaf60a7 /board | |
parent | ff148ae240ab2ec4971279be55282a288e5c8c6f (diff) | |
download | chrome-ec-3fe117d346e2a23d316cbdf038f95ccb62ac4565.tar.gz |
samus_pd: Adjust input current limit downward to prevent OC
Based on measurements, Samus can pull more current than desired, even
taking into account the existing INPUT_CURRENT_LIMIT_OFFSET_MA
adjustment. Decrease the programmed current limit by an additional
factor, determined by taking the worst-case power measurements across 15
different Samus devices, to ensure that Samus never pulls more current
than desired.
BUG=chrome-os-partner:55297
BRANCH=samus
TEST=Verify with debug prints that curr_lim_ma becomes 256 when
negotiated current limit is 500mA and curr_lim_ma becomes 2556 when
negotiated limit is 3000mA.
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I6912d987c5a519f55a831698873a69c4cac817b8
Reviewed-on: https://chromium-review.googlesource.com/684696
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'board')
-rw-r--r-- | board/samus_pd/board.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/board/samus_pd/board.c b/board/samus_pd/board.c index f20afd7985..bad38ed435 100644 --- a/board/samus_pd/board.c +++ b/board/samus_pd/board.c @@ -30,9 +30,6 @@ #define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args) -/* Amount to offset the input current limit when sending to EC */ -#define INPUT_CURRENT_LIMIT_OFFSET_MA 192 - /* * When battery is high, system may not be pulling full current. Also, when * high AND input voltage is below boost bypass, then limit input current @@ -484,8 +481,8 @@ static int board_update_charge_limit(int charge_ma) pwm_set_duty(PWM_CH_ILIM, pwm_duty); #endif - pd_status.curr_lim_ma = MAX(0, charge_ma - - INPUT_CURRENT_LIMIT_OFFSET_MA); + pd_status.curr_lim_ma = charge_ma >= 500 ? + (charge_ma - 500) * 92 / 100 + 256 : 0; CPRINTS("New ilim %d", charge_ma); return 1; |