diff options
author | Ting Shen <phoenixshen@google.com> | 2020-05-06 18:06:52 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-05-29 05:11:24 +0000 |
commit | 8975cbb645f1f07c3682334d02510a8a1d3f730b (patch) | |
tree | 1c65f1c460b25e785181b15c2d78b303b4cfacfc /common/charge_manager.c | |
parent | fad8f404df3e1b2278326c08247a62edce434f32 (diff) | |
download | chrome-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 'common/charge_manager.c')
-rw-r--r-- | common/charge_manager.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/common/charge_manager.c b/common/charge_manager.c index c12fc12318..388e74fc1c 100644 --- a/common/charge_manager.c +++ b/common/charge_manager.c @@ -431,7 +431,7 @@ static void charge_manager_fill_power_info(int port, #if defined(HAS_TASK_CHG_RAMP) || defined(CONFIG_CHARGE_RAMP_HW) /* Read ramped current if active charging port */ use_ramp_current = - (charge_port == port) && chg_ramp_allowed(sup); + (charge_port == port) && chg_ramp_allowed(port, sup); #else use_ramp_current = 0; #endif @@ -449,7 +449,7 @@ static void charge_manager_fill_power_info(int port, * available charge current. */ r->meas.current_max = chg_ramp_is_stable() ? - r->meas.current_lim : chg_ramp_max(sup, + r->meas.current_lim : chg_ramp_max(port, sup, available_charge[sup][port].current); r->max_power = @@ -728,9 +728,9 @@ static void charge_manager_refresh(void) * Allow to set the maximum current value, so the hardware can * know the range of acceptable current values for its ramping. */ - if (chg_ramp_allowed(new_supplier)) + if (chg_ramp_allowed(new_port, new_supplier)) new_charge_current_uncapped = - chg_ramp_max(new_supplier, + chg_ramp_max(new_port, new_supplier, new_charge_current_uncapped); #endif /* CONFIG_CHARGE_RAMP_HW */ /* Enforce port charge ceiling. */ @@ -756,7 +756,7 @@ static void charge_manager_refresh(void) #else #ifdef CONFIG_CHARGE_RAMP_HW /* Enable or disable charge ramp */ - charger_set_hw_ramp(chg_ramp_allowed(new_supplier)); + charger_set_hw_ramp(chg_ramp_allowed(new_port, new_supplier)); #endif board_set_charge_limit(new_port, new_supplier, new_charge_current, |