mb/google/corsola: Add support for AW37503 Power IC
The AW37503 is designed to supply positive/negative supply for driving the MIPI panel. It doesn't integrate non-volatile memory(EEPROM), so we need to program the registers at boot. We program the target positive/negative output voltage via I2C and enable the power rails by pulling up ENP and ENN pins. On Starmie, we need +/-6V power supply for the MIPI panel. We program the AW37503 registers in coreboot so that kernel can control AW37503 via fixed regulators without additional settings(what we did for TPS65132). Since we distinguish AW37503 and TPS65132 by reading the vendor ID, we need to initialize I2C bus as early as possible. Therefore, we move mtk_i2c_bus_init() to mainboard_init(). BUG=b:289482828 TEST=emerge-staryu coreboot chromeos-bootimage TEST=Test the sequence the voltage Change-Id: I9ccd4db19c93a032226f006eab0427f78f7b6dc8 Signed-off-by: Ruihai Zhou <zhouruihai@huaqin.corp-partner.google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/76219 Reviewed-by: Yu-Ping Wu <yupingso@google.com> Reviewed-by: cong yang <yangcong5@huaqin.corp-partner.google.com> Reviewed-by: Yidi Lin <yidilin@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
#include <boardid.h>
|
#include <boardid.h>
|
||||||
#include <cbfs.h>
|
#include <cbfs.h>
|
||||||
#include <console/console.h>
|
#include <console/console.h>
|
||||||
|
#include <device/i2c_simple.h>
|
||||||
#include <edid.h>
|
#include <edid.h>
|
||||||
#include <gpio.h>
|
#include <gpio.h>
|
||||||
#include <soc/ddp.h>
|
#include <soc/ddp.h>
|
||||||
@@ -13,11 +14,30 @@
|
|||||||
#include "display.h"
|
#include "display.h"
|
||||||
#include "gpio.h"
|
#include "gpio.h"
|
||||||
|
|
||||||
|
void aw37503_init(unsigned int bus)
|
||||||
|
{
|
||||||
|
i2c_write_field(bus, PMIC_AW37503_SLAVE, 0x00, 0x14, 0x1F, 0);
|
||||||
|
i2c_write_field(bus, PMIC_AW37503_SLAVE, 0x01, 0x14, 0x1F, 0);
|
||||||
|
i2c_write_field(bus, PMIC_AW37503_SLAVE, 0x21, 0x4C, 0xFF, 0);
|
||||||
|
i2c_write_field(bus, PMIC_AW37503_SLAVE, 0x03, 0x43, 0xFF, 0);
|
||||||
|
i2c_write_field(bus, PMIC_AW37503_SLAVE, 0x21, 0x00, 0xFF, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool is_pmic_aw37503(unsigned int bus)
|
||||||
|
{
|
||||||
|
u8 vendor_id;
|
||||||
|
return (!i2c_read_field(bus, PMIC_AW37503_SLAVE,
|
||||||
|
0x04, &vendor_id, 0x0F, 0) && vendor_id == 0x01);
|
||||||
|
}
|
||||||
|
|
||||||
static void backlight_control(void)
|
static void backlight_control(void)
|
||||||
{
|
{
|
||||||
/* Disable backlight before turning on bridge */
|
/* Disable backlight before turning on bridge */
|
||||||
gpio_output(GPIO_AP_EDP_BKLTEN, 0);
|
gpio_output(GPIO_AP_EDP_BKLTEN, 0);
|
||||||
gpio_output(GPIO_BL_PWM_1V8, 0);
|
gpio_output(GPIO_BL_PWM_1V8, 0);
|
||||||
|
/* For staryu variants, GPIO_EN_PP3300_DISP_X is controlled in
|
||||||
|
mipi_panel_power_on() */
|
||||||
|
if (!CONFIG(BOARD_GOOGLE_STARYU_COMMON))
|
||||||
gpio_output(GPIO_EN_PP3300_DISP_X, 1);
|
gpio_output(GPIO_EN_PP3300_DISP_X, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -8,7 +8,8 @@
|
|||||||
#include <soc/i2c.h>
|
#include <soc/i2c.h>
|
||||||
|
|
||||||
#define BRIDGE_I2C I2C0
|
#define BRIDGE_I2C I2C0
|
||||||
#define PMIC_TPS65132_I2C I2C6
|
#define PMIC_AW37503_SLAVE 0x3E
|
||||||
|
#define PMIC_I2C_BUS I2C6
|
||||||
|
|
||||||
struct panel_description {
|
struct panel_description {
|
||||||
void (*power_on)(void); /* Callback to turn on panel */
|
void (*power_on)(void); /* Callback to turn on panel */
|
||||||
@@ -18,6 +19,8 @@ struct panel_description {
|
|||||||
enum lb_fb_orientation orientation;
|
enum lb_fb_orientation orientation;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void aw37503_init(unsigned int bus);
|
||||||
|
bool is_pmic_aw37503(unsigned int bus);
|
||||||
int configure_display(void);
|
int configure_display(void);
|
||||||
uint32_t panel_id(void);
|
uint32_t panel_id(void);
|
||||||
|
|
||||||
|
@@ -48,6 +48,13 @@ static void mainboard_init(struct device *dev)
|
|||||||
if (configure_display() < 0)
|
if (configure_display() < 0)
|
||||||
printk(BIOS_ERR, "%s: Failed to init display\n", __func__);
|
printk(BIOS_ERR, "%s: Failed to init display\n", __func__);
|
||||||
} else {
|
} else {
|
||||||
|
if (CONFIG(BOARD_GOOGLE_STARYU_COMMON)) {
|
||||||
|
mtk_i2c_bus_init(PMIC_I2C_BUS, I2C_SPEED_FAST);
|
||||||
|
if (is_pmic_aw37503(PMIC_I2C_BUS)) {
|
||||||
|
printk(BIOS_DEBUG, "Initialize PMIC AW37503\n");
|
||||||
|
aw37503_init(PMIC_I2C_BUS);
|
||||||
|
}
|
||||||
|
}
|
||||||
printk(BIOS_INFO, "%s: Skipped display init\n", __func__);
|
printk(BIOS_INFO, "%s: Skipped display init\n", __func__);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,7 @@ static void mipi_panel_power_on(void)
|
|||||||
{ PMIC_TPS65132_ASSDD, 0x5b, 0xFF },
|
{ PMIC_TPS65132_ASSDD, 0x5b, 0xFF },
|
||||||
};
|
};
|
||||||
const struct tps65132s_cfg cfg = {
|
const struct tps65132s_cfg cfg = {
|
||||||
.i2c_bus = PMIC_TPS65132_I2C,
|
.i2c_bus = PMIC_I2C_BUS,
|
||||||
.en = GPIO_EN_PP3300_DISP_X,
|
.en = GPIO_EN_PP3300_DISP_X,
|
||||||
.sync = GPIO_EN_PP3300_SDBRDG_X,
|
.sync = GPIO_EN_PP3300_SDBRDG_X,
|
||||||
.settings = reg_settings,
|
.settings = reg_settings,
|
||||||
@@ -26,8 +26,17 @@ static void mipi_panel_power_on(void)
|
|||||||
};
|
};
|
||||||
|
|
||||||
mainboard_set_regulator_voltage(MTK_REGULATOR_VIO18, 1800000);
|
mainboard_set_regulator_voltage(MTK_REGULATOR_VIO18, 1800000);
|
||||||
if (tps65132s_setup(&cfg) != CB_SUCCESS)
|
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);
|
||||||
|
} else if (tps65132s_setup(&cfg) != CB_SUCCESS) {
|
||||||
printk(BIOS_ERR, "Failed to setup tps65132s\n");
|
printk(BIOS_ERR, "Failed to setup tps65132s\n");
|
||||||
|
}
|
||||||
|
|
||||||
/* DISP_RST_1V8_L */
|
/* DISP_RST_1V8_L */
|
||||||
gpio_output(GPIO_EDPBRDG_RST_L, 1);
|
gpio_output(GPIO_EDPBRDG_RST_L, 1);
|
||||||
|
@@ -30,10 +30,6 @@ enum cb_err tps65132s_setup(const struct tps65132s_cfg *cfg)
|
|||||||
u8 val;
|
u8 val;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Initialize I2C bus for PMIC TPS65132 */
|
|
||||||
mtk_i2c_bus_init(cfg->i2c_bus, I2C_SPEED_FAST);
|
|
||||||
mdelay(10);
|
|
||||||
|
|
||||||
gpio_output(cfg->en, 1);
|
gpio_output(cfg->en, 1);
|
||||||
gpio_output(cfg->sync, 1);
|
gpio_output(cfg->sync, 1);
|
||||||
mdelay(10);
|
mdelay(10);
|
||||||
|
Reference in New Issue
Block a user