mb/google/geralt: Enable BOE_NV110WUM_L60 panel for Ciri

The MIPI panel BOE_NV110WUM_L60 will be used for Ciri, enable it.
Also remove the `mdelay(10)` after mtk_i2c_bus_init, because MTK
confirms this is not needed. Add mdelay(2) between VDD18 and VSP/VSN
to meet the panel datasheet.

BUG=b:308968270
TEST=Boot to firmware screen
BRANCH=None

Change-Id: I0a04f062f81c543d38716d7ff185b5633c1aa3a9
Signed-off-by: Ruihai Zhou <zhouruihai@huaqin.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/78957
Reviewed-by: Yidi Lin <yidilin@google.com>
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/src/mainboard/google/geralt/Kconfig b/src/mainboard/google/geralt/Kconfig
index feac88a..7782267 100644
--- a/src/mainboard/google/geralt/Kconfig
+++ b/src/mainboard/google/geralt/Kconfig
@@ -42,6 +42,7 @@
 	select HAVE_LINEAR_FRAMEBUFFER
 	select RTC
 	select MIPI_PANEL_BOE_TV110C9M_LL0 if BOARD_GOOGLE_GERALT
+	select MIPI_PANEL_BOE_NV110WUM_L60 if BOARD_GOOGLE_CIRI
 	select FW_CONFIG
 	select FW_CONFIG_SOURCE_CHROMEEC_CBI
 
diff --git a/src/mainboard/google/geralt/Makefile.inc b/src/mainboard/google/geralt/Makefile.inc
index e954309..b1af289 100644
--- a/src/mainboard/google/geralt/Makefile.inc
+++ b/src/mainboard/google/geralt/Makefile.inc
@@ -24,4 +24,5 @@
 ramstage-y += panel.c
 ramstage-y += regulator.c
 ramstage-y += reset.c
+ramstage-$(CONFIG_BOARD_GOOGLE_CIRI) += panel_ciri.c
 ramstage-$(CONFIG_BOARD_GOOGLE_GERALT) += panel_geralt.c
diff --git a/src/mainboard/google/geralt/panel.c b/src/mainboard/google/geralt/panel.c
index 202eda7..3f55cac 100644
--- a/src/mainboard/google/geralt/panel.c
+++ b/src/mainboard/google/geralt/panel.c
@@ -3,10 +3,14 @@
 #include <boardid.h>
 #include <cbfs.h>
 #include <console/console.h>
+#include <delay.h>
 #include <edid.h>
 #include <gpio.h>
 #include <identity.h>
 #include <soc/gpio_common.h>
+#include <soc/i2c.h>
+#include <soc/pmif.h>
+#include <soc/regulator.h>
 #include <string.h>
 
 #include "gpio.h"
@@ -59,3 +63,22 @@
 
 	lb_add_gpios(gpios, backlight_gpios, ARRAY_SIZE(backlight_gpios));
 }
+
+void power_on_mipi_panel(const struct tps65132s_cfg *cfg)
+{
+	mtk_i2c_bus_init(cfg->i2c_bus, I2C_SPEED_FAST);
+
+	/* Enable VM18V */
+	mainboard_enable_regulator(MTK_REGULATOR_VDD18, true);
+	mdelay(2);
+	if (tps65132s_setup(cfg) != CB_SUCCESS)
+		printk(BIOS_ERR, "Failed to set up voltage regulator tps65132s\n");
+	gpio_output(GPIO_DISP_RST_1V8_L, 0);
+	mdelay(1);
+	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);
+}
diff --git a/src/mainboard/google/geralt/panel.h b/src/mainboard/google/geralt/panel.h
index 3d0fafd..7e07fb1 100644
--- a/src/mainboard/google/geralt/panel.h
+++ b/src/mainboard/google/geralt/panel.h
@@ -4,9 +4,11 @@
 #define __MAINBOARD_GOOGLE_GERALT_PANEL_H__
 
 #include <soc/display.h>
+#include <soc/tps65132s.h>
 
 void configure_mipi_pwm_backlight(void);
 void fill_lp_backlight_gpios(struct lb_gpios *gpios);
+void power_on_mipi_panel(const struct tps65132s_cfg *cfg);
 uint32_t panel_id(void);
 struct panel_description *get_panel_description(uint32_t panel_id);
 
diff --git a/src/mainboard/google/geralt/panel_ciri.c b/src/mainboard/google/geralt/panel_ciri.c
new file mode 100644
index 0000000..c50e2fa
--- /dev/null
+++ b/src/mainboard/google/geralt/panel_ciri.c
@@ -0,0 +1,48 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <console/console.h>
+#include <soc/i2c.h>
+
+#include "gpio.h"
+#include "panel.h"
+
+#define PMIC_TPS65132_I2C	I2C3
+
+static void power_on_mipi_himax_83102j(void)
+{
+	const struct tps65132s_reg_setting reg_settings[] = {
+		{ PMIC_TPS65132_VPOS, 0x11, 0x1f },
+		{ PMIC_TPS65132_VNEG, 0x11, 0x1f },
+		{ PMIC_TPS65132_DLYX, 0x55, 0xff },
+		{ PMIC_TPS65132_ASSDD, 0x5b, 0xff },
+	};
+	const struct tps65132s_cfg cfg = {
+		.i2c_bus = PMIC_TPS65132_I2C,
+		.en = GPIO_EN_PPVAR_MIPI_DISP,
+		.sync = GPIO_EN_PPVAR_MIPI_DISP_150MA,
+		.settings = reg_settings,
+		.setting_counts = ARRAY_SIZE(reg_settings),
+	};
+	power_on_mipi_panel(&cfg);
+}
+
+static struct panel_description ciri_panels[] = {
+	[17] = {
+		.name = "BOE_NV110WUM_L60",
+		.power_on = power_on_mipi_himax_83102j,
+		.configure_backlight = configure_mipi_pwm_backlight,
+		.orientation = LB_FB_ORIENTATION_LEFT_UP,
+		.disp_path = DISP_PATH_MIPI,
+		.pwm_ctrl_gpio = true,
+	},
+};
+
+struct panel_description *get_panel_description(uint32_t panel_id)
+{
+	uint32_t id = panel_id & 0xFF;
+
+	if (id >= ARRAY_SIZE(ciri_panels))
+		return NULL;
+
+	return &ciri_panels[id];
+}
diff --git a/src/mainboard/google/geralt/panel_geralt.c b/src/mainboard/google/geralt/panel_geralt.c
index 6eed3fb12..0b59a4e 100644
--- a/src/mainboard/google/geralt/panel_geralt.c
+++ b/src/mainboard/google/geralt/panel_geralt.c
@@ -1,15 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
-#include <boardid.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/tps65132s.h>
-#include <soc/pmif.h>
-#include <string.h>
 
 #include "gpio.h"
 #include "panel.h"
@@ -31,21 +23,7 @@
 		.settings = reg_settings,
 		.setting_counts = ARRAY_SIZE(reg_settings),
 	};
-
-	/* Enable VM18V */
-	mainboard_enable_regulator(MTK_REGULATOR_VDD18, true);
-	mtk_i2c_bus_init(PMIC_TPS65132_I2C, I2C_SPEED_FAST);
-	mdelay(10);
-	if (tps65132s_setup(&cfg) != CB_SUCCESS)
-		printk(BIOS_ERR, "Failed to set up voltage regulator tps65132s\n");
-	gpio_output(GPIO_DISP_RST_1V8_L, 0);
-	mdelay(1);
-	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);
+	power_on_mipi_panel(&cfg);
 }
 
 static struct panel_description panels[] = {