diff options
author | Julius Werner <jwerner@chromium.org> | 2021-08-12 23:26:25 -0700 |
---|---|---|
committer | Julius Werner <jwerner@chromium.org> | 2021-08-20 18:28:57 +0000 |
commit | e78fd115e6b7ad3b35dde1ba8d6228ed0162a843 (patch) | |
tree | 99ff52c261ad557a3e7115fbd965ea1b8130228f /src/mainboard | |
parent | 312fb716d03977c9e194f67b8fba4d0fed677e41 (diff) |
qualcomm/sc7180: Switch to common MIPI panel library
This patch changes the sc7180 boards to use the new common MIPI panel
framework, which allows more flexible initialization command packing and
sharing panel definitions between boards. (I'm taking the lane count
control back out again for now, since it seems we only ever want 4 for
now anyway, and if we ever have a need for a different lane count it's
not clear whether that should be a property of the board or the panel or
both. Better to leave that decision until we have a real use case.)
Also, the code was not written to deal with DCS commands that were not a
length divisible by 4 (it would read over the end of the command
buffer). The corresponding kernel driver seems to pad the command with
0xff instead, let's do the same here. (Also increase the maximum allowed
command length to 256 bytes, as per Qualcomm's recommendation.)
Signed-off-by: Julius Werner <jwerner@chromium.org>
Change-Id: I78f6efbaa9da88a3574d5c6a51061e308412340e
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56966
Reviewed-by: Shelley Chen <shchen@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/mainboard')
-rw-r--r-- | src/mainboard/google/trogdor/Kconfig | 1 | ||||
-rw-r--r-- | src/mainboard/google/trogdor/Makefile.inc | 1 | ||||
-rw-r--r-- | src/mainboard/google/trogdor/mainboard.c | 89 | ||||
-rw-r--r-- | src/mainboard/google/trogdor/panel_driver.c | 45 |
4 files changed, 58 insertions, 78 deletions
diff --git a/src/mainboard/google/trogdor/Kconfig b/src/mainboard/google/trogdor/Kconfig index 08004d5079..164c05fe3b 100644 --- a/src/mainboard/google/trogdor/Kconfig +++ b/src/mainboard/google/trogdor/Kconfig @@ -15,6 +15,7 @@ config TROGDOR_HAS_BRIDGE_BACKLIGHT config TROGDOR_HAS_MIPI_PANEL bool default n + select MIPI_PANEL_VIS_RM69299 config TROGDOR_HAS_FINGERPRINT bool diff --git a/src/mainboard/google/trogdor/Makefile.inc b/src/mainboard/google/trogdor/Makefile.inc index f42e1476c7..9a71ea5197 100644 --- a/src/mainboard/google/trogdor/Makefile.inc +++ b/src/mainboard/google/trogdor/Makefile.inc @@ -15,7 +15,6 @@ romstage-y += boardid.c romstage-y += chromeos.c ramstage-y += mainboard.c -ramstage-y += panel_driver.c ifneq ($(CONFIG_BOARD_GOOGLE_BUBS),y) ramstage-y += reset.c endif diff --git a/src/mainboard/google/trogdor/mainboard.c b/src/mainboard/google/trogdor/mainboard.c index 96751fede2..02a1f7d27b 100644 --- a/src/mainboard/google/trogdor/mainboard.c +++ b/src/mainboard/google/trogdor/mainboard.c @@ -1,11 +1,14 @@ /* SPDX-License-Identifier: GPL-2.0-only */ #include <bootmode.h> +#include <cbfs.h> #include <console/console.h> #include <delay.h> #include <device/device.h> #include <device/i2c_simple.h> +#include <device/mipi_panel.h> #include <drivers/ti/sn65dsi86bridge/sn65dsi86bridge.h> +#include <edid.h> #include <framebuffer_info.h> #include <soc/display/mipi_dsi.h> #include <soc/display/mdssreg.h> @@ -64,7 +67,7 @@ static void load_qup_fw(void) qupv3_se_fw_load_and_init(QUPV3_1_SE5, SE_PROTOCOL_I2C, MIXED); /* Codec I2C */ } -static void configure_display(void) +static void power_on_bridge(void) { printk(BIOS_INFO, "%s: Bridge gpio init\n", __func__); @@ -75,25 +78,38 @@ static void configure_display(void) gpio_output(GPIO_EN_PP3300_DX_EDP, 1); } -static enum cb_err display_init(struct edid *edid, const struct panel_data *pinfo) +static struct panel_serializable_data *get_mipi_panel(void) +{ + const char *cbfs_filename = "panel-VIS_RM69299"; + + struct panel_serializable_data *panel = cbfs_map(cbfs_filename, NULL); + if (!panel) { + printk(BIOS_ERR, "Could not find panel data for %s!\n", cbfs_filename); + return NULL; + } + + return panel; +} + +static enum cb_err display_init(struct panel_serializable_data *panel) { uint32_t dsi_bpp = 24; - uint32_t lanes = pinfo ? pinfo->lanes : 4; + uint32_t lanes = 4; - if (mdss_dsi_config(edid, lanes, dsi_bpp)) + if (mdss_dsi_config(&panel->edid, lanes, dsi_bpp)) return CB_ERR; if (CONFIG(TROGDOR_HAS_MIPI_PANEL)) { - if (mdss_dsi_panel_initialize(pinfo)) + if (mdss_dsi_panel_initialize(panel->init)) return CB_ERR; } else { - sn65dsi86_bridge_configure(BRIDGE_BUS, BRIDGE_CHIP, edid, lanes, dsi_bpp); + sn65dsi86_bridge_configure(BRIDGE_BUS, BRIDGE_CHIP, &panel->edid, + lanes, dsi_bpp); + if (CONFIG(TROGDOR_HAS_BRIDGE_BACKLIGHT)) + sn65dsi86_backlight_enable(BRIDGE_BUS, BRIDGE_CHIP); } - if (CONFIG(TROGDOR_HAS_BRIDGE_BACKLIGHT)) - sn65dsi86_backlight_enable(BRIDGE_BUS, BRIDGE_CHIP); - - mdp_dsi_video_config(edid); - mdss_dsi_video_mode_config(edid, dsi_bpp); + mdp_dsi_video_config(&panel->edid); + mdss_dsi_video_mode_config(&panel->edid, dsi_bpp); mdp_dsi_video_on(); return CB_SUCCESS; @@ -101,28 +117,37 @@ static enum cb_err display_init(struct edid *edid, const struct panel_data *pinf static void display_startup(void) { - static struct edid ed; - enum dp_pll_clk_src ref_clk = SN65_SEL_19MHZ; - const struct panel_data *pinfo = NULL; - - if (display_init_required()) { - if (CONFIG(TROGDOR_HAS_MIPI_PANEL)) { - pinfo = get_panel_config(&ed); - } else { - i2c_init(QUPV3_0_SE2, I2C_SPEED_FAST); /* EDP Bridge I2C */ - configure_display(); - mdelay(250); /* Delay for the panel to be up */ - sn65dsi86_bridge_init(BRIDGE_BUS, BRIDGE_CHIP, ref_clk); - if (sn65dsi86_bridge_read_edid(BRIDGE_BUS, BRIDGE_CHIP, &ed) < 0) - return; - } - - printk(BIOS_INFO, "display init!\n"); - if (display_init(&ed, pinfo) == CB_SUCCESS) - fb_new_framebuffer_info_from_edid(&ed, (uintptr_t)0); - - } else + struct panel_serializable_data *panel = NULL; + + if (!display_init_required()) { printk(BIOS_INFO, "Skipping display init.\n"); + return; + } + + if (CONFIG(TROGDOR_HAS_MIPI_PANEL)) { + panel = get_mipi_panel(); + if (!panel) + return; + } else { + enum dp_pll_clk_src ref_clk = SN65_SEL_19MHZ; + static struct panel_serializable_data edp_panel = { + .orientation = LB_FB_ORIENTATION_NORMAL, + }; + i2c_init(QUPV3_0_SE2, I2C_SPEED_FAST); /* EDP Bridge I2C */ + power_on_bridge(); + mdelay(250); /* Delay for the panel to be up */ + sn65dsi86_bridge_init(BRIDGE_BUS, BRIDGE_CHIP, ref_clk); + if (sn65dsi86_bridge_read_edid(BRIDGE_BUS, BRIDGE_CHIP, &edp_panel.edid) < 0) + return; + panel = &edp_panel; + } + + printk(BIOS_INFO, "display init!\n"); + edid_set_framebuffer_bits_per_pixel(&panel->edid, 32, 0); + if (display_init(panel) == CB_SUCCESS) { + struct fb_info *info = fb_new_framebuffer_info_from_edid(&panel->edid, 0); + fb_set_orientation(info, panel->orientation); + } } static void mainboard_init(struct device *dev) diff --git a/src/mainboard/google/trogdor/panel_driver.c b/src/mainboard/google/trogdor/panel_driver.c deleted file mode 100644 index 5da02098ec..0000000000 --- a/src/mainboard/google/trogdor/panel_driver.c +++ /dev/null @@ -1,45 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -#include <edid.h> -#include <string.h> -#include <types.h> -#include <soc/display/mipi_dsi.h> -#include <soc/display/panel.h> - -struct mipi_dsi_cmd visionox_init_cmds[] = { - {{0xFE, 0x00, 0x15, 0x80}, 0x4, 0}, - {{0xc2, 0x08, 0x15, 0x80}, 0x4, 0}, - {{0x35, 0x00, 0x15, 0x80}, 0x4, 0}, - {{0x51, 0xff, 0x15, 0x80}, 0x4, 0}, - {{0x11, 0x00, 0x05, 0x80}, 0x4, 150000}, - {{0x29, 0x00, 0x05, 0x80}, 0x4, 50000}, -}; - -static const struct edid visionox_edid = { - .ascii_string = "RM69299", - .manufacturer_name = "RM", - .panel_bits_per_color = 8, - .panel_bits_per_pixel = 24, - .mode = { - .pixel_clock = 158695, - .lvds_dual_channel = 0, - .refresh = 60, - .ha = 1080, .hbl = 64, .hso = 26, .hspw = 2, - .va = 2248, .vbl = 64, .vso = 56, .vspw = 4, - .phsync = '-', .pvsync = '-', - .x_mm = 74, .y_mm = 131, - }, -}; - -const struct panel_data panel_info = { - .lanes = 4, - .init_cmd = visionox_init_cmds, - .init_cmd_count = 6, -}; - -const struct panel_data *get_panel_config(struct edid *edid) -{ - memcpy(edid, &visionox_edid, sizeof(struct edid)); - edid_set_framebuffer_bits_per_pixel(edid, 32, 0); - return &panel_info; -} |