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 <yangcong5@huaqin.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/73443
Reviewed-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Reviewed-by: Yidi Lin <yidilin@google.com>
This commit is contained in:
yangcong 2023-03-02 20:59:30 +08:00 committed by Rex-BC Chen
parent 1912a86d1d
commit 6538464e2f
3 changed files with 51 additions and 15 deletions

View File

@ -3,6 +3,7 @@
#include <assert.h> #include <assert.h>
#include <console/console.h> #include <console/console.h>
#include <delay.h> #include <delay.h>
#include <device/i2c_simple.h>
#include <edid.h> #include <edid.h>
#include <framebuffer_info.h> #include <framebuffer_info.h>
#include <gpio.h> #include <gpio.h>
@ -10,11 +11,16 @@
#include <soc/dptx.h> #include <soc/dptx.h>
#include <soc/dsi.h> #include <soc/dsi.h>
#include <soc/gpio_common.h> #include <soc/gpio_common.h>
#include <soc/i2c.h>
#include <soc/mtcmos.h> #include <soc/mtcmos.h>
#include "display.h" #include "display.h"
#include "gpio.h"
#include "panel.h" #include "panel.h"
#define PMIC_TPS65132_I2C I2C3
#define PMIC_TPS65132_SLAVE 0x3E
int configure_display(void) int configure_display(void)
{ {
struct edid edid; struct edid edid;
@ -72,3 +78,44 @@ int configure_display(void)
return 0; 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);
}

View File

@ -4,5 +4,6 @@
#define __MAINBOARD_GOOGLE_GERALT_DISPLAY_H__ #define __MAINBOARD_GOOGLE_GERALT_DISPLAY_H__
int configure_display(void); int configure_display(void);
void tps65132s_program_eeprom(void);
#endif #endif

View File

@ -11,11 +11,10 @@
#include <soc/pmif.h> #include <soc/pmif.h>
#include <string.h> #include <string.h>
#include "display.h"
#include "gpio.h" #include "gpio.h"
#include "panel.h" #include "panel.h"
#define PMIC_TPS65132_I2C I2C3
#define PMIC_TPS65132_SLAVE 0x3E
static void configure_mipi_pwm_backlight(void) 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) static void power_on_mipi_boe_tv110c9m_ll0(void)
{ {
tps65132s_program_eeprom();
/* Enable VM18V */ /* Enable VM18V */
mainboard_enable_regulator(MTK_REGULATOR_VDD18, true); 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); gpio_output(GPIO_DISP_RST_1V8_L, 0);
mdelay(1); mdelay(1);
gpio_output(GPIO_EN_PPVAR_MIPI_DISP, 1); gpio_output(GPIO_EN_PPVAR_MIPI_DISP, 1);
gpio_output(GPIO_EN_PPVAR_MIPI_DISP_150MA, 1); gpio_output(GPIO_EN_PPVAR_MIPI_DISP_150MA, 1);
mdelay(10); 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); gpio_output(GPIO_DISP_RST_1V8_L, 1);
mdelay(1); mdelay(1);
gpio_output(GPIO_DISP_RST_1V8_L, 0); gpio_output(GPIO_DISP_RST_1V8_L, 0);