diff options
author | Shawn Nematbakhsh <shawnn@chromium.org> | 2017-10-05 09:50:08 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-10-06 13:47:12 -0700 |
commit | b87fe062eca43fc00909098e716581bf2aeea7eb (patch) | |
tree | 890225b40bf562456984424adc1f243fb06ae7eb /test | |
parent | 02045eb040227250689caec9b9401c2cd3861363 (diff) | |
download | chrome-ec-b87fe062eca43fc00909098e716581bf2aeea7eb.tar.gz |
charge_ramp: Move ramp allowed / ilim callbacks to common code
The decision on whether to ramp (and how high) depends on the quirks of
charger identification, so move the decision out of board, into the
drivers that implement usb_charger.
Also, rename CONFIG_CHARGE_RAMP to CONFIG_CHARGE_RAMP_SW, to better
contrast with the existing CONFIG_CHARGE_RAMP_HW.
BUG=None
TEST=Manual on kevin, verify ramp occurs when port plugged into Z840
workstation.
BRANCH=None
Change-Id: I5b395274133837a18a4f4ac34b59b623287be175
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/702681
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/charge_ramp.c | 34 | ||||
-rw-r--r-- | test/test_config.h | 2 |
2 files changed, 24 insertions, 12 deletions
diff --git a/test/charge_ramp.c b/test/charge_ramp.c index 4c5c01b64c..e3dce7a860 100644 --- a/test/charge_ramp.c +++ b/test/charge_ramp.c @@ -36,12 +36,34 @@ static int charge_limit_ma; /* Mock functions */ -int board_is_ramp_allowed(int supplier) +/* Override test_mockable implementations in charge_ramp module */ +int chg_ramp_allowed(int supplier) { /* Ramp for TEST4-TEST8 */ return supplier > CHARGE_SUPPLIER_TEST3; } +int chg_ramp_max(int supplier, int sup_curr) +{ + if (supplier == CHARGE_SUPPLIER_TEST7) + return 1600; + else if (supplier == CHARGE_SUPPLIER_TEST8) + return 2400; + else + return 3000; +} + +/* These usb_charger functions are unused, but necessary to link */ +int usb_charger_ramp_allowed(int supplier) +{ + return 0; +} + +int usb_charger_ramp_max(int supplier, int sup_curr) +{ + return 0; +} + int board_is_consuming_full_charge(void) { return charge_limit_ma <= system_load_current_ma; @@ -61,16 +83,6 @@ void board_set_charge_limit(int port, int supplier, int limit_ma, task_set_event(TASK_ID_TEST_RUNNER, TASK_EVENT_OVERCURRENT, 0); } -int board_get_ramp_current_limit(int supplier, int sup_curr) -{ - if (supplier == CHARGE_SUPPLIER_TEST7) - return 1600; - else if (supplier == CHARGE_SUPPLIER_TEST8) - return 2400; - else - return 3000; -} - /* Test utilities */ static void plug_charger_with_ts(int supplier_type, int port, int min_current, diff --git a/test/test_config.h b/test/test_config.h index 6ed975eb18..20cca9806d 100644 --- a/test/test_config.h +++ b/test/test_config.h @@ -195,7 +195,7 @@ int ncp15wb_calculate_temp(uint16_t adc); #endif #ifdef TEST_CHARGE_RAMP -#define CONFIG_CHARGE_RAMP +#define CONFIG_CHARGE_RAMP_SW #define CONFIG_USB_PD_PORT_COUNT 2 #endif |