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 <rex-bc.chen@mediatek.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/70406
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Reviewed-by: Yidi Lin <yidilin@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Bo-Chen Chen 2022-11-30 15:16:47 +08:00 committed by Felix Held
parent c07ccd9aac
commit 7d94b2b489
1 changed files with 30 additions and 21 deletions

View File

@ -1,5 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <assert.h>
#include <console/console.h>
#include <delay.h>
#include <edid.h>
@ -7,45 +8,53 @@
#include <gpio.h>
#include <soc/ddp.h>
#include <soc/dptx.h>
#include <soc/dsi.h>
#include <soc/gpio_common.h>
#include <soc/mtcmos.h>
#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);