yongqiang niu has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/31478
Change subject: mediatek/mt8183: Add display driver ......................................................................
mediatek/mt8183: Add display driver
BUG=b:80501386 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: Ic4aecc58d081f14f5d136b9ff8e813e6f40f78eb Signed-off-by: Yongqiang Niu yongqiang.niu@mediatek.com --- M src/mainboard/google/kukui/mainboard.c M src/soc/mediatek/mt8183/Makefile.inc A src/soc/mediatek/mt8183/ddp.c M src/soc/mediatek/mt8183/include/soc/addressmap.h A src/soc/mediatek/mt8183/include/soc/ddp.h 5 files changed, 602 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/31478/1
diff --git a/src/mainboard/google/kukui/mainboard.c b/src/mainboard/google/kukui/mainboard.c index e1d8f5f..a089236 100644 --- a/src/mainboard/google/kukui/mainboard.c +++ b/src/mainboard/google/kukui/mainboard.c @@ -13,9 +13,14 @@ * GNU General Public License for more details. */
+#include <bootmode.h> +#include <console/console.h> #include <device/device.h> +#include <edid.h> +#include <soc/ddp.h> #include <soc/gpio.h> #include <soc/mmu_operations.h> +#include <soc/mtcmos.h> #include <soc/usb.h>
static void configure_emmc(void) @@ -37,8 +42,36 @@ setup_usb_host(); }
+static void display_startup(void) +{ + int ret = 0; + struct edid edid; + + edid_set_framebuffer_bits_per_pixel(&edid, 32, 0); + + mtk_ddp_init(); + if (ret < 0) { + printk(BIOS_ERR, "dsi init fail\n"); + return; + } + + mtk_ddp_mode_set(&edid); + + set_vbe_mode_info_valid(&edid, (uintptr_t)0); +} + static void mainboard_init(struct device *dev) { + if (display_init_required()) { + printk(BIOS_INFO, "start display init.\n"); + mtcmos_display_power_on(); + mtcmos_protect_display_bus(); + + display_startup(); + } else { + printk(BIOS_INFO, "Skipping display init.\n"); + } + configure_emmc(); configure_usb(); } diff --git a/src/soc/mediatek/mt8183/Makefile.inc b/src/soc/mediatek/mt8183/Makefile.inc index 5770a83..225a969 100644 --- a/src/soc/mediatek/mt8183/Makefile.inc +++ b/src/soc/mediatek/mt8183/Makefile.inc @@ -49,6 +49,7 @@ ramstage-y += ../common/uart.c ramstage-y += ../common/usb.c ramstage-y += ../common/wdt.c +ramstage-y += ddp.c
CPPFLAGS_common += -Isrc/soc/mediatek/mt8183/include CPPFLAGS_common += -Isrc/soc/mediatek/common/include diff --git a/src/soc/mediatek/mt8183/ddp.c b/src/soc/mediatek/mt8183/ddp.c new file mode 100644 index 0000000..2e2c0d2 --- /dev/null +++ b/src/soc/mediatek/mt8183/ddp.c @@ -0,0 +1,229 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2019 MediaTek Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include <arch/io.h> +#include <console/console.h> +#include <delay.h> +#include <edid.h> +#include <stdlib.h> +#include <string.h> +#include <stddef.h> +#include <soc/addressmap.h> +#include <soc/ddp.h> + +#define RDMA_FIFO_PSEUDO_SIZE(bytes) (((bytes) / 16) << 16) +#define RDMA_OUTPUT_VALID_FIFO_THRESHOLD(bytes) ((bytes) / 16) + +static void disp_config_main_path_connection(void) +{ + write32(&mmsys_cfg->disp_ovl0_mout_en, OVL0_MOUT_EN_OVL0_2L); + + write32(&mmsys_cfg->disp_ovl0_2l_mout_en, OVL0_2L_MOUT_EN_DISP_PATH0); + + write32(&mmsys_cfg->disp_path0_sel_in, DISP_PATH0_SEL_IN_OVL0_2L); + + write32(&mmsys_cfg->disp_rdma0_sout_sel_in, RDMA0_SOUT_SEL_IN_COLOR); + + write32(&mmsys_cfg->disp_dither0_mout_en, DITHER0_MOUT_EN_DISP_DSI0); + + write32(&mmsys_cfg->dsi0_sel_in, DSI0_SEL_IN_DITHER0_MOUT); +} + +static void disp_config_main_path_mutex(void) +{ + write32(&disp_mutex->mutex[0].mod, MUTEX_MOD_MAIN_PATH); + + /* Clock source from DSI0 */ + write32(&disp_mutex->mutex[0].ctl, + MUTEX_SOF_DSI0 | (MUTEX_SOF_DSI0 << 6)); + write32(&disp_mutex->mutex[0].en, BIT(0)); +} + +static void ovl_set_roi(u32 idx, u32 width, u32 height, u32 color) +{ + write32(&disp_ovl[idx]->roi_size, height << 16 | width); + write32(&disp_ovl[idx]->roi_bgclr, color); +} + +static void ovl_layer_enable(u32 idx) +{ + write32(&disp_ovl[idx]->rdma[0].ctrl, BIT(0)); + write32(&disp_ovl[idx]->rdma[0].mem_gmc_setting, RDMA_MEM_GMC); + + setbits_le32(&disp_ovl[idx]->src_con, BIT(0)); +} + +static void ovl_bgclr_in_sel(u32 idx) +{ + setbits_le32(&disp_ovl[idx]->datapath_con, BIT(2)); +} + +static void rdma_start(u32 idx) +{ + setbits_le32(&disp_rdma[idx]->global_con, RDMA_ENGINE_EN); +} + +static void rdma_config(u32 idx, u32 width, u32 height, u32 vrefresh) +{ + u32 threshold; + u32 reg; + u32 fifo_size; + + /* Config width */ + clrsetbits_le32(&disp_rdma[idx]->size_con_0, 0x1FFF, width); + + /* Config height */ + clrsetbits_le32(&disp_rdma[idx]->size_con_1, 0xFFFFF, height); + + /* + * Enable FIFO underflow since DSI and DPI can't be blocked. Keep the + * FIFO pseudo size reset default of 8 KiB. Set the output threshold to + * 6 microseconds with 7/6 overhead to account for blanking, and with a + * pixel depth of 4 bytes: + */ + + fifo_size = RDMA_FIFO_SIZE_0 * KiB; + + threshold = width * height * vrefresh * 4 * 7 / 1000000; + + if (threshold > fifo_size) + threshold = fifo_size; + + reg = RDMA_FIFO_UNDERFLOW_EN | + RDMA_FIFO_PSEUDO_SIZE(fifo_size) | + RDMA_OUTPUT_VALID_FIFO_THRESHOLD(threshold); + + write32(&disp_rdma[idx]->fifo_con, reg); +} + +static void color_start(u32 width, u32 height) +{ + write32(&disp_color->width, width); + write32(&disp_color->height, height); + write32(&disp_color->cfg_main, COLOR_BYPASS_ALL | COLOR_SEQ_SEL); + write32(&disp_color->start, BIT(0)); +} + +static void aal_start(u32 width, u32 height) +{ + write32(&disp_aal->size, height << 16 | width); + write32(&disp_aal->en, PQ_EN); +} + +static void ccorr_start(u32 width, u32 height) +{ + write32(&disp_ccorr->size, height << 16 | width); + write32(&disp_ccorr->cfg, PQ_RELAY_MODE); + write32(&disp_ccorr->en, PQ_EN); +} + +static void dither_start(u32 width, u32 height) +{ + write32(&disp_dither->size, height << 16 | width); + write32(&disp_dither->cfg, PQ_RELAY_MODE); + write32(&disp_dither->en, PQ_EN); +} + +static void gamma_start(u32 width, u32 height) +{ + write32(&disp_gamma->size, height << 16 | width); + write32(&disp_gamma->en, PQ_EN); +} + +static void ovl_layer_config(u32 idx, u32 fmt, u32 bpp, u32 width, u32 height) +{ + write32(&disp_ovl[idx]->layer[0].con, fmt << 12); + write32(&disp_ovl[idx]->layer[0].src_size, height << 16 | width); + write32(&disp_ovl[idx]->layer[0].pitch, (width * bpp) & 0xFFFF); + + ovl_layer_enable(idx); +} + +static void main_disp_path_setup(u32 width, u32 height, u32 vrefresh) +{ + u32 idx = 0; + + /* Setup OVL */ + for (idx = 0; idx < MAIN_PATH_OVL_NR; idx++) { + u32 color = 0; + + if (idx == 0) + color = 0xFF0000FF; + + ovl_set_roi(idx, width, height, color); + } + + /* Setup RDMA0 */ + idx = 0; + rdma_config(idx, width, height, vrefresh); + + /* Setup Color */ + color_start(width, height); + + /* Setup CCORR */ + ccorr_start(width, height); + + /* Setup AAL */ + aal_start(width, height); + + /* Setup GAMMA */ + gamma_start(width, height); + + /* Setup DITHER */ + dither_start(width, height); + + /* Setup main path connection */ + disp_config_main_path_connection(); + + /* Setup main path mutex */ + disp_config_main_path_mutex(); +} + +static void disp_clock_on(void) +{ + clrbits_le32(&mmsys_cfg->mmsys_cg_con0, CG_CON0_DISP_ALL); + + clrbits_le32(&mmsys_cfg->mmsys_cg_con1, CG_CON1_DISP_DSI0 | + CG_CON1_DISP_DSI0_INTERFACE); +} + +static void disp_m4u_port_off(void) +{ + write32((void *)(SMI_LARB0 + 0x380), 0); +} + +void mtk_ddp_init(void) +{ + disp_clock_on(); + disp_m4u_port_off(); +} + +void mtk_ddp_mode_set(const struct edid *edid) +{ + u32 fmt = OVL_INFMT_RGBA8888; + u32 bpp = edid->framebuffer_bits_per_pixel / 8; + u32 idx = 0; + u32 width = edid->mode.ha; + u32 height = edid->mode.va; + u32 vrefresh = edid->mode.refresh; + + main_disp_path_setup(width, height, vrefresh); + + rdma_start(idx); + + ovl_layer_config(idx, fmt, bpp, width, height); + + ovl_bgclr_in_sel(idx+1); +} diff --git a/src/soc/mediatek/mt8183/include/soc/addressmap.h b/src/soc/mediatek/mt8183/include/soc/addressmap.h index d41b2b9..88653eb 100644 --- a/src/soc/mediatek/mt8183/include/soc/addressmap.h +++ b/src/soc/mediatek/mt8183/include/soc/addressmap.h @@ -53,6 +53,19 @@ IOCFG_LT_BASE = IO_PHYS + 0x01F20000, IOCFG_TL_BASE = IO_PHYS + 0x01F30000, SSUSB_SIF_BASE = IO_PHYS + 0x01F40300, + MMSYS_BASE = IO_PHYS + 0x04000000, + DISP_OVL0_BASE = IO_PHYS + 0x04008000, + DISP_OVL0_2L_BASE = IO_PHYS + 0x04009000, + DISP_OVL1_2L_BASE = IO_PHYS + 0x0400A000, + DISP_RDMA0_BASE = IO_PHYS + 0x0400B000, + DISP_RDMA1_BASE = IO_PHYS + 0x0400C000, + DISP_COLOR0_BASE = IO_PHYS + 0x0400E000, + DISP_CCORR0_BASE = IO_PHYS + 0x0400F000, + DISP_AAL0_BASE = IO_PHYS + 0x04010000, + DISP_GAMMA0_BASE = IO_PHYS + 0x04011000, + DISP_DITHER0_BASE = IO_PHYS + 0x04012000, + DISP_MUTEX_BASE = IO_PHYS + 0x04016000, + SMI_LARB0 = IO_PHYS + 0x04017000, SMI_BASE = IO_PHYS + 0x04019000, };
diff --git a/src/soc/mediatek/mt8183/include/soc/ddp.h b/src/soc/mediatek/mt8183/include/soc/ddp.h new file mode 100644 index 0000000..38f66e8 --- /dev/null +++ b/src/soc/mediatek/mt8183/include/soc/ddp.h @@ -0,0 +1,326 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2015 MediaTek Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef _DDP_REG_H_ +#define _DDP_REG_H_ + +#include <soc/addressmap.h> +#include <types.h> + +#define MAIN_PATH_OVL_NR 2 + +struct mmsys_cfg_regs { + u32 reserved_0x000[64]; /* 0x000 */ + u32 mmsys_cg_con0; /* 0x100 */ + u32 mmsys_cg_set0; /* 0x104 */ + u32 mmsys_cg_clr0; /* 0x108 */ + u32 reserved_0x10C; /* 0x10C */ + u32 mmsys_cg_con1; /* 0x110 */ + u32 mmsys_cg_set1; /* 0x114 */ + u32 mmsys_cg_clr1; /* 0x118 */ + u32 reserved_0x11C[889]; /* 0x11C */ + u32 disp_ovl0_mout_en; /* 0xF00 */ + u32 disp_ovl0_2l_mout_en; /* 0xF04 */ + u32 disp_ovl1_2l_mout_en; /* 0xF08 */ + u32 disp_dither0_mout_en; /* 0xF0C */ + u32 reserved_0xF10[5]; /* 0xF10 - 0xF20 */ + u32 disp_path0_sel_in; /* 0xF24 */ + u32 reserved_0xF28; /* 0xF28 */ + u32 dsi0_sel_in; /* 0xF2C */ + u32 dpi0_sel_in; /* 0xF30 */ + u32 reserved_0xF34; /* 0xF34 */ + u32 disp_ovl0_2l_sel_in; /* 0xF38 */ + u32 reserved_0xF3C[5]; /* 0xF3C - 0xF4C */ + u32 disp_rdma0_sout_sel_in; /* 0xF50 */ + u32 disp_rdma1_sout_sel_in; /* 0xF54 */ + u32 reserved_0xF58[3]; /* 0xF58 - 0xF60 */ + u32 dpi0_sel_sout_sel_in; /* 0xF64 */ +}; + +check_member(mmsys_cfg_regs, mmsys_cg_con0, 0x100); +check_member(mmsys_cfg_regs, reserved_0x11C, 0x11C); +check_member(mmsys_cfg_regs, disp_ovl0_mout_en, 0xF00); +check_member(mmsys_cfg_regs, reserved_0xF10, 0xF10); +check_member(mmsys_cfg_regs, disp_path0_sel_in, 0xF24); +check_member(mmsys_cfg_regs, disp_ovl0_2l_sel_in, 0xF38); +check_member(mmsys_cfg_regs, reserved_0xF3C, 0xF3C); +check_member(mmsys_cfg_regs, disp_rdma0_sout_sel_in, 0xF50); +check_member(mmsys_cfg_regs, dpi0_sel_sout_sel_in, 0xF64); +static struct mmsys_cfg_regs *const mmsys_cfg = + (void *)MMSYS_BASE; + + +/* DISP_REG_CONFIG_MMSYS_CG_CON0 + Configures free-run clock gating 0 + 0: Enable clock + 1: Clock gating */ +enum { + CG_CON0_SMI_COMMON = BIT(0), + CG_CON0_SMI_LARB0 = BIT(1), + CG_CON0_GALS_COMMON0 = BIT(3), + CG_CON0_GALS_COMMON1 = BIT(4), + CG_CON0_DISP_OVL0 = BIT(20), + CG_CON0_DISP_OVL0_2L = BIT(21), + CG_CON0_DISP_OVL1_2L = BIT(22), + CG_CON0_DISP_RDMA0 = BIT(23), + CG_CON0_DISP_RDMA1 = BIT(24), + CG_CON0_DISP_WDMA0 = BIT(25), + CG_CON0_DISP_COLOR0 = BIT(26), + CG_CON0_DISP_CCORR0 = BIT(27), + CG_CON0_DISP_AAL0 = BIT(28), + CG_CON0_DISP_GAMMA0 = BIT(29), + CG_CON0_DISP_DITHER0 = BIT(30), + CG_CON0_DISP_ALL = CG_CON0_SMI_COMMON | + CG_CON0_SMI_LARB0 | + CG_CON0_GALS_COMMON0 | + CG_CON0_GALS_COMMON1 | + CG_CON0_DISP_OVL0 | + CG_CON0_DISP_OVL0_2L | + CG_CON0_DISP_RDMA0 | + CG_CON0_DISP_COLOR0 | + CG_CON0_DISP_CCORR0 | + CG_CON0_DISP_AAL0 | + CG_CON0_DISP_DITHER0 | + CG_CON0_DISP_GAMMA0, + CG_CON0_ALL = 0xffffffff +}; + +/* DISP_REG_CONFIG_MMSYS_CG_CON1 + Configures free-run clock gating 1 + 0: Enable clock + 1: Clock gating */ +enum { + CG_CON1_DISP_DSI0 = BIT(0), + CG_CON1_DISP_DSI0_INTERFACE = BIT(1), + CG_CON1_DISP_26M = BIT(7), + + CG_CON1_ALL = 0xffffffff +}; + +enum { + OVL0_MOUT_EN_RDMA0 = BIT(0), + OVL0_MOUT_EN_OVL0_2L = BIT(4), + OVL0_2L_MOUT_EN_DISP_PATH0 = BIT(0), + OVL1_2L_MOUT_EN_DISP_RDMA1 = BIT(4), + DITHER0_MOUT_EN_DISP_DSI0 = BIT(0), +}; + +enum { + DISP_PATH0_SEL_IN_OVL0 = 0, + DISP_PATH0_SEL_IN_OVL0_2L = 1, + DSI0_SEL_IN_DITHER0_MOUT = 0, + DSI0_SEL_IN_RDMA0 = 1, + RDMA0_SOUT_SEL_IN_DSI0 = 0, + RDMA0_SOUT_SEL_IN_COLOR = 1, +}; + +struct disp_mutex_regs { + u32 inten; + u32 intsta; + u32 reserved0[6]; + struct { + u32 en; + u32 dummy; + u32 rst; + u32 ctl; + u32 mod; + u32 reserved[3]; + } mutex[12]; +}; + +static struct disp_mutex_regs *const disp_mutex = (void *)DISP_MUTEX_BASE; + +enum { + MUTEX_MOD_DISP_RDMA0 = BIT(0), + MUTEX_MOD_DISP_RDMA1 = BIT(1), + MUTEX_MOD_DISP_OVL0 = BIT(9), + MUTEX_MOD_DISP_OVL0_2L = BIT(10), + MUTEX_MOD_DISP_OVL1_2L = BIT(11), + MUTEX_MOD_DISP_WDMA0 = BIT(12), + MUTEX_MOD_DISP_COLOR0 = BIT(13), + MUTEX_MOD_DISP_CCORR0 = BIT(14), + MUTEX_MOD_DISP_AAL0 = BIT(15), + MUTEX_MOD_DISP_GAMMA0 = BIT(16), + MUTEX_MOD_DISP_DITHER0 = BIT(17), + MUTEX_MOD_DISP_PWM0 = BIT(28), + MUTEX_MOD_MAIN_PATH = MUTEX_MOD_DISP_OVL0 | MUTEX_MOD_DISP_OVL0_2L | + MUTEX_MOD_DISP_RDMA0 | MUTEX_MOD_DISP_COLOR0 | + MUTEX_MOD_DISP_CCORR0 | MUTEX_MOD_DISP_AAL0 | + MUTEX_MOD_DISP_GAMMA0| MUTEX_MOD_DISP_DITHER0, +}; + +enum { + MUTEX_SOF_SINGLE_MODE = 0, + MUTEX_SOF_DSI0 = 1, + MUTEX_SOF_DPI0 = 2, +}; + +struct disp_ovl_regs { + u32 sta; + u32 inten; + u32 intsta; + u32 en; + u32 trig; + u32 rst; + u32 reserved_0x018[2]; + u32 roi_size; + u32 datapath_con; + u32 roi_bgclr; + u32 src_con; + struct { + u32 con; + u32 srckey; + u32 src_size; + u32 offset; + u32 reserved0; + u32 pitch; + u32 reserved1[2]; + } layer[4]; + u32 reserved_0x0B0[4]; + struct { + u32 ctrl; + u32 reserved0; + u32 mem_gmc_setting; + u32 mem_slow_con; + u32 fifo_ctrl; + u32 reserved1[3]; + } rdma[4]; + u32 reserved_0x140[880]; + u32 reserved_0xF00[16]; + u32 l0_addr; + u32 reserved_0xF44[7]; + u32 l1_addr; + u32 reserved_0xF64[7]; + u32 l2_addr; + u32 reserved_0xF84[7]; + u32 l3_addr; +}; + +check_member(disp_ovl_regs, reserved_0x018, 0x018); +check_member(disp_ovl_regs, roi_size, 0x020); +check_member(disp_ovl_regs, reserved_0x0B0, 0x0B0); +check_member(disp_ovl_regs, reserved_0x140, 0x140); +check_member(disp_ovl_regs, reserved_0xF00, 0xF00); +check_member(disp_ovl_regs, l0_addr, 0xF40); +check_member(disp_ovl_regs, l3_addr, 0xFA0); +static struct disp_ovl_regs *const disp_ovl[2] = { + (void *)DISP_OVL0_BASE, (void *)DISP_OVL0_2L_BASE +}; + +struct disp_rdma_regs { + u32 int_enable; + u32 int_status; + u32 reserved0[2]; + u32 global_con; + u32 size_con_0; + u32 size_con_1; + u32 target_line; + u32 reserved1; + u32 mem_con; + u32 reserved2; + u32 mem_src_pitch; + u32 mem_gmc_setting_0; + u32 mem_gmc_setting_1; + u32 mem_slow_con; + u32 mem_gmc_setting_2; + u32 fifo_con; + u32 reserved3[4]; + u32 cf[3][3]; + u32 cf_pre_add[3]; + u32 cf_post_add[3]; + u32 dummy; + u32 debug_out_sel; +}; + +enum { + RDMA_ENGINE_EN = BIT(0), + RDMA_FIFO_UNDERFLOW_EN = BIT(31), + RDMA_FIFO_SIZE_0 = 5, /* 5K */ + RDMA_VREFRESH = 60, /* vrefresh 60HZ */ + RDMA_MEM_GMC = 0x40402020, +}; + +check_member(disp_rdma_regs, debug_out_sel, 0x94); +static struct disp_rdma_regs *const disp_rdma[2] = { + (void *)DISP_RDMA0_BASE, + (void *)DISP_RDMA1_BASE, +}; + +struct disp_color_regs { + u8 reserved0[1024]; + u32 cfg_main; + u8 reserved1[2044]; + u32 start; + u8 reserved2[76]; + u32 width; + u32 height; +}; + +check_member(disp_color_regs, cfg_main, 0x400); +check_member(disp_color_regs, start, 0xC00); +check_member(disp_color_regs, width, 0xC50); +check_member(disp_color_regs, height, 0xC54); +static struct disp_color_regs *const disp_color = (void *)DISP_COLOR0_BASE; + +enum { + COLOR_BYPASS_ALL = BIT(7), + COLOR_SEQ_SEL = BIT(13), +}; + +struct disp_pq_regs { + u32 en; + u32 reset; + u32 inten; + u32 intsta; + u32 status; + u32 reserved0[3]; + u32 cfg; + u32 reserved1[3]; + u32 size; +}; + +enum { + PQ_EN = BIT(0), + PQ_RELAY_MODE = BIT(0), +}; + +static struct disp_pq_regs *const disp_ccorr = (void *)DISP_CCORR0_BASE; + +static struct disp_pq_regs *const disp_aal = (void *)DISP_AAL0_BASE; + +static struct disp_pq_regs *const disp_gamma = (void *)DISP_GAMMA0_BASE; + +static struct disp_pq_regs *const disp_dither = (void *)DISP_DITHER0_BASE; + +enum OVL_INPUT_FORMAT { + OVL_INFMT_RGB565 = 0, + OVL_INFMT_RGB888 = 1, + OVL_INFMT_RGBA8888 = 2, + OVL_INFMT_ARGB8888 = 3, + OVL_INFMT_UYVY = 4, + OVL_INFMT_YUYV = 5, + OVL_INFMT_UNKNOWN = 16, + + OVL_COLOR_BASE = 30, + OVL_INFMT_BGR565 = OVL_INFMT_RGB565 + OVL_COLOR_BASE, + OVL_INFMT_BGR888 = OVL_INFMT_RGB888 + OVL_COLOR_BASE, + OVL_INFMT_BGRA8888 = OVL_INFMT_RGBA8888 + OVL_COLOR_BASE, + OVL_INFMT_ABGR8888 = OVL_INFMT_ARGB8888 + OVL_COLOR_BASE, +}; + +void mtk_ddp_init(void); +void mtk_ddp_mode_set(const struct edid *edid); + +#endif
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display driver ......................................................................
Patch Set 1:
(23 comments)
https://review.coreboot.org/#/c/31478/1/src/soc/mediatek/mt8183/include/soc/... File src/soc/mediatek/mt8183/include/soc/ddp.h:
https://review.coreboot.org/#/c/31478/1/src/soc/mediatek/mt8183/include/soc/... PS1, Line 35: u32 disp_ovl0_2l_mout_en; /* 0xF04 */ please, no space before tabs
https://review.coreboot.org/#/c/31478/1/src/soc/mediatek/mt8183/include/soc/... PS1, Line 36: u32 disp_ovl1_2l_mout_en; /* 0xF08 */ please, no space before tabs
https://review.coreboot.org/#/c/31478/1/src/soc/mediatek/mt8183/include/soc/... PS1, Line 37: u32 disp_dither0_mout_en; /* 0xF0C */ please, no space before tabs
https://review.coreboot.org/#/c/31478/1/src/soc/mediatek/mt8183/include/soc/... PS1, Line 39: u32 disp_path0_sel_in; /* 0xF24 */ please, no space before tabs
https://review.coreboot.org/#/c/31478/1/src/soc/mediatek/mt8183/include/soc/... PS1, Line 70: CG_CON0_SMI_COMMON = BIT(0), please, no space before tabs
https://review.coreboot.org/#/c/31478/1/src/soc/mediatek/mt8183/include/soc/... PS1, Line 71: CG_CON0_SMI_LARB0 = BIT(1), please, no space before tabs
https://review.coreboot.org/#/c/31478/1/src/soc/mediatek/mt8183/include/soc/... PS1, Line 72: CG_CON0_GALS_COMMON0 = BIT(3), please, no space before tabs
https://review.coreboot.org/#/c/31478/1/src/soc/mediatek/mt8183/include/soc/... PS1, Line 73: CG_CON0_GALS_COMMON1 = BIT(4), please, no space before tabs
https://review.coreboot.org/#/c/31478/1/src/soc/mediatek/mt8183/include/soc/... PS1, Line 77: CG_CON0_DISP_RDMA0 = BIT(23), please, no space before tabs
https://review.coreboot.org/#/c/31478/1/src/soc/mediatek/mt8183/include/soc/... PS1, Line 78: CG_CON0_DISP_RDMA1 = BIT(24), please, no space before tabs
https://review.coreboot.org/#/c/31478/1/src/soc/mediatek/mt8183/include/soc/... PS1, Line 79: CG_CON0_DISP_WDMA0 = BIT(25), please, no space before tabs
https://review.coreboot.org/#/c/31478/1/src/soc/mediatek/mt8183/include/soc/... PS1, Line 80: CG_CON0_DISP_COLOR0 = BIT(26), please, no space before tabs
https://review.coreboot.org/#/c/31478/1/src/soc/mediatek/mt8183/include/soc/... PS1, Line 81: CG_CON0_DISP_CCORR0 = BIT(27), please, no space before tabs
https://review.coreboot.org/#/c/31478/1/src/soc/mediatek/mt8183/include/soc/... PS1, Line 82: CG_CON0_DISP_AAL0 = BIT(28), please, no space before tabs
https://review.coreboot.org/#/c/31478/1/src/soc/mediatek/mt8183/include/soc/... PS1, Line 83: CG_CON0_DISP_GAMMA0 = BIT(29), please, no space before tabs
https://review.coreboot.org/#/c/31478/1/src/soc/mediatek/mt8183/include/soc/... PS1, Line 97: CG_CON0_ALL = 0xffffffff please, no space before tabs
https://review.coreboot.org/#/c/31478/1/src/soc/mediatek/mt8183/include/soc/... PS1, Line 113: OVL0_MOUT_EN_RDMA0 = BIT(0), please, no space before tabs
https://review.coreboot.org/#/c/31478/1/src/soc/mediatek/mt8183/include/soc/... PS1, Line 114: OVL0_MOUT_EN_OVL0_2L = BIT(4), please, no space before tabs
https://review.coreboot.org/#/c/31478/1/src/soc/mediatek/mt8183/include/soc/... PS1, Line 115: OVL0_2L_MOUT_EN_DISP_PATH0 = BIT(0), please, no space before tabs
https://review.coreboot.org/#/c/31478/1/src/soc/mediatek/mt8183/include/soc/... PS1, Line 116: OVL1_2L_MOUT_EN_DISP_RDMA1 = BIT(4), please, no space before tabs
https://review.coreboot.org/#/c/31478/1/src/soc/mediatek/mt8183/include/soc/... PS1, Line 161: MUTEX_MOD_DISP_GAMMA0| MUTEX_MOD_DISP_DITHER0, need consistent spacing around '|' (ctx:VxW)
https://review.coreboot.org/#/c/31478/1/src/soc/mediatek/mt8183/include/soc/... PS1, Line 295: PQ_EN = BIT(0), please, no space before tabs
https://review.coreboot.org/#/c/31478/1/src/soc/mediatek/mt8183/include/soc/... PS1, Line 296: PQ_RELAY_MODE = BIT(0), please, no space before tabs
Hello Julius Werner, You-Cheng Syu, Tristan Hsieh, Hung-Te Lin, build bot (Jenkins), Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/31478
to look at the new patch set (#2).
Change subject: mediatek/mt8183: Add display driver ......................................................................
mediatek/mt8183: Add display driver
BUG=b:80501386 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: Ic4aecc58d081f14f5d136b9ff8e813e6f40f78eb Signed-off-by: Yongqiang Niu yongqiang.niu@mediatek.com --- M src/mainboard/google/kukui/mainboard.c M src/soc/mediatek/mt8183/Makefile.inc A src/soc/mediatek/mt8183/ddp.c M src/soc/mediatek/mt8183/include/soc/addressmap.h A src/soc/mediatek/mt8183/include/soc/ddp.h 5 files changed, 603 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/31478/2
You-Cheng Syu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display driver ......................................................................
Patch Set 2:
(2 comments)
https://review.coreboot.org/#/c/31478/2/src/mainboard/google/kukui/mainboard... File src/mainboard/google/kukui/mainboard.c:
https://review.coreboot.org/#/c/31478/2/src/mainboard/google/kukui/mainboard... PS2, Line 53: ret < 0 It seems to me that 'ret' is always zero.
https://review.coreboot.org/#/c/31478/2/src/soc/mediatek/mt8183/Makefile.inc File src/soc/mediatek/mt8183/Makefile.inc:
https://review.coreboot.org/#/c/31478/2/src/soc/mediatek/mt8183/Makefile.inc... PS2, Line 52: ramstage-y += ddp.c Move this line in between line 42-43?
yongqiang niu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display driver ......................................................................
Patch Set 2:
(2 comments)
https://review.coreboot.org/#/c/31478/2/src/mainboard/google/kukui/mainboard... File src/mainboard/google/kukui/mainboard.c:
https://review.coreboot.org/#/c/31478/2/src/mainboard/google/kukui/mainboard... PS2, Line 53: ret < 0
It seems to me that 'ret' is always zero.
i will moved this ret check into another patch, which will add dsi init function
https://review.coreboot.org/#/c/31478/2/src/soc/mediatek/mt8183/Makefile.inc File src/soc/mediatek/mt8183/Makefile.inc:
https://review.coreboot.org/#/c/31478/2/src/soc/mediatek/mt8183/Makefile.inc... PS2, Line 52: ramstage-y += ddp.c
Move this line in between line 42-43?
ok, reordered by file name
You-Cheng Syu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display driver ......................................................................
Patch Set 2:
(1 comment)
https://review.coreboot.org/#/c/31478/2//COMMIT_MSG Commit Message:
https://review.coreboot.org/#/c/31478/2//COMMIT_MSG@9 PS2, Line 9: BUG=b:80501386 Also add b:117254947
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display driver ......................................................................
Patch Set 2:
(2 comments)
Please split out the mainboard change into a separate commit.
https://review.coreboot.org/#/c/31478/2//COMMIT_MSG Commit Message:
https://review.coreboot.org/#/c/31478/2//COMMIT_MSG@8 PS2, Line 8: What datasheet did you use?
https://review.coreboot.org/#/c/31478/2/src/mainboard/google/kukui/mainboard... File src/mainboard/google/kukui/mainboard.c:
https://review.coreboot.org/#/c/31478/2/src/mainboard/google/kukui/mainboard... PS2, Line 66: start Starting
Hello Julius Werner, You-Cheng Syu, Tristan Hsieh, Hung-Te Lin, build bot (Jenkins), Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/31478
to look at the new patch set (#3).
Change subject: mediatek/mt8183: Add display driver ......................................................................
mediatek/mt8183: Add display driver
BUG=b:80501386,b:117254947 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: Ic4aecc58d081f14f5d136b9ff8e813e6f40f78eb Signed-off-by: Yongqiang Niu yongqiang.niu@mediatek.com --- M src/soc/mediatek/mt8183/Makefile.inc A src/soc/mediatek/mt8183/ddp.c M src/soc/mediatek/mt8183/include/soc/addressmap.h A src/soc/mediatek/mt8183/include/soc/ddp.h 4 files changed, 570 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/31478/3
Yongqiang Niu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display driver ......................................................................
Patch Set 3:
(3 comments)
https://review.coreboot.org/#/c/31478/2//COMMIT_MSG Commit Message:
https://review.coreboot.org/#/c/31478/2//COMMIT_MSG@8 PS2, Line 8:
What datasheet did you use?
does datasheet means hardware register map?
https://review.coreboot.org/#/c/31478/2//COMMIT_MSG@9 PS2, Line 9: BUG=b:80501386
Also add b:117254947
add this bug id in patch3
https://review.coreboot.org/#/c/31478/2/src/mainboard/google/kukui/mainboard... File src/mainboard/google/kukui/mainboard.c:
https://review.coreboot.org/#/c/31478/2/src/mainboard/google/kukui/mainboard... PS2, Line 66: start
Starting
modified in patch3
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display driver ......................................................................
Patch Set 3:
(1 comment)
https://review.coreboot.org/#/c/31478/2//COMMIT_MSG Commit Message:
https://review.coreboot.org/#/c/31478/2//COMMIT_MSG@8 PS2, Line 8:
does datasheet means hardware register map?
No, that means if there's a model, or product number that this implementation is for.
But I'd assume this is a internal display stack of 8183 right?
You-Cheng Syu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display driver ......................................................................
Patch Set 3: Code-Review+1
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display driver ......................................................................
Patch Set 3:
(3 comments)
Is it possible to merge with 8173/ddp.c, then move to common/ddp.c?
https://review.coreboot.org/#/c/31478/3/src/soc/mediatek/mt8183/include/soc/... File src/soc/mediatek/mt8183/include/soc/ddp.h:
https://review.coreboot.org/#/c/31478/3/src/soc/mediatek/mt8183/include/soc/... PS3, Line 53: check_member(mmsys_cfg_regs, reserved_0x11C, 0x11C); : check_member(mmsys_cfg_regs, disp_ovl0_mout_en, 0xF00); : check_member(mmsys_cfg_regs, reserved_0xF10, 0xF10); : check_member(mmsys_cfg_regs, disp_path0_sel_in, 0xF24); : check_member(mmsys_cfg_regs, disp_ovl0_2l_sel_in, 0xF38); : check_member(mmsys_cfg_regs, reserved_0xF3C, 0xF3C); : check_member(mmsys_cfg_regs, disp_rdma0_sout_sel_in, 0xF50); I think these are not needed. We should check only critical addresses, probably just start of functional reg (mmsys_cg_con0) and end of reg (dpi0_sel_sout_sel_in).
https://review.coreboot.org/#/c/31478/3/src/soc/mediatek/mt8183/include/soc/... PS3, Line 212: check_member(disp_ovl_regs, reserved_0x018, 0x018); : check_member(disp_ovl_regs, roi_size, 0x020); : check_member(disp_ovl_regs, reserved_0x0B0, 0x0B0); : check_member(disp_ovl_regs, reserved_0x140, 0x140); : check_member(disp_ovl_regs, reserved_0xF00, 0xF00); : check_member(disp_ovl_regs, l0_addr, 0xF40); not needed
https://review.coreboot.org/#/c/31478/3/src/soc/mediatek/mt8183/include/soc/... PS3, Line 272: check_member(disp_color_regs, cfg_main, 0x400); : check_member(disp_color_regs, start, 0xC00); : check_member(disp_color_regs, width, 0xC50); not needed
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display driver ......................................................................
Patch Set 3:
(12 comments)
https://review.coreboot.org/#/c/31478/3/src/soc/mediatek/mt8183/ddp.c File src/soc/mediatek/mt8183/ddp.c:
https://review.coreboot.org/#/c/31478/3/src/soc/mediatek/mt8183/ddp.c@32 PS3, Line 32: blank links in this function are not needed.
https://review.coreboot.org/#/c/31478/3/src/soc/mediatek/mt8183/ddp.c@84 PS3, Line 84: /* Config width */ probably no need since it's pretty trivial; or a comment like "Configure with and height to reg size_con_0".
https://review.coreboot.org/#/c/31478/3/src/soc/mediatek/mt8183/ddp.c@87 PS3, Line 87: /* Config height */ probably no need since it's pretty trivial
https://review.coreboot.org/#/c/31478/3/src/soc/mediatek/mt8183/ddp.c@168 PS3, Line 168: /* Setup RDMA0 */ I think this is very trivial. Instead maybe you can explain why only 0 is needed in comments?
https://review.coreboot.org/#/c/31478/3/src/soc/mediatek/mt8183/ddp.c@172 PS3, Line 172: /* Setup Color */ no need since the function name below clearly explains.
https://review.coreboot.org/#/c/31478/3/src/soc/mediatek/mt8183/ddp.c@175 PS3, Line 175: /* Setup CCORR */ no need since the function name below clearly explains. Probably better if the comment explains what is CCORR (what it stands for).
https://review.coreboot.org/#/c/31478/3/src/soc/mediatek/mt8183/ddp.c@178 PS3, Line 178: /* Setup AAL */ No need unless if you want to add what AAL stands for in the comment.
https://review.coreboot.org/#/c/31478/3/src/soc/mediatek/mt8183/ddp.c@181 PS3, Line 181: /* Setup GAMMA */ no need
https://review.coreboot.org/#/c/31478/3/src/soc/mediatek/mt8183/ddp.c@184 PS3, Line 184: /* Setup DITHER */ no need
https://review.coreboot.org/#/c/31478/3/src/soc/mediatek/mt8183/ddp.c@187 PS3, Line 187: /* Setup main path connection */ no need
https://review.coreboot.org/#/c/31478/3/src/soc/mediatek/mt8183/ddp.c@190 PS3, Line 190: /* Setup main path mutex */ no need
https://review.coreboot.org/#/c/31478/3/src/soc/mediatek/mt8183/ddp.c@204 PS3, Line 204: 0x380 any comments for what this magic number is? maybe define it in address map or regs offset?
Yongqiang Niu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display driver ......................................................................
Patch Set 3:
Patch Set 3:
(3 comments)
Is it possible to merge with 8173/ddp.c, then move to common/ddp.c?
there are many function and hardware register define difference between mt8183 and mt8173, i suppose keep them in different c file is better.
Yongqiang Niu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display driver ......................................................................
Patch Set 3:
(15 comments)
https://review.coreboot.org/#/c/31478/3/src/soc/mediatek/mt8183/ddp.c File src/soc/mediatek/mt8183/ddp.c:
https://review.coreboot.org/#/c/31478/3/src/soc/mediatek/mt8183/ddp.c@32 PS3, Line 32:
blank links in this function are not needed.
i will remove blank lines in next patch
https://review.coreboot.org/#/c/31478/3/src/soc/mediatek/mt8183/ddp.c@84 PS3, Line 84: /* Config width */
probably no need since it's pretty trivial; or a comment like "Configure with and height to reg size […]
i will remove this comment in next patch
https://review.coreboot.org/#/c/31478/3/src/soc/mediatek/mt8183/ddp.c@87 PS3, Line 87: /* Config height */
probably no need since it's pretty trivial
i will remove this comment in next patch
https://review.coreboot.org/#/c/31478/3/src/soc/mediatek/mt8183/ddp.c@168 PS3, Line 168: /* Setup RDMA0 */
I think this is very trivial. […]
i will remove this comment in next patch
https://review.coreboot.org/#/c/31478/3/src/soc/mediatek/mt8183/ddp.c@172 PS3, Line 172: /* Setup Color */
no need since the function name below clearly explains.
i will remove this comment in next patch
https://review.coreboot.org/#/c/31478/3/src/soc/mediatek/mt8183/ddp.c@175 PS3, Line 175: /* Setup CCORR */
no need since the function name below clearly explains. […]
i will remove this comment in next patch
https://review.coreboot.org/#/c/31478/3/src/soc/mediatek/mt8183/ddp.c@178 PS3, Line 178: /* Setup AAL */
No need unless if you want to add what AAL stands for in the comment.
i will remove this comment in next patch
https://review.coreboot.org/#/c/31478/3/src/soc/mediatek/mt8183/ddp.c@181 PS3, Line 181: /* Setup GAMMA */
no need
i will remove this comment in next patch
https://review.coreboot.org/#/c/31478/3/src/soc/mediatek/mt8183/ddp.c@184 PS3, Line 184: /* Setup DITHER */
no need
i will remove this comment in next patch
https://review.coreboot.org/#/c/31478/3/src/soc/mediatek/mt8183/ddp.c@187 PS3, Line 187: /* Setup main path connection */
no need
i will remove this comment in next patch
https://review.coreboot.org/#/c/31478/3/src/soc/mediatek/mt8183/ddp.c@190 PS3, Line 190: /* Setup main path mutex */
no need
i will remove this comment in next patch
https://review.coreboot.org/#/c/31478/3/src/soc/mediatek/mt8183/ddp.c@204 PS3, Line 204: 0x380
any comments for what this magic number is? maybe define it in address map or regs offset?
i will define this number as a macro or enum number
https://review.coreboot.org/#/c/31478/3/src/soc/mediatek/mt8183/include/soc/... File src/soc/mediatek/mt8183/include/soc/ddp.h:
https://review.coreboot.org/#/c/31478/3/src/soc/mediatek/mt8183/include/soc/... PS3, Line 53: check_member(mmsys_cfg_regs, reserved_0x11C, 0x11C); : check_member(mmsys_cfg_regs, disp_ovl0_mout_en, 0xF00); : check_member(mmsys_cfg_regs, reserved_0xF10, 0xF10); : check_member(mmsys_cfg_regs, disp_path0_sel_in, 0xF24); : check_member(mmsys_cfg_regs, disp_ovl0_2l_sel_in, 0xF38); : check_member(mmsys_cfg_regs, reserved_0xF3C, 0xF3C); : check_member(mmsys_cfg_regs, disp_rdma0_sout_sel_in, 0xF50);
I think these are not needed. […]
i will remove these check in next patch
https://review.coreboot.org/#/c/31478/3/src/soc/mediatek/mt8183/include/soc/... PS3, Line 212: check_member(disp_ovl_regs, reserved_0x018, 0x018); : check_member(disp_ovl_regs, roi_size, 0x020); : check_member(disp_ovl_regs, reserved_0x0B0, 0x0B0); : check_member(disp_ovl_regs, reserved_0x140, 0x140); : check_member(disp_ovl_regs, reserved_0xF00, 0xF00); : check_member(disp_ovl_regs, l0_addr, 0xF40);
not needed
i will remove these check in next patch
https://review.coreboot.org/#/c/31478/3/src/soc/mediatek/mt8183/include/soc/... PS3, Line 272: check_member(disp_color_regs, cfg_main, 0x400); : check_member(disp_color_regs, start, 0xC00); : check_member(disp_color_regs, width, 0xC50);
not needed
i will remove these check in next patch
Hello Julius Werner, You-Cheng Syu, Tristan Hsieh, Hung-Te Lin, build bot (Jenkins), Chun-ta Lin, Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/31478
to look at the new patch set (#4).
Change subject: mediatek/mt8183: Add display driver ......................................................................
mediatek/mt8183: Add display driver
BUG=b:80501386,b:117254947 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: Ic4aecc58d081f14f5d136b9ff8e813e6f40f78eb Signed-off-by: Yongqiang Niu yongqiang.niu@mediatek.com --- M src/soc/mediatek/mt8183/Makefile.inc A src/soc/mediatek/mt8183/ddp.c M src/soc/mediatek/mt8183/include/soc/addressmap.h A src/soc/mediatek/mt8183/include/soc/ddp.h 4 files changed, 541 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/31478/4
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display driver ......................................................................
Patch Set 4:
(7 comments)
there are many function and hardware register define difference between mt8183 and mt8173
There are also many functions being the same (or identical - by specifying idx=0), for example ovl_set_roi, ovl_layer_enable, rdma_start, rdma_config, color_start, ovl_layer_config, half of main_disp_path_setup, some of mtk_ddp_mode_set.
A quick calculation, the files are having 127 lines in diff while 8183 ddp.c is 212 lines, so it's about 40% in common.
I think we may still do something, for example have few functions in common/ddp.c, and then have soc-specific part in mt*/ddp.c; but it's also true this is probably not that urgent.
https://review.coreboot.org/#/c/31478/4/src/soc/mediatek/mt8183/ddp.c File src/soc/mediatek/mt8183/ddp.c:
https://review.coreboot.org/#/c/31478/4/src/soc/mediatek/mt8183/ddp.c@161 PS4, Line 161: remove the blank line here
https://review.coreboot.org/#/c/31478/4/src/soc/mediatek/mt8183/ddp.c@163 PS4, Line 163: remove the blank line here
https://review.coreboot.org/#/c/31478/4/src/soc/mediatek/mt8183/ddp.c@165 PS4, Line 165: remove the blank line here
https://review.coreboot.org/#/c/31478/4/src/soc/mediatek/mt8183/ddp.c@167 PS4, Line 167: remove the blank line here
https://review.coreboot.org/#/c/31478/4/src/soc/mediatek/mt8183/ddp.c@169 PS4, Line 169: remove the blank line here
https://review.coreboot.org/#/c/31478/4/src/soc/mediatek/mt8183/ddp.c@171 PS4, Line 171: remove the blank line here
https://review.coreboot.org/#/c/31478/4/src/soc/mediatek/mt8183/ddp.c@173 PS4, Line 173: remove the blank line here
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display driver ......................................................................
Patch Set 4:
(1 comment)
https://review.coreboot.org/#/c/31478/4//COMMIT_MSG Commit Message:
https://review.coreboot.org/#/c/31478/4//COMMIT_MSG@8 PS4, Line 8: For a diffstat of over 500 lines, please add a commit message summary, detailing what this driver does, where the data sheet is, and so on.
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display driver ......................................................................
Patch Set 5:
(2 comments)
https://review.coreboot.org/#/c/31478/5/src/soc/mediatek/mt8183/ddp.c File src/soc/mediatek/mt8183/ddp.c:
https://review.coreboot.org/#/c/31478/5/src/soc/mediatek/mt8183/ddp.c@160 PS5, Line 160: rdma_config please remove blank line below. same as following lines.
https://review.coreboot.org/#/c/31478/5/src/soc/mediatek/mt8183/ddp.c@206 PS5, Line 206: please remove the blank lines here (and below)
jitao shi has uploaded a new patch set (#7) to the change originally created by yongqiang niu. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display driver ......................................................................
mediatek/mt8183: Add display driver
BUG=b:80501386,b:117254947 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: Ic4aecc58d081f14f5d136b9ff8e813e6f40f78eb Signed-off-by: Yongqiang Niu yongqiang.niu@mediatek.com --- M src/soc/mediatek/mt8183/Makefile.inc A src/soc/mediatek/mt8183/ddp.c M src/soc/mediatek/mt8183/include/soc/addressmap.h A src/soc/mediatek/mt8183/include/soc/ddp.h 4 files changed, 541 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/31478/7
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display driver ......................................................................
Patch Set 7:
(2 comments)
https://review.coreboot.org/#/c/31478/5/src/soc/mediatek/mt8183/ddp.c File src/soc/mediatek/mt8183/ddp.c:
https://review.coreboot.org/#/c/31478/5/src/soc/mediatek/mt8183/ddp.c@160 PS5, Line 160: rdma_config
please remove blank line below. […]
this is still not fixed.
https://review.coreboot.org/#/c/31478/5/src/soc/mediatek/mt8183/ddp.c@206 PS5, Line 206:
please remove the blank lines here (and below)
this is still not fixed.
Hello Julius Werner, You-Cheng Syu, jitao shi, Tristan Hsieh, Hung-Te Lin, build bot (Jenkins), Chun-ta Lin, Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/31478
to look at the new patch set (#8).
Change subject: mediatek/mt8183: Add display driver ......................................................................
mediatek/mt8183: Add display driver
BUG=b:80501386,b:117254947 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: Ic4aecc58d081f14f5d136b9ff8e813e6f40f78eb Signed-off-by: Yongqiang Niu yongqiang.niu@mediatek.com --- M src/soc/mediatek/mt8183/Makefile.inc A src/soc/mediatek/mt8183/ddp.c M src/soc/mediatek/mt8183/include/soc/addressmap.h A src/soc/mediatek/mt8183/include/soc/ddp.h 4 files changed, 531 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/31478/8
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display driver ......................................................................
Patch Set 8:
(1 comment)
https://review.coreboot.org/#/c/31478/8//COMMIT_MSG Commit Message:
https://review.coreboot.org/#/c/31478/8//COMMIT_MSG@9 PS8, Line 9: BUG Please add more information in the description. Like Paul mentioned: "please add a commit message summary, detailing what this driver does, where the data sheet is, and so on."
jitao shi has uploaded a new patch set (#10) to the change originally created by yongqiang niu. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display driver ......................................................................
mediatek/mt8183: Add display driver
BUG=b:80501386,b:117254947 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: Ic4aecc58d081f14f5d136b9ff8e813e6f40f78eb Signed-off-by: Yongqiang Niu yongqiang.niu@mediatek.com --- M src/soc/mediatek/mt8183/Makefile.inc A src/soc/mediatek/mt8183/ddp.c M src/soc/mediatek/mt8183/include/soc/addressmap.h A src/soc/mediatek/mt8183/include/soc/ddp.h 4 files changed, 531 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/31478/10
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display driver ......................................................................
Patch Set 11:
(2 comments)
The build failure is caused by ATF include files. Can you rebase this to ToT instead of ATF? Then we may review and merge display changes earlier.
https://review.coreboot.org/#/c/31478/11/src/soc/mediatek/mt8183/include/soc... File src/soc/mediatek/mt8183/include/soc/ddp.h:
https://review.coreboot.org/#/c/31478/11/src/soc/mediatek/mt8183/include/soc... PS11, Line 4: 2015 2019
https://review.coreboot.org/#/c/31478/11/src/soc/mediatek/mt8183/include/soc... PS11, Line 58: /* DISP_REG_CONFIG_MMSYS_CG_CON0 : Configures free-run clock gating 0 : 0: Enable clock : 1: Clock gating */ /* * DISP_REG_CONFIG_MMSYS_CG_CON0 * Configure free-run clock gating 0 * 0: Enable clock * 1: Clock gating */
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display driver ......................................................................
Patch Set 13:
(3 comments)
Pretty close - just clarify few of the comments and then I think we're good to go.
https://review.coreboot.org/#/c/31478/12/src/soc/mediatek/mt8183/include/soc... File src/soc/mediatek/mt8183/include/soc/ddp.h:
https://review.coreboot.org/#/c/31478/12/src/soc/mediatek/mt8183/include/soc... PS12, Line 4: 2015 2019
https://review.coreboot.org/#/c/31478/12/src/soc/mediatek/mt8183/include/soc... PS12, Line 58: /* DISP_REG_CONFIG_MMSYS_CG_CON0 : Configures free-run clock gating 0 : 0: Enable clock : 1: Clock gating */ Is this comment for following enums? I can't see the relationship with that
https://review.coreboot.org/#/c/31478/12/src/soc/mediatek/mt8183/include/soc... PS12, Line 93: /* DISP_REG_CONFIG_MMSYS_CG_CON1 : Configures free-run clock gating 1 : 0: Enable clock : 1: Clock gating */ same here - is this related to any of the enums below?
Julius Werner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display driver ......................................................................
Patch Set 13:
A lot of this seems duplicated from MT8173 code. Can you factor out the common parts?
yongqiang niu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display driver ......................................................................
Patch Set 13:
(2 comments)
https://review.coreboot.org/#/c/31478/12/src/soc/mediatek/mt8183/include/soc... File src/soc/mediatek/mt8183/include/soc/ddp.h:
https://review.coreboot.org/#/c/31478/12/src/soc/mediatek/mt8183/include/soc... PS12, Line 58: /* DISP_REG_CONFIG_MMSYS_CG_CON0 : Configures free-run clock gating 0 : 0: Enable clock : 1: Clock gating */
Is this comment for following enums? I can't see the relationship with that
yes.
the bits defined in CG_CON0_DISP_ALL will be clear to 0 in disp_clock_on, that will enable these module clock.
https://review.coreboot.org/#/c/31478/12/src/soc/mediatek/mt8183/include/soc... PS12, Line 93: /* DISP_REG_CONFIG_MMSYS_CG_CON1 : Configures free-run clock gating 1 : 0: Enable clock : 1: Clock gating */
same here - is this related to any of the enums below?
same with the last one
jitao shi has uploaded a new patch set (#14) to the change originally created by yongqiang niu. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display driver ......................................................................
mediatek/mt8183: Add display driver
BUG=b:80501386,b:117254947 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: Ic4aecc58d081f14f5d136b9ff8e813e6f40f78eb Signed-off-by: Yongqiang Niu yongqiang.niu@mediatek.com --- M src/soc/mediatek/mt8183/Makefile.inc A src/soc/mediatek/mt8183/ddp.c M src/soc/mediatek/mt8183/include/soc/addressmap.h A src/soc/mediatek/mt8183/include/soc/ddp.h 4 files changed, 531 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/31478/14
yongqiang niu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display driver ......................................................................
Patch Set 14:
Patch Set 13:
A lot of this seems duplicated from MT8173 code. Can you factor out the common parts?
there are 18 functions in 8183 ddp.c, but only 1(color_start) of them is same with 8173, the duplicate rate is 5.5%
there are 17 struct or enum define in 8183 ddp.h, but only 2 (disp_color_regs, OVL_INPUT_FORMAT) of them is same with 8173, the duplicate rate is 11.7%
i suppose the duplicate rate is too low, and no common them, please double confirm
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display driver ......................................................................
Patch Set 14:
there are 18 functions in 8183 ddp.c, but only 1(color_start) of them is same with 8173, the duplicate rate is 5.5%
We should look at functions that can be integrated. For example,
disp_config_main_path_mutex has only difference in clock source line
ovl_set_roi can be merged by 8183's version (and for 8173 we simply call with idx=0)
ovl_layer_enable also only needs an additional index arg
rdma_start also only needs an additional index arg
rdma_config is almost the same - probably also only need the index arg
And there can be more to be refactored.
yongqiang niu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display driver ......................................................................
Patch Set 14:
Patch Set 14:
there are 18 functions in 8183 ddp.c, but only 1(color_start) of them is same with 8173, the duplicate rate is 5.5%
We should look at functions that can be integrated. For example,
disp_config_main_path_mutex has only difference in clock source line
ovl_set_roi can be merged by 8183's version (and for 8173 we simply call with idx=0)
ovl_layer_enable also only needs an additional index arg
rdma_start also only needs an additional index arg
rdma_config is almost the same - probably also only need the index arg
And there can be more to be refactored.
if refactor these function as you mentioned, is there anyone could test the refactor patch on 8173 platform?
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display driver ......................................................................
Patch Set 14:
if refactor these function as you mentioned, is there anyone could test the refactor patch on 8173 platform?
You can check with SJ? No need for a full firmware qualification, just some quick test to make sure it still can display firmware screens should be enough.
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display driver ......................................................................
Patch Set 14:
ping? I think we do need to get this merged.
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display driver ......................................................................
Patch Set 14:
(1 comment)
https://review.coreboot.org/c/coreboot/+/31478/14//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/31478/14//COMMIT_MSG@8 PS14, Line 8: Please give more details for a change-set with such a big diffstat.
Also, display driver is ambiguous. I guess graphics/GFX driver is better, because display driver could also be the “panel” driver, couldn’t it?
Julius Werner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display driver ......................................................................
Patch Set 14:
(1 comment)
https://review.coreboot.org/c/coreboot/+/31478/14//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/31478/14//COMMIT_MSG@8 PS14, Line 8:
Please give more details for a change-set with such a big diffstat. […]
This is a driver for the display controller. When people talk about graphics/GFX they usually talk about graphics accelerators which is something else.
Hung-Te Lin has uploaded a new patch set (#15) to the change originally created by yongqiang niu. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add driver for display controller ......................................................................
mediatek/mt8183: Add driver for display controller
BUG=b:80501386,b:117254947 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: Ic4aecc58d081f14f5d136b9ff8e813e6f40f78eb Signed-off-by: Yongqiang Niu yongqiang.niu@mediatek.com --- M src/soc/mediatek/mt8183/Makefile.inc A src/soc/mediatek/mt8183/ddp.c M src/soc/mediatek/mt8183/include/soc/addressmap.h A src/soc/mediatek/mt8183/include/soc/ddp.h 4 files changed, 531 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/31478/15
Hung-Te Lin has uploaded a new patch set (#16) to the change originally created by yongqiang niu. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display controller driver ......................................................................
mediatek/mt8183: Add display controller driver
BUG=b:80501386,b:117254947 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: Ic4aecc58d081f14f5d136b9ff8e813e6f40f78eb Signed-off-by: Yongqiang Niu yongqiang.niu@mediatek.com --- M src/soc/mediatek/mt8183/Makefile.inc A src/soc/mediatek/mt8183/ddp.c M src/soc/mediatek/mt8183/include/soc/addressmap.h A src/soc/mediatek/mt8183/include/soc/ddp.h 4 files changed, 531 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/31478/16
Hello Yu-Ping Wu, Julius Werner, You-Cheng Syu, jitao shi, Tristan Hsieh, Hung-Te Lin, build bot (Jenkins), Chun-ta Lin, Patrick Georgi, Martin Roth,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/31478
to look at the new patch set (#18).
Change subject: mediatek/mt8183: Add display controller driver ......................................................................
mediatek/mt8183: Add display controller driver
BUG=b:80501386,b:117254947 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: Ic4aecc58d081f14f5d136b9ff8e813e6f40f78eb Signed-off-by: Yongqiang Niu yongqiang.niu@mediatek.com --- M src/soc/mediatek/mt8183/Makefile.inc A src/soc/mediatek/mt8183/ddp.c M src/soc/mediatek/mt8183/include/soc/addressmap.h A src/soc/mediatek/mt8183/include/soc/ddp.h 4 files changed, 531 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/31478/18
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display controller driver ......................................................................
Patch Set 19: Code-Review+1
Hi Patrick/Julius, since we're having lots of new panels waiting to be merged I'd like to get this ready first. There's some CLs refactoring the ddp/dsi drivers to share more code between 8183 and 8173, but I think that will take a longer time to pass review.
Are we ok to have this merged first?
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display controller driver ......................................................................
Patch Set 20:
(8 comments)
https://review.coreboot.org/c/coreboot/+/31478/4//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/31478/4//COMMIT_MSG@8 PS4, Line 8:
For a diffstat of over 500 lines, please add a commit message summary, detailing what this driver do […]
Done
https://review.coreboot.org/c/coreboot/+/31478/4/src/soc/mediatek/mt8183/ddp... File src/soc/mediatek/mt8183/ddp.c:
https://review.coreboot.org/c/coreboot/+/31478/4/src/soc/mediatek/mt8183/ddp... PS4, Line 161:
remove the blank line here
Done
https://review.coreboot.org/c/coreboot/+/31478/4/src/soc/mediatek/mt8183/ddp... PS4, Line 163:
remove the blank line here
Done
https://review.coreboot.org/c/coreboot/+/31478/4/src/soc/mediatek/mt8183/ddp... PS4, Line 165:
remove the blank line here
Done
https://review.coreboot.org/c/coreboot/+/31478/4/src/soc/mediatek/mt8183/ddp... PS4, Line 167:
remove the blank line here
Done
https://review.coreboot.org/c/coreboot/+/31478/4/src/soc/mediatek/mt8183/ddp... PS4, Line 169:
remove the blank line here
Done
https://review.coreboot.org/c/coreboot/+/31478/4/src/soc/mediatek/mt8183/ddp... PS4, Line 171:
remove the blank line here
Done
https://review.coreboot.org/c/coreboot/+/31478/4/src/soc/mediatek/mt8183/ddp... PS4, Line 173:
remove the blank line here
Done
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display controller driver ......................................................................
Patch Set 20:
(2 comments)
https://review.coreboot.org/c/coreboot/+/31478/5/src/soc/mediatek/mt8183/ddp... File src/soc/mediatek/mt8183/ddp.c:
https://review.coreboot.org/c/coreboot/+/31478/5/src/soc/mediatek/mt8183/ddp... PS5, Line 160: rdma_config
this is still not fixed.
Done
https://review.coreboot.org/c/coreboot/+/31478/5/src/soc/mediatek/mt8183/ddp... PS5, Line 206:
this is still not fixed.
Done
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display controller driver ......................................................................
Patch Set 20:
(3 comments)
https://review.coreboot.org/c/coreboot/+/31478/8//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/31478/8//COMMIT_MSG@9 PS8, Line 9: BUG
Please add more information in the description. […]
Ack
https://review.coreboot.org/c/coreboot/+/31478/11/src/soc/mediatek/mt8183/in... File src/soc/mediatek/mt8183/include/soc/ddp.h:
https://review.coreboot.org/c/coreboot/+/31478/11/src/soc/mediatek/mt8183/in... PS11, Line 4: 2015
2019
Ack
https://review.coreboot.org/c/coreboot/+/31478/11/src/soc/mediatek/mt8183/in... PS11, Line 58: /* DISP_REG_CONFIG_MMSYS_CG_CON0 : Configures free-run clock gating 0 : 0: Enable clock : 1: Clock gating */
/* […]
Ack
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display controller driver ......................................................................
Patch Set 20:
(1 comment)
https://review.coreboot.org/c/coreboot/+/31478/14//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/31478/14//COMMIT_MSG@8 PS14, Line 8:
This is a driver for the display controller. […]
Ack
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display controller driver ......................................................................
Patch Set 20: -Code-Review
I'll ask MTK owners to provide datasheet name & version.
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display controller driver ......................................................................
Patch Set 20:
(1 comment)
https://review.coreboot.org/c/coreboot/+/31478/12/src/soc/mediatek/mt8183/in... File src/soc/mediatek/mt8183/include/soc/ddp.h:
https://review.coreboot.org/c/coreboot/+/31478/12/src/soc/mediatek/mt8183/in... PS12, Line 4: 2015
2019
Ack
Hung-Te Lin has uploaded a new patch set (#21) to the change originally created by yongqiang niu. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display controller driver ......................................................................
mediatek/mt8183: Add display controller driver
The MT8183 SOC has The DISP supports overlay, read/write DMA, color enhancement, adaptive ambient light processing, color correction, gamma correction and dither. The output of DISP goes to display interface DSI, DPI or DBI directly.
Reference: MT8183 Application Processor Functional Spec, 6.1 Display Controller
BUG=b:80501386,b:117254947 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: Ic4aecc58d081f14f5d136b9ff8e813e6f40f78eb Signed-off-by: Yongqiang Niu yongqiang.niu@mediatek.com --- M src/soc/mediatek/mt8183/Makefile.inc A src/soc/mediatek/mt8183/ddp.c M src/soc/mediatek/mt8183/include/soc/addressmap.h A src/soc/mediatek/mt8183/include/soc/ddp.h 4 files changed, 531 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/31478/21
Hung-Te Lin has uploaded a new patch set (#22) to the change originally created by yongqiang niu. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display controller driver ......................................................................
mediatek/mt8183: Add display controller driver
The MT8183 SOC has a DISP (display controller) that supports overlay, read/write DMA, ... etc. The output of DISP goes to display interface DSI, DPI or DBI directly.
Reference: MT8183 Application Processor Functional Spec, 6.1 Display Controller
BUG=b:80501386,b:117254947 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: Ic4aecc58d081f14f5d136b9ff8e813e6f40f78eb Signed-off-by: Yongqiang Niu yongqiang.niu@mediatek.com --- M src/soc/mediatek/mt8183/Makefile.inc A src/soc/mediatek/mt8183/ddp.c M src/soc/mediatek/mt8183/include/soc/addressmap.h A src/soc/mediatek/mt8183/include/soc/ddp.h 4 files changed, 531 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/31478/22
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display controller driver ......................................................................
Patch Set 22: Code-Review+1
ping - is this ready to go?
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display controller driver ......................................................................
Patch Set 22: Code-Review+1
Julius Werner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display controller driver ......................................................................
Patch Set 22:
Sorry, I missed your pings last week.
Can you clarify how urgent this is and what the plan for deduplication is? There are plenty of functions here that are really copy&pasted 1-to-1 from MT8173. Looks like we had agreement on deduplicating at the start of June, but then nothing happened since. Can we at least clean it up a little? What deadline do you need to hit now?
Part of the problem is that not deduplicating makes this a lot harder to review. Right now, it's just a 500+ line standalone patch. If we would factor out common parts properly, there'd probably be less than 100 lines remaining which would be a lot easier to deal with.
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: mediatek/mt8183: Add display controller driver ......................................................................
Patch Set 22:
Can you clarify how urgent this is and what the plan for deduplication is? There are plenty of functions here that are really copy&pasted 1-to-1 from MT8173. Looks like we had agreement on deduplicating at the start of June, but then nothing happened since. Can we at least clean it up a little? What deadline do you need to hit now?
I want to have basic features all merged before Sep. There's partial work of dedup in https://review.coreboot.org/c/coreboot/+/34515
ok... let me try to merge some of them and see if we can get something better.
Hung-Te Lin has uploaded a new patch set (#23) to the change originally created by yongqiang niu. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: soc/mediatek/mt8183: Add display controller driver ......................................................................
soc/mediatek/mt8183: Add display controller driver
The MT8183 SOC has a DISP (display controller) that supports overlay, read/write DMA, ... etc. The output of DISP goes to display interface DSI, DPI or DBI directly.
Reference: MT8183 Application Processor Functional Spec, 6.1 Display Controller
BUG=b:80501386,b:117254947 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: Ic4aecc58d081f14f5d136b9ff8e813e6f40f78eb Signed-off-by: Yongqiang Niu yongqiang.niu@mediatek.com --- M src/soc/mediatek/mt8183/Makefile.inc A src/soc/mediatek/mt8183/ddp.c M src/soc/mediatek/mt8183/include/soc/addressmap.h A src/soc/mediatek/mt8183/include/soc/ddp.h 4 files changed, 346 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/31478/23
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: soc/mediatek/mt8183: Add display controller driver ......................................................................
Patch Set 23: Code-Review+1
ok here's the new version
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: soc/mediatek/mt8183: Add display controller driver ......................................................................
Patch Set 23: Code-Review+1
Hung-Te Lin has uploaded a new patch set (#24) to the change originally created by yongqiang niu. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: soc/mediatek/mt8183: Add display controller driver ......................................................................
soc/mediatek/mt8183: Add display controller driver
The MT8183 SOC has a DISP (display controller) that supports overlay, read/write DMA, ... etc. The output of DISP goes to display interface DSI, DPI or DBI directly.
Reference: MT8183 Application Processor Functional Spec, 6.1 Display Controller
BUG=b:80501386,b:117254947 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: Ic4aecc58d081f14f5d136b9ff8e813e6f40f78eb Signed-off-by: Yongqiang Niu yongqiang.niu@mediatek.com --- M src/soc/mediatek/mt8183/Makefile.inc A src/soc/mediatek/mt8183/ddp.c M src/soc/mediatek/mt8183/include/soc/addressmap.h A src/soc/mediatek/mt8183/include/soc/ddp.h 4 files changed, 331 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/31478/24
Hung-Te Lin has uploaded a new patch set (#27) to the change originally created by yongqiang niu. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: soc/mediatek/mt8183: Add display controller driver ......................................................................
soc/mediatek/mt8183: Add display controller driver
The MT8183 SOC has a DISP (display controller) that supports overlay, read/write DMA, ... etc. The output of DISP goes to display interface DSI, DPI or DBI directly.
Reference: MT8183 Application Processor Functional Spec, 6.1 Display Controller
BUG=b:80501386,b:117254947 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: Ic4aecc58d081f14f5d136b9ff8e813e6f40f78eb Signed-off-by: Yongqiang Niu yongqiang.niu@mediatek.com --- M src/soc/mediatek/common/ddp.c M src/soc/mediatek/mt8183/Makefile.inc A src/soc/mediatek/mt8183/ddp.c M src/soc/mediatek/mt8183/include/soc/addressmap.h A src/soc/mediatek/mt8183/include/soc/ddp.h 5 files changed, 332 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/31478/27
Hung-Te Lin has uploaded a new patch set (#28) to the change originally created by yongqiang niu. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: soc/mediatek/mt8183: Add display controller driver ......................................................................
soc/mediatek/mt8183: Add display controller driver
The MT8183 SOC has a DISP (display controller) that supports overlay, read/write DMA, ... etc. The output of DISP goes to display interface DSI, DPI or DBI directly.
Reference: MT8183 Application Processor Functional Spec, 6.1 Display Controller
BUG=b:80501386,b:117254947 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: Ic4aecc58d081f14f5d136b9ff8e813e6f40f78eb Signed-off-by: Yongqiang Niu yongqiang.niu@mediatek.com --- M src/soc/mediatek/common/ddp.c M src/soc/mediatek/mt8183/Makefile.inc A src/soc/mediatek/mt8183/ddp.c M src/soc/mediatek/mt8183/include/soc/addressmap.h A src/soc/mediatek/mt8183/include/soc/ddp.h 5 files changed, 332 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/31478/28
Hung-Te Lin has uploaded a new patch set (#29) to the change originally created by yongqiang niu. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: soc/mediatek/mt8183: Add display controller driver ......................................................................
soc/mediatek/mt8183: Add display controller driver
The MT8183 SOC has a DISP (display controller) that supports overlay, read/write DMA, ... etc. The output of DISP goes to display interface DSI, DPI or DBI directly.
Reference: MT8183 Application Processor Functional Spec, 6.1 Display Controller
BUG=b:80501386,b:117254947 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: Ic4aecc58d081f14f5d136b9ff8e813e6f40f78eb Signed-off-by: Yongqiang Niu yongqiang.niu@mediatek.com --- M src/soc/mediatek/common/ddp.c M src/soc/mediatek/mt8183/Makefile.inc A src/soc/mediatek/mt8183/ddp.c M src/soc/mediatek/mt8183/include/soc/addressmap.h A src/soc/mediatek/mt8183/include/soc/ddp.h 5 files changed, 332 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/31478/29
Hung-Te Lin has uploaded a new patch set (#30) to the change originally created by yongqiang niu. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: soc/mediatek/mt8183: Add display controller driver ......................................................................
soc/mediatek/mt8183: Add display controller driver
The MT8183 SOC has a DISP (display controller) that supports overlay, read/write DMA, ... etc. The output of DISP goes to display interface DSI, DPI or DBI directly.
Reference: MT8183 Application Processor Functional Spec, 6.1 Display Controller
BUG=b:80501386,b:117254947 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: Ic4aecc58d081f14f5d136b9ff8e813e6f40f78eb Signed-off-by: Yongqiang Niu yongqiang.niu@mediatek.com --- M src/soc/mediatek/mt8183/Makefile.inc A src/soc/mediatek/mt8183/ddp.c M src/soc/mediatek/mt8183/include/soc/addressmap.h A src/soc/mediatek/mt8183/include/soc/ddp.h 4 files changed, 314 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/78/31478/30
Julius Werner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: soc/mediatek/mt8183: Add display controller driver ......................................................................
Patch Set 30: Code-Review+2
Julius Werner has submitted this change and it was merged. ( https://review.coreboot.org/c/coreboot/+/31478 )
Change subject: soc/mediatek/mt8183: Add display controller driver ......................................................................
soc/mediatek/mt8183: Add display controller driver
The MT8183 SOC has a DISP (display controller) that supports overlay, read/write DMA, ... etc. The output of DISP goes to display interface DSI, DPI or DBI directly.
Reference: MT8183 Application Processor Functional Spec, 6.1 Display Controller
BUG=b:80501386,b:117254947 BRANCH=none TEST=Boots correctly on Kukui
Change-Id: Ic4aecc58d081f14f5d136b9ff8e813e6f40f78eb Signed-off-by: Yongqiang Niu yongqiang.niu@mediatek.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/31478 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Julius Werner jwerner@chromium.org --- M src/soc/mediatek/mt8183/Makefile.inc A src/soc/mediatek/mt8183/ddp.c M src/soc/mediatek/mt8183/include/soc/addressmap.h A src/soc/mediatek/mt8183/include/soc/ddp.h 4 files changed, 314 insertions(+), 0 deletions(-)
Approvals: build bot (Jenkins): Verified Julius Werner: Looks good to me, approved
diff --git a/src/soc/mediatek/mt8183/Makefile.inc b/src/soc/mediatek/mt8183/Makefile.inc index 2a65c35..4527683 100644 --- a/src/soc/mediatek/mt8183/Makefile.inc +++ b/src/soc/mediatek/mt8183/Makefile.inc @@ -45,6 +45,7 @@
ramstage-y += auxadc.c ramstage-y += ../common/cbmem.c emi.c +ramstage-y += ../common/ddp.c ddp.c ramstage-y += ../common/gpio.c gpio.c ramstage-y += ../common/i2c.c i2c.c ramstage-y += ../common/mmu_operations.c mmu_operations.c diff --git a/src/soc/mediatek/mt8183/ddp.c b/src/soc/mediatek/mt8183/ddp.c new file mode 100644 index 0000000..0ae0be1 --- /dev/null +++ b/src/soc/mediatek/mt8183/ddp.c @@ -0,0 +1,103 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2019 MediaTek Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include <device/mmio.h> +#include <edid.h> +#include <stdlib.h> +#include <string.h> +#include <stddef.h> +#include <soc/addressmap.h> +#include <soc/ddp.h> + +static void disp_config_main_path_connection(void) +{ + write32(&mmsys_cfg->disp_ovl0_mout_en, OVL0_MOUT_EN_OVL0_2L); + write32(&mmsys_cfg->disp_ovl0_2l_mout_en, OVL0_2L_MOUT_EN_DISP_PATH0); + write32(&mmsys_cfg->disp_path0_sel_in, DISP_PATH0_SEL_IN_OVL0_2L); + write32(&mmsys_cfg->disp_rdma0_sout_sel_in, RDMA0_SOUT_SEL_IN_COLOR); + write32(&mmsys_cfg->disp_dither0_mout_en, DITHER0_MOUT_EN_DISP_DSI0); + write32(&mmsys_cfg->dsi0_sel_in, DSI0_SEL_IN_DITHER0_MOUT); +} + +static void disp_config_main_path_mutex(void) +{ + write32(&disp_mutex->mutex[0].mod, MUTEX_MOD_MAIN_PATH); + + /* Clock source from DSI0 */ + write32(&disp_mutex->mutex[0].ctl, + MUTEX_SOF_DSI0 | (MUTEX_SOF_DSI0 << 6)); + write32(&disp_mutex->mutex[0].en, BIT(0)); +} + +static void ovl_bgclr_in_sel(u32 idx) +{ + setbits_le32(&disp_ovl[idx]->datapath_con, BIT(2)); +} + +static void enable_pq(struct disp_pq_regs *const regs, u32 width, u32 height, + int enable_relay) +{ + write32(®s->size, height << 16 | width); + if (enable_relay) + write32(®s->cfg, PQ_RELAY_MODE); + write32(®s->en, PQ_EN); +} + +static void main_disp_path_setup(u32 width, u32 height, u32 vrefresh) +{ + u32 idx = 0; + u32 pixel_clk = width * height * vrefresh; + + for (idx = 0; idx < MAIN_PATH_OVL_NR; idx++) + ovl_set_roi(idx, width, height, idx ? 0 : 0xff0000ff); + + rdma_config(width, height, pixel_clk, 5 * KiB); + color_start(width, height); + enable_pq(disp_ccorr, width, height, 1); + enable_pq(disp_aal, width, height, 0); + enable_pq(disp_gamma, width, height, 0); + enable_pq(disp_dither, width, height, 1); + disp_config_main_path_connection(); + disp_config_main_path_mutex(); +} + +static void disp_clock_on(void) +{ + clrbits_le32(&mmsys_cfg->mmsys_cg_con0, CG_CON0_DISP_ALL); + + clrbits_le32(&mmsys_cfg->mmsys_cg_con1, CG_CON1_DISP_DSI0 | + CG_CON1_DISP_DSI0_INTERFACE); +} + +void mtk_ddp_init(void) +{ + disp_clock_on(); + /* Turn off M4U port. */ + write32((void *)(SMI_LARB0 + SMI_LARB_NON_SEC_CON), 0); +} + +void mtk_ddp_mode_set(const struct edid *edid) +{ + u32 fmt = OVL_INFMT_RGBA8888; + u32 bpp = edid->framebuffer_bits_per_pixel / 8; + u32 width = edid->mode.ha; + u32 height = edid->mode.va; + u32 vrefresh = edid->mode.refresh; + + main_disp_path_setup(width, height, vrefresh); + rdma_start(); + ovl_layer_config(fmt, bpp, width, height); + ovl_bgclr_in_sel(1); +} diff --git a/src/soc/mediatek/mt8183/include/soc/addressmap.h b/src/soc/mediatek/mt8183/include/soc/addressmap.h index 5a4784d..bb44f9b 100644 --- a/src/soc/mediatek/mt8183/include/soc/addressmap.h +++ b/src/soc/mediatek/mt8183/include/soc/addressmap.h @@ -58,6 +58,19 @@ IOCFG_LT_BASE = IO_PHYS + 0x01F20000, IOCFG_TL_BASE = IO_PHYS + 0x01F30000, SSUSB_SIF_BASE = IO_PHYS + 0x01F40300, + MMSYS_BASE = IO_PHYS + 0x04000000, + DISP_OVL0_BASE = IO_PHYS + 0x04008000, + DISP_OVL1_BASE = IO_PHYS + 0x04009000, + DISP_OVL1_2L_BASE = IO_PHYS + 0x0400A000, + DISP_RDMA0_BASE = IO_PHYS + 0x0400B000, + DISP_RDMA1_BASE = IO_PHYS + 0x0400C000, + DISP_COLOR0_BASE = IO_PHYS + 0x0400E000, + DISP_CCORR0_BASE = IO_PHYS + 0x0400F000, + DISP_AAL0_BASE = IO_PHYS + 0x04010000, + DISP_GAMMA0_BASE = IO_PHYS + 0x04011000, + DISP_DITHER0_BASE = IO_PHYS + 0x04012000, + DISP_MUTEX_BASE = IO_PHYS + 0x04016000, + SMI_LARB0 = IO_PHYS + 0x04017000, SMI_BASE = IO_PHYS + 0x04019000, };
diff --git a/src/soc/mediatek/mt8183/include/soc/ddp.h b/src/soc/mediatek/mt8183/include/soc/ddp.h new file mode 100644 index 0000000..479417c --- /dev/null +++ b/src/soc/mediatek/mt8183/include/soc/ddp.h @@ -0,0 +1,197 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2019 MediaTek Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef _MT8183_SOC_DDP_H_ +#define _MT8183_SOC_DDP_H_ + +#include <soc/addressmap.h> +#include <soc/ddp_common.h> +#include <types.h> + +#define MAIN_PATH_OVL_NR 2 + +struct mmsys_cfg_regs { + u32 reserved_0x000[64]; /* 0x000 */ + u32 mmsys_cg_con0; /* 0x100 */ + u32 mmsys_cg_set0; /* 0x104 */ + u32 mmsys_cg_clr0; /* 0x108 */ + u32 reserved_0x10C; /* 0x10C */ + u32 mmsys_cg_con1; /* 0x110 */ + u32 mmsys_cg_set1; /* 0x114 */ + u32 mmsys_cg_clr1; /* 0x118 */ + u32 reserved_0x11C[889]; /* 0x11C */ + u32 disp_ovl0_mout_en; /* 0xF00 */ + u32 disp_ovl0_2l_mout_en; /* 0xF04 */ + u32 disp_ovl1_2l_mout_en; /* 0xF08 */ + u32 disp_dither0_mout_en; /* 0xF0C */ + u32 reserved_0xF10[5]; /* 0xF10 - 0xF20 */ + u32 disp_path0_sel_in; /* 0xF24 */ + u32 reserved_0xF28; /* 0xF28 */ + u32 dsi0_sel_in; /* 0xF2C */ + u32 dpi0_sel_in; /* 0xF30 */ + u32 reserved_0xF34; /* 0xF34 */ + u32 disp_ovl0_2l_sel_in; /* 0xF38 */ + u32 reserved_0xF3C[5]; /* 0xF3C - 0xF4C */ + u32 disp_rdma0_sout_sel_in; /* 0xF50 */ + u32 disp_rdma1_sout_sel_in; /* 0xF54 */ + u32 reserved_0xF58[3]; /* 0xF58 - 0xF60 */ + u32 dpi0_sel_sout_sel_in; /* 0xF64 */ +}; + +check_member(mmsys_cfg_regs, mmsys_cg_con0, 0x100); +check_member(mmsys_cfg_regs, dpi0_sel_sout_sel_in, 0xF64); +static struct mmsys_cfg_regs *const mmsys_cfg = + (void *)MMSYS_BASE; + + +/* DISP_REG_CONFIG_MMSYS_CG_CON0 + Configures free-run clock gating 0 + 0: Enable clock + 1: Clock gating */ +enum { + CG_CON0_SMI_COMMON = BIT(0), + CG_CON0_SMI_LARB0 = BIT(1), + CG_CON0_GALS_COMMON0 = BIT(3), + CG_CON0_GALS_COMMON1 = BIT(4), + CG_CON0_DISP_OVL0 = BIT(20), + CG_CON0_DISP_OVL0_2L = BIT(21), + CG_CON0_DISP_OVL1_2L = BIT(22), + CG_CON0_DISP_RDMA0 = BIT(23), + CG_CON0_DISP_RDMA1 = BIT(24), + CG_CON0_DISP_WDMA0 = BIT(25), + CG_CON0_DISP_COLOR0 = BIT(26), + CG_CON0_DISP_CCORR0 = BIT(27), + CG_CON0_DISP_AAL0 = BIT(28), + CG_CON0_DISP_GAMMA0 = BIT(29), + CG_CON0_DISP_DITHER0 = BIT(30), + CG_CON0_DISP_ALL = CG_CON0_SMI_COMMON | + CG_CON0_SMI_LARB0 | + CG_CON0_GALS_COMMON0 | + CG_CON0_GALS_COMMON1 | + CG_CON0_DISP_OVL0 | + CG_CON0_DISP_OVL0_2L | + CG_CON0_DISP_RDMA0 | + CG_CON0_DISP_COLOR0 | + CG_CON0_DISP_CCORR0 | + CG_CON0_DISP_AAL0 | + CG_CON0_DISP_DITHER0 | + CG_CON0_DISP_GAMMA0, + CG_CON0_ALL = 0xffffffff +}; + +/* DISP_REG_CONFIG_MMSYS_CG_CON1 + Configures free-run clock gating 1 + 0: Enable clock + 1: Clock gating */ +enum { + CG_CON1_DISP_DSI0 = BIT(0), + CG_CON1_DISP_DSI0_INTERFACE = BIT(1), + CG_CON1_DISP_26M = BIT(7), + + CG_CON1_ALL = 0xffffffff +}; + +enum { + OVL0_MOUT_EN_RDMA0 = BIT(0), + OVL0_MOUT_EN_OVL0_2L = BIT(4), + OVL0_2L_MOUT_EN_DISP_PATH0 = BIT(0), + OVL1_2L_MOUT_EN_DISP_RDMA1 = BIT(4), + DITHER0_MOUT_EN_DISP_DSI0 = BIT(0), +}; + +enum { + DISP_PATH0_SEL_IN_OVL0 = 0, + DISP_PATH0_SEL_IN_OVL0_2L = 1, + DSI0_SEL_IN_DITHER0_MOUT = 0, + DSI0_SEL_IN_RDMA0 = 1, + RDMA0_SOUT_SEL_IN_DSI0 = 0, + RDMA0_SOUT_SEL_IN_COLOR = 1, +}; + +struct disp_mutex_regs { + u32 inten; + u32 intsta; + u32 reserved0[6]; + struct { + u32 en; + u32 dummy; + u32 rst; + u32 ctl; + u32 mod; + u32 reserved[3]; + } mutex[12]; +}; + +static struct disp_mutex_regs *const disp_mutex = (void *)DISP_MUTEX_BASE; + +enum { + MUTEX_MOD_DISP_RDMA0 = BIT(0), + MUTEX_MOD_DISP_RDMA1 = BIT(1), + MUTEX_MOD_DISP_OVL0 = BIT(9), + MUTEX_MOD_DISP_OVL0_2L = BIT(10), + MUTEX_MOD_DISP_OVL1_2L = BIT(11), + MUTEX_MOD_DISP_WDMA0 = BIT(12), + MUTEX_MOD_DISP_COLOR0 = BIT(13), + MUTEX_MOD_DISP_CCORR0 = BIT(14), + MUTEX_MOD_DISP_AAL0 = BIT(15), + MUTEX_MOD_DISP_GAMMA0 = BIT(16), + MUTEX_MOD_DISP_DITHER0 = BIT(17), + MUTEX_MOD_DISP_PWM0 = BIT(28), + MUTEX_MOD_MAIN_PATH = MUTEX_MOD_DISP_OVL0 | MUTEX_MOD_DISP_OVL0_2L | + MUTEX_MOD_DISP_RDMA0 | MUTEX_MOD_DISP_COLOR0 | + MUTEX_MOD_DISP_CCORR0 | MUTEX_MOD_DISP_AAL0 | + MUTEX_MOD_DISP_GAMMA0 | + MUTEX_MOD_DISP_DITHER0, +}; + +enum { + MUTEX_SOF_SINGLE_MODE = 0, + MUTEX_SOF_DSI0 = 1, + MUTEX_SOF_DPI0 = 2, +}; + +struct disp_pq_regs { + u32 en; + u32 reset; + u32 inten; + u32 intsta; + u32 status; + u32 reserved0[3]; + u32 cfg; + u32 reserved1[3]; + u32 size; +}; + +enum { + PQ_EN = BIT(0), + PQ_RELAY_MODE = BIT(0), +}; + +static struct disp_pq_regs *const disp_ccorr = (void *)DISP_CCORR0_BASE; + +static struct disp_pq_regs *const disp_aal = (void *)DISP_AAL0_BASE; + +static struct disp_pq_regs *const disp_gamma = (void *)DISP_GAMMA0_BASE; + +static struct disp_pq_regs *const disp_dither = (void *)DISP_DITHER0_BASE; + +enum { + SMI_LARB_NON_SEC_CON = 0x380, +}; + +void mtk_ddp_init(void); +void mtk_ddp_mode_set(const struct edid *edid); + +#endif