diff options
author | Shawn Nematbakhsh <shawnn@chromium.org> | 2017-10-05 08:15:12 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-10-05 21:24:46 -0700 |
commit | 286b800f14b139ca5d349d35142d7f31f3655689 (patch) | |
tree | 1dad9a731db2ede5712aea0aac164120a9d6fe00 | |
parent | 1e72cc1f5719d5c5df6dbe76a8c86f60a525fe1a (diff) | |
download | chrome-ec-286b800f14b139ca5d349d35142d7f31f3655689.tar.gz |
pd: Move *_set_input_current() to common code
Boards that use charge_manager have identical implementations of
typec_set_input_current_limit() and pd_set_input_current_limit(), so
move these functions to charge_manager.
BUG=b:67413505
TEST=`make buildall -j`, also verify that fizz continues to power-on and
boot AP, in both protected and unprotected mode, with barrel jack power
and with zinger.
BRANCH=None
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I99a5314d02c4696db944c0f8ac689405f4f1f707
Reviewed-on: https://chromium-review.googlesource.com/701412
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r-- | board/chell/usb_pd_policy.c | 24 | ||||
-rw-r--r-- | board/coral/usb_pd_policy.c | 24 | ||||
-rw-r--r-- | board/elm/usb_pd_policy.c | 20 | ||||
-rw-r--r-- | board/eve/usb_pd_policy.c | 24 | ||||
-rw-r--r-- | board/fizz/usb_pd_policy.c | 30 | ||||
-rw-r--r-- | board/glados/usb_pd_policy.c | 22 | ||||
-rw-r--r-- | board/glkrvp/usb_pd_policy.c | 24 | ||||
-rw-r--r-- | board/it83xx_evb/usb_pd_policy.c | 10 | ||||
-rw-r--r-- | board/kahlee/usb_pd_policy.c | 24 | ||||
-rw-r--r-- | board/kevin/usb_pd_policy.c | 24 | ||||
-rw-r--r-- | board/nefario/usb_pd_policy.c | 24 | ||||
-rw-r--r-- | board/oak/usb_pd_policy.c | 35 | ||||
-rw-r--r-- | board/poppy/usb_pd_policy.c | 24 | ||||
-rw-r--r-- | board/reef/usb_pd_policy.c | 24 | ||||
-rw-r--r-- | board/reef_it8320/usb_pd_policy.c | 24 | ||||
-rw-r--r-- | board/rowan/usb_pd_policy.c | 20 | ||||
-rw-r--r-- | board/samus_pd/usb_pd_policy.c | 18 | ||||
-rw-r--r-- | board/scarlet/usb_pd_policy.c | 24 | ||||
-rw-r--r-- | board/strago/usb_pd_policy.c | 22 | ||||
-rw-r--r-- | board/wheatley/usb_pd_policy.c | 22 | ||||
-rw-r--r-- | board/zoombini/usb_pd_policy.c | 20 | ||||
-rw-r--r-- | common/charge_manager.c | 20 |
22 files changed, 20 insertions, 483 deletions
diff --git a/board/chell/usb_pd_policy.c b/board/chell/usb_pd_policy.c index 9c2218dd5a..276f97f800 100644 --- a/board/chell/usb_pd_policy.c +++ b/board/chell/usb_pd_policy.c @@ -72,30 +72,6 @@ void pd_power_supply_reset(int port) pd_send_host_event(PD_EVENT_POWER_CHANGE); } -void pd_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ -#ifdef CONFIG_CHARGE_MANAGER - struct charge_port_info charge; - - charge.current = max_ma; - charge.voltage = supply_voltage; - charge_manager_update_charge(CHARGE_SUPPLIER_PD, port, &charge); -#endif -} - -void typec_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ -#ifdef CONFIG_CHARGE_MANAGER - struct charge_port_info charge; - - charge.current = max_ma; - charge.voltage = supply_voltage; - charge_manager_update_charge(CHARGE_SUPPLIER_TYPEC, port, &charge); -#endif -} - int pd_snk_is_vbus_provided(int port) { return !gpio_get_level(port ? GPIO_USB_C1_VBUS_WAKE_L : diff --git a/board/coral/usb_pd_policy.c b/board/coral/usb_pd_policy.c index 8aacbd0190..b6c3f07328 100644 --- a/board/coral/usb_pd_policy.c +++ b/board/coral/usb_pd_policy.c @@ -129,30 +129,6 @@ void pd_power_supply_reset(int port) pd_send_host_event(PD_EVENT_POWER_CHANGE); } -void pd_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ -#ifdef CONFIG_CHARGE_MANAGER - struct charge_port_info charge; - - charge.current = max_ma; - charge.voltage = supply_voltage; - charge_manager_update_charge(CHARGE_SUPPLIER_PD, port, &charge); -#endif -} - -void typec_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ -#ifdef CONFIG_CHARGE_MANAGER - struct charge_port_info charge; - - charge.current = max_ma; - charge.voltage = supply_voltage; - charge_manager_update_charge(CHARGE_SUPPLIER_TYPEC, port, &charge); -#endif -} - int pd_board_checks(void) { return EC_SUCCESS; diff --git a/board/elm/usb_pd_policy.c b/board/elm/usb_pd_policy.c index b03d52e71e..2da68d7484 100644 --- a/board/elm/usb_pd_policy.c +++ b/board/elm/usb_pd_policy.c @@ -76,26 +76,6 @@ void pd_power_supply_reset(int port) pd_send_host_event(PD_EVENT_POWER_CHANGE); } -void pd_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ - struct charge_port_info charge; - - charge.current = max_ma; - charge.voltage = supply_voltage; - charge_manager_update_charge(CHARGE_SUPPLIER_PD, port, &charge); -} - -void typec_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ - struct charge_port_info charge; - - charge.current = max_ma; - charge.voltage = supply_voltage; - charge_manager_update_charge(CHARGE_SUPPLIER_TYPEC, port, &charge); -} - int pd_board_checks(void) { return EC_SUCCESS; diff --git a/board/eve/usb_pd_policy.c b/board/eve/usb_pd_policy.c index b6cdeb4b5a..62664d95ae 100644 --- a/board/eve/usb_pd_policy.c +++ b/board/eve/usb_pd_policy.c @@ -149,30 +149,6 @@ void pd_power_supply_reset(int port) pd_send_host_event(PD_EVENT_POWER_CHANGE); } -void pd_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ -#ifdef CONFIG_CHARGE_MANAGER - struct charge_port_info charge; - - charge.current = max_ma; - charge.voltage = supply_voltage; - charge_manager_update_charge(CHARGE_SUPPLIER_PD, port, &charge); -#endif -} - -void typec_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ -#ifdef CONFIG_CHARGE_MANAGER - struct charge_port_info charge; - - charge.current = max_ma; - charge.voltage = supply_voltage; - charge_manager_update_charge(CHARGE_SUPPLIER_TYPEC, port, &charge); -#endif -} - int pd_board_checks(void) { return EC_SUCCESS; diff --git a/board/fizz/usb_pd_policy.c b/board/fizz/usb_pd_policy.c index 0213c22867..8ab7e03541 100644 --- a/board/fizz/usb_pd_policy.c +++ b/board/fizz/usb_pd_policy.c @@ -91,36 +91,6 @@ int pd_snk_is_vbus_provided(int port) return !gpio_get_level(GPIO_USB_C0_VBUS_WAKE_L); } -void pd_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ - struct charge_port_info charge; - - /* If the port is already supplying the power, don't reset it */ - if (charge_manager_get_active_charge_port() == CHARGE_PORT_TYPEC0 && - max_ma == 0 && supply_voltage == 0) - return; - - charge.current = max_ma; - charge.voltage = supply_voltage; - charge_manager_update_charge(CHARGE_SUPPLIER_PD, port, &charge); -} - -void typec_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ - struct charge_port_info charge; - - /* If the port is already supplying the power, don't reset it */ - if (charge_manager_get_active_charge_port() == CHARGE_PORT_TYPEC0 && - max_ma == 0 && supply_voltage == 0) - return; - - charge.current = max_ma; - charge.voltage = supply_voltage; - charge_manager_update_charge(CHARGE_SUPPLIER_TYPEC, port, &charge); -} - int pd_board_checks(void) { return EC_SUCCESS; diff --git a/board/glados/usb_pd_policy.c b/board/glados/usb_pd_policy.c index 59bf0d7545..d7b607f1de 100644 --- a/board/glados/usb_pd_policy.c +++ b/board/glados/usb_pd_policy.c @@ -72,28 +72,6 @@ void pd_power_supply_reset(int port) pd_send_host_event(PD_EVENT_POWER_CHANGE); } -void pd_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ -#ifdef CONFIG_CHARGE_MANAGER - struct charge_port_info charge; - charge.current = max_ma; - charge.voltage = supply_voltage; - charge_manager_update_charge(CHARGE_SUPPLIER_PD, port, &charge); -#endif -} - -void typec_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ -#ifdef CONFIG_CHARGE_MANAGER - struct charge_port_info charge; - charge.current = max_ma; - charge.voltage = supply_voltage; - charge_manager_update_charge(CHARGE_SUPPLIER_TYPEC, port, &charge); -#endif -} - int pd_snk_is_vbus_provided(int port) { return !gpio_get_level(port ? GPIO_USB_C1_VBUS_WAKE_L : diff --git a/board/glkrvp/usb_pd_policy.c b/board/glkrvp/usb_pd_policy.c index 8162495d33..a20171a455 100644 --- a/board/glkrvp/usb_pd_policy.c +++ b/board/glkrvp/usb_pd_policy.c @@ -68,30 +68,6 @@ void pd_power_supply_reset(int port) pd_send_host_event(PD_EVENT_POWER_CHANGE); } -void pd_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ -#ifdef CONFIG_CHARGE_MANAGER - struct charge_port_info charge; - - charge.current = max_ma; - charge.voltage = supply_voltage; - charge_manager_update_charge(CHARGE_SUPPLIER_PD, port, &charge); -#endif -} - -void typec_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ -#ifdef CONFIG_CHARGE_MANAGER - struct charge_port_info charge; - - charge.current = max_ma; - charge.voltage = supply_voltage; - charge_manager_update_charge(CHARGE_SUPPLIER_TYPEC, port, &charge); -#endif -} - int pd_board_checks(void) { return EC_SUCCESS; diff --git a/board/it83xx_evb/usb_pd_policy.c b/board/it83xx_evb/usb_pd_policy.c index b1c0fa3014..32060a587c 100644 --- a/board/it83xx_evb/usb_pd_policy.c +++ b/board/it83xx_evb/usb_pd_policy.c @@ -37,16 +37,6 @@ const uint32_t pd_snk_pdo[] = { }; const int pd_snk_pdo_cnt = ARRAY_SIZE(pd_snk_pdo); -void pd_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ -} - -void typec_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ -} - int pd_is_max_request_allowed(void) { /* max voltage request allowed */ diff --git a/board/kahlee/usb_pd_policy.c b/board/kahlee/usb_pd_policy.c index 4f21038159..64b32ed937 100644 --- a/board/kahlee/usb_pd_policy.c +++ b/board/kahlee/usb_pd_policy.c @@ -131,30 +131,6 @@ void pd_power_supply_reset(int port) pd_send_host_event(PD_EVENT_POWER_CHANGE); } -void pd_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ -#ifdef CONFIG_CHARGE_MANAGER - struct charge_port_info charge; - - charge.current = max_ma; - charge.voltage = supply_voltage; - charge_manager_update_charge(CHARGE_SUPPLIER_PD, port, &charge); -#endif -} - -void typec_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ -#ifdef CONFIG_CHARGE_MANAGER - struct charge_port_info charge; - - charge.current = max_ma; - charge.voltage = supply_voltage; - charge_manager_update_charge(CHARGE_SUPPLIER_TYPEC, port, &charge); -#endif -} - int pd_board_checks(void) { return EC_SUCCESS; diff --git a/board/kevin/usb_pd_policy.c b/board/kevin/usb_pd_policy.c index c72433dbb3..8e1c8da7a8 100644 --- a/board/kevin/usb_pd_policy.c +++ b/board/kevin/usb_pd_policy.c @@ -125,30 +125,6 @@ void pd_power_supply_reset(int port) pd_send_host_event(PD_EVENT_POWER_CHANGE); } -void pd_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ -#ifdef CONFIG_CHARGE_MANAGER - struct charge_port_info charge; - - charge.current = max_ma; - charge.voltage = supply_voltage; - charge_manager_update_charge(CHARGE_SUPPLIER_PD, port, &charge); -#endif -} - -void typec_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ -#ifdef CONFIG_CHARGE_MANAGER - struct charge_port_info charge; - - charge.current = max_ma; - charge.voltage = supply_voltage; - charge_manager_update_charge(CHARGE_SUPPLIER_TYPEC, port, &charge); -#endif -} - void typec_set_source_current_limit(int port, int rp) { vbus_rp[port] = rp; diff --git a/board/nefario/usb_pd_policy.c b/board/nefario/usb_pd_policy.c index 51a1adec4b..fa59088ac0 100644 --- a/board/nefario/usb_pd_policy.c +++ b/board/nefario/usb_pd_policy.c @@ -115,30 +115,6 @@ void pd_power_supply_reset(int port) pd_send_host_event(PD_EVENT_POWER_CHANGE); } -void pd_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ -#ifdef CONFIG_CHARGE_MANAGER - struct charge_port_info charge; - - charge.current = max_ma; - charge.voltage = supply_voltage; - charge_manager_update_charge(CHARGE_SUPPLIER_PD, port, &charge); -#endif -} - -void typec_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ -#ifdef CONFIG_CHARGE_MANAGER - struct charge_port_info charge; - - charge.current = max_ma; - charge.voltage = supply_voltage; - charge_manager_update_charge(CHARGE_SUPPLIER_TYPEC, port, &charge); -#endif -} - void typec_set_source_current_limit(int port, int rp) { vbus_rp[port] = rp; diff --git a/board/oak/usb_pd_policy.c b/board/oak/usb_pd_policy.c index 357afabd8f..d1932e9493 100644 --- a/board/oak/usb_pd_policy.c +++ b/board/oak/usb_pd_policy.c @@ -72,41 +72,6 @@ void pd_power_supply_reset(int port) pd_send_host_event(PD_EVENT_POWER_CHANGE); } -void pd_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ -#ifdef CONFIG_CHARGE_MANAGER - struct charge_port_info charge; - charge.current = max_ma; - charge.voltage = supply_voltage; - charge_manager_update_charge(CHARGE_SUPPLIER_PD, port, &charge); -#endif - /* - * move power info change notification to board_set_charge_limit(), - * board_set_charge_limit() will be executed in call stack of - * charge_manager_update_charge() if the "charge limit" or "charge port" - * or supplier if is changed. - */ -} - -void typec_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ -#ifdef CONFIG_CHARGE_MANAGER - struct charge_port_info charge; - charge.current = max_ma; - charge.voltage = supply_voltage; - charge_manager_update_charge(CHARGE_SUPPLIER_TYPEC, port, &charge); -#endif - /* - * move power info change notification to board_set_charge_limit(), - * board_set_charge_limit() will be executed in call stack of - * charge_manager_update_charge() if the "charge limit" or "charge port" - * or supplier if is changed. - */ -} - - int pd_board_checks(void) { #if BOARD_REV <= OAK_REV3 diff --git a/board/poppy/usb_pd_policy.c b/board/poppy/usb_pd_policy.c index cf4be4c61a..bb1920c6db 100644 --- a/board/poppy/usb_pd_policy.c +++ b/board/poppy/usb_pd_policy.c @@ -154,30 +154,6 @@ int pd_snk_is_vbus_provided(int port) GPIO_USB_C0_VBUS_WAKE_L); } -void pd_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ -#ifdef CONFIG_CHARGE_MANAGER - struct charge_port_info charge; - - charge.current = max_ma; - charge.voltage = supply_voltage; - charge_manager_update_charge(CHARGE_SUPPLIER_PD, port, &charge); -#endif -} - -void typec_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ -#ifdef CONFIG_CHARGE_MANAGER - struct charge_port_info charge; - - charge.current = max_ma; - charge.voltage = supply_voltage; - charge_manager_update_charge(CHARGE_SUPPLIER_TYPEC, port, &charge); -#endif -} - int pd_board_checks(void) { return EC_SUCCESS; diff --git a/board/reef/usb_pd_policy.c b/board/reef/usb_pd_policy.c index 8aacbd0190..b6c3f07328 100644 --- a/board/reef/usb_pd_policy.c +++ b/board/reef/usb_pd_policy.c @@ -129,30 +129,6 @@ void pd_power_supply_reset(int port) pd_send_host_event(PD_EVENT_POWER_CHANGE); } -void pd_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ -#ifdef CONFIG_CHARGE_MANAGER - struct charge_port_info charge; - - charge.current = max_ma; - charge.voltage = supply_voltage; - charge_manager_update_charge(CHARGE_SUPPLIER_PD, port, &charge); -#endif -} - -void typec_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ -#ifdef CONFIG_CHARGE_MANAGER - struct charge_port_info charge; - - charge.current = max_ma; - charge.voltage = supply_voltage; - charge_manager_update_charge(CHARGE_SUPPLIER_TYPEC, port, &charge); -#endif -} - int pd_board_checks(void) { return EC_SUCCESS; diff --git a/board/reef_it8320/usb_pd_policy.c b/board/reef_it8320/usb_pd_policy.c index 58028d7af3..48211441be 100644 --- a/board/reef_it8320/usb_pd_policy.c +++ b/board/reef_it8320/usb_pd_policy.c @@ -122,30 +122,6 @@ void pd_power_supply_reset(int port) pd_send_host_event(PD_EVENT_POWER_CHANGE); } -void pd_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ -#ifdef CONFIG_CHARGE_MANAGER - struct charge_port_info charge; - - charge.current = max_ma; - charge.voltage = supply_voltage; - charge_manager_update_charge(CHARGE_SUPPLIER_PD, port, &charge); -#endif -} - -void typec_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ -#ifdef CONFIG_CHARGE_MANAGER - struct charge_port_info charge; - - charge.current = max_ma; - charge.voltage = supply_voltage; - charge_manager_update_charge(CHARGE_SUPPLIER_TYPEC, port, &charge); -#endif -} - int pd_board_checks(void) { return EC_SUCCESS; diff --git a/board/rowan/usb_pd_policy.c b/board/rowan/usb_pd_policy.c index 81147ee936..db428b71d7 100644 --- a/board/rowan/usb_pd_policy.c +++ b/board/rowan/usb_pd_policy.c @@ -76,26 +76,6 @@ void pd_power_supply_reset(int port) pd_send_host_event(PD_EVENT_POWER_CHANGE); } -void pd_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ - struct charge_port_info charge; - - charge.current = max_ma; - charge.voltage = supply_voltage; - charge_manager_update_charge(CHARGE_SUPPLIER_PD, port, &charge); -} - -void typec_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ - struct charge_port_info charge; - - charge.current = max_ma; - charge.voltage = supply_voltage; - charge_manager_update_charge(CHARGE_SUPPLIER_TYPEC, port, &charge); -} - int pd_board_checks(void) { return EC_SUCCESS; diff --git a/board/samus_pd/usb_pd_policy.c b/board/samus_pd/usb_pd_policy.c index 875234a9fb..6c9147bef4 100644 --- a/board/samus_pd/usb_pd_policy.c +++ b/board/samus_pd/usb_pd_policy.c @@ -80,24 +80,6 @@ void pd_power_supply_reset(int port) pd_send_host_event(PD_EVENT_POWER_CHANGE); } -void pd_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ - struct charge_port_info charge; - charge.current = max_ma; - charge.voltage = supply_voltage; - charge_manager_update_charge(CHARGE_SUPPLIER_PD, port, &charge); -} - -void typec_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ - struct charge_port_info charge; - charge.current = max_ma; - charge.voltage = supply_voltage; - charge_manager_update_charge(CHARGE_SUPPLIER_TYPEC, port, &charge); -} - int pd_snk_is_vbus_provided(int port) { return gpio_get_level(port ? GPIO_USB_C1_VBUS_WAKE : diff --git a/board/scarlet/usb_pd_policy.c b/board/scarlet/usb_pd_policy.c index 95f365ff49..e256c915c1 100644 --- a/board/scarlet/usb_pd_policy.c +++ b/board/scarlet/usb_pd_policy.c @@ -99,30 +99,6 @@ void pd_power_supply_reset(int port) pd_send_host_event(PD_EVENT_POWER_CHANGE); } -void pd_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ -#ifdef CONFIG_CHARGE_MANAGER - struct charge_port_info charge; - - charge.current = max_ma; - charge.voltage = supply_voltage; - charge_manager_update_charge(CHARGE_SUPPLIER_PD, port, &charge); -#endif -} - -void typec_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ -#ifdef CONFIG_CHARGE_MANAGER - struct charge_port_info charge; - - charge.current = max_ma; - charge.voltage = supply_voltage; - charge_manager_update_charge(CHARGE_SUPPLIER_TYPEC, port, &charge); -#endif -} - void typec_set_source_current_limit(int port, int rp) { /* No-operation */ diff --git a/board/strago/usb_pd_policy.c b/board/strago/usb_pd_policy.c index e252f98dc9..64e0d4f863 100644 --- a/board/strago/usb_pd_policy.c +++ b/board/strago/usb_pd_policy.c @@ -64,28 +64,6 @@ void pd_power_supply_reset(int port) gpio_set_level(GPIO_USB_C0_5V_EN, 0); } -void pd_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ -#ifdef CONFIG_CHARGE_MANAGER - struct charge_port_info charge; - charge.current = max_ma; - charge.voltage = supply_voltage; - charge_manager_update_charge(CHARGE_SUPPLIER_PD, port, &charge); -#endif -} - -void typec_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ -#ifdef CONFIG_CHARGE_MANAGER - struct charge_port_info charge; - charge.current = max_ma; - charge.voltage = supply_voltage; - charge_manager_update_charge(CHARGE_SUPPLIER_TYPEC, port, &charge); -#endif -} - int pd_snk_is_vbus_provided(int port) { return !gpio_get_level(GPIO_USB_C0_VBUS_WAKE_L); diff --git a/board/wheatley/usb_pd_policy.c b/board/wheatley/usb_pd_policy.c index e0bdef8e20..29cf4b4b9a 100644 --- a/board/wheatley/usb_pd_policy.c +++ b/board/wheatley/usb_pd_policy.c @@ -69,28 +69,6 @@ void pd_power_supply_reset(int port) pd_send_host_event(PD_EVENT_POWER_CHANGE); } -void pd_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ -#ifdef CONFIG_CHARGE_MANAGER - struct charge_port_info charge; - charge.current = max_ma; - charge.voltage = supply_voltage; - charge_manager_update_charge(CHARGE_SUPPLIER_PD, port, &charge); -#endif -} - -void typec_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ -#ifdef CONFIG_CHARGE_MANAGER - struct charge_port_info charge; - charge.current = max_ma; - charge.voltage = supply_voltage; - charge_manager_update_charge(CHARGE_SUPPLIER_TYPEC, port, &charge); -#endif -} - int pd_snk_is_vbus_provided(int port) { return !gpio_get_level(port ? GPIO_USB_C1_VBUS_WAKE_L : diff --git a/board/zoombini/usb_pd_policy.c b/board/zoombini/usb_pd_policy.c index 6f035832f8..fe072875f2 100644 --- a/board/zoombini/usb_pd_policy.c +++ b/board/zoombini/usb_pd_policy.c @@ -126,16 +126,6 @@ void pd_power_supply_reset(int port) pd_send_host_event(PD_EVENT_POWER_CHANGE); } -void pd_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ - struct charge_port_info charge; - - charge.current = max_ma; - charge.voltage = supply_voltage; - charge_manager_update_charge(CHARGE_SUPPLIER_PD, port, &charge); -} - int pd_set_power_supply_ready(int port) { switch (port) { @@ -181,16 +171,6 @@ void pd_transition_voltage(int idx) /* No-operation: we are always 5V */ } -void typec_set_input_current_limit(int port, uint32_t max_ma, - uint32_t supply_voltage) -{ - struct charge_port_info charge; - - charge.current = max_ma; - charge.voltage = supply_voltage; - charge_manager_update_charge(CHARGE_SUPPLIER_TYPEC, port, &charge); -} - /* ----------------- Vendor Defined Messages ------------------ */ const struct svdm_response svdm_rsp = { .identity = NULL, diff --git a/common/charge_manager.c b/common/charge_manager.c index 71169fe97f..05656c5aa0 100644 --- a/common/charge_manager.c +++ b/common/charge_manager.c @@ -823,6 +823,26 @@ static void charge_manager_make_change(enum charge_manager_change_type change, hook_call_deferred(&charge_manager_refresh_data, 0); } +void pd_set_input_current_limit(int port, uint32_t max_ma, + uint32_t supply_voltage) +{ + struct charge_port_info charge; + + charge.current = max_ma; + charge.voltage = supply_voltage; + charge_manager_update_charge(CHARGE_SUPPLIER_PD, port, &charge); +} + +void typec_set_input_current_limit(int port, uint32_t max_ma, + uint32_t supply_voltage) +{ + struct charge_port_info charge; + + charge.current = max_ma; + charge.voltage = supply_voltage; + charge_manager_update_charge(CHARGE_SUPPLIER_TYPEC, port, &charge); +} + void charge_manager_update_charge(int supplier, int port, struct charge_port_info *charge) |