mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-27 18:25:05 +00:00
reef: Initialize charge suppliers after change manager is initialized
Initialize the charge suppliers after change manager is initialized,
otherwise charge supplier current & voltage values will be overwritten
to -1 by the charge manager ini function.
BUG=chrome-os-partner:53788
BRANCH=None
TEST=Observed there are no "CL: p(port) s(supplier) i-1 v-1" prints
on the EC console.
Change-Id: Id0212c502d5833c016ac79ee15d21304d6d7ceb2
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/347896
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
This commit is contained in:
committed by
chrome-bot
parent
52fdd95321
commit
dc3de2c826
@@ -294,20 +294,32 @@ static void chipset_pre_init(void)
|
||||
}
|
||||
DECLARE_HOOK(HOOK_CHIPSET_PRE_INIT, chipset_pre_init, HOOK_PRIO_DEFAULT);
|
||||
|
||||
/* Initialize board. */
|
||||
static void board_init(void)
|
||||
static void update_vbus_supplier(int port, int vbus_level)
|
||||
{
|
||||
/* FIXME: Handle tablet mode */
|
||||
/* gpio_enable_interrupt(GPIO_TABLET_MODE_L); */
|
||||
struct charge_port_info charge;
|
||||
|
||||
struct charge_port_info charge_none;
|
||||
/*
|
||||
* If VBUS is low, or VBUS is high and we are not outputting VBUS
|
||||
* ourselves, then update the VBUS supplier.
|
||||
*/
|
||||
if (!vbus_level || !usb_charger_port_is_sourcing_vbus(port)) {
|
||||
charge.voltage = USB_CHARGER_VOLTAGE_MV;
|
||||
charge.current = vbus_level ? USB_CHARGER_MIN_CURR_MA : 0;
|
||||
charge_manager_update_charge(CHARGE_SUPPLIER_VBUS,
|
||||
port,
|
||||
&charge);
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO: Implement BC1.2 + VBUS detection */
|
||||
static void usb_charger_init(void)
|
||||
{
|
||||
int i;
|
||||
struct charge_port_info charge_none;
|
||||
|
||||
/* Initialize all BC1.2 charge suppliers to 0 */
|
||||
/* Initialize all charge suppliers to 0 */
|
||||
charge_none.voltage = USB_CHARGER_VOLTAGE_MV;
|
||||
charge_none.current = 0;
|
||||
|
||||
/* TODO: Implement BC1.2 + VBUS detection */
|
||||
for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; i++) {
|
||||
charge_manager_update_charge(CHARGE_SUPPLIER_PROPRIETARY,
|
||||
i,
|
||||
@@ -324,10 +336,18 @@ static void board_init(void)
|
||||
charge_manager_update_charge(CHARGE_SUPPLIER_OTHER,
|
||||
i,
|
||||
&charge_none);
|
||||
charge_manager_update_charge(CHARGE_SUPPLIER_VBUS,
|
||||
i,
|
||||
&charge_none);
|
||||
|
||||
/* Initialize VBUS supplier based on whether VBUS is present */
|
||||
update_vbus_supplier(i, pd_snk_is_vbus_provided(i));
|
||||
}
|
||||
}
|
||||
DECLARE_HOOK(HOOK_INIT, usb_charger_init, HOOK_PRIO_CHARGE_MANAGER_INIT + 1);
|
||||
|
||||
/* Initialize board. */
|
||||
static void board_init(void)
|
||||
{
|
||||
/* FIXME: Handle tablet mode */
|
||||
/* gpio_enable_interrupt(GPIO_TABLET_MODE_L); */
|
||||
|
||||
/*
|
||||
* There are dependencies in Reef's power topology:
|
||||
|
||||
@@ -114,7 +114,7 @@ static void charge_manager_init(void)
|
||||
CAP_UNKNOWN;
|
||||
}
|
||||
}
|
||||
DECLARE_HOOK(HOOK_INIT, charge_manager_init, HOOK_PRIO_DEFAULT-1);
|
||||
DECLARE_HOOK(HOOK_INIT, charge_manager_init, HOOK_PRIO_CHARGE_MANAGER_INIT);
|
||||
|
||||
/**
|
||||
* Returns 1 if all ports + suppliers have reported in with some initial charge,
|
||||
|
||||
@@ -69,7 +69,7 @@ static void usb_charger_init(void)
|
||||
int i;
|
||||
struct charge_port_info charge_none;
|
||||
|
||||
/* Initialize all pericom charge suppliers to 0 */
|
||||
/* Initialize all charge suppliers to 0 */
|
||||
charge_none.voltage = USB_CHARGER_VOLTAGE_MV;
|
||||
charge_none.current = 0;
|
||||
for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; i++) {
|
||||
@@ -95,4 +95,4 @@ static void usb_charger_init(void)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
DECLARE_HOOK(HOOK_INIT, usb_charger_init, HOOK_PRIO_DEFAULT);
|
||||
DECLARE_HOOK(HOOK_INIT, usb_charger_init, HOOK_PRIO_CHARGE_MANAGER_INIT + 1);
|
||||
|
||||
@@ -39,6 +39,8 @@ enum hook_priority {
|
||||
HOOK_PRIO_INIT_EXTPOWER = HOOK_PRIO_FIRST + 9,
|
||||
/* Init VBOOT hash later, since it depends on deferred functions */
|
||||
HOOK_PRIO_INIT_VBOOT_HASH = HOOK_PRIO_FIRST + 10,
|
||||
/* Init charge manager before usage in board init */
|
||||
HOOK_PRIO_CHARGE_MANAGER_INIT = HOOK_PRIO_FIRST + 11,
|
||||
|
||||
/* Specific values to lump temperature-related hooks together */
|
||||
HOOK_PRIO_TEMP_SENSOR = 6000,
|
||||
|
||||
Reference in New Issue
Block a user