summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2015-02-16 15:01:39 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-02-17 20:53:05 +0000
commit275606d104183c09ecabae3affa914e9f3b22926 (patch)
treea44668ec76e31902792ddbbed08f4adea8f66965
parent672d37789f6a9ba93550c229f72a56b0cc8e041d (diff)
downloadchrome-ec-275606d104183c09ecabae3affa914e9f3b22926.tar.gz
samus: avoid waking extpower task until task has been initialized
Fix booting without battery by avoiding waking the extpower task until it has run extpower_board_hacks() the first time. The problem was if there was no battery and AC was attached, extpower_board_hacks() would run twice on boot, once in extpower task initialization, before the while(1) loop, and a second time due to the AC_PRESENT interrupt. This would cause extpower_board_hacks() to think that AC had transitioned from 1 to 1, which represents a glitch on ACOK, so it would disable charging, thus causing us to lose power. BUG=chrome-os-partner:35570 BRANCH=samus TEST=load on a samus and boot with and without battery Change-Id: Idf6d0022f7dbedbb66a2fbe1c2b7dd885eabc43b Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/250301 Reviewed-by: Shawn N <shawnn@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
-rw-r--r--board/samus/extpower.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/board/samus/extpower.c b/board/samus/extpower.c
index 19f4a5d5ff..c0b5283777 100644
--- a/board/samus/extpower.c
+++ b/board/samus/extpower.c
@@ -35,6 +35,9 @@ static int bkboost_detected;
/* Charging is disabled */
static int charge_is_disabled;
+/* Extpower task has been initialized */
+static int extpower_task_initialized;
+
/*
* Charge circuit occasionally gets wedged and doesn't charge.
* This variable keeps track of the state of the circuit.
@@ -70,10 +73,12 @@ DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, extpower_shutdown, HOOK_PRIO_DEFAULT);
void extpower_interrupt(enum gpio_signal signal)
{
+ /* Trigger notification of external power change */
extpower_buffer_to_pch();
- /* Trigger notification of external power change */
- task_wake(TASK_ID_EXTPOWER);
+ /* Wake extpower task only if task has been initialized */
+ if (extpower_task_initialized)
+ task_wake(TASK_ID_EXTPOWER);
}
static void extpower_init(void)
@@ -369,6 +374,7 @@ void extpower_task(void)
extpower_board_hacks(extpower, extpower_prev);
extpower_prev = extpower;
+ extpower_task_initialized = 1;
/* Enable backboost detection interrupt */
gpio_enable_interrupt(GPIO_BKBOOST_DET);