From f66113247a7fb0f8fcc015a50b85137d1ab044a1 Mon Sep 17 00:00:00 2001 From: Vijay Hiremath Date: Mon, 14 Nov 2016 17:38:05 -0800 Subject: charge_state_v2: Limit i/p current to meet allowed MAX i/p system power If battery is not present, input current is set to PD_MAX_CURRENT_MA. If the input power set is greater than the maximum allowed system power, system might get damaged. Hence, limit the input current to meet maximum allowed input system power. BUG=chrome-os-partner:58498 BRANCH=none TEST=Manually tested on Reef. Removed the battery & using 'charger' console command observed the following. With Zinger charger at 20V - Input current is set to 2.25A With Type-C & other chargers - Input current is set to 3A Change-Id: Ife8686f322e095aa74b740a7c469bfe87107fb9a Signed-off-by: Vijay Hiremath Reviewed-on: https://chromium-review.googlesource.com/397865 Commit-Ready: Vijay P Hiremath Tested-by: Vijay P Hiremath Reviewed-by: Shawn N --- board/wheatley/board.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'board/wheatley') diff --git a/board/wheatley/board.c b/board/wheatley/board.c index deac227365..c467d4dd89 100644 --- a/board/wheatley/board.c +++ b/board/wheatley/board.c @@ -300,11 +300,13 @@ int board_set_active_charge_port(int charge_port) * @param port Port number. * @param supplier Charge supplier type. * @param charge_ma Desired charge limit (mA). + * @param charge_mv Negotiated charge voltage (mV). */ -void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma) +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)); + CONFIG_CHARGER_INPUT_CURRENT), charge_mv); } /* Enable or disable input devices, based upon chipset state and tablet mode */ -- cgit v1.2.1