summaryrefslogtreecommitdiff
path: root/board/nipperkin
diff options
context:
space:
mode:
authorRob Barnes <robbarnes@google.com>2022-02-03 13:10:53 -0700
committerCommit Bot <commit-bot@chromium.org>2022-02-11 18:22:57 +0000
commit5f870ddebb8c909d68278b66dac1b9143d6ef50a (patch)
tree9cf710a6b26716aa9bedf4cca8fe17bac5d916c3 /board/nipperkin
parentc1e1dd95ce6e946b7b63caaedcc3f32c590a1091 (diff)
downloadchrome-ec-5f870ddebb8c909d68278b66dac1b9143d6ef50a.tar.gz
nipperkin: Override current limit when no battery
When there is no battery or battery is malfunctioning, override charger current limit to be 6A to prevent brownouts during boot. BUG=b:202754460 BRANCH=guybrush TEST=100+ cycles on R7 with 16GB 25% brownout with 65W charger without override. 15% brownout with 87W charger without override. 3% brownout with 65W charger with override. 0% brownout with 87W charger with override. Change-Id: Ib8f1610415e6b185e694e07e048d15c4b6e8ffa5 Signed-off-by: Rob Barnes <robbarnes@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3436689 Reviewed-by: Zick Wei <zick.wei@quanta.corp-partner.google.com> Reviewed-by: Diana Z <dzigterman@chromium.org>
Diffstat (limited to 'board/nipperkin')
-rw-r--r--board/nipperkin/board.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/board/nipperkin/board.c b/board/nipperkin/board.c
index d8a22aabb2..81a19f2f58 100644
--- a/board/nipperkin/board.c
+++ b/board/nipperkin/board.c
@@ -7,8 +7,10 @@
#include "adc.h"
#include "base_fw_config.h"
+#include "battery.h"
#include "board_fw_config.h"
#include "button.h"
+#include "charger.h"
#include "chipset.h"
#include "common.h"
#include "cros_board_info.h"
@@ -484,3 +486,20 @@ static void hdmi_hpd_interrupt(enum gpio_signal signal)
/* Debounce for 2 msec */
hook_call_deferred(&hdmi_hpd_handler_data, (2 * MSEC));
}
+
+void board_set_current_limit(void)
+{
+ const int no_battery_current_limit_override_ma = 6000;
+ /*
+ * When there is no battery, override charger current limit to
+ * prevent brownout during boot.
+ */
+ if (battery_is_present() == BP_NO) {
+ ccprints("No Battery Found - Override Current Limit to %dmA",
+ no_battery_current_limit_override_ma);
+ charger_set_input_current_limit(
+ CHARGER_SOLO, no_battery_current_limit_override_ma);
+ }
+}
+DECLARE_HOOK(HOOK_BATTERY_SOC_CHANGE, board_set_current_limit,
+ HOOK_PRIO_INIT_EXTPOWER);