diff --git a/src/mainboard/google/corsola/display.c b/src/mainboard/google/corsola/display.c index 9a8ecc567a..a66d92e8e3 100644 --- a/src/mainboard/google/corsola/display.c +++ b/src/mainboard/google/corsola/display.c @@ -1,17 +1,13 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -#include #include #include #include -#include -#include #include #include #include #include #include -#include #include #include "display.h" @@ -25,67 +21,6 @@ static void backlight_control(void) gpio_output(GPIO_EN_PP3300_DISP_X, 1); } -int panel_pmic_reg_mask(unsigned int bus, uint8_t chip, uint8_t addr, - uint8_t val, uint8_t mask) -{ - uint8_t msg = 0; - - if (i2c_read_field(bus, chip, addr, &msg, 0xFF, 0) < 0) { - printk(BIOS_ERR, "%s: Failed to read i2c(%u): addr(%u)\n", - __func__, bus, addr); - return -1; - } - - msg &= ~mask; - msg |= val; - - return i2c_write_field(bus, chip, addr, msg, 0xFF, 0); -} - -void tps65132s_program_eeprom(void) -{ - u8 value = 0; - u8 value1 = 0; - - /* Initialize I2C6 for PMIC TPS65132 */ - mtk_i2c_bus_init(PMIC_TPS65132_I2C, I2C_SPEED_FAST); - mdelay(10); - - /* EN_PP6000_MIPI_DISP */ - gpio_output(GPIO_EN_PP3300_DISP_X, 1); - /* EN_PP6000_MIPI_DISP_150MA */ - gpio_output(GPIO_EN_PP3300_SDBRDG_X, 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 != 0x14 || value1 != 0x14) { - printk(BIOS_INFO, "Set AVDD AVEE 6.0V to EEPROM Data in first time\n"); - - /* Set AVDD = 6.0V */ - if (panel_pmic_reg_mask(PMIC_TPS65132_I2C, PMIC_TPS65132_SLAVE, 0x00, 0x14, - 0x1F) < 0) - return; - - /* Set AVEE = -6.0V */ - if (panel_pmic_reg_mask(PMIC_TPS65132_I2C, PMIC_TPS65132_SLAVE, 0x01, 0x14, - 0x1F) < 0) - return; - - /* Set EEPROM Data */ - if (panel_pmic_reg_mask(PMIC_TPS65132_I2C, PMIC_TPS65132_SLAVE, 0xFF, 0x80, - 0xFC) < 0) - return; - mdelay(50); - } - /* EN_PP6000_MIPI_DISP */ - gpio_output(GPIO_EN_PP3300_DISP_X, 0); - /* EN_PP6000_MIPI_DISP_150MA */ - gpio_output(GPIO_EN_PP3300_SDBRDG_X, 0); - mdelay(5); -} - struct panel_description *get_panel_from_cbfs(struct panel_description *desc) { char cbfs_name[64]; diff --git a/src/mainboard/google/corsola/display.h b/src/mainboard/google/corsola/display.h index afff4bf30f..11d2f24faf 100644 --- a/src/mainboard/google/corsola/display.h +++ b/src/mainboard/google/corsola/display.h @@ -9,7 +9,6 @@ #define BRIDGE_I2C I2C0 #define PMIC_TPS65132_I2C I2C6 -#define PMIC_TPS65132_SLAVE 0x3E struct panel_description { void (*power_on)(void); /* Callback to turn on panel */ @@ -34,7 +33,4 @@ struct panel_description *get_ps8640_description(void); /* Load panel serializable data from CBFS */ struct panel_description *get_panel_from_cbfs(struct panel_description *desc); -void tps65132s_program_eeprom(void); -int panel_pmic_reg_mask(u32 bus, u8 chip, u8 addr, u8 val, u8 mask); - #endif diff --git a/src/mainboard/google/corsola/panel_starmie.c b/src/mainboard/google/corsola/panel_starmie.c index ffb7b65cd2..aadabf4119 100644 --- a/src/mainboard/google/corsola/panel_starmie.c +++ b/src/mainboard/google/corsola/panel_starmie.c @@ -1,20 +1,34 @@ /* SPDX-License-Identifier: GPL-2.0-only */ +#include #include #include #include +#include #include "display.h" #include "gpio.h" static void mipi_panel_power_on(void) { - tps65132s_program_eeprom(); + const struct tps65132s_reg_setting reg_settings[] = { + { PMIC_TPS65132_VPOS, 0x14, 0x1F }, + { PMIC_TPS65132_VNEG, 0x14, 0x1F }, + { PMIC_TPS65132_DLYX, 0x95, 0xFF }, + { PMIC_TPS65132_ASSDD, 0x5b, 0xFF }, + }; + const struct tps65132s_cfg cfg = { + .i2c_bus = PMIC_TPS65132_I2C, + .en = GPIO_EN_PP3300_DISP_X, + .sync = GPIO_EN_PP3300_SDBRDG_X, + .settings = reg_settings, + .setting_counts = ARRAY_SIZE(reg_settings), + }; + mainboard_set_regulator_voltage(MTK_REGULATOR_VIO18, 1800000); - mdelay(1); - gpio_output(GPIO_EN_PP3300_DISP_X, 1); - gpio_output(GPIO_EN_PP3300_SDBRDG_X, 1); - mdelay(1); + if (tps65132s_setup(&cfg) != CB_SUCCESS) + printk(BIOS_ERR, "Failed to setup tps65132s\n"); + /* DISP_RST_1V8_L */ gpio_output(GPIO_EDPBRDG_RST_L, 1); mdelay(1);