summaryrefslogtreecommitdiff
path: root/board/careena
diff options
context:
space:
mode:
authorEdward Hill <ecgh@chromium.org>2018-06-18 15:43:14 -0600
committerchrome-bot <chrome-bot@chromium.org>2018-06-20 14:23:54 -0700
commit725b337a61b6250f72f392e7a6df330b7c7bcae6 (patch)
treec35a8d91b8e7adf2162bfec5a3462f8a55c1f7d5 /board/careena
parentc8323ec1ad9852bcf775934933c117214dd3f5d7 (diff)
downloadchrome-ec-725b337a61b6250f72f392e7a6df330b7c7bcae6.tar.gz
careena: Fix power-on with cut-off battery
Remove CONFIG_BATTERY_HW_PRESENT_CUSTOM, CONFIG_BATTERY_PRESENT_CUSTOM, and associated code in battery.c, and delay in board_tcpc_init. Add CONFIG_BATTERY_PRESENT_GPIO. This allows CONFIG_BATTERY_REVIVE_DISCONNECT to work correctly to revive a cut-off battery, using battery_get_disconnect_state(). Before this change, the call to battery_get_disconnect_state() in the main loop of charge_state_v2's charger_task would not be reached with cut-off battery, due to the earlier: "if (curr.batt.is_present == BP_NO) goto wait_for_it;" With this change, curr.batt.is_present changes to BP_YES based on the simple test of GPIO_EC_BATT_PRES_L. This allows charger_task to "try to wake battery", then call battery_get_disconnect_state() and "found battery in disconnect state". This succeeds in getting the battery out of the disconnect state. The delay in board_tcpc_init() is removed because TCPC init doesn't disturb the AC power supply. If it did, powering on with AC only (no battery) would fail. BUG=b:109894491 BRANCH=none TEST=these combinations on grunt and careena: grunt, unplug AC, cutoff battery, on AC plug: pass (AP boots) grunt, unplug AC, normal battery, on EC reboot: pass (AP boots) grunt, unplug AC, unplug battery, on AC plug: pass (AP boots) grunt, unplug AC, discharge battery to cutoff, on AC plug: pass (AP boots) careena, unplug AC, cutoff battery, on AC plug: pass (AP boots) careena, unplug AC, normal battery, on EC reboot: pass (AP boots) careena, unplug AC, unplug battery, on AC plug: pass (AP boots) careena, unplug AC, discharge battery to cutoff, on AC plug: pass (AP boots) Change-Id: Ieceaa51535b9fcabc8b42681472689bfa9d0e498 Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1105338 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Diffstat (limited to 'board/careena')
-rw-r--r--board/careena/board.c10
1 files changed, 0 insertions, 10 deletions
diff --git a/board/careena/board.c b/board/careena/board.c
index 18ef2f8e5f..79ad52c827 100644
--- a/board/careena/board.c
+++ b/board/careena/board.c
@@ -141,18 +141,8 @@ void board_overcurrent_event(int port)
void board_tcpc_init(void)
{
- int count = 0;
int port;
- /* Wait for disconnected battery to wake up */
- while (battery_hw_present() == BP_YES &&
- battery_is_present() == BP_NO) {
- usleep(100 * MSEC);
- /* Give up waiting after 1 second */
- if (++count > 10)
- break;
- }
-
/* Only reset TCPC if not sysjump */
if (!system_jumped_to_this_image())
board_reset_pd_mcu();