diff options
author | Peter Marheine <pmarheine@chromium.org> | 2020-08-20 15:18:35 +1000 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-08-21 04:38:54 +0000 |
commit | d44d6b29eb5ff59c1afd47135ec626ed907b174a (patch) | |
tree | f170e2f7ca5c0a3004a7db289edd088a09a41ba7 /baseboard/zork/variant_trembyle.c | |
parent | ace8af086a9f8110ec0086cd6f81720e4bc6e7a1 (diff) | |
download | chrome-ec-d44d6b29eb5ff59c1afd47135ec626ed907b174a.tar.gz |
trembyle: correctly pass USB-C1 HPD to the MST hub
The RTD2141 MST hub on some daughterboard options requires the EC to drive
its HPD input because HPD comes over USB-PD, but the MST hub then drives
the AP's HPD input. The EC was incorrectly driving nothing, causing DP
outputs on port C1 to not be detected.
Because the MST's HPD input is connected to an IO expander on current
hardware, configure the USB-C and Trembyle-specific HPD twiddling code to
support regular or expander GPIOs. Experience says IO expanders tend to be
too slow for reliable HPD, but this should allow some (possibly flaky) HPD
support until hardware changes are completed to put the output directly on
an EC GPIO.
BUG=b:159051013,b:165622386
TEST=still builds (I have no v3 hardware to test against)
BRANCH=None
Signed-off-by: Peter Marheine <pmarheine@chromium.org>
Change-Id: I9e041ab7c222927a11b8972920b7e978ab30d751
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2366456
Reviewed-by: Edward Hill <ecgh@chromium.org>
Diffstat (limited to 'baseboard/zork/variant_trembyle.c')
-rw-r--r-- | baseboard/zork/variant_trembyle.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/baseboard/zork/variant_trembyle.c b/baseboard/zork/variant_trembyle.c index 2f1f11fd61..669ed5f6b7 100644 --- a/baseboard/zork/variant_trembyle.c +++ b/baseboard/zork/variant_trembyle.c @@ -486,10 +486,10 @@ static int board_ps8818_mux_set(const struct usb_mux *me, return rv; /* Enable IN_HPD on the DB */ - ioex_set_level(IOEX_USB_C1_HPD_IN_DB, 1); + gpio_or_ioex_set_level(PORT_TO_HPD(1), 1); } else { /* Disable IN_HPD on the DB */ - ioex_set_level(IOEX_USB_C1_HPD_IN_DB, 0); + gpio_or_ioex_set_level(PORT_TO_HPD(1), 0); } return rv; @@ -515,3 +515,26 @@ struct usb_mux usbc1_amd_fp5_usb_mux = { .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS, .driver = &amd_fp5_usb_mux_driver, }; + +/* + * USB-C1 HPD may go through an IO expander, so we must use a custom HPD GPIO + * control function with CONFIG_USB_PD_DP_HPD_GPIO_CUSTOM. + * + * TODO(b/165622386) revert to non-custom GPIO control when HPD is no longer on + * the IO expander in any variants. + */ +void svdm_set_hpd_gpio(int port, int en) +{ + gpio_or_ioex_set_level(PORT_TO_HPD(port), en); +} + +int svdm_get_hpd_gpio(int port) +{ + int out; + + if (gpio_or_ioex_get_level(PORT_TO_HPD(port), &out) != EC_SUCCESS) { + ccprints("Failed to read current HPD for port C%d", port); + return 0; + } + return out; +} |