spring: Allow a minimum 100mA current input

With this, we are able to boot with a super dead battery even with a bad
charger. This however breaks support for chargers that cannot even
supply 100mA, but that's very unlikely to happen.

BUG=chrome-os-partner:21107
TEST=Charge a dead battery with a bad charger and a super long cable.
BRANCH=Spring

Change-Id: I3c532523456185223420a4381f56365ad3afb2ec
Original-Change-Id: I6b7b0df0ae7bdf863420755ea92e09d87f6866c3
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63804
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64276
This commit is contained in:
Vic Yang
2013-07-30 16:23:10 -07:00
committed by ChromeBot
parent bcdfbee1b6
commit 191693b881

View File

@@ -67,7 +67,7 @@ enum ilim_config {
#define I_LIMIT_3000MA 0
/* PWM control loop parameters */
#define PWM_CTRL_MAX_DUTY 96 /* Minimum current for dead battery */
#define PWM_CTRL_MAX_DUTY I_LIMIT_100MA /* Minimum current */
#define PWM_CTRL_BEGIN_OFFSET 90
#define PWM_CTRL_OC_MARGIN 15
#define PWM_CTRL_OC_DETECT_TIME (1200 * MSEC)
@@ -403,17 +403,10 @@ static int pwm_check_vbus_high(int vbus)
static void pwm_nominal_duty_cycle(int percent)
{
int dummy;
int new_percent = percent;
new_percent += PWM_CTRL_BEGIN_OFFSET;
/*
* If the battery is dead, leave a minimum amount of current
* input to sustain the system.
*/
if (battery_current(&dummy))
new_percent = MIN(new_percent, PWM_CTRL_MAX_DUTY);
new_percent = MIN(new_percent, PWM_CTRL_MAX_DUTY);
set_pwm_duty_cycle(new_percent);
nominal_pwm_duty = percent;