summaryrefslogtreecommitdiff
path: root/common/charger.c
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2020-03-18 14:31:42 -0600
committerCommit Bot <commit-bot@chromium.org>2020-03-21 00:28:11 +0000
commitd68abb5d52c3474aa247a47c23375354d08be600 (patch)
treeff3b183a0a9ee29e6db0d52ed675d6ec14299d33 /common/charger.c
parent9ce65e72ce2ad6207fba220e78aab69afc2f6ee9 (diff)
downloadchrome-ec-d68abb5d52c3474aa247a47c23375354d08be600.tar.gz
Charger: Add driver function for sourcing OTG
Fold charger_is_sourcing_otg_power into the charger driver structure. BUG=None BRANCH=None TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I0526495fff8464539e216d2cf80c34e09af2c418 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2110530 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'common/charger.c')
-rw-r--r--common/charger.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/common/charger.c b/common/charger.c
index 7997b03371..25b73b2ac3 100644
--- a/common/charger.c
+++ b/common/charger.c
@@ -318,6 +318,22 @@ enum ec_error_list charger_set_otg_current_voltage(int output_current,
return rv;
}
+int charger_is_sourcing_otg_power(int port)
+{
+ int chgnum = 0;
+ int rv = 0;
+
+ if ((chgnum < 0) || (chgnum >= chg_cnt)) {
+ CPRINTS("%s(%d) Invalid charger!", __func__, chgnum);
+ return 0;
+ }
+
+ if (chg_chips[chgnum].drv->is_sourcing_otg_power)
+ rv = chg_chips[chgnum].drv->is_sourcing_otg_power(chgnum, port);
+
+ return rv;
+}
+
enum ec_error_list charger_get_current(int *current)
{
int chgnum = 0;