From 10fe09bf9aaf59213d141fc1d479ed259f786049 Mon Sep 17 00:00:00 2001 From: Aseda Aboagye Date: Fri, 3 Apr 2020 16:42:47 -0700 Subject: OCPC: Add concept of active charger IC With OCPC, one charger IC per Type-C port, there are now multiple charger ICs present in the system. This commit adds the beginning of OCPC support by adding the notion of an active charger IC. Charge Manager will select the active charger IC based upon the charge port. Boards must define this mapping in a board specific function. Additionally, this commit adds chgnum as a parameter to charger_set_input_current_limit(). BUG=b:148981052 BRANCH=None TEST=With other patches, verify that the active charger IC is able to be saved and retrieved. Change-Id: Iba4a8958171ad6e1630b0ca3d07d128bc1f2c4dd Signed-off-by: Aseda Aboagye Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2135963 Tested-by: Aseda Aboagye Reviewed-by: Diana Z Commit-Queue: Aseda Aboagye --- include/charger.h | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'include/charger.h') diff --git a/include/charger.h b/include/charger.h index 3baf9e93c9..310643017b 100644 --- a/include/charger.h +++ b/include/charger.h @@ -211,12 +211,12 @@ enum ec_error_list charger_set_otg_current_voltage(int output_current, int charger_is_sourcing_otg_power(int port); /* Get/set charge current limit in mA */ -enum ec_error_list charger_get_current(int *current); -enum ec_error_list charger_set_current(int current); +enum ec_error_list charger_get_current(int chgnum, int *current); +enum ec_error_list charger_set_current(int chgnum, int current); /* Get/set charge voltage limit in mV */ -enum ec_error_list charger_get_voltage(int *voltage); -enum ec_error_list charger_set_voltage(int voltage); +enum ec_error_list charger_get_voltage(int chgnum, int *voltage); +enum ec_error_list charger_set_voltage(int chgnum, int voltage); /* Discharge battery when on AC power. */ enum ec_error_list charger_discharge_on_ac(int enable); @@ -236,7 +236,7 @@ int charger_get_system_power(void); /* Other parameters that may be charger-specific, but are common so far. */ /* Set desired input current value */ -enum ec_error_list charger_set_input_current(int input_current); +enum ec_error_list charger_set_input_current(int chgnum, int input_current); /* * Get actual input current value. @@ -251,8 +251,11 @@ enum ec_error_list charger_get_option(int *option); enum ec_error_list charger_set_option(int option); enum ec_error_list charger_set_hw_ramp(int enable); -/* Print all charger info for debugging purposes */ -void print_charger_debug(void); +/* + * Print all charger info for debugging purposes + * @param chgnum: charger IC index. + */ +void print_charger_debug(int chgnum); #endif /* __CROS_EC_CHARGER_H */ -- cgit v1.2.1