Yu-Ping Wu has submitted this change. ( https://review.coreboot.org/c/coreboot/+/68490 )
Change subject: mb/google/geralt: Configure firmware display for eDP panel ......................................................................
mb/google/geralt: Configure firmware display for eDP panel
Add eDP panel power-on sequences and initialize the display in the ramstage.
eDP panel in MT8188 EVB: "IVO R140NWF5 RH". Panel spec name: R140NWF5 RH Product Specification
Firmware display eDP panel logs: configure_display: Starting display initialization SINK DPCD version: 0x11 SINK SUPPORT SSC! Extracted contents: header: 00 ff ff ff ff ff ff 00 serial number: 26 cf 7d 05 00 00 00 00 00 1e version: 01 04 basic params: 95 1f 11 78 0a chroma info: 76 90 94 55 54 90 27 21 50 54 established: 00 00 00 standard: 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 descriptor 1: 38 36 80 a0 70 38 20 40 18 30 3c 00 35 ae 10 00 00 19 descriptor 2: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 descriptor 3: 00 00 00 fe 00 49 6e 66 6f 56 69 73 69 6f 6e 0a 20 20 descriptor 4: 00 00 00 fe 00 52 31 34 30 4e 57 46 35 20 52 48 20 0a extensions: 00 checksum: fb Manufacturer: IVO Model 57d Serial Number 0 Made week 0 of 2020 EDID version: 1.4
BUG=b:244208960 TEST=see firmware display using eDP panel in MT8188 EVB.
Signed-off-by: Bo-Chen Chen rex-bc.chen@mediatek.com Change-Id: I67e0699c976c6f85e69d40d77154420c983b715e Reviewed-on: https://review.coreboot.org/c/coreboot/+/68490 Reviewed-by: Yidi Lin yidilin@google.com Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Yu-Ping Wu yupingso@google.com --- M src/mainboard/google/geralt/Kconfig M src/mainboard/google/geralt/Makefile.inc A src/mainboard/google/geralt/display.c A src/mainboard/google/geralt/display.h M src/mainboard/google/geralt/gpio.h M src/mainboard/google/geralt/mainboard.c 6 files changed, 134 insertions(+), 0 deletions(-)
Approvals: build bot (Jenkins): Verified Yu-Ping Wu: Looks good to me, approved Yidi Lin: Looks good to me, but someone else must approve
diff --git a/src/mainboard/google/geralt/Kconfig b/src/mainboard/google/geralt/Kconfig index 11a2d7b..a911cb8 100644 --- a/src/mainboard/google/geralt/Kconfig +++ b/src/mainboard/google/geralt/Kconfig @@ -28,6 +28,8 @@ 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 8da2ecf..85748dd 100644 --- a/src/mainboard/google/geralt/Makefile.inc +++ b/src/mainboard/google/geralt/Makefile.inc @@ -15,6 +15,7 @@ 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 0000000..3db9171 --- /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 0000000..29153b3 --- /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 5be09ce..df2520a 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 ddcb1bb..b2367b6 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();