diff options
author | Ruihai Zhou <zhouruihai@huaqin.corp-partner.google.com> | 2023-05-16 17:30:23 +0800 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2023-06-01 13:09:40 +0000 |
commit | e811c9a44d04bec211f111f73e47f4d3be9d2117 (patch) | |
tree | 866a5aeaebb786bbc7cd6c52aae9a13a7daecdf9 /src/mainboard/google | |
parent | 44b60eb503778c1a39785963006112aa6cfc8ddd (diff) |
mb/google/corsola: Fix MIPI panel power on/off sequence
Based on the power sequence of the panel [1] and PMIC datasheet [2],
the power on T2 sequence VSP to VSN should be large than 1ms, but it's
-159us now, and the power off T2 sequence VSP to VSN should be large
than 0ms, but it's less than 0 now. Let's modify the power sequence
to meet the datasheet requirement.
[1] HX83102-J02_Datasheet_v03.pdf
[2] TPS65132-Single-Inductor-Dual-Output-Power-Supply.pdf
BUG=b:282902297
TEST=power sequence T2 pass
Signed-off-by: Ruihai Zhou <zhouruihai@huaqin.corp-partner.google.com>
Change-Id: Ib1625c6a211f849071393f69eaf5c649a8e7f72e
Reviewed-on: https://review.coreboot.org/c/coreboot/+/75298
Reviewed-by: Yidi Lin <yidilin@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/mainboard/google')
-rw-r--r-- | src/mainboard/google/corsola/display.c | 65 | ||||
-rw-r--r-- | src/mainboard/google/corsola/display.h | 4 | ||||
-rw-r--r-- | src/mainboard/google/corsola/panel_starmie.c | 24 |
3 files changed, 19 insertions, 74 deletions
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 <assert.h> #include <boardid.h> #include <cbfs.h> #include <console/console.h> -#include <delay.h> -#include <device/i2c_simple.h> #include <edid.h> #include <gpio.h> #include <soc/ddp.h> #include <soc/dsi.h> #include <soc/gpio_common.h> -#include <soc/i2c.h> #include <soc/mtcmos.h> #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 <console/console.h> #include <delay.h> #include <gpio.h> #include <soc/regulator.h> +#include <soc/tps65132s.h> #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); |