spring: Always pull 500mA before charger type is determined

To prevent the EC browning out when the battery is too low, let's always
pull 500mA before we can determine the charger type. The correct current
limit can then be set after we know the charger type.

Also, even if the battery is not present, keep the PWM tweaking loop
going.

BUG=chrome-os-partner:21107
TEST=Plug in charger to a device with a dead battery and see it charge.
BRANCH=Spring

Change-Id: Iad5599b60d20fb405d78d30b2be74bcc98958dd5
Original-Change-Id: Iec2ec96e3c2c341f14888aa50bd84f72af75c073
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63626
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64275
This commit is contained in:
Vic Yang
2013-07-30 05:06:49 +08:00
committed by ChromeBot
parent 311812b569
commit bcdfbee1b6

View File

@@ -671,16 +671,7 @@ static void usb_device_change(int dev_type)
*/
void extpower_charge_init(void)
{
int dummy;
/*
* Shut off power input if battery is good. Otherwise, leave
* 500mA to sustain the system.
*/
if (battery_current(&dummy))
set_pwm_duty_cycle(I_LIMIT_500MA);
else
ilim_config(ILIM_CONFIG_MANUAL_ON);
set_pwm_duty_cycle(I_LIMIT_500MA);
/*
* Somehow TSU6721 comes up slowly. Let's wait for a moment before
@@ -821,7 +812,7 @@ static void pwm_tweak(void)
vbus = adc_read_channel(ADC_CH_USB_VBUS_SNS);
if (battery_current(&current))
return;
current = 0;
if (user_pwm_duty >= 0) {
if (current_pwm_duty != user_pwm_duty)