From d4b6b81280e70ba59962e9e41cd7cad52e3f369d Mon Sep 17 00:00:00 2001 From: Ruihai Zhou Date: Wed, 8 Nov 2023 09:11:34 +0800 Subject: mb/google/geralt: Enable BOE_NV110WUM_L60 panel for Ciri The MIPI panel BOE_NV110WUM_L60 will be used for Ciri, enable it. Also remove the `mdelay(10)` after mtk_i2c_bus_init, because MTK confirms this is not needed. Add mdelay(2) between VDD18 and VSP/VSN to meet the panel datasheet. BUG=b:308968270 TEST=Boot to firmware screen BRANCH=None Change-Id: I0a04f062f81c543d38716d7ff185b5633c1aa3a9 Signed-off-by: Ruihai Zhou Reviewed-on: https://review.coreboot.org/c/coreboot/+/78957 Reviewed-by: Yidi Lin Reviewed-by: Yu-Ping Wu Tested-by: build bot (Jenkins) --- src/mainboard/google/geralt/Kconfig | 1 + src/mainboard/google/geralt/Makefile.inc | 1 + src/mainboard/google/geralt/panel.c | 23 ++++++++++++++ src/mainboard/google/geralt/panel.h | 2 ++ src/mainboard/google/geralt/panel_ciri.c | 48 ++++++++++++++++++++++++++++++ src/mainboard/google/geralt/panel_geralt.c | 24 +-------------- 6 files changed, 76 insertions(+), 23 deletions(-) create mode 100644 src/mainboard/google/geralt/panel_ciri.c (limited to 'src/mainboard/google') diff --git a/src/mainboard/google/geralt/Kconfig b/src/mainboard/google/geralt/Kconfig index feac88a102..77822678fd 100644 --- a/src/mainboard/google/geralt/Kconfig +++ b/src/mainboard/google/geralt/Kconfig @@ -42,6 +42,7 @@ config BOARD_SPECIFIC_OPTIONS select HAVE_LINEAR_FRAMEBUFFER select RTC select MIPI_PANEL_BOE_TV110C9M_LL0 if BOARD_GOOGLE_GERALT + select MIPI_PANEL_BOE_NV110WUM_L60 if BOARD_GOOGLE_CIRI select FW_CONFIG select FW_CONFIG_SOURCE_CHROMEEC_CBI diff --git a/src/mainboard/google/geralt/Makefile.inc b/src/mainboard/google/geralt/Makefile.inc index e954309e2a..b1af289d55 100644 --- a/src/mainboard/google/geralt/Makefile.inc +++ b/src/mainboard/google/geralt/Makefile.inc @@ -24,4 +24,5 @@ ramstage-y += mainboard.c ramstage-y += panel.c ramstage-y += regulator.c ramstage-y += reset.c +ramstage-$(CONFIG_BOARD_GOOGLE_CIRI) += panel_ciri.c ramstage-$(CONFIG_BOARD_GOOGLE_GERALT) += panel_geralt.c diff --git a/src/mainboard/google/geralt/panel.c b/src/mainboard/google/geralt/panel.c index 202eda7b7d..3f55cac12d 100644 --- a/src/mainboard/google/geralt/panel.c +++ b/src/mainboard/google/geralt/panel.c @@ -3,10 +3,14 @@ #include #include #include +#include #include #include #include #include +#include +#include +#include #include #include "gpio.h" @@ -59,3 +63,22 @@ void fill_lp_backlight_gpios(struct lb_gpios *gpios) lb_add_gpios(gpios, backlight_gpios, ARRAY_SIZE(backlight_gpios)); } + +void power_on_mipi_panel(const struct tps65132s_cfg *cfg) +{ + mtk_i2c_bus_init(cfg->i2c_bus, I2C_SPEED_FAST); + + /* Enable VM18V */ + mainboard_enable_regulator(MTK_REGULATOR_VDD18, true); + mdelay(2); + if (tps65132s_setup(cfg) != CB_SUCCESS) + printk(BIOS_ERR, "Failed to set up voltage regulator tps65132s\n"); + gpio_output(GPIO_DISP_RST_1V8_L, 0); + mdelay(1); + gpio_output(GPIO_DISP_RST_1V8_L, 1); + mdelay(1); + gpio_output(GPIO_DISP_RST_1V8_L, 0); + mdelay(1); + gpio_output(GPIO_DISP_RST_1V8_L, 1); + mdelay(6); +} diff --git a/src/mainboard/google/geralt/panel.h b/src/mainboard/google/geralt/panel.h index 3d0fafdaed..7e07fb1684 100644 --- a/src/mainboard/google/geralt/panel.h +++ b/src/mainboard/google/geralt/panel.h @@ -4,9 +4,11 @@ #define __MAINBOARD_GOOGLE_GERALT_PANEL_H__ #include +#include void configure_mipi_pwm_backlight(void); void fill_lp_backlight_gpios(struct lb_gpios *gpios); +void power_on_mipi_panel(const struct tps65132s_cfg *cfg); uint32_t panel_id(void); struct panel_description *get_panel_description(uint32_t panel_id); diff --git a/src/mainboard/google/geralt/panel_ciri.c b/src/mainboard/google/geralt/panel_ciri.c new file mode 100644 index 0000000000..c50e2fa296 --- /dev/null +++ b/src/mainboard/google/geralt/panel_ciri.c @@ -0,0 +1,48 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include + +#include "gpio.h" +#include "panel.h" + +#define PMIC_TPS65132_I2C I2C3 + +static void power_on_mipi_himax_83102j(void) +{ + const struct tps65132s_reg_setting reg_settings[] = { + { PMIC_TPS65132_VPOS, 0x11, 0x1f }, + { PMIC_TPS65132_VNEG, 0x11, 0x1f }, + { PMIC_TPS65132_DLYX, 0x55, 0xff }, + { PMIC_TPS65132_ASSDD, 0x5b, 0xff }, + }; + const struct tps65132s_cfg cfg = { + .i2c_bus = PMIC_TPS65132_I2C, + .en = GPIO_EN_PPVAR_MIPI_DISP, + .sync = GPIO_EN_PPVAR_MIPI_DISP_150MA, + .settings = reg_settings, + .setting_counts = ARRAY_SIZE(reg_settings), + }; + power_on_mipi_panel(&cfg); +} + +static struct panel_description ciri_panels[] = { + [17] = { + .name = "BOE_NV110WUM_L60", + .power_on = power_on_mipi_himax_83102j, + .configure_backlight = configure_mipi_pwm_backlight, + .orientation = LB_FB_ORIENTATION_LEFT_UP, + .disp_path = DISP_PATH_MIPI, + .pwm_ctrl_gpio = true, + }, +}; + +struct panel_description *get_panel_description(uint32_t panel_id) +{ + uint32_t id = panel_id & 0xFF; + + if (id >= ARRAY_SIZE(ciri_panels)) + return NULL; + + return &ciri_panels[id]; +} diff --git a/src/mainboard/google/geralt/panel_geralt.c b/src/mainboard/google/geralt/panel_geralt.c index 6eed3fb122..0b59a4e3d5 100644 --- a/src/mainboard/google/geralt/panel_geralt.c +++ b/src/mainboard/google/geralt/panel_geralt.c @@ -1,15 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -#include #include -#include -#include -#include #include -#include -#include -#include -#include #include "gpio.h" #include "panel.h" @@ -31,21 +23,7 @@ static void power_on_mipi_boe_tv110c9m_ll0(void) .settings = reg_settings, .setting_counts = ARRAY_SIZE(reg_settings), }; - - /* Enable VM18V */ - mainboard_enable_regulator(MTK_REGULATOR_VDD18, true); - mtk_i2c_bus_init(PMIC_TPS65132_I2C, I2C_SPEED_FAST); - mdelay(10); - if (tps65132s_setup(&cfg) != CB_SUCCESS) - printk(BIOS_ERR, "Failed to set up voltage regulator tps65132s\n"); - gpio_output(GPIO_DISP_RST_1V8_L, 0); - mdelay(1); - gpio_output(GPIO_DISP_RST_1V8_L, 1); - mdelay(1); - gpio_output(GPIO_DISP_RST_1V8_L, 0); - mdelay(1); - gpio_output(GPIO_DISP_RST_1V8_L, 1); - mdelay(6); + power_on_mipi_panel(&cfg); } static struct panel_description panels[] = { -- cgit v1.2.3