From 6ba2df9be55dc90694067c76763918e8b26decc1 Mon Sep 17 00:00:00 2001 From: Vince Liu Date: Tue, 19 Aug 2025 18:08:02 +0800 Subject: [PATCH] soc/mediatek/common: Use polling to reduce eDP HPD wait time Some eDP panels assert HPD (Hot Plug Detect) after panel VCC is enabled, typically around 200ms. To reduce boot time, this commit replaces the original fixed 200ms delay with polling for the HPD status, shortening the waiting period to approximately 70ms. Once the HPD pin is detected high, an additional delay of around 1ms is introduced to ensure the AUX channel is ready for EDID reading. BUG=b:434574691,b:439535227,b:439476647 BRANCH=none TEST=Check firmware display on Navi and Skywalker Signed-off-by: Bincai Liu Signed-off-by: Vince Liu Change-Id: I6702c79416700b44d4bfbc763b6fc6003feb69b5 Reviewed-on: https://review.coreboot.org/c/coreboot/+/88864 Reviewed-by: Hung-Te Lin Reviewed-by: Yu-Ping Wu Reviewed-by: Paul Menzel Tested-by: build bot (Jenkins) Reviewed-by: Yidi Lin --- src/soc/mediatek/common/display.c | 1 - src/soc/mediatek/common/dp/dptx_common.c | 3 ++- src/soc/mediatek/common/dp/include/soc/dptx_common.h | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/soc/mediatek/common/display.c b/src/soc/mediatek/common/display.c index 417a764499..c805c6d664 100644 --- a/src/soc/mediatek/common/display.c +++ b/src/soc/mediatek/common/display.c @@ -90,7 +90,6 @@ int mtk_display_init(void) process_panel_quirks(&mtk_edp, panel); if (panel->disp_path == DISP_PATH_EDP) { - mdelay(200); if (mtk_edp_init(&mtk_edp, &edid) < 0) { printk(BIOS_ERR, "%s: Failed to initialize eDP\n", __func__); return -1; diff --git a/src/soc/mediatek/common/dp/dptx_common.c b/src/soc/mediatek/common/dp/dptx_common.c index 9c6cdcba4d..342f742a2c 100644 --- a/src/soc/mediatek/common/dp/dptx_common.c +++ b/src/soc/mediatek/common/dp/dptx_common.c @@ -549,10 +549,11 @@ int mtk_edp_init(struct mtk_dp *mtk_dp, struct edid *edid) dptx_init_variable(mtk_dp); dptx_init_port(mtk_dp); - if (!dptx_hal_hpd_high(mtk_dp)) { + if (!wait_ms(HPD_WAIT_TIMEOUT_MS, dptx_hal_hpd_high(mtk_dp))) { printk(BIOS_ERR, "HPD is low\n"); return -1; } + mdelay(WAIT_AUX_READY_TIME_MS); dptx_check_sinkcap(mtk_dp); diff --git a/src/soc/mediatek/common/dp/include/soc/dptx_common.h b/src/soc/mediatek/common/dp/include/soc/dptx_common.h index b65948fbad..8a42a63996 100644 --- a/src/soc/mediatek/common/dp/include/soc/dptx_common.h +++ b/src/soc/mediatek/common/dp/include/soc/dptx_common.h @@ -69,6 +69,9 @@ #define MAX_LANECOUNT 4 +#define HPD_WAIT_TIMEOUT_MS 200 +#define WAIT_AUX_READY_TIME_MS 1 + enum { DP_LANECOUNT_1 = 0x1, DP_LANECOUNT_2 = 0x2,