From 9ede2ffee845d243d8e1515effbc206152fbc7fd Mon Sep 17 00:00:00 2001 From: Hung-Te Lin Date: Thu, 15 Aug 2019 09:43:55 +0800 Subject: mb/google/kukui: Move panel description to CBFS files The panel description may be pretty large (for example, 1.3k for BOE TV101) due to init commands and we should only load the right config when display is needed. BUG=None TEST=make -j; boots and see display on Krane. Change-Id: I2560a11ecf7badfd0605ab189d57ec9456850f75 Signed-off-by: Hung-Te Lin Reviewed-on: https://review.coreboot.org/c/coreboot/+/34877 Tested-by: build bot (Jenkins) Reviewed-by: Julius Werner --- src/mainboard/google/kukui/mainboard.c | 46 ++++++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 8 deletions(-) (limited to 'src/mainboard/google/kukui/mainboard.c') diff --git a/src/mainboard/google/kukui/mainboard.c b/src/mainboard/google/kukui/mainboard.c index 9f90b0f230..f34be6f51e 100644 --- a/src/mainboard/google/kukui/mainboard.c +++ b/src/mainboard/google/kukui/mainboard.c @@ -13,8 +13,10 @@ * GNU General Public License for more details. */ +#include #include #include +#include #include #include #include @@ -26,6 +28,7 @@ #include #include #include +#include #include "panel.h" @@ -93,6 +96,31 @@ static void power_on_panel(struct panel_description *panel) mdelay(6); } +struct panel_description *get_panel_from_cbfs(struct panel_description *desc) +{ + /* The CBFS name will be panel-{MANUFACTURER}-${PANEL_NAME}, + * where MANUFACTURER is 3 characters and PANEL_NAME is usually + * 13 characters. + */ + char cbfs_name[64]; + static union { + u8 raw[4 * 1024]; /* Most panels only need < 2K. */ + struct panel_serializable_data s; + } buffer; + + if (!desc->name) + return NULL; + + snprintf(cbfs_name, sizeof(cbfs_name), "panel-%s", desc->name); + if (cbfs_boot_load_file(cbfs_name, buffer.raw, sizeof(buffer), + CBFS_TYPE_STRUCT)) + desc->s = &buffer.s; + else + printk(BIOS_ERR, "Missing %s in CBFS.\n", cbfs_name); + + return desc->s ? desc : NULL; +} + static struct panel_description *get_active_panel(void) { /* TODO(hungte) Create a dedicated panel_id() in board_id.c */ @@ -104,13 +132,15 @@ static struct panel_description *get_active_panel(void) __func__, panel_id); return NULL; } - const char *mode_name = panel->edid.mode.name; - const char *name = panel->edid.ascii_string; + 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' %s\n", __func__, - panel_id, panel->edid.manufacturer_name, name, - mode_name ? mode_name : "(unknown mode)"); + 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; } @@ -125,20 +155,20 @@ static bool configure_display(void) configure_panel_backlight(); power_on_panel(panel); - struct edid *edid = &panel->edid; + 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 (mtk_dsi_init(mipi_dsi_flags, MIPI_DSI_FMT_RGB888, 4, edid, - panel->init) < 0) { + 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->orientation); + set_vbe_framebuffer_orientation(panel->s->orientation); return true; } -- cgit v1.2.3