summaryrefslogtreecommitdiff
path: root/test/charge_ramp.c
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2015-06-08 13:58:47 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-06-10 19:48:08 +0000
commite05ed041cfe60db7d1bff5424d4579a52aea402f (patch)
tree1fd7a6e78c42682b1f9eb331c12084a4b44c3b56 /test/charge_ramp.c
parent5d7c4f0cd6b7b020e70c9f9ec5f60a8457b90f12 (diff)
downloadchrome-ec-e05ed041cfe60db7d1bff5424d4579a52aea402f.tar.gz
charger: Move USB charger / BC1.2 task to common code
Move the task responsible for detection of USB chargers to common code to reduce code duplication. BUG=chrome-os-partner:40920 TEST=Manual on samus_pd. Plug USB charger, verify detection is correct on both charge ports. BRANCH=None Change-Id: I362f8b5b51741509e459c66928131f1f6d2a3b1d Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/276210 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'test/charge_ramp.c')
-rw-r--r--test/charge_ramp.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/test/charge_ramp.c b/test/charge_ramp.c
index 406888533b..ecb72bf142 100644
--- a/test/charge_ramp.c
+++ b/test/charge_ramp.c
@@ -38,7 +38,7 @@ static int charge_limit_ma;
int board_is_ramp_allowed(int supplier)
{
- /* Ramp for TEST4-TEST9 */
+ /* Ramp for TEST4-TEST8 */
return supplier > CHARGE_SUPPLIER_TEST3;
}
@@ -62,7 +62,7 @@ void board_set_charge_limit(int limit_ma)
int board_get_ramp_current_limit(int supplier, int sup_curr)
{
- if (supplier == CHARGE_SUPPLIER_TEST9)
+ if (supplier == CHARGE_SUPPLIER_TEST7)
return 1600;
else if (supplier == CHARGE_SUPPLIER_TEST8)
return 2400;
@@ -70,6 +70,10 @@ int board_get_ramp_current_limit(int supplier, int sup_curr)
return 3000;
}
+void pd_send_host_event(int mask)
+{
+}
+
/* Test utilities */
static void plug_charger_with_ts(int supplier_type, int port, int min_current,
@@ -191,7 +195,7 @@ static int test_switch_outlet(void)
system_load_current_ma = 3000;
/* Here's a nice powerful charger */
- plug_charger(CHARGE_SUPPLIER_TEST7, 0, 500, 3000, 3000);
+ plug_charger(CHARGE_SUPPLIER_TEST6, 0, 500, 3000, 3000);
/*
* Now the user decides to move it to a nearby outlet...actually
@@ -201,7 +205,7 @@ static int test_switch_outlet(void)
usleep(SECOND * 20);
unplug_charger();
usleep(SECOND * 1.5);
- plug_charger(CHARGE_SUPPLIER_TEST7, 0, 500, 3000, 3000);
+ plug_charger(CHARGE_SUPPLIER_TEST6, 0, 500, 3000, 3000);
usleep(CHARGE_DETECT_DELAY_TEST);
/* Ramp restarts at 500 mA */
TEST_ASSERT(is_in_range(charge_limit_ma, 500, 700));
@@ -399,7 +403,7 @@ static int test_vbus_shift(void)
* At first, the charger is able to supply up to 1900 mA before
* the VBUS voltage starts to drop.
*/
- plug_charger(CHARGE_SUPPLIER_TEST7, 0, 500, 1900, 2000);
+ plug_charger(CHARGE_SUPPLIER_TEST6, 0, 500, 1900, 2000);
TEST_ASSERT(wait_stable_no_overcurrent());
TEST_ASSERT(is_in_range(charge_limit_ma, 1700, 1900));
@@ -456,7 +460,7 @@ static int test_ramp_limit(void)
system_load_current_ma = 3000;
/* Plug in supplier that is limited to 1.6A */
- plug_charger(CHARGE_SUPPLIER_TEST9, 0, 500, 3000, 3000);
+ plug_charger(CHARGE_SUPPLIER_TEST7, 0, 500, 3000, 3000);
usleep(SECOND);
TEST_ASSERT(is_in_range(charge_limit_ma, 500, 700));
TEST_ASSERT(wait_stable_no_overcurrent());
@@ -470,7 +474,7 @@ static int test_ramp_limit(void)
TEST_ASSERT(charge_limit_ma == 2400);
/* Go back to 1.6A limited, but VBUS goes low before that point */
- plug_charger(CHARGE_SUPPLIER_TEST9, 0, 500, 1200, 1300);
+ plug_charger(CHARGE_SUPPLIER_TEST7, 0, 500, 1200, 1300);
usleep(SECOND);
TEST_ASSERT(is_in_range(charge_limit_ma, 500, 700));
TEST_ASSERT(wait_stable_no_overcurrent());