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 <john.zhao@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/69694
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com>
This commit is contained in:
zhaojohn 2022-11-16 20:37:01 -08:00 committed by Martin L Roth
parent 2b9ee5d79e
commit 7e0b925162
1 changed files with 2 additions and 18 deletions

View File

@ -202,7 +202,6 @@ static int send_pmc_dp_hpd_request(int port, const struct usbc_mux_info *mux_dat
req.buf[0] = cmd; req.buf[0] = cmd;
return send_pmc_req(HPD_REQ, &req, &rsp, PMC_IPC_HPD_REQ_SIZE); 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, 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) 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; size_t i;
const struct usbc_ops *ops; const struct usbc_ops *ops;
struct usbc_mux_info mux_info; 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) if (ops == NULL)
return; 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++) { 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); ret = ops->mux_ops.get_mux_info(i, &mux_info);
if (ret < 0) if ((ret < 0) || (!mux_info.dp))
continue; continue;
port_info = &port_map[i]; port_info = &port_map[i];