summaryrefslogtreecommitdiff
path: root/src/mainboard
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainboard')
-rw-r--r--src/mainboard/google/kukui/mainboard.c4
-rw-r--r--src/mainboard/google/kukui/panel.h1
-rw-r--r--src/mainboard/google/kukui/panel_anx7625.c57
3 files changed, 36 insertions, 26 deletions
diff --git a/src/mainboard/google/kukui/mainboard.c b/src/mainboard/google/kukui/mainboard.c
index a197a7f009..7efa01b0cc 100644
--- a/src/mainboard/google/kukui/mainboard.c
+++ b/src/mainboard/google/kukui/mainboard.c
@@ -168,6 +168,10 @@ static bool configure_display(void)
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);
struct fb_info *info = fb_new_framebuffer_info_from_edid(edid, 0);
if (info)
diff --git a/src/mainboard/google/kukui/panel.h b/src/mainboard/google/kukui/panel.h
index 7ae31dd791..174956551d 100644
--- a/src/mainboard/google/kukui/panel.h
+++ b/src/mainboard/google/kukui/panel.h
@@ -21,6 +21,7 @@ struct panel_description {
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 cc41c86e63..aa22cf3edf 100644
--- a/src/mainboard/google/kukui/panel_anx7625.c
+++ b/src/mainboard/google/kukui/panel_anx7625.c
@@ -9,6 +9,33 @@
#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)
{
/* Disable backlight before turning on bridge */
@@ -27,43 +54,21 @@ static void power_on_anx7625(void)
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;
}