diff options
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 |