Files
OpenCellular/include/battery.h
Randall Spangler fcd0f0a5e4 link: Hibernate EC when battery level drops below 2%
We already shut down the main processor below 3%.  Hibernating the EC
below 2% will further cut power draw and minimize the risk of
deep-discharging the battery.

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

1) discharge battery below 3%; system should shut down.  when powered
on again it should shut back down within ~10 sec.

2) discharge battery below 2%; when system shuts down it should also hibernate.

(I've also tested this with a hacked smart_battery.c which lies about
the battery state of charge, since that's faster than waiting for my
battery to discharge.)

Change-Id: I504ba927012430db5cf10b895a36e6cd6fdf4c8b
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/34793
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-10-05 15:21:18 -07:00

35 lines
1.1 KiB
C

/* Copyright (c) 2012 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
/* Design capacities, percentage */
#define BATTERY_LEVEL_WARNING 15
#define BATTERY_LEVEL_LOW 10
#define BATTERY_LEVEL_CRITICAL 5
/* Shut down main processor when battery level reaches this level */
#define BATTERY_LEVEL_SHUTDOWN 3
/* Hibernate EC immediately when battery level reaches this level */
#define BATTERY_LEVEL_HIBERNATE_EC 2
/* Stop charge when state of charge reaches this percentage */
#define STOP_CHARGE_THRESHOLD 100
/* Tell host we're charged at this percentage */
#define NEAR_FULL_THRESHOLD 97
/* Precharge only when state of charge is below this level */
#define PRE_CHARGE_THRESHOLD 25
/* Define the lightbar color thresholds, percentage */
#define LIGHTBAR_POWER_THRESHOLD_FULL 99
#define LIGHTBAR_POWER_THRESHOLD_HIGH 40
#define LIGHTBAR_POWER_THRESHOLD_MEDIUM 25
/* LOW is anything below MEDIUM */
#endif /* __CROS_EC_BATTERY_H */