summaryrefslogtreecommitdiff
path: root/board/poppy/board.c
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2018-01-26 17:47:46 -0800
committerchrome-bot <chrome-bot@chromium.org>2018-02-01 14:55:18 -0800
commitf80b0f31c55e6b5a9bfcb500569dc2dacaec1479 (patch)
tree7739219014eafb3c52335e6a35460331a617645d /board/poppy/board.c
parentc870c87f2d03556debd854fa816a19a2a43004f4 (diff)
downloadchrome-ec-f80b0f31c55e6b5a9bfcb500569dc2dacaec1479.tar.gz
poppy / soraka: Decrease input current limit to prevent OC
Based on measurements, Soraka can pull more current than desired. Decrease the programmed current limit by an additional factor, determined by taking the worst-case power measurements across several different Soraka devices, to ensure that Soraka never pulls more current than desired. BRANCH=None BUG=b:67944740 TEST=Verify with `charger` that input current limit becomes 472mA when a 5V / 500mA charger is plugged, and 2896mA when a 5V / 3000mA charger is plugged. Change-Id: I2b2cb6f445533476d173cd7f5fb825d8b11d1405 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/890102 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Benson Leung <bleung@google.com> Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Diffstat (limited to 'board/poppy/board.c')
-rw-r--r--board/poppy/board.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/board/poppy/board.c b/board/poppy/board.c
index 0db69536d1..e56910833a 100644
--- a/board/poppy/board.c
+++ b/board/poppy/board.c
@@ -57,6 +57,9 @@
#define USB_PD_PORT_ANX74XX 0
+/* Minimum input current limit. */
+#define ILIM_MIN_MA 472
+
static void tcpc_alert_event(enum gpio_signal signal)
{
if ((signal == GPIO_USB_C0_PD_INT_ODL) &&
@@ -656,8 +659,13 @@ int board_set_active_charge_port(int charge_port)
void board_set_charge_limit(int port, int supplier, int charge_ma,
int max_ma, int charge_mv)
{
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+ /* Adjust ILIM according to measurements to eliminate overshoot. */
+ charge_ma = (charge_ma - 500) * 31 / 32 + 472;
+ /* 5V is significantly more accurate than other voltages. */
+ if (charge_mv > 5000)
+ charge_ma -= 52;
+
+ charge_set_input_current_limit(MAX(charge_ma, ILIM_MIN_MA), charge_mv);
}
void board_hibernate(void)