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 |