samus: enable bq learn mode to avoid backboosting

For samus, use learn mode on BQ24773 to avoid the soft start that
causes backboosting on some boards.

BUG=chrome-os-partner:33644
BRANCH=samus
TEST=tested in EE lab on a board that was backboosting reliable.
this fixes backboosting at 5V, and also on 20V to 5V transitions.

Change-Id: I97c52a55ba07662d444e67bfbc9ca488b530f423
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/229282
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
This commit is contained in:
Alec Berg
2014-11-12 08:55:34 -08:00
committed by chrome-internal-fetch
parent 7e7e82f2c1
commit 2ff6a30c47

View File

@@ -8,6 +8,7 @@
* Drive high in S5-S0 when AC_PRESENT is high, otherwise drive low.
*/
#include "charger.h"
#include "chipset.h"
#include "common.h"
#include "extpower.h"
@@ -25,10 +26,24 @@ int extpower_is_present(void)
*/
static void extpower_deferred(void)
{
static int extpower_prev;
int extpower = extpower_is_present();
if (extpower && !extpower_prev) {
charger_discharge_on_ac(0);
} else if (extpower && extpower_prev) {
/* glitch on AC_PRESENT, attempt to recover from backboost */
charger_discharge_on_ac(1);
charger_discharge_on_ac(0);
} else {
charger_discharge_on_ac(1);
}
extpower_prev = extpower;
hook_notify(HOOK_AC_CHANGE);
/* Forward notification to host */
if (extpower_is_present())
if (extpower)
host_set_single_event(EC_HOST_EVENT_AC_CONNECTED);
else
host_set_single_event(EC_HOST_EVENT_AC_DISCONNECTED);
@@ -66,6 +81,8 @@ static void extpower_init(void)
{
extpower_buffer_to_pch();
hook_call_deferred(extpower_deferred, 0);
/* Enable interrupts, now that we've initialized */
gpio_enable_interrupt(GPIO_AC_PRESENT);
}