diff options
author | Vic Yang <victoryang@chromium.org> | 2013-03-04 10:42:01 +0800 |
---|---|---|
committer | ChromeBot <chrome-bot@google.com> | 2013-03-04 16:24:56 -0800 |
commit | 6249a400696f270e7c9216db8e2998d7331f4613 (patch) | |
tree | be6828005a687d5d479f90b6f94f1bd54a332319 /board | |
parent | d86df6c38883435c9df5de3bd7ba1c2b35b67316 (diff) | |
download | chrome-ec-6249a400696f270e7c9216db8e2998d7331f4613.tar.gz |
spring: set maximum allowed duty cycle
We should allow a minimum amount of current input in case the
battery is dead.
BUG=chrome-os-partner:14319
TEST=Boot with a dead battery
BRANCH=none
Change-Id: I3c172d43c8190ed2dc5d421dcf2b5aaf0e88ecd9
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44510
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'board')
-rw-r--r-- | board/spring/usb_charging.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/board/spring/usb_charging.c b/board/spring/usb_charging.c index ce864e1d9f..cf17170129 100644 --- a/board/spring/usb_charging.c +++ b/board/spring/usb_charging.c @@ -39,6 +39,7 @@ #define I_LIMIT_3000MA 0 /* PWM control loop parameters */ +#define PWM_CTRL_MAX_DUTY 96 /* Minimum current for dead battery */ #define PWM_CTRL_BEGIN_OFFSET 30 #define PWM_CTRL_OC_MARGIN 15 #define PWM_CTRL_OC_DETECT_TIME (800 * MSEC) @@ -249,6 +250,8 @@ void board_pwm_nominal_duty_cycle(int percent) if (battery_current(&dummy)) board_pwm_duty_cycle(percent); + else if (percent + PWM_CTRL_BEGIN_OFFSET > PWM_CTRL_MAX_DUTY) + board_pwm_duty_cycle(PWM_CTRL_MAX_DUTY); else board_pwm_duty_cycle(percent + PWM_CTRL_BEGIN_OFFSET); nominal_pwm_duty = percent; |