diff options
author | Kevin K Wong <kevin.k.wong@intel.com> | 2015-09-26 01:22:06 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2015-09-29 21:11:39 -0700 |
commit | 447e543ef62971394dcf9c98ebf23e6434a9a081 (patch) | |
tree | 7c2fee4585babe9062e843bf138d3b3c88f68f01 | |
parent | 75e8dae37c698b00591c358025223d03a82d2a22 (diff) | |
download | chrome-ec-447e543ef62971394dcf9c98ebf23e6434a9a081.tar.gz |
kunimitsu: revert TYPEC PD VBUS_DET / CHARGE_EN for older hardware.
This is to revert https://chromium-review.googlesource.com/#/c/298067 and
add BOARD_KUNIMITSU_V3 build flag to always enable CHARGE_EN to get proper
VBUS_DET assertion.
When proper hardware is available, this should be removed.
BUG=none
BRANCH=none
TEST=Verified both port is able to charge with zinger on kunimitsu.
Change-Id: I331fd4575d7cef50bd9c1e1118284d5a71364aee
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/303075
Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
-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, |