summaryrefslogtreecommitdiff
path: root/src/mainboard
diff options
context:
space:
mode:
authorJitao Shi <jitao.shi@mediatek.com>2016-01-08 16:02:13 +0800
committerPatrick Georgi <pgeorgi@google.com>2016-05-09 08:31:49 +0200
commit4a04a7bf10d7b2c372247fce297f7a69b85de250 (patch)
tree8252c82ed94513e78cbf93554493d2ad88ad152c /src/mainboard
parent866cc3d66202ad29485bedb3f39dabe0ebf6d986 (diff)
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 <pgeorgi@chromium.org> Original-Commit-Id: 8d52a4c486b75b99dc25657ccb6ed90f671c26d6 Original-Change-Id: I4efe439d52b5a5516145960bcffb340152bfba53 Original-Signed-off-by: Jitao Shi <jitao.shi@mediatek.com> Original-Reviewed-on: https://chromium-review.googlesource.com/331812 Original-Commit-Ready: Yidi Lin <yidi.lin@mediatek.com> Original-Tested-by: Yidi Lin <yidi.lin@mediatek.com> Original-Reviewed-by: Julius Werner <jwerner@chromium.org> Original-Reviewed-by: Daniel Kurtz <djkurtz@chromium.org> Reviewed-on: https://review.coreboot.org/14689 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/mainboard')
-rw-r--r--src/mainboard/google/oak/Kconfig1
-rw-r--r--src/mainboard/google/oak/mainboard.c54
2 files changed, 54 insertions, 1 deletions
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 <arch/io.h>
#include <boardid.h>
#include <boot/coreboot_tables.h>
+#include <bootmode.h>
+#include <console/console.h>
#include <delay.h>
#include <device/device.h>
+#include <drivers/parade/ps8640/ps8640.h>
+#include <edid.h>
#include <elog.h>
#include <gpio.h>
#include <soc/da9212.h>
+#include <soc/ddp.h>
+#include <soc/dsi.h>
#include <soc/i2c.h>
#include <soc/mt6311.h>
#include <soc/mt6391.h>
@@ -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();