From 7d94b2b489ae4406c1fbd3cdf2c90de59865a405 Mon Sep 17 00:00:00 2001 From: Bo-Chen Chen Date: Wed, 30 Nov 2022 15:16:47 +0800 Subject: mb/google/geralt: Add support for MIPI display Both eDP and MIPI interfaces are supported in geralt project, so we can initialize the different displays according to the panel ID. This patch also generalizes the display initialization. So `configure_edp_panel_backlight` and `power_on_edp_panel` can be removed. BUG=b:244208960 TEST=test firmware display pass for MIPI panel on MT8188 EVB. Change-Id: I7ae9318f56c70446516e197635acaffb8197ab53 Signed-off-by: Bo-Chen Chen Reviewed-on: https://review.coreboot.org/c/coreboot/+/70406 Reviewed-by: Yu-Ping Wu Reviewed-by: Yidi Lin Tested-by: build bot (Jenkins) --- src/mainboard/google/geralt/display.c | 51 ++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 21 deletions(-) (limited to 'src/mainboard') diff --git a/src/mainboard/google/geralt/display.c b/src/mainboard/google/geralt/display.c index 5c81434fea..396d6e0c03 100644 --- a/src/mainboard/google/geralt/display.c +++ b/src/mainboard/google/geralt/display.c @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ +#include #include #include #include @@ -7,45 +8,53 @@ #include #include #include +#include #include #include #include "display.h" -#include "gpio.h" - -/* Set up backlight control pins as output pin and power-off by default */ -static void configure_edp_panel_backlight(void) -{ - gpio_output(GPIO_AP_DISP_BKLTEN, 0); - gpio_output(GPIO_EDP_BL_PWM_1V8, 0); -} - -static void power_on_edp_panel(void) -{ - gpio_output(GPIO_EN_PP3300_EDP_DISP_X, 1); - gpio_set_pull(GPIO_EDP_HPD_1V8, GPIO_PULL_ENABLE, GPIO_PULL_UP); - gpio_set_mode(GPIO_EDP_HPD_1V8, 4); -} +#include "panel.h" int configure_display(void) { struct edid edid; struct fb_info *info; const char *name; + struct panel_description *panel = get_active_panel(); + if (!panel) + return -1; printk(BIOS_INFO, "%s: Starting display initialization\n", __func__); mtcmos_display_power_on(); - configure_edp_panel_backlight(); - power_on_edp_panel(); + + panel->configure_panel_backlight(); + panel->power_on(); mtk_ddp_init(); mdelay(200); - if (mtk_edp_init(&edid) < 0) { - printk(BIOS_ERR, "%s: Failed to initialize eDP\n", __func__); - return -1; + if (panel->disp_path == DISP_PATH_EDP) { + if (mtk_edp_init(&edid) < 0) { + printk(BIOS_ERR, "%s: Failed to initialize eDP\n", __func__); + return -1; + } + + } else { + u32 mipi_dsi_flags = (MIPI_DSI_MODE_VIDEO | + MIPI_DSI_MODE_VIDEO_SYNC_PULSE | + MIPI_DSI_MODE_LPM | + MIPI_DSI_MODE_EOT_PACKET); + + edid = panel->s->edid; + + if (mtk_dsi_init(mipi_dsi_flags, MIPI_DSI_FMT_RGB888, 4, &edid, + panel->s->init) < 0) { + printk(BIOS_ERR, "%s: Failed in DSI init\n", __func__); + return -1; + } } + name = edid.ascii_string; if (name[0] == '\0') name = "unknown name"; @@ -55,7 +64,7 @@ int configure_display(void) edid_set_framebuffer_bits_per_pixel(&edid, 32, 0); - mtk_ddp_mode_set(&edid, DISP_PATH_EDP); + mtk_ddp_mode_set(&edid, panel->disp_path); info = fb_new_framebuffer_info_from_edid(&edid, (uintptr_t)0); if (info) fb_set_orientation(info, LB_FB_ORIENTATION_NORMAL); -- cgit v1.2.3