From b87fe062eca43fc00909098e716581bf2aeea7eb Mon Sep 17 00:00:00 2001 From: Shawn Nematbakhsh Date: Thu, 5 Oct 2017 09:50:08 -0700 Subject: charge_ramp: Move ramp allowed / ilim callbacks to common code The decision on whether to ramp (and how high) depends on the quirks of charger identification, so move the decision out of board, into the drivers that implement usb_charger. Also, rename CONFIG_CHARGE_RAMP to CONFIG_CHARGE_RAMP_SW, to better contrast with the existing CONFIG_CHARGE_RAMP_HW. BUG=None TEST=Manual on kevin, verify ramp occurs when port plugged into Z840 workstation. BRANCH=None Change-Id: I5b395274133837a18a4f4ac34b59b623287be175 Signed-off-by: Shawn Nematbakhsh Reviewed-on: https://chromium-review.googlesource.com/702681 Commit-Ready: Shawn N Tested-by: Shawn N Reviewed-by: Vincent Palatin --- board/chell/board.c | 33 --------------------------------- 1 file changed, 33 deletions(-) (limited to 'board/chell') diff --git a/board/chell/board.c b/board/chell/board.c index ca0ed3d276..5fc0a47965 100644 --- a/board/chell/board.c +++ b/board/chell/board.c @@ -354,39 +354,6 @@ void board_set_charge_limit(int port, int supplier, int charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv); } -/** - * 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_is_in_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; - } -} - /* Called on AP S5 -> S3 transition */ static void board_chipset_startup(void) { -- cgit v1.2.1