summaryrefslogtreecommitdiff
path: root/baseboard/honeybuns/baseboard.c
diff options
context:
space:
mode:
authorScott Collyer <scollyer@google.com>2021-03-25 12:32:56 -0700
committerCommit Bot <commit-bot@chromium.org>2021-05-02 02:47:54 +0000
commit00f1fed18d7a75792f6a4a849bb39d33590a5f9c (patch)
tree4c99a3db2a1f3c4ea8155187ac5ec85b72788f02 /baseboard/honeybuns/baseboard.c
parent89e4a2e95103abbfb31d6d77bba0d9eeb047290b (diff)
downloadchrome-ec-00f1fed18d7a75792f6a4a849bb39d33590a5f9c.tar.gz
honeybuns: Add usbc attached gpio support for usb/mst hubs
This CL adds support for new GPIO signals used by the EC to notify usb/mst hubs about type-c attach and over current protection events. The usb3 only port on quiche/baklava uses a PPC, and previously the PPC was only being used to enable/disable VBUS and did not have interrupt support. However, there can still protection events that must be handled. This CL also adds a simple usbc state machine to be able to determine attached.src state while in RO. The USB hub needs to be notified when VBUS is present (BPWRDET) otherwise it will just go into suspend state and there can be USB enumeration issues. BUG=b:185066262 BRANCH=quiche TEST=manual For OCP, I set the PPC source current limit to 1.5A and connected to a chromebook. This triggers the OCP event. For BPWRDET/UFP_PLUG_DET verified that when attached, these signals are high, when detached, are low as expected. Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: Ia147b970ea3dc298545aec4dedaa035ad2a1db30 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2818522 Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Sam Hurst <shurst@google.com> Commit-Queue: Scott Collyer <scollyer@chromium.org>
Diffstat (limited to 'baseboard/honeybuns/baseboard.c')
-rw-r--r--baseboard/honeybuns/baseboard.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/baseboard/honeybuns/baseboard.c b/baseboard/honeybuns/baseboard.c
index 3e185d8ae5..e61f447240 100644
--- a/baseboard/honeybuns/baseboard.c
+++ b/baseboard/honeybuns/baseboard.c
@@ -108,6 +108,9 @@ static void baseboard_set_led(enum led_color color)
* associated with a power button press.
*/
CPRINTS("led: color = %d", color);
+
+ /* Not all boards may have LEDs under EC control */
+#if defined(GPIO_EC_STATUS_LED1) && defined(GPIO_EC_STATUS_LED2)
if (color == OFF) {
gpio_set_level(GPIO_EC_STATUS_LED1, 1);
gpio_set_level(GPIO_EC_STATUS_LED2, 1);
@@ -118,6 +121,7 @@ static void baseboard_set_led(enum led_color color)
gpio_set_level(GPIO_EC_STATUS_LED1, 0);
gpio_set_level(GPIO_EC_STATUS_LED2, 0);
}
+#endif
}
static void baseboard_led_callback(void);
@@ -225,6 +229,8 @@ static void baseboard_init(void)
/* Set up host port usbc to present Rd on CC lines */
if(baseboard_usbc_init(USB_PD_PORT_HOST))
CPRINTS("usbc: Failed to set up sink path");
+ else
+ CPRINTS("usbc: sink path configure success!");
#endif /* SECTION_IS_RW */
}
/*
@@ -285,6 +291,11 @@ static void baseboard_power_off(void)
tcpm_release(USB_PD_PORT_HOST);
/* Disable PPC/TCPC interrupts */
board_disable_usbc_interrupts();
+
+#ifdef GPIO_USBC_UF_ATTACHED_SRC
+ /* Disable PPC interrupts for PS8803 managed port */
+ baseboard_usbc_usb3_enable_interrupts(0);
+#endif
/* Go into power off state */
board_power_sequence(0);
}