From ba604b558e3a4e9e53c948391bc86a7bc775e6b3 Mon Sep 17 00:00:00 2001 From: Yidi Lin Date: Wed, 3 Jan 2024 16:07:24 +0800 Subject: soc/mediatek: Add common implementation to configure display The sequences of configure_display() are similar on MediaTek platforms. The sequences usually involve following steps: 1. Setup mtcmos for display hardware block. - mtcmos_display_power_on() - mtcmos_protect_display_bus() 2. Configure backlight pins 3. Power on the panel - It also powers on the bridge in MIPI DSI to eDP case. 4. General initialization for DDP(display data path) 5. Initialize eDP/MIPI DSI accordingly, - For eDP path, it calls mtk_edp_init() to get edid from the panel and initializes eDP driver. - For MIPI DSI path, the edid is retrieved either from the bridge or from CBFS (the serializable data), and then initializes DSI driver. 6. Set framebuffer bits per pixel 7. Setup DDP mode 8. Setup panel orientation This patch extracts geralt/display.c to mediatek/common/display.c and refactors `struct panel_description` to generalize the display init sequences. configure_display() is also renamed to mtk_display_init(). TEST=check FW screen on geralt. Change-Id: I403bba8a826de5f3fb2ea96a5403725ff194164f Signed-off-by: Yidi Lin Reviewed-on: https://review.coreboot.org/c/coreboot/+/79776 Reviewed-by: Yu-Ping Wu Tested-by: build bot (Jenkins) --- src/soc/mediatek/common/include/soc/display.h | 32 +++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/soc/mediatek/common/include/soc/display.h (limited to 'src/soc/mediatek/common/include') diff --git a/src/soc/mediatek/common/include/soc/display.h b/src/soc/mediatek/common/include/soc/display.h new file mode 100644 index 0000000000..61bc21fc98 --- /dev/null +++ b/src/soc/mediatek/common/include/soc/display.h @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef __SOC_MEDIATEK_COMMON_DISPLAY_H__ +#define __SOC_MEDIATEK_COMMON_DISPLAY_H__ + +#include +#include + +enum disp_path_sel { + DISP_PATH_NONE = 0, + DISP_PATH_EDP, + DISP_PATH_MIPI, +}; + +struct panel_description { + const char *name; + void (*configure_backlight)(void); + void (*power_on)(void); + int (*get_edid)(struct edid *edid); + int (*post_power_on)(const struct edid *edid); + enum lb_fb_orientation orientation; + enum disp_path_sel disp_path; + bool pwm_ctrl_gpio; +}; + +int mtk_display_init(void); +struct panel_description *get_active_panel(void); + +void mtk_ddp_init(void); +void mtk_ddp_mode_set(const struct edid *edid, enum disp_path_sel path); + +#endif -- cgit v1.2.3