summaryrefslogtreecommitdiff
path: root/common/usb_charger.c
diff options
context:
space:
mode:
authorEdward Hill <ecgh@chromium.org>2018-06-04 11:11:47 -0600
committerchrome-bot <chrome-bot@chromium.org>2018-06-07 08:35:52 -0700
commit718b86e1d2e44862602b9f87e391aa0963bf0ee7 (patch)
treea349e9e6beb14caaba822006bb6c69892f492dfb /common/usb_charger.c
parentd7c2e435c0823fb16272b7bdced3851c20108987 (diff)
downloadchrome-ec-718b86e1d2e44862602b9f87e391aa0963bf0ee7.tar.gz
usb_charger: Always update VBUS charge supplier
usb_charger_init() did not call charge_manager_update_charge() if we are sourcing VBUS. This means we can get stuck with charge_manager_is_seeded() never returning true, and so charging never starts, and power-on is prevented. Change update_vbus_supplier() so it always calls charge_manager_update_charge(), but with current = 0 when we are sourcing VBUS. BUG=b:80203727 BRANCH=none TEST=Reboot Grunt EC while one USB-C port is VBUS source. Change-Id: I24c29dc6b9ad9c50254181614a6440d2d055cd5a Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1086113 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'common/usb_charger.c')
-rw-r--r--common/usb_charger.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/common/usb_charger.c b/common/usb_charger.c
index 1533dc3167..e42fee48bd 100644
--- a/common/usb_charger.c
+++ b/common/usb_charger.c
@@ -27,17 +27,14 @@ static void update_vbus_supplier(int port, int vbus_level)
{
struct charge_port_info charge;
- /*
- * 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);
- }
+ charge.voltage = USB_CHARGER_VOLTAGE_MV;
+
+ if (vbus_level && !usb_charger_port_is_sourcing_vbus(port))
+ charge.current = USB_CHARGER_MIN_CURR_MA;
+ else
+ charge.current = 0;
+
+ charge_manager_update_charge(CHARGE_SUPPLIER_VBUS, port, &charge);
}
#ifdef CONFIG_USB_PD_5V_EN_CUSTOM