diff options
author | Wai-Hong Tam <waihong@google.com> | 2022-12-02 14:24:00 -0800 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-01-06 00:47:59 +0000 |
commit | 1c6a7642d30058b3accf108e09210b18abb4dff4 (patch) | |
tree | f773b9293bc1a635a79e0e41b022d08bb1696a27 /baseboard | |
parent | 5a99b9b38428215cce0f3c660f003919652595e2 (diff) | |
download | chrome-ec-1c6a7642d30058b3accf108e09210b18abb4dff4.tar.gz |
trogdor: Handle HPD High embedded in DP-Status VDM
The HPD state is a field of the DP-Status VDO. The DP-Status VDO is
embedded in either the DP-Status VDM or the Attention VDM.
The DP-Status happens before the DP-Config. The pin assignment of the
PD partner hasn't been set up yet. Passing through the HPD to the DP
PHY is too early. Racing it may fail the link-training. Should wait
until the DP-Config is done.
BRANCH=trogdor
BUG=b:247005613
TEST=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: I796bc459659ddccf860f540de9409159e3c99d36
Signed-off-by: Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4076561
Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
Commit-Queue: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Diffstat (limited to 'baseboard')
-rw-r--r-- | baseboard/trogdor/usb_pd_policy.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/baseboard/trogdor/usb_pd_policy.c b/baseboard/trogdor/usb_pd_policy.c index f707882511..2e064518e0 100644 --- a/baseboard/trogdor/usb_pd_policy.c +++ b/baseboard/trogdor/usb_pd_policy.c @@ -117,8 +117,6 @@ __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. @@ -135,6 +133,19 @@ __override void svdm_dp_post_config(int port) */ usb_mux_set(port, USB_PD_MUX_DOCK, USB_SWITCH_CONNECT, polarity_rm_dts(pd_get_polarity(port))); + + dp_flags[port] |= DP_FLAGS_DP_ON; + if (!(dp_flags[port] & DP_FLAGS_HPD_HI_PENDING)) + return; + + CPRINTS("C%d: Pending HPD. HPD->1", port); + gpio_set_level(GPIO_DP_HOT_PLUG_DET, 1); + + /* set the minimum time delay (2ms) for the next HPD IRQ */ + svdm_hpd_deadline[port] = get_time().val + HPD_USTREAM_DEBOUNCE_LVL; + + usb_mux_hpd_update(port, + USB_PD_MUX_HPD_LVL | USB_PD_MUX_HPD_IRQ_DEASSERTED); } /** @@ -225,6 +236,13 @@ __override int svdm_dp_attention(int port, uint32_t *payload) */ pd_notify_dp_alt_mode_entry(port); + /* Its initial DP status message prior to config */ + if (!(dp_flags[port] & DP_FLAGS_DP_ON)) { + if (lvl) + dp_flags[port] |= DP_FLAGS_HPD_HI_PENDING; + return 1; + } + /* Configure TCPC for the HPD event, for proper muxing */ mux_state = (lvl ? USB_PD_MUX_HPD_LVL : USB_PD_MUX_HPD_LVL_DEASSERTED) | (irq ? USB_PD_MUX_HPD_IRQ : USB_PD_MUX_HPD_IRQ_DEASSERTED); @@ -264,6 +282,8 @@ __override int svdm_dp_attention(int port, uint32_t *payload) __override void svdm_exit_dp_mode(int port) { CPRINTS("%s(%d)", __func__, port); + dp_flags[port] = 0; + dp_status[port] = 0; if (is_dp_muxable(port)) { /* Disconnect the DP port selection mux. */ gpio_set_level(GPIO_DP_MUX_OE_L, 1); |