summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWai-Hong Tam <waihong@google.com>2022-12-02 14:21:54 -0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-01-12 20:17:42 +0000
commit82c8521864ddc8dc790bbdfcbe1ec9a3812eeef6 (patch)
treeb6d00b544b1c8c3181129d43936a3991a276b938
parentf0ee9665875c2a95b650ba8f70d8b16d8a371f2f (diff)
downloadchrome-ec-82c8521864ddc8dc790bbdfcbe1ec9a3812eeef6.tar.gz
trogdor: Pass through AUX termination when DP-Config is acked
The hardware block diagram is like: AUX termination | +----+--- TCPC MUX --- PPC SW --- Type-C connector (port-0) DP PHY -- DP MUX +----+--- TCPC MUX --- PPC SW --- Type-C connector (port-1) | AUX termination The current implementation muxes the path end-to-end on a HPD high event. The dependencies are: * Chromebook muxing the AUX channel depends on a HPD high event, * DP sink raising HPD depends on a cable connection detected (auto- probe), * Successful probe of a cable connection depends on AUX termination, which cause a dead-lock. This change breaks the dead-lock. During the DP-Config phase, when the DP-Config VDM is acked, connect the PPC SW and TCPC MUX, but leave the DP MUX disconnected. So the DP sink can detect the correct AUX termination. The DP port selection mux is not enabled yet so no signal passes through to the DP PHY. As the TCPC MUX is enabled in the DP-Config phase, we can't use the TCPC MUX status as the condition to check if the DP path is muxable. Change it to the DP selection mux. BRANCH=trogdor BUG=b:247005613 TEST=Together with the next CL. Connect the device through a Type-C dongle to a monitor and verify the screen. Try the combinations: * Plug C0 monitor -> plug C0 dongle -> screen on C0 monitor * Plug C0 dongle -> plug C0 monitor -> screen on C0 monitor -> unplug C0 monitor -> plug C0 monitor -> screen on C0 monitor * Plug C0 dongle -> plug C0 monitor -> screen on C0 monitor -> plug C1 dongle -> -> plug C1 monitor -> no screen on C1 monitor -> unplug C0 monitor -> replug C1 monitor -> screen on C0 monitor * Plug C0 dongle -> plug C1 dongle -> plug C1 monitor -> screen on C1 monitor -> unplug C1 dongle -> plug C0 monitor -> screen on C0 monitor Change-Id: Id24ce4627a1c015ad2dc9748578fa1a6d68122c6 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4076560 Reviewed-by: Stephen Boyd <swboyd@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Commit-Queue: Stephen Boyd <swboyd@chromium.org> (cherry picked from commit 5a99b9b38428215cce0f3c660f003919652595e2) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4163457
-rw-r--r--baseboard/trogdor/usb_pd_policy.c35
1 files changed, 25 insertions, 10 deletions
diff --git a/baseboard/trogdor/usb_pd_policy.c b/baseboard/trogdor/usb_pd_policy.c
index 5258cd4f8c..797602b0df 100644
--- a/baseboard/trogdor/usb_pd_policy.c
+++ b/baseboard/trogdor/usb_pd_policy.c
@@ -106,7 +106,7 @@ __override int svdm_dp_config(int port, uint32_t *payload)
return 0;
/*
- * Defer setting the usb_mux until HPD goes high, svdm_dp_attention().
+ * Defer setting the DP mux until HPD goes high, svdm_dp_attention().
* The AP only supports one DP phy. An external DP mux switches between
* the two ports. Should switch those muxes when it is really used,
* i.e. HPD high; otherwise, the real use case is preempted, like:
@@ -126,6 +126,23 @@ __override int svdm_dp_config(int port, uint32_t *payload)
__override void svdm_dp_post_config(int port)
{
dp_flags[port] |= DP_FLAGS_DP_ON;
+
+ /*
+ * Connect the SBU lines in PPC chip such that the AUX termination
+ * can be passed through.
+ */
+ if (IS_ENABLED(CONFIG_USBC_PPC_SBU))
+ ppc_set_sbu(port, 1);
+
+ /*
+ * Connect the USB SS/DP lines in TCPC chip.
+ *
+ * When mf_pref not true, still use the dock muxing
+ * because of the board USB-C topology (limited to 2
+ * lanes DP).
+ */
+ usb_mux_set(port, USB_PD_MUX_DOCK, USB_SWITCH_CONNECT,
+ polarity_rm_dts(pd_get_polarity(port)));
}
/**
@@ -138,15 +155,13 @@ __override void svdm_dp_post_config(int port)
*/
static int is_dp_muxable(int port)
{
- int i;
-
- for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++)
- if (i != port) {
- if (usb_mux_get(i) & USB_PD_MUX_DP_ENABLED)
- return 0;
- }
-
- return 1;
+ /*
+ * Check the DP port selection mux, positive either:
+ * - no port is muxed, OE_L deasserted, HIGH, or
+ * - already muxed to the same port.
+ */
+ return gpio_get_level(GPIO_DP_MUX_OE_L) ||
+ (gpio_get_level(GPIO_DP_MUX_SEL) == port);
}
__override int svdm_dp_attention(int port, uint32_t *payload)