mb/google/cherry: enable display support

To enable display, we have to:
1. Configure panel power and backlight
2. Configure eDP driver

BUG=b:189985956

Signed-off-by: Jitao Shi <jitao.shi@mediatek.com>
Change-Id: Ida6c157a6a3bd904d3fa3dd2001385ced34f7711
Reviewed-on: https://review.coreboot.org/c/coreboot/+/55574
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Jitao Shi 2021-06-03 13:51:29 +08:00 committed by Hung-Te Lin
parent 56126604e0
commit f2c259cf2a
1 changed files with 68 additions and 0 deletions

View File

@ -6,10 +6,15 @@
#include <delay.h> #include <delay.h>
#include <device/device.h> #include <device/device.h>
#include <device/mmio.h> #include <device/mmio.h>
#include <edid.h>
#include <framebuffer_info.h>
#include <gpio.h> #include <gpio.h>
#include <soc/ddp.h>
#include <soc/dptx.h>
#include <soc/gpio.h> #include <soc/gpio.h>
#include <soc/i2c.h> #include <soc/i2c.h>
#include <soc/mt6360.h> #include <soc/mt6360.h>
#include <soc/mtcmos.h>
#include <soc/regulator.h> #include <soc/regulator.h>
#include <soc/spm.h> #include <soc/spm.h>
#include <soc/usb.h> #include <soc/usb.h>
@ -18,6 +23,12 @@
#include <arm-trusted-firmware/include/export/plat/mediatek/common/plat_params_exp.h> #include <arm-trusted-firmware/include/export/plat/mediatek/common/plat_params_exp.h>
/* GPIO to schematics names */
#define GPIO_AP_EDP_BKLTEN GPIO(DGI_D5)
#define GPIO_BL_PWM_1V8 GPIO(DISP_PWM0)
#define GPIO_EDP_HPD_1V8 GPIO(GPIO_07)
#define GPIO_EN_PP3300_DISP_X GPIO(I2SO1_D2)
DEFINE_BITFIELD(MSDC0_DRV, 29, 0) DEFINE_BITFIELD(MSDC0_DRV, 29, 0)
DEFINE_BITFIELD(MSDC1_DRV, 17, 0) DEFINE_BITFIELD(MSDC1_DRV, 17, 0)
DEFINE_BITFIELD(MSDC1_GPIO_MODE0_0, 26, 24) DEFINE_BITFIELD(MSDC1_GPIO_MODE0_0, 26, 24)
@ -119,8 +130,65 @@ static void configure_sdcard(void)
mt6360_ldo_enable(MT6360_LDO5, 1); mt6360_ldo_enable(MT6360_LDO5, 1);
} }
/* Set up backlight control pins as output pin and power-off by default */
static void configure_panel_backlight(void)
{
gpio_output(GPIO_AP_EDP_BKLTEN, 0);
gpio_output(GPIO_BL_PWM_1V8, 0);
}
static void power_on_panel(void)
{
/* Default power sequence for most panels. */
gpio_set_pull(GPIO_EDP_HPD_1V8, GPIO_PULL_ENABLE, GPIO_PULL_UP);
gpio_set_mode(GPIO_EDP_HPD_1V8, 2);
gpio_output(GPIO_EN_PP3300_DISP_X, 1);
}
static bool configure_display(void)
{
struct edid edid;
struct fb_info *info;
const char *name;
printk(BIOS_INFO, "%s: Starting display initialization\n", __func__);
mtcmos_display_power_on();
mtcmos_protect_display_bus();
configure_panel_backlight();
power_on_panel();
mtk_ddp_init();
mdelay(200);
if (mtk_edp_init(&edid) < 0) {
printk(BIOS_ERR, "%s: Failed to initialize eDP\n", __func__);
return false;
}
name = edid.ascii_string;
if (name[0] == '\0')
name = "unknown name";
printk(BIOS_INFO, "%s: '%s %s' %dx%d@%dHz\n", __func__,
edid.manufacturer_name, name, edid.mode.ha, edid.mode.va,
edid.mode.refresh);
edid_set_framebuffer_bits_per_pixel(&edid, 32, 0);
mtk_ddp_mode_set(&edid);
info = fb_new_framebuffer_info_from_edid(&edid, (uintptr_t)0);
if (info)
fb_set_orientation(info, LB_FB_ORIENTATION_NORMAL);
return true;
}
static void mainboard_init(struct device *dev) static void mainboard_init(struct device *dev)
{ {
if (display_init_required())
configure_display();
else
printk(BIOS_INFO, "%s: Skipped display initialization\n", __func__);
configure_emmc(); configure_emmc();
configure_sdcard(); configure_sdcard();
setup_usb_host(); setup_usb_host();