Felix Held has submitted this change. ( https://review.coreboot.org/c/coreboot/+/75512?usp=email )
Change subject: mb/google/geralt: Fix MIPI panel power on/off sequence ......................................................................
mb/google/geralt: Fix MIPI panel power on/off sequence
Based on the power sequence of the panel [1], the power on T2 sequence VSP to VSN should be larger than 1ms, and the power off T2 sequence VSP to VSN should be larger than 0ms. We modify the power sequence to meet the datasheet requirement.
[1] B5 TV110C9M-LL0 Product Specification Rev.P0
Signed-off-by: Ruihai Zhou zhouruihai@huaqin.corp-partner.google.com Change-Id: I4ccb5be04062a0516f84a054ff3f40afbf5279be Reviewed-on: https://review.coreboot.org/c/coreboot/+/75512 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Yidi Lin yidilin@google.com --- M src/mainboard/google/geralt/display.c M src/mainboard/google/geralt/display.h M src/mainboard/google/geralt/panel.c M src/mainboard/google/geralt/panel.h M src/mainboard/google/geralt/panel_geralt.c M src/soc/mediatek/mt8188/Makefile.inc 6 files changed, 18 insertions(+), 71 deletions(-)
Approvals: build bot (Jenkins): Verified Yidi Lin: Looks good to me, approved
diff --git a/src/mainboard/google/geralt/display.c b/src/mainboard/google/geralt/display.c index 8c7a0c1..fa007a1 100644 --- a/src/mainboard/google/geralt/display.c +++ b/src/mainboard/google/geralt/display.c @@ -1,9 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-only */
-#include <assert.h> #include <console/console.h> #include <delay.h> -#include <device/i2c_simple.h> #include <edid.h> #include <framebuffer_info.h> #include <gpio.h> @@ -11,16 +9,12 @@ #include <soc/dptx.h> #include <soc/dsi.h> #include <soc/gpio_common.h> -#include <soc/i2c.h> #include <soc/mtcmos.h>
#include "display.h" #include "gpio.h" #include "panel.h"
-#define PMIC_TPS65132_I2C I2C3 -#define PMIC_TPS65132_SLAVE 0x3E - int configure_display(void) { struct edid edid; @@ -78,44 +72,3 @@
return 0; } - -void tps65132s_program_eeprom(void) -{ - u8 value = 0; - u8 value1 = 0; - - /* Initialize I2C3 for PMIC TPS65132 */ - mtk_i2c_bus_init(PMIC_TPS65132_I2C, I2C_SPEED_FAST); - mdelay(10); - - gpio_output(GPIO_EN_PPVAR_MIPI_DISP, 1); - gpio_output(GPIO_EN_PPVAR_MIPI_DISP_150MA, 1); - mdelay(10); - - i2c_read_field(PMIC_TPS65132_I2C, PMIC_TPS65132_SLAVE, 0x00, &value, 0xFF, 0); - i2c_read_field(PMIC_TPS65132_I2C, PMIC_TPS65132_SLAVE, 0x01, &value1, 0xFF, 0); - - if (value != 0x11 || value1 != 0x11) { - printk(BIOS_INFO, "Just set AVDD AVEE 5.7V to EEPROM Data in first time.\n"); - - /* Set AVDD = 5.7V */ - if (panel_pmic_reg_mask(PMIC_TPS65132_I2C, PMIC_TPS65132_SLAVE, 0x00, 0x11, - 0x1F) < 0) - return; - - /* Set AVEE = -5.7V */ - if (panel_pmic_reg_mask(PMIC_TPS65132_I2C, PMIC_TPS65132_SLAVE, 0x01, 0x11, - 0x1F) < 0) - return; - - /* Set EEPROM Data */ - if (panel_pmic_reg_mask(PMIC_TPS65132_I2C, PMIC_TPS65132_SLAVE, 0xFF, 0x80, - 0xFC) < 0) - return; - mdelay(50); - } - - gpio_output(GPIO_EN_PPVAR_MIPI_DISP, 0); - gpio_output(GPIO_EN_PPVAR_MIPI_DISP_150MA, 0); - mdelay(5); -} diff --git a/src/mainboard/google/geralt/display.h b/src/mainboard/google/geralt/display.h index 71e0e08..29153b3 100644 --- a/src/mainboard/google/geralt/display.h +++ b/src/mainboard/google/geralt/display.h @@ -4,6 +4,5 @@ #define __MAINBOARD_GOOGLE_GERALT_DISPLAY_H__
int configure_display(void); -void tps65132s_program_eeprom(void);
#endif diff --git a/src/mainboard/google/geralt/panel.c b/src/mainboard/google/geralt/panel.c index 78d4f84..3174870 100644 --- a/src/mainboard/google/geralt/panel.c +++ b/src/mainboard/google/geralt/panel.c @@ -3,7 +3,6 @@ #include <boardid.h> #include <cbfs.h> #include <console/console.h> -#include <device/i2c_simple.h> #include <edid.h> #include <gpio.h> #include <soc/gpio_common.h> @@ -12,21 +11,6 @@ #include "gpio.h" #include "panel.h"
-int panel_pmic_reg_mask(u32 bus, u8 chip, u8 addr, u8 val, u8 mask) -{ - u8 msg = 0; - - if (i2c_read_field(bus, chip, addr, &msg, 0xFF, 0) < 0) { - printk(BIOS_ERR, "Failed to read i2c: addr(%u)\n", addr); - return -1; - } - - msg &= ~mask; - msg |= val; - - return i2c_write_field(bus, chip, addr, msg, 0xFF, 0); -} - static void get_mipi_cmd_from_cbfs(struct panel_description *desc) { /* diff --git a/src/mainboard/google/geralt/panel.h b/src/mainboard/google/geralt/panel.h index 0335ece..11b7fb0 100644 --- a/src/mainboard/google/geralt/panel.h +++ b/src/mainboard/google/geralt/panel.h @@ -17,7 +17,6 @@ };
void fill_lp_backlight_gpios(struct lb_gpios *gpios); -int panel_pmic_reg_mask(u32 bus, u8 chip, u8 addr, u8 val, u8 mask); uint32_t panel_id(void); struct panel_description *get_panel_description(uint32_t panel_id); struct panel_description *get_active_panel(void); diff --git a/src/mainboard/google/geralt/panel_geralt.c b/src/mainboard/google/geralt/panel_geralt.c index 159bc76..9a98836 100644 --- a/src/mainboard/google/geralt/panel_geralt.c +++ b/src/mainboard/google/geralt/panel_geralt.c @@ -8,6 +8,7 @@ #include <soc/gpio_common.h> #include <soc/i2c.h> #include <soc/regulator.h> +#include <soc/tps65132s.h> #include <soc/pmif.h> #include <string.h>
@@ -15,6 +16,7 @@ #include "gpio.h" #include "panel.h"
+#define PMIC_TPS65132_I2C I2C3
static void configure_mipi_pwm_backlight(void) { @@ -29,17 +31,26 @@
static void power_on_mipi_boe_tv110c9m_ll0(void) { - tps65132s_program_eeprom(); + const struct tps65132s_reg_setting reg_settings[] = { + { PMIC_TPS65132_VPOS, 0x11, 0x1f }, + { PMIC_TPS65132_VNEG, 0x11, 0x1f }, + { PMIC_TPS65132_DLYX, 0x95, 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), + };
/* Enable VM18V */ mainboard_enable_regulator(MTK_REGULATOR_VDD18, true); - + 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_EN_PPVAR_MIPI_DISP, 1); - gpio_output(GPIO_EN_PPVAR_MIPI_DISP_150MA, 1); - mdelay(10); gpio_output(GPIO_DISP_RST_1V8_L, 1); mdelay(1); gpio_output(GPIO_DISP_RST_1V8_L, 0); diff --git a/src/soc/mediatek/mt8188/Makefile.inc b/src/soc/mediatek/mt8188/Makefile.inc index 651cff0..67c2d7a 100644 --- a/src/soc/mediatek/mt8188/Makefile.inc +++ b/src/soc/mediatek/mt8188/Makefile.inc @@ -55,6 +55,7 @@ ramstage-y += soc.c ramstage-y += ../common/spm.c spm.c ramstage-y += ../common/sspm.c +ramstage-y += ../common/tps65132s.c ramstage-y += ../common/usb.c usb.c
BL31_MAKEARGS += PLAT=mt8188