diff options
author | Yilun Lin <yllin@google.com> | 2019-01-31 17:16:06 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-02-19 22:15:43 -0800 |
commit | cfcc4bc2c0f543270a91cfb30076659fbf69f32f (patch) | |
tree | 812affee1ef6fa282bb3b96710d071b78c029c0f | |
parent | eed81a74e4d4c9e8616686e85281bd3e05a77ce8 (diff) | |
download | chrome-ec-cfcc4bc2c0f543270a91cfb30076659fbf69f32f.tar.gz |
kukui: Fix unable to source power to peripheral.
EN_PP5000_USBC shuold be asserted when source power to peripheral,
and EN_USBC_CHARGE_L and EN_POGO_CHARGE_L should not be asserted at
the same time.
BRANCH=None
BUG=b:122993147, b:123670673
TEST=1. On kukui-p2 booted, without connecting to anything, see GPIO
0 EN_PP3300_POGO
1 EN_POGO_CHARGE_L
0 EN_USBC_CHARGE_L
0 EN_PP5000_USBC
that EN_POGO_CHARGE_L and EN_USBC_CHARGE_L doesn't both assert.
2. Plug peripheral, and see GPIO
0 EN_PP3300_POGO
1 EN_POGO_CHARGE_L
1* EN_USBC_CHARGE_L
1* EN_PP5000_USBC
see EN_PP5000_USBC is asserted and EN_USBC_CHARGE_L is deasserted,
and peripheral is sinking power.
3. Plug PD charger, and see GPIO
0 EN_PP3300_POGO
1 EN_POGO_CHARGE_L
0* EN_USBC_CHARGE_L
0* EN_PP5000_USBC
see EN_PP5000_USBC is deasserted and EN_USBC_CHARGE_L is asserted,
and kukui is sinking power.
Change-Id: I53ddf891edee128e03c40d27d903690620b66dad
Signed-off-by: Yilun Lin <yllin@google.com>
Signed-off-by: Yilun Lin <yilun1204@gmail.com>
Reviewed-on: https://chromium-review.googlesource.com/1445958
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Yilun Lin <yllin@chromium.org>
Reviewed-by: Ayo Wu <ayowu@chromium.org>
Reviewed-by: Ting Shen <phoenixshen@chromium.org>
-rw-r--r-- | board/kukui/gpio.inc | 2 | ||||
-rw-r--r-- | board/kukui/usb_pd_policy.c | 20 |
2 files changed, 19 insertions, 3 deletions
diff --git a/board/kukui/gpio.inc b/board/kukui/gpio.inc index 1c090eea42..4986e878a2 100644 --- a/board/kukui/gpio.inc +++ b/board/kukui/gpio.inc @@ -105,7 +105,7 @@ GPIO(BOOTBLOCK_MUX_OE, PIN(C, 4), GPIO_ODR_HIGH) GPIO(USB_ID, PIN(A, 13), GPIO_ODR_HIGH) #elif BOARD_REV >= 2 GPIO(EN_PP3300_POGO, PIN(A, 13), GPIO_OUT_LOW) -GPIO(EN_POGO_CHARGE_L, PIN(B, 6), GPIO_OUT_LOW) +GPIO(EN_POGO_CHARGE_L, PIN(B, 6), GPIO_OUT_HIGH) GPIO(EN_USBC_CHARGE_L, PIN(C, 7), GPIO_OUT_LOW) GPIO(EN_PP5000_USBC, PIN(D, 2), GPIO_OUT_LOW) #endif diff --git a/board/kukui/usb_pd_policy.c b/board/kukui/usb_pd_policy.c index 42b0ce7e03..38354dc148 100644 --- a/board/kukui/usb_pd_policy.c +++ b/board/kukui/usb_pd_policy.c @@ -52,7 +52,6 @@ void pd_transition_voltage(int idx) { /* No-operation: we are always 5V */ } - static uint8_t vbus_en; int board_vbus_source_enabled(int port) @@ -68,6 +67,12 @@ int pd_set_power_supply_ready(int port) vbus_en = 1; charger_enable_otg_power(1); +#if BOARD_REV >= 2 + /* TODO(b:123268580): Implement POGO discharge logic. */ + gpio_set_level(GPIO_EN_USBC_CHARGE_L, 1); + gpio_set_level(GPIO_EN_PP5000_USBC, 1); +#endif + /* notify host of power info change */ pd_send_host_event(PD_EVENT_POWER_CHANGE); @@ -86,6 +91,18 @@ void pd_power_supply_reset(int port) if (prev_en) pd_set_vbus_discharge(port, 1); +#if BOARD_REV >= 2 + /* + * TODO(b:123268580): Implement POGO discharge logic. + * + * Turn off source path and POGO path before asserting + * EN_USB_CHARGE_L. + */ + gpio_set_level(GPIO_EN_PP5000_USBC, 0); + gpio_set_level(GPIO_EN_POGO_CHARGE_L, 1); + gpio_set_level(GPIO_EN_USBC_CHARGE_L, 0); +#endif + /* notify host of power info change */ pd_send_host_event(PD_EVENT_POWER_CHANGE); } @@ -405,4 +422,3 @@ const struct svdm_amode_fx supported_modes[] = { }; const int supported_modes_cnt = ARRAY_SIZE(supported_modes); #endif /* CONFIG_USB_PD_ALT_MODE_DFP */ - |