diff options
Diffstat (limited to 'src/mainboard/google/geralt')
-rw-r--r-- | src/mainboard/google/geralt/Kconfig | 2 | ||||
-rw-r--r-- | src/mainboard/google/geralt/Makefile.inc | 1 | ||||
-rw-r--r-- | src/mainboard/google/geralt/display.c | 64 | ||||
-rw-r--r-- | src/mainboard/google/geralt/display.h | 8 | ||||
-rw-r--r-- | src/mainboard/google/geralt/gpio.h | 5 | ||||
-rw-r--r-- | src/mainboard/google/geralt/mainboard.c | 9 |
6 files changed, 89 insertions, 0 deletions
diff --git a/src/mainboard/google/geralt/Kconfig b/src/mainboard/google/geralt/Kconfig index 11a2d7bc04..a911cb8215 100644 --- a/src/mainboard/google/geralt/Kconfig +++ b/src/mainboard/google/geralt/Kconfig @@ -28,6 +28,8 @@ config BOARD_SPECIFIC_OPTIONS select I2C_TPM if VBOOT select MAINBOARD_HAS_TPM2 if VBOOT select TPM_GOOGLE_TI50 if VBOOT + select MAINBOARD_HAS_NATIVE_VGA_INIT + select HAVE_LINEAR_FRAMEBUFFER config MAINBOARD_DIR string diff --git a/src/mainboard/google/geralt/Makefile.inc b/src/mainboard/google/geralt/Makefile.inc index 8da2ecf156..85748ddffe 100644 --- a/src/mainboard/google/geralt/Makefile.inc +++ b/src/mainboard/google/geralt/Makefile.inc @@ -15,6 +15,7 @@ romstage-y += sdram_configs.c ramstage-y += memlayout.ld ramstage-y += boardid.c ramstage-y += chromeos.c +ramstage-y += display.c ramstage-y += mainboard.c ramstage-y += regulator.c ramstage-y += reset.c diff --git a/src/mainboard/google/geralt/display.c b/src/mainboard/google/geralt/display.c new file mode 100644 index 0000000000..3db917143d --- /dev/null +++ b/src/mainboard/google/geralt/display.c @@ -0,0 +1,64 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <console/console.h> +#include <delay.h> +#include <edid.h> +#include <framebuffer_info.h> +#include <gpio.h> +#include <soc/ddp.h> +#include <soc/dptx.h> +#include <soc/gpio_common.h> +#include <soc/mtcmos.h> + +#include "display.h" +#include "gpio.h" + +/* Set up backlight control pins as output pin and power-off by default */ +static void configure_edp_panel_backlight(void) +{ + gpio_output(GPIO_AP_EDP_BKLTEN, 0); + gpio_output(GPIO_EDP_BL_PWM_1V8, 0); +} + +static void power_on_edp_panel(void) +{ + gpio_output(GPIO_EN_PP3300_EDP_DISP_X, 1); + gpio_set_pull(GPIO_EDP_HPD_1V8, GPIO_PULL_ENABLE, GPIO_PULL_UP); + gpio_set_mode(GPIO_EDP_HPD_1V8, 4); +} + +int 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(); + configure_edp_panel_backlight(); + power_on_edp_panel(); + + mtk_ddp_init(); + mdelay(200); + + if (mtk_edp_init(&edid) < 0) { + printk(BIOS_ERR, "%s: Failed to initialize eDP\n", __func__); + return -1; + } + 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 0; +} diff --git a/src/mainboard/google/geralt/display.h b/src/mainboard/google/geralt/display.h new file mode 100644 index 0000000000..29153b303c --- /dev/null +++ b/src/mainboard/google/geralt/display.h @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef __MAINBOARD_GOOGLE_GERALT_DISPLAY_H__ +#define __MAINBOARD_GOOGLE_GERALT_DISPLAY_H__ + +int configure_display(void); + +#endif diff --git a/src/mainboard/google/geralt/gpio.h b/src/mainboard/google/geralt/gpio.h index 5be09ce479..df2520a725 100644 --- a/src/mainboard/google/geralt/gpio.h +++ b/src/mainboard/google/geralt/gpio.h @@ -13,6 +13,11 @@ #define GPIO_GSC_AP_INT_ODL GPIO(GPIO00) #define GPIO_XHCI_INIT_DONE GPIO(DPI_CK) +#define GPIO_AP_EDP_BKLTEN GPIO(GPIO01) +#define GPIO_EDP_BL_PWM_1V8 GPIO(DISP_PWM1) +#define GPIO_EDP_HPD_1V8 GPIO(GPIO17) +#define GPIO_EN_PP3300_EDP_DISP_X GPIO(DSI1_LCM_RST) + void setup_chromeos_gpios(void); #endif diff --git a/src/mainboard/google/geralt/mainboard.c b/src/mainboard/google/geralt/mainboard.c index ddcb1bb000..b2367b6685 100644 --- a/src/mainboard/google/geralt/mainboard.c +++ b/src/mainboard/google/geralt/mainboard.c @@ -1,14 +1,23 @@ /* SPDX-License-Identifier: GPL-2.0-only */ +#include <bootmode.h> #include <device/device.h> #include <soc/bl31.h> #include <soc/msdc.h> #include <soc/usb.h> +#include "display.h" #include "gpio.h" static void mainboard_init(struct device *dev) { + if (display_init_required()) { + if (configure_display() < 0) + printk(BIOS_ERR, "%s: Failed to init display\n", __func__); + } else { + printk(BIOS_INFO, "%s: Skipped display initialization\n", __func__); + } + mtk_msdc_configure_emmc(true); mtk_msdc_configure_sdcard(); setup_usb_host(); |