diff options
author | Diana Z <dzigterman@chromium.org> | 2021-01-28 16:21:30 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-01-29 23:23:46 +0000 |
commit | c1b5095aa8404709bb447bd7a58f262d7d471a01 (patch) | |
tree | 28e98a5e557da139d1bbcf095d7f469ab0d3f431 | |
parent | e5febf9ec926bb00d00f2e81558617604eb2b455 (diff) | |
download | chrome-ec-c1b5095aa8404709bb447bd7a58f262d7d471a01.tar.gz |
Dedede: Add RAA489000 output current setting
Boards using the RAA489000 TCPC should set output current on their ports
through the TCPC driver. This commit adds a board function to do this
for every dedede board currently using the RAA489000.
BRANCH=None
BUG=b:178064507
TEST=on madoo, verify OCP occurs if more than 1.5A is drawn on a non-PD
port, verify register is set to allow 3.0A for port partners requesting
that current in their sink capabilities
Signed-off-by: Diana Z <dzigterman@chromium.org>
Change-Id: Ieb7df916c122d5de1adaa7371a58ad5cf2954ee4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2658377
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r-- | board/boten/board.c | 8 | ||||
-rw-r--r-- | board/galtic/board.c | 8 | ||||
-rw-r--r-- | board/madoo/board.c | 8 | ||||
-rw-r--r-- | board/magolor/board.c | 8 | ||||
-rw-r--r-- | board/metaknight/board.c | 8 | ||||
-rw-r--r-- | board/sasuke/board.c | 8 | ||||
-rw-r--r-- | board/waddledoo/board.c | 8 |
7 files changed, 50 insertions, 6 deletions
diff --git a/board/boten/board.c b/board/boten/board.c index 8ff385687e..6679b4bd7d 100644 --- a/board/boten/board.c +++ b/board/boten/board.c @@ -256,6 +256,14 @@ void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma, charge_set_input_current_limit(icl, charge_mv); } +__override void typec_set_source_current_limit(int port, enum tcpc_rp_value rp) +{ + if (port < 0 || port > board_get_usb_pd_port_count()) + return; + + raa489000_set_output_current(port, rp); +} + int board_is_sourcing_vbus(int port) { int regval; diff --git a/board/galtic/board.c b/board/galtic/board.c index 0a26811b73..01c2932f4c 100644 --- a/board/galtic/board.c +++ b/board/galtic/board.c @@ -476,14 +476,10 @@ __override void ocpc_get_pid_constants(int *kp, int *kp_div, __override void typec_set_source_current_limit(int port, enum tcpc_rp_value rp) { - int current; - - if (port < 0 || port > CONFIG_USB_PD_PORT_MAX_COUNT) + if (port < 0 || port > board_get_usb_pd_port_count()) return; - current = (rp == TYPEC_RP_3A0) ? 3000 : 1500; - - charger_set_otg_current_voltage(port, current, 5000); + raa489000_set_output_current(port, rp); } /* PWM channels. Must be in the exactly same order as in enum pwm_channel. */ diff --git a/board/madoo/board.c b/board/madoo/board.c index 7c81d18ba8..9ecdd3f407 100644 --- a/board/madoo/board.c +++ b/board/madoo/board.c @@ -327,6 +327,14 @@ void board_set_charge_limit(int port, int supplier, int charge_ma, charge_set_input_current_limit(icl, charge_mv); } +__override void typec_set_source_current_limit(int port, enum tcpc_rp_value rp) +{ + if (port < 0 || port > board_get_usb_pd_port_count()) + return; + + raa489000_set_output_current(port, rp); +} + /* Sensors */ static struct mutex g_lid_mutex; static struct mutex g_base_mutex; diff --git a/board/magolor/board.c b/board/magolor/board.c index 393e0af8c4..196cd1239c 100644 --- a/board/magolor/board.c +++ b/board/magolor/board.c @@ -439,6 +439,14 @@ void board_set_charge_limit(int port, int supplier, int charge_ma, charge_set_input_current_limit(icl, charge_mv); } +__override void typec_set_source_current_limit(int port, enum tcpc_rp_value rp) +{ + if (port < 0 || port > board_get_usb_pd_port_count()) + return; + + raa489000_set_output_current(port, rp); +} + /* Sensors */ static struct mutex g_lid_mutex; static struct mutex g_base_mutex; diff --git a/board/metaknight/board.c b/board/metaknight/board.c index 5453777c6a..6d8a49bd8d 100644 --- a/board/metaknight/board.c +++ b/board/metaknight/board.c @@ -423,6 +423,14 @@ void board_set_charge_limit(int port, int supplier, int charge_ma, charge_set_input_current_limit(icl, charge_mv); } +__override void typec_set_source_current_limit(int port, enum tcpc_rp_value rp) +{ + if (port < 0 || port > board_get_usb_pd_port_count()) + return; + + raa489000_set_output_current(port, rp); +} + /* Sensors */ static struct mutex g_lid_mutex; static struct mutex g_base_mutex; diff --git a/board/sasuke/board.c b/board/sasuke/board.c index 229cf74665..5ee60ddc27 100644 --- a/board/sasuke/board.c +++ b/board/sasuke/board.c @@ -380,6 +380,14 @@ void board_set_charge_limit(int port, int supplier, int charge_ma, charge_set_input_current_limit(icl, charge_mv); } +__override void typec_set_source_current_limit(int port, enum tcpc_rp_value rp) +{ + if (port < 0 || port > board_get_usb_pd_port_count()) + return; + + raa489000_set_output_current(port, rp); +} + __override void ocpc_get_pid_constants(int *kp, int *kp_div, int *ki, int *ki_div, int *kd, int *kd_div) diff --git a/board/waddledoo/board.c b/board/waddledoo/board.c index 0bdcb2b684..cdfe78a379 100644 --- a/board/waddledoo/board.c +++ b/board/waddledoo/board.c @@ -404,6 +404,14 @@ void board_set_charge_limit(int port, int supplier, int charge_ma, charge_set_input_current_limit(icl, charge_mv); } +__override void typec_set_source_current_limit(int port, enum tcpc_rp_value rp) +{ + if (port < 0 || port > board_get_usb_pd_port_count()) + return; + + raa489000_set_output_current(port, rp); +} + /* Sensors */ static struct mutex g_lid_mutex; static struct mutex g_base_mutex; |