From 1aa13eb648994f2124f8b680a227fe57dd691cf4 Mon Sep 17 00:00:00 2001 From: Alec Berg Date: Mon, 25 Aug 2014 14:05:08 -0700 Subject: [PATCH] samus: allow booting without a battery When there is no battery, add a delay in power sequencing to allow time for PD MCU to negotiate to 20V. This is a temporary solution to allow booting without a battery for a factory. BUG=chrome-os-partner:31583 BRANCH=none TEST=Boot without a battery 10 times successfully. Also looked at timestamps on console. PD MCU tends to successfully negotiate before 370ms. With this added delay, the EC will come out of S5 at around 660ms. Change-Id: I88dcb10b2cfef2cdb3e943c24d567ba5b741d729 Signed-off-by: Alec Berg Reviewed-on: https://chromium-review.googlesource.com/214038 Reviewed-by: Duncan Laurie --- board/samus/power_sequence.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/board/samus/power_sequence.c b/board/samus/power_sequence.c index 95c017dbf3..b0c649f1d7 100644 --- a/board/samus/power_sequence.c +++ b/board/samus/power_sequence.c @@ -5,6 +5,7 @@ /* X86 chipset power control module for Chrome EC */ +#include "battery.h" #include "chipset.h" #include "common.h" #include "console.h" @@ -184,6 +185,8 @@ DECLARE_HOOK(HOOK_LID_CHANGE, update_touchscreen, HOOK_PRIO_DEFAULT); enum power_state power_handle_state(enum power_state state) { + struct batt_params batt; + switch (state) { case POWER_G3: break; @@ -310,6 +313,17 @@ enum power_state power_handle_state(enum power_state state) return POWER_S5; case POWER_S5S3: + /* + * TODO(crosbug.com/p/31583): Temporary hack to allow booting + * without battery. If battery is not present here, then delay + * to give time for PD MCU to negotiate to 20V. + */ + battery_get_params(&batt); + if (batt.is_present != BP_YES && !system_is_locked()) { + CPRINTS("Attempting boot w/o battery, adding delay"); + msleep(500); + } + /* Turn on power to RAM */ gpio_set_level(GPIO_PP1800_EN, 1); gpio_set_level(GPIO_PP1200_EN, 1);