diff options
author | Vijay Hiremath <vijay.p.hiremath@intel.com> | 2018-06-20 14:07:41 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-07-03 18:18:22 -0700 |
commit | 9b3ab01f0f09cf010bad4838735606f378a98eb4 (patch) | |
tree | ce99e1ecbe7ff15a983ba5f39bdb4e412b94ced5 /baseboard | |
parent | 9431a997aaa195e81d3e1a96ef484dcbcfa9803f (diff) | |
download | chrome-ec-9b3ab01f0f09cf010bad4838735606f378a98eb4.tar.gz |
octopus: Fix booting to OS from shipmode
If the battery is booting from shipmode, it cannot provide power
hence check for the battery revive state and do not disable charge
ports instead assume the power source port as dedicated charge port
and remain in charge manager safe mode till the battery is
initialized and able to provide power.
1. Remove custom battery hardware present logic:
In case of booting from battery shipmode, though battery is
physically present it cannot provide power hence we need to prevent
auto-power on till the negotiated power is >=
CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON hence removed the custom
h/w present logic
2. Remove custom battery present logic
As we are using battery revive logic to remain in charge manager
safe mode till the battery is initialized, enabled logic to use the
physical battery GPIO for battery detection and removed the custom
battery present logic.
BUG=b:80299100, b:74427009, b:110438520
BRANCH=none
TEST=Manually tested on BIP
1. Battery can revive from shipmode
2. DUT can boot to S0 when no battery connected and from
shipmode battery, without pressing the power button
3. Deeply discharged battery is recovered and DUT booted
to OS without pressing the power button
Change-Id: I75378d5d70d07cea13ec775188ce17cb8fe9d9ae
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/1109443
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'baseboard')
-rw-r--r-- | baseboard/octopus/baseboard.c | 22 | ||||
-rw-r--r-- | baseboard/octopus/baseboard.h | 4 | ||||
-rw-r--r-- | baseboard/octopus/battery.c | 69 | ||||
-rw-r--r-- | baseboard/octopus/build.mk | 3 |
4 files changed, 2 insertions, 96 deletions
diff --git a/baseboard/octopus/baseboard.c b/baseboard/octopus/baseboard.c index 81488f56bb..e8f1adb6b9 100644 --- a/baseboard/octopus/baseboard.c +++ b/baseboard/octopus/baseboard.c @@ -182,32 +182,10 @@ void chipset_do_shutdown(void) /******************************************************************************/ /* Power Delivery and charing functions */ -static void wait_for_battery(void) -{ - int count = 0; - - /* If battery is not present, don't bother waiting */ - if (battery_hw_present() == BP_NO) - return; - - /* Wait for disconnected battery to wake up */ - while (battery_get_disconnect_state() != BATTERY_NOT_DISCONNECTED) { - usleep(100 * MSEC); - /* Give up waiting after more than 1 second */ - if (++count > 10) { - ccprintf("Battery still disconnected > 1 second!\n"); - break; - } - } -} - void baseboard_tcpc_init(void) { int port; - /* Wait for battery to wake up (if present) */ - wait_for_battery(); - /* Only reset TCPC if not sysjump */ if (!system_jumped_to_this_image()) board_reset_pd_mcu(); diff --git a/baseboard/octopus/baseboard.h b/baseboard/octopus/baseboard.h index e6e288c35a..ecb21a097e 100644 --- a/baseboard/octopus/baseboard.h +++ b/baseboard/octopus/baseboard.h @@ -126,9 +126,7 @@ #define CONFIG_BATTERY_CUT_OFF #define CONFIG_BATTERY_DEVICE_CHEMISTRY "LION" #define CONFIG_BATTERY_FUEL_GAUGE -/* TODO(b/74427009): Ensure this works in dead battery conditions */ -#define CONFIG_BATTERY_HW_PRESENT_CUSTOM -#define CONFIG_BATTERY_PRESENT_CUSTOM +#define CONFIG_BATTERY_PRESENT_GPIO GPIO_EC_BATT_PRES_L #define CONFIG_BATTERY_REVIVE_DISCONNECT #define CONFIG_BATTERY_SMART diff --git a/baseboard/octopus/battery.c b/baseboard/octopus/battery.c deleted file mode 100644 index 835132366b..0000000000 --- a/baseboard/octopus/battery.c +++ /dev/null @@ -1,69 +0,0 @@ -/* Copyright 2018 The Chromium OS Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - * - * Battery pack vendor provided charging profile - */ - -#include "battery.h" -#include "battery_smart.h" -#include "gpio.h" - -static enum battery_present batt_pres_prev = BP_NOT_SURE; - -enum battery_present battery_hw_present(void) -{ - /* The GPIO is low when the battery is physically present */ - return gpio_get_level(GPIO_EC_BATT_PRES_L) ? BP_NO : BP_YES; -} - -static int battery_init(void) -{ - int batt_status; - - return battery_status(&batt_status) ? 0 : - !!(batt_status & STATUS_INITIALIZED); -} - -/* - * Physical detection of battery. - */ -static enum battery_present battery_check_present_status(void) -{ - enum battery_present batt_pres; - - /* Get the physical hardware status */ - batt_pres = battery_hw_present(); - - /* - * If the battery is not physically connected, then no need to perform - * any more checks. - */ - if (batt_pres != BP_YES) - return batt_pres; - - /* - * If the battery is present now and was present last time we checked, - * return early. - */ - if (batt_pres == batt_pres_prev) - return batt_pres; - - /* - * Ensure that battery is: - * 1. Not in cutoff - * 2. Initialized - */ - if (battery_is_cut_off() != BATTERY_CUTOFF_STATE_NORMAL || - battery_init() == 0) { - batt_pres = BP_NO; - } - - return batt_pres; -} - -enum battery_present battery_is_present(void) -{ - batt_pres_prev = battery_check_present_status(); - return batt_pres_prev; -} diff --git a/baseboard/octopus/build.mk b/baseboard/octopus/build.mk index bbe8af8e1f..ccce76a0a6 100644 --- a/baseboard/octopus/build.mk +++ b/baseboard/octopus/build.mk @@ -8,10 +8,9 @@ baseboard-y=baseboard.o baseboard-$(CONFIG_LED_COMMON)+=led_states.o -baseboard-$(CONFIG_BATTERY_SMART)+=battery.o baseboard-$(CONFIG_USB_POWER_DELIVERY)+=usb_pd_policy.o baseboard-$(VARIANT_OCTOPUS_EC_NPCX796FB)+=variant_ec_npcx796fb.o baseboard-$(VARIANT_OCTOPUS_EC_ITE8320)+=variant_ec_ite8320.o baseboard-$(VARIANT_OCTOPUS_USBC_STANDALONE_TCPCS)+= \ variant_usbc_standalone_tcpcs.o -baseboard-$(VARIANT_OCTOPUS_USBC_ITE_EC_TCPCS)+=variant_usbc_ec_tcpcs.o
\ No newline at end of file +baseboard-$(VARIANT_OCTOPUS_USBC_ITE_EC_TCPCS)+=variant_usbc_ec_tcpcs.o |