summaryrefslogtreecommitdiff
path: root/common/usb_charger.c
diff options
context:
space:
mode:
authorJett Rink <jettrink@chromium.org>2018-04-03 18:50:03 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-04-10 19:12:55 -0700
commitbe6a26363871acb3529a30cdcb4189135a372bd7 (patch)
tree94bd53eb1af91d704b5b4afe03b2308559a331a0 /common/usb_charger.c
parentdb8d6edf26ba3f78bbab2bcda7a98e249331b8c1 (diff)
downloadchrome-ec-be6a26363871acb3529a30cdcb4189135a372bd7.tar.gz
usb_charger: initialize VBUS supplier at startup
When using VBUS_DETECT_TCPC the charger code relied on the TCPC alert to initialize the VBUS supply, but that happens too late in board startup sequence to allow an initally plugged in USB-C power supply to be chosen as the active charging port. We can and should initialize the the supplier sooner as to prevent the charge_manager_is_seeded() check from failing thus preventing the board from choosing a charging port. BRANCH=none BUG=b:77458917 TEST=PS8751 on yorp will negotiate 20V over USB-C (which was prevent by the charge_manager not being seeded) Change-Id: I6f612c508932a90ece0036ce8310a20de02d8467 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/994707 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Divya S Sasidharan <divya.s.sasidharan@intel.com> Reviewed-by: Divya S Sasidharan <divya.s.sasidharan@intel.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'common/usb_charger.c')
-rw-r--r--common/usb_charger.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/common/usb_charger.c b/common/usb_charger.c
index c55f32bbd4..010485afa3 100644
--- a/common/usb_charger.c
+++ b/common/usb_charger.c
@@ -88,7 +88,7 @@ static void usb_charger_init(void)
int i;
struct charge_port_info charge_none;
- /* Initialize all charge suppliers to 0 */
+ /* Initialize all charge suppliers */
charge_none.voltage = USB_CHARGER_VOLTAGE_MV;
charge_none.current = 0;
for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; i++) {
@@ -107,15 +107,8 @@ static void usb_charger_init(void)
charge_manager_update_charge(CHARGE_SUPPLIER_OTHER,
i,
&charge_none);
-
-#ifndef CONFIG_USB_PD_VBUS_DETECT_TCPC
- /*
- * Initialize VBUS supplier based on whether VBUS is present.
- * For CONFIG_USB_PD_VBUS_DETECT_TCPC, usb_charger_vbus_change()
- * will be called directly from TCPC alert.
- */
- update_vbus_supplier(i, pd_snk_is_vbus_provided(i));
-#endif
+ /* Initialize VBUS supplier based on whether VBUS is present. */
+ update_vbus_supplier(i, pd_is_vbus_present(i));
}
}
DECLARE_HOOK(HOOK_INIT, usb_charger_init, HOOK_PRIO_CHARGE_MANAGER_INIT + 1);