diff options
author | Aseda Aboagye <aaboagye@google.com> | 2020-04-03 16:42:47 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-05-01 01:12:04 +0000 |
commit | 10fe09bf9aaf59213d141fc1d479ed259f786049 (patch) | |
tree | 1c2f9c76714af47bdb08b9cc388b0c0a56041e26 /driver/charger/bq25710.c | |
parent | 03e331ec95e732eab725073e6af22a09ad9c7616 (diff) | |
download | chrome-ec-10fe09bf9aaf59213d141fc1d479ed259f786049.tar.gz |
OCPC: Add concept of active charger IC
With OCPC, one charger IC per Type-C port, there are now multiple
charger ICs present in the system. This commit adds the beginning of
OCPC support by adding the notion of an active charger IC. Charge
Manager will select the active charger IC based upon the charge port.
Boards must define this mapping in a board specific function.
Additionally, this commit adds chgnum as a parameter to
charger_set_input_current_limit().
BUG=b:148981052
BRANCH=None
TEST=With other patches, verify that the active charger IC is able to
be saved and retrieved.
Change-Id: Iba4a8958171ad6e1630b0ca3d07d128bc1f2c4dd
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2135963
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Diana Z <dzigterman@chromium.org>
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'driver/charger/bq25710.c')
-rw-r--r-- | driver/charger/bq25710.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/driver/charger/bq25710.c b/driver/charger/bq25710.c index b9a897d843..72eaf20bdf 100644 --- a/driver/charger/bq25710.c +++ b/driver/charger/bq25710.c @@ -9,6 +9,7 @@ #include "battery_smart.h" #include "bq25710.h" #include "charge_ramp.h" +#include "charge_state_v2.h" #include "charger.h" #include "common.h" #include "console.h" @@ -466,6 +467,10 @@ static enum ec_error_list bq25710_set_option(int chgnum, int option) static void bq25710_chg_ramp_handle(void) { int ramp_curr; + int chgnum = 0; + + if (IS_ENABLED(CONFIG_OCPC)) + chgnum = charge_get_active_chg_chip(); /* * Once the charge ramp is stable write back the stable ramp @@ -473,7 +478,7 @@ static void bq25710_chg_ramp_handle(void) */ ramp_curr = chg_ramp_get_current_limit(); if (chg_ramp_is_stable()) { - if (ramp_curr && !charger_set_input_current(ramp_curr)) + if (ramp_curr && !charger_set_input_current(chgnum, ramp_curr)) CPRINTF("bq25710: stable ramp current=%d\n", ramp_curr); } else { CPRINTF("bq25710: ICO stall, ramp current=%d\n", ramp_curr); |