mb/google/corsola: Refactor mipi_panel_power_on function
Refactor mipi_panel_power_on function in panel-starmie.c to reduce code duplication. BUG=b:379810871 TEST=emerge-staryu coreboot chromeos-bootimage and check FW screen BRANCH=corsola Change-Id: Ic0561e57d99ab55e6dcbb7744b2228c4cebb0d88 Signed-off-by: Yang Wu <wuyang5@huaqin.corp-partner.google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/85745 Reviewed-by: Yu-Ping Wu <yupingso@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Yidi Lin <yidilin@google.com>
This commit is contained in:
parent
79f60c6b22
commit
745dcc861d
4 changed files with 49 additions and 33 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include <soc/display.h>
|
||||
#include <soc/i2c.h>
|
||||
#include <soc/tps65132s.h>
|
||||
|
||||
#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);
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
/* 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 "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[] = {
|
||||
|
|
|
|||
43
src/mainboard/google/corsola/panel_tps65132s.c
Normal file
43
src/mainboard/google/corsola/panel_tps65132s.c
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/* 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 "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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue