mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-09 17:11:42 +00:00
Test charging error state when battery is detached
This checks charge state machine goes into error state when battery is not responding. BUG=chrome-os-partner:19236 TEST=Pass sbs_charging test BRANCH=None Change-Id: I61970c4d88cbb0d6242613cdc87b88da7ae3f2f4 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/170753 Reviewed-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
committed by
chrome-internal-fetch
parent
4de56d4a7f
commit
1b1bf3f03f
@@ -18,6 +18,7 @@
|
||||
#include "util.h"
|
||||
|
||||
#define WAIT_CHARGER_TASK 500
|
||||
#define BATTERY_DETACH_DELAY 35000
|
||||
|
||||
static int mock_ac_present = 1;
|
||||
static int mock_chipset_state = CHIPSET_STATE_ON;
|
||||
@@ -104,6 +105,20 @@ static int test_charge_state(void)
|
||||
state = wait_charging_state();
|
||||
TEST_ASSERT(state == PWR_STATE_CHARGE);
|
||||
|
||||
/* Detach battery, charging error */
|
||||
ccprintf("[CHARGING TEST] Detach battery\n");
|
||||
TEST_ASSERT(test_detach_i2c(I2C_PORT_BATTERY, BATTERY_ADDR) ==
|
||||
EC_SUCCESS);
|
||||
msleep(BATTERY_DETACH_DELAY);
|
||||
state = wait_charging_state();
|
||||
TEST_ASSERT(state == PWR_STATE_ERROR);
|
||||
|
||||
/* Attach battery again, charging */
|
||||
ccprintf("[CHARGING TEST] Attach battery\n");
|
||||
test_attach_i2c(I2C_PORT_HOST, BATTERY_ADDR);
|
||||
state = wait_charging_state();
|
||||
TEST_ASSERT(state == PWR_STATE_CHARGE);
|
||||
|
||||
/* Unplug AC, discharging at 1000mAh */
|
||||
ccprintf("[CHARGING TEST] AC off\n");
|
||||
mock_ac_present = 0;
|
||||
|
||||
Reference in New Issue
Block a user