diff options
author | Aseda Aboagye <aaboagye@google.com> | 2020-12-03 01:02:06 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-12-10 00:47:27 +0000 |
commit | 87c58967cf0fd5f4c7af1f434ba0c112afb71d3c (patch) | |
tree | b0c8b64c61813becfbb249594b296930f920b551 /common/charger.c | |
parent | f871ed9e0d782a1f44a303aa22b55a82874fbeac (diff) | |
download | chrome-ec-87c58967cf0fd5f4c7af1f434ba0c112afb71d3c.tar.gz |
charger: Add driver method for linear charging
This commit adds a driver method for enabling linear charging. Some
charger ICs have the ability to manipulate the BFET in the linear
region. This commit just adds that method and an API for use by the
rest of the system.
BUG=b:174683659
BRANCH=dedede
TEST=`make -j buildall`
Change-Id: I1660c0598a402b1f3f82300052b7cd72b8154a31
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2570937
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Diana Z <dzigterman@chromium.org>
Diffstat (limited to 'common/charger.c')
-rw-r--r-- | common/charger.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/common/charger.c b/common/charger.c index 7c073edc29..8225b5683f 100644 --- a/common/charger.c +++ b/common/charger.c @@ -655,4 +655,18 @@ enum ec_error_list charger_is_icl_reached(int chgnum, bool *reached) return chg_chips[chgnum].drv->is_icl_reached(chgnum, reached); return EC_ERROR_UNIMPLEMENTED; +} + +enum ec_error_list charger_enable_linear_charge(int chgnum, bool enable) +{ + if ((chgnum < 0) || (chgnum >= board_get_charger_chip_count())) { + CPRINTS("%s(%d) Invalid charger!", __func__, chgnum); + return EC_ERROR_INVAL; + } + + if (chg_chips[chgnum].drv->enable_linear_charge) + return chg_chips[chgnum].drv->enable_linear_charge(chgnum, + enable); + + return EC_ERROR_UNIMPLEMENTED; }
\ No newline at end of file |