yongqiang niu has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/46578 )
Change subject: WIP: coreboot: Add display code ......................................................................
WIP: coreboot: Add display code
Add display init code to support display
Signed-off-by: Huijuan Xie huijuan.xie@mediatek.corp-partner.google.com Change-Id: If730c42451f7b392285df686abc4ca252d8d42cf --- M src/mainboard/google/asurada/mainboard.c 1 file changed, 103 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/46578/1
diff --git a/src/mainboard/google/asurada/mainboard.c b/src/mainboard/google/asurada/mainboard.c index 677e917..30e98e8 100644 --- a/src/mainboard/google/asurada/mainboard.c +++ b/src/mainboard/google/asurada/mainboard.c @@ -1,16 +1,27 @@ /* SPDX-License-Identifier: GPL-2.0-only */
+#include <assert.h> #include <bl31.h> +#include <boardid.h> +#include <bootmode.h> #include <console/console.h> +#include <delay.h> #include <device/device.h> #include <device/mmio.h> +#include <edid.h> +#include <gpio.h> #include <lib.h> +#include <soc/ddp.h> +#include <soc/dsi.h> #include <soc/dpm.h> +#include <soc/gpio.h> #include <soc/gpio_common.h> +#include <soc/mtcmos.h> #include <soc/spm.h> #include <soc/usb.h>
#include "gpio.h" +#include "panel.h"
#include <arm-trusted-firmware/include/export/plat/mediatek/common/plat_params_exp.h>
@@ -34,10 +45,102 @@ register_bl31_aux_param(¶m_reset.h); }
+/* Default implementation for boards without panels defined yet. */ +struct panel_description __weak *get_panel_description(int panel_id) +{ + printk(BIOS_ERR, "%s: ERROR: No panels defined for board: %s.\n", + __func__, CONFIG_MAINBOARD_PART_NUMBER); + return NULL; +} + +/* Set up backlight control pins as output pin and power-off by default */ +static void configure_panel_backlight(void) +{ + gpio_output(GPIO(KPROW1), 0); + gpio_output(GPIO(DISP_PWM), 0); +} + +static void power_on_panel(struct panel_description *panel) +{ + if (panel->power_on) { + panel->power_on(); + return; + } + + /* Default power sequence for most panels. */ + gpio_output(GPIO_MIPIBRDG_RST_L_1V8, 0); + mdelay(6); + gpio_output(GPIO_MIPIBRDG_RST_L_1V8, 1); + mdelay(6); +} + +static struct panel_description *get_active_panel(void) +{ + /* TODO(hungte) Create a dedicated panel_id() in board_id.c */ + int panel_id = sku_id() >> 4; + + struct panel_description *panel = get_panel_description(panel_id); + if (!panel) { + printk(BIOS_ERR, "%s: Panel %d is not supported.\n", + __func__, panel_id); + return NULL; + } + assert(panel->s); + + const struct edid *edid = &panel->s->edid; + const char *name = edid->ascii_string; + if (name[0] == '\0') + name = "unknown name"; + printk(BIOS_INFO, "%s: Found ID %d: '%s %s' %dx%d@%dHz\n", __func__, + panel_id, edid->manufacturer_name, name, edid->mode.ha, + edid->mode.va, edid->mode.refresh); + return panel; +} + +static bool configure_display(void) +{ + struct panel_description *panel = get_active_panel(); + if (!panel) + return false; + + mtcmos_display_power_on(); + mtcmos_protect_display_bus(); + configure_panel_backlight(); + power_on_panel(panel); + + struct edid *edid = &panel->s->edid; + 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); + if (CONFIG(DRIVER_ANALOGIX_ANX7625)) + mipi_dsi_flags |= MIPI_DSI_MODE_EOT_PACKET; + if (mtk_dsi_init(mipi_dsi_flags, MIPI_DSI_FMT_RGB888, 4, edid, + panel->s->init) < 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); + set_vbe_framebuffer_orientation(panel->s->orientation); + return true; +} + static void mainboard_init(struct device *dev) { int i;
+ if (display_init_required()) { + printk(BIOS_INFO, "%s: Starting display init.\n", __func__); + if (!configure_display()) + printk(BIOS_ERR, "%s: Failed to init display.\n", + __func__); + } else { + printk(BIOS_INFO, "%s: Skipped display init.\n", __func__); + } + + /* HACK, set pinctrl for SD card */ for (i = 51; i <= 56; i++) gpio_set_mode((gpio_t){.id = i}, 1);
Yu-Ping Wu has uploaded a new patch set (#3) to the change originally created by yongqiang niu. ( https://review.coreboot.org/c/coreboot/+/46578 )
Change subject: WIP: coreboot: Add display code ......................................................................
WIP: coreboot: Add display code
Add display init code to support display
Signed-off-by: Huijuan Xie huijuan.xie@mediatek.corp-partner.google.com Change-Id: If730c42451f7b392285df686abc4ca252d8d42cf --- M src/mainboard/google/asurada/mainboard.c 1 file changed, 103 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/46578/3
Hello Jg Daolongzhu, build bot (Jenkins), Huijuan Xie,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/46578
to look at the new patch set (#5).
Change subject: WIP: coreboot: Add display code ......................................................................
WIP: coreboot: Add display code
Add display init code to support display
Signed-off-by: Huijuan Xie huijuan.xie@mediatek.corp-partner.google.com Change-Id: If730c42451f7b392285df686abc4ca252d8d42cf --- M src/mainboard/google/asurada/mainboard.c 1 file changed, 103 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/46578/5
Yu-Ping Wu has uploaded a new patch set (#6) to the change originally created by yongqiang niu. ( https://review.coreboot.org/c/coreboot/+/46578 )
Change subject: mb/google/asurada: Initialize display ......................................................................
mb/google/asurada: Initialize display
Configure display in mainboard_init() to support display in firmware screen.
BUG=b:155713214 BRANCH=none TEST=Firmware screen looks good
Signed-off-by: Huijuan Xie huijuan.xie@mediatek.corp-partner.google.com Change-Id: If730c42451f7b392285df686abc4ca252d8d42cf --- M src/mainboard/google/asurada/mainboard.c 1 file changed, 103 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/46578/6
Yidi Lin has uploaded a new patch set (#8) to the change originally created by yongqiang niu. ( https://review.coreboot.org/c/coreboot/+/46578 )
Change subject: mb/google/asurada: Initialize display ......................................................................
mb/google/asurada: Initialize display
Configure display in mainboard_init() to support display in firmware screen.
BUG=b:155713214 BRANCH=none TEST=Firmware screen looks good
Signed-off-by: Huijuan Xie huijuan.xie@mediatek.corp-partner.google.com Change-Id: If730c42451f7b392285df686abc4ca252d8d42cf --- M src/mainboard/google/asurada/mainboard.c 1 file changed, 103 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/46578/8
Yidi Lin has uploaded a new patch set (#10) to the change originally created by yongqiang niu. ( https://review.coreboot.org/c/coreboot/+/46578 )
Change subject: mb/google/asurada: Initialize display ......................................................................
mb/google/asurada: Initialize display
Configure display in mainboard_init() to support display in firmware screen.
BUG=b:155713214 BRANCH=none TEST=Firmware screen looks good
Signed-off-by: Huijuan Xie huijuan.xie@mediatek.corp-partner.google.com Change-Id: If730c42451f7b392285df686abc4ca252d8d42cf --- M src/mainboard/google/asurada/mainboard.c 1 file changed, 103 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/46578/10
Yidi Lin has uploaded a new patch set (#11) to the change originally created by yongqiang niu. ( https://review.coreboot.org/c/coreboot/+/46578 )
Change subject: mb/google/asurada: Initialize display ......................................................................
mb/google/asurada: Initialize display
Configure display in mainboard_init() to support display in firmware screen.
BUG=b:155713214 BRANCH=none TEST=Firmware screen looks good
Signed-off-by: Huijuan Xie huijuan.xie@mediatek.corp-partner.google.com Change-Id: If730c42451f7b392285df686abc4ca252d8d42cf --- M src/mainboard/google/asurada/mainboard.c 1 file changed, 103 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/46578/11
Yidi Lin has uploaded a new patch set (#12) to the change originally created by yongqiang niu. ( https://review.coreboot.org/c/coreboot/+/46578 )
Change subject: mb/google/asurada: Initialize display ......................................................................
mb/google/asurada: Initialize display
Configure display in mainboard_init() to support display in firmware screen.
BUG=b:155713214 BRANCH=none TEST=Firmware screen looks good
Signed-off-by: Huijuan Xie huijuan.xie@mediatek.corp-partner.google.com Change-Id: If730c42451f7b392285df686abc4ca252d8d42cf --- M src/mainboard/google/asurada/Kconfig M src/mainboard/google/asurada/mainboard.c 2 files changed, 104 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/46578/12
Yidi Lin has uploaded a new patch set (#13) to the change originally created by yongqiang niu. ( https://review.coreboot.org/c/coreboot/+/46578 )
Change subject: mb/google/asurada: Initialize display ......................................................................
mb/google/asurada: Initialize display
Configure display in mainboard_init() to support display in firmware screen.
BUG=b:155713214 BRANCH=none TEST=Firmware screen looks good
Signed-off-by: Huijuan Xie huijuan.xie@mediatek.corp-partner.google.com Change-Id: If730c42451f7b392285df686abc4ca252d8d42cf --- M src/mainboard/google/asurada/Kconfig M src/mainboard/google/asurada/mainboard.c 2 files changed, 104 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/46578/13
Yidi Lin has uploaded a new patch set (#15) to the change originally created by yongqiang niu. ( https://review.coreboot.org/c/coreboot/+/46578 )
Change subject: mb/google/asurada: Initialize display ......................................................................
mb/google/asurada: Initialize display
Configure display in mainboard_init() to support display in firmware screen.
BUG=b:155713214 BRANCH=none TEST=Firmware screen looks good
Signed-off-by: Huijuan Xie huijuan.xie@mediatek.corp-partner.google.com Change-Id: If730c42451f7b392285df686abc4ca252d8d42cf --- M src/mainboard/google/asurada/Kconfig M src/mainboard/google/asurada/mainboard.c 2 files changed, 104 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/46578/15
Yidi Lin has uploaded a new patch set (#16) to the change originally created by yongqiang niu. ( https://review.coreboot.org/c/coreboot/+/46578 )
Change subject: mb/google/asurada: Initialize display ......................................................................
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=Firmware screen looks good
Signed-off-by: Huijuan Xie huijuan.xie@mediatek.corp-partner.google.com Change-Id: If730c42451f7b392285df686abc4ca252d8d42cf --- M src/mainboard/google/asurada/Kconfig M src/mainboard/google/asurada/Makefile.inc M src/mainboard/google/asurada/mainboard.c A src/mainboard/google/asurada/panel.h A src/mainboard/google/asurada/panel_anx7625.c 5 files changed, 221 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/46578/16
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46578 )
Change subject: mb/google/asurada: Initialize display ......................................................................
Patch Set 16:
(9 comments)
thanks. in short, we really don't need the panel.h design given there will be only one panel (edp) supported. please revise and do only mainboard.c. Thanks!
https://review.coreboot.org/c/coreboot/+/46578/16/src/mainboard/google/asura... File src/mainboard/google/asurada/mainboard.c:
https://review.coreboot.org/c/coreboot/+/46578/16/src/mainboard/google/asura... PS16, Line 53: /* Default implementation for boards without panels defined yet. */ : struct panel_description __weak *get_panel_description(int panel_id) : { : printk(BIOS_ERR, "%s: ERROR: No panels defined for board: %s.\n", : __func__, CONFIG_MAINBOARD_PART_NUMBER); : return NULL; : } remove this
https://review.coreboot.org/c/coreboot/+/46578/16/src/mainboard/google/asura... PS16, Line 70: if (panel->power_on) { : panel->power_on(); : return; : } remove this
https://review.coreboot.org/c/coreboot/+/46578/16/src/mainboard/google/asura... PS16, Line 84: /* TODO(hungte) Create a dedicated panel_id() in board_id.c */ : int panel_id = sku_id() >> 4; we don't do this
https://review.coreboot.org/c/coreboot/+/46578/16/src/mainboard/google/asura... PS16, Line 87: struct panel_description *panel = get_panel_description(panel_id); : if (!panel) { : printk(BIOS_ERR, "%s: Panel %d is not supported.\n", : __func__, panel_id); : return NULL; : } : assert(panel->s); no need
https://review.coreboot.org/c/coreboot/+/46578/16/src/mainboard/google/asura... PS16, Line 95: const struct edid *edid = &panel->s->edid; : const char *name = edid->ascii_string; : if (name[0] == '\0') : name = "unknown name"; : printk(BIOS_INFO, "%s: Found ID %d: '%s %s' %dx%d@%dHz\n", __func__, : panel_id, edid->manufacturer_name, name, edid->mode.ha, : edid->mode.va, edid->mode.refresh); : return panel; merge these to configure_display
https://review.coreboot.org/c/coreboot/+/46578/16/src/mainboard/google/asura... PS16, Line 201: if (display_init_required()) { : printk(BIOS_INFO, "%s: Starting display init.\n", __func__); : if (!configure_display()) : printk(BIOS_ERR, "%s: Failed to init display.\n", : __func__); : } else { : printk(BIOS_INFO, "%s: Skipped display init.\n", __func__); : } : move this to after bl31, or even the last of init sequence. we want to config emmc/sdcard/usb as early as possible.
https://review.coreboot.org/c/coreboot/+/46578/16/src/mainboard/google/asura... File src/mainboard/google/asurada/panel_anx7625.c:
https://review.coreboot.org/c/coreboot/+/46578/16/src/mainboard/google/asura... PS16, Line 15: /* Disable backlight before turning on bridge */ : gpio_output(GPIO(KPROW1), 0); : gpio_output(GPIO(DISP_PWM), 0); : gpio_output(GPIO_PP3300_PANEL, 1); : : /* Turn on bridge */ : gpio_output(GPIO_MIPIBRDG_RST_L_1V8, 0); : gpio_output(GPIO_MIPIBRDG_PP1000_EN, 1); : gpio_output(GPIO_MIPIBRDG_PP1800_EN, 1); : gpio_output(GPIO_MIPIBRDG_PP3300_EN, 1); : mdelay(2); : gpio_output(GPIO_MIPIBRDG_PWREN, 1); : mdelay(10); : gpio_output(GPIO_MIPIBRDG_RST_L_1V8, 1); merge this back to mainboard.c, and revise with configure_pnel_backlight
https://review.coreboot.org/c/coreboot/+/46578/16/src/mainboard/google/asura... PS16, Line 31: 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_serializable_data anx7625_data = { : .orientation = LB_FB_ORIENTATION_NORMAL, : .init = { INIT_END_CMD }, : }; : : static struct panel_description anx7625_panel = { : .s = &anx7625_data, : .power_on = dummy_power_on, : }; no need
https://review.coreboot.org/c/coreboot/+/46578/16/src/mainboard/google/asura... PS16, Line 50: /* To read panel EDID, we have to first power on anx7625. */ : power_on_anx7625(); : : u8 i2c_bus = 3; : mtk_i2c_bus_init(i2c_bus); : : if (anx7625_init(i2c_bus)) { : printk(BIOS_ERR, "Can't init ANX7625 bridge.\n"); : return NULL; : } : struct edid *edid = &anx7625_data.edid; : if (anx7625_dp_get_edid(i2c_bus, edid)) { : printk(BIOS_ERR, "Can't get panel's edid.\n"); : return NULL; : } : if (anx7625_dp_start(i2c_bus, edid) < 0) { : printk(BIOS_ERR, "Can't start display via ANX7625.\n"); : return NULL; : } : move to mainboard.c
Yidi Lin has uploaded a new patch set (#17) to the change originally created by yongqiang niu. ( https://review.coreboot.org/c/coreboot/+/46578 )
Change subject: mb/google/asurada: Initialize display ......................................................................
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 --- M src/mainboard/google/asurada/Kconfig M src/mainboard/google/asurada/mainboard.c 2 files changed, 97 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/46578/17
Yidi Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46578 )
Change subject: mb/google/asurada: Initialize display ......................................................................
Patch Set 17:
(9 comments)
https://review.coreboot.org/c/coreboot/+/46578/16/src/mainboard/google/asura... File src/mainboard/google/asurada/mainboard.c:
https://review.coreboot.org/c/coreboot/+/46578/16/src/mainboard/google/asura... PS16, Line 53: /* Default implementation for boards without panels defined yet. */ : struct panel_description __weak *get_panel_description(int panel_id) : { : printk(BIOS_ERR, "%s: ERROR: No panels defined for board: %s.\n", : __func__, CONFIG_MAINBOARD_PART_NUMBER); : return NULL; : }
remove this
Done
https://review.coreboot.org/c/coreboot/+/46578/16/src/mainboard/google/asura... PS16, Line 70: if (panel->power_on) { : panel->power_on(); : return; : }
remove this
Done
https://review.coreboot.org/c/coreboot/+/46578/16/src/mainboard/google/asura... PS16, Line 84: /* TODO(hungte) Create a dedicated panel_id() in board_id.c */ : int panel_id = sku_id() >> 4;
we don't do this
Done
https://review.coreboot.org/c/coreboot/+/46578/16/src/mainboard/google/asura... PS16, Line 87: struct panel_description *panel = get_panel_description(panel_id); : if (!panel) { : printk(BIOS_ERR, "%s: Panel %d is not supported.\n", : __func__, panel_id); : return NULL; : } : assert(panel->s);
no need
Done
https://review.coreboot.org/c/coreboot/+/46578/16/src/mainboard/google/asura... PS16, Line 95: const struct edid *edid = &panel->s->edid; : const char *name = edid->ascii_string; : if (name[0] == '\0') : name = "unknown name"; : printk(BIOS_INFO, "%s: Found ID %d: '%s %s' %dx%d@%dHz\n", __func__, : panel_id, edid->manufacturer_name, name, edid->mode.ha, : edid->mode.va, edid->mode.refresh); : return panel;
merge these to configure_display
Done
https://review.coreboot.org/c/coreboot/+/46578/16/src/mainboard/google/asura... PS16, Line 201: if (display_init_required()) { : printk(BIOS_INFO, "%s: Starting display init.\n", __func__); : if (!configure_display()) : printk(BIOS_ERR, "%s: Failed to init display.\n", : __func__); : } else { : printk(BIOS_INFO, "%s: Skipped display init.\n", __func__); : } :
move this to after bl31, or even the last of init sequence. […]
Done
https://review.coreboot.org/c/coreboot/+/46578/16/src/mainboard/google/asura... File src/mainboard/google/asurada/panel_anx7625.c:
https://review.coreboot.org/c/coreboot/+/46578/16/src/mainboard/google/asura... PS16, Line 15: /* Disable backlight before turning on bridge */ : gpio_output(GPIO(KPROW1), 0); : gpio_output(GPIO(DISP_PWM), 0); : gpio_output(GPIO_PP3300_PANEL, 1); : : /* Turn on bridge */ : gpio_output(GPIO_MIPIBRDG_RST_L_1V8, 0); : gpio_output(GPIO_MIPIBRDG_PP1000_EN, 1); : gpio_output(GPIO_MIPIBRDG_PP1800_EN, 1); : gpio_output(GPIO_MIPIBRDG_PP3300_EN, 1); : mdelay(2); : gpio_output(GPIO_MIPIBRDG_PWREN, 1); : mdelay(10); : gpio_output(GPIO_MIPIBRDG_RST_L_1V8, 1);
merge this back to mainboard. […]
Done
https://review.coreboot.org/c/coreboot/+/46578/16/src/mainboard/google/asura... PS16, Line 31: 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_serializable_data anx7625_data = { : .orientation = LB_FB_ORIENTATION_NORMAL, : .init = { INIT_END_CMD }, : }; : : static struct panel_description anx7625_panel = { : .s = &anx7625_data, : .power_on = dummy_power_on, : };
no need
Done
https://review.coreboot.org/c/coreboot/+/46578/16/src/mainboard/google/asura... PS16, Line 50: /* To read panel EDID, we have to first power on anx7625. */ : power_on_anx7625(); : : u8 i2c_bus = 3; : mtk_i2c_bus_init(i2c_bus); : : if (anx7625_init(i2c_bus)) { : printk(BIOS_ERR, "Can't init ANX7625 bridge.\n"); : return NULL; : } : struct edid *edid = &anx7625_data.edid; : if (anx7625_dp_get_edid(i2c_bus, edid)) { : printk(BIOS_ERR, "Can't get panel's edid.\n"); : return NULL; : } : if (anx7625_dp_start(i2c_bus, edid) < 0) { : printk(BIOS_ERR, "Can't start display via ANX7625.\n"); : return NULL; : } :
move to mainboard. […]
Done
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46578 )
Change subject: mb/google/asurada: Initialize display ......................................................................
Patch Set 17:
(15 comments)
very close & thanks!
let's try to give the GPIOs correct names from schematics.
https://review.coreboot.org/c/coreboot/+/46578/17/src/mainboard/google/asura... File src/mainboard/google/asurada/mainboard.c:
https://review.coreboot.org/c/coreboot/+/46578/17/src/mainboard/google/asura... PS17, Line 52: GPIO_MIPIBRDG_INT_ODL GPIO_EDPBRDG_INT_ODL
https://review.coreboot.org/c/coreboot/+/46578/17/src/mainboard/google/asura... PS17, Line 53: GPIO_MIPIBRDG_PWREN GPIO_EDPBRDG_PWREN
https://review.coreboot.org/c/coreboot/+/46578/17/src/mainboard/google/asura... PS17, Line 54: GPIO_MIPIBRDG_RST_L_1V8 GPIO_EDPBRDG_RST_ODL
https://review.coreboot.org/c/coreboot/+/46578/17/src/mainboard/google/asura... PS17, Line 55: GPIO_MIPIBRDG_PP3300_EN GPIO_EN_PP3300_EDP_DX
https://review.coreboot.org/c/coreboot/+/46578/17/src/mainboard/google/asura... PS17, Line 56: GPIO_MIPIBRDG_PP1800_EN GPIO_EN_PP1800_EDPBRDG_DX
https://review.coreboot.org/c/coreboot/+/46578/17/src/mainboard/google/asura... PS17, Line 57: GPIO_MIPIBRDG_PP1000_EN GPIO_EN_PP1000_EDPBRDG
https://review.coreboot.org/c/coreboot/+/46578/17/src/mainboard/google/asura... PS17, Line 58: GPIO_PP3300_PANEL GPIO_EN_PP3300_DISPLAY_DX
https://review.coreboot.org/c/coreboot/+/46578/17/src/mainboard/google/asura... PS17, Line 51: /* GPIO names */ : #define GPIO_MIPIBRDG_INT_ODL GPIO(EINT6) /* 6 */ : #define GPIO_MIPIBRDG_PWREN GPIO(DSI_TE) /* 41 */ : #define GPIO_MIPIBRDG_RST_L_1V8 GPIO(LCM_RST) /* 42 */ : #define GPIO_MIPIBRDG_PP3300_EN GPIO(PERIPHERAL_EN1) /* 127 */ : #define GPIO_MIPIBRDG_PP1800_EN GPIO(PERIPHERAL_EN2) /* 128 */ : #define GPIO_MIPIBRDG_PP1000_EN GPIO(PERIPHERAL_EN3) /* 129 */ : #define GPIO_PP3300_PANEL GPIO(CAM_CLK3) /* 136 */ : #define should be moved to before register_reset_to_bl31 (first function)
https://review.coreboot.org/c/coreboot/+/46578/17/src/mainboard/google/asura... PS17, Line 64: GPIO(KPROW1) Add #defines for mapping this to schematics:
#define GPIO_AP_EDP_BKLTEN GPIO(KPROW1) #define GPIO_BL_PWM_1V8 GPIO(DISP_PWM)
https://review.coreboot.org/c/coreboot/+/46578/17/src/mainboard/google/asura... PS17, Line 82: u8 const u8
https://review.coreboot.org/c/coreboot/+/46578/17/src/mainboard/google/asura... PS17, Line 88: " "%s: ....", __func__);
https://review.coreboot.org/c/coreboot/+/46578/17/src/mainboard/google/asura... PS17, Line 93: " "%s: ....", __func__);
https://review.coreboot.org/c/coreboot/+/46578/17/src/mainboard/google/asura... PS17, Line 97: " "%s: ....", __func__);
https://review.coreboot.org/c/coreboot/+/46578/17/src/mainboard/google/asura... PS17, Line 116: MIPI_DSI_MODE_EOT_PACKET since we're not checking configs, just merge this to previous line.
https://review.coreboot.org/c/coreboot/+/46578/17/src/mainboard/google/asura... PS17, Line 208: if (!configure_display()) : printk(BIOS_ERR, "%s: Failed to init display.\n", : __func__); since now every failure in configure_display will output messages, I think we don't need to repeat here; just do
if (display_init_required()) configure_display();
And move the [printk(BIOS_INFO, "%s: Starting display init.\n", __func__);] to starting of configure_display.
Yidi Lin has uploaded a new patch set (#18) to the change originally created by yongqiang niu. ( https://review.coreboot.org/c/coreboot/+/46578 )
Change subject: mb/google/asurada: Initialize display ......................................................................
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 --- M src/mainboard/google/asurada/Kconfig M src/mainboard/google/asurada/mainboard.c 2 files changed, 95 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/46578/18
Yidi Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46578 )
Change subject: mb/google/asurada: Initialize display ......................................................................
Patch Set 18:
(14 comments)
https://review.coreboot.org/c/coreboot/+/46578/17/src/mainboard/google/asura... File src/mainboard/google/asurada/mainboard.c:
https://review.coreboot.org/c/coreboot/+/46578/17/src/mainboard/google/asura... PS17, Line 52: GPIO_MIPIBRDG_INT_ODL
GPIO_EDPBRDG_INT_ODL
Done
https://review.coreboot.org/c/coreboot/+/46578/17/src/mainboard/google/asura... PS17, Line 53: GPIO_MIPIBRDG_PWREN
GPIO_EDPBRDG_PWREN
Done
https://review.coreboot.org/c/coreboot/+/46578/17/src/mainboard/google/asura... PS17, Line 54: GPIO_MIPIBRDG_RST_L_1V8
GPIO_EDPBRDG_RST_ODL
Done
https://review.coreboot.org/c/coreboot/+/46578/17/src/mainboard/google/asura... PS17, Line 55: GPIO_MIPIBRDG_PP3300_EN
GPIO_EN_PP3300_EDP_DX
Done
https://review.coreboot.org/c/coreboot/+/46578/17/src/mainboard/google/asura... PS17, Line 56: GPIO_MIPIBRDG_PP1800_EN
GPIO_EN_PP1800_EDPBRDG_DX
Done
https://review.coreboot.org/c/coreboot/+/46578/17/src/mainboard/google/asura... PS17, Line 57: GPIO_MIPIBRDG_PP1000_EN
GPIO_EN_PP1000_EDPBRDG
Done
https://review.coreboot.org/c/coreboot/+/46578/17/src/mainboard/google/asura... PS17, Line 58: GPIO_PP3300_PANEL
GPIO_EN_PP3300_DISPLAY_DX
Done
https://review.coreboot.org/c/coreboot/+/46578/17/src/mainboard/google/asura... PS17, Line 51: /* GPIO names */ : #define GPIO_MIPIBRDG_INT_ODL GPIO(EINT6) /* 6 */ : #define GPIO_MIPIBRDG_PWREN GPIO(DSI_TE) /* 41 */ : #define GPIO_MIPIBRDG_RST_L_1V8 GPIO(LCM_RST) /* 42 */ : #define GPIO_MIPIBRDG_PP3300_EN GPIO(PERIPHERAL_EN1) /* 127 */ : #define GPIO_MIPIBRDG_PP1800_EN GPIO(PERIPHERAL_EN2) /* 128 */ : #define GPIO_MIPIBRDG_PP1000_EN GPIO(PERIPHERAL_EN3) /* 129 */ : #define GPIO_PP3300_PANEL GPIO(CAM_CLK3) /* 136 */ :
#define should be moved to before register_reset_to_bl31 (first function)
Done
https://review.coreboot.org/c/coreboot/+/46578/17/src/mainboard/google/asura... PS17, Line 82: u8
const u8
Done
https://review.coreboot.org/c/coreboot/+/46578/17/src/mainboard/google/asura... PS17, Line 88: "
"%s: .... […]
Done
https://review.coreboot.org/c/coreboot/+/46578/17/src/mainboard/google/asura... PS17, Line 93: "
"%s: .... […]
Done
https://review.coreboot.org/c/coreboot/+/46578/17/src/mainboard/google/asura... PS17, Line 97: "
"%s: .... […]
Done
https://review.coreboot.org/c/coreboot/+/46578/17/src/mainboard/google/asura... PS17, Line 116: MIPI_DSI_MODE_EOT_PACKET
since we're not checking configs, just merge this to previous line.
Done
https://review.coreboot.org/c/coreboot/+/46578/17/src/mainboard/google/asura... PS17, Line 208: if (!configure_display()) : printk(BIOS_ERR, "%s: Failed to init display.\n", : __func__);
since now every failure in configure_display will output messages, I think we don't need to repeat h […]
Done
Yidi Lin has uploaded a new patch set (#19) to the change originally created by yongqiang niu. ( https://review.coreboot.org/c/coreboot/+/46578 )
Change subject: mb/google/asurada: Initialize display ......................................................................
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 --- M src/mainboard/google/asurada/Kconfig M src/mainboard/google/asurada/mainboard.c 2 files changed, 97 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/46578/19
Yidi Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46578 )
Change subject: mb/google/asurada: Initialize display ......................................................................
Patch Set 19:
(1 comment)
https://review.coreboot.org/c/coreboot/+/46578/17/src/mainboard/google/asura... File src/mainboard/google/asurada/mainboard.c:
https://review.coreboot.org/c/coreboot/+/46578/17/src/mainboard/google/asura... PS17, Line 64: GPIO(KPROW1)
Add #defines for mapping this to schematics: […]
Done
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46578 )
Change subject: mb/google/asurada: Initialize display ......................................................................
Patch Set 19: Code-Review+2
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46578 )
Change subject: mb/google/asurada: Initialize display ......................................................................
Patch Set 20: Code-Review+2
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46578 )
Change subject: mb/google/asurada: Initialize display ......................................................................
Patch Set 20: -Code-Review
Error from build bot:
/home/coreboot/node-root/workspace/coreboot-gerrit/src/mainboard/google/asurada/mainboard.c:128: undefined reference to `set_vbe_framebuffer_orientation'
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46578 )
Change subject: mb/google/asurada: Initialize display ......................................................................
Patch Set 20:
/home/coreboot/node-root/workspace/coreboot-gerrit/src/mainboard/google/asurada/mainboard.c:128: undefined reference to `set_vbe_framebuffer_orientation'
since the panel is edp (always default orientation) we may remove the call to that.
Yidi Lin has uploaded a new patch set (#21) to the change originally created by yongqiang niu. ( https://review.coreboot.org/c/coreboot/+/46578 )
Change subject: mb/google/asurada: Initialize display ......................................................................
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 --- M src/mainboard/google/asurada/Kconfig M src/mainboard/google/asurada/mainboard.c 2 files changed, 96 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/46578/21
Yidi Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46578 )
Change subject: mb/google/asurada: Initialize display ......................................................................
Patch Set 21:
Patch Set 20:
/home/coreboot/node-root/workspace/coreboot-gerrit/src/mainboard/google/asurada/mainboard.c:128: undefined reference to `set_vbe_framebuffer_orientation'
since the panel is edp (always default orientation) we may remove the call to that.
done.
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46578 )
Change subject: mb/google/asurada: Initialize display ......................................................................
Patch Set 21: Code-Review+2
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46578 )
Change subject: mb/google/asurada: Initialize display ......................................................................
Patch Set 21: Code-Review+2
Hung-Te Lin has submitted this change. ( https://review.coreboot.org/c/coreboot/+/46578 )
Change subject: mb/google/asurada: Initialize display ......................................................................
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 --- M src/mainboard/google/asurada/Kconfig M src/mainboard/google/asurada/mainboard.c 2 files changed, 96 insertions(+), 0 deletions(-)
Approvals: build bot (Jenkins): Verified Hung-Te Lin: Looks good to me, approved Yu-Ping Wu: Looks good to me, approved
diff --git a/src/mainboard/google/asurada/Kconfig b/src/mainboard/google/asurada/Kconfig index 7c93815..5f5ed85 100644 --- a/src/mainboard/google/asurada/Kconfig +++ b/src/mainboard/google/asurada/Kconfig @@ -27,6 +27,7 @@ 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 32bd407..8e7f2e8 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 @@ register_bl31_aux_param(¶m_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 @@
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)