summaryrefslogtreecommitdiff
path: root/baseboard/volteer/baseboard.c
diff options
context:
space:
mode:
authorKeith Short <keithshort@chromium.org>2020-09-29 16:16:00 -0600
committerCommit Bot <commit-bot@chromium.org>2020-10-01 20:09:00 +0000
commit9b4f53e42e7bfcb2d045eca422b0097cc309a8d2 (patch)
treec09e8e175355fad269f7339a157ec370e2e58070 /baseboard/volteer/baseboard.c
parent480a1dc59a883251019262147a8c306e98599436 (diff)
downloadchrome-ec-9b4f53e42e7bfcb2d045eca422b0097cc309a8d2.tar.gz
volteer: Enable SW charge ramping
Enable CONFIG_CHARGE_RAMP_SW because hardware based charge ramping doesn't work on the ISL9241. BUG=b:169350714, b:168960587 BRANCH=none TEST=make buildall TEST=Connect 1.5A CDP device to Volteer and verify charge ramp from 0.5A to 1.5A over about 7 seconds. Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I81e8a3913bd776d0d3fda6d294fdeabbde5df62a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2438912 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
Diffstat (limited to 'baseboard/volteer/baseboard.c')
-rw-r--r--baseboard/volteer/baseboard.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/baseboard/volteer/baseboard.c b/baseboard/volteer/baseboard.c
index 36bf4bed8e..c06306ec2c 100644
--- a/baseboard/volteer/baseboard.c
+++ b/baseboard/volteer/baseboard.c
@@ -8,6 +8,7 @@
#include "button.h"
#include "cbi_ec_fw_config.h"
#include "charge_manager.h"
+#include "charge_ramp.h"
#include "charge_state.h"
#include "cros_board_info.h"
#include "driver/charger/isl9241.h"
@@ -357,3 +358,22 @@ static void cbi_init(void)
board_cbi_init();
}
DECLARE_HOOK(HOOK_INIT, cbi_init, HOOK_PRIO_FIRST);
+
+/**
+ * Return if VBUS is 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;
+
+ /*
+ * For legacy BC1.2 charging with CONFIG_CHARGE_RAMP_SW, ramp up input
+ * current until voltage drops to the minimum input voltage of the
+ * charger, 4.096V.
+ */
+ return voltage < ISL9241_BC12_MIN_VOLTAGE;
+}
+