summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIkjoon Jang <ikjn@chromium.org>2020-06-17 13:56:48 +0800
committerCommit Bot <commit-bot@chromium.org>2020-06-19 10:33:44 +0000
commit4df277da323b87bebb27209971670e6862d6f435 (patch)
tree6d6fa0dc76decb34530d754d4e81e48447dd51af
parent46b89211e0480f7acf8d1cb832aac2e20827a48e (diff)
downloadchrome-ec-4df277da323b87bebb27209971670e6862d6f435.tar.gz
baseboard/kukui: Do not consider FET states in battery presence check
When Juniper is powered up with fully drained LGC battery, its FET states indicates battery is disconnected even it's still i2c responsive. In MT8183 platform, !battery_is_presence() isn't blocking power on, this function does not need to return BP_NO when battery is i2c responsive but DFET state is off. This patch fixes the problem of sbs-battery probe fail from host side when a device is powered up from external power source with fully drained battery reporting DFET state is off. BUG=b:153710351 TEST=none BRANCH=none Signed-off-by: Ikjoon Jang <ikjn@chromium.org> Change-Id: I67b750b7586fcad149c65e88e73dcbd872ca76bc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2247972 Reviewed-by: Ting Shen <phoenixshen@chromium.org>
-rw-r--r--baseboard/kukui/battery_smart.c12
-rw-r--r--baseboard/kukui/battery_smart.h20
-rw-r--r--board/jacuzzi/battery.c49
3 files changed, 3 insertions, 78 deletions
diff --git a/baseboard/kukui/battery_smart.c b/baseboard/kukui/battery_smart.c
index 3cd8facd5e..ba2af17443 100644
--- a/baseboard/kukui/battery_smart.c
+++ b/baseboard/kukui/battery_smart.c
@@ -16,7 +16,7 @@ enum battery_present batt_pres_prev = BP_NOT_SURE;
/*
* Physical detection of battery.
*/
-__overridable enum battery_present battery_check_present_status(void)
+static enum battery_present battery_check_present_status(void)
{
enum battery_present batt_pres = BP_NOT_SURE;
@@ -49,14 +49,8 @@ __overridable enum battery_present battery_check_present_status(void)
if (battery_get_disconnect_state() == BATTERY_DISCONNECT_ERROR)
return BP_NOT_SURE;
- /*
- * Ensure that battery is:
- * 1. Not in cutoff
- * 2. Not disconnected
- * 3. Initialized
- */
- if (battery_is_cut_off() != BATTERY_CUTOFF_STATE_NORMAL ||
- battery_get_disconnect_state() != BATTERY_NOT_DISCONNECTED)
+ /* Ensure the battery is not in cutoff state */
+ if (battery_is_cut_off() != BATTERY_CUTOFF_STATE_NORMAL)
return BP_NO;
return batt_pres;
diff --git a/baseboard/kukui/battery_smart.h b/baseboard/kukui/battery_smart.h
deleted file mode 100644
index 2171bfb95d..0000000000
--- a/baseboard/kukui/battery_smart.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright 2019 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
- */
-
-#ifndef __CROS_EC_BATTERY_SMART_H
-#define __CROS_EC_BATTERY_SMART_H
-
-#include "battery.h"
-
-/*
- * Physical detection of battery.
- */
-__override_proto enum battery_present battery_check_present_status(void);
-
-extern enum battery_present batt_pres_prev;
-
-#endif /* __CROS_EC_BATTERY_SMART_H */
diff --git a/board/jacuzzi/battery.c b/board/jacuzzi/battery.c
index 4f8ae97451..7fd56ea7a3 100644
--- a/board/jacuzzi/battery.c
+++ b/board/jacuzzi/battery.c
@@ -3,7 +3,6 @@
* found in the LICENSE file.
*/
-#include "baseboard/kukui/battery_smart.h"
#include "battery.h"
#include "battery_fuel_gauge.h"
#include "gpio.h"
@@ -100,51 +99,3 @@ enum battery_present battery_hw_present(void)
{
return gpio_get_level(GPIO_EC_BATT_PRES_ODL) ? BP_NO : BP_YES;
}
-
-/*
- * Physical detection of battery.
- */
-__override enum battery_present battery_check_present_status(void)
-{
- enum battery_present batt_pres = BP_NOT_SURE;
-
-#ifdef CONFIG_BATTERY_HW_PRESENT_CUSTOM
- /* Get the physical hardware status */
- batt_pres = battery_hw_present();
-#endif
-
- /*
- * If the battery is not physically connected, then no need to perform
- * any more checks.
- */
- if (batt_pres == BP_NO)
- 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;
-
- /*
- * Check battery disconnect status. If we are unable to read battery
- * disconnect status or DFET is off, then return BP_NOT_SURE. Battery
- * could be in ship mode and might require pre-charge current to wake
- * it up. BP_NO is not returned here because charger state machine
- * will not provide pre-charge current assuming that battery is not
- * present.
- */
- if (battery_get_disconnect_state() != BATTERY_NOT_DISCONNECTED)
- return BP_NOT_SURE;
-
- /*
- * Ensure that battery is:
- * 1. Not in cutoff
- */
- if (battery_is_cut_off() != BATTERY_CUTOFF_STATE_NORMAL)
- return BP_NO;
-
- return batt_pres;
-}
-