summaryrefslogtreecommitdiff
path: root/src/mainboard/google
diff options
context:
space:
mode:
authorHuijuan Xie <huijuan.xie@mediatek.corp-partner.google.com>2020-08-11 17:55:11 +0800
committerHung-Te Lin <hungte@chromium.org>2020-12-15 01:53:26 +0000
commitbde97082007775664ffff3c0efadc50ea9e50c40 (patch)
tree7990fd8bfd8708df1e552d5128c5f4f22cdfa117 /src/mainboard/google
parent4b3269e21d50da6ce33b72f356b6714e58f7478f (diff)
mb/google/asurada: Initialize display
Enable ANX7625 panel and configure display in mainboard_init() to support display in firmware screen. BUG=b:155713214 BRANCH=none TEST=Recovery screen is shown in recovery mode. Signed-off-by: Huijuan Xie <huijuan.xie@mediatek.corp-partner.google.com> Change-Id: If730c42451f7b392285df686abc4ca252d8d42cf Reviewed-on: https://review.coreboot.org/c/coreboot/+/46578 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Diffstat (limited to 'src/mainboard/google')
-rw-r--r--src/mainboard/google/asurada/Kconfig1
-rw-r--r--src/mainboard/google/asurada/mainboard.c95
2 files changed, 96 insertions, 0 deletions
diff --git a/src/mainboard/google/asurada/Kconfig b/src/mainboard/google/asurada/Kconfig
index 7c93815ae8..5f5ed856be 100644
--- a/src/mainboard/google/asurada/Kconfig
+++ b/src/mainboard/google/asurada/Kconfig
@@ -27,6 +27,7 @@ config BOARD_SPECIFIC_OPTIONS
select MAINBOARD_HAS_NATIVE_VGA_INIT
select MAINBOARD_FORCE_NATIVE_VGA_INIT
select HAVE_LINEAR_FRAMEBUFFER
+ select DRIVER_ANALOGIX_ANX7625
config MAINBOARD_DIR
string
diff --git a/src/mainboard/google/asurada/mainboard.c b/src/mainboard/google/asurada/mainboard.c
index 32bd407817..8e7f2e8480 100644
--- a/src/mainboard/google/asurada/mainboard.c
+++ b/src/mainboard/google/asurada/mainboard.c
@@ -1,11 +1,21 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <bl31.h>
+#include <bootmode.h>
#include <console/console.h>
+#include <delay.h>
#include <device/device.h>
#include <device/mmio.h>
+#include <drivers/analogix/anx7625/anx7625.h>
+#include <edid.h>
+#include <gpio.h>
+#include <soc/ddp.h>
#include <soc/dpm.h>
+#include <soc/dsi.h>
#include <soc/gpio.h>
+#include <soc/gpio_common.h>
+#include <soc/i2c.h>
+#include <soc/mtcmos.h>
#include <soc/regulator.h>
#include <soc/spm.h>
#include <soc/usb.h>
@@ -27,6 +37,17 @@
#define MSDC1_GPIO_MODE1_MASK 0x7
#define MSDC1_GPIO_MODE1_VALUE 0x1
+/* GPIO names */
+#define GPIO_EDPBRDG_INT_ODL GPIO(EINT6) /* 6 */
+#define GPIO_EDPBRDG_PWREN GPIO(DSI_TE) /* 41 */
+#define GPIO_EDPBRDG_RST_ODL GPIO(LCM_RST) /* 42 */
+#define GPIO_EN_PP3300_EDP_DX GPIO(PERIPHERAL_EN1) /* 127 */
+#define GPIO_EN_PP1800_EDPBRDG_DX GPIO(PERIPHERAL_EN2) /* 128 */
+#define GPIO_EN_PP1000_EDPBRDG GPIO(PERIPHERAL_EN3) /* 129 */
+#define GPIO_EN_PP3300_DISPLAY_DX GPIO(CAM_CLK3) /* 136 */
+#define GPIO_AP_EDP_BKLTEN GPIO(KPROW1) /* 152 */
+#define GPIO_BL_PWM_1V8 GPIO(DISP_PWM) /* 40 */
+
static void register_reset_to_bl31(void)
{
static struct bl_aux_param_gpio param_reset = {
@@ -38,6 +59,75 @@ static void register_reset_to_bl31(void)
register_bl31_aux_param(&param_reset.h);
}
+/* Set up backlight control pins as output pin and power-off by default */
+static void configure_backlight_and_bridge(void)
+{
+ /* Disable backlight before turning on bridge */
+ gpio_output(GPIO_AP_EDP_BKLTEN, 0);
+ gpio_output(GPIO_BL_PWM_1V8, 0);
+ gpio_output(GPIO_EN_PP3300_DISPLAY_DX, 1);
+
+ /* Turn on bridge */
+ gpio_output(GPIO_EDPBRDG_RST_ODL, 0);
+ gpio_output(GPIO_EN_PP1000_EDPBRDG, 1);
+ gpio_output(GPIO_EN_PP1800_EDPBRDG_DX, 1);
+ gpio_output(GPIO_EN_PP3300_EDP_DX, 1);
+ mdelay(2);
+ gpio_output(GPIO_EDPBRDG_PWREN, 1);
+ mdelay(10);
+ gpio_output(GPIO_EDPBRDG_RST_ODL, 1);
+}
+
+static bool configure_display(void)
+{
+ struct edid edid;
+ const u8 i2c_bus = 3;
+
+ printk(BIOS_INFO, "%s: Starting display init\n", __func__);
+
+ configure_backlight_and_bridge();
+ mtk_i2c_bus_init(i2c_bus);
+
+ if (anx7625_init(i2c_bus)) {
+ printk(BIOS_ERR, "%s: Can't init ANX7625 bridge\n", __func__);
+ return false;
+ }
+
+ if (anx7625_dp_get_edid(i2c_bus, &edid)) {
+ printk(BIOS_ERR, "%s: Can't get panel's edid\n", __func__);
+ return false;
+ }
+ if (anx7625_dp_start(i2c_bus, &edid) < 0) {
+ printk(BIOS_ERR, "%s: Can't start display via ANX7625\n", __func__);
+ return false;
+ }
+
+ const char *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);
+
+ mtcmos_display_power_on();
+ mtcmos_protect_display_bus();
+
+ edid_set_framebuffer_bits_per_pixel(&edid, 32, 0);
+ mtk_ddp_init();
+ u32 mipi_dsi_flags = (MIPI_DSI_MODE_VIDEO |
+ MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
+ MIPI_DSI_MODE_LPM |
+ MIPI_DSI_MODE_EOT_PACKET);
+
+ if (mtk_dsi_init(mipi_dsi_flags, MIPI_DSI_FMT_RGB888, 4, &edid, NULL) < 0) {
+ printk(BIOS_ERR, "%s: Failed in DSI init\n", __func__);
+ return false;
+ }
+ mtk_ddp_mode_set(&edid);
+ set_vbe_mode_info_valid(&edid, 0);
+ return true;
+}
+
static void configure_emmc(void)
{
void *gpio_base = (void *)IOCFG_TL_BASE;
@@ -115,6 +205,11 @@ static void mainboard_init(struct device *dev)
if (spm_init())
printk(BIOS_ERR, "spm init fail, system suspend may stuck\n");
+
+ if (display_init_required())
+ configure_display();
+ else
+ printk(BIOS_INFO, "%s: Skipped display init\n", __func__);
}
static void mainboard_enable(struct device *dev)