mb/google/kukui: Add panel api after dsi start

Some bridge chip or panel requires dsi signal output before dsi
receiver works.

BUG=b:168728787
BRANCH=kukui
TEST=Display is normal on Kukui

Original-signed-off-by: Jitao Shi <jitao.shi@mediatek.com>
Original-change-Id: I3bded27087490f32ee233e615cfad1fd05fb582d
Original-reviewed-on: https://review.coreboot.org/c/coreboot/+/47380
Original-tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Original-reviewed-by: Yu-Ping Wu <yupingso@google.com>
Change-Id: Ifdcc90502d22eeb23448a6c47cf24fd4880eae27
Signed-off-by: Yu-Ping Wu <yupingso@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/coreboot/+/2608238
diff --git a/src/mainboard/google/kukui/mainboard.c b/src/mainboard/google/kukui/mainboard.c
index cbcb5da..33eed56 100644
--- a/src/mainboard/google/kukui/mainboard.c
+++ b/src/mainboard/google/kukui/mainboard.c
@@ -168,6 +168,10 @@
 		printk(BIOS_ERR, "%s: Failed in DSI init.\n", __func__);
 		return false;
 	}
+
+	if (panel->post_power_on)
+		panel->post_power_on();
+
 	mtk_ddp_mode_set(edid);
 	set_vbe_mode_info_valid(edid, 0);
 	set_vbe_framebuffer_orientation(panel->s->orientation);
diff --git a/src/mainboard/google/kukui/panel.h b/src/mainboard/google/kukui/panel.h
index 7ae31dd..1749565 100644
--- a/src/mainboard/google/kukui/panel.h
+++ b/src/mainboard/google/kukui/panel.h
@@ -21,6 +21,7 @@
 	const char *name;  /* Panel name for constructing CBFS file name */
 	struct panel_serializable_data *s;
 	void (*power_on)(void);  /* Callback to turn on panel */
+	void (*post_power_on)(void);  /* Callback to run after panel is turned on */
 };
 
 /* Returns the panel description from given ID. */
diff --git a/src/mainboard/google/kukui/panel_anx7625.c b/src/mainboard/google/kukui/panel_anx7625.c
index 5685661..885709e 100644
--- a/src/mainboard/google/kukui/panel_anx7625.c
+++ b/src/mainboard/google/kukui/panel_anx7625.c
@@ -10,6 +10,32 @@
 
 #include "panel.h"
 
+#define ANX7625_I2C_BUS 4
+
+static struct panel_serializable_data anx7625_data = {
+	.orientation = LB_FB_ORIENTATION_NORMAL,
+	.init = { INIT_END_CMD },
+};
+
+static void dummy_power_on(void)
+{
+	/*
+	 * The panel has been already powered on when getting panel information
+	 * so we should do nothing here.
+	 */
+}
+
+static void start_anx7625(void)
+{
+	if (anx7625_dp_start(ANX7625_I2C_BUS, &anx7625_data.edid) < 0)
+		printk(BIOS_ERR, "Can't start display via ANX7625.\n");
+}
+
+static struct panel_description anx7625_panel = {
+	.s = &anx7625_data,
+	.power_on = dummy_power_on,
+	.post_power_on = start_anx7625,
+};
 
 static void power_on_anx7625(void)
 {
@@ -29,43 +55,21 @@
 	gpio_output(GPIO_PP3300_LCM_EN, 1);
 }
 
-static void dummy_power_on(void)
-{
-	/* The panel has been already powered on when getting panel information
-	 * so we should do nothing here.
-	 */
-}
-
-static struct panel_serializable_data anx7625_data = {
-	.orientation = LB_FB_ORIENTATION_NORMAL,
-	.init = { INIT_END_CMD },
-};
-
-static struct panel_description anx7625_panel = {
-	.s = &anx7625_data,
-	.power_on = dummy_power_on,
-};
-
 struct panel_description *get_panel_description(int panel_id)
 {
 	/* To read panel EDID, we have to first power on anx7625. */
 	power_on_anx7625();
 
-	u8 i2c_bus = 4;
-	mtk_i2c_bus_init(i2c_bus);
+	mtk_i2c_bus_init(ANX7625_I2C_BUS);
 
-	if (anx7625_init(i2c_bus)) {
+	if (anx7625_init(ANX7625_I2C_BUS)) {
 		printk(BIOS_ERR, "Can't init ANX7625 bridge.\n");
 		return NULL;
 	}
-	struct edid *edid = &anx7625_data.edid;
-	if (anx7625_dp_get_edid(i2c_bus, edid)) {
+
+	if (anx7625_dp_get_edid(ANX7625_I2C_BUS, &anx7625_data.edid)) {
 		printk(BIOS_ERR, "Can't get panel's edid.\n");
 		return NULL;
 	}
-	if (anx7625_dp_start(i2c_bus, edid) < 0) {
-		printk(BIOS_ERR, "Can't start display via ANX7625.\n");
-		return NULL;
-	}
 	return &anx7625_panel;
 }