summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mainboard/google/corsola/display.c22
-rw-r--r--src/mainboard/google/corsola/display.h5
-rw-r--r--src/mainboard/google/corsola/mainboard.c7
-rw-r--r--src/mainboard/google/corsola/panel_starmie.c13
-rw-r--r--src/soc/mediatek/common/tps65132s.c4
5 files changed, 43 insertions, 8 deletions
diff --git a/src/mainboard/google/corsola/display.c b/src/mainboard/google/corsola/display.c
index a66d92e8e3..79f6b81d53 100644
--- a/src/mainboard/google/corsola/display.c
+++ b/src/mainboard/google/corsola/display.c
@@ -3,6 +3,7 @@
#include <boardid.h>
#include <cbfs.h>
#include <console/console.h>
+#include <device/i2c_simple.h>
#include <edid.h>
#include <gpio.h>
#include <soc/ddp.h>
@@ -13,12 +14,31 @@
#include "display.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)
{
/* Disable backlight before turning on bridge */
gpio_output(GPIO_AP_EDP_BKLTEN, 0);
gpio_output(GPIO_BL_PWM_1V8, 0);
- gpio_output(GPIO_EN_PP3300_DISP_X, 1);
+ /* 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);
}
struct panel_description *get_panel_from_cbfs(struct panel_description *desc)
diff --git a/src/mainboard/google/corsola/display.h b/src/mainboard/google/corsola/display.h
index 11d2f24faf..7631bb9bae 100644
--- a/src/mainboard/google/corsola/display.h
+++ b/src/mainboard/google/corsola/display.h
@@ -8,7 +8,8 @@
#include <soc/i2c.h>
#define BRIDGE_I2C I2C0
-#define PMIC_TPS65132_I2C I2C6
+#define PMIC_AW37503_SLAVE 0x3E
+#define PMIC_I2C_BUS I2C6
struct panel_description {
void (*power_on)(void); /* Callback to turn on panel */
@@ -18,6 +19,8 @@ struct panel_description {
enum lb_fb_orientation orientation;
};
+void aw37503_init(unsigned int bus);
+bool is_pmic_aw37503(unsigned int bus);
int configure_display(void);
uint32_t panel_id(void);
diff --git a/src/mainboard/google/corsola/mainboard.c b/src/mainboard/google/corsola/mainboard.c
index b6823c671c..b2c65eb411 100644
--- a/src/mainboard/google/corsola/mainboard.c
+++ b/src/mainboard/google/corsola/mainboard.c
@@ -48,6 +48,13 @@ static void mainboard_init(struct device *dev)
if (configure_display() < 0)
printk(BIOS_ERR, "%s: Failed to init display\n", __func__);
} 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__);
}
}
diff --git a/src/mainboard/google/corsola/panel_starmie.c b/src/mainboard/google/corsola/panel_starmie.c
index 9306960309..106f722080 100644
--- a/src/mainboard/google/corsola/panel_starmie.c
+++ b/src/mainboard/google/corsola/panel_starmie.c
@@ -18,7 +18,7 @@ static void mipi_panel_power_on(void)
{ PMIC_TPS65132_ASSDD, 0x5b, 0xFF },
};
const struct tps65132s_cfg cfg = {
- .i2c_bus = PMIC_TPS65132_I2C,
+ .i2c_bus = PMIC_I2C_BUS,
.en = GPIO_EN_PP3300_DISP_X,
.sync = GPIO_EN_PP3300_SDBRDG_X,
.settings = reg_settings,
@@ -26,8 +26,17 @@ static void mipi_panel_power_on(void)
};
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");
+ }
/* DISP_RST_1V8_L */
gpio_output(GPIO_EDPBRDG_RST_L, 1);
diff --git a/src/soc/mediatek/common/tps65132s.c b/src/soc/mediatek/common/tps65132s.c
index 4683a43072..5a29035123 100644
--- a/src/soc/mediatek/common/tps65132s.c
+++ b/src/soc/mediatek/common/tps65132s.c
@@ -30,10 +30,6 @@ enum cb_err tps65132s_setup(const struct tps65132s_cfg *cfg)
u8 val;
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->sync, 1);
mdelay(10);