From 6538464e2f404ff5fcf28c29f032fac0f1668b85 Mon Sep 17 00:00:00 2001 From: yangcong Date: Thu, 2 Mar 2023 20:59:30 +0800 Subject: mb/google/geralt: Set +-5.7V to TPS65132s EEPROM It is necessary to increase the AVDD/AVEE of TPS65132s PMIC to +-5.7V for powering on BOE_TV110C9M_LL0. So we set the default value to +-5.7V and program the value to the EEPROM when configuring the display at the first time. In this way, TPS65132s could load the correct setting from the EEPROM after booting into kernel. BUG=b:268292556 TEST=test firmware display pass and AVDD/AVEE is +-5.7V on Geralt. Change-Id: I29236818444cac84d42386a371cd8934048ff948 Signed-off-by: yangcong Reviewed-on: https://review.coreboot.org/c/coreboot/+/73443 Reviewed-by: Rex-BC Chen Tested-by: build bot (Jenkins) Reviewed-by: Yu-Ping Wu Reviewed-by: Yidi Lin --- src/mainboard/google/geralt/display.c | 47 ++++++++++++++++++++++++++++++ src/mainboard/google/geralt/display.h | 1 + src/mainboard/google/geralt/panel_geralt.c | 18 ++---------- 3 files changed, 51 insertions(+), 15 deletions(-) (limited to 'src/mainboard') diff --git a/src/mainboard/google/geralt/display.c b/src/mainboard/google/geralt/display.c index bbdd808fa1..243ed6d739 100644 --- a/src/mainboard/google/geralt/display.c +++ b/src/mainboard/google/geralt/display.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include @@ -10,11 +11,16 @@ #include #include #include +#include #include #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; @@ -72,3 +78,44 @@ int configure_display(void) 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 29153b303c..71e0e08392 100644 --- a/src/mainboard/google/geralt/display.h +++ b/src/mainboard/google/geralt/display.h @@ -4,5 +4,6 @@ #define __MAINBOARD_GOOGLE_GERALT_DISPLAY_H__ int configure_display(void); +void tps65132s_program_eeprom(void); #endif diff --git a/src/mainboard/google/geralt/panel_geralt.c b/src/mainboard/google/geralt/panel_geralt.c index 2991360506..7828651397 100644 --- a/src/mainboard/google/geralt/panel_geralt.c +++ b/src/mainboard/google/geralt/panel_geralt.c @@ -11,11 +11,10 @@ #include #include +#include "display.h" #include "gpio.h" #include "panel.h" -#define PMIC_TPS65132_I2C I2C3 -#define PMIC_TPS65132_SLAVE 0x3E static void configure_mipi_pwm_backlight(void) { @@ -30,28 +29,17 @@ static void configure_edp_aux_backlight(void) static void power_on_mipi_boe_tv110c9m_ll0(void) { + tps65132s_program_eeprom(); + /* Enable VM18V */ mainboard_enable_regulator(MTK_REGULATOR_VDD18, true); - /* Initialize I2C3 for PMIC TPS65132 */ - mtk_i2c_bus_init(PMIC_TPS65132_I2C, I2C_SPEED_FAST); - mdelay(10); - 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); - - /* 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; - gpio_output(GPIO_DISP_RST_1V8_L, 1); mdelay(1); gpio_output(GPIO_DISP_RST_1V8_L, 0); -- cgit v1.2.3