diff options
author | Vic Yang <victoryang@chromium.org> | 2013-02-20 21:27:37 +0800 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-02-20 09:22:43 -0800 |
commit | 070943e9bfa2530603bb84ddaecd209aa53208da (patch) | |
tree | 8bec0cf81b64f2e50a6df5dd63802c1b4643f795 /board | |
parent | 95253a68dd9ec77388d6556f384299ecb80cfb7e (diff) | |
download | chrome-ec-070943e9bfa2530603bb84ddaecd209aa53208da.tar.gz |
spring: Handle dead battery and booting with low power charger
This tweaks initial PWM configuration so that:
- When battery is dead, more current is allowed to sustain the system.
- When EC boots with a low power charger, input current is throttled
so as not to kill the charger.
BUG=chrome-os-partner:14319
TEST=Manual
BRANCH=none
Change-Id: Ib52894b07fecdd533aecab312f40afa0b6df5676
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43600
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'board')
-rw-r--r-- | board/spring/board.h | 3 | ||||
-rw-r--r-- | board/spring/usb_charging.c | 21 |
2 files changed, 23 insertions, 1 deletions
diff --git a/board/spring/board.h b/board/spring/board.h index 5a026d9051..dd1b755da0 100644 --- a/board/spring/board.h +++ b/board/spring/board.h @@ -174,6 +174,9 @@ int board_get_usb_dev_type(void); /* Get USB port current limit */ int board_get_usb_current_limit(void); +/* Properly limit input power on EC boot */ +void board_pwm_init_limit(void); + #endif /* !__ASSEMBLER__ */ #endif /* __BOARD_H */ diff --git a/board/spring/usb_charging.c b/board/spring/usb_charging.c index 61e2b96da3..135405d483 100644 --- a/board/spring/usb_charging.c +++ b/board/spring/usb_charging.c @@ -166,6 +166,20 @@ void board_pwm_duty_cycle(int percent) current_pwm_duty = percent; } +void board_pwm_init_limit(void) +{ + int dummy; + + /* + * Shut off power input if battery is good. Otherwise, leave + * 500mA to sustain the system. + */ + if (battery_current(&dummy)) + board_pwm_duty_cycle(I_LIMIT_500MA); + else + board_ilim_config(ILIM_CONFIG_MANUAL_ON); +} + static void board_pwm_tweak(void) { int vbus, current; @@ -199,7 +213,12 @@ DECLARE_HOOK(HOOK_SECOND, board_pwm_tweak, HOOK_PRIO_DEFAULT); void board_pwm_nominal_duty_cycle(int percent) { - board_pwm_duty_cycle(percent + PWM_CTRL_BEGIN_OFFSET); + int dummy; + + if (battery_current(&dummy)) + board_pwm_duty_cycle(percent); + else + board_pwm_duty_cycle(percent + PWM_CTRL_BEGIN_OFFSET); nominal_pwm_duty = percent; } |