summaryrefslogtreecommitdiff
path: root/board/grunt/board.c
diff options
context:
space:
mode:
authorEdward Hill <ecgh@chromium.org>2018-02-01 15:18:00 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-03-12 15:24:50 -0700
commit7aac7a43cc146049bea6ce871be53948650f81fa (patch)
tree82c12879cfacecf822eabc50a22839a188f2513e /board/grunt/board.c
parent99bcab486dff32c646abed906cf37dfe68a6ead7 (diff)
downloadchrome-ec-7aac7a43cc146049bea6ce871be53948650f81fa.tar.gz
grunt: Improve battery presence checks
Use CONFIG_BATTERY_HW_PRESENT_CUSTOM and CONFIG_BATTERY_PRESENT_CUSTOM to make Grunt closer to Coral and Eve. This gets auto-power-on-with-no-battery closer to working, because charge_prevent_power_on uses battery_hw_present for its factory override check: "Factory override: Always allow power on if WP is disabled, except when auto-power-on at EC startup and the battery is physically present." BUG=b:72645441 BRANCH=none TEST=cold reset Grunt with battery connected and disconnected Change-Id: I2b158bedcad7dffc340992dc020145a4c6e60802 Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/900048 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@google.com>
Diffstat (limited to 'board/grunt/board.c')
-rw-r--r--board/grunt/board.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/board/grunt/board.c b/board/grunt/board.c
index 597ff0fa10..1257a74a88 100644
--- a/board/grunt/board.c
+++ b/board/grunt/board.c
@@ -324,9 +324,17 @@ void board_reset_pd_mcu(void)
void board_tcpc_init(void)
{
+ int count = 0;
int port;
- /* TODO(ecgh): need to wait for disconnected battery? */
+ /* 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())