summaryrefslogtreecommitdiff
path: root/board/ryu
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2015-06-29 14:33:22 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-07-01 02:15:19 +0000
commitcdef497a4e50dc05818e7b327997ecb2de10c206 (patch)
treecbbb6b49dc29b02490c80925dc3e7bfe31b8c741 /board/ryu
parenta11ffa6c93e28f536cf97eb29e613399d25baf63 (diff)
downloadchrome-ec-cdef497a4e50dc05818e7b327997ecb2de10c206.tar.gz
bq2598x: ryu: take into account hardware input current optimizer
Take profit of the hardware input current ramping/back-off integrated in the BQ2589x charger by setting the current limits higher for BC1.2 USB modes and letting the hardware adjust to the actual charger limitation depending on the VBUS voltage droop. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=smaug BUG=chrome-os-partner:42045 TEST=Connect a Nexus 9 DCP charger to Smaug and see the input current adjusted to 1650mA without brown-out, read back the value properly from the AP: $ ectool usbpdpower Port 0: SNK Charger DCP 4958mV / 1650mA, max 5000mV / 1650mA / 8250mW Change-Id: I348e5ee4980a5652f72f279ab4e3a7126583b093 Reviewed-on: https://chromium-review.googlesource.com/282584 Trybot-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'board/ryu')
-rw-r--r--board/ryu/board.c30
-rw-r--r--board/ryu/board.h1
2 files changed, 31 insertions, 0 deletions
diff --git a/board/ryu/board.c b/board/ryu/board.c
index d7b3d2893d..11f7753ccd 100644
--- a/board/ryu/board.c
+++ b/board/ryu/board.c
@@ -415,6 +415,36 @@ void board_set_charge_limit(int charge_ma)
CPRINTS("Failed to set input current limit for PD");
}
+/**
+ * Return whether ramping is allowed for given supplier
+ */
+int board_is_ramp_allowed(int supplier)
+{
+ 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 2400;
+ case CHARGE_SUPPLIER_BC12_SDP:
+ return 1000;
+ case CHARGE_SUPPLIER_BC12_CDP:
+ return 2400;
+ case CHARGE_SUPPLIER_PROPRIETARY:
+ return sup_curr;
+ default:
+ return 500;
+ }
+}
+
/* Send host event up to AP */
void pd_send_host_event(int mask)
{
diff --git a/board/ryu/board.h b/board/ryu/board.h
index eb982ed44f..5ce4066fdf 100644
--- a/board/ryu/board.h
+++ b/board/ryu/board.h
@@ -21,6 +21,7 @@
/* Optional features */
#undef CONFIG_CMD_HASH
#define CONFIG_CHARGE_MANAGER
+#define CONFIG_CHARGE_RAMP_HW
#define CONFIG_FORCE_CONSOLE_RESUME
#define CONFIG_STM_HWTIMER32
#define CONFIG_USB_CHARGER