From 7e0b925162201060dc49e7e46b0715151d890583 Mon Sep 17 00:00:00 2001 From: zhaojohn Date: Wed, 16 Nov 2022 20:37:01 -0800 Subject: [PATCH] soc/intel/common: Fix the TCSS DisplayPort detection flow After DisplayPort is plugged into type-C port, its hpd signal instantly presents and EC has mux_info for dp and hpd. This change fixes the DP detection flow to avoid the 1 second delay while no DP is connected. If DP is present, there will be requests towards PMC through the sequence of connect, safe mode, dp and hpd mode. BUG=b:247670186 TEST=Built image and validated the DisplayPort preboot feature on Rex. Change-Id: I7cb95ec7fcc7e1a86e86466e6d45390eedcc4531 Signed-off-by: zhaojohn Reviewed-on: https://review.coreboot.org/c/coreboot/+/69694 Tested-by: build bot (Jenkins) Reviewed-by: Eric Lai --- src/soc/intel/common/block/tcss/tcss.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/src/soc/intel/common/block/tcss/tcss.c b/src/soc/intel/common/block/tcss/tcss.c index df331c2abe..b4a5a0eff6 100644 --- a/src/soc/intel/common/block/tcss/tcss.c +++ b/src/soc/intel/common/block/tcss/tcss.c @@ -202,7 +202,6 @@ static int send_pmc_dp_hpd_request(int port, const struct usbc_mux_info *mux_dat req.buf[0] = cmd; return send_pmc_req(HPD_REQ, &req, &rsp, PMC_IPC_HPD_REQ_SIZE); - } static int send_pmc_dp_mode_request(int port, const struct usbc_mux_info *mux_data, @@ -287,7 +286,7 @@ static void tcss_init_mux(int port, const struct tcss_port_map *port_map) static void tcss_configure_dp_mode(const struct tcss_port_map *port_map, size_t num_ports) { - int ret, port_bitmask; + int ret; size_t i; const struct usbc_ops *ops; struct usbc_mux_info mux_info; @@ -300,24 +299,9 @@ static void tcss_configure_dp_mode(const struct tcss_port_map *port_map, size_t if (ops == NULL) return; - port_bitmask = ops->dp_ops.wait_for_connection(WAIT_FOR_DISPLAYPORT_TIMEOUT_MS); - if (!port_bitmask) /* No DP device is connected */ - return; - for (i = 0; i < num_ports; i++) { - if (!(port_bitmask & BIT(i))) - continue; - - ret = ops->dp_ops.enter_dp_mode(i); - if (ret < 0) - continue; - - ret = ops->dp_ops.wait_for_hpd(i, WAIT_FOR_HPD_TIMEOUT_MS); - if (ret < 0) - continue; - ret = ops->mux_ops.get_mux_info(i, &mux_info); - if (ret < 0) + if ((ret < 0) || (!mux_info.dp)) continue; port_info = &port_map[i];