summaryrefslogtreecommitdiff
path: root/include/charge_state_v2.h
diff options
context:
space:
mode:
authorPeter Marheine <pmarheine@chromium.org>2022-11-10 16:37:09 +1100
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-11-23 03:58:51 +0000
commitb75dc90677f29424e6f0d63f294dce4b39782135 (patch)
tree17002ffbd6b6f660b1a5a1a1e1911e741fa4ac73 /include/charge_state_v2.h
parentf1b563c350acf6a1b687c682f07770aa8210dc01 (diff)
downloadchrome-ec-b75dc90677f29424e6f0d63f294dce4b39782135.tar.gz
Add CONFIG_CHARGER_MIN_INPUT_CURRENT_LIMIT
This splits the dual use of CONFIG_CHARGER_INPUT_CURRENT into two different symbols, changing the uses of that which are used to set a minimum current limit to be CONFIG_CHARGER_MAX_INPUT_CURRENT_LIMIT. Most boards implement this in the same way within either the board or baseboard, so handling of the new option is moved into charge_set_input_current_limit (which is called by every user of the option) and every board which repeated this pattern has the new symbol set to the same value as the old one, with the duplicated code deleted. One functional change to the charge manager is made: when charging stops, the input current limit is set to the default value (CONFIG_CHARGER_INPUT_CURRENT) rather than 0. This captures the intent that the default current is appropriate at any time, which was previously configured by individual boards' implementation of board_set_charge_limit() while still allowing the limit to be set lower as needed. To verify that all changes are appropriate, the following has been manually checked: * All boards with a change to a .c file also have a .h change * All boards without a changed .h file have a changed baseboard.h * For Zephyr projects, those with a changed .c file have config added for the minimum limit and others (only corsola) are unchanged to leave it off. This is intended to verify that each board that duplicated the MAX() logic has its configuration updated to use the shared copy, and that boards with that code in the baseboard also update their configuration. BUG=b:163093572 TEST=make buildall; zmake build -a BRANCH=none LOW_COVERAGE_REASON=added lines will soon be deleted Change-Id: Ia460a16293c1fb82aac3784fd9be57ba0985f2fe Signed-off-by: Peter Marheine <pmarheine@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4019703 Reviewed-by: Keith Short <keithshort@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
Diffstat (limited to 'include/charge_state_v2.h')
-rw-r--r--include/charge_state_v2.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/charge_state_v2.h b/include/charge_state_v2.h
index 5f886257d3..c7a5cbc995 100644
--- a/include/charge_state_v2.h
+++ b/include/charge_state_v2.h
@@ -72,7 +72,8 @@ int charge_set_output_current_limit(int chgnum, int ma, int mv);
* time AC is applied.
*
* The input current limit is automatically derated by
- * CONFIG_CHARGER_INPUT_CURRENT_DERATE_PCT, if configured.
+ * CONFIG_CHARGER_INPUT_CURRENT_DERATE_PCT (if configured), and is clamped to
+ * no less than CONFIG_CHARGER_MIN_INPUT_CURRENT_LIMIT mA (if configured).
*
* @param ma New input current limit in mA
* @param mv Negotiated charge voltage in mV.