summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorEdward Hill <ecgh@chromium.org>2018-06-12 14:55:14 -0600
committerchrome-bot <chrome-bot@chromium.org>2018-06-14 05:38:34 -0700
commitb4f69d8a0cf5c4bc55880befe7cd995b1ddd2926 (patch)
treec09f25cd7935819fad2c0ed970af399a218a562f /common
parent2b0918db5c3c4181410bc97e98a27db20fd622d9 (diff)
downloadchrome-ec-b4f69d8a0cf5c4bc55880befe7cd995b1ddd2926.tar.gz
battery: Move presence checks out of common
Undo some of CL:1072637 so that battery_is_present() and battery_hw_present() move back to baseboard. battery_fuel_gauge.c now only includes code which is directly involved with the fuel gauge. BUG=b:109894491,b:80299100 BRANCH=none TEST=make -j buildall Change-Id: I8fc5be3856564601019d94514dcfc8ffb3071c2e Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1097954 Commit-Ready: Devin Lu <Devin.Lu@quantatw.com> Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/battery_fuel_gauge.c62
1 files changed, 0 insertions, 62 deletions
diff --git a/common/battery_fuel_gauge.c b/common/battery_fuel_gauge.c
index c14b9de4cb..204b562401 100644
--- a/common/battery_fuel_gauge.c
+++ b/common/battery_fuel_gauge.c
@@ -7,18 +7,13 @@
#include "battery_fuel_gauge.h"
#include "battery_smart.h"
-#include "charge_state.h"
-#include "common.h"
#include "console.h"
-#include "gpio.h"
#include "hooks.h"
#include "util.h"
#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
-static enum battery_present batt_pres_prev = BP_NOT_SURE;
-
/* Get type of the battery connected on the board */
static int get_battery_type(void)
{
@@ -118,20 +113,6 @@ int board_cut_off_battery(void)
return rv ? EC_RES_ERROR : EC_RES_SUCCESS;
}
-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);
-}
-
/*
* This function checks the charge/discharge FET status bits. Each battery type
* supported provides the register address, mask, and disconnect value for these
@@ -181,46 +162,3 @@ enum battery_disconnect_state battery_get_disconnect_state(void)
return BATTERY_NOT_DISCONNECTED;
}
-
-/*
- * 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;
-}