Files
OpenCellular/include/battery.h
Randall Spangler 6971fd7a7f After shutting down AP, hibernate EC if battery is low
This preserves more battery for the real-time clock.  It also gets rid
of one battery level/state, since the EC will now shut down at the
same level (2%) as the AP.

Having the EC hibernate at the same level as the AP shuts down also
prevents the following weird scenario:

- EC powers on at 2% battery.
- EC won't power on the AP to do software sync because battery is low.
- But the charge state machine won't actually hibernate the EC until 1%.
- Between 2% and 1%, AC is inserted and system starts charging.
- But EC-RO is what's doing the charging; we should go through software sync
  before charging.

BUG=chrome-os-partner:17124
BRANCH=link
TEST=manual

On battery power,
1) With system on, battfake 2 -> system shuts down and EC hibernates
2) With system off, battfake 2 -> EC hibernates

Change-Id: I87d17f70d60673f3e3f1c6eb88f3f00a8c9ed4e7
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44314
2013-03-05 10:26:21 -08:00

34 lines
1021 B
C

/* Copyright (c) 2013 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 charging parameters and constraints
*/
#ifndef __CROS_EC_BATTERY_H
#define __CROS_EC_BATTERY_H
/* Stop charge when charging and battery level >= this percentage */
#define BATTERY_LEVEL_FULL 100
/* Tell host we're charged when battery level >= this percentage */
#define BATTERY_LEVEL_NEAR_FULL 97
/* Precharge only when charging and battery level < this level */
#define BATTERY_LEVEL_PRE_CHARGE 25
/*
* Send battery-low host event when discharging and battery level <= this level
*/
#define BATTERY_LEVEL_LOW 10
/*
* Send battery-critical host event when discharging and battery level <= this
* level.
*/
#define BATTERY_LEVEL_CRITICAL 5
/*
* Shut down main processor and/or hibernate EC when discharging and battery
* level < this level.
*/
#define BATTERY_LEVEL_SHUTDOWN 3
#endif /* __CROS_EC_BATTERY_H */