summaryrefslogtreecommitdiff
path: root/common/charger.c
diff options
context:
space:
mode:
authorEric Yilun Lin <yllin@chromium.org>2020-10-29 15:27:23 +0800
committerCommit Bot <commit-bot@chromium.org>2020-12-08 06:28:44 +0000
commit7ae129c1f3cd76722902da6582825f53e4aff344 (patch)
treeecdf9c027a2fb07af1ca74352b4def2547adbe3b /common/charger.c
parenta94624f1a2fa5c25c810fef5ef66012218ed177d (diff)
downloadchrome-ec-7ae129c1f3cd76722902da6582825f53e4aff344.tar.gz
charger: add charger_get_input_current_limit
A pre-processing CL for the later CL which migrate API from charger_get_input_current. BUG=b:171853295 TEST=make buildall BRANCH=none Change-Id: Ia15ce47ac5d068b7125c58115e368f9dfa87958c Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2569084 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'common/charger.c')
-rw-r--r--common/charger.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/common/charger.c b/common/charger.c
index a2bf4abbfa..45ffafdec3 100644
--- a/common/charger.c
+++ b/common/charger.c
@@ -491,6 +491,23 @@ enum ec_error_list charger_set_input_current_limit(int chgnum,
return rv;
}
+enum ec_error_list charger_get_input_current_limit(int chgnum,
+ int *input_current)
+{
+ int rv = EC_ERROR_UNIMPLEMENTED;
+
+ 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->get_input_current_limit)
+ rv = chg_chips[chgnum].drv->get_input_current_limit(
+ chgnum, input_current);
+
+ return rv;
+}
+
enum ec_error_list charger_get_input_current(int chgnum, int *input_current)
{
int rv = EC_ERROR_UNIMPLEMENTED;