mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-10 17:41:54 +00:00
scarlet: Initialize non-PD/USB-C charge suppliers
Before all of the charge suppliers are initialized, charge_manager_refresh() wouldn't be called to update charging voltage/current. Since we don't define CONFIG_USB_CHARGER, we need to do the initialization in board specific files. BUG=b:65118519 BRANCH=none TEST=manually verify charging voltage/current are updated Change-Id: Ib0c226c236b8add0dcba7bf3610da47c26166732 Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/639926 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
This commit is contained in:
@@ -281,6 +281,9 @@ DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN,
|
||||
|
||||
static void board_init(void)
|
||||
{
|
||||
int i;
|
||||
struct charge_port_info charge_none;
|
||||
|
||||
/* Enable TCPC alert interrupts */
|
||||
gpio_enable_interrupt(GPIO_USB_C0_PD_INT_L);
|
||||
|
||||
@@ -294,6 +297,34 @@ static void board_init(void)
|
||||
/* Sensor Init */
|
||||
if (system_jumped_to_this_image() && chipset_in_state(CHIPSET_STATE_ON))
|
||||
board_spi_enable();
|
||||
|
||||
/*
|
||||
* Even if we don't support BC 1.2, we still need to initialize
|
||||
* non-PD/USB-C charge suppliers to make charge manager seeded.
|
||||
*/
|
||||
charge_none.voltage = 0;
|
||||
charge_none.current = 0;
|
||||
|
||||
for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; i++) {
|
||||
charge_manager_update_charge(CHARGE_SUPPLIER_PROPRIETARY,
|
||||
i,
|
||||
&charge_none);
|
||||
charge_manager_update_charge(CHARGE_SUPPLIER_BC12_CDP,
|
||||
i,
|
||||
&charge_none);
|
||||
charge_manager_update_charge(CHARGE_SUPPLIER_BC12_DCP,
|
||||
i,
|
||||
&charge_none);
|
||||
charge_manager_update_charge(CHARGE_SUPPLIER_BC12_SDP,
|
||||
i,
|
||||
&charge_none);
|
||||
charge_manager_update_charge(CHARGE_SUPPLIER_OTHER,
|
||||
i,
|
||||
&charge_none);
|
||||
charge_manager_update_charge(CHARGE_SUPPLIER_VBUS,
|
||||
i,
|
||||
&charge_none);
|
||||
}
|
||||
}
|
||||
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user