mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-05 22:41:44 +00:00
oak: enable HW charge ramping
refer to commit 75f740fa, enabling the option on oak too.
BUG=none
BRANCH=none
TEST=plug in CDP, SDP, DCP, type-C, and PD charger. Make sure
we ramp to a reasonable value for the correct suppliers.
Make sure we don't ramp for type-C and PD chargers.
Signed-off-by: Ben Lok <ben.lok@mediatek.com>
Change-Id: I9c6a0726e9cb23af59d5841c63a81897ae624998
Reviewed-on: https://chromium-review.googlesource.com/314436
Reviewed-by: Alec Berg <alecaberg@chromium.org>
This commit is contained in:
@@ -290,6 +290,40 @@ void board_set_charge_limit(int charge_ma)
|
||||
CONFIG_CHARGER_INPUT_CURRENT));
|
||||
}
|
||||
|
||||
/**
|
||||
* 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_get_image_copy() != SYSTEM_IMAGE_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;
|
||||
}
|
||||
}
|
||||
|
||||
static void hpd_irq_deferred(void)
|
||||
{
|
||||
gpio_set_level(GPIO_USB_DP_HPD, 1);
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#define CONFIG_BATTERY_PRESENT_GPIO GPIO_BAT_PRESENT_L
|
||||
#define CONFIG_BATTERY_SMART
|
||||
#define CONFIG_CHARGE_MANAGER
|
||||
#define CONFIG_CHARGE_RAMP_HW
|
||||
#define CONFIG_CHARGER
|
||||
|
||||
#define CONFIG_CHARGER_INPUT_CURRENT 512
|
||||
|
||||
Reference in New Issue
Block a user