diff --git a/src/mainboard/google/corsola/Makefile.mk b/src/mainboard/google/corsola/Makefile.mk index 09e9b91758..6ff22c6073 100644 --- a/src/mainboard/google/corsola/Makefile.mk +++ b/src/mainboard/google/corsola/Makefile.mk @@ -22,6 +22,8 @@ ramstage-y += mainboard.c ramstage-y += panel.c ramstage-y += panel_anx7625.c ramstage-y += panel_ps8640.c +ramstage-y += panel_tps65132s.c + ramstage-y += regulator.c ramstage-y += reset.c diff --git a/src/mainboard/google/corsola/panel.h b/src/mainboard/google/corsola/panel.h index a4198f3ecd..01606f4dab 100644 --- a/src/mainboard/google/corsola/panel.h +++ b/src/mainboard/google/corsola/panel.h @@ -5,6 +5,7 @@ #include #include +#include #define BRIDGE_I2C I2C0 #define PMIC_AW37503_SLAVE 0x3E @@ -14,6 +15,7 @@ void aw37503_init(unsigned int bus); bool is_pmic_aw37503(unsigned int bus); uint32_t panel_id(void); void backlight_control(void); +void tps65132s_power_on(struct tps65132s_cfg *config); /* Return the mipi panel description from given panel id */ struct panel_description *get_panel_description(void); diff --git a/src/mainboard/google/corsola/panel_starmie.c b/src/mainboard/google/corsola/panel_starmie.c index 1de2c61a08..5a1228cddf 100644 --- a/src/mainboard/google/corsola/panel_starmie.c +++ b/src/mainboard/google/corsola/panel_starmie.c @@ -1,9 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ #include -#include -#include -#include #include #include "gpio.h" @@ -11,40 +8,12 @@ static void mipi_panel_power_on(void) { - 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 = { + struct tps65132s_cfg config = { .i2c_bus = PMIC_I2C_BUS, .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); - mtk_i2c_bus_init(PMIC_I2C_BUS, I2C_SPEED_FAST); - - if (is_pmic_aw37503(PMIC_I2C_BUS)) { - printk(BIOS_DEBUG, "Initialize and power on PMIC AW37503\n"); - aw37503_init(PMIC_I2C_BUS); - gpio_output(GPIO_EN_PP3300_DISP_X, 1); - mdelay(2); - gpio_output(GPIO_EN_PP3300_SDBRDG_X, 1); - mdelay(3); - } else 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); - gpio_output(GPIO_EDPBRDG_RST_L, 0); - udelay(20); - gpio_output(GPIO_EDPBRDG_RST_L, 1); + tps65132s_power_on(&config); } static struct panel_description starmie_panels[] = { diff --git a/src/mainboard/google/corsola/panel_tps65132s.c b/src/mainboard/google/corsola/panel_tps65132s.c new file mode 100644 index 0000000000..36933c0bc7 --- /dev/null +++ b/src/mainboard/google/corsola/panel_tps65132s.c @@ -0,0 +1,43 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include +#include +#include +#include + +#include "gpio.h" +#include "panel.h" + +void tps65132s_power_on(struct tps65132s_cfg *config) +{ + 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 }, + }; + config->settings = reg_settings; + config->setting_counts = ARRAY_SIZE(reg_settings); + + mainboard_set_regulator_voltage(MTK_REGULATOR_VIO18, 1800000); + mtk_i2c_bus_init(config->i2c_bus, I2C_SPEED_FAST); + + if (is_pmic_aw37503(config->i2c_bus)) { + printk(BIOS_DEBUG, "Initialize and power on PMIC AW37503\n"); + aw37503_init(config->i2c_bus); + gpio_output(config->en, 1); + mdelay(2); + gpio_output(config->sync, 1); + mdelay(3); + } else if (tps65132s_setup(config) != CB_SUCCESS) { + printk(BIOS_ERR, "Failed to setup tps65132s\n"); + } + + /* DISP_RST_1V8_L */ + gpio_output(GPIO_EDPBRDG_RST_L, 1); + mdelay(1); + gpio_output(GPIO_EDPBRDG_RST_L, 0); + udelay(20); + gpio_output(GPIO_EDPBRDG_RST_L, 1); +}