diff options
-rw-r--r-- | board/kunimitsu/board.c | 14 | ||||
-rw-r--r-- | board/kunimitsu/usb_pd_policy.c | 16 |
2 files changed, 29 insertions, 1 deletions
diff --git a/board/kunimitsu/board.c b/board/kunimitsu/board.c index dde188cdef..9601d86572 100644 --- a/board/kunimitsu/board.c +++ b/board/kunimitsu/board.c @@ -434,9 +434,23 @@ int board_set_active_charge_port(int charge_port) CPRINTS("New chg p%d", charge_port); if (charge_port == CHARGE_PORT_NONE) { +#ifndef BOARD_KUNIMITSU_V3 /* Disable both ports */ gpio_set_level(GPIO_USB_C0_CHARGE_EN_L, 1); gpio_set_level(GPIO_USB_C1_CHARGE_EN_L, 1); +#else + /* + * TODO (crosbug.com/p/44704): Remove support for V3 when V4 is + * available. + * + * Currently we only get VBUS knowledge when charge is enabled, + * so, when not charging, we need to enable both ports. but, + * this is dangerous if you have two chargers plugged in and you + * set charge override to -1 then it will enable both sides! + */ + gpio_set_level(GPIO_USB_C0_CHARGE_EN_L, 0); + gpio_set_level(GPIO_USB_C1_CHARGE_EN_L, 0); +#endif } else { /* Make sure non-charging port is disabled */ gpio_set_level(charge_port ? GPIO_USB_C0_CHARGE_EN_L : diff --git a/board/kunimitsu/usb_pd_policy.c b/board/kunimitsu/usb_pd_policy.c index dc5153e32e..3dd9586bf2 100644 --- a/board/kunimitsu/usb_pd_policy.c +++ b/board/kunimitsu/usb_pd_policy.c @@ -90,9 +90,23 @@ void pd_power_supply_reset(int port) /* Disable VBUS */ gpio_set_level(port ? GPIO_USB_C1_5V_EN : GPIO_USB_C0_5V_EN, 0); - +#ifndef BOARD_KUNIMITSU_V3 /* notify host of power info change */ pd_send_host_event(PD_EVENT_POWER_CHANGE); +#else + /* + * TODO (crosbug.com/p/44704): Remove support for V3 when V4 is + * available. + * + * Currently we can only detect VBUS when charge_en is asserted, + * so, if there is no active charge port, then enable charge_en. + * If the other port is the active charger, then leave this port + * disabled. + */ + if (charge_manager_get_active_charge_port() != !port) + gpio_set_level(port ? GPIO_USB_C1_CHARGE_EN_L : + GPIO_USB_C0_CHARGE_EN_L, 0); +#endif } void pd_set_input_current_limit(int port, uint32_t max_ma, |