summaryrefslogtreecommitdiff
path: root/test/charge_ramp.c
diff options
context:
space:
mode:
authorTing Shen <phoenixshen@google.com>2020-05-06 18:06:52 +0800
committerCommit Bot <commit-bot@chromium.org>2020-05-29 05:11:24 +0000
commit8975cbb645f1f07c3682334d02510a8a1d3f730b (patch)
tree1c65f1c460b25e785181b15c2d78b303b4cfacfc /test/charge_ramp.c
parentfad8f404df3e1b2278326c08247a62edce434f32 (diff)
downloadchrome-ec-8975cbb645f1f07c3682334d02510a8a1d3f730b.tar.gz
bc12: create bc12 driver structure
To support linking multiple bc12 drivers into ec binary, we have to remove the common symbols in drivers. This CL creates a bc12_drv structure to hold the original driver-specific usb_charger_* functions, and implements common usb_charger_* functions which whill dispatch the function call based on the information in bc12_drv table. Also add a CONFIG_BC12_SINGLE_DRIVER and enabled by default for backward compatibility. If CONFIG_BC12_SINGLE_DRIVER is defined, a default bc12_drv array with proper size and content will be created for the board. BUG=b:155611686 TEST=1) make buildall. 2) verify single driver mode on krane (rt946x) and juniper (pi3usb9201). 3) verify multiple driver works on asurada, see CL:2189624 for example usage. 4) verify single driver multi chip on blooglet. BRANCH=none Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: I8a96eda47c94aeb6cc150b498cfa1a6eefcc4a5b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2187080 Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
Diffstat (limited to 'test/charge_ramp.c')
-rw-r--r--test/charge_ramp.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/test/charge_ramp.c b/test/charge_ramp.c
index f6f8bd542e..faec9c8888 100644
--- a/test/charge_ramp.c
+++ b/test/charge_ramp.c
@@ -14,6 +14,7 @@
#include "task.h"
#include "test_util.h"
#include "timer.h"
+#include "usb_charge.h"
#include "util.h"
#define TASK_EVENT_OVERCURRENT (1 << 0)
@@ -37,13 +38,13 @@ static int charge_limit_ma;
/* Mock functions */
/* Override test_mockable implementations in charge_ramp module */
-int chg_ramp_allowed(int supplier)
+int chg_ramp_allowed(int port, int supplier)
{
/* Ramp for TEST4-TEST8 */
return supplier > CHARGE_SUPPLIER_TEST3;
}
-int chg_ramp_max(int supplier, int sup_curr)
+int chg_ramp_max(int port, int supplier, int sup_curr)
{
if (supplier == CHARGE_SUPPLIER_TEST7)
return 1600;
@@ -53,16 +54,8 @@ int chg_ramp_max(int supplier, int sup_curr)
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;
-}
+/* Dummy bc12_ports[] array to make linker happy */
+struct bc12_config bc12_ports[0];
int charge_is_consuming_full_input_current(void)
{