summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYB.Ha <ybha@samsung.com>2014-08-08 11:08:15 +0900
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-08-08 06:44:37 +0000
commitb264c41a01c0d4251bb2940d67bebe9a729360cf (patch)
tree44f2c43f1f93e397fbb13f52fa73986de59ab3a0
parentafbfe085796acf28807617b49659cee9a9d09ca2 (diff)
downloadchrome-ec-b264c41a01c0d4251bb2940d67bebe9a729360cf.tar.gz
Winky : Generate battery error if low voltage for more than 2 hours
Stop to charge and enter battery error state when system keeps low voltage for more than 2hours. Battery error state by this reason is cleared only once when battery was reconnected. BUG=chrome-os-partner:30951 TEST=emerge-winky chromeos-ec Check to stop and start charging by low voltage during 2hours. Change-Id: I0bf22c165d676b3d7637dd78c01db21b6d658874 Reviewed-on: https://chromium-review.googlesource.com/211124 Reviewed-by: Mohammed Habibulla <moch@chromium.org> Reviewed-by: yoojin lee <yoojin7.lee@samsung.com> Commit-Queue: yoojin lee <yoojin7.lee@samsung.com> Tested-by: yoojin lee <yoojin7.lee@samsung.com>
-rwxr-xr-xboard/winky/battery.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/board/winky/battery.c b/board/winky/battery.c
index 1b21e6ee28..8c662ca149 100755
--- a/board/winky/battery.c
+++ b/board/winky/battery.c
@@ -67,6 +67,7 @@ DECLARE_CONSOLE_COMMAND(battcutoff, command_battcutoff,
NULL);
#ifdef CONFIG_BATTERY_OVERRIDE_PARAMS
+static timestamp_t start_lowvoltage_time;
static int oem_battery_state;
#define OEM_BATTERY_STATE_DEFAULT 0x00
#define OEM_BATTERY_STATE_ERROR 0x01
@@ -104,7 +105,15 @@ void battery_override_params(struct batt_params *batt)
/* Check battery overvoltage */
if(batt->voltage > info.voltage_max) {
oem_battery_state |= OEM_BATTERY_STATE_ERROR;
+ } else if(batt->voltage < info.voltage_min) {
+ if((get_time().val - start_lowvoltage_time.val) > 2*HOUR) {
+ oem_battery_state |= OEM_BATTERY_STATE_ERROR;
+ }
+ } else {
+ start_lowvoltage_time = get_time();
}
+ } else if((chstate == PWR_STATE_IDLE) || (chstate == PWR_STATE_IDLE0)) {
+ start_lowvoltage_time = get_time();
}
}