aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRex-BC Chen <rex-bc.chen@mediatek.com>2023-01-17 11:04:58 +0800
committerRex-BC Chen <rex-bc.chen@mediatek.com>2023-02-09 09:19:07 +0000
commitd7b7460d6e8a9fbd32c41e91a9d00dc536953310 (patch)
tree5cbace6ace8a86e761f41bb7f69e55d772ea0909
parent84bb5f4e1958b0fe82991b027ef0f166c109faa2 (diff)
mb/google/geralt: Add power-on sequence for BOE_TV110C9M_LL0
For Geralt, we use BOE_TV110C9M_LL0 as MIPI firmware display, so add the power-on sequence for BOE_TV110C9M_LL0. BUG=b:244208960 TEST=test firmware display pass for BOE_TV110C9M_LL0 on Geralt. Change-Id: I3ef0b2e26d8cc0dc35c2985363ee4c3557dac8a9 Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com> Signed-off-by: Liju-Clr Chen <liju-clr.chen@mediatek.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/72749 Reviewed-by: Yidi Lin <yidilin@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Yu-Ping Wu <yupingso@google.com>
-rw-r--r--src/mainboard/google/geralt/gpio.h3
-rw-r--r--src/mainboard/google/geralt/panel.c16
-rw-r--r--src/mainboard/google/geralt/panel.h1
-rw-r--r--src/mainboard/google/geralt/panel_geralt.c37
-rw-r--r--src/soc/mediatek/mt8188/Makefile.inc1
5 files changed, 57 insertions, 1 deletions
diff --git a/src/mainboard/google/geralt/gpio.h b/src/mainboard/google/geralt/gpio.h
index 7eec8f1506..36f488e7b8 100644
--- a/src/mainboard/google/geralt/gpio.h
+++ b/src/mainboard/google/geralt/gpio.h
@@ -18,6 +18,9 @@
#define GPIO_EDP_HPD_1V8 GPIO(GPIO17)
#define GPIO_EN_PP3300_EDP_DISP_X GPIO(DSI1_LCM_RST)
+#define GPIO_DISP_RST_1V8_L GPIO(DSI0_LCM_RST)
+#define GPIO_EN_PPVAR_MIPI_DISP GPIO(GPIO03)
+#define GPIO_EN_PPVAR_MIPI_DISP_150MA GPIO(GPIO04)
#define GPIO_MIPI_BL_PWM_1V8 GPIO(DISP_PWM0)
#define GPIO_SD_CD_ODL GPIO(I2SIN_MCK)
diff --git a/src/mainboard/google/geralt/panel.c b/src/mainboard/google/geralt/panel.c
index 3174870050..78d4f84bbd 100644
--- a/src/mainboard/google/geralt/panel.c
+++ b/src/mainboard/google/geralt/panel.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/gpio_common.h>
@@ -11,6 +12,21 @@
#include "gpio.h"
#include "panel.h"
+int panel_pmic_reg_mask(u32 bus, u8 chip, u8 addr, u8 val, u8 mask)
+{
+ u8 msg = 0;
+
+ if (i2c_read_field(bus, chip, addr, &msg, 0xFF, 0) < 0) {
+ printk(BIOS_ERR, "Failed to read i2c: addr(%u)\n", addr);
+ return -1;
+ }
+
+ msg &= ~mask;
+ msg |= val;
+
+ return i2c_write_field(bus, chip, addr, msg, 0xFF, 0);
+}
+
static void get_mipi_cmd_from_cbfs(struct panel_description *desc)
{
/*
diff --git a/src/mainboard/google/geralt/panel.h b/src/mainboard/google/geralt/panel.h
index 11b7fb0918..0335ece695 100644
--- a/src/mainboard/google/geralt/panel.h
+++ b/src/mainboard/google/geralt/panel.h
@@ -17,6 +17,7 @@ struct panel_description {
};
void fill_lp_backlight_gpios(struct lb_gpios *gpios);
+int panel_pmic_reg_mask(u32 bus, u8 chip, u8 addr, u8 val, u8 mask);
uint32_t panel_id(void);
struct panel_description *get_panel_description(uint32_t panel_id);
struct panel_description *get_active_panel(void);
diff --git a/src/mainboard/google/geralt/panel_geralt.c b/src/mainboard/google/geralt/panel_geralt.c
index bbb1060137..2991360506 100644
--- a/src/mainboard/google/geralt/panel_geralt.c
+++ b/src/mainboard/google/geralt/panel_geralt.c
@@ -2,13 +2,21 @@
#include <boardid.h>
#include <boot/coreboot_tables.h>
+#include <console/console.h>
+#include <delay.h>
#include <gpio.h>
#include <soc/gpio_common.h>
+#include <soc/i2c.h>
+#include <soc/regulator.h>
+#include <soc/pmif.h>
#include <string.h>
#include "gpio.h"
#include "panel.h"
+#define PMIC_TPS65132_I2C I2C3
+#define PMIC_TPS65132_SLAVE 0x3E
+
static void configure_mipi_pwm_backlight(void)
{
gpio_output(GPIO_AP_DISP_BKLTEN, 0);
@@ -22,7 +30,34 @@ static void configure_edp_aux_backlight(void)
static void power_on_mipi_boe_tv110c9m_ll0(void)
{
- /* TODO: Add the poweron for BOE_TV110C9M_LL0 when we get BOE_TV110C9M_LL0 */
+ /* Enable VM18V */
+ mainboard_enable_regulator(MTK_REGULATOR_VDD18, true);
+
+ /* Initialize I2C3 for PMIC TPS65132 */
+ mtk_i2c_bus_init(PMIC_TPS65132_I2C, I2C_SPEED_FAST);
+ mdelay(10);
+
+ gpio_output(GPIO_DISP_RST_1V8_L, 0);
+ mdelay(1);
+
+ gpio_output(GPIO_EN_PPVAR_MIPI_DISP, 1);
+ gpio_output(GPIO_EN_PPVAR_MIPI_DISP_150MA, 1);
+ mdelay(10);
+
+ /* Set AVDD = 5.7V */
+ if (panel_pmic_reg_mask(PMIC_TPS65132_I2C, PMIC_TPS65132_SLAVE, 0x00, 0x11, 0x1F) < 0)
+ return;
+
+ /* Set AVEE = -5.7V */
+ if (panel_pmic_reg_mask(PMIC_TPS65132_I2C, PMIC_TPS65132_SLAVE, 0x01, 0x11, 0x1F) < 0)
+ return;
+
+ gpio_output(GPIO_DISP_RST_1V8_L, 1);
+ mdelay(1);
+ gpio_output(GPIO_DISP_RST_1V8_L, 0);
+ mdelay(1);
+ gpio_output(GPIO_DISP_RST_1V8_L, 1);
+ mdelay(6);
}
static void power_on_edp_mutto_b152731e1(void)
diff --git a/src/soc/mediatek/mt8188/Makefile.inc b/src/soc/mediatek/mt8188/Makefile.inc
index 7ac988b750..95df6dc1d9 100644
--- a/src/soc/mediatek/mt8188/Makefile.inc
+++ b/src/soc/mediatek/mt8188/Makefile.inc
@@ -49,6 +49,7 @@ ramstage-y += ../common/mt6359p.c mt6359p.c
ramstage-y += ../common/mtcmos.c mtcmos.c
ramstage-y += ../common/pmif.c ../common/pmif_clk.c pmif_clk.c
ramstage-y += ../common/pmif_spi.c pmif_spi.c
+ramstage-y += ../common/pmif_spmi.c pmif_spmi.c
ramstage-y += ../common/rtc.c ../common/rtc_osc_init.c ../common/rtc_mt6359p.c
ramstage-y += soc.c
ramstage-y += ../common/spm.c spm.c