summaryrefslogtreecommitdiff
path: root/board/kukui/board.c
diff options
context:
space:
mode:
authorYilun Lin <yllin@google.com>2019-05-29 09:53:07 +0800
committerCommit Bot <commit-bot@chromium.org>2019-06-12 09:35:49 +0000
commit0fa5294778cd73d265e38f9240aaedc3898e803f (patch)
treedce94068f34577bee1e0836172d6eab95f7aa11c /board/kukui/board.c
parent3f7fa9b08875f332d2d80f4fa9096ad57491bba5 (diff)
downloadchrome-ec-0fa5294778cd73d265e38f9240aaedc3898e803f.tar.gz
kukui: Enable charger software ramping.
Most DCP chargers supply 5V/2A, and we want kukui to drain as much power as possible for such chargers. TEST=Plug a DCP 5V/2.1A charger and see it ramps and drains up to 1.75A, rather than original 1.34A. BUG=b:131284131 BRANCH=None Change-Id: I56ff4454036dd148cce6fcfbf80222a37c68e544 Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1610385 Reviewed-by: Yilun Lin <yllin@chromium.org> Commit-Queue: Yilun Lin <yllin@chromium.org> Tested-by: Yilun Lin <yllin@chromium.org>
Diffstat (limited to 'board/kukui/board.c')
-rw-r--r--board/kukui/board.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/board/kukui/board.c b/board/kukui/board.c
index 65e98ea788..6192b4481b 100644
--- a/board/kukui/board.c
+++ b/board/kukui/board.c
@@ -8,6 +8,7 @@
#include "backlight.h"
#include "button.h"
#include "charge_manager.h"
+#include "charge_ramp.h"
#include "charge_state.h"
#include "charger.h"
#include "chipset.h"
@@ -504,3 +505,21 @@ int board_allow_i2c_passthru(int port)
void usb_charger_set_switches(int port, enum usb_switch setting)
{
}
+
+/*
+ * Return if VBUS is sagging too low
+ */
+int board_is_vbus_too_low(int port, enum chg_ramp_vbus_state ramp_state)
+{
+ /*
+ * Though we have a more tolerant range (3.9V~13.4V), setting 4400 to
+ * prevent from a bad charger crashed.
+ *
+ * TODO(b:131284131): mt6370 VBUS reading is not accurate currently.
+ * Vendor will provide a workaround solution to fix the gap between ADC
+ * reading and actual voltage. After the workaround applied, we could
+ * try to raise this value to 4600. (when it says it read 4400, it is
+ * actually close to 4600)
+ */
+ return charger_get_vbus_voltage(port) < 4400;
+}