diff options
author | Ruihai Zhou <zhouruihai@huaqin.corp-partner.google.com> | 2023-07-03 20:10:28 +0800 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2023-07-10 14:19:13 +0000 |
commit | 266e6557ba50a33fd1290f64552dc76d7fb48151 (patch) | |
tree | 7549e8b104f31a7accf0dd661ad0cab87d6e6581 /src/mainboard | |
parent | a8602a17bc7a18d29ffcb96e193a37903efe0394 (diff) |
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>
Diffstat (limited to 'src/mainboard')
-rw-r--r-- | src/mainboard/google/corsola/display.c | 22 | ||||
-rw-r--r-- | src/mainboard/google/corsola/display.h | 5 | ||||
-rw-r--r-- | src/mainboard/google/corsola/mainboard.c | 7 | ||||
-rw-r--r-- | src/mainboard/google/corsola/panel_starmie.c | 13 |
4 files changed, 43 insertions, 4 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); |