diff options
author | Alec Berg <alecaberg@chromium.org> | 2015-05-11 17:31:16 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-05-27 02:39:41 +0000 |
commit | 5b5f737d8f6f1be15d4ab5f42f290d20576307c4 (patch) | |
tree | be384973f533436d9a53c46b742be35f5b377a4f /test/charge_manager.c | |
parent | 25ce43fc3d35669500d74e44f3b7c96302ee2ade (diff) | |
download | chrome-ec-5b5f737d8f6f1be15d4ab5f42f290d20576307c4.tar.gz |
pd: move non-phy layer config out of usb_pd_config.h
Move parts of usb_pd_config.h that are not part of the phy layer
out of usb_pd_config.h and into board.h. This cleans up the
division between the TCPC and TCPM as only the TCPC needs to
use usb_pd_config.h.
Also cleans up the use of the CC detection voltage thresholds
by creating standard macros to use based on Rp strength for the
board.
BUG=none
BRANCH=none
TEST=make -j buildall
Change-Id: I946cceb38bea8233095b8a4b287102bb8a3a296d
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/270337
Reviewed-by: Todd Broch <tbroch@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'test/charge_manager.c')
-rw-r--r-- | test/charge_manager.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/test/charge_manager.c b/test/charge_manager.c index d504d9daf5..a2a366750c 100644 --- a/test/charge_manager.c +++ b/test/charge_manager.c @@ -11,7 +11,6 @@ #include "test_util.h" #include "timer.h" #include "usb_pd.h" -#include "usb_pd_config.h" #include "util.h" #define CHARGE_MANAGER_SLEEP_MS 50 @@ -33,8 +32,8 @@ BUILD_ASSERT(ARRAY_SIZE(supplier_priority) == CHARGE_SUPPLIER_COUNT); static unsigned int active_charge_limit = CHARGE_SUPPLIER_NONE; static unsigned int active_charge_port = CHARGE_PORT_NONE; static unsigned int charge_port_to_reject = CHARGE_PORT_NONE; -static int new_power_request[PD_PORT_COUNT]; -static int power_role[PD_PORT_COUNT]; +static int new_power_request[CONFIG_USB_PD_PORT_COUNT]; +static int power_role[CONFIG_USB_PD_PORT_COUNT]; /* Callback functions called by CM on state change */ void board_set_charge_limit(int charge_ma) @@ -70,7 +69,7 @@ void pd_set_new_power_request(int port) static void clear_new_power_requests(void) { int i; - for (i = 0; i < PD_PORT_COUNT; ++i) + for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; ++i) new_power_request[i] = 0; } @@ -107,7 +106,7 @@ static void initialize_charge_table(int current, int voltage, int ceil) charge.current = current; charge.voltage = voltage; - for (i = 0; i < PD_PORT_COUNT; ++i) { + for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; ++i) { charge_manager_set_ceil(i, ceil); charge_manager_update_dualrole(i, CAP_DEDICATED); pd_set_role(i, PD_ROLE_SINK); @@ -132,12 +131,12 @@ static int test_initialization(void) /* Initialize all supplier/port pairs, except for the last one */ for (i = 0; i < CHARGE_SUPPLIER_COUNT; ++i) - for (j = 0; j < PD_PORT_COUNT; ++j) { + for (j = 0; j < CONFIG_USB_PD_PORT_COUNT; ++j) { if (i == 0) charge_manager_update_dualrole(j, CAP_DEDICATED); if (i == CHARGE_SUPPLIER_COUNT - 1 && - j == PD_PORT_COUNT - 1) + j == CONFIG_USB_PD_PORT_COUNT - 1) break; charge_manager_update_charge(i, j, &charge); } @@ -148,7 +147,7 @@ static int test_initialization(void) /* Update last pair and verify a charge port has been selected */ charge_manager_update_charge(CHARGE_SUPPLIER_COUNT-1, - PD_PORT_COUNT-1, + CONFIG_USB_PD_PORT_COUNT-1, &charge); wait_for_charge_manager_refresh(); TEST_ASSERT(active_charge_port != CHARGE_PORT_NONE); |