summaryrefslogtreecommitdiff
path: root/baseboard/zork/baseboard.c
diff options
context:
space:
mode:
Diffstat (limited to 'baseboard/zork/baseboard.c')
-rw-r--r--baseboard/zork/baseboard.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/baseboard/zork/baseboard.c b/baseboard/zork/baseboard.c
index 4a482a42cb..c4715a943a 100644
--- a/baseboard/zork/baseboard.c
+++ b/baseboard/zork/baseboard.c
@@ -10,6 +10,7 @@
#include "button.h"
#include "cbi_ec_fw_config.h"
#include "charge_manager.h"
+#include "charge_ramp.h"
#include "charge_state.h"
#include "charge_state_v2.h"
#include "common.h"
@@ -46,6 +47,13 @@
#define SAFE_RESET_VBUS_MV 5000
+/*
+ * For legacy BC1.2 charging with CONFIG_CHARGE_RAMP_SW, ramp up input current
+ * until voltage drops to 4.5V. Don't go lower than this to be kind to the
+ * charger (see b/67964166).
+ */
+#define BC12_MIN_VOLTAGE 4500
+
const enum gpio_signal hibernate_wake_pins[] = {
GPIO_LID_OPEN,
GPIO_AC_PRESENT,
@@ -348,3 +356,17 @@ void board_pwrbtn_to_pch(int level)
}
gpio_set_level(GPIO_PCH_PWRBTN_L, level);
}
+
+/**
+ * Return if VBUS is sagging too low
+ */
+int board_is_vbus_too_low(int port, enum chg_ramp_vbus_state ramp_state)
+{
+ int voltage;
+
+ if (charger_get_vbus_voltage(port, &voltage))
+ voltage = 0;
+ ccprints("vbus %d", voltage);
+
+ return voltage < BC12_MIN_VOLTAGE;
+}