From 4ae6fd792aee06acb5b9d1ed454b3a129f7144df Mon Sep 17 00:00:00 2001 From: Yidi Lin Date: Thu, 27 Mar 2025 12:52:56 +0800 Subject: [PATCH] soc/mediatek/common/display: Add force max swing quirk A 'quirks' variable is added for panels that require special handling in the display driver due to sensitivity to the eDP signal quality. The display driver can then handle the special requests accordingly. On Navi, the swing level needs to be increased to 3 (500mV) for the ATNA40HQ01-0 panel to resolve a flickering issue. BRANCH=rauru BUG=b:392040003 TEST=check edp training pass and show log: [INFO ] fw_config match found: OLED_WQXGA_PLUS=PRESENT ... [INFO ] update_swing_preemphasis: Force swing setting to 3 (500 mV) Signed-off-by: Bincai Liu Signed-off-by: Yidi Lin Change-Id: Ifa8c45050f61d3dff1fa7aed8fa8e435391a6f3a Reviewed-on: https://review.coreboot.org/c/coreboot/+/86999 Tested-by: build bot (Jenkins) Reviewed-by: Yu-Ping Wu --- src/soc/mediatek/common/display.c | 8 ++++++++ src/soc/mediatek/common/dp/include/soc/dptx_common.h | 1 + src/soc/mediatek/common/include/soc/display.h | 3 +++ src/soc/mediatek/mt8196/dptx.c | 8 +++++++- 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/soc/mediatek/common/display.c b/src/soc/mediatek/common/display.c index c7493feeb8..417a764499 100644 --- a/src/soc/mediatek/common/display.c +++ b/src/soc/mediatek/common/display.c @@ -56,6 +56,13 @@ __weak int mtk_dsi_init(u32 mode_flags, u32 format, u32 lanes, return -1; } +static void process_panel_quirks(struct mtk_dp *mtk_dp, + struct panel_description *panel) +{ + if (panel->quirks & PANEL_QUIRK_FORCE_MAX_SWING) + mtk_dp->force_max_swing = true; +} + int mtk_display_init(void) { struct edid edid = {0}; @@ -80,6 +87,7 @@ int mtk_display_init(void) panel->power_on(); mtk_ddp_init(); + process_panel_quirks(&mtk_edp, panel); if (panel->disp_path == DISP_PATH_EDP) { mdelay(200); 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 2ea070eca7..af8c9dce6d 100644 --- a/src/soc/mediatek/common/dp/include/soc/dptx_common.h +++ b/src/soc/mediatek/common/dp/include/soc/dptx_common.h @@ -212,6 +212,7 @@ struct mtk_dp { bool dsc_enable; bool enabled; bool powered; + bool force_max_swing; }; int mtk_edp_init(struct mtk_dp *mtk_dp, struct edid *edid); diff --git a/src/soc/mediatek/common/include/soc/display.h b/src/soc/mediatek/common/include/soc/display.h index 61bc21fc98..2881505860 100644 --- a/src/soc/mediatek/common/include/soc/display.h +++ b/src/soc/mediatek/common/include/soc/display.h @@ -12,6 +12,8 @@ enum disp_path_sel { DISP_PATH_MIPI, }; +#define PANEL_QUIRK_FORCE_MAX_SWING BIT(0) + struct panel_description { const char *name; void (*configure_backlight)(void); @@ -21,6 +23,7 @@ struct panel_description { enum lb_fb_orientation orientation; enum disp_path_sel disp_path; bool pwm_ctrl_gpio; + uint32_t quirks; }; int mtk_display_init(void); diff --git a/src/soc/mediatek/mt8196/dptx.c b/src/soc/mediatek/mt8196/dptx.c index 926850a675..b892b1a562 100644 --- a/src/soc/mediatek/mt8196/dptx.c +++ b/src/soc/mediatek/mt8196/dptx.c @@ -61,7 +61,13 @@ static void update_swing_preemphasis(struct mtk_dp *mtk_dp, u8 lane_count, int shift = lane % 2 ? DP_ADJUST_VOLTAGE_SWING_LANE1_SHIFT : 0; u8 swing_value = dpcd_adjust_req[index] >> shift; - swing_val[lane] = swing_value & DP_ADJUST_VOLTAGE_SWING_LANE0_MASK; + if (mtk_dp->force_max_swing) { + swing_val[lane] = DPTX_SWING3; + printk(BIOS_INFO, "%s: Force swing setting to %u (500 mV)\n", + __func__, swing_val[lane]); + } else { + swing_val[lane] = swing_value & DP_ADJUST_VOLTAGE_SWING_LANE0_MASK; + } preemphasis[lane] = swing_value & DP_ADJUST_PRE_EMPHASIS_LANE0_MASK; preemphasis[lane] >>= DP_ADJUST_PRE_EMPHASIS_LANE0_SHIFT; val = swing_val[lane] << DP_TRAIN_VOLTAGE_SWING_SHIFT |