summaryrefslogtreecommitdiff
path: root/baseboard
diff options
context:
space:
mode:
authorScott Collyer <scollyer@google.com>2018-10-01 15:59:45 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-10-10 21:33:30 -0700
commita8d4272aa96bee7914ce93503a3b4f0385e328a3 (patch)
treea75e0ea9988d17cd4d2da42b6a688e4acf37b22f /baseboard
parent17d6c69b7be2aabe4188792a2d11d1b0bb4ddc4b (diff)
downloadchrome-ec-a8d4272aa96bee7914ce93503a3b4f0385e328a3.tar.gz
DragonEgg: Rely on BATT_PRES_ODL for battery_hw_present
P0 boards required a FW workaround for the battery present signal as it always read high. Starting with P1, this issue has been fixed in HW. This CL relies on the board id to determine which method to use for determing battery presence. BUG=b:117120739 BRANCH=none TEST=Tested on P0, verified that battery charging still works. Change-Id: I28eeca9f27244c6cac54ce032caf7c1073a110c2 Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-on: https://chromium-review.googlesource.com/1256183 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Diffstat (limited to 'baseboard')
-rw-r--r--baseboard/dragonegg/battery.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/baseboard/dragonegg/battery.c b/baseboard/dragonegg/battery.c
index 088bd27f6c..0c4ec32903 100644
--- a/baseboard/dragonegg/battery.c
+++ b/baseboard/dragonegg/battery.c
@@ -9,11 +9,13 @@
#include "battery_fuel_gauge.h"
#include "battery_smart.h"
#include "gpio.h"
+#include "system.h"
static enum battery_present batt_pres_prev = BP_NOT_SURE;
enum battery_present battery_hw_present(void)
{
+ enum battery_present bp;
/* The GPIO is low when the battery is physically present */
/*
* TODO(b/111704193): The signal GPIO_EC_BATT_PRES_ODL has an issue
@@ -26,10 +28,16 @@ enum battery_present battery_hw_present(void)
* presence pin.
*
*/
- /* return gpio_get_level(GPIO_EC_BATT_PRES_ODL) ? BP_NO : BP_YES; */
- return (battery_get_disconnect_state() == BATTERY_DISCONNECT_ERROR) ?
- BP_NO : BP_YES;
+ if (system_get_board_version() == 0)
+ /* P0 boards can't use gpio signal */
+ bp = (battery_get_disconnect_state() ==
+ BATTERY_DISCONNECT_ERROR) ? BP_NO : BP_YES;
+ else
+ /* P1 boards can read presence from gpio signal */
+ bp = gpio_get_level(GPIO_EC_BATT_PRES_ODL) ? BP_NO : BP_YES;
+
+ return bp;
}
static int battery_init(void)