summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHung-Te Lin <hungte@chromium.org>2019-07-25 17:09:53 +0800
committerJulius Werner <jwerner@chromium.org>2019-08-15 00:54:12 +0000
commit00e1ee9242cc0796f09ddb2c019d3dce35e13832 (patch)
tree596fdd9ca8d11248626239c3b5f6f516fb849488
parent1d5fc281c88632268df8b796ca331c583d695436 (diff)
downloadcoreboot-00e1ee9242cc0796f09ddb2c019d3dce35e13832.tar.xz
mb/google/kukui: Support eDP panels via PS8640
Some Kukui variants may have eDP panels connected via a PS8640 MIPI bridge which we may retrieve EDID dynamically. BUG=b:b:137517228 TEST=emerge-jacuzzi coreboot chromeos-bootimage; boots and see display. Change-Id: I85aac5255e6a3e6019299670486214ecffbf9801 Signed-off-by: Hung-Te Lin <hungte@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/34516 Reviewed-by: Julius Werner <jwerner@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r--src/mainboard/google/kukui/Kconfig1
-rw-r--r--src/mainboard/google/kukui/Makefile.inc1
-rw-r--r--src/mainboard/google/kukui/panel_ps8640.c73
3 files changed, 75 insertions, 0 deletions
diff --git a/src/mainboard/google/kukui/Kconfig b/src/mainboard/google/kukui/Kconfig
index 863f49ee23..b4d0fda72a 100644
--- a/src/mainboard/google/kukui/Kconfig
+++ b/src/mainboard/google/kukui/Kconfig
@@ -41,6 +41,7 @@ config BOARD_SPECIFIC_OPTIONS
select MAINBOARD_HAS_NATIVE_VGA_INIT
select MAINBOARD_FORCE_NATIVE_VGA_INIT
select HAVE_LINEAR_FRAMEBUFFER
+ select DRIVER_PARADE_PS8640 if BOARD_GOOGLE_JACUZZI
config MAINBOARD_DIR
string
diff --git a/src/mainboard/google/kukui/Makefile.inc b/src/mainboard/google/kukui/Makefile.inc
index 3f3d931c46..e34bff17fb 100644
--- a/src/mainboard/google/kukui/Makefile.inc
+++ b/src/mainboard/google/kukui/Makefile.inc
@@ -27,4 +27,5 @@ ramstage-y += memlayout.ld
ramstage-$(CONFIG_BOARD_GOOGLE_KODAMA) += panel_kodama.c
ramstage-$(CONFIG_BOARD_GOOGLE_KRANE) += panel_krane.c
ramstage-$(CONFIG_BOARD_GOOGLE_KUKUI) += panel_kukui.c
+ramstage-$(CONFIG_DRIVER_PARADE_PS8640) += panel_ps8640.c
ramstage-y += reset.c
diff --git a/src/mainboard/google/kukui/panel_ps8640.c b/src/mainboard/google/kukui/panel_ps8640.c
new file mode 100644
index 0000000000..d2f65a8d95
--- /dev/null
+++ b/src/mainboard/google/kukui/panel_ps8640.c
@@ -0,0 +1,73 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2019 Google Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <console/console.h>
+#include <delay.h>
+#include <drivers/parade/ps8640/ps8640.h>
+#include <edid.h>
+#include <gpio.h>
+#include <soc/i2c.h>
+#include <string.h>
+
+#include "panel.h"
+
+
+static void power_on_ps8640(void)
+{
+ gpio_output(GPIO_MIPIBRDG_RST_L_1V8, 0);
+ gpio_output(GPIO_PP1200_MIPIBRDG_EN, 1);
+ gpio_output(GPIO_VDDIO_MIPIBRDG_EN, 1);
+ mdelay(2);
+ gpio_output(GPIO_MIPIBRDG_PWRDN_L_1V8, 1);
+ mdelay(2);
+ gpio_output(GPIO_MIPIBRDG_RST_L_1V8, 1);
+ gpio_output(GPIO_PP3300_LCM_EN, 1);
+}
+
+static void dummy_power_on(void)
+{
+ /* The panel has been already powered on when getting panel information
+ * so we should do nothing here.
+ */
+}
+
+static struct panel_description ps8640_panel = {
+ .power_on = dummy_power_on,
+ .orientation = LB_FB_ORIENTATION_NORMAL,
+ .init = { INIT_END_CMD },
+};
+
+struct panel_description *get_panel_description(int panel_id)
+{
+ static char mode_name[64];
+
+ /* To read panel EDID, we have to first power on PS8640. */
+ power_on_ps8640();
+
+ u8 i2c_bus = 4, i2c_addr = 0x08;
+ mtk_i2c_bus_init(i2c_bus);
+
+ ps8640_init(i2c_bus, i2c_addr);
+ struct edid *edid = &ps8640_panel.edid;
+ if (ps8640_get_edid(i2c_bus, i2c_addr, edid)) {
+ printk(BIOS_ERR, "Can't get panel's edid\n");
+ return NULL;
+ }
+ /* TODO(hungte) Move this to ps8640_get_edid */
+ snprintf(mode_name, sizeof(mode_name), "%dx%d@%dHz", edid->x_resolution,
+ edid->y_resolution, edid->mode.refresh);
+ ps8640_panel.edid.mode.name = mode_name;
+ return &ps8640_panel;
+}