diff options
author | Aseda Aboagye <aaboagye@google.com> | 2020-05-08 17:22:22 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-06-04 02:50:29 +0000 |
commit | ca454e7f6ec451d7fcee5287534e6b63533b0b2f (patch) | |
tree | 2bd2d0f9ea55b2165cb22c2e52f5996127a83e5d /common/charger.c | |
parent | 533c749098b53ec3e640f874dab20dda8adbd086 (diff) | |
download | chrome-ec-ca454e7f6ec451d7fcee5287534e6b63533b0b2f.tar.gz |
OCPC: charger: Add support for VSYS compensation
Some charger ICs can compensate VSYS for losses across the board when
charging from an auxiliary charger in an OCPC scheme. This commit
adds that support to the common charger and OCPC framework such that
it can be leveraged.
Charger ICs which can dynamically compensate and don't need continuous
adjustments should return EC_SUCCESS as the PID won't be needed.
Other chargers should return EC_ERROR_UNIMPLEMENTED since they require
continuous adjustments.
BUG=b:147440290,b:148980016
BRANCH=None
TEST=With driver changes made for RAA48900, build and flash on
waddledoo, verify that charging from the sub board works on board revs
0 and 1.
TEST=`make -j buildall`
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Change-Id: Ie6fb27260b2d6e040dbfdc0aaa5b64b52173037c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2191298
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 | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/common/charger.c b/common/charger.c index aac623d74a..3a980d99df 100644 --- a/common/charger.c +++ b/common/charger.c @@ -624,3 +624,26 @@ int chg_ramp_get_current_limit(void) return rv; } #endif + +enum ec_error_list charger_set_vsys_compensation(int chgnum, + struct ocpc_data *ocpc, + int current_ma, + int voltage_mv) +{ + if ((chgnum < 0) || (chgnum >= chg_cnt)) { + CPRINTS("%s(%d) Invalid charger!", __func__, chgnum); + return EC_ERROR_INVAL; + } + + if (chg_chips[chgnum].drv->set_vsys_compensation) + return chg_chips[chgnum].drv->set_vsys_compensation(chgnum, + ocpc, + current_ma, + voltage_mv); + + /* + * This shouldn't happen as this should only be called on chargers + * that support this. + */ + return EC_ERROR_UNIMPLEMENTED; +} |