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 <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/702681
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
Shawn Nematbakhsh
2017-10-05 09:50:08 -07:00
committed by chrome-bot
parent 02045eb040
commit b87fe062ec
34 changed files with 563 additions and 850 deletions

View File

@@ -16,25 +16,6 @@ enum chg_ramp_vbus_state {
CHG_RAMP_VBUS_STABLE
};
/**
* Check if ramping is allowed for given supplier
*
* @supplier Supplier to check
*
* @return Ramping is allowed for given supplier
*/
int board_is_ramp_allowed(int supplier);
/**
* Get the maximum current limit that we are allowed to ramp to
*
* @supplier Active supplier type
* @sup_curr Input current limit based on supplier
*
* @return Maximum current in mA
*/
int board_get_ramp_current_limit(int supplier, int sup_curr);
/**
* Check if board is consuming full input current
*
@@ -52,6 +33,25 @@ int board_is_consuming_full_charge(void);
*/
int board_is_vbus_too_low(int port, enum chg_ramp_vbus_state ramp_state);
/**
* Check if ramping is allowed for given supplier
*
* @supplier Supplier to check
*
* @return Ramping is allowed for given supplier
*/
int chg_ramp_allowed(int supplier);
/**
* Get the maximum current limit that we are allowed to ramp to
*
* @supplier Active supplier type
* @sup_curr Input current limit based on supplier
*
* @return Maximum current in mA
*/
int chg_ramp_max(int supplier, int sup_curr);
/**
* Get the input current limit set by ramp module
*

View File

@@ -434,12 +434,12 @@
/* Handle the external power limit host command in charge manager */
#undef CONFIG_CHARGE_MANAGER_EXTERNAL_POWER_LIMIT
/* Compile input current ramping support */
#undef CONFIG_CHARGE_RAMP
/* The hardware has some input current ramping/back-off mechanism */
#undef CONFIG_CHARGE_RAMP_HW
/* Compile input current ramping support using software control */
#undef CONFIG_CHARGE_RAMP_SW
/*****************************************************************************/
/* Charger config */

View File

@@ -88,4 +88,22 @@ void usb_charger_set_switches(int port, enum usb_switch setting);
*/
void usb_charger_vbus_change(int port, int vbus_level);
/**
* Check if ramping is allowed for given supplier
*
* @supplier Supplier to check
*
* @return Ramping is allowed for given supplier
*/
int usb_charger_ramp_allowed(int supplier);
/**
* Get the maximum current limit that we are allowed to ramp to
*
* @supplier Active supplier type
* @sup_curr Input current limit based on supplier
*
* @return Maximum current in mA
*/
int usb_charger_ramp_max(int supplier, int sup_curr);
#endif /* __CROS_EC_USB_CHARGE_H */