samus: Don't power-on AP if battery level < 1%

This will also inhibit power-on if no battery is attached.

BUG=chrome-os-partner:31127
TEST=Manual on Samus. Verify that AP continues to boot normally when
charge level exceeds CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON. Verify
that power button presses are ignored when the charge level is below
the threshold, and we return to G3. Also, verify that Samus can boot
successfully to the OS with 1% battery and a 5V @ 500mA charger attached.
BRANCH=Samus

Change-Id: I47cd3903c8cc13282fd5038f9d5fd1e310283ea7
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/236022
Reviewed-by: Alec Berg <alecaberg@chromium.org>
This commit is contained in:
Shawn Nematbakhsh
2014-12-16 10:17:06 -08:00
committed by ChromeOS Commit Bot
parent 783b46afb9
commit 0a2807572e
2 changed files with 9 additions and 0 deletions

View File

@@ -48,6 +48,7 @@
#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
#define CONFIG_CHARGER_INPUT_CURRENT 448
#define CONFIG_CHARGER_DISCHARGE_ON_AC
#define CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON 1
#define CONFIG_FANS 2
#define CONFIG_GESTURE_DETECTION
#define CONFIG_GESTURE_SAMPLING_INTERVAL_MS 5

View File

@@ -6,6 +6,7 @@
/* X86 chipset power control module for Chrome EC */
#include "battery.h"
#include "charge_state.h"
#include "chipset.h"
#include "common.h"
#include "console.h"
@@ -196,6 +197,13 @@ enum power_state power_handle_state(enum power_state state)
case POWER_S5:
while ((power_get_signals() & IN_PCH_SLP_S5_DEASSERTED) == 0) {
/* Return to G3 if battery level is too low */
if (charge_want_shutdown() ||
charge_prevent_power_on()) {
CPRINTS("power-up inhibited");
return POWER_S5G3;
}
if (task_wait_event(SECOND*4) == TASK_EVENT_TIMER) {
CPRINTS("timeout waiting for S5 exit");
/* Put system in G3 and assert RTCRST# */