summaryrefslogtreecommitdiff
path: root/test/sbs_charging_v2.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/sbs_charging_v2.c')
-rw-r--r--test/sbs_charging_v2.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/test/sbs_charging_v2.c b/test/sbs_charging_v2.c
index 095405b3bb..31dfb34e25 100644
--- a/test/sbs_charging_v2.c
+++ b/test/sbs_charging_v2.c
@@ -105,6 +105,14 @@ static int wait_charging_state(void)
return state;
}
+static int charge_control(enum ec_charge_control_mode mode)
+{
+ struct ec_params_charge_control params;
+ params.mode = mode;
+ return test_send_host_command(EC_CMD_CHARGE_CONTROL, 1, &params,
+ sizeof(params), NULL, 0);
+}
+
/* Setup init condition */
static void test_setup(int on_ac)
{
@@ -134,18 +142,13 @@ static void test_setup(int on_ac)
gpio_set_level(GPIO_AC_PRESENT, 0);
}
+ /* Reset the charger state to initial state */
+ charge_control(CHARGE_CONTROL_NORMAL);
+
/* Let things stabilize */
wait_charging_state();
}
-static int charge_control(enum ec_charge_control_mode mode)
-{
- struct ec_params_charge_control params;
- params.mode = mode;
- return test_send_host_command(EC_CMD_CHARGE_CONTROL, 1, &params,
- sizeof(params), NULL, 0);
-}
-
/* Host Event helpers */
static int ev_is_set(int event)
{