summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2015-11-03 18:26:26 -0800
committerchrome-bot <chrome-bot@chromium.org>2015-11-09 12:49:30 -0800
commit75f740fa231703b7000fdfbee8f7225214c1a7ff (patch)
tree9a7053d0bab3b07c698e0fb93633ed17d4bc240d /board
parent92a65427d3881f3d2ec64b1ab540fb5a4aa0ce93 (diff)
downloadchrome-ec-75f740fa231703b7000fdfbee8f7225214c1a7ff.tar.gz
glados: isl9237: add HW charge ramping
Add HW charge ramping option and enable on glados. Modify charge_manager to enable/disable HW charge ramping when option is defined. Unfortunately, the isl9237 doesn't have a way to determine what the input current limit has settled on, so the EC will always report the max input current for that supplier. BUG=chrome-os-partner:47335 BRANCH=none TEST=plug in CDP, SDP, DCP, type-C, and PD charger. Make sure we ramp to a reasonable value for the correct suppliers. Make sure we don't ramp for type-C and PD chargers. Change-Id: Ib541fa0be48d8f4d261c71b853b0ee72b2adbf6b Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/311301 Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'board')
-rw-r--r--board/glados/board.c34
-rw-r--r--board/glados/board.h1
2 files changed, 35 insertions, 0 deletions
diff --git a/board/glados/board.c b/board/glados/board.c
index 299e04fbae..2681c49f94 100644
--- a/board/glados/board.c
+++ b/board/glados/board.c
@@ -321,6 +321,40 @@ void board_set_charge_limit(int charge_ma)
CONFIG_CHARGER_INPUT_CURRENT));
}
+/**
+ * Return whether ramping is allowed for given supplier
+ */
+int board_is_ramp_allowed(int supplier)
+{
+ /* Don't allow ramping in RO when write protected */
+ if (system_get_image_copy() != SYSTEM_IMAGE_RW
+ && system_is_locked())
+ return 0;
+ else
+ return supplier == CHARGE_SUPPLIER_BC12_DCP ||
+ supplier == CHARGE_SUPPLIER_BC12_SDP ||
+ supplier == CHARGE_SUPPLIER_BC12_CDP ||
+ supplier == CHARGE_SUPPLIER_PROPRIETARY;
+}
+
+/**
+ * Return the maximum allowed input current
+ */
+int board_get_ramp_current_limit(int supplier, int sup_curr)
+{
+ switch (supplier) {
+ case CHARGE_SUPPLIER_BC12_DCP:
+ return 2000;
+ case CHARGE_SUPPLIER_BC12_SDP:
+ return 1000;
+ case CHARGE_SUPPLIER_BC12_CDP:
+ case CHARGE_SUPPLIER_PROPRIETARY:
+ return sup_curr;
+ default:
+ return 500;
+ }
+}
+
/* Enable or disable input devices, based upon chipset state and tablet mode */
static void enable_input_devices(void)
{
diff --git a/board/glados/board.h b/board/glados/board.h
index 0d4063c2dd..ff9f817dca 100644
--- a/board/glados/board.h
+++ b/board/glados/board.h
@@ -20,6 +20,7 @@
#define CONFIG_BOARD_VERSION
#define CONFIG_BUTTON_COUNT 2
#define CONFIG_CHARGE_MANAGER
+#define CONFIG_CHARGE_RAMP_HW
#define CONFIG_CHARGER
#define CONFIG_CHARGER_V2