mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-05 22:41:44 +00:00
skylake: Inhibit AP power-on until charge current limit is set
Inhibit AP power-on through the BATLOW pin, even if the system is unprotected, until our charger and current limit are initialized. Note that this feature is only functional on glados v2 since other skylake boards do not have BATLOW connected. BUG=chrome-os-partner:41258 TEST=Manual on glados v1 with rework. Remove battery and attach Zinger. Verify EC powers on and AP doesn't boot. Run `powerbtn`, verify that AP boots. Remove all power and attach battery, verify that EC powers on and AP boots. Also verify compilation on glados v2. BRANCH=None Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I55de857f7006777640f7853b7bde98ba97e8bd13 Reviewed-on: https://chromium-review.googlesource.com/287378
This commit is contained in:
committed by
ChromeOS Commit Bot
parent
e58a913bcc
commit
0085573ff4
@@ -30,6 +30,7 @@
|
||||
#define CONFIG_CHARGER_ISL9237
|
||||
#define CONFIG_CHARGER_ILIM_PIN_DISABLED
|
||||
#define CONFIG_CHARGER_INPUT_CURRENT 512
|
||||
#define CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON 1
|
||||
#define CONFIG_CHARGER_PROFILE_OVERRIDE
|
||||
#define CONFIG_CHARGER_SENSE_RESISTOR 10
|
||||
#define CONFIG_CHARGER_SENSE_RESISTOR_AC 20
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
/* Skylake IMVP8 / ROP PMIC chipset power control module for Chrome EC */
|
||||
|
||||
#include "charge_state.h"
|
||||
#include "chipset.h"
|
||||
#include "common.h"
|
||||
#include "console.h"
|
||||
@@ -38,6 +39,9 @@
|
||||
|
||||
#define IN_ALL_S0 (IN_PGOOD_ALL_CORE | IN_ALL_PM_SLP_DEASSERTED)
|
||||
|
||||
#define CHARGER_INITIALIZED_DELAY_MS 100
|
||||
#define CHARGER_INITIALIZED_TRIES 10
|
||||
|
||||
static int throttle_cpu; /* Throttle CPU? */
|
||||
static int forcing_shutdown; /* Forced shutdown in progress? */
|
||||
|
||||
@@ -128,6 +132,9 @@ enum power_state power_handle_state(enum power_state state)
|
||||
*/
|
||||
int rsmrst_in = gpio_get_level(GPIO_RSMRST_L_PGOOD);
|
||||
int rsmrst_out = gpio_get_level(GPIO_PCH_RSMRST_L);
|
||||
#ifdef GLADOS_BOARD_V2
|
||||
int tries = 0;
|
||||
#endif
|
||||
|
||||
if (rsmrst_in != rsmrst_out) {
|
||||
/*
|
||||
@@ -187,6 +194,23 @@ enum power_state power_handle_state(enum power_state state)
|
||||
}
|
||||
|
||||
#ifdef GLADOS_BOARD_V2
|
||||
/*
|
||||
* Allow up to 1s for charger to be initialized, in case
|
||||
* we're trying to boot the AP with no battery.
|
||||
*/
|
||||
while (charge_prevent_power_on() &&
|
||||
tries++ < CHARGER_INITIALIZED_TRIES) {
|
||||
msleep(CHARGER_INITIALIZED_DELAY_MS);
|
||||
}
|
||||
|
||||
/* Return to G3 if battery level is too low */
|
||||
if (charge_want_shutdown() ||
|
||||
tries == CHARGER_INITIALIZED_TRIES) {
|
||||
CPRINTS("power-up inhibited");
|
||||
chipset_force_shutdown();
|
||||
return POWER_G3;
|
||||
}
|
||||
|
||||
/* Allow AP to power on */
|
||||
gpio_set_level(GPIO_PMIC_SLP_SUS_L, 1);
|
||||
gpio_set_level(GPIO_PCH_BATLOW_L, 1);
|
||||
|
||||
Reference in New Issue
Block a user