From e5e8f84d412dc97d9e33b12fef61b6657627f772 Mon Sep 17 00:00:00 2001 From: Vijay Hiremath Date: Mon, 31 Aug 2015 17:45:52 -0700 Subject: Kunimitsu: Enable support for limiting the inrush current Enable the support for limiting the inrush current by routing the PCH_SLP_SUS through EC gpio PMIC_SLP_SUS which allows the DUT to boot on charger without the battery / dead battery. This is applicable to Kunimitsu FAB4 only. Enabling the Glados patch for Kunimitsu FAB4. Change-Id: I55de857f7006777640f7853b7bde98ba97e8bd13 Reviewed-on: https://chromium-review.googlesource.com/287378 BUG=chrome-os-partner:44706 TEST=FAB4 prototype boots to UI without battery / dead battery. BRANCH=none Change-Id: Ie81cdf3c59fc02d6d59dd06ca321705ca06e7b88 Signed-off-by: Vijay Hiremath Reviewed-on: https://chromium-review.googlesource.com/296521 Commit-Ready: Vijay P Hiremath Tested-by: Vijay P Hiremath Reviewed-by: Vijay P Hiremath Reviewed-by: Shawn N --- board/kunimitsu/board.c | 2 +- board/kunimitsu/board.h | 18 +++++++++++++----- board/kunimitsu/gpio.inc | 6 +++++- power/skylake.c | 8 ++++---- 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/board/kunimitsu/board.c b/board/kunimitsu/board.c index f14686a114..5b825445ef 100644 --- a/board/kunimitsu/board.c +++ b/board/kunimitsu/board.c @@ -419,7 +419,7 @@ static void board_chipset_startup(void) { gpio_set_level(GPIO_ENABLE_TOUCHPAD, 1); } -DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_chipset_startup, +DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_chipset_startup, HOOK_PRIO_DEFAULT); /* Disable touchpad on chipset shutdown as it is no longer useful */ diff --git a/board/kunimitsu/board.h b/board/kunimitsu/board.h index 6ea8be6379..3310030cd9 100644 --- a/board/kunimitsu/board.h +++ b/board/kunimitsu/board.h @@ -8,24 +8,32 @@ #ifndef __CROS_EC_BOARD_H #define __CROS_EC_BOARD_H +/* + * TODO (crosbug.com/p/44704): Remove support for V3 when V4 is available. + */ +#define BOARD_KUNIMITSU_V3 + /* Optional features */ #define CONFIG_ADC #define CONFIG_BATTERY_CUT_OFF #define CONFIG_BATTERY_PRESENT_GPIO GPIO_BAT_PRESENT_L #define CONFIG_BATTERY_SMART +#define CONFIG_BOARD_VERSION #define CONFIG_BUTTON_COUNT 2 #define CONFIG_CHARGE_MANAGER -#define CONFIG_BOARD_VERSION - #define CONFIG_CHARGER #define CONFIG_CHARGER_V2 + +#define CONFIG_CHARGER_DISCHARGE_ON_AC #define CONFIG_CHARGER_ISL9237 #define CONFIG_CHARGER_ILIM_PIN_DISABLED +#define CONFIG_CHARGER_INPUT_CURRENT 512 +#ifndef KUNIMITSU_BOARD_V3 +#define CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON 1 +#endif #define CONFIG_CHARGER_SENSE_RESISTOR 10 #define CONFIG_CHARGER_SENSE_RESISTOR_AC 20 -#define CONFIG_CHARGER_INPUT_CURRENT 512 -#define CONFIG_CHARGER_DISCHARGE_ON_AC #define CONFIG_CHIPSET_SKYLAKE #define CONFIG_CLOCK_CRYSTAL @@ -44,6 +52,7 @@ #define CONFIG_POWER_BUTTON_X86 #define CONFIG_POWER_COMMON #define CONFIG_POWER_SHUTDOWN_PAUSE_IN_S5 +#define CONFIG_SCI_GPIO GPIO_PCH_SCI_L #define CONFIG_USB_CHARGER #define CONFIG_USB_MUX_PI3USB30532 #define CONFIG_USB_POWER_DELIVERY @@ -59,7 +68,6 @@ #define CONFIG_USBC_SS_MUX #define CONFIG_USBC_SS_MUX_DFP_ONLY #define CONFIG_USBC_VCONN -#define CONFIG_SCI_GPIO GPIO_PCH_SCI_L #define CONFIG_VBOOT_HASH #define CONFIG_SPI_FLASH_PORT 1 diff --git a/board/kunimitsu/gpio.inc b/board/kunimitsu/gpio.inc index 643b335b16..d60b06b6b7 100644 --- a/board/kunimitsu/gpio.inc +++ b/board/kunimitsu/gpio.inc @@ -42,7 +42,11 @@ GPIO(I2C3_SCL, PIN(24), GPIO_INPUT) GPIO(I2C3_SDA, PIN(25), GPIO_INPUT) GPIO(PCH_SCI_L, PIN(26), GPIO_ODR_HIGH) +#ifndef BOARD_KUNIMITSU_V3 +GPIO(PMIC_SLP_SUS_L, PIN(34), GPIO_OUT_LOW) +#else GPIO(NC_034, PIN(34), GPIO_INPUT | GPIO_PULL_UP) +#endif GPIO(USB1_ENABLE, PIN(36), GPIO_OUT_HIGH) GPIO(USB2_ENABLE, PIN(67), GPIO_OUT_HIGH) GPIO(ENTERING_RW, PIN(41), GPIO_OUT_LOW) @@ -51,7 +55,7 @@ GPIO(PCH_PWRBTN_L, PIN(45), GPIO_OUT_HIGH) GPIO(USB_C0_DP_HPD, PIN(46), GPIO_OUT_LOW) GPIO(USB_C1_DP_HPD, PIN(51), GPIO_OUT_LOW) GPIO(CPU_PROCHOT, PIN(52), GPIO_OUT_LOW) -GPIO(ENABLE_TOUCHPAD, PIN(53), GPIO_OUT_HIGH) +GPIO(ENABLE_TOUCHPAD, PIN(53), GPIO_OUT_LOW) GPIO(BAT_PRESENT_L, PIN(56), GPIO_INPUT) GPIO(USB_PD_WAKE, PIN(60), GPIO_OUT_LOW) /* When asserted, ME does not lock security descriptor */ diff --git a/power/skylake.c b/power/skylake.c index 76f14ea49b..6ef1e85cfc 100644 --- a/power/skylake.c +++ b/power/skylake.c @@ -69,7 +69,7 @@ static void chipset_force_g3(void) * Kunimitsu doesn't yet have pass-thru SLP_SUS_L. * TODO(crosbug.com/p/43075): Remove this when new boards roll out. */ -#ifndef BOARD_KUNIMITSU +#ifndef BOARD_KUNIMITSU_V3 gpio_set_level(GPIO_PMIC_SLP_SUS_L, 0); #endif } @@ -129,7 +129,7 @@ enum power_state power_chipset_init(void) static enum power_state _power_handle_state(enum power_state state) { -#ifndef BOARD_KUNIMITSU +#ifndef BOARD_KUNIMITSU_V3 int tries = 0; #endif @@ -174,7 +174,7 @@ static enum power_state _power_handle_state(enum power_state state) /* Call hooks to initialize PMIC */ hook_notify(HOOK_CHIPSET_PRE_INIT); -#ifndef BOARD_KUNIMITSU +#ifndef BOARD_KUNIMITSU_V3 /* * Allow up to 1s for charger to be initialized, in case * we're trying to boot the AP with no battery. @@ -316,7 +316,7 @@ static void handle_slp_sus(enum power_state state) return; /* Always mimic PCH SLP_SUS request for all other states. */ -#ifndef BOARD_KUNIMITSU +#ifndef BOARD_KUNIMITSU_V3 gpio_set_level(GPIO_PMIC_SLP_SUS_L, gpio_get_level(GPIO_PCH_SLP_SUS_L)); #endif } -- cgit v1.2.1