diff options
author | Diana Z <dzigterman@chromium.org> | 2020-08-25 11:13:01 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-08-27 17:58:10 +0000 |
commit | 40a988f3fa4c259dcba1d2d8fa0ef84c6a867c88 (patch) | |
tree | 1587cb39f1ee9bf136454bb68123d86b58b422f1 /include | |
parent | ffbc66137e4033eccd13a339043efbc24a0e8aab (diff) | |
download | chrome-ec-40a988f3fa4c259dcba1d2d8fa0ef84c6a867c88.tar.gz |
Charger: Add chgnum parameter to OTG set functions
Add the charger number as an input for setting OTG output current and
enabling it, both in the charger driver and in
charge_set_output_current_limit(). Also add a clarifying note about the
intent of CHARGER_SOLO.
BRANCH=None
BUG=b:147440290
TEST=make -j buildall
Signed-off-by: Diana Z <dzigterman@chromium.org>
Change-Id: I7656c19a87d8216f5efc72dcffa6d638064d3e2f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2376469
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/charge_state_v2.h | 3 | ||||
-rw-r--r-- | include/charger.h | 12 |
2 files changed, 12 insertions, 3 deletions
diff --git a/include/charge_state_v2.h b/include/charge_state_v2.h index f5408fa253..1cff136ee8 100644 --- a/include/charge_state_v2.h +++ b/include/charge_state_v2.h @@ -55,11 +55,12 @@ struct charge_state_data { * Set the output current limit and voltage. This is used to provide power from * the charger chip ("OTG" mode). * + * @param chgnum Charger index to act upon * @param ma Maximum current to provide in mA (0 to disable output). * @param mv Voltage in mV (ignored if ma == 0). * @return EC_SUCCESS or error */ -int charge_set_output_current_limit(int ma, int mv); +int charge_set_output_current_limit(int chgnum, int ma, int mv); /** * Set the charge input current limit. This value is stored and sent every diff --git a/include/charger.h b/include/charger.h index 246edec1ab..f097f564a9 100644 --- a/include/charger.h +++ b/include/charger.h @@ -134,10 +134,17 @@ extern struct charger_config_t chg_chips[]; __override_proto uint8_t board_get_charger_chip_count(void); #ifdef CONFIG_CHARGER_SINGLE_CHIP +/* + * Note: CHARGER_SOLO should be used anywhere the charger index being called is + * only valid for a single-chip system. This will then generate build errors if + * the callsite is compliled for a multi-chip system, which needs to re-evaluate + * the charger index to act upon. + */ enum chg_id { CHARGER_SOLO, CHARGER_NUM, }; + #endif /* Get the current charger_params. Failures are reported in .flags */ @@ -193,7 +200,7 @@ enum ec_error_list charger_set_mode(int mode); * For chargers that are able to supply output power for OTG dongle, this * function enables or disables power output. */ -enum ec_error_list charger_enable_otg_power(int enabled); +enum ec_error_list charger_enable_otg_power(int chgnum, int enabled); /** * Sets OTG current limit and voltage (independent of whether OTG power is @@ -211,7 +218,8 @@ enum ec_error_list charger_enable_otg_power(int enabled); * * @return EC_SUCCESS on success, an error otherwise. */ -enum ec_error_list charger_set_otg_current_voltage(int output_current, +enum ec_error_list charger_set_otg_current_voltage(int chgnum, + int output_current, int output_voltage); /** |