mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-07 16:11:43 +00:00
Tell the host the battery is no longer charging when it hits 97%, and set the power adapter LED to green. This solves several problems: 1) The last 3% of charge takes a looong time. Kernel/ACPI/UI already have a hack to show the battery as charged when it's about 3% from full, but the EC still showed a yellow LED. 2) If the system is charged and you briefly unplug the adapter, the LED turned yellow for a long time as it slowly trickle-charged. Now it goes right to green. 3) A fully-charged battery will drop below 100% charge as it settles, but won't accept more current at that time. This caused the LED to turn yellow and stay there until the battery finally settled down to ~96%, at which point it'd accept more current and top itself off. The whole time it did this, the kernel/ACPI/UI hack from (1) would keep reporting "battery full". Now the LED stays green too. BUG=chrome-os-partner:11248 BRANCH=link TEST=manual - Discharge system to <95% full. - Plug adapter in. LED should come on yellow. - At around 97% full, the LED should turn green. - Around that the UI will display "battery full". (Note that due to rounding, the UI may take a few minutes to display "battery full" after the LED goes green; that's ok) - Unplug and replug adapter. LED should come on green. UI still reports "battery full". Change-Id: Ie56fbf3a05239e73d2c765bb98d36aa5cfedc2ef Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/34452
32 lines
981 B
C
32 lines
981 B
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
|
|
#define BATTERY_LEVEL_SHUTDOWN 3
|
|
|
|
/* 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 */
|
|
|