From 4a04a7bf10d7b2c372247fce297f7a69b85de250 Mon Sep 17 00:00:00 2001 From: Jitao Shi Date: Fri, 8 Jan 2016 16:02:13 +0800 Subject: mediatek/mt8173: Add display driver BRANCH=none BUG=none TEST=saw bootloader screen on rev4 and rev5 with CL:331813 Change-Id: Ibb01cf251276d2c059739f10e166fefd0de35460 Signed-off-by: Patrick Georgi Original-Commit-Id: 8d52a4c486b75b99dc25657ccb6ed90f671c26d6 Original-Change-Id: I4efe439d52b5a5516145960bcffb340152bfba53 Original-Signed-off-by: Jitao Shi Original-Reviewed-on: https://chromium-review.googlesource.com/331812 Original-Commit-Ready: Yidi Lin Original-Tested-by: Yidi Lin Original-Reviewed-by: Julius Werner Original-Reviewed-by: Daniel Kurtz Reviewed-on: https://review.coreboot.org/14689 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer --- src/mainboard/google/oak/Kconfig | 1 + src/mainboard/google/oak/mainboard.c | 54 +++++++++++++++++++++++++++++++++++- 2 files changed, 54 insertions(+), 1 deletion(-) (limited to 'src/mainboard') diff --git a/src/mainboard/google/oak/Kconfig b/src/mainboard/google/oak/Kconfig index 3bae9f7387..79d43d4b63 100644 --- a/src/mainboard/google/oak/Kconfig +++ b/src/mainboard/google/oak/Kconfig @@ -21,6 +21,7 @@ config BOARD_SPECIFIC_OPTIONS select BOARD_ID_AUTO select BOARD_ROMSIZE_KB_4096 select COMMON_CBFS_SPI_WRAPPER + select DRIVER_PARADE_PS8640 select EC_GOOGLE_CHROMEEC select EC_GOOGLE_CHROMEEC_SPI select MAINBOARD_HAS_NATIVE_VGA_INIT diff --git a/src/mainboard/google/oak/mainboard.c b/src/mainboard/google/oak/mainboard.c index e99a5c02de..6bd42e3686 100644 --- a/src/mainboard/google/oak/mainboard.c +++ b/src/mainboard/google/oak/mainboard.c @@ -17,12 +17,18 @@ #include #include #include +#include +#include #include #include +#include +#include #include #include #include +#include +#include #include #include #include @@ -146,6 +152,47 @@ static void configure_backlight(void) gpio_output(PAD_PCM_TX, 0); /* PANEL_POWER_EN */ } +static void display_startup(void) +{ + struct edid edid; + u8 i2c_bus; + int ret; + + switch (board_id()) { + case 0: + case 1: + i2c_bus = 3; + break; + default: + i2c_bus = 4; + break; + } + mtk_i2c_bus_init(i2c_bus); + + ps8640_init(i2c_bus, 0x18); + if (ps8640_get_edid(i2c_bus, 0x18, &edid)) { + printk(BIOS_ERR, "Can't get panel's edid\n"); + return; + } + + edid.x_resolution = edid.mode.ha; + edid.y_resolution = edid.mode.va; + edid.bytes_per_line = edid.mode.ha * edid.framebuffer_bits_per_pixel / + 8; + + mtk_ddp_init(); + ret = mtk_dsi_init(MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE, + MIPI_DSI_FMT_RGB888, 4, &edid); + if (ret < 0) { + printk(BIOS_ERR, "dsi init fail\n"); + return; + } + + mtk_ddp_mode_set(&edid); + + set_vbe_mode_info_valid(&edid, (uintptr_t)0); +} + static void mainboard_init(device_t dev) { /* TP_SHIFT_EN: Enables the level shifter for I2C bus 4 (TPAD), which @@ -158,7 +205,12 @@ static void mainboard_init(device_t dev) gpio_input(PAD_EINT1); /* SD_DET */ configure_audio(); - configure_backlight(); + if (display_init_required()) { + configure_backlight(); + display_startup(); + } else { + printk(BIOS_INFO, "Skipping display init.\n"); + } configure_usb(); configure_usb_hub(); configure_ext_buck(); -- cgit v1.2.3