diff --git a/src/soc/mediatek/common/display.c b/src/soc/mediatek/common/display.c index a212805b5b..c7493feeb8 100644 --- a/src/soc/mediatek/common/display.c +++ b/src/soc/mediatek/common/display.c @@ -37,7 +37,13 @@ static struct panel_serializable_data *get_mipi_cmd_from_cbfs(struct panel_descr return NULL; } -__weak int mtk_edp_init(struct edid *edid) +__weak int mtk_edp_init(struct mtk_dp *mtk_dp, struct edid *edid) +{ + printk(BIOS_WARNING, "%s: Not supported\n", __func__); + return -1; +} + +__weak int mtk_edp_enable(struct mtk_dp *mtk_dp) { printk(BIOS_WARNING, "%s: Not supported\n", __func__); return -1; @@ -52,7 +58,8 @@ __weak int mtk_dsi_init(u32 mode_flags, u32 format, u32 lanes, int mtk_display_init(void) { - struct edid edid; + struct edid edid = {0}; + struct mtk_dp mtk_edp = {0}; struct fb_info *info; const char *name; struct panel_description *panel = get_active_panel(); @@ -76,7 +83,7 @@ int mtk_display_init(void) if (panel->disp_path == DISP_PATH_EDP) { mdelay(200); - if (mtk_edp_init(&edid) < 0) { + if (mtk_edp_init(&mtk_edp, &edid) < 0) { printk(BIOS_ERR, "%s: Failed to initialize eDP\n", __func__); return -1; } @@ -120,6 +127,14 @@ int mtk_display_init(void) edid_set_framebuffer_bits_per_pixel(&edid, 32, 0); mtk_ddp_mode_set(&edid, panel->disp_path); + + if (panel->disp_path == DISP_PATH_EDP) { + if (mtk_edp_enable(&mtk_edp) < 0) { + printk(BIOS_ERR, "%s: Failed to enable eDP\n", __func__); + return -1; + } + } + info = fb_new_framebuffer_info_from_edid(&edid, (uintptr_t)0); if (info) fb_set_orientation(info, panel->orientation); diff --git a/src/soc/mediatek/common/dp/dptx.c b/src/soc/mediatek/common/dp/dptx.c index b0afb897a3..6cf590d417 100644 --- a/src/soc/mediatek/common/dp/dptx.c +++ b/src/soc/mediatek/common/dp/dptx.c @@ -478,29 +478,32 @@ static void dptx_init_port(struct mtk_dp *mtk_dp) dptx_hal_hpd_int_en(mtk_dp, true); } -int mtk_edp_init(struct edid *edid) +int mtk_edp_init(struct mtk_dp *mtk_dp, struct edid *edid) { - struct mtk_dp mtk_edp; + dptx_init_variable(mtk_dp); + dptx_init_port(mtk_dp); - dptx_init_variable(&mtk_edp); - dptx_init_port(&mtk_edp); - - if (!dptx_hal_hpd_high(&mtk_edp)) { + if (!dptx_hal_hpd_high(mtk_dp)) { printk(BIOS_ERR, "HPD is low\n"); return -1; } - dptx_check_sinkcap(&mtk_edp); + dptx_check_sinkcap(mtk_dp); - if (dptx_get_edid(&mtk_edp, edid) != 0) { + if (dptx_get_edid(mtk_dp, edid) != 0) { printk(BIOS_ERR, "Failed to get EDID\n"); return -1; } - dptx_set_trainingstart(&mtk_edp); + dptx_set_trainingstart(mtk_dp); dp_intf_config(edid); - dptx_video_config(&mtk_edp); - dptx_video_enable(&mtk_edp, true); + dptx_video_config(mtk_dp); return 0; } + +int mtk_edp_enable(struct mtk_dp *mtk_dp) +{ + dptx_video_enable(mtk_dp, true); + return 0; +} 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 1d7e135529..3ed71a9dda 100644 --- a/src/soc/mediatek/common/dp/include/soc/dptx_common.h +++ b/src/soc/mediatek/common/dp/include/soc/dptx_common.h @@ -211,7 +211,9 @@ struct mtk_dp { bool powered; }; -int mtk_edp_init(struct edid *edid); +int mtk_edp_init(struct mtk_dp *mtk_dp, struct edid *edid); +int mtk_edp_enable(struct mtk_dp *mtk_dp); + bool dptx_auxread_dpcd(struct mtk_dp *mtk_dp, u8 cmd, u32 dpcd_addr, size_t length, u8 *rxbuf); bool dptx_auxwrite_dpcd(struct mtk_dp *mtk_dp, u8 cmd, u32 dpcd_addr,